Add option to onos-power script for user
also remove extra argument to onos-die call
Change-Id: I43b6a2c4dbe05396d82d25c13f846db39de4a7fb
diff --git a/tools/test/bin/onos-power b/tools/test/bin/onos-power
index 8b37c5d..fc684ca 100755
--- a/tools/test/bin/onos-power
+++ b/tools/test/bin/onos-power
@@ -13,22 +13,23 @@
node=${1:-$OCI}
cmd=${2:-on}
+user=${3:$(id -un)}
if [ "$cmd" = "on" ]; then
if [ -n "$HARD_POWER_OFF" -a $ONOS_CELL = "borrow" ]; then
- curl -sS -X PUT "http://$CELL_WARDEN:4321/?cmd=powerOn&nodeIp=$node&user=$(id -un)"
+ curl -sS -X PUT "http://$CELL_WARDEN:4321/?cmd=powerOn&nodeIp=$node&user=$user"
else
onos-service $node start
fi
elif [ "$cmd" = "off" ]; then
if [ -n "$HARD_POWER_OFF" -a $ONOS_CELL = "borrow" ]; then
- curl -sS -X PUT "http://$CELL_WARDEN:4321/?cmd=powerOff&nodeIp=$node&user=$(id -un)"
+ curl -sS -X PUT "http://$CELL_WARDEN:4321/?cmd=powerOff&nodeIp=$node&user=$user"
else
- onos-die $node start
+ onos-die $node
fi
else
- echo "usage: $(basename $0) node-ip {on|off}" >&2 && exit 1
+ echo "usage: $(basename $0) node-ip {on|off} user" >&2 && exit 1
fi