Add a script to copy keys from test-station to cell nodes

Change-Id: Icbaf3c19d4663e709e640d68e6caa325d9b30f36
diff --git a/TestON/bin/copy-key-to-cells.sh b/TestON/bin/copy-key-to-cells.sh
new file mode 100755
index 0000000..d6555eb
--- /dev/null
+++ b/TestON/bin/copy-key-to-cells.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+# ------------------------------------------------------------------------
+# This script is a workaround for the key collision issue when loging into
+# onos cli from both test-station and onos cells with identical user names.
+# It copies both private and public keys of localhost (test-station) to
+# all remote hosts specified in your cell.
+# It also backs up the original keys of the remote hosts before
+# overwriting them.
+# Setting up passwordless login is recommended before running the script.
+# ------------------------------------------------------------------------
+
+ADDRESSES=()
+# Check if OC1 to OC7 exist
+for i in $(seq 1 7); do
+    if [ -n "$OC$i" ]; then
+        TEMP=OC$i
+        ADDRESSES+=(${!TEMP})
+    fi
+done
+
+# Check if OCN exists
+[ -n "$OCN" ] && ADDRESSES+=($OCN)
+
+# Copy keys to remote hosts
+for address in "${ADDRESSES[@]}"; do
+    echo "Backing up remote keys on" $address
+    ssh sdn@$address "cd ~/.ssh; \
+    cp id_rsa id_rsa.old; \
+    cp id_rsa.pub id_rsa.pub.old; "
+
+    echo "Copying keys to" $address
+    scp ~/.ssh/id_rsa sdn@$address:~/.ssh/
+    scp ~/.ssh/id_rsa.pub sdn@$address:~/.ssh/
+done