Add a single point to multi point intent scenario

Change-Id: I53d7d56e90fd95ac0b019ab025ad52998d2aad8a
diff --git a/tools/test/bin/onos-create-intent b/tools/test/bin/onos-create-intent
index d1c0b93..1c07185 100755
--- a/tools/test/bin/onos-create-intent
+++ b/tools/test/bin/onos-create-intent
@@ -15,8 +15,11 @@
 type=$3
 arg1=$4
 arg2=$5
+arg3=$6
+arg4=$7
+arg5=$8
 
 set -x
 
-onos $target "onos:add-${type}-intent" --key $name "${arg1}" "${arg2}"
+onos $target "onos:add-${type}-intent" --key $name "${arg1}" "${arg2}" "${arg3}" "${arg4}" "${arg5}"
 
diff --git a/tools/test/scenarios/net-single-to-multi-intent.xml b/tools/test/scenarios/net-single-to-multi-intent.xml
new file mode 100644
index 0000000..321d6bc
--- /dev/null
+++ b/tools/test/scenarios/net-single-to-multi-intent.xml
@@ -0,0 +1,81 @@
+<!--
+  ~ 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-single-to-multi-intent"
+          description="Network single point to multi point intent connectivity test">
+    <!-- TODO: parametrize this via recipes -->
+    <group name="S2M-Intent-Connectivity">
+        <step name="S2M-Intent.Uninstall-Reactive-Forwarding"
+              exec="onos ${OC1} app deactivate org.onosproject.fwd org.onosproject.ifwd"/>
+        <step name="S2M-Intent.Check-Apps" requires="^"
+              exec="onos-check-apps ${OC1} fwd,ifwd excludes"/>
+
+        <!-- Create a single point to three points intent -->
+        <step name="S2M-Intent.Create-Intent-forward" requires="^"
+              exec="onos-create-intent ${OC1} forward single-to-multi of:0000000000000011/1 of:0000000000000014/1 of:0000000000000002/1 of:000000000000000E/1"/>
+
+        <!-- Create back links from the 3 points back to the source -->
+        <step name="S2M-Intent.Create-Intent-back1" requires="^"
+              exec="onos-create-intent ${OC1} back1 point of:0000000000000014/1 of:0000000000000011/1"/>
+        <step name="S2M-Intent.Create-Intent-back2" requires="^"
+              exec="onos-create-intent ${OC1} back2 point of:0000000000000002/1 of:0000000000000011/1"/>
+        <step name="S2M-Intent.Create-Intent-back3" requires="^"
+              exec="onos-create-intent ${OC1} back3 point of:000000000000000E/1 of:0000000000000011/1"/>
+
+        <!-- Make sure intents installed properly -->
+        <step name="S2M-Intent.Validate-Intent-forward-Installed" requires="S2M-Intent.Create-Intent-forward"
+              exec="onos-check-intent ${OC1} forward INSTALLED"/>
+        <step name="S2M-Intent.Validate-Intent-back1-Installed" requires="S2M-Intent.Create-Intent-back1"
+              exec="onos-check-intent ${OC1} back1 INSTALLED"/>
+        <step name="S2M-Intent.Validate-Intent-back2-Installed" requires="S2M-Intent.Create-Intent-back2"
+              exec="onos-check-intent ${OC1} back2 INSTALLED"/>
+        <step name="S2M-Intent.Validate-Intent-back3-Installed" requires="S2M-Intent.Create-Intent-back3"
+              exec="onos-check-intent ${OC1} back3 INSTALLED"/>
+
+        <!-- Check the connectivity of the 11 <-> 14 intent -->
+        <step name="S2M-Intent.Ping-1-forward"
+              exec="onos-mininet sendAndExpect h17 ping -c1 h20 --expect \ 0% packet loss" requires="S2M-Intent.Create-Intent-forward,
+                                                                                                     S2M-Intent.Create-Intent-back1" />
+        <step name="S2M-Intent.Ping-1-back"
+              exec="onos-mininet sendAndExpect h20 ping -c1 h17 --expect \ 0% packet loss" requires="S2M-Intent.Create-Intent-forward,
+                                                                                                     S2M-Intent.Create-Intent-back1" />
+
+        <!-- Check the connectivity of the 11 <-> 2 intent -->
+        <step name="S2M-Intent.Ping-2-forward"
+              exec="onos-mininet sendAndExpect h17 ping -c1 h2 --expect \ 0% packet loss" requires="S2M-Intent.Create-Intent-forward,
+                                                                                                     S2M-Intent.Create-Intent-back1" />
+        <step name="S2M-Intent.Ping-2-back"
+              exec="onos-mininet sendAndExpect h2 ping -c1 h17 --expect \ 0% packet loss" requires="S2M-Intent.Create-Intent-forward,
+                                                                                                     S2M-Intent.Create-Intent-back1" />
+
+        <!-- Check the connectivity of the 11 <-> E intent -->
+        <step name="S2M-Intent.Ping-3-forward"
+              exec="onos-mininet sendAndExpect h17 ping -c1 h14 --expect \ 0% packet loss" requires="S2M-Intent.Create-Intent-forward,
+                                                                                                     S2M-Intent.Create-Intent-back2" />
+        <step name="S2M-Intent.Ping-3-back"
+              exec="onos-mininet sendAndExpect h14 ping -c1 h17 --expect \ 0% packet loss" requires="S2M-Intent.Create-Intent-forward,
+                                                                                                     S2M-Intent.Create-Intent-back3" />
+
+        <!-- Clean up intents -->
+        <step name="S2M-Intent.Remove-Intent-forward" requires="~S2M-Intent.Ping-3-back"
+              exec="onos ${OC1} remove-intent -p org.onosproject.cli forward"/>
+        <step name="S2M-Intent.Remove-Intent-back1" requires="~S2M-Intent.Ping-3-back"
+              exec="onos ${OC1} remove-intent -p org.onosproject.cli back1"/>
+        <step name="S2M-Intent.Remove-Intent-back2" requires="~S2M-Intent.Ping-3-back"
+              exec="onos ${OC1} remove-intent -p org.onosproject.cli back2"/>
+        <step name="S2M-Intent.Remove-Intent-back3" requires="~S2M-Intent.Ping-3-back"
+              exec="onos ${OC1} remove-intent -p org.onosproject.cli back3"/>
+    </group>
+</scenario>
diff --git a/tools/test/scenarios/net-smoke.xml b/tools/test/scenarios/net-smoke.xml
index 734018a..4dfa313 100644
--- a/tools/test/scenarios/net-smoke.xml
+++ b/tools/test/scenarios/net-smoke.xml
@@ -29,8 +29,12 @@
         <import file="${ONOS_SCENARIOS}/net-point-intent.xml"/>
         <dependency name="P2P-Intent-Connectivity" requires="Net-Setup,~Reactive-Forwarding.Net-Link-Down-Up,Host-Intent-Connectivity"/>
 
+        <import file="${ONOS_SCENARIOS}/net-single-to-multi-intent.xml"/>
+        <dependency name="S2M-Intent-Connectivity"
+                    requires="Net-Setup,~Reactive-Forwarding.Net-Link-Down-Up,Host-Intent-Connectivity,P2P-Intent-Connectivity"/>
+
         <import file="${ONOS_SCENARIOS}/net-rest.xml"/>
-        <dependency name="Net-REST" requires="Net-Setup,P2P-Intent-Connectivity"/>
+        <dependency name="Net-REST" requires="Net-Setup,P2P-Intent-Connectivity,S2M-Intent-Connectivity"/>
 
         <import file="${ONOS_SCENARIOS}/net-create-flows.xml"/>
         <dependency name="Net-Create-Flows" requires="Net-Setup,P2P-Intent-Connectivity,Net-REST"/>