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