| # ----------------------------------------------------------------------------- |
| # Executes a command on the given ONOS instance and matches the output |
| # First argument is the IP address of the machine to run the command on, |
| # then you pass the command and it's arguments if needed, then --expect and |
| # after it the string of what the output should be. |
| # onos-execute-expect 1.1.1.1 fooCommand fooParamenter --expect fooOutputString |
| # ----------------------------------------------------------------------------- |
| [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| . $ONOS_ROOT/tools/build/envDefaults |
| trap "rm -f $aux 2>/dev/null" EXIT |
| for a in ${*:2}; do shift; if [ "$a" = "--expect" ]; then break; fi; cmd="$cmd $a"; done |
| grep -q $expect $aux && echo "expected value found" && exit 0 |