2 # Connect to ODL Karaf shell. Mostly used for testing.
4 # Output verbose debug info (true) or not (anything else)
6 # Port that the Karaf shell listens on
9 # This could be done with public key crypto, but sshpass is easier
10 if ! command -v sshpass &> /dev/null; then
11 echo "Installing sshpass. It's used connecting non-interactively"
12 if "$VERBOSE" = true; then
13 sudo yum install -y sshpass
15 sudo yum install -y sshpass &> /dev/null
19 echo "Will repeatedly attempt connecting to Karaf shell until it's ready"
20 # Loop until exit status 0 (success) given by Karaf shell
21 # Exit status 255 means Karaf shell isn't open for SSH connections yet
22 # Exit status 1 means `dropAllPacketsRpc on` isn't runnable yet
23 until sshpass -p karaf ssh -p $KARAF_SHELL_PORT -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PreferredAuthentications=password karaf@localhost
25 echo "Karaf shell isn't ready yet, sleeping 5 seconds..."