blob: ec212fe51de4b0ffd1ddeb247a5610e05d78686f [file] [log] [blame]
Ray Milkey4ff514c2015-09-01 09:02:03 -07001<!--
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"
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"
Thomas Vachuska4ccc7d32015-09-03 13:39:40 -070066 exec="find-host.py ${OC1} host1 00:00:00:00:00:01/-1"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070067 <step name="Net-REST.Validate-Host-1-Id" requires="^"
68 exec="test '${host1Id}' == '00:00:00:00:00:01/-1'"/>
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"
Thomas Vachuska4ccc7d32015-09-03 13:39:40 -070075 exec="find-host.py ${OC1} host2 00:00:00:00:00:04/-1"/>
Ray Milkey4ff514c2015-09-01 09:02:03 -070076 <step name="Net-REST.Validate-Host-2-Id" requires="^"
77 exec="test '${host2Id}' == '00:00:00:00:00:04/-1'"/>
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 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"
104 exec="curl -f -uonos:rocks ${xyLocation}"/>
105 <step name="Net-REST.Validate-Intent-YX-Installed"
106 requires="Net-REST.Create-Intent-YX"
107 exec="curl -f -uonos:rocks ${yxLocation}"/>
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 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="^"
123 exec="test '${dev4outFlowPort}' == '3'"/>
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}"/>
142
143 <!-- Use REST API to be sure that flows are no longer installed -->
144 <step name="Net-REST.Validate-XY-Flows-Removed" requires="Net-REST.Delete-Intent-XY"
Thomas Vachuska4ccc7d32015-09-03 13:39:40 -0700145 exec="find-flow.py ${OC1} dev1out of:0000000000000001"
Ray Milkey4ff514c2015-09-01 09:02:03 -0700146 env="!"/>
147 <step name="Net-REST.Validate-YX-Flows-Removed" requires="Net-REST.Delete-Intent-YX"
Thomas Vachuska4ccc7d32015-09-03 13:39:40 -0700148 exec="find-flow.py ${OC1} dev4out of:0000000000000004"
Ray Milkey4ff514c2015-09-01 09:02:03 -0700149 env="!"/>
150
151 <!-- Check that the deleted intents no longer appear in the REST API -->
152 <step name="Net-REST.Validate-Intent-XY-Removed" requires="Net-REST.Delete-Intent-XY"
153 exec="curl -f -uonos:rocks ${xyLocation}" env="!"/>
154 <step name="Net-REST.Validate-Intent-YX-Removed" requires="Net-REST.Delete-Intent-YX"
155 exec="curl -f -uonos:rocks ${yxLocation}" env="!"/>
156
157 </group>
158</scenario>