Utility to clean known_hosts
- utility to clean known_hosts when identities of nodes defined in the cell changed
Change-Id: Iab818ca9d888cfb58c98f16f62174cc75a4f32b7
diff --git a/tools/test/bin/onos-remove-cell-sshkeys b/tools/test/bin/onos-remove-cell-sshkeys
new file mode 100755
index 0000000..3c7b70c
--- /dev/null
+++ b/tools/test/bin/onos-remove-cell-sshkeys
@@ -0,0 +1,9 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Removes known_host entries about current ONOS cell.
+# -----------------------------------------------------------------------------
+
+for host in $OCT $OCN $(env | egrep "^OC[0-9]+" | cut -d '=' -f 2); do
+ ssh-keygen -F "$host" >/dev/null && ssh-keygen -R "$host"
+ ssh-keygen -F "[$host]:8101" >/dev/null && ssh-keygen -R "[$host]:8101"
+done