Fix net-trellis-p4-smoke not working with latest stratum_bmv2

- Fix scenario files to use correct deviceId
- More robust liveness check in bmv2.py
- Use different ports for stratum internal server
- Longer switch startup timeout in bmv2.py
- Ignore number of flow rules when checking summary (make scenario
independent of trellis implementation)

Change-Id: I206e5339d2e78ae9a025caa5ec4862a9d4c24871
diff --git a/tools/test/scenarios/bin/mininet-p4-trellis b/tools/test/scenarios/bin/mininet-p4-trellis
index b5a3593..db19cc4 100755
--- a/tools/test/scenarios/bin/mininet-p4-trellis
+++ b/tools/test/scenarios/bin/mininet-p4-trellis
@@ -4,7 +4,6 @@
 # Starts mininet in the network machine with the Trellis P4 topology
 # -----------------------------------------------------------------------------
 
-set -e
 set -x
 
 [[ ! -d "$ONOS_ROOT" ]] && echo "ONOS_ROOT is not defined" >&2 && exit 1
@@ -25,7 +24,7 @@
 "
 
 (
-    ssh -t -t ${remote} "screen -L -S mininet sudo ${trellisp4Sh}"
+    ssh -t -t ${remote} "screen -L -S mininet ${trellisp4Sh}"
     scp ${ONOS_USER}@[${OCN}]:$log /tmp/mininet.log
     ssh ${remote} rm -f $log
 ) &
diff --git a/tools/test/scenarios/net-trellis-p4-devices.xml b/tools/test/scenarios/net-trellis-p4-devices.xml
index 1b79eab..76e3632 100644
--- a/tools/test/scenarios/net-trellis-p4-devices.xml
+++ b/tools/test/scenarios/net-trellis-p4-devices.xml
@@ -21,17 +21,17 @@
         <group name="Net-Trellis-P4-Devices">
 
             <step name="Net-Trellis-P4-Devices.Device-1"
-                  exec="onos-find-device ${OC1} device:bmv2:s204"/>
+                  exec="onos-find-device ${OC1} device:s204"/>
 
             <step name="Net-Trellis-P4-Devices.Device-2"
-                  exec="onos-find-device ${OC1} device:bmv2:s205"/>
+                  exec="onos-find-device ${OC1} device:s205"/>
 
             <step name="Net-Trellis-P4-Devices.Device-3"
-                  exec="onos-find-device ${OC1} device:bmv2:s226"/>
+                  exec="onos-find-device ${OC1} device:s226"/>
 
             <step name="Net-Trellis-P4-Devices.Device-4"
-                  exec="onos-find-device ${OC1} device:bmv2:s227"/>
+                  exec="onos-find-device ${OC1} device:s227"/>
 
         </group>
 
-</scenario>
\ No newline at end of file
+</scenario>
diff --git a/tools/test/scenarios/net-trellis-p4-hosts.xml b/tools/test/scenarios/net-trellis-p4-hosts.xml
index 287cbe7..0ad2c59 100644
--- a/tools/test/scenarios/net-trellis-p4-hosts.xml
+++ b/tools/test/scenarios/net-trellis-p4-hosts.xml
@@ -20,13 +20,13 @@
 
         <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"/>
+                  exec="onos-find-host ${OC1} 00:AA:00:00:00:01 device: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"/>
+                  exec="onos-find-host ${OC1} 00:AA:00:00:00:02 device: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"/>
+                  exec="onos-find-host ${OC1} 00:AA:00:00:00:03 device: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"/>
+                  exec="onos-find-host ${OC1} 00:AA:00:00:00:04 device: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 0a19caa..137877c 100644
--- a/tools/test/scenarios/net-trellis-p4-links.xml
+++ b/tools/test/scenarios/net-trellis-p4-links.xml
@@ -24,30 +24,30 @@
             <!-- Bi-Directional link between s204 and s226 -->
             <!-- 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"/>
+                  exec="find-link.py ${OC1} link_204_226_1_ device:s204 1 device:s226 1"/>
             <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-P4-Links.Validate-204-226-Link-1-Type" requires="^"
                   exec="test '${link_204_226_1_Type}' == 'DIRECT'"/>
             <step name="Net-Trellis-P4-Links.Validate-204-226-Link-1-Src-Device" requires="^"
