Working STC trellis-p4 scenario with connectivity test

Change-Id: I3ec166856a6a8a3ee705d392ace74b0677aa7ad5
diff --git a/tools/test/scenarios/net-trellis-p4-connectivity.xml b/tools/test/scenarios/net-trellis-p4-connectivity.xml
new file mode 100644
index 0000000..fc7aec3
--- /dev/null
+++ b/tools/test/scenarios/net-trellis-p4-connectivity.xml
@@ -0,0 +1,61 @@
+<!--
+  ~ Copyright 2018-present Open Networking Foundation
+  ~
+  ~ 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-trellis-p4-connectivity"
+          description="Trellis P4 network connectivity test steps">
+
+    <group name="Net-Trellis-P4-Connectivity-Host-Discovery">
+        <step name="Net-Trellis-P4-Connectivity-Host-Discovery.h1"
+              exec="onos-mininet sendAndExpect h1 ping -c1 10.0.2.254 --expect \ 0% packet loss"/>
+        <step name="Net-Trellis-P4-Connectivity-Host-Discovery.h2"
+              exec="onos-mininet sendAndExpect h2 ping -c1 10.0.2.254 --expect \ 0% packet loss"
+              requires="~^"/>
+        <step name="Net-Trellis-P4-Connectivity-Host-Discovery.h3"
+              exec="onos-mininet sendAndExpect h3 ping -c1 10.0.3.254 --expect \ 0% packet loss"
+              requires="~^"/>
+        <step name="Net-Trellis-P4-Connectivity-Host-Discovery.h4"
+              exec="onos-mininet sendAndExpect h4 ping -c1 10.0.3.254 --expect \ 0% packet loss"
+              requires="~^"/>
+    </group>
+
+    <group name="Net-Trellis-P4-Connectivity-Bridging"
+           requires="Net-Trellis-P4-Connectivity-Host-Discovery">
+        <step name="Net-Trellis-P4-Connectivity-Bridging.IP4Ping1"
+              exec="onos-mininet sendAndExpect h1 ping -c1 h2 --expect \ 0% packet loss"
+              requires="Net-Trellis-P4-Connectivity-Host-Discovery"/>
+        <step name="Net-Trellis-P4-Connectivity-Bridging.IP4Ping2"
+              exec="onos-mininet sendAndExpect h3 ping -c1 h4 --expect \ 0% packet loss"
+              requires="~^"/>
+    </group>
+
+    <group name="Net-Trellis-P4-Connectivity-Routing"
+           requires="~Net-Trellis-P4-Connectivity-Bridging">
+        <step name="Net-Trellis-P4-Connectivity-Routing.IP4Ping1"
+              exec="onos-mininet sendAndExpect h1 ping -c1 h3 --expect \ 0% packet loss"
+              requires="~Net-Trellis-P4-Connectivity-Bridging"/>
+        <step name="Net-Trellis-P4-Connectivity-Routing.IP4Ping2"
+              exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"
+              requires="~^"/>
+        <step name="Net-Trellis-P4-Connectivity-Routing.IP4Ping3"
+              exec="onos-mininet sendAndExpect h2 ping -c1 h3 --expect \ 0% packet loss"
+              requires="~^"/>
+        <step name="Net-Trellis-P4-Connectivity-Routing.IP4Ping4"
+              exec="onos-mininet sendAndExpect h2 ping -c1 h4 --expect \ 0% packet loss"
+              requires="~^"/>
+    </group>
+
+</scenario>
diff --git a/tools/test/scenarios/net-trellis-p4-hosts.xml b/tools/test/scenarios/net-trellis-p4-hosts.xml
new file mode 100644
index 0000000..287cbe7
--- /dev/null
+++ b/tools/test/scenarios/net-trellis-p4-hosts.xml
@@ -0,0 +1,32 @@
+<!--
+  ~ Copyright 2018-present Open Networking Foundation
+  ~
+  ~ 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-trellis-p4-hosts" description="Trellis P4 network host check steps">
+
+        <group name="Net-Trellis-P4-Hosts">
+            <step name="Net-Trellis-P4-Hosts.Host-1"
+                  exec="onos-find-host ${OC1} 00:AA:00:00:00:01 device:bmv2:s204/3 10.0.2.1"/>
+            <step name="Net-Trellis-P4-Hosts.Host-2"
+                  exec="onos-find-host ${OC1} 00:AA:00:00:00:02 device:bmv2:s204/4 10.0.2.2"/>
+            <step name="Net-Trellis-P4-Hosts.Host-3"
+                  exec="onos-find-host ${OC1} 00:AA:00:00:00:03 device:bmv2:s205/3 10.0.3.1"/>
+            <step name="Net-Trellis-P4-Hosts.Host-4"
+                  exec="onos-find-host ${OC1} 00:AA:00:00:00:04 device:bmv2:s205/4 10.0.3.2"/>
+        </group>
+
+</scenario>
diff --git a/tools/test/scenarios/net-trellis-p4-links.xml b/tools/test/scenarios/net-trellis-p4-links.xml
index bc4192b..0a19caa 100644
--- a/tools/test/scenarios/net-trellis-p4-links.xml
+++ b/tools/test/scenarios/net-trellis-p4-links.xml
@@ -23,66 +23,66 @@
 
             <!-- Bi-Directional link between s204 and s226 -->
             <!-- Link 1 -->
