blob: 95f91d14d3557854e92584df73c8d18903260d66 [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">
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 Vachuska4ccc7d32015-09-03 13:39:40 -070035 exec="find-link.py ${OC1} link1 of:0000000000000001 5 of:0000000000000006 4"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070036 <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 Vachuska4ccc7d32015-09-03 13:39:40 -070050 exec="find-link.py ${OC1} link2 of:0000000000000019 7 of:0000000000000006 3"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070051 <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 Milkey90289b02016-03-31 15:23:28 -070066 exec="find-host.py ${OC1} host1 00:00:00:00:00:01/None"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070067 <step name="Net-REST.Validate-Host-1-Id" requires="^"
Ray Milkey90289b02016-03-31 15:23:28 -070068 exec="test '${host1Id}' == '00:00:00:00:00:01/None'"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070069 <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 Milkey90289b02016-03-31 15:23:28 -070075 exec="find-host.py ${OC1} host2 00:00:00:00:00:04/None"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070076 <step name="Net-REST.Validate-Host-2-Id" requires="^"
Ray Milkey90289b02016-03-31 15:23:28 -070077 exec="test '${host2Id}' == '00:00:00:00:00:04/None'"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070078 <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 Vachuska4ccc7d32015-09-03 13:39:40 -070085 exec="find-device.py ${OC1} dev1 of:0000000000000014"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070086 <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 Vachuska4ccc7d32015-09-03 13:39:40 -070093 exec="test '${dev1IpAddress}' == '${OCN}'"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070094
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 Vachuska4ccc7d32015-09-03 13:39:40 -070097 exec="create-intent.py ${OC1} xy of:0000000000000001 1 of:0000000000000004 1"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070098 <step name="Net-REST.Create-Intent-YX" requires="^"
Thomas Vachuska4ccc7d32015-09-03 13:39:40 -070099 exec="create-intent.py ${OC1} yx of:0000000000000004 1 of:0000000000000001 1"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -0700100
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 Milkey6e968e12015-09-18 09:55:07 -0700104 exec="curl-with-retry ${xyLocation}"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -0700105 <step name="Net-REST.Validate-Intent-YX-Installed"
Ray Milkey2495b982015-09-03 18:00:09 -0700106 requires="^"
Ray Milkey6e968e12015-09-18 09:55:07 -0700107 exec="curl-with-retry ${yxLocation}"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -0700108
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 Vachuska4ccc7d32015-09-03 13:39:40 -0700112 exec="find-flow.py ${OC1} dev1out of:0000000000000001"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -0700113 <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 Vachuska4ccc7d32015-09-03 13:39:40 -0700119 exec="find-flow.py ${OC1} dev4out of:0000000000000004"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -0700120 <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 Milkey6e968e12015-09-18 09:55:07 -0700123 exec="test ${dev4outFlowPort} -ge 1 -a ${dev4outFlowPort} -le 5"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -0700124
125 <!-- Check that connectivity was established -->
Ray Milkey9ce9e252016-05-09 08:20:51 -0700126 <step name="Net-REST.Ping-XY" requires="^"
Ray Milkey4ff514c2015-09-01 09:02:03 -0700127 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 Milkey6e968e12015-09-18 09:55:07 -0700142 <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 Milkey4ff514c2015-09-01 09:02:03 -0700145
146 <!-- Use REST API to be sure that flows are no longer installed -->
Ray Milkey6e968e12015-09-18 09:55:07 -0700147 <step name="Net-REST.Validate-XY-Flows-Removed" requires="Net-REST.Allow-Intents-To-Purge"
Thomas Vachuska4ccc7d32015-09-03 13:39:40 -0700148 exec="find-flow.py ${OC1} dev1out of:0000000000000001"
Ray Milkey4ff514c2015-09-01 09:02:03 -0700149 env="!"/>
Ray Milkey6e968e12015-09-18 09:55:07 -0700150 <step name="Net-REST.Validate-YX-Flows-Removed" requires="Net-REST.Allow-Intents-To-Purge"
Thomas Vachuska4ccc7d32015-09-03 13:39:40 -0700151 exec="find-flow.py ${OC1} dev4out of:0000000000000004"
Ray Milkey4ff514c2015-09-01 09:02:03 -0700152 env="!"/>
153
154 <!-- Check that the deleted intents no longer appear in the REST API -->
Ray Milkey2495b982015-09-03 18:00:09 -0700155 <step name="Net-REST.Validate-Intent-XY-Removed" requires="Net-REST.Allow-Intents-To-Purge"
Ray Milkey6e968e12015-09-18 09:55:07 -0700156 exec="curl-with-retry ${xyLocation}" env="!"/>
Ray Milkey2495b982015-09-03 18:00:09 -0700157 <step name="Net-REST.Validate-Intent-YX-Removed" requires="Net-REST.Allow-Intents-To-Purge"
Ray Milkey6e968e12015-09-18 09:55:07 -0700158 exec="curl-with-retry ${yxLocation}" env="!"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -0700159
160 </group>
161</scenario>