Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 1 | <!-- |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | ~ Copyright 2015-present Open Networking Laboratory |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 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" |
Thomas Vachuska | 4ccc7d3 | 2015-09-03 13:39:40 -0700 | [diff] [blame] | 35 | exec="find-link.py ${OC1} link1 of:0000000000000001 5 of:0000000000000006 4"/> |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 36 | <step name="Net-REST.Validate-Link-1-State" requires="^" |
| 37 | exec="test '${link1State}' == 'ACTIVE'"/> |
| 38 | <step name="Net-REST.Validate-Link-1-Type" requires="^" |
| 39 | exec="test '${link1Type}' == 'DIRECT'"/> |
| 40 | <step name="Net-REST.Validate-Link-1-Src-Device" requires="^" |
| 41 | exec="test '${link1SrcDevice}' == 'of:0000000000000001'"/> |
| 42 | <step name="Net-REST.Validate-Link-1-Dst-Device" requires="^" |
| 43 | exec="test '${link1DstDevice}' == 'of:0000000000000006'"/> |
| 44 | <step name="Net-REST.Validate-Link-1-Src-Port" requires="^" |
| 45 | exec="test '${link1SrcPort}' == '5'"/> |
| 46 | <step name="Net-REST.Validate-Link-1-Dst-Port" requires="^" |
| 47 | exec="test '${link1DstPort}' == '4'"/> |
| 48 | |
| 49 | <step name="Net-REST.Query-Link-2" requires="Net-REST.Find-Host-2" |
Thomas Vachuska | 4ccc7d3 | 2015-09-03 13:39:40 -0700 | [diff] [blame] | 50 | exec="find-link.py ${OC1} link2 of:0000000000000019 7 of:0000000000000006 3"/> |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 51 | <step name="Net-REST.Validate-Link-2-State" requires="^" |
| 52 | exec="test '${link2State}' == 'ACTIVE'"/> |
| 53 | <step name="Net-REST.Validate-Link-2-Type" requires="^" |
| 54 | exec="test '${link2Type}' == 'DIRECT'"/> |
| 55 | <step name="Net-REST.Validate-Link-2-Src-Device" requires="^" |
| 56 | exec="test '${link2SrcDevice}' == 'of:0000000000000019'"/> |
| 57 | <step name="Net-REST.Validate-Link-2-Dst-Device" requires="^" |
| 58 | exec="test '${link2DstDevice}' == 'of:0000000000000006'"/> |
| 59 | <step name="Net-REST.Validate-Link-2-Src-Port" requires="^" |
| 60 | exec="test '${link2SrcPort}' == '7'"/> |
| 61 | <step name="Net-REST.Validate-Link-2-Dst-Port" requires="^" |
| 62 | exec="test '${link2DstPort}' == '3'"/> |
| 63 | |
| 64 | <!-- Verify the hosts using the REST API --> |
| 65 | <step name="Net-REST.Query-Host-1" requires="Net-REST.Find-Host-2" |
Ray Milkey | 90289b0 | 2016-03-31 15:23:28 -0700 | [diff] [blame] | 66 | exec="find-host.py ${OC1} host1 00:00:00:00:00:01/None"/> |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 67 | <step name="Net-REST.Validate-Host-1-Id" requires="^" |
Ray Milkey | 90289b0 | 2016-03-31 15:23:28 -0700 | [diff] [blame] | 68 | exec="test '${host1Id}' == '00:00:00:00:00:01/None'"/> |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 69 | <step name="Net-REST.Validate-Host-1-Mac" requires="^" |
| 70 | exec="test '${host1Mac}' == '00:00:00:00:00:01'"/> |
| 71 | <step name="Net-REST.Validate-Host-1-Ip" requires="^" |
| 72 | exec="test '${host1IpAddress}' == '10.0.0.1'"/> |
| 73 | |
| 74 | <step name="Net-REST.Query-Host-2" requires="Net-REST.Find-Host-2" |
Ray Milkey | 90289b0 | 2016-03-31 15:23:28 -0700 | [diff] [blame] | 75 | exec="find-host.py ${OC1} host2 00:00:00:00:00:04/None"/> |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 76 | <step name="Net-REST.Validate-Host-2-Id" requires="^" |
Ray Milkey | 90289b0 | 2016-03-31 15:23:28 -0700 | [diff] [blame] | 77 | exec="test '${host2Id}' == '00:00:00:00:00:04/None'"/> |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 78 | <step name="Net-REST.Validate-Host-2-Mac" requires="^" |
| 79 | exec="test '${host2Mac}' == '00:00:00:00:00:04'"/> |
| 80 | <step name="Net-REST.Validate-Host-2-Ip" requires="^" |
| 81 | exec="test '${host2IpAddress}' == '10.0.0.4'"/> |
| 82 | |
| 83 | <!-- Verify a switch using the REST API --> |
| 84 | <step name="Net-REST.Query-Dev-1" requires="Net-REST.Find-Host-2" |
Thomas Vachuska | 4ccc7d3 | 2015-09-03 13:39:40 -0700 | [diff] [blame] | 85 | exec="find-device.py ${OC1} dev1 of:0000000000000014"/> |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 86 | <step name="Net-REST.Validate-Dev1-Id" requires="^" |
| 87 | exec="test '${dev1Id}' == 'of:0000000000000014'"/> |
| 88 | <step name="Net-REST.Validate-Dev1-Type" requires="^" |
| 89 | exec="test '${dev1Type}' == 'SWITCH'"/> |
| 90 | <step name="Net-REST.Validate-Dev1-Available" requires="^" |
| 91 | exec="test '${dev1Available}' == 'True'"/> |
| 92 | <step name="Net-REST.Validate-Dev1-ChannelId" requires="^" |
Thomas Vachuska | 4ccc7d3 | 2015-09-03 13:39:40 -0700 | [diff] [blame] | 93 | exec="test '${dev1IpAddress}' == '${OCN}'"/> |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 94 | |
| 95 | <!-- Use REST API to create a point to point intent in each direction --> |
| 96 | <step name="Net-REST.Create-Intent-XY" requires="Net-REST.Find-Host-2" |
Thomas Vachuska | 4ccc7d3 | 2015-09-03 13:39:40 -0700 | [diff] [blame] | 97 | exec="create-intent.py ${OC1} xy of:0000000000000001 1 of:0000000000000004 1"/> |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 98 | <step name="Net-REST.Create-Intent-YX" requires="^" |
Thomas Vachuska | 4ccc7d3 | 2015-09-03 13:39:40 -0700 | [diff] [blame] | 99 | exec="create-intent.py ${OC1} yx of:0000000000000004 1 of:0000000000000001 1"/> |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 100 | |
| 101 | <!-- Check that the intents can be fetched via the REST API --> |
| 102 | <step name="Net-REST.Validate-Intent-XY-Installed" |
| 103 | requires="Net-REST.Create-Intent-YX" |
Ray Milkey | 6e968e1 | 2015-09-18 09:55:07 -0700 | [diff] [blame] | 104 | exec="curl-with-retry ${xyLocation}"/> |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 105 | <step name="Net-REST.Validate-Intent-YX-Installed" |
Ray Milkey | 2495b98 | 2015-09-03 18:00:09 -0700 | [diff] [blame] | 106 | requires="^" |
Ray Milkey | 6e968e1 | 2015-09-18 09:55:07 -0700 | [diff] [blame] | 107 | exec="curl-with-retry ${yxLocation}"/> |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 108 | |
| 109 | <!-- Use REST API to query flows created by the intents --> |
| 110 | <step name="Net-REST.Validate-Intent-XY-Flow-Installed" |
| 111 | requires="Net-REST.Create-Intent-YX" |
Thomas Vachuska | 4ccc7d3 | 2015-09-03 13:39:40 -0700 | [diff] [blame] | 112 | exec="find-flow.py ${OC1} dev1out of:0000000000000001"/> |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 113 | <step name="Net-REST.Validate-XY-Flow-State" requires="^" |
| 114 | exec="test '${dev1outFlowState}' == 'ADDED' -o '${dev1outFlowState}' == 'PENDING_ADD'"/> |
| 115 | <step name="Net-REST.Validate-XY-Flow-Port" requires="^" |
| 116 | exec="test ${dev1outFlowPort} -ge 1 -a ${dev1outFlowPort} -le 5"/> |
| 117 | |
| 118 | <step name="Net-REST.Validate-Intent-YX-Flow-Installed" requires="Net-REST.Create-Intent-YX" |
Thomas Vachuska | 4ccc7d3 | 2015-09-03 13:39:40 -0700 | [diff] [blame] | 119 | exec="find-flow.py ${OC1} dev4out of:0000000000000004"/> |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 120 | <step name="Net-REST.Validate-YX-Flow-State" requires="^" |
| 121 | exec="test '${dev4outFlowState}' == 'ADDED' -o '${dev4outFlowState}' == 'PENDING_ADD'"/> |
| 122 | <step name="Net-REST.Validate-YX-Flow-Port" requires="^" |
Ray Milkey | 6e968e1 | 2015-09-18 09:55:07 -0700 | [diff] [blame] | 123 | exec="test ${dev4outFlowPort} -ge 1 -a ${dev4outFlowPort} -le 5"/> |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 124 | |
| 125 | <!-- Check that connectivity was established --> |
| 126 | <step name="Net-REST.Ping-XY" requires="Net-REST.Create-Intent-XY,Net-REST.Create-Intent-YX" |
| 127 | exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/> |
| 128 | <step name="Net-REST.Ping-YX" requires="^" |
| 129 | exec="onos-mininet sendAndExpect h4 ping -c1 h1 --expect \ 0% packet loss"/> |
| 130 | |
| 131 | <!-- Remove the intents via the REST API --> |
| 132 | <step name="Net-REST.Delete-Intent-XY" |
| 133 | requires="Net-REST.Validate-Intent-XY-Installed, |
| 134 | Net-REST.Validate-Intent-YX-Installed, |
| 135 | Net-REST.Validate-Intent-XY-Flow-Installed, |
| 136 | Net-REST.Validate-Intent-YX-Flow-Installed, |
| 137 | Net-REST.Ping-XY, |
| 138 | Net-REST.Ping-YX" |
| 139 | exec="curl -f -X DELETE -uonos:rocks ${xyLocation}"/> |
| 140 | <step name="Net-REST.Delete-Intent-YX" requires="^" |
| 141 | exec="curl -f -X DELETE -uonos:rocks ${yxLocation}"/> |
Ray Milkey | 6e968e1 | 2015-09-18 09:55:07 -0700 | [diff] [blame] | 142 | <step name="Net-REST.Allow-Intents-To-Purge" |
| 143 | exec="onos-check-intent ${OC1} xy INSTALLED" env="!" |
| 144 | requires="Net-REST.Delete-Intent-XY,Net-REST.Delete-Intent-YX"/> |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 145 | |
| 146 | <!-- Use REST API to be sure that flows are no longer installed --> |
Ray Milkey | 6e968e1 | 2015-09-18 09:55:07 -0700 | [diff] [blame] | 147 | <step name="Net-REST.Validate-XY-Flows-Removed" requires="Net-REST.Allow-Intents-To-Purge" |
Thomas Vachuska | 4ccc7d3 | 2015-09-03 13:39:40 -0700 | [diff] [blame] | 148 | exec="find-flow.py ${OC1} dev1out of:0000000000000001" |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 149 | env="!"/> |
Ray Milkey | 6e968e1 | 2015-09-18 09:55:07 -0700 | [diff] [blame] | 150 | <step name="Net-REST.Validate-YX-Flows-Removed" requires="Net-REST.Allow-Intents-To-Purge" |
Thomas Vachuska | 4ccc7d3 | 2015-09-03 13:39:40 -0700 | [diff] [blame] | 151 | exec="find-flow.py ${OC1} dev4out of:0000000000000004" |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 152 | env="!"/> |
| 153 | |
| 154 | <!-- Check that the deleted intents no longer appear in the REST API --> |
Ray Milkey | 2495b98 | 2015-09-03 18:00:09 -0700 | [diff] [blame] | 155 | <step name="Net-REST.Validate-Intent-XY-Removed" requires="Net-REST.Allow-Intents-To-Purge" |
Ray Milkey | 6e968e1 | 2015-09-18 09:55:07 -0700 | [diff] [blame] | 156 | exec="curl-with-retry ${xyLocation}" env="!"/> |
Ray Milkey | 2495b98 | 2015-09-03 18:00:09 -0700 | [diff] [blame] | 157 | <step name="Net-REST.Validate-Intent-YX-Removed" requires="Net-REST.Allow-Intents-To-Purge" |
Ray Milkey | 6e968e1 | 2015-09-18 09:55:07 -0700 | [diff] [blame] | 158 | exec="curl-with-retry ${yxLocation}" env="!"/> |
Ray Milkey | 4ff514c | 2015-09-01 09:02:03 -0700 | [diff] [blame] | 159 | |
| 160 | </group> |
| 161 | </scenario> |