-            <step name="Net-Trellis-HAG-Links.Query-204-226-Link-1"
+            <step name="Net-Trellis-P4-Links.Query-204-226-Link-1"
                   exec="find-link.py ${OC1} link_204_226_1_ device:bmv2:s204 1 device:bmv2:s226 1"/>
-            <step name="Net-Trellis-HAG-Links.Validate-204-226-Link-1-State" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-204-226-Link-1-State" requires="^"
                   exec="test '${link_204_226_1_State}' == 'ACTIVE'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-204-226-Link-1-Type" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-204-226-Link-1-Type" requires="^"
                   exec="test '${link_204_226_1_Type}' == 'DIRECT'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-204-226-Link-1-Src-Device" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-204-226-Link-1-Src-Device" requires="^"
                   exec="test '${link_204_226_1_SrcDevice}' == 'device:bmv2:s204'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-204-226-Link-1-Dst-Device" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-204-226-Link-1-Dst-Device" requires="^"
                   exec="test '${link_204_226_1_DstDevice}' == 'device:bmv2:s226'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-204-226-Link-1-Src-Port" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-204-226-Link-1-Src-Port" requires="^"
                   exec="test '${link_204_226_1_SrcPort}' == '1'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-204-226-Link-1-Dst-Port" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-204-226-Link-1-Dst-Port" requires="^"
                   exec="test '${link_204_226_1_DstPort}' == '1'"/>
 
-            <step name="Net-Trellis-HAG-Links.Query-226-204-Link-2"
+            <step name="Net-Trellis-P4-Links.Query-226-204-Link-2"
                   exec="find-link.py ${OC1} link_226_204_2_ device:bmv2:s226 1 device:bmv2:s204 1"/>
-            <step name="Net-Trellis-HAG-Links.Validate-226-204-Link-2-State" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-226-204-Link-2-State" requires="^"
                   exec="test '${link_226_204_2_State}' == 'ACTIVE'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-226-204-Link-2-Type" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-226-204-Link-2-Type" requires="^"
                   exec="test '${link_226_204_2_Type}' == 'DIRECT'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-226-204-Link-2-Src-Device" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-226-204-Link-2-Src-Device" requires="^"
                   exec="test '${link_226_204_2_SrcDevice}' == 'device:bmv2:s226'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-226-204-Link-2-Dst-Device" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-226-204-Link-2-Dst-Device" requires="^"
                   exec="test '${link_226_204_2_DstDevice}' == 'device:bmv2:s204'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-226-204-Link-2-Src-Port" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-226-204-Link-2-Src-Port" requires="^"
                   exec="test '${link_226_204_2_SrcPort}' == '1'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-226-204-Link-2-Dst-Port" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-226-204-Link-2-Dst-Port" requires="^"
                   exec="test '${link_226_204_2_DstPort}' == '1'"/>
 
             <!-- Bi-Directional link between s205 and s227 -->
             <!-- Link 1 -->
-            <step name="Net-Trellis-HAG-Links.Query-205-227-Link-1"
+            <step name="Net-Trellis-P4-Links.Query-205-227-Link-1"
                   exec="find-link.py ${OC1} link_205_227_1_ device:bmv2:s205 2 device:bmv2:s227 2"/>
-            <step name="Net-Trellis-HAG-Links.Validate-205-227-Link-1-State" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-205-227-Link-1-State" requires="^"
                   exec="test '${link_205_227_1_State}' == 'ACTIVE'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-205-227-Link-1-Type" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-205-227-Link-1-Type" requires="^"
                   exec="test '${link_205_227_1_Type}' == 'DIRECT'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-205-227-Link-1-Src-Device" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-205-227-Link-1-Src-Device" requires="^"
                   exec="test '${link_205_227_1_SrcDevice}' == 'device:bmv2:s205'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-205-227-Link-1-Dst-Device" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-205-227-Link-1-Dst-Device" requires="^"
                   exec="test '${link_205_227_1_DstDevice}' == 'device:bmv2:s227'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-205-227-Link-1-Src-Port" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-205-227-Link-1-Src-Port" requires="^"
                   exec="test '${link_205_227_1_SrcPort}' == '2'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-205-227-Link-1-Dst-Port" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-205-227-Link-1-Dst-Port" requires="^"
                   exec="test '${link_205_227_1_DstPort}' == '2'"/>
 
-            <step name="Net-Trellis-HAG-Links.Query-227-205-Link-2"
+            <step name="Net-Trellis-P4-Links.Query-227-205-Link-2"
                   exec="find-link.py ${OC1} link_227_205_2_ device:bmv2:s227 2 device:bmv2:s205 2"/>