-                  exec="test '${link_204_226_1_SrcDevice}' == 'device:bmv2:s204'"/>
+                  exec="test '${link_204_226_1_SrcDevice}' == 'device:s204'"/>
             <step name="Net-Trellis-P4-Links.Validate-204-226-Link-1-Dst-Device" requires="^"
-                  exec="test '${link_204_226_1_DstDevice}' == 'device:bmv2:s226'"/>
+                  exec="test '${link_204_226_1_DstDevice}' == 'device:s226'"/>
             <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-P4-Links.Validate-204-226-Link-1-Dst-Port" requires="^"
                   exec="test '${link_204_226_1_DstPort}' == '1'"/>
 
             <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"/>
+                  exec="find-link.py ${OC1} link_226_204_2_ device:s226 1 device:s204 1"/>
             <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-P4-Links.Validate-226-204-Link-2-Type" requires="^"
                   exec="test '${link_226_204_2_Type}' == 'DIRECT'"/>
             <step name="Net-Trellis-P4-Links.Validate-226-204-Link-2-Src-Device" requires="^"
-                  exec="test '${link_226_204_2_SrcDevice}' == 'device:bmv2:s226'"/>
+                  exec="test '${link_226_204_2_SrcDevice}' == 'device:s226'"/>
             <step name="Net-Trellis-P4-Links.Validate-226-204-Link-2-Dst-Device" requires="^"
-                  exec="test '${link_226_204_2_DstDevice}' == 'device:bmv2:s204'"/>
+                  exec="test '${link_226_204_2_DstDevice}' == 'device:s204'"/>
             <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-P4-Links.Validate-226-204-Link-2-Dst-Port" requires="^"
@@ -56,30 +56,30 @@
             <!-- Bi-Directional link between s205 and s227 -->
             <!-- 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"/>
+                  exec="find-link.py ${OC1} link_205_227_1_ device:s205 2 device:s227 2"/>
             <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-P4-Links.Validate-205-227-Link-1-Type" requires="^"
                   exec="test '${link_205_227_1_Type}' == 'DIRECT'"/>
             <step name="Net-Trellis-P4-Links.Validate-205-227-Link-1-Src-Device" requires="^"
-                  exec="test '${link_205_227_1_SrcDevice}' == 'device:bmv2:s205'"/>
+                  exec="test '${link_205_227_1_SrcDevice}' == 'device:s205'"/>
             <step name="Net-Trellis-P4-Links.Validate-205-227-Link-1-Dst-Device" requires="^"
-                  exec="test '${link_205_227_1_DstDevice}' == 'device:bmv2:s227'"/>
+                  exec="test '${link_205_227_1_DstDevice}' == 'device:s227'"/>
             <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-P4-Links.Validate-205-227-Link-1-Dst-Port" requires="^"
                   exec="test '${link_205_227_1_DstPort}' == '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"/>
+                  exec="find-link.py ${OC1} link_227_205_2_ device:s227 2 device:s205 2"/>
             <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-P4-Links.Validate-227-205-Link-2-Type" requires="^"
                   exec="test '${link_227_205_2_Type}' == 'DIRECT'"/>
             <step name="Net-Trellis-P4-Links.Validate-227-205-Link-2-Src-Device" requires="^"
-                  exec="test '${link_227_205_2_SrcDevice}' == 'device:bmv2:s227'"/>
+                  exec="test '${link_227_205_2_SrcDevice}' == 'device:s227'"/>
             <step name="Net-Trellis-P4-Links.Validate-227-205-Link-2-Dst-Device" requires="^"
-                  exec="test '${link_227_205_2_DstDevice}' == 'device:bmv2:s205'"/>
+                  exec="test '${link_227_205_2_DstDevice}' == 'device:s205'"/>
             <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-P4-Links.Validate-227-205-Link-2-Dst-Port" requires="^"
diff --git a/tools/test/scenarios/net-trellis-p4-smoke.xml b/tools/test/scenarios/net-trellis-p4-smoke.xml
index 0033aeb..cb80cd7 100644
--- a/tools/test/scenarios/net-trellis-p4-smoke.xml
+++ b/tools/test/scenarios/net-trellis-p4-smoke.xml
@@ -24,7 +24,7 @@
 
         <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"/>
+              exec="onos-check-summary ${OC1} [0-9]* 4 8 0 [0-9]*"/>
 
         <import file="${ONOS_SCENARIOS}/net-trellis-p4-devices.xml"/>
         <dependency name="Net-Trellis-P4-Devices"