Ray Milkey | 51cf307 | 2018-12-11 08:46:52 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Finds a device in the system. |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
| 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 7 | . $ONOS_ROOT/tools/build/envDefaults |
| 8 | |
| 9 | aux=/tmp/stc/stc-$$.log |
| 10 | trap "rm -f $aux 2>/dev/null" EXIT |
| 11 | |
| 12 | echo onos-find-device: $* |
| 13 | |
| 14 | target=${1:-$OCI} |
| 15 | id=$2 |
| 16 | |
| 17 | onos $target "onos:devices" | tee $aux |
| 18 | cat $aux | fgrep "id=$id" |
| 19 | |
| 20 | if [ $? -ne 0 ] |
| 21 | then |
| 22 | exit 1; |
| 23 | fi |
| 24 | |
| 25 | exit 0 |
| 26 | |