blob: fbf1692e41c8fc46bf99755f29ce2ae6d679102f [file] [log] [blame]
Ray Milkey51cf3072018-12-11 08:46:52 -08001#!/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
9aux=/tmp/stc/stc-$$.log
10trap "rm -f $aux 2>/dev/null" EXIT
11
12echo onos-find-device: $*
13
14target=${1:-$OCI}
15id=$2
16
17onos $target "onos:devices" | tee $aux
18cat $aux | fgrep "id=$id"
19
20if [ $? -ne 0 ]
21then
22 exit 1;
23fi
24
25exit 0
26