Ray Milkey

STC scenario for creation and testing of flow objectives

Change-Id: I298424d7354cc0cf8c682e904ccb2d55ead8ada0
# /bin/sh
if [ "$#" -ne 6 ]
then
echo usage: create-forward-objective.sh onos device src-mac dst-mac src-port dst-port
exit 1
fi
onos=$1
device=$2
srcMac=$3
dstMac=$4
srcPort=$5
dstPort=$6
curl -u onos:rocks -X POST --header "Content-Type: application/json" --header "Accept: application/json" -d "{
\"priority\": 100,
\"isPermanent\": \"false\",
\"timeout\": 100,
\"flag\": \"VERSATILE\",
\"operation\": \"ADD\",
\"selector\": {
\"criteria\": [
{\"type\": \"ETH_TYPE\", \"ethType\": 2048},
{\"type\": \"IN_PORT\", \"port\": \"$srcPort\"},
{\"type\": \"ETH_DST\", \"mac\": \"$dstMac\"},
{\"type\": \"ETH_SRC\", \"mac\": \"$srcMac\"}
]
},
\"treatment\":
{
\"instructions\":
[
{\"type\":\"OUTPUT\",\"port\":$dstPort}
],
\"deferred\":[]
}
}" http://${onos}:8181/onos/v1/flowobjectives/$device/forward
echo
<!--
~ Copyright 2016 Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<scenario name="net-flow-objectives"
description="Network REST API test">
<!-- TODO: parametrize this via recipes -->
<group name="Net-Flow-Objectives">
<!-- Make sure that reactive forwarding is off -->
<step name="Net-Flow-Objectives.Uninstall-Reactive-Forwarding"
exec="onos ${OC1} app deactivate org.onosproject.fwd org.onosproject.ifwd"/>
<step name="Net-Flow-Objectives.Check-Apps" requires="^"
exec="onos-check-apps ${OC1} fwd,ifwd excludes"/>
<!-- Force discovery of hosts -->
<step name="Net-Flow-Objectives.Find-Host-1" requires="^"
exec="onos-mininet sendAndExpect h1 ping -c1 -w1 h4 --expect ."/>
<step name="Net-Flow-Objectives.Find-Host-2" requires="^"
exec="onos-mininet sendAndExpect h4 ping -c1 -w1 h1 --expect ."/>
<!-- Verify the hosts using the REST API -->
<step name="Net-Flow-Objectives.Query-Host-1" requires="Net-Flow-Objectives.Find-Host-1"
exec="find-host.py ${OC1} host1 00:00:00:00:00:01/-1"/>
<step name="Net-Flow-Objectives.Validate-Host-1-Id" requires="^"
exec="test '${host1Id}' == '00:00:00:00:00:01/-1'"/>
<step name="Net-Flow-Objectives.Validate-Host-1-Mac" requires="^"
exec="test '${host1Mac}' == '00:00:00:00:00:01'"/>
<step name="Net-Flow-Objectives.Validate-Host-1-Ip" requires="^"
exec="test '${host1IpAddress}' == '10.0.0.1'"/>
<step name="Net-Flow-Objectives.Query-Host-2" requires="Net-Flow-Objectives.Find-Host-2"
exec="find-host.py ${OC1} host2 00:00:00:00:00:04/-1"/>
<step name="Net-Flow-Objectives.Validate-Host-2-Id" requires="^"
exec="test '${host2Id}' == '00:00:00:00:00:04/-1'"/>
<step name="Net-Flow-Objectives.Validate-Host-2-Mac" requires="^"
exec="test '${host2Mac}' == '00:00:00:00:00:04'"/>
<step name="Net-Flow-Objectives.Validate-Host-2-Ip" requires="^"
exec="test '${host2IpAddress}' == '10.0.0.4'"/>
<!-- Use REST API to create flow objectives to connect h1 and h4 -->
<step name="Net-Flow-Objectives.Objective-1F" requires="Net-Flow-Objectives.Find-Host-2"
exec="create-forward-objective.sh ${OC1} of:0000000000000001 00:00:00:00:00:01 00:00:00:00:00:04 1 2"/>
<step name="Net-Flow-Objectives.Objective-1R" requires="Net-Flow-Objectives.Find-Host-2"
exec="create-forward-objective.sh ${OC1} of:0000000000000001 00:00:00:00:00:04 00:00:00:00:00:01 2 1"/>
<step name="Net-Flow-Objectives.Objective-19F" requires="Net-Flow-Objectives.Find-Host-2"
exec="create-forward-objective.sh ${OC1} of:0000000000000019 00:00:00:00:00:01 00:00:00:00:00:04 2 8"/>
<step name="Net-Flow-Objectives.Objective-19R" requires="^"
exec="create-forward-objective.sh ${OC1} of:0000000000000019 00:00:00:00:00:04 00:00:00:00:00:01 8 2"/>
<step name="Net-Flow-Objectives.Objective-7F" requires="Net-Flow-Objectives.Find-Host-2"
exec="create-forward-objective.sh ${OC1} of:0000000000000007 00:00:00:00:00:01 00:00:00:00:00:04 2 3"/>
<step name="Net-Flow-Objectives.Objective-7R" requires="Net-Flow-Objectives.Find-Host-2"
exec="create-forward-objective.sh ${OC1} of:0000000000000007 00:00:00:00:00:04 00:00:00:00:00:01 3 2"/>
<step name="Net-Flow-Objectives.Objective-4F" requires="Net-Flow-Objectives.Find-Host-2"
exec="create-forward-objective.sh ${OC1} of:0000000000000004 00:00:00:00:00:01 00:00:00:00:00:04 3 1"/>
<step name="Net-Flow-Objectives.Objective-4R" requires="Net-Flow-Objectives.Find-Host-2"
exec="create-forward-objective.sh ${OC1} of:0000000000000004 00:00:00:00:00:04 00:00:00:00:00:01 1 3"/>
<!-- Check that connectivity was established -->
<step name="Net-Flow-Objectives.Ping-XY" requires="Net-Flow-Objectives.Objective-1F,
Net-Flow-Objectives.Objective-1R,
Net-Flow-Objectives.Objective-19F,
Net-Flow-Objectives.Objective-19R
Net-Flow-Objectives.Objective-7F,
Net-Flow-Objectives.Objective-7R
Net-Flow-Objectives.Objective-4F,
Net-Flow-Objectives.Objective-4R"
exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/>
<step name="Net-Flow-Objectives.Ping-YX" requires="^"
exec="onos-mininet sendAndExpect h4 ping -c1 h1 --expect \ 0% packet loss"/>
</group>
</scenario>
......@@ -35,8 +35,11 @@
<import file="${ONOS_SCENARIOS}/net-create-flows.xml"/>
<dependency name="Net-Create-Flows" requires="Net-Setup,P2P-Intent-Connectivity,Net-REST"/>
<import file="${ONOS_SCENARIOS}/net-flow-objectives.xml"/>
<dependency name="Net-Flow-Objectives" requires="Net-Setup,P2P-Intent-Connectivity,Net-REST,Net-Create-Flows"/>
<import file="${ONOS_SCENARIOS}/net-topo.xml"/>
<dependency name="Net-Topo" requires="Net-Setup,Net-Create-Flows"/>
<dependency name="Net-Topo" requires="Net-Setup,Net-Create-Flows,Net-Flow-Objectives"/>
<import file="${ONOS_SCENARIOS}/net-teardown.xml"/>
<dependency name="Net-Teardown" requires="~Host-Intent-Connectivity,
......