Merge "[SDFAB-985] Match on slice ID in applications table for up4"
diff --git a/TestON/tests/USECASE/SegmentRouting/QOS/dependencies/QOSTest.py b/TestON/tests/USECASE/SegmentRouting/QOS/dependencies/QOSTest.py
index 46f0cc8..217f639 100644
--- a/TestON/tests/USECASE/SegmentRouting/QOS/dependencies/QOSTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/QOS/dependencies/QOSTest.py
@@ -1,7 +1,7 @@
 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
     Testcaselib as run
 from tests.USECASE.SegmentRouting.dependencies.trex import Trex
-from tests.USECASE.SegmentRouting.dependencies.up4 import UP4, N_FLOWS_PER_UE
+from tests.USECASE.SegmentRouting.dependencies.up4 import UP4
 import json
 
 
@@ -16,7 +16,6 @@
         main.step("Start P4rt client and setup TRex")
         # Use the first available ONOS instance CLI
         onos_cli = main.Cluster.active(0).CLI
-        initial_flow_count = onos_cli.checkFlowCount()
         up4 = UP4()
         trex = Trex()
         # Get the P4RT client connected to UP4 in the first available ONOS instance
@@ -27,12 +26,6 @@
         up4.attachUes()
         up4.verifyUp4Flow(onos_cli)
 
-        run.checkFlows(
-            main,
-            minFlowCount=initial_flow_count + (
-                        len(up4.emulated_ues) * N_FLOWS_PER_UE * n_switches)
-        )
-
         # Load traffic config for the current test case
         main.step("Load test JSON config")
         cfgFile = main.configPath + "/tests/" + "CASE_%d.json" % test_idx
@@ -69,8 +62,6 @@
         up4.detachUes()
         up4.verifyNoUesFlow(onos_cli)
 
-        run.checkFlows(main, minFlowCount=initial_flow_count)
-
         main.step("Teardown")
         trex.teardown()
         up4.teardown()
diff --git a/TestON/tests/USECASE/SegmentRouting/QOSNonMobile/QOSNonMobile.params b/TestON/tests/USECASE/SegmentRouting/QOSNonMobile/QOSNonMobile.params
index 51c916e..32def60 100644
--- a/TestON/tests/USECASE/SegmentRouting/QOSNonMobile/QOSNonMobile.params
+++ b/TestON/tests/USECASE/SegmentRouting/QOSNonMobile/QOSNonMobile.params
@@ -19,26 +19,22 @@
     <SLICING>
         <slices>
             <!-- Should match slices defined in netcfg-->
-            <slice0>
+            <default>
                 <slice_id>0</slice_id>
                 <traffic_classes>BEST_EFFORT,REAL_TIME</traffic_classes>
-            </slice0>
-            <slice1>
+            </default>
+            <mobile_slice>
                 <slice_id>1</slice_id>
-                <traffic_classes>BEST_EFFORT,CONTROL,REAL_TIME,ELASTIC</traffic_classes>
-            </slice1>
-            <slice2>
+                <traffic_classes>BEST_EFFORT,ELASTIC</traffic_classes>
+            </mobile_slice>
+            <non_mobile_slice>
                 <slice_id>2</slice_id>
-                <traffic_classes>BEST_EFFORT,REAL_TIME,ELASTIC</traffic_classes>
-            </slice2>
-            <slice3>
-                <slice_id>3</slice_id>
                 <traffic_classes>BEST_EFFORT,REAL_TIME</traffic_classes>
-            </slice3>
+            </non_mobile_slice>
         </slices>
         <traffic_classification>
-            <slice_1_be>
-                <slice_id>1</slice_id>
+            <non_mobile_be>
+                <slice_id>2</slice_id>
                 <traffic_class>BEST_EFFORT</traffic_class>
                 <traffic_selector>
                     <ipProto>
@@ -50,9 +46,9 @@
                         <udpPort>100</udpPort>
                     </udpDst>
                 </traffic_selector>
-            </slice_1_be>
-            <slice_1_rt>
-                <slice_id>1</slice_id>
+            </non_mobile_be>
+            <non_mobile_rt>
+                <slice_id>2</slice_id>
                 <traffic_class>REAL_TIME</traffic_class>
                 <traffic_selector>
                     <ipProto>
@@ -64,7 +60,7 @@
                         <udpPort>200</udpPort>
                     </udpDst>
                 </traffic_selector>
-            </slice_1_rt>
+            </non_mobile_rt>
         </traffic_classification>
     </SLICING>
 
