Ray Milkey

STC scenario for creation and testing of flow objectives

Change-Id: I298424d7354cc0cf8c682e904ccb2d55ead8ada0
1 +# /bin/sh
2 +
3 +if [ "$#" -ne 6 ]
4 +then
5 + echo usage: create-forward-objective.sh onos device src-mac dst-mac src-port dst-port
6 + exit 1
7 +fi
8 +
9 +
10 +onos=$1
11 +device=$2
12 +srcMac=$3
13 +dstMac=$4
14 +srcPort=$5
15 +dstPort=$6
16 +
17 +curl -u onos:rocks -X POST --header "Content-Type: application/json" --header "Accept: application/json" -d "{
18 + \"priority\": 100,
19 + \"isPermanent\": \"false\",
20 + \"timeout\": 100,
21 + \"flag\": \"VERSATILE\",
22 + \"operation\": \"ADD\",
23 + \"selector\": {
24 + \"criteria\": [
25 + {\"type\": \"ETH_TYPE\", \"ethType\": 2048},
26 + {\"type\": \"IN_PORT\", \"port\": \"$srcPort\"},
27 + {\"type\": \"ETH_DST\", \"mac\": \"$dstMac\"},
28 + {\"type\": \"ETH_SRC\", \"mac\": \"$srcMac\"}
29 + ]
30 + },
31 + \"treatment\":
32 + {
33 + \"instructions\":
34 + [
35 + {\"type\":\"OUTPUT\",\"port\":$dstPort}
36 + ],
37 + \"deferred\":[]
38 + }
39 +}" http://${onos}:8181/onos/v1/flowobjectives/$device/forward
40 +
41 +echo
1 +<!--
2 + ~ Copyright 2016 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-flow-objectives"
17 + description="Network REST API test">
18 + <!-- TODO: parametrize this via recipes -->
19 + <group name="Net-Flow-Objectives">
20 +
21 + <!-- Make sure that reactive forwarding is off -->
22 + <step name="Net-Flow-Objectives.Uninstall-Reactive-Forwarding"
23 + exec="onos ${OC1} app deactivate org.onosproject.fwd org.onosproject.ifwd"/>
24 + <step name="Net-Flow-Objectives.Check-Apps" requires="^"
25 + exec="onos-check-apps ${OC1} fwd,ifwd excludes"/>
26 +
27 + <!-- Force discovery of hosts -->
28 + <step name="Net-Flow-Objectives.Find-Host-1" requires="^"
29 + exec="onos-mininet sendAndExpect h1 ping -c1 -w1 h4 --expect ."/>
30 + <step name="Net-Flow-Objectives.Find-Host-2" requires="^"
31 + exec="onos-mininet sendAndExpect h4 ping -c1 -w1 h1 --expect ."/>
32 +
33 + <!-- Verify the hosts using the REST API -->
34 + <step name="Net-Flow-Objectives.Query-Host-1" requires="Net-Flow-Objectives.Find-Host-1"
35 + exec="find-host.py ${OC1} host1 00:00:00:00:00:01/-1"/>
36 + <step name="Net-Flow-Objectives.Validate-Host-1-Id" requires="^"
37 + exec="test '${host1Id}' == '00:00:00:00:00:01/-1'"/>
38 + <step name="Net-Flow-Objectives.Validate-Host-1-Mac" requires="^"
39 + exec="test '${host1Mac}' == '00:00:00:00:00:01'"/>
40 + <step name="Net-Flow-Objectives.Validate-Host-1-Ip" requires="^"
41 + exec="test '${host1IpAddress}' == '10.0.0.1'"/>
42 +
43 + <step name="Net-Flow-Objectives.Query-Host-2" requires="Net-Flow-Objectives.Find-Host-2"
44 + exec="find-host.py ${OC1} host2 00:00:00:00:00:04/-1"/>
45 + <step name="Net-Flow-Objectives.Validate-Host-2-Id" requires="^"
46 + exec="test '${host2Id}' == '00:00:00:00:00:04/-1'"/>
47 + <step name="Net-Flow-Objectives.Validate-Host-2-Mac" requires="^"
48 + exec="test '${host2Mac}' == '00:00:00:00:00:04'"/>
49 + <step name="Net-Flow-Objectives.Validate-Host-2-Ip" requires="^"
50 + exec="test '${host2IpAddress}' == '10.0.0.4'"/>
51 +
52 + <!-- Use REST API to create flow objectives to connect h1 and h4 -->
53 + <step name="Net-Flow-Objectives.Objective-1F" requires="Net-Flow-Objectives.Find-Host-2"
54 + exec="create-forward-objective.sh ${OC1} of:0000000000000001 00:00:00:00:00:01 00:00:00:00:00:04 1 2"/>
55 + <step name="Net-Flow-Objectives.Objective-1R" requires="Net-Flow-Objectives.Find-Host-2"
56 + exec="create-forward-objective.sh ${OC1} of:0000000000000001 00:00:00:00:00:04 00:00:00:00:00:01 2 1"/>
57 +
58 + <step name="Net-Flow-Objectives.Objective-19F" requires="Net-Flow-Objectives.Find-Host-2"
59 + exec="create-forward-objective.sh ${OC1} of:0000000000000019 00:00:00:00:00:01 00:00:00:00:00:04 2 8"/>
60 + <step name="Net-Flow-Objectives.Objective-19R" requires="^"
61 + exec="create-forward-objective.sh ${OC1} of:0000000000000019 00:00:00:00:00:04 00:00:00:00:00:01 8 2"/>
62 +
63 + <step name="Net-Flow-Objectives.Objective-7F" requires="Net-Flow-Objectives.Find-Host-2"
64 + exec="create-forward-objective.sh ${OC1} of:0000000000000007 00:00:00:00:00:01 00:00:00:00:00:04 2 3"/>
65 + <step name="Net-Flow-Objectives.Objective-7R" requires="Net-Flow-Objectives.Find-Host-2"
66 + exec="create-forward-objective.sh ${OC1} of:0000000000000007 00:00:00:00:00:04 00:00:00:00:00:01 3 2"/>
67 +
68 + <step name="Net-Flow-Objectives.Objective-4F" requires="Net-Flow-Objectives.Find-Host-2"
69 + exec="create-forward-objective.sh ${OC1} of:0000000000000004 00:00:00:00:00:01 00:00:00:00:00:04 3 1"/>
70 + <step name="Net-Flow-Objectives.Objective-4R" requires="Net-Flow-Objectives.Find-Host-2"
71 + exec="create-forward-objective.sh ${OC1} of:0000000000000004 00:00:00:00:00:04 00:00:00:00:00:01 1 3"/>
72 +
73 +
74 + <!-- Check that connectivity was established -->
75 + <step name="Net-Flow-Objectives.Ping-XY" requires="Net-Flow-Objectives.Objective-1F,
76 + Net-Flow-Objectives.Objective-1R,
77 + Net-Flow-Objectives.Objective-19F,
78 + Net-Flow-Objectives.Objective-19R
79 + Net-Flow-Objectives.Objective-7F,
80 + Net-Flow-Objectives.Objective-7R
81 + Net-Flow-Objectives.Objective-4F,
82 + Net-Flow-Objectives.Objective-4R"
83 + exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/>
84 + <step name="Net-Flow-Objectives.Ping-YX" requires="^"
85 + exec="onos-mininet sendAndExpect h4 ping -c1 h1 --expect \ 0% packet loss"/>
86 +
87 + </group>
88 +</scenario>
...@@ -35,8 +35,11 @@ ...@@ -35,8 +35,11 @@
35 <import file="${ONOS_SCENARIOS}/net-create-flows.xml"/> 35 <import file="${ONOS_SCENARIOS}/net-create-flows.xml"/>
36 <dependency name="Net-Create-Flows" requires="Net-Setup,P2P-Intent-Connectivity,Net-REST"/> 36 <dependency name="Net-Create-Flows" requires="Net-Setup,P2P-Intent-Connectivity,Net-REST"/>
37 37
38 + <import file="${ONOS_SCENARIOS}/net-flow-objectives.xml"/>
39 + <dependency name="Net-Flow-Objectives" requires="Net-Setup,P2P-Intent-Connectivity,Net-REST,Net-Create-Flows"/>
40 +
38 <import file="${ONOS_SCENARIOS}/net-topo.xml"/> 41 <import file="${ONOS_SCENARIOS}/net-topo.xml"/>
39 - <dependency name="Net-Topo" requires="Net-Setup,Net-Create-Flows"/> 42 + <dependency name="Net-Topo" requires="Net-Setup,Net-Create-Flows,Net-Flow-Objectives"/>
40 43
41 <import file="${ONOS_SCENARIOS}/net-teardown.xml"/> 44 <import file="${ONOS_SCENARIOS}/net-teardown.xml"/>
42 <dependency name="Net-Teardown" requires="~Host-Intent-Connectivity, 45 <dependency name="Net-Teardown" requires="~Host-Intent-Connectivity,
......