STC scenario to test administrative enable and disable of a port
Change-Id: I69026a7ada071bf06f3505666712778350b6969f
(cherry picked from commit f16975bffab4ec4e8c4e99662232c3ade0197532)
diff --git a/tools/test/scenarios/bin/onos-change-device-portstate b/tools/test/scenarios/bin/onos-change-device-portstate
new file mode 100755
index 0000000..bc69d98
--- /dev/null
+++ b/tools/test/scenarios/bin/onos-change-device-portstate
@@ -0,0 +1,32 @@
+#! /usr/bin/env python
+
+import requests
+
+from requests.auth import HTTPBasicAuth
+import sys
+
+
+
+if len(sys.argv) != 5:
+ print "usage: change-device-portstate onos-node device-id port new_enabled_state"
+ sys.exit(1)
+
+node = sys.argv[1]
+device_id = sys.argv[2]
+port = sys.argv[3]
+new_enabled_state = sys.argv[4]
+
+payload = '{ "enabled": ' + new_enabled_state + ' }'
+
+change_request = requests.post('http://' + node + ':8181/onos/v1/devices/' + device_id + '/portstate/' + port,
+ auth=HTTPBasicAuth('onos', 'rocks'),
+ data=payload)
+
+if change_request.status_code != 200:
+ print change_request.text
+ sys.exit(1)
+
+sys.exit(0)
+
+
+