diff --git a/TestON/tests/USECASE/SegmentRouting/UP4/UP4.py b/TestON/tests/USECASE/SegmentRouting/UP4/UP4.py
index f0d7fa5..1b4b88e 100644
--- a/TestON/tests/USECASE/SegmentRouting/UP4/UP4.py
+++ b/TestON/tests/USECASE/SegmentRouting/UP4/UP4.py
@@ -16,8 +16,7 @@
         Verify removed UPF entities
         """
         try:
-            from tests.USECASE.SegmentRouting.dependencies.up4 import UP4, \
-                N_FLOWS_PER_UE
+            from tests.USECASE.SegmentRouting.dependencies.up4 import UP4
             from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
                 Testcaselib as run
         except ImportError as e:
@@ -34,7 +33,6 @@
         main.step("Start scapy and p4rt client")
         # Use the first available ONOS instance CLI
         onos_cli = main.Cluster.active(0).CLI
-        initial_flow_count = onos_cli.checkFlowCount()
         up4 = UP4()
         # Get the P4RT client connected to UP4 in the first available ONOS instance
         up4.setup(main.Cluster.active(0).p4rtUp4)
@@ -43,12 +41,6 @@
         up4.attachUes()
         up4.verifyUp4Flow(onos_cli)
 
-        run.checkFlows(
-            main,
-            minFlowCount=initial_flow_count + (
-                    len(up4.emulated_ues) * N_FLOWS_PER_UE * n_switches)
-        )
-
         # ------- Test Upstream traffic (enb->pdn)
         for app_filter_name in up4.app_filters:
             main.step("Test upstream traffic %s" % app_filter_name)
@@ -63,8 +55,6 @@
         up4.detachUes()
         up4.verifyNoUesFlow(onos_cli)
 
-        run.checkFlows(main, minFlowCount=initial_flow_count)
-
         main.step("Stop scapy and p4rt client")
         up4.teardown()
 
@@ -87,8 +77,7 @@
         UE_PORT = 400
         PDN_PORT = 800
         try:
-            from tests.USECASE.SegmentRouting.dependencies.up4 import UP4, \
-                N_FLOWS_PER_UE
+            from tests.USECASE.SegmentRouting.dependencies.up4 import UP4
             from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
                 Testcaselib as run
         except ImportError as e:
@@ -105,7 +94,6 @@
         main.step("Start scapy and p4rt client + Scapy on BESS Host")
         # Use the first available ONOS instance CLI
         onos_cli = main.Cluster.active(0).CLI
-        initial_flow_count = onos_cli.checkFlowCount()
         up4 = UP4()
         # Get the P4RT client connected to UP4 in the first available ONOS instance
         up4.setup(main.Cluster.active(0).p4rtUp4)
@@ -126,12 +114,6 @@
         up4.attachUes()
         up4.verifyUp4Flow(onos_cli)
 
-        run.checkFlows(
-            main,
-            minFlowCount=initial_flow_count + (
-                    len(up4.emulated_ues) * N_FLOWS_PER_UE * n_switches)
-        )
-
         # ------------------- UPSTREAM -------------------
         # ------- eNB -> fabric -> BESS (encapped)
         main.step("Test upstream eNB -> fabric -> BESS")
@@ -261,8 +243,6 @@
         up4.detachUes()
         up4.verifyNoUesFlow(onos_cli)
 
-        run.checkFlows(main, minFlowCount=initial_flow_count)
-
         main.step("Stop scapy and p4rt client")
         up4.teardown()
         bess_host.stopScapy()
@@ -282,8 +262,7 @@
             Disconnect P4RT client
         """
         try:
-            from tests.USECASE.SegmentRouting.dependencies.up4 import UP4, \
-                N_FLOWS_PER_UE
+            from tests.USECASE.SegmentRouting.dependencies.up4 import UP4
             from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
                 Testcaselib as run
         except ImportError as e:
@@ -303,7 +282,6 @@
         up4_0 = UP4()
         up4_1 = UP4()
         up4_2 = UP4()
-        initial_flow_count = onos_cli_0.checkFlowCount()
 
         main.step("Program and Verify UPF entities via UP4 on ONOS 0")
         up4_0.setup(main.Cluster.active(0).p4rtUp4, no_host=True)
@@ -311,12 +289,6 @@
         up4_0.verifyUp4Flow(onos_cli_0)
         up4_0.teardown()
 
