From b731e2f1dd0972409b136aebc7b463dd72c9cfad Mon Sep 17 00:00:00 2001 From: CNlucius Date: Tue, 13 Sep 2016 11:40:12 +0800 Subject: ONOSFW-171 O/S-SFC-ONOS scenario documentation Change-Id: I51ae1cf736ea24ab6680f8edca1b2bf5dd598365 Signed-off-by: CNlucius --- .../onos/tools/test/scenarios/bin/create-flow.py | 56 ---------------------- .../onos/tools/test/scenarios/bin/create-intent.py | 49 ------------------- .../onos/tools/test/scenarios/bin/curl-with-retry | 23 --------- .../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 -------------- .../test/scenarios/bin/find-link-in-cluster.py | 54 --------------------- .../src/onos/tools/test/scenarios/bin/find-link.py | 45 ----------------- .../test/scenarios/bin/find-topo-infrastructure.py | 34 ------------- .../onos/tools/test/scenarios/bin/query-cluster.py | 37 -------------- .../onos/tools/test/scenarios/bin/query-topo.py | 35 -------------- .../test/scenarios/bin/verify-topo-devices.py | 51 -------------------- 12 files changed, 499 deletions(-) delete mode 100755 framework/src/onos/tools/test/scenarios/bin/create-flow.py delete mode 100755 framework/src/onos/tools/test/scenarios/bin/create-intent.py delete mode 100755 framework/src/onos/tools/test/scenarios/bin/curl-with-retry delete mode 100755 framework/src/onos/tools/test/scenarios/bin/find-device.py delete mode 100755 framework/src/onos/tools/test/scenarios/bin/find-flow.py delete mode 100755 framework/src/onos/tools/test/scenarios/bin/find-host.py delete mode 100755 framework/src/onos/tools/test/scenarios/bin/find-link-in-cluster.py delete mode 100755 framework/src/onos/tools/test/scenarios/bin/find-link.py delete mode 100755 framework/src/onos/tools/test/scenarios/bin/find-topo-infrastructure.py delete mode 100755 framework/src/onos/tools/test/scenarios/bin/query-cluster.py delete mode 100755 framework/src/onos/tools/test/scenarios/bin/query-topo.py delete mode 100755 framework/src/onos/tools/test/scenarios/bin/verify-topo-devices.py (limited to 'framework/src/onos/tools/test/scenarios/bin') diff --git a/framework/src/onos/tools/test/scenarios/bin/create-flow.py b/framework/src/onos/tools/test/scenarios/bin/create-flow.py deleted file mode 100755 index 4e9b452b..00000000 --- a/framework/src/onos/tools/test/scenarios/bin/create-flow.py +++ /dev/null @@ -1,56 +0,0 @@ -#! /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 deleted file mode 100755 index 4e5d4f62..00000000 --- a/framework/src/onos/tools/test/scenarios/bin/create-intent.py +++ /dev/null @@ -1,49 +0,0 @@ -#! /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/curl-with-retry b/framework/src/onos/tools/test/scenarios/bin/curl-with-retry deleted file mode 100755 index c9546aea..00000000 --- a/framework/src/onos/tools/test/scenarios/bin/curl-with-retry +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -aux=/tmp/stc-$$.log -trap "rm -f $aux 2>/dev/null" EXIT - -url=$1 - - -echo curl-with-retry: $* - -set -x -for i in {1..3}; do - curl -f -uonos:rocks ${url} >$aux - if [ $? = 0 ]; then - cat $aux - exit 0 - fi - sleep 1 -done - -cat $aux -exit 1 - diff --git a/framework/src/onos/tools/test/scenarios/bin/find-device.py b/framework/src/onos/tools/test/scenarios/bin/find-device.py deleted file mode 100755 index 430e18ad..00000000 --- a/framework/src/onos/tools/test/scenarios/bin/find-device.py +++ /dev/null @@ -1,39 +0,0 @@ -#! /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 deleted file mode 100755 index a2f2e4d1..00000000 --- a/framework/src/onos/tools/test/scenarios/bin/find-flow.py +++ /dev/null @@ -1,40 +0,0 @@ -#! /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 deleted file mode 100755 index e87a4090..00000000 --- a/framework/src/onos/tools/test/scenarios/bin/find-host.py +++ /dev/null @@ -1,36 +0,0 @@ -#! /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-in-cluster.py b/framework/src/onos/tools/test/scenarios/bin/find-link-in-cluster.py deleted file mode 100755 index 928531fd..00000000 --- a/framework/src/onos/tools/test/scenarios/bin/find-link-in-cluster.py +++ /dev/null @@ -1,54 +0,0 @@ -#! /usr/bin/env python - -import requests -import sys - -from requests.auth import HTTPBasicAuth - -if len(sys.argv) != 9: - print "usage: find-link-in-cluster onos-node name cluster-id expected-length src-device-id src-port dst-device-id dst-port" - sys.exit(1) - -node = sys.argv[1] -name = sys.argv[2] -cluster = sys.argv[3] -length = int(sys.argv[4]) -srcDeviceId = sys.argv[5] -srcPort = sys.argv[6] -dstDeviceId = sys.argv[7] -dstPort = sys.argv[8] - - -linksRequest = requests.get('http://' + node + ':8181/onos/v1/topology/clusters/' - + cluster + '/links', - auth=HTTPBasicAuth('onos', 'rocks')) - -if linksRequest.status_code != 200: - print linksRequest.text - sys.exit(1) - -linksJson = linksRequest.json() -linksLength = len(linksJson["links"]) - -if linksLength != length: - print "Expected length {} but got {}".format(length, linksLength) - sys.exit(1) - -for link in linksJson["links"]: - if srcDeviceId == link["src"]["device"] and srcPort == link["src"]["port"]: - if dstDeviceId == link["dst"]["device"] and dstPort == link["dst"]["port"]: - 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) - -print "Could not find link from {}:{} to {}:{}"\ - .format(srcDeviceId, srcPort, dstDeviceId, dstPort) -sys.exit(1) - - - - diff --git a/framework/src/onos/tools/test/scenarios/bin/find-link.py b/framework/src/onos/tools/test/scenarios/bin/find-link.py deleted file mode 100755 index 9ac6e358..00000000 --- a/framework/src/onos/tools/test/scenarios/bin/find-link.py +++ /dev/null @@ -1,45 +0,0 @@ -#! /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/bin/find-topo-infrastructure.py b/framework/src/onos/tools/test/scenarios/bin/find-topo-infrastructure.py deleted file mode 100755 index 6d1970f7..00000000 --- a/framework/src/onos/tools/test/scenarios/bin/find-topo-infrastructure.py +++ /dev/null @@ -1,34 +0,0 @@ -#! /usr/bin/env python - -import requests -import sys -import urllib - -from requests.auth import HTTPBasicAuth - -if len(sys.argv) != 4: - print "usage: find-topo-infrastructure onos-node name connect-point" - sys.exit(1) - -node = sys.argv[1] -name = sys.argv[2] -id = sys.argv[3] - -infrastructureRequest = requests.get('http://' + node + ':8181/onos/v1/topology/infrastructure/' + - urllib.quote_plus(id), - auth=HTTPBasicAuth('onos', 'rocks')) - -if infrastructureRequest.status_code != 200: - print infrastructureRequest.text - sys.exit(1) - -infrastructureJson = infrastructureRequest.json() - -print "@stc " + name + "Infrastructure=" + str(infrastructureJson["infrastructure"]) - -sys.exit(0) - - - - - diff --git a/framework/src/onos/tools/test/scenarios/bin/query-cluster.py b/framework/src/onos/tools/test/scenarios/bin/query-cluster.py deleted file mode 100755 index 0cac7ac3..00000000 --- a/framework/src/onos/tools/test/scenarios/bin/query-cluster.py +++ /dev/null @@ -1,37 +0,0 @@ -#! /usr/bin/env python - -import requests -import sys -import urllib - -from requests.auth import HTTPBasicAuth - -if len(sys.argv) != 4: - print "usage: query-cluster onos-node name cluster-number" - sys.exit(1) - -node = sys.argv[1] -name = sys.argv[2] -cluster = sys.argv[3] - -topoRequest = requests.get('http://' + node + ':8181/onos/v1/topology/clusters/' - + cluster, - auth=HTTPBasicAuth('onos', 'rocks')) - -if topoRequest.status_code != 200: - print topoRequest.text - sys.exit(1) - -topoJson = topoRequest.json() - -print "@stc " + name + "Id=" + str(topoJson["id"]) -print "@stc " + name + "DeviceCount=" + str(topoJson["deviceCount"]) -print "@stc " + name + "LinkCount=" + str(topoJson["linkCount"]) -print "@stc " + name + "Root=" + topoJson["root"] - -sys.exit(0) - - - - - diff --git a/framework/src/onos/tools/test/scenarios/bin/query-topo.py b/framework/src/onos/tools/test/scenarios/bin/query-topo.py deleted file mode 100755 index 9b81b4ee..00000000 --- a/framework/src/onos/tools/test/scenarios/bin/query-topo.py +++ /dev/null @@ -1,35 +0,0 @@ -#! /usr/bin/env python - -import requests -import sys -import urllib - -from requests.auth import HTTPBasicAuth - -if len(sys.argv) != 3: - print "usage: query-topo onos-node name" - sys.exit(1) - -node = sys.argv[1] -name = sys.argv[2] - -topoRequest = requests.get('http://' + node + ':8181/onos/v1/topology/', - auth=HTTPBasicAuth('onos', 'rocks')) - -if topoRequest.status_code != 200: - print topoRequest.text - sys.exit(1) - -topoJson = topoRequest.json() - -print "@stc " + name + "Time=" + str(topoJson["time"]) -print "@stc " + name + "Devices=" + str(topoJson["devices"]) -print "@stc " + name + "Links=" + str(topoJson["links"]) -print "@stc " + name + "Clusters=" + str(topoJson["clusters"]) - -sys.exit(0) - - - - - diff --git a/framework/src/onos/tools/test/scenarios/bin/verify-topo-devices.py b/framework/src/onos/tools/test/scenarios/bin/verify-topo-devices.py deleted file mode 100755 index be834b9b..00000000 --- a/framework/src/onos/tools/test/scenarios/bin/verify-topo-devices.py +++ /dev/null @@ -1,51 +0,0 @@ -#! /usr/bin/env python - -import requests -import sys -import urllib - -from requests.auth import HTTPBasicAuth - -if len(sys.argv) != 5: - print "usage: verify-topo-links onos-node cluster-id first-index last-index" - sys.exit(1) - -node = sys.argv[1] -cluster = sys.argv[2] -first = int(sys.argv[3]) -last = int(sys.argv[4]) - -found = 0 - -topoRequest = requests.get('http://' + node + ':8181/onos/v1/topology/clusters/' - + cluster - + "/devices", - auth=HTTPBasicAuth('onos', 'rocks')) - -if topoRequest.status_code != 200: - print topoRequest.text - sys.exit(1) - -topoJson = topoRequest.json() - -for deviceIndex in range(first, last+1): - lookingFor = "of:" + format(deviceIndex, '016x') - print lookingFor - for arrayIndex in range(0, len(topoJson["devices"])): - device = topoJson["devices"][arrayIndex] - if device == lookingFor: - found = found + 1 - print "Match found for " + device - break - - -if found == last - first: - sys.exit(0) - -print "Found " + str(found) + " matches, need " + str(last - first) -sys.exit(2) - - - - - -- cgit 1.2.3-korg