Ray Milkey | 23f2795 | 2018-11-02 14:05:28 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Waits for a CLI command to be runnable. |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
| 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 7 | . $ONOS_ROOT/tools/build/envDefaults |
| 8 | . $ONOS_ROOT/tools/test/bin/find-node.sh |
| 9 | |
| 10 | node=$(find_node ${1}) |
| 11 | cmd="$2" |
| 12 | |
| 13 | remote=$ONOS_USER@$node |
| 14 | |
| 15 | for i in {1..10}; do |
| 16 | $ONOS_ROOT/tools/test/bin/onos $node ${cmd} 2>/dev/null | \ |
| 17 | grep -q -v 'Command not found:' && exit 0 || sleep 3 |
| 18 | done |
| 19 | |
| 20 | exit 1 |
| 21 | |