-        run.checkFlows(
-            main,
-            minFlowCount=initial_flow_count + (
-                    len(up4_0.emulated_ues) * N_FLOWS_PER_UE * n_switches)
-        )
-
         main.step("Verify UPF entities number via UP4 P4RT on ONOS 1")
         up4_1.setup(main.Cluster.active(1).p4rtUp4, no_host=True)
         utilities.assert_equal(
@@ -352,8 +324,6 @@
         up4_2.detachUes()
         up4_2.verifyNoUesFlow(onos_cli_2)
 
-        run.checkFlows(main, minFlowCount=initial_flow_count)
-
         main.step("Verify no UPF entities via UP4 P4RT on ONOS 2")
         utilities.assert_equal(
             expect=True,
@@ -411,8 +381,7 @@
         Remove UPF entities (cleanup)
         """
         try:
-            from tests.USECASE.SegmentRouting.dependencies.up4 import UP4, \
-                N_FLOWS_PER_UE
+            from tests.USECASE.SegmentRouting.dependencies.up4 import UP4
             from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
                 Testcaselib as run
             from tests.USECASE.SegmentRouting.SRStaging.dependencies.SRStagingTest import \
@@ -437,20 +406,12 @@
         up4_1 = UP4()
         up4_2 = UP4()
 
-        initial_flow_count = onos_cli_0.checkFlowCount()
-
         main.step("Program and Verify UPF entities via UP4 on ONOS 0")
         up4_0.setup(main.Cluster.active(0).p4rtUp4, no_host=True)
         up4_0.attachUes()
         up4_0.verifyUp4Flow(onos_cli_0)
         up4_0.teardown()
 
-        run.checkFlows(
-            main,
-            minFlowCount=initial_flow_count + (
-                    len(up4_0.emulated_ues) * N_FLOWS_PER_UE * n_switches)
-        )
-
         onosPod = main.params["UP4_delete_pod"]
 
         # Save ONOS diags of the POD we are killing otherwise we lose ONOS logs
@@ -521,19 +482,11 @@
             onfail="Stale UPF entities"
         )
 
-        run.checkFlows(main, minFlowCount=initial_flow_count)
-
         main.step("Re-program UPF entities via UP4 on ONOS 0 after restart")
         up4_0.attachUes()
         up4_0.verifyUp4Flow(onos_cli_0)
         up4_0.teardown()
 
-        run.checkFlows(
-            main,
-            minFlowCount=initial_flow_count + (
-                    len(up4_0.emulated_ues) * N_FLOWS_PER_UE * n_switches)
-        )
-
         main.step("Verify UPF entities via UP4 on ONOS 1")
         up4_1.setup(main.Cluster.active(1).p4rtUp4, no_host=True)
         up4_1.verifyUp4Flow(onos_cli_1)
@@ -555,8 +508,6 @@
         up4_1.verifyNoUesFlow(onos_cli_1)
         up4_1.teardown()
 
-        run.checkFlows(main, minFlowCount=initial_flow_count)
-
         run.cleanup(main)
 
     def CASE5(self, main):
@@ -572,8 +523,7 @@
         Remove UPF entities (cleanup)
         """
         try:
-            from tests.USECASE.SegmentRouting.dependencies.up4 import UP4, \
-                N_FLOWS_PER_UE
+            from tests.USECASE.SegmentRouting.dependencies.up4 import UP4
             from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
                 Testcaselib as run
             from tests.USECASE.SegmentRouting.SRStaging.dependencies.SRStagingTest import \
@@ -603,18 +553,11 @@
 
         up4 = UP4()
 
-        initial_flow_count = onos_cli.checkFlowCount()
-
         main.step("Program and Verify UPF entities via UP4")
         up4.setup(main.Cluster.active(0).p4rtUp4)
         up4.attachUes()
         up4.verifyUp4Flow(onos_cli)
 
-        run.checkFlows(
-            main,
-            minFlowCount=initial_flow_count+(len(up4.emulated_ues)*4*n_switches)
-        )
-
         main.step("Set label to switch k8s node and kill switch")
         # K8s node name correspond to the switch name in lowercase
         utilities.assert_equal(
@@ -751,8 +694,6 @@
         up4.verifyNoUesFlow(onos_cli)
         up4.teardown()
 
-        run.checkFlows(main, minFlowCount=initial_flow_count)
-
         # Teardown
         run.cleanup(main)
 
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/up4.py b/TestON/tests/USECASE/SegmentRouting/dependencies/up4.py
index 65e2c91..833cea1 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/up4.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/up4.py
@@ -14,8 +14,6 @@
 DEFAULT_PDN_PORT = 800
 GPDU_PORT = 2152
 
-N_FLOWS_PER_UE = 5
-
 DEFAULT_APP_ID = 0
 DEFAULT_SESSION_METER_IDX = 0
 DEFAULT_APP_METER_IDX = 0