diff options
author | Ashlee Young <ashlee@onosfw.com> | 2015-09-09 22:15:21 -0700 |
---|---|---|
committer | Ashlee Young <ashlee@onosfw.com> | 2015-09-09 22:15:21 -0700 |
commit | 13d05bc8458758ee39cb829098241e89616717ee (patch) | |
tree | 22a4d1ce65f15952f07a3df5af4b462b4697cb3a /framework/src/onos/tools/test/scenarios | |
parent | 6139282e1e93c2322076de4b91b1c85d0bc4a8b3 (diff) |
ONOS checkin based on commit tag e796610b1f721d02f9b0e213cf6f7790c10ecd60
Change-Id: Ife8810491034fe7becdba75dda20de4267bd15cd
Diffstat (limited to 'framework/src/onos/tools/test/scenarios')
24 files changed, 1150 insertions, 0 deletions
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 @@ +<!-- + ~ Copyright 2015 Open Networking Laboratory + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<scenario name="archetypes" description="ONOS archetypes test"> + <group name="Archetypes" cwd="${WORKSPACE}/tmp/test-app"> + <step name="Clean-Up" cwd="${WORKSPACE}/tmp" env="~" + exec="rm -r test-app"/> + + <step name="Create-App" cwd="${WORKSPACE}/tmp" requires="^" + exec="onos-create-app app org.test.app test-app 1.2.3 org.test.app -DinteractiveMode=false"/> + <step name="Build-App" requires="Create-App" exec="mvn clean install"/> + <step name="Install-App" requires="^" + exec="onos-app ${OCI} install! target/test-app-1.2.3.oar"/> + <step name="Verify-App" requires="^" + exec="onos-check-components ${OCI} org.test.app.AppComponent"/> + + <step name="Create-App-CLI-Overlay" requires="Install-App" + exec="onos-create-app cli org.test.app test-app 1.2.3 org.test.app -DinteractiveMode=false"/> + <step name="Build-App-With-CLI" requires="^" + exec="mvn clean install"/> + <step name="Reinstall-App-With-CLI" requires="^,~Verify-App" + exec="onos-app ${OCI} reinstall! target/test-app-1.2.3.oar"/> + <step name="Verify-CLI" requires="^" + exec="onos ${OCI} sample"/> + + <step name="Create-App-UI-Overlay" requires="Reinstall-App-With-CLI" + exec="onos-create-app ui org.test.app test-app 1.2.3 org.test.app -DinteractiveMode=false"/> + <step name="Build-App-With-UI" requires="^" + exec="mvn clean install"/> + <step name="Reinstall-App-With-UI" requires="^,~Verify-CLI" + exec="onos-app ${OCI} reinstall! target/test-app-1.2.3.oar"/> + <step name="Verify-UI" requires="^" + exec="onos-check-views ${OCI} id=sample"/> + + <step name="Uninstall-App" requires="^" + exec="onos-app ${OCI} uninstall org.foo.app"/> + </group> +</scenario> 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 @@ +<!-- + ~ Copyright 2015 Open Networking Laboratory + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<scenario name="example" description="Example"> + <step name="One" exec="echo @stc foo=bar"/> + <step name="Two" requires="One" exec="echo ${foo}"/> +</scenario> 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 @@ +<!-- + ~ Copyright 2015 Open Networking Laboratory + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<scenario name="net-create-flows" + description="Network Flow Creation Test Using REST API"> + <!-- TODO: parametrize this via recipes --> + <group name="Net-Create-Flows"> + + <!-- Make sure that reactive forwarding is off --> + <step name="Net-Create-Flows.Uninstall-Reactive-Forwarding" + exec="onos ${OC1} app deactivate org.onosproject.fwd org.onosproject.ifwd"/> + <step name="Net-Create-Flows.Check-Apps" requires="^" + exec="onos-check-apps ${OC1} fwd,ifwd excludes"/> + + <!-- Force discovery of hosts --> + <step name="Net-Create-Flows.Find-Host-1" requires="^" + exec="onos-mininet sendAndExpect h1 ping -c1 -w1 h4 --expect 100% packet loss"/> + <step name="Net-Create-Flows.Find-Host-2" requires="^" + exec="onos-mininet sendAndExpect h4 ping -c1 -w1 h1 --expect 100% packet loss"/> + + + <!-- Use REST API to create a point to point intent in each direction --> + <step name="Net-Create-Flows.1-to-Host" requires="Net-Create-Flows.Find-Host-2" + exec="create-flow.py ${OC1} f1 of:0000000000000001 5 1"/> + <step name="Net-Create-Flows.1-to-19" requires="^" + exec="create-flow.py ${OC1} f2 of:0000000000000001 1 2"/> + <step name="Net-Create-Flows.19-to-7" requires="^" + exec="create-flow.py ${OC1} f3 of:0000000000000019 2 8"/> + <step name="Net-Create-Flows.7-to-4" requires="^" + exec="create-flow.py ${OC1} f4 of:0000000000000007 2 3"/> + <step name="Net-Create-Flows.4-to-Host" requires="^" + exec="create-flow.py ${OC1} f5 of:0000000000000004 1 3"/> + + <step name="Net-Create-Flows.Host-to-1" requires="^" + exec="create-flow.py ${OC1} f6 of:0000000000000001 1 5"/> + <step name="Net-Create-Flows.19-to-1" requires="^" + exec="create-flow.py ${OC1} f7 of:0000000000000001 2 1"/> + <step name="Net-Create-Flows.7-to-19" requires="^" + exec="create-flow.py ${OC1} f8 of:0000000000000019 8 2"/> + <step name="Net-Create-Flows.4-to-7" requires="^" + exec="create-flow.py ${OC1} f9 of:0000000000000007 3 2"/> + <step name="Net-Create-Flows.Host-to-4" requires="^" + exec="create-flow.py ${OC1} f10 of:0000000000000004 3 1"/> + + <!-- Check that connectivity was established --> + <step name="Net-Create-Flows.Ping-XY" requires="^" + exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/> + <step name="Net-Create-Flows.Ping-YX" requires="^" + exec="onos-mininet sendAndExpect h4 ping -c1 h1 --expect \ 0% packet loss"/> + + <!-- Use REST API to remove the flows. --> + <step name="Net-Create-Flows.Delete-f1" requires="^" + exec="curl -f -X DELETE -uonos:rocks ${f1Location}"/> + <step name="Net-Create-Flows.Delete-f2" requires="^" + exec="curl -f -X DELETE -uonos:rocks ${f2Location}"/> + <step name="Net-Create-Flows.Delete-f3" requires="^" + exec="curl -f -X DELETE -uonos:rocks ${f3Location}"/> + <step name="Net-Create-Flows.Delete-f4" requires="^" + exec="curl -f -X DELETE -uonos:rocks ${f4Location}"/> + <step name="Net-Create-Flows.Delete-f5" requires="^" + exec="curl -f -X DELETE -uonos:rocks ${f5Location}"/> + <step name="Net-Create-Flows.Delete-f6" requires="^" + exec="curl -f -X DELETE -uonos:rocks ${f6Location}"/> + <step name="Net-Create-Flows.Delete-f7" requires="^" + exec="curl -f -X DELETE -uonos:rocks ${f7Location}"/> + <step name="Net-Create-Flows.Delete-f8" requires="^" + exec="curl -f -X DELETE -uonos:rocks ${f8Location}"/> + <step name="Net-Create-Flows.Delete-f9" requires="^" + exec="curl -f -X DELETE -uonos:rocks ${f9Location}"/> + <step name="Net-Create-Flows.Delete-f10" requires="^" + exec="curl -f -X DELETE -uonos:rocks ${f10Location}"/> + + <!-- Ping again to be sure the path was removed. --> + <step name="Net-Create-Flows.Fail-Ping-XY" requires="^" + exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 100% packet loss"/> + <step name="Net-Create-Flows.Fail-Ping-YX" requires="^" + exec="onos-mininet sendAndExpect h4 ping -c1 h1 --expect \ 100% packet loss"/> + + + </group> +</scenario> 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 @@ +<!-- + ~ Copyright 2015 Open Networking Laboratory + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<scenario name="net-host-intent" description="Network host intent connectivity test"> + <!-- TODO: parametrize this via recipes --> + <group name="Host-Intent-Connectivity"> + <step name="Host-Intent.Uninstall-Reactive-Forwarding" + exec="onos ${OC1} app deactivate org.onosproject.fwd org.onosproject.ifwd"/> + <step name="Host-Intent.Check-Apps" requires="^" + exec="onos-check-apps ${OC1} fwd,ifwd excludes"/> + + <step name="Host-Intent.Find-Host-1" requires="^" + exec="onos-mininet sendAndExpect h1 ping -c1 -w1 h4 --expect ."/> + <step name="Host-Intent.Find-Host-2" requires="^" + exec="onos-mininet sendAndExpect h4 ping -c1 -w1 h1 --expect ."/> + + <step name="Host-Intent.Create-Intent" requires="^" + exec="onos-create-intent ${OC1} h2h host 00:00:00:00:00:01/-1 00:00:00:00:00:04/-1"/> + <step name="Host-Intent.Validate-Intent-Installed" requires="Host-Intent.Create-Intent" + exec="onos-check-intent ${OC1} h2h INSTALLED"/> + + <import file="${ONOS_SCENARIOS}/net-link-down-up.xml" namespace="Host-Intent"/> + <dependency name="Host-Intent.Net-Link-Down-Up" + requires="Host-Intent.Validate-Intent-Installed"/> + + <step name="Host-Intent.Validate-Intent-Installed-Still" requires="Host-Intent.Link-1-Down" + exec="onos-check-intent ${OC1} h2h INSTALLED"/> + + <dependency name="Host-Intent.Link-2-Down" + requires="~Host-Intent.Validate-Intent-Installed-Still" /> + + <step name="Host-Intent.Validate-Intent-Failed" requires="Host-Intent.Link-2-Down" + exec="onos-check-intent ${OC1} h2h FAILED"/> + + <dependency name="Host-Intent.Link-1-Up" + requires="~Host-Intent.Validate-Intent-Failed" /> + + <step name="Host-Intent.Validate-Intent-Installed-Again" requires="Host-Intent.Link-1-Up" + exec="onos-check-intent ${OC1} h2h INSTALLED"/> + + <dependency name="Host-Intent.Ping-4" + requires="~Host-Intent.Validate-Intent-Installed-Again" /> + + <step name="Host-Intent.Remove-Intent" requires="~Host-Intent.Net-Link-Down-Up" + exec="onos ${OC1} remove-intent -p org.onosproject.cli h2h"/> + </group> +</scenario> 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 @@ +<!-- + ~ Copyright 2015 Open Networking Laboratory + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<scenario name="net-link-down-up" description="Network link up-down test"> + <!-- TODO: parametrize this via recipes --> + <group name="Net-Link-Down-Up"> + <step name="Ping-1" + exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/> + <step name="Link-1-Down" requires="~Ping-1" + exec="onos-mininet sendAndExpect link s4 s7 down --expect ."/> + <step name="Ping-2" requires="~Link-1-Down" + exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/> + <step name="Link-2-Down" requires="~Ping-2" + exec="onos-mininet sendAndExpect link s4 s5 down --expect ."/> + <step name="Ping-3" requires="~Link-2-Down" + exec="onos-mininet sendAndExpect h1 ping -c1 -w1 h4 --expect 100% packet loss"/> + <step name="Link-1-Up" requires="~Ping-3" + exec="onos-mininet sendAndExpect link s4 s7 up --expect ."/> + <step name="Ping-4" requires="~Link-1-Up" + exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/> + <step name="Link-2-Up" requires="~Ping-4" + exec="onos-mininet sendAndExpect link s4 s5 up --expect ."/> + <step name="Ping-5" requires="~Link-2-Up" + exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/> + </group> +</scenario>
\ 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 @@ +<!-- + ~ Copyright 2015 Open Networking Laboratory + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<scenario name="net-pingall" description="Network pingall test"> + <!-- TODO: parametrize this via recipes --> + <group name="Net-Pingall"> + <step name="Install-Apps" + exec="onos ${OC1} app activate org.onosproject.openflow org.onosproject.proxyarp org.onosproject.fwd"/> + <step name="Check-Apps" requires="^" + exec="onos-check-apps ${OC1} drivers,openflow,proxyarp,fwd includes"/> + + <!-- TODO: take this out when initial pingall sweep is 100% --> + <step name="Initial-Ping-All" requires="Check-Apps" + exec="onos-mininet sendAndExpect py net.pingAll(1) --expect 600 received"/> + + <step name="Ping-All-And-Verify" requires="Check-Apps,Initial-Ping-All" + exec="onos-mininet sendAndExpect py net.pingAll(1) --expect 600/600 received"/> + + <step name="Check-Summary-For-Hosts" requires="~Ping-All-And-Verify" + exec="onos-check-summary ${OC1} [0-9]* 25 140 25"/> + + <step name="Config-Topo" requires="~Check-Summary-For-Hosts" + exec="onos-topo-cfg ${OC1} ${ONOS_ROOT}/tools/test/topos/attmpls.json"/> + </group> +</scenario>
\ 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 @@ +<!-- + ~ Copyright 2015 Open Networking Laboratory + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<scenario name="net-point-intent" + description="Network point to point intent connectivity test"> + <!-- TODO: parametrize this via recipes --> + <group name="P2P-Intent-Connectivity"> + <step name="P2P-Intent.Uninstall-Reactive-Forwarding" + exec="onos ${OC1} app deactivate org.onosproject.fwd org.onosproject.ifwd"/> + <step name="P2P-Intent.Check-Apps" requires="^" + exec="onos-check-apps ${OC1} fwd,ifwd excludes"/> + + <step name="P2P-Intent.Find-Host-1" requires="^" + exec="onos-mininet sendAndExpect h1 ping -c1 -w1 h4 --expect ."/> + <step name="P2P-Intent.Find-Host-2" requires="^" + exec="onos-mininet sendAndExpect h4 ping -c1 -w1 h1 --expect ."/> + + <step name="P2P-Intent.Create-Intent-XY" requires="^" + exec="onos-create-intent ${OC1} xy point of:0000000000000001/1 of:0000000000000004/1"/> + <step name="P2P-Intent.Create-Intent-YX" requires="^" + exec="onos-create-intent ${OC1} yx point of:0000000000000004/1 of:0000000000000001/1"/> + + <step name="P2P-Intent.Validate-Intent-XY-Installed" requires="^" + exec="onos-check-intent ${OC1} yx INSTALLED"/> + <step name="P2P-Intent.Validate-Intent-YX-Installed" requires="^" + exec="onos-check-intent ${OC1} xy INSTALLED"/> + + <import file="${ONOS_SCENARIOS}/net-link-down-up.xml" namespace="P2P-Intent"/> + <dependency name="P2P-Intent.Net-Link-Down-Up" + requires="P2P-Intent.Validate-Intent-XY-Installed, + P2P-Intent.Validate-Intent-YX-Installed"/> + + <step name="P2P-Intent.Validate-Intent-XY-Installed-Still" requires="P2P-Intent.Link-1-Down" + exec="onos-check-intent ${OC1} xy INSTALLED"/> + <step name="P2P-Intent.Validate-Intent-YX-Installed-Still" requires="P2P-Intent.Link-1-Down" + exec="onos-check-intent ${OC1} yx INSTALLED"/> + + <dependency name="P2P-Intent.Link-2-Down" + requires="~P2P-Intent.Validate-Intent-XY-Installed-Still, + ~P2P-Intent.Validate-Intent-YX-Installed-Still"/> + + <step name="P2P-Intent.Validate-Intent-XY-Failed" requires="P2P-Intent.Link-2-Down" + exec="onos-check-intent ${OC1} xy FAILED"/> + <step name="P2P-Intent.Validate-Intent-YX-Failed" requires="P2P-Intent.Link-2-Down" + exec="onos-check-intent ${OC1} yx FAILED"/> + + <dependency name="P2P-Intent.Link-1-Up" + requires="~P2P-Intent.Validate-Intent-XY-Failed, + ~P2P-Intent.Validate-Intent-YX-Failed" /> + + <step name="P2P-Intent.Validate-Intent-XY-Installed-Again" requires="P2P-Intent.Link-1-Up" + exec="onos-check-intent ${OC1} xy INSTALLED"/> + <step name="P2P-Intent.Validate-Intent-YX-Installed-Again" requires="P2P-Intent.Link-1-Up" + exec="onos-check-intent ${OC1} yx INSTALLED"/> + + <dependency name="P2P-Intent.Ping-4" + requires="~P2P-Intent.Validate-Intent-XY-Installed-Again, + ~P2P-Intent.Validate-Intent-YX-Installed-Again"/> + + <step name="P2P-Intent.Remove-Intent-XY" requires="~P2P-Intent.Net-Link-Down-Up" + exec="onos ${OC1} remove-intent -p org.onosproject.cli xy"/> + <step name="P2P-Intent.Remove-Intent-YX" requires="~P2P-Intent.Net-Link-Down-Up" + exec="onos ${OC1} remove-intent -p org.onosproject.cli yx"/> + </group> +</scenario> 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 @@ +<!-- + ~ Copyright 2015 Open Networking Laboratory + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<scenario name="net-rest" + description="Network REST API test"> + <!-- TODO: parametrize this via recipes --> + <group name="Net-REST"> + + <!-- Make sure that reactive forwarding is off --> + <step name="Net-REST.Uninstall-Reactive-Forwarding" + exec="onos ${OC1} app deactivate org.onosproject.fwd org.onosproject.ifwd"/> + <step name="Net-REST.Check-Apps" requires="^" + exec="onos-check-apps ${OC1} fwd,ifwd excludes"/> + + <!-- Force discovery of hosts --> + <step name="Net-REST.Find-Host-1" requires="^" + exec="onos-mininet sendAndExpect h1 ping -c1 -w1 h4 --expect ."/> + <step name="Net-REST.Find-Host-2" requires="^" + exec="onos-mininet sendAndExpect h4 ping -c1 -w1 h1 --expect ."/> + + <!-- Verify some links using the REST API --> + <step name="Net-REST.Query-Link-1" requires="Net-REST.Find-Host-2" + exec="find-link.py ${OC1} link1 of:0000000000000001 5 of:0000000000000006 4"/> + <step name="Net-REST.Validate-Link-1-State" requires="^" + exec="test '${link1State}' == 'ACTIVE'"/> + <step name="Net-REST.Validate-Link-1-Type" requires="^" + exec="test '${link1Type}' == 'DIRECT'"/> + <step name="Net-REST.Validate-Link-1-Src-Device" requires="^" + exec="test '${link1SrcDevice}' == 'of:0000000000000001'"/> + <step name="Net-REST.Validate-Link-1-Dst-Device" requires="^" + exec="test '${link1DstDevice}' == 'of:0000000000000006'"/> + <step name="Net-REST.Validate-Link-1-Src-Port" requires="^" + exec="test '${link1SrcPort}' == '5'"/> + <step name="Net-REST.Validate-Link-1-Dst-Port" requires="^" + exec="test '${link1DstPort}' == '4'"/> + + <step name="Net-REST.Query-Link-2" requires="Net-REST.Find-Host-2" + exec="find-link.py ${OC1} link2 of:0000000000000019 7 of:0000000000000006 3"/> + <step name="Net-REST.Validate-Link-2-State" requires="^" + exec="test '${link2State}' == 'ACTIVE'"/> + <step name="Net-REST.Validate-Link-2-Type" requires="^" + exec="test '${link2Type}' == 'DIRECT'"/> + <step name="Net-REST.Validate-Link-2-Src-Device" requires="^" + exec="test '${link2SrcDevice}' == 'of:0000000000000019'"/> + <step name="Net-REST.Validate-Link-2-Dst-Device" requires="^" + exec="test '${link2DstDevice}' == 'of:0000000000000006'"/> + <step name="Net-REST.Validate-Link-2-Src-Port" requires="^" + exec="test '${link2SrcPort}' == '7'"/> + <step name="Net-REST.Validate-Link-2-Dst-Port" requires="^" + exec="test '${link2DstPort}' == '3'"/> + + <!-- Verify the hosts using the REST API --> + <step name="Net-REST.Query-Host-1" requires="Net-REST.Find-Host-2" + exec="find-host.py ${OC1} host1 00:00:00:00:00:01/-1"/> + <step name="Net-REST.Validate-Host-1-Id" requires="^" + exec="test '${host1Id}' == '00:00:00:00:00:01/-1'"/> + <step name="Net-REST.Validate-Host-1-Mac" requires="^" + exec="test '${host1Mac}' == '00:00:00:00:00:01'"/> + <step name="Net-REST.Validate-Host-1-Ip" requires="^" + exec="test '${host1IpAddress}' == '10.0.0.1'"/> + + <step name="Net-REST.Query-Host-2" requires="Net-REST.Find-Host-2" + exec="find-host.py ${OC1} host2 00:00:00:00:00:04/-1"/> + <step name="Net-REST.Validate-Host-2-Id" requires="^" + exec="test '${host2Id}' == '00:00:00:00:00:04/-1'"/> + <step name="Net-REST.Validate-Host-2-Mac" requires="^" + exec="test '${host2Mac}' == '00:00:00:00:00:04'"/> + <step name="Net-REST.Validate-Host-2-Ip" requires="^" + exec="test '${host2IpAddress}' == '10.0.0.4'"/> + + <!-- Verify a switch using the REST API --> + <step name="Net-REST.Query-Dev-1" requires="Net-REST.Find-Host-2" + exec="find-device.py ${OC1} dev1 of:0000000000000014"/> + <step name="Net-REST.Validate-Dev1-Id" requires="^" + exec="test '${dev1Id}' == 'of:0000000000000014'"/> + <step name="Net-REST.Validate-Dev1-Type" requires="^" + exec="test '${dev1Type}' == 'SWITCH'"/> + <step name="Net-REST.Validate-Dev1-Available" requires="^" + exec="test '${dev1Available}' == 'True'"/> + <step name="Net-REST.Validate-Dev1-ChannelId" requires="^" + exec="test '${dev1IpAddress}' == '${OCN}'"/> + + <!-- Use REST API to create a point to point intent in each direction --> + <step name="Net-REST.Create-Intent-XY" requires="Net-REST.Find-Host-2" + exec="create-intent.py ${OC1} xy of:0000000000000001 1 of:0000000000000004 1"/> + <step name="Net-REST.Create-Intent-YX" requires="^" + exec="create-intent.py ${OC1} yx of:0000000000000004 1 of:0000000000000001 1"/> + + <!-- Check that the intents can be fetched via the REST API --> + <step name="Net-REST.Validate-Intent-XY-Installed" + requires="Net-REST.Create-Intent-YX" + exec="curl -f -uonos:rocks ${xyLocation}"/> + <step name="Net-REST.Validate-Intent-YX-Installed" + requires="^" + exec="curl -f -uonos:rocks ${yxLocation}"/> + + <!-- Use REST API to query flows created by the intents --> + <step name="Net-REST.Validate-Intent-XY-Flow-Installed" + requires="Net-REST.Create-Intent-YX" + exec="find-flow.py ${OC1} dev1out of:0000000000000001"/> + <step name="Net-REST.Validate-XY-Flow-State" requires="^" + exec="test '${dev1outFlowState}' == 'ADDED' -o '${dev1outFlowState}' == 'PENDING_ADD'"/> + <step name="Net-REST.Validate-XY-Flow-Port" requires="^" + exec="test ${dev1outFlowPort} -ge 1 -a ${dev1outFlowPort} -le 5"/> + + <step name="Net-REST.Validate-Intent-YX-Flow-Installed" requires="Net-REST.Create-Intent-YX" + exec="find-flow.py ${OC1} dev4out of:0000000000000004"/> + <step name="Net-REST.Validate-YX-Flow-State" requires="^" + exec="test '${dev4outFlowState}' == 'ADDED' -o '${dev4outFlowState}' == 'PENDING_ADD'"/> + <step name="Net-REST.Validate-YX-Flow-Port" requires="^" + exec="test '${dev4outFlowPort}' == '3'"/> + + <!-- Check that connectivity was established --> + <step name="Net-REST.Ping-XY" requires="Net-REST.Create-Intent-XY,Net-REST.Create-Intent-YX" + exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/> + <step name="Net-REST.Ping-YX" requires="^" + exec="onos-mininet sendAndExpect h4 ping -c1 h1 --expect \ 0% packet loss"/> + + <!-- Remove the intents via the REST API --> + <step name="Net-REST.Delete-Intent-XY" + requires="Net-REST.Validate-Intent-XY-Installed, + Net-REST.Validate-Intent-YX-Installed, + Net-REST.Validate-Intent-XY-Flow-Installed, + Net-REST.Validate-Intent-YX-Flow-Installed, + Net-REST.Ping-XY, + Net-REST.Ping-YX" + exec="curl -f -X DELETE -uonos:rocks ${xyLocation}"/> + <step name="Net-REST.Delete-Intent-YX" requires="^" + exec="curl -f -X DELETE -uonos:rocks ${yxLocation}"/> + + <!-- Use REST API to be sure that flows are no longer installed --> + <step name="Net-REST.Validate-XY-Flows-Removed" requires="Net-REST.Delete-Intent-XY" + exec="find-flow.py ${OC1} dev1out of:0000000000000001" + env="!"/> + <step name="Net-REST.Validate-YX-Flows-Removed" requires="Net-REST.Delete-Intent-YX" + exec="find-flow.py ${OC1} dev4out of:0000000000000004" + env="!"/> + + <!-- Check that the deleted intents no longer appear in the REST API --> + <step name="Net-REST.Allow-Intents-To-Purge" requires="Net-REST.Delete-Intent-XY" + exec="sleep 1"/> + <step name="Net-REST.Validate-Intent-XY-Removed" requires="Net-REST.Allow-Intents-To-Purge" + exec="curl -f -uonos:rocks ${xyLocation}" env="!"/> + <step name="Net-REST.Validate-Intent-YX-Removed" requires="Net-REST.Allow-Intents-To-Purge" + exec="curl -f -uonos:rocks ${yxLocation}" env="!"/> + + </group> +</scenario> 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 @@ +<!-- + ~ Copyright 2015 Open Networking Laboratory + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<scenario name="net-setup" description="Network setup steps"> + <!-- TODO: parametrize this via recipes --> + <group name="Net-Setup"> + <step name="Push-Topos" exec="onos-push-topos ${OCN}"/> + <step name="Stop-Mininet-If-Needed" env="~" exec="onos-mininet stop"/> + + <step name="Wipe-Out-Data-Before" exec="onos-wipe-out"/> + + <step name="Initial-Summary-Check" requires="~Wipe-Out-Data-Before" + exec="onos-check-summary ${OC1} [0-9]* 0 0 0"/> + + <step name="Start-Mininet" + requires="Install-Apps,Initial-Summary-Check,Push-Topos,Stop-Mininet-If-Needed" + exec="onos-mininet start topos/topo att-onos.py ${ONOS_INSTANCES}"/> + + <step name="Wait-For-Mininet" requires="Start-Mininet" + exec="onos-mininet wait 10"/> + + <step name="Check-Summary" requires="Wait-For-Mininet" + exec="onos-check-summary ${OC1} [0-9]* 25 140 0"/> + + <step name="Balance-Masters" requires="~Check-Summary" if="${OC2}" + exec="onos ${OC1} balance-masters"/> + + <step name="Pause-For-Masters" requires="Balance-Masters" if="${OC2}" + exec="sleep 10"/> + + <step name="Check-Flows" requires="~Pause-For-Masters,~Check-Summary" + exec="onos-check-flows ${OC1}"/> + </group> +</scenario>
\ 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 @@ +<!-- + ~ Copyright 2015 Open Networking Laboratory + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<scenario name="net-smoke" description="Basic network functionality smoke test"> + <group name="Net-Smoke"> + <import file="${ONOS_SCENARIOS}/net-setup.xml"/> + + <import file="${ONOS_SCENARIOS}/net-pingall.xml" namespace="Reactive-Forwarding"/> + <dependency name="Reactive-Forwarding.Net-Pingall" requires="Net-Setup"/> + + <import file="${ONOS_SCENARIOS}/net-link-down-up.xml" namespace="Reactive-Forwarding"/> + <dependency name="Reactive-Forwarding.Net-Link-Down-Up" requires="Net-Setup,~Reactive-Forwarding.Net-Pingall"/> + + <import file="${ONOS_SCENARIOS}/net-host-intent.xml"/> + <dependency name="Host-Intent-Connectivity" requires="Net-Setup,~Reactive-Forwarding.Net-Link-Down-Up"/> + + <import file="${ONOS_SCENARIOS}/net-point-intent.xml"/> + <dependency name="P2P-Intent-Connectivity" requires="Net-Setup,~Reactive-Forwarding.Net-Link-Down-Up,Host-Intent-Connectivity"/> + + <import file="${ONOS_SCENARIOS}/net-rest.xml"/> + <dependency name="Net-REST" requires="Net-Setup,P2P-Intent-Connectivity"/> + + <import file="${ONOS_SCENARIOS}/net-create-flows.xml"/> + <dependency name="Net-Create-Flows" requires="Net-Setup,P2P-Intent-Connectivity,Net-REST"/> + + <import file="${ONOS_SCENARIOS}/net-teardown.xml"/> + <dependency name="Net-Teardown" requires="~Host-Intent-Connectivity, + ~P2P-Intent-Connectivity, + ~Net-REST, + ~Net-Create-Flows"/> + </group> +</scenario> 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 @@ +<!-- + ~ Copyright 2015 Open Networking Laboratory + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<scenario name="net-setup" description="Network teardown steps"> + <group name="Net-Teardown"> + <step name="Stop-Mininet" exec="onos-mininet stop"/> + <XXXstep name="Wipe-Out-Data-After" requires="~Stop-Mininet" exec="onos-wipe-out"/> + </group> +</scenario>
\ 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 @@ +<!-- + ~ Copyright 2015 Open Networking Laboratory + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<scenario name="prerequisites" description="ONOS test pre-requisites"> + <group name="Prerequisites"> + <step name="Check-Environment" exec="test -n ${ONOS_ROOT} -a -n ${ONOS_NIC} -a -n ${OC1}"/> + <step name="Check-ONOS-Bits" exec="onos-check-bits"/> + + <parallel var="${OC#}"> + <step name="Check-Passwordless-Login-${#}" + exec="ssh -n -o ConnectTimeout=3 -o PasswordAuthentication=no sdn@${OC#} date"/> + </parallel> + </group> +</scenario> 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 @@ +<!-- + ~ Copyright 2015 Open Networking Laboratory + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<scenario name="setup" description="ONOS cluster setup"> + <group name="Setup"> + <step name="Push-Bits" exec="onos-push-bits-through-proxy" if="${OCT}"/> + <step name="Secure-SSH" exec="onos-secure-ssh -u ${ONOS_WEB_USER} -p ${ONOS_WEB_PASS}" if="${ONOS_USE_SSH}"/> + + <parallel var="${OC#}"> + <step name="Push-Bits-${#}" exec="onos-push-bits ${OC#}" + unless="${OCT}"/> + <step name="Uninstall-${#}" exec="onos-uninstall ${OC#}"/> + <step name="Kill-${#}" env="~" exec="onos-kill ${OC#}" + requires="Uninstall-${#}"/> + + <step name="Install-${#}" exec="onos-install ${OC#}" + requires="Kill-${#},Push-Bits-${#},Push-Bits"/> + + <dependency name="Secure-SSH" requires="Install-${#}"/> + + <step name="Wait-for-Start-${#}" exec="onos-wait-for-start ${OC#}" + requires="Install-${#},~Secure-SSH"/> + + <step name="Check-Nodes-${#}" exec="onos-check-nodes ${OC#}" + requires="~Wait-for-Start-${#}"/> + <step name="Check-Logs-${#}" exec="onos-check-logs ${OC#}" + requires="~Wait-for-Start-${#}"/> + <step name="Check-Components-${#}" + exec="onos-check-components ${OC#}" + requires="~Wait-for-Start-${#},"/> + <step name="Check-Apps-${#}" exec="onos-check-apps ${OC#}" + requires="~Wait-for-Start-${#}"/> + </parallel> + </group> +</scenario> 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 @@ +<!-- + ~ Copyright 2015 Open Networking Laboratory + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<scenario name="shutdown" description="ONOS cluster shutdown"> + <group name="Shutdown"> + <parallel var="${OC#}"> + <step name="Stop-Service-${#}" exec="onos-service ${OC#} stop"/> + <step name="Check-Logs-${#}" exec="onos-check-logs ${OC#}" + requires="~Stop-Service-${#}"/> + </parallel> + </group> +</scenario> 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 @@ +<!-- + ~ Copyright 2015 Open Networking Laboratory + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<scenario name="smoke" description="ONOS smoke test"> + <import file="${ONOS_SCENARIOS}/prerequisites.xml"/> + + <import file="${ONOS_SCENARIOS}/setup.xml"/> + <dependency name="Setup" requires="Prerequisites"/> + + <import file="${ONOS_SCENARIOS}/net-smoke.xml"/> + <dependency name="Net-Smoke" requires="Setup"/> + + <import file="${ONOS_SCENARIOS}/archetypes.xml"/> + <dependency name="Archetypes" requires="Setup"/> + + <import file="${ONOS_SCENARIOS}/wrapup.xml"/> + <dependency name="Wrapup" requires="~Archetypes,~Setup,~Net-Smoke"/> +</scenario> 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 @@ +<!-- + ~ Copyright 2015 Open Networking Laboratory + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<scenario name="startup" description="ONOS cluster startup"> + <group name="Startup"> + <parallel var="${OC#}"> + <step name="Start-Service-${#}" exec="onos-service ${OC#} start"/> + <step name="Wait-for-Start-${#}" exec="onos-wait-for-start ${OC#}" + requires="Start-Service-${#}"/> + <step name="Check-Logs-${#}" exec="onos-check-logs ${OC#}" + requires="~Wait-for-Start-${#}"/> + </parallel> + </group> +</scenario> 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 @@ +<!-- + ~ Copyright 2015 Open Networking Laboratory + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<scenario name="tar-setup" description="ONOS cluster setup via onos.tar.gz"> + <group name="Setup-Instances"> + <step name="Push-Bits" exec="onos-push-bits-through-proxy" if="${OCT}"/> + <step name="Secure-SSH" exec="onos-secure-ssh -u ${ONOS_WEB_USER} -p ${ONOS_WEB_PASS}" if="${ONOS_USE_SSH}"/> + + <parallel var="${OC#}"> + <step name="Push-Bits-${#}" exec="onos-push-bits ${OC#}" unless="${OCT}"/> + <step name="Uninstall-${#}" exec="onos-uninstall ${OC#}"/> + <step name="Kill-${#}" env="~" exec="onos-kill ${OC#}" requires="Uninstall-${#}"/> + + <step name="Untar-And-Run-${#}" exec="onos-untar-and-run ${OC#}" + requires="Kill-${#},Push-Bits-${#},Push-Bits"/> + + <dependency name="Secure-SSH" requires="Untar-And-Run-${#}"/> + + <step name="Wait-for-Start-${#}" exec="onos-wait-for-start ${OC#}" + requires="Untar-And-Run-${#},~Secure-SSH"/> + + <step name="Check-Logs-${#}" exec="onos-check-logs ${OC#}" + requires="~Wait-for-Start-${#}"/> + <step name="Check-Components-${#}" exec="onos-check-components ${OC#}" + requires="~Wait-for-Start-${#}"/> + <step name="Check-Apps-${#}" exec="onos-check-apps ${OC#} drivers" + requires="~Wait-for-Start-${#}"/> + + <step name="Check-Nodes-${#}" exec="onos-check-nodes ${OC#} ${OC#}" + requires="~Wait-for-Start-${#}"/> + </parallel> + </group> + + <group name="Setup-Cluster" requires="Setup-Instances" unless="${NO_CLUSTER}"> + <step name="Form-Cluster" exec="onos-form-cluster -u ${ONOS_WEB_USER} -p ${ONOS_WEB_PASS} cell"/> + <parallel var="${OC#}"> + <step name="Wait-for-Start-Again-${#}" exec="onos-wait-for-start ${OC#}" + requires="Form-Cluster"/> + + <step name="Check-Logs-Again-${#}" exec="onos-check-logs ${OC#}" + requires="~Wait-for-Start-Again-${#}"/> + <step name="Check-Components-Again-${#}" exec="onos-check-components ${OC#}" + requires="~Wait-for-Start-Again-${#}"/> + <step name="Check-Apps-Again-${#}" exec="onos-check-apps ${OC#} drivers" + requires="~Wait-for-Start-Again-${#}"/> + + <step name="Check-Nodes-Again-${#}" exec="onos-check-nodes ${OC#}" + requires="~Wait-for-Start-Again-${#}"/> + </parallel> + </group> + +</scenario> 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 @@ +<!-- + ~ Copyright 2015 Open Networking Laboratory + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<scenario name="wrapup" description="ONOS test wrapup"> + <group name="Wrapup"> + <parallel var="${OC#}"> + <step name="Final-Check-Logs-${#}" exec="onos-check-logs ${OC#}"/> + <step name="Fetch-Logs-${#}" exec="onos-fetch-logs ${OC#}" + cwd="${WORKSPACE}/tmp/stc" requires="~^"/> + </parallel> + </group> +</scenario> |