blob: ec4e015005e8b885b90a4695df19e1ba47ddc4f8 [file] [log] [blame]
Ray Milkey23f27952018-11-02 14:05:28 -07001#!/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
10node=$(find_node ${1})
11cmd="$2"
12
13remote=$ONOS_USER@$node
14
15for 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
18done
19
20exit 1
21