Remove flow objectives after test completes

Change-Id: I62ec858803b7767d98ac24e3693834aa13c6ee06
diff --git a/tools/test/scenarios/bin/remove-forward-objective.sh b/tools/test/scenarios/bin/remove-forward-objective.sh
new file mode 100755
index 0000000..15a19ce
--- /dev/null
+++ b/tools/test/scenarios/bin/remove-forward-objective.sh
@@ -0,0 +1,41 @@
+# /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\": \"REMOVE\",
+  \"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
diff --git a/tools/test/scenarios/net-flow-objectives.xml b/tools/test/scenarios/net-flow-objectives.xml
index be7fa45..3bf3055 100644
--- a/tools/test/scenarios/net-flow-objectives.xml
+++ b/tools/test/scenarios/net-flow-objectives.xml
@@ -78,5 +78,26 @@
         <step name="Net-Flow-Objectives.Ping-YX" requires="^"
               exec="onos-mininet sendAndExpect h4 ping -c1 h1 --expect \ 0% packet loss"/>
 
+        <!-- Use REST API to remove flow objectives -->
+        <step name="Net-Flow-Objectives.Objective-R1F" requires="Net-Flow-Objectives.Ping-YX, Net-Flow-Objectives.Ping-XY"
+              exec="remove-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-R1R" requires="Net-Flow-Objectives.Ping-YX, Net-Flow-Objectives.Ping-XY"
+              exec="remove-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-R19F" requires="Net-Flow-Objectives.Ping-YX, Net-Flow-Objectives.Ping-XY"
+              exec="remove-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-R19R" requires="Net-Flow-Objectives.Ping-YX, Net-Flow-Objectives.Ping-XY"
+              exec="remove-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-R7F" requires="Net-Flow-Objectives.Ping-YX, Net-Flow-Objectives.Ping-XY"
+              exec="remove-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-R7R" requires="Net-Flow-Objectives.Ping-YX, Net-Flow-Objectives.Ping-XY"
+              exec="remove-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-R4F" requires="Net-Flow-Objectives.Ping-YX, Net-Flow-Objectives.Ping-XY"
+              exec="remove-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-R4R" requires="Net-Flow-Objectives.Ping-YX, Net-Flow-Objectives.Ping-XY"
+              exec="remove-forward-objective.sh ${OC1} of:0000000000000004 00:00:00:00:00:04 00:00:00:00:00:01 1 3"/>
+
     </group>
 </scenario>