blob: 78eacd2e7d7220601cbfe380c2d689a53150867c [file] [log] [blame]
Ray Milkey4ff514c2015-09-01 09:02:03 -07001<!--
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 ~ Copyright 2015-present Open Networking Laboratory
Ray Milkey4ff514c2015-09-01 09:02:03 -07003 ~
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 Milkey4ff514c2015-09-01 09:02:03 -070020 <!-- Force discovery of hosts -->
Ray Milkey955c4b82016-07-11 09:48:53 -070021 <step name="Net-REST.Find-Host-1"
Ray Milkey4ff514c2015-09-01 09:02:03 -070022 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 Vachuska4ccc7d32015-09-03 13:39:40 -070028 exec="find-link.py ${OC1} link1 of:0000000000000001 5 of:0000000000000006 4"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070029 <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 Vachuska4ccc7d32015-09-03 13:39:40 -070043 exec="find-link.py ${OC1} link2 of:0000000000000019 7 of:0000000000000006 3"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070044 <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 Milkey90289b02016-03-31 15:23:28 -070059 exec="find-host.py ${OC1} host1 00:00:00:00:00:01/None"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070060 <step name="Net-REST.Validate-Host-1-Id" requires="^"
Ray Milkey90289b02016-03-31 15:23:28 -070061 exec="test '${host1Id}' == '00:00:00:00:00:01/None'"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070062 <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 Milkey90289b02016-03-31 15:23:28 -070068 exec="find-host.py ${OC1} host2 00:00:00:00:00:04/None"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070069 <step name="Net-REST.Validate-Host-2-Id" requires="^"
Ray Milkey90289b02016-03-31 15:23:28 -070070 exec="test '${host2Id}' == '00:00:00:00:00:04/None'"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070071 <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 Vachuska4ccc7d32015-09-03 13:39:40 -070078 exec="find-device.py ${OC1} dev1 of:0000000000000014"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070079 <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 Vachuska4ccc7d32015-09-03 13:39:40 -070086 exec="test '${dev1IpAddress}' == '${OCN}'"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070087
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 Vachuska4ccc7d32015-09-03 13:39:40 -070090 exec="create-intent.py ${OC1} xy of:0000000000000001 1 of:0000000000000004 1"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070091 <step name="Net-REST.Create-Intent-YX" requires="^"
Thomas Vachuska4ccc7d32015-09-03 13:39:40 -070092 exec="create-intent.py ${OC1} yx of:0000000000000004 1 of:0000000000000001 1"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070093
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 Milkey6e968e12015-09-18 09:55:07 -070097 exec="curl-with-retry ${xyLocation}"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070098 <step name="Net-REST.Validate-Intent-YX-Installed"
Ray Milkey2495b982015-09-03 18:00:09 -070099 requires="^"
Ray Milkey6e968e12015-09-18 09:55:07 -0700100 exec="curl-with-retry ${yxLocation}"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -0700101
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 Vachuska4ccc7d32015-09-03 13:39:40 -0700105 exec="find-flow.py ${OC1} dev1out of:0000000000000001"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -0700106 <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 Vachuska4ccc7d32015-09-03 13:39:40 -0700112 exec="find-flow.py ${OC1} dev4out of:0000000000000004"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -0700113 <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 Milkey6e968e12015-09-18 09:55:07 -0700116 exec="test ${dev4outFlowPort} -ge 1 -a ${dev4outFlowPort} -le 5"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -0700117
118 <!-- Check that connectivity was established -->
Ray Milkey9ce9e252016-05-09 08:20:51 -0700119 <step name="Net-REST.Ping-XY" requires="^"
Ray Milkey4ff514c2015-09-01 09:02:03 -0700120 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 Milkey6e968e12015-09-18 09:55:07 -0700135 <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 Milkey4ff514c2015-09-01 09:02:03 -0700138
139 <!-- Use REST API to be sure that flows are no longer installed -->
Ray Milkey6e968e12015-09-18 09:55:07 -0700140 <step name="Net-REST.Validate-XY-Flows-Removed" requires="Net-REST.Allow-Intents-To-Purge"
Thomas Vachuska4ccc7d32015-09-03 13:39:40 -0700141 exec="find-flow.py ${OC1} dev1out of:0000000000000001"
Ray Milkey4ff514c2015-09-01 09:02:03 -0700142 env="!"/>
Ray Milkey6e968e12015-09-18 09:55:07 -0700143 <step name="Net-REST.Validate-YX-Flows-Removed" requires="Net-REST.Allow-Intents-To-Purge"
Thomas Vachuska4ccc7d32015-09-03 13:39:40 -0700144 exec="find-flow.py ${OC1} dev4out of:0000000000000004"
Ray Milkey4ff514c2015-09-01 09:02:03 -0700145 env="!"/>
146
147 <!-- Check that the deleted intents no longer appear in the REST API -->
Ray Milkey2495b982015-09-03 18:00:09 -0700148 <step name="Net-REST.Validate-Intent-XY-Removed" requires="Net-REST.Allow-Intents-To-Purge"
Ray Milkey6e968e12015-09-18 09:55:07 -0700149 exec="curl-with-retry ${xyLocation}" env="!"/>
Ray Milkey2495b982015-09-03 18:00:09 -0700150 <step name="Net-REST.Validate-Intent-YX-Removed" requires="Net-REST.Allow-Intents-To-Purge"
Ray Milkey6e968e12015-09-18 09:55:07 -0700151 exec="curl-with-retry ${yxLocation}" env="!"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -0700152
153 </group>
154</scenario>