Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 1 | <!-- |
| 2 | ~ Copyright 2015 Open Networking Laboratory |
| 3 | ~ |
| 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | ~ you may not use this file except in compliance with the License. |
| 6 | ~ You may obtain a copy of the License at |
| 7 | ~ |
| 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | ~ |
| 10 | ~ Unless required by applicable law or agreed to in writing, software |
| 11 | ~ distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | ~ See the License for the specific language governing permissions and |
| 14 | ~ limitations under the License. |
| 15 | --> |
| 16 | <scenario name="net-rest" |
| 17 | description="Network REST API test"> |
| 18 | <!-- TODO: parametrize this via recipes --> |
| 19 | <group name="Net-REST"> |
| 20 | |
| 21 | <!-- Make sure that reactive forwarding is off --> |
| 22 | <step name="Net-REST.Uninstall-Reactive-Forwarding" |
| 23 | exec="onos ${OC1} app deactivate org.onosproject.fwd org.onosproject.ifwd"/> |
| 24 | <step name="Net-REST.Check-Apps" requires="^" |
| 25 | exec="onos-check-apps ${OC1} fwd,ifwd excludes"/> |
| 26 | |
| 27 | <!-- Force discovery of hosts --> |
| 28 | <step name="Net-REST.Find-Host-1" requires="^" |
| 29 | exec="onos-mininet sendAndExpect h1 ping -c1 -w1 h4 --expect ."/> |
| 30 | <step name="Net-REST.Find-Host-2" requires="^" |
| 31 | exec="onos-mininet sendAndExpect h4 ping -c1 -w1 h1 --expect ."/> |
| 32 | |
| 33 | <!-- Verify some links using the REST API --> |
| 34 | <step name="Net-REST.Query-Link-1" requires="Net-REST.Find-Host-2" |
| 35 | exec="${ONOS_ROOT}/tools/test/scenarios/net-rest/find-link.py |
| 36 | ${OC1} link1 of:0000000000000001 5 of:0000000000000006 4"/> |
| 37 | <step name="Net-REST.Validate-Link-1-State" requires="^" |
| 38 | exec="test '${link1State}' == 'ACTIVE'"/> |
| 39 | <step name="Net-REST.Validate-Link-1-Type" requires="^" |
| 40 | exec="test '${link1Type}' == 'DIRECT'"/> |
| 41 | <step name="Net-REST.Validate-Link-1-Src-Device" requires="^" |
| 42 | exec="test '${link1SrcDevice}' == 'of:0000000000000001'"/> |
| 43 | <step name="Net-REST.Validate-Link-1-Dst-Device" requires="^" |
| 44 | exec="test '${link1DstDevice}' == 'of:0000000000000006'"/> |
| 45 | <step name="Net-REST.Validate-Link-1-Src-Port" requires="^" |
| 46 | exec="test '${link1SrcPort}' == '5'"/> |
| 47 | <step name="Net-REST.Validate-Link-1-Dst-Port" requires="^" |
| 48 | exec="test '${link1DstPort}' == '4'"/> |
| 49 | |
| 50 | <step name="Net-REST.Query-Link-2" requires="Net-REST.Find-Host-2" |
| 51 | exec="${ONOS_ROOT}/tools/test/scenarios/net-rest/find-link.py |
| 52 | ${OC1} link2 of:0000000000000019 7 of:0000000000000006 3"/> |
| 53 | <step name="Net-REST.Validate-Link-2-State" requires="^" |
| 54 | exec="test '${link2State}' == 'ACTIVE'"/> |
| 55 | <step name="Net-REST.Validate-Link-2-Type" requires="^" |
| 56 | exec="test '${link2Type}' == 'DIRECT'"/> |
| 57 | <step name="Net-REST.Validate-Link-2-Src-Device" requires="^" |
| 58 | exec="test '${link2SrcDevice}' == 'of:0000000000000019'"/> |
| 59 | <step name="Net-REST.Validate-Link-2-Dst-Device" requires="^" |
| 60 | exec="test '${link2DstDevice}' == 'of:0000000000000006'"/> |
| 61 | <step name="Net-REST.Validate-Link-2-Src-Port" requires="^" |
| 62 | exec="test '${link2SrcPort}' == '7'"/> |
| 63 | <step name="Net-REST.Validate-Link-2-Dst-Port" requires="^" |
| 64 | exec="test '${link2DstPort}' == '3'"/> |
| 65 | |
| 66 | <!-- Verify the hosts using the REST API --> |
| 67 | <step name="Net-REST.Query-Host-1" requires="Net-REST.Find-Host-2" |
| 68 | exec="${ONOS_ROOT}/tools/test/scenarios/net-rest/find-host.py |
| 69 | ${OC1} host1 00:00:00:00:00:01/-1"/> |
| 70 | <step name="Net-REST.Validate-Host-1-Id" requires="^" |
| 71 | exec="test '${host1Id}' == '00:00:00:00:00:01/-1'"/> |
| 72 | <step name="Net-REST.Validate-Host-1-Mac" requires="^" |
| 73 | exec="test '${host1Mac}' == '00:00:00:00:00:01'"/> |
| 74 | <step name="Net-REST.Validate-Host-1-Ip" requires="^" |
| 75 | exec="test '${host1IpAddress}' == '10.0.0.1'"/> |
| 76 | |
| 77 | <step name="Net-REST.Query-Host-2" requires="Net-REST.Find-Host-2" |
| 78 | exec="${ONOS_ROOT}/tools/test/scenarios/net-rest/find-host.py |
| 79 | ${OC1} host2 00:00:00:00:00:04/-1"/> |
| 80 | <step name="Net-REST.Validate-Host-2-Id" requires="^" |
| 81 | exec="test '${host2Id}' == '00:00:00:00:00:04/-1'"/> |
| 82 | <step name="Net-REST.Validate-Host-2-Mac" requires="^" |
| 83 | exec="test '${host2Mac}' == '00:00:00:00:00:04'"/> |
| 84 | <step name="Net-REST.Validate-Host-2-Ip" requires="^" |
| 85 | exec="test '${host2IpAddress}' == '10.0.0.4'"/> |
| 86 | |
| 87 | <!-- Verify a switch using the REST API --> |
| 88 | <step name="Net-REST.Query-Dev-1" requires="Net-REST.Find-Host-2" |
| 89 | exec="${ONOS_ROOT}/tools/test/scenarios/net-rest/find-device.py |
| 90 | ${OC1} dev1 of:0000000000000014"/> |
| 91 | <step name="Net-REST.Validate-Dev1-Id" requires="^" |
| 92 | exec="test '${dev1Id}' == 'of:0000000000000014'"/> |
| 93 | <step name="Net-REST.Validate-Dev1-Type" requires="^" |
| 94 | exec="test '${dev1Type}' == 'SWITCH'"/> |
| 95 | <step name="Net-REST.Validate-Dev1-Available" requires="^" |
| 96 | exec="test '${dev1Available}' == 'True'"/> |
| 97 | <step name="Net-REST.Validate-Dev1-ChannelId" requires="^" |
| 98 | exec="test '${dev1IpAddress}' == '192.168.56.102'"/> |
| 99 | |
| 100 | <!-- Use REST API to create a point to point intent in each direction --> |
| 101 | <step name="Net-REST.Create-Intent-XY" requires="Net-REST.Find-Host-2" |
| 102 | exec="${ONOS_ROOT}/tools/test/scenarios/net-rest/create-intent.py |
| 103 | ${OC1} xy of:0000000000000001 1 of:0000000000000004 1"/> |
| 104 | <step name="Net-REST.Create-Intent-YX" requires="^" |
| 105 | exec="${ONOS_ROOT}/tools/test/scenarios/net-rest/create-intent.py |
| 106 | ${OC1} yx of:0000000000000004 1 of:0000000000000001 1"/> |
| 107 | |
| 108 | <!-- Check that the intents can be fetched via the REST API --> |
| 109 | <step name="Net-REST.Validate-Intent-XY-Installed" |
| 110 | requires="Net-REST.Create-Intent-YX" |
| 111 | exec="curl -f -uonos:rocks ${xyLocation}"/> |
| 112 | <step name="Net-REST.Validate-Intent-YX-Installed" |
| 113 | requires="Net-REST.Create-Intent-YX" |
| 114 | exec="curl -f -uonos:rocks ${yxLocation}"/> |
| 115 | |
| 116 | <!-- Use REST API to query flows created by the intents --> |
| 117 | <step name="Net-REST.Validate-Intent-XY-Flow-Installed" |
| 118 | requires="Net-REST.Create-Intent-YX" |
| 119 | exec="${ONOS_ROOT}/tools/test/scenarios/net-rest/find-flow.py |
| 120 | ${OC1} dev1out of:0000000000000001"/> |
| 121 | <step name="Net-REST.Validate-XY-Flow-State" requires="^" |
| 122 | exec="test '${dev1outFlowState}' == 'ADDED' -o '${dev1outFlowState}' == 'PENDING_ADD'"/> |
| 123 | <step name="Net-REST.Validate-XY-Flow-Port" requires="^" |
| 124 | exec="test ${dev1outFlowPort} -ge 1 -a ${dev1outFlowPort} -le 5"/> |
| 125 | |
| 126 | <step name="Net-REST.Validate-Intent-YX-Flow-Installed" requires="Net-REST.Create-Intent-YX" |
| 127 | exec="${ONOS_ROOT}/tools/test/scenarios/net-rest/find-flow.py |
| 128 | ${OC1} dev4out of:0000000000000004"/> |
| 129 | <step name="Net-REST.Validate-YX-Flow-State" requires="^" |
| 130 | exec="test '${dev4outFlowState}' == 'ADDED' -o '${dev4outFlowState}' == 'PENDING_ADD'"/> |
| 131 | <step name="Net-REST.Validate-YX-Flow-Port" requires="^" |
| 132 | exec="test '${dev4outFlowPort}' == '3'"/> |
| 133 | |
| 134 | <!-- Check that connectivity was established --> |
| 135 | <step name="Net-REST.Ping-XY" requires="Net-REST.Create-Intent-XY,Net-REST.Create-Intent-YX" |
| 136 | exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/> |
| 137 | <step name="Net-REST.Ping-YX" requires="^" |
| 138 | exec="onos-mininet sendAndExpect h4 ping -c1 h1 --expect \ 0% packet loss"/> |
| 139 | |
| 140 | <!-- Remove the intents via the REST API --> |
| 141 | <step name="Net-REST.Delete-Intent-XY" |
| 142 | requires="Net-REST.Validate-Intent-XY-Installed, |
| 143 | Net-REST.Validate-Intent-YX-Installed, |
| 144 | Net-REST.Validate-Intent-XY-Flow-Installed, |
| 145 | Net-REST.Validate-Intent-YX-Flow-Installed, |
| 146 | Net-REST.Ping-XY, |
| 147 | Net-REST.Ping-YX" |
| 148 | exec="curl -f -X DELETE -uonos:rocks ${xyLocation}"/> |
| 149 | <step name="Net-REST.Delete-Intent-YX" requires="^" |
| 150 | exec="curl -f -X DELETE -uonos:rocks ${yxLocation}"/> |
| 151 | |
| 152 | <!-- Use REST API to be sure that flows are no longer installed --> |
| 153 | <step name="Net-REST.Validate-XY-Flows-Removed" requires="Net-REST.Delete-Intent-XY" |
| 154 | exec="${ONOS_ROOT}/tools/test/scenarios/net-rest/find-flow.py |
| 155 | ${OC1} dev1out of:0000000000000001" |
| 156 | env="!"/> |
| 157 | <step name="Net-REST.Validate-YX-Flows-Removed" requires="Net-REST.Delete-Intent-YX" |
| 158 | exec="${ONOS_ROOT}/tools/test/scenarios/net-rest/find-flow.py |
| 159 | ${OC1} dev4out of:0000000000000004" |
| 160 | env="!"/> |
| 161 | |
| 162 | <!-- Check that the deleted intents no longer appear in the REST API --> |
| 163 | <step name="Net-REST.Validate-Intent-XY-Removed" requires="Net-REST.Delete-Intent-XY" |
| 164 | exec="curl -f -uonos:rocks ${xyLocation}" env="!"/> |
| 165 | <step name="Net-REST.Validate-Intent-YX-Removed" requires="Net-REST.Delete-Intent-YX" |
| 166 | exec="curl -f -uonos:rocks ${yxLocation}" env="!"/> |
| 167 | |
| 168 | </group> |
| 169 | </scenario> |