From 13d05bc8458758ee39cb829098241e89616717ee Mon Sep 17 00:00:00 2001 From: Ashlee Young Date: Wed, 9 Sep 2015 22:15:21 -0700 Subject: ONOS checkin based on commit tag e796610b1f721d02f9b0e213cf6f7790c10ecd60 Change-Id: Ife8810491034fe7becdba75dda20de4267bd15cd --- .../src/onos/tools/test/scenarios/archetypes.xml | 50 +++++++ .../onos/tools/test/scenarios/bin/create-flow.py | 56 ++++++++ .../onos/tools/test/scenarios/bin/create-intent.py | 49 +++++++ .../onos/tools/test/scenarios/bin/find-device.py | 39 +++++ .../src/onos/tools/test/scenarios/bin/find-flow.py | 40 ++++++ .../src/onos/tools/test/scenarios/bin/find-host.py | 36 +++++ .../src/onos/tools/test/scenarios/bin/find-link.py | 45 ++++++ .../src/onos/tools/test/scenarios/example.xml | 19 +++ .../onos/tools/test/scenarios/net-create-flows.xml | 93 ++++++++++++ .../onos/tools/test/scenarios/net-host-intent.xml | 59 ++++++++ .../onos/tools/test/scenarios/net-link-down-up.xml | 38 +++++ .../src/onos/tools/test/scenarios/net-pingall.xml | 37 +++++ .../onos/tools/test/scenarios/net-point-intent.xml | 77 ++++++++++ .../src/onos/tools/test/scenarios/net-rest.xml | 160 +++++++++++++++++++++ .../src/onos/tools/test/scenarios/net-setup.xml | 46 ++++++ .../src/onos/tools/test/scenarios/net-smoke.xml | 44 ++++++ .../src/onos/tools/test/scenarios/net-teardown.xml | 21 +++ .../onos/tools/test/scenarios/prerequisites.xml | 26 ++++ framework/src/onos/tools/test/scenarios/setup.xml | 47 ++++++ .../src/onos/tools/test/scenarios/shutdown.xml | 24 ++++ framework/src/onos/tools/test/scenarios/smoke.xml | 30 ++++ .../src/onos/tools/test/scenarios/startup.xml | 26 ++++ .../src/onos/tools/test/scenarios/tar-setup.xml | 64 +++++++++ framework/src/onos/tools/test/scenarios/wrapup.xml | 24 ++++ 24 files changed, 1150 insertions(+) create mode 100644 framework/src/onos/tools/test/scenarios/archetypes.xml create mode 100755 framework/src/onos/tools/test/scenarios/bin/create-flow.py create mode 100755 framework/src/onos/tools/test/scenarios/bin/create-intent.py create mode 100755 framework/src/onos/tools/test/scenarios/bin/find-device.py create mode 100755 framework/src/onos/tools/test/scenarios/bin/find-flow.py create mode 100755 framework/src/onos/tools/test/scenarios/bin/find-host.py create mode 100755 framework/src/onos/tools/test/scenarios/bin/find-link.py create mode 100644 framework/src/onos/tools/test/scenarios/example.xml create mode 100644 framework/src/onos/tools/test/scenarios/net-create-flows.xml create mode 100644 framework/src/onos/tools/test/scenarios/net-host-intent.xml create mode 100644 framework/src/onos/tools/test/scenarios/net-link-down-up.xml create mode 100644 framework/src/onos/tools/test/scenarios/net-pingall.xml create mode 100644 framework/src/onos/tools/test/scenarios/net-point-intent.xml create mode 100644 framework/src/onos/tools/test/scenarios/net-rest.xml create mode 100644 framework/src/onos/tools/test/scenarios/net-setup.xml create mode 100644 framework/src/onos/tools/test/scenarios/net-smoke.xml create mode 100644 framework/src/onos/tools/test/scenarios/net-teardown.xml create mode 100644 framework/src/onos/tools/test/scenarios/prerequisites.xml create mode 100644 framework/src/onos/tools/test/scenarios/setup.xml create mode 100644 framework/src/onos/tools/test/scenarios/shutdown.xml create mode 100644 framework/src/onos/tools/test/scenarios/smoke.xml create mode 100644 framework/src/onos/tools/test/scenarios/startup.xml create mode 100644 framework/src/onos/tools/test/scenarios/tar-setup.xml create mode 100644 framework/src/onos/tools/test/scenarios/wrapup.xml (limited to 'framework/src/onos/tools/test/scenarios') diff --git a/framework/src/onos/tools/test/scenarios/archetypes.xml b/framework/src/onos/tools/test/scenarios/archetypes.xml new file mode 100644 index 00000000..8244a32f --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/archetypes.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/src/onos/tools/test/scenarios/bin/create-flow.py b/framework/src/onos/tools/test/scenarios/bin/create-flow.py new file mode 100755 index 00000000..4e9b452b --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/bin/create-flow.py @@ -0,0 +1,56 @@ +#! /usr/bin/env python + +import requests + +from requests.auth import HTTPBasicAuth +import sys + + + +if len(sys.argv) != 6: + print "usage: create-flow onos-node name device in-port out-port" + sys.exit(1) + +node = sys.argv[1] +name = sys.argv[2] +device = sys.argv[3] +inPort = sys.argv[4] +outPort = sys.argv[5] + +flowJsonTemplate = \ + '{{' + \ + '"priority": 1,' + \ + '"isPermanent": true,' + \ + '"treatment": {{' + \ + '"instructions": [' + \ + '{{' + \ + '"type": "OUTPUT",' + \ + '"port": {}' + \ + '}}' + \ + ']' + \ + '}},' + \ + '"selector": {{' + \ + '"criteria": [' + \ + '{{' + \ + '"type": "IN_PORT",' + \ + '"port": {}' + \ + '}}' + \ + ']' + \ + '}}' + \ + '}}' + +flowJson = flowJsonTemplate.format(inPort, outPort) +intentRequest = requests.post('http://' + node + ':8181/onos/v1/flows/' + device, + auth=HTTPBasicAuth('onos', 'rocks'), + data=flowJson) + +if intentRequest.status_code != 201: + print intentRequest.text + sys.exit(1) + +location = intentRequest.headers["location"] +print "@stc " + name + "Location=" + location +sys.exit(0) + + + diff --git a/framework/src/onos/tools/test/scenarios/bin/create-intent.py b/framework/src/onos/tools/test/scenarios/bin/create-intent.py new file mode 100755 index 00000000..4e5d4f62 --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/bin/create-intent.py @@ -0,0 +1,49 @@ +#! /usr/bin/env python + +import requests + +from requests.auth import HTTPBasicAuth +import sys + + + +if len(sys.argv) != 7: + print "usage: create-intent onos-node name ingressDevice ingressPort egressDevice egressPort" + sys.exit(1) + +node = sys.argv[1] +name = sys.argv[2] +ingress = sys.argv[3] +ingressPort = sys.argv[4] +egress = sys.argv[5] +egressPort = sys.argv[6] + +intentJsonTemplate = \ + '{{' + \ + '"type": "PointToPointIntent",' + \ + '"appId": "org.onosproject.cli",' + \ + '"ingressPoint": {{' + \ + ' "device": "{}",' + \ + ' "port": "{}"' + \ + '}},' + \ + '"egressPoint": {{' + \ + ' "device": "{}",' + \ + ' "port": "{}"' + \ + '}}' + \ + '}}' + +intentJson = intentJsonTemplate.format(ingress, ingressPort, egress, egressPort) +intentRequest = requests.post('http://' + node + ':8181/onos/v1/intents/', + auth=HTTPBasicAuth('onos', 'rocks'), + data=intentJson) + +if intentRequest.status_code != 201: + print intentRequest.text + sys.exit(1) + +location = intentRequest.headers["location"] +print "@stc " + name + "Location=" + location +sys.exit(0) + + + diff --git a/framework/src/onos/tools/test/scenarios/bin/find-device.py b/framework/src/onos/tools/test/scenarios/bin/find-device.py new file mode 100755 index 00000000..430e18ad --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/bin/find-device.py @@ -0,0 +1,39 @@ +#! /usr/bin/env python + +import requests +import sys +import urllib + +from requests.auth import HTTPBasicAuth + +if len(sys.argv) != 4: + print "usage: find-device onos-node name device-id" + sys.exit(1) + +node = sys.argv[1] +name = sys.argv[2] +id = sys.argv[3] + +deviceRequest = requests.get('http://' + node + ':8181/onos/v1/devices/' + + urllib.quote_plus(id), + auth=HTTPBasicAuth('onos', 'rocks')) + +if deviceRequest.status_code != 200: + print deviceRequest.text + sys.exit(1) + +deviceJson = deviceRequest.json() + +print "@stc " + name + "Id=" + deviceJson["id"] +print "@stc " + name + "Type=" + deviceJson["type"] +print "@stc " + name + "Available=" + str(deviceJson["available"]) +channelId = deviceJson["annotations"]["channelId"] +channelIdWords = channelId.split(':') +print "@stc " + name + "IpAddress=" + channelIdWords[0] + +sys.exit(0) + + + + + diff --git a/framework/src/onos/tools/test/scenarios/bin/find-flow.py b/framework/src/onos/tools/test/scenarios/bin/find-flow.py new file mode 100755 index 00000000..a2f2e4d1 --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/bin/find-flow.py @@ -0,0 +1,40 @@ +#! /usr/bin/env python + +import requests +import sys + +from requests.auth import HTTPBasicAuth + +if len(sys.argv) != 4: + print "usage: find-flow onos-node name device-id" + sys.exit(1) + +node = sys.argv[1] +name = sys.argv[2] +deviceId = sys.argv[3] + +flowsRequest = requests.get('http://' + node + ':8181/onos/v1/flows/' + deviceId, + auth=HTTPBasicAuth('onos', 'rocks')) + +if flowsRequest.status_code != 200: + print flowsRequest.text + sys.exit(1) + +flowsJson = flowsRequest.json() + +for flow in flowsJson["flows"]: + if deviceId == flow["deviceId"]: + for criterion in flow["selector"]["criteria"]: + if criterion["type"] == 'IN_PORT' and criterion["port"] > 0: + for instruction in flow["treatment"]["instructions"]: + if instruction["port"] > 0 and instruction["type"] == 'OUTPUT': + print "@stc " + name + "FlowState=" + flow["state"] + print "@stc " + name + "FlowId=" + flow["id"] + print "@stc " + name + "FlowPort=" + str(instruction["port"]) + sys.exit(0) + +sys.exit(1) + + + + diff --git a/framework/src/onos/tools/test/scenarios/bin/find-host.py b/framework/src/onos/tools/test/scenarios/bin/find-host.py new file mode 100755 index 00000000..e87a4090 --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/bin/find-host.py @@ -0,0 +1,36 @@ +#! /usr/bin/env python + +import requests +import sys +import urllib + +from requests.auth import HTTPBasicAuth + +if len(sys.argv) != 4: + print "usage: find-host onos-node name device-id" + sys.exit(1) + +node = sys.argv[1] +name = sys.argv[2] +id = sys.argv[3] + +hostRequest = requests.get('http://' + node + ':8181/onos/v1/hosts/' + + urllib.quote_plus(id), + auth=HTTPBasicAuth('onos', 'rocks')) + +if hostRequest.status_code != 200: + print hostRequest.text + sys.exit(1) + +hostJson = hostRequest.json() + +print "@stc " + name + "Id=" + hostJson["id"] +print "@stc " + name + "Mac=" + hostJson["mac"] +print "@stc " + name + "IpAddress=" + hostJson["ipAddresses"][0] + +sys.exit(0) + + + + + diff --git a/framework/src/onos/tools/test/scenarios/bin/find-link.py b/framework/src/onos/tools/test/scenarios/bin/find-link.py new file mode 100755 index 00000000..9ac6e358 --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/bin/find-link.py @@ -0,0 +1,45 @@ +#! /usr/bin/env python + +import requests +import sys + +from requests.auth import HTTPBasicAuth + +if len(sys.argv) != 7: + print "usage: find-link onos-node name src-device-id src-port dst-device-id dst-port" + sys.exit(1) + +node = sys.argv[1] +name = sys.argv[2] +srcDeviceId = sys.argv[3] +srcPort = sys.argv[4] +dstDeviceId = sys.argv[5] +dstPort = sys.argv[6] + + +linksRequest = requests.get('http://' + node + ':8181/onos/v1/links?device=' + + srcDeviceId + '&port=' + srcPort, + auth=HTTPBasicAuth('onos', 'rocks')) + +if linksRequest.status_code != 200: + print linksRequest.text + sys.exit(1) + +linksJson = linksRequest.json() + +for link in linksJson["links"]: + if srcDeviceId == link["src"]["device"]: + if dstDeviceId == link["dst"]["device"]: + print "@stc " + name + "SrcDevice=" + link["src"]["device"] + print "@stc " + name + "SrcPort=" + link["src"]["port"] + print "@stc " + name + "DstDevice=" + link["dst"]["device"] + print "@stc " + name + "DstPort=" + link["dst"]["port"] + print "@stc " + name + "Type=" + link["type"] + print "@stc " + name + "State=" + link["state"] + sys.exit(0) + +sys.exit(1) + + + + diff --git a/framework/src/onos/tools/test/scenarios/example.xml b/framework/src/onos/tools/test/scenarios/example.xml new file mode 100644 index 00000000..65803141 --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/example.xml @@ -0,0 +1,19 @@ + + + + + diff --git a/framework/src/onos/tools/test/scenarios/net-create-flows.xml b/framework/src/onos/tools/test/scenarios/net-create-flows.xml new file mode 100644 index 00000000..6a6a80b0 --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/net-create-flows.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/src/onos/tools/test/scenarios/net-host-intent.xml b/framework/src/onos/tools/test/scenarios/net-host-intent.xml new file mode 100644 index 00000000..fbf8c4ab --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/net-host-intent.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/src/onos/tools/test/scenarios/net-link-down-up.xml b/framework/src/onos/tools/test/scenarios/net-link-down-up.xml new file mode 100644 index 00000000..8bcbfa7f --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/net-link-down-up.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/framework/src/onos/tools/test/scenarios/net-pingall.xml b/framework/src/onos/tools/test/scenarios/net-pingall.xml new file mode 100644 index 00000000..8968e0dc --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/net-pingall.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/framework/src/onos/tools/test/scenarios/net-point-intent.xml b/framework/src/onos/tools/test/scenarios/net-point-intent.xml new file mode 100644 index 00000000..acb8212b --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/net-point-intent.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/src/onos/tools/test/scenarios/net-rest.xml b/framework/src/onos/tools/test/scenarios/net-rest.xml new file mode 100644 index 00000000..fc7b1d08 --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/net-rest.xml @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/src/onos/tools/test/scenarios/net-setup.xml b/framework/src/onos/tools/test/scenarios/net-setup.xml new file mode 100644 index 00000000..e179ec5a --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/net-setup.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/framework/src/onos/tools/test/scenarios/net-smoke.xml b/framework/src/onos/tools/test/scenarios/net-smoke.xml new file mode 100644 index 00000000..53a5729c --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/net-smoke.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/src/onos/tools/test/scenarios/net-teardown.xml b/framework/src/onos/tools/test/scenarios/net-teardown.xml new file mode 100644 index 00000000..a5d93ee2 --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/net-teardown.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/framework/src/onos/tools/test/scenarios/prerequisites.xml b/framework/src/onos/tools/test/scenarios/prerequisites.xml new file mode 100644 index 00000000..650aa411 --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/prerequisites.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + diff --git a/framework/src/onos/tools/test/scenarios/setup.xml b/framework/src/onos/tools/test/scenarios/setup.xml new file mode 100644 index 00000000..c26c0dea --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/setup.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/src/onos/tools/test/scenarios/shutdown.xml b/framework/src/onos/tools/test/scenarios/shutdown.xml new file mode 100644 index 00000000..0be21647 --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/shutdown.xml @@ -0,0 +1,24 @@ + + + + + + + + + diff --git a/framework/src/onos/tools/test/scenarios/smoke.xml b/framework/src/onos/tools/test/scenarios/smoke.xml new file mode 100644 index 00000000..ce8140ad --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/smoke.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + diff --git a/framework/src/onos/tools/test/scenarios/startup.xml b/framework/src/onos/tools/test/scenarios/startup.xml new file mode 100644 index 00000000..430d51c3 --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/startup.xml @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/framework/src/onos/tools/test/scenarios/tar-setup.xml b/framework/src/onos/tools/test/scenarios/tar-setup.xml new file mode 100644 index 00000000..e330b2df --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/tar-setup.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/src/onos/tools/test/scenarios/wrapup.xml b/framework/src/onos/tools/test/scenarios/wrapup.xml new file mode 100644 index 00000000..e46441d6 --- /dev/null +++ b/framework/src/onos/tools/test/scenarios/wrapup.xml @@ -0,0 +1,24 @@ + + + + + + + + + -- cgit 1.2.3-korg