| # ----------------------------------------------------------------------------- |
| # Checks vnet related entities (tenantId, networkId). |
| # ----------------------------------------------------------------------------- |
| [ ! -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 |
| command_name=`basename $0` |
| echo "usage: $command_name <node-ip> checkTenant <tenantId>" >&2 |
| echo " $command_name <node-ip> getNetworkId <tenantId>" >&2 |
| function extractAndPublishNetworkId() { |
| if [[ $token =~ "networkId=" ]] |
| [ $# -lt 3 ] || [ "$1" = "-h" ] && usage && exit 0 |
| onos $target "vnet-tenants" | tee $aux |
| grep -w $3 $aux && exit 0 |
| onos $target "vnets" | tee $aux |
| aString=`grep "tenantId=$3," $aux | tail -1` #get last row |
| extractAndPublishNetworkId && exit 0 |