blob: 498935772bb43b45ae173818119d5480d3171908 [file] [log] [blame]
Ray Milkey0b53f952018-04-02 08:54:51 -07001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Finds a host 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-host: $*
13
14target=${1:-$OCI}
15mac=$2
16locations=$3
17ips=$4
18set -x
19
20onos $target "onos:hosts" | tee $aux
21cat $aux | fgrep "mac=$mac" | fgrep "locations=[$locations]" | grep "ip.*[.*$ips.*]"
22
23if [ $? -ne 0 ]
24then
25 exit 1;
26fi
27
28exit 0
29