| # ----------------------------------------------------------------------------- |
| # Executes a command on the given ONOS instance and matches the output |
| # to the passed after X retries. |
| # 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 or --retry and the maximum |
| # retries with 5 seconds delay between them |
| # onos-execute-expect 1.1.1.1 fooCommand fooParamenter --retry 5 --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 |
| if [ "${!i}" = "--expect" ]; then |
| elif [ "${!i}" = "--retry" ]; then |
| grep -q $expct $aux && echo "expected value found" && exit 0 |