-            <step name="Net-Trellis-HAG-Links.Validate-227-205-Link-2-State" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-227-205-Link-2-State" requires="^"
                   exec="test '${link_227_205_2_State}' == 'ACTIVE'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-227-205-Link-2-Type" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-227-205-Link-2-Type" requires="^"
                   exec="test '${link_227_205_2_Type}' == 'DIRECT'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-227-205-Link-2-Src-Device" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-227-205-Link-2-Src-Device" requires="^"
                   exec="test '${link_227_205_2_SrcDevice}' == 'device:bmv2:s227'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-227-205-Link-2-Dst-Device" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-227-205-Link-2-Dst-Device" requires="^"
                   exec="test '${link_227_205_2_DstDevice}' == 'device:bmv2:s205'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-227-205-Link-2-Src-Port" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-227-205-Link-2-Src-Port" requires="^"
                   exec="test '${link_227_205_2_SrcPort}' == '2'"/>
-            <step name="Net-Trellis-HAG-Links.Validate-227-205-Link-2-Dst-Port" requires="^"
+            <step name="Net-Trellis-P4-Links.Validate-227-205-Link-2-Dst-Port" requires="^"
                   exec="test '${link_227_205_2_DstPort}' == '2'"/>
 
         </group>
diff --git a/tools/test/scenarios/net-trellis-p4-smoke.xml b/tools/test/scenarios/net-trellis-p4-smoke.xml
index 0ced6c1..b27b5c1 100644
--- a/tools/test/scenarios/net-trellis-p4-smoke.xml
+++ b/tools/test/scenarios/net-trellis-p4-smoke.xml
@@ -15,22 +15,48 @@
   -->
 
 
-
-<scenario name="net-trellis-p4-smoke" description="Trellis P4 network connectivity test steps">
+<scenario name="net-trellis-p4-smoke"
+          description="Trellis P4 network connectivity test steps">
 
     <import file="${ONOS_SCENARIOS}/net-setup-trellis-p4.xml"/>
 
-    <step name="Net-Trellis-P4-Smoke.Check-Summary" requires="Trellis-Net-P4-Setup.Wait-For-Mininet" delay="15"
+    <step name="Net-Trellis-P4-Smoke.Check-Summary"
+          requires="Trellis-Net-P4-Setup.Wait-For-Mininet" delay="5"
           exec="onos-check-summary ${OC1} [0-9]* 4 8 0 112"/>
 
     <import file="${ONOS_SCENARIOS}/net-trellis-p4-devices.xml"/>
-    <dependency name="Net-Trellis-P4-Devices" requires="Net-Trellis-P4-Smoke.Check-Summary"/>
+    <dependency name="Net-Trellis-P4-Devices"
+                requires="Net-Trellis-P4-Smoke.Check-Summary"/>
+
+    <import file="${ONOS_SCENARIOS}/net-trellis-p4-links.xml"/>
+    <dependency name="Net-Trellis-P4-Links"
+                requires="Net-Trellis-P4-Smoke.Check-Summary"/>
+
+    <import file="${ONOS_SCENARIOS}/net-trellis-p4-connectivity.xml"/>
+    <dependency name="Net-Trellis-P4-Connectivity-Host-Discovery"
+                requires="Net-Trellis-P4-Smoke.Check-Summary"/>
+
+    <import file="${ONOS_SCENARIOS}/net-trellis-p4-hosts.xml"/>
+    <dependency name="Net-Trellis-P4-Hosts"
+                requires="Net-Trellis-P4-Connectivity-Host-Discovery"/>
+
+    <!-- Check additional flow rules for discovered hosts -->
+    <step name="Net-Trellis-P4-Smoke.Check-Summary-2"
+          requires="Net-Trellis-P4-Connectivity-Host-Discovery" delay="3"
+          exec="onos-check-summary ${OC1} [0-9]* 4 8 4 136"/>
+
+    <dependency name="Net-Trellis-P4-Connectivity-Bridging"
+                requires="Net-Trellis-P4-Smoke.Check-Summary-2"/>
+    <dependency name="Net-Trellis-P4-Connectivity-Routing"
+                requires="Net-Trellis-P4-Smoke.Check-Summary-2,~Net-Trellis-P4-Connectivity-Bridging"/>
 
     <import file="${ONOS_SCENARIOS}/net-teardown.xml"/>
-    <dependency name="Net-Teardown" requires="Net-Trellis-P4-Smoke.Check-Summary"/>
+    <dependency name="Net-Teardown"
+                requires="~Net-Trellis-P4-Devices,~Net-Trellis-P4-Links,~Net-Trellis-P4-Hosts,~Net-Trellis-P4-Connectivity-Bridging,~Net-Trellis-P4-Connectivity-Routing"/>
 
     <parallel var="${OC#}">
-        <step name="Net-Trellis-P4-Smoke-Check-Logs-${#}" requires="~Net-Teardown"
+        <step name="Net-Trellis-P4-Smoke-Check-Logs-${#}"
+              requires="~Net-Teardown"
               exec="onos-check-logs ${OC#}"/>
     </parallel>