Merge "[SDFAB-985] Match on slice ID in applications table for up4"
diff --git a/TestON/tests/USECASE/SegmentRouting/QOS/QOS.params b/TestON/tests/USECASE/SegmentRouting/QOS/QOS.params
index 324fe5a..9f24236 100644
--- a/TestON/tests/USECASE/SegmentRouting/QOS/QOS.params
+++ b/TestON/tests/USECASE/SegmentRouting/QOS/QOS.params
@@ -18,6 +18,7 @@
 
     <UP4>
         <s1u_address>10.32.11.126</s1u_address>
+        <slice_id>1</slice_id>
         <enodebs>
             <enodeb_1>
                 <host>TRexClient</host>
@@ -32,7 +33,6 @@
                 <teid>100</teid>
                 <up_id>10</up_id>
                 <down_id>11</down_id>
-                // TODO: we should pass also the slice_id
                 <tc>0</tc> <!-- Best Effort -->
                 <five_g>False</five_g>
             </ue1>
diff --git a/TestON/tests/USECASE/SegmentRouting/UP4/UP4.params b/TestON/tests/USECASE/SegmentRouting/UP4/UP4.params
index 38f1701..e1f522c 100644
--- a/TestON/tests/USECASE/SegmentRouting/UP4/UP4.params
+++ b/TestON/tests/USECASE/SegmentRouting/UP4/UP4.params
@@ -33,6 +33,7 @@
         </enodebs>
         <s1u_address>10.32.11.126</s1u_address>
         <router_mac>00:00:0A:4C:1C:46</router_mac>
+        <slice_id>1</slice_id>
         <ues>
             <ue1>
                 <ue_address>10.240.0.1</ue_address>
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/up4.py b/TestON/tests/USECASE/SegmentRouting/dependencies/up4.py
index f9aba6c..833cea1 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/up4.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/up4.py
@@ -45,6 +45,7 @@
         <enodeb_host>Compute3</enodeb_host>
         <router_mac>00:00:0A:4C:1C:46</router_mac> # Needed to verify connectivity with scapy
         <s1u_address>10.32.11.126</s1u_address>
+        <slice_id>1</slice_id> # Mobile SLICE ID, used when pushing application filtering entries
         <ues>
             <ue2>
                 <ue_address>10.240.0.2</ue_address>
@@ -71,6 +72,7 @@
         self.app_filters = {}
         self.up4_client = None
         self.no_host = False
+        self.slice_id = None
 
     def setup(self, p4rt_client, no_host=False):
         """
@@ -82,6 +84,7 @@
         self.s1u_address = main.params["UP4"]["s1u_address"]
         self.emulated_ues = main.params["UP4"]['ues']
         self.app_filters = main.params["UP4"]['app_filters']
+        self.slice_id = main.params["UP4"]['slice_id']
         self.up4_client = p4rt_client
         self.no_host = no_host
 
@@ -108,6 +111,9 @@
                                            enableGtp=True)
             if self.pdn_host is not None:
                 self.pdn_host.startScapy(ifaceName=self.pdn_interface["name"])
+        # TODO: configure interfaces table. Currently, we rely on netcfg or
+        #  PFCP agent to push interface entries, but we should explicitly push
+        #  them here
 
     def teardown(self):
         self.up4_client.stopP4RtClient()
@@ -460,13 +466,13 @@
                 fail = True
         return not fail
 
-    def appFilterOnosString(self, app_id, priority, ip_proto, ip_prefix, port_range, **kwargs):
+    def appFilterOnosString(self, app_id, priority, ip_proto, ip_prefix, port_range, slice_id, **kwargs):
         return "UpfApplication(priority=%s, Match(%s%s%s%s) -> Action(app_id=%s))" % (
             priority,
             ("ip_prefix=%s, " % ip_prefix) if ip_prefix else "",
             ("l4_port_range=[%s], " % port_range) if port_range else "",
             ("ip_proto=%s, " % ip_proto) if ip_proto else "",
-            "slice_id=0",
+            "slice_id=s" % slice_id,
             app_id
         )
 
@@ -572,7 +578,9 @@
         tableName = 'PreQosPipe.applications'
         actionName = 'PreQosPipe.set_app_id'
         actionParams = {'app_id': str(app_id)}
-        matchFields = {}
+        matchFields = {
+            'slice_id': str(self.slice_id)
+        }
         if ip_prefix:
             matchFields['app_ip_addr'] = str(ip_prefix)
         if ip_proto: