Merge "changes for failing tests in nightly tests"
diff --git a/TestON/tests/USECASE/SegmentRouting/INT/INT.params b/TestON/tests/USECASE/SegmentRouting/INT/INT.params
index 63ff5c7..e73c627 100644
--- a/TestON/tests/USECASE/SegmentRouting/INT/INT.params
+++ b/TestON/tests/USECASE/SegmentRouting/INT/INT.params
@@ -1,7 +1,7 @@
 <!-- SPDX-FileCopyrightText: Copyright 2021-present Open Networking Foundation. -->
 <!-- SPDX-License-Identifier: GPL-2.0-or-later -->
 <PARAMS>
-    <testcases>1,2,3</testcases>
+    <testcases>1,2,3,4</testcases>
     <routerMac>00:00:0A:4C:1C:46</routerMac>
     <TREX>
         <flows>
diff --git a/TestON/tests/USECASE/SegmentRouting/INT/INT.py b/TestON/tests/USECASE/SegmentRouting/INT/INT.py
index 9295a29..4942d44 100644
--- a/TestON/tests/USECASE/SegmentRouting/INT/INT.py
+++ b/TestON/tests/USECASE/SegmentRouting/INT/INT.py
@@ -7,9 +7,7 @@
         self.default = ""
 
     def CASE1 (self, main):
-        """
-        Send ping packets from one host to another host and check flows from DeepInsight.
-        """
+        main.case("Send ping packets from one host to another host and check flows from DeepInsight")
         import time
         import socket
         from core import utilities
@@ -38,7 +36,10 @@
             UDP(sport={}, dport={}) /
             ("A"*30)
         )""".format(srcMac, dstMac, srcIp, dstIp, srcPort, dstPort)
-        main.h1.sendPacket(iface=srcIfaceName, packet=pkt)
+        # Send multiple packets incase the server or DeepInsight drop the report accidently
+        # FIXME: Find the root cause, might be misconfiguration or Linux(e.g., rp_filter?) issue.
+        for _ in range(0, 5):
+            main.h1.sendPacket(iface=srcIfaceName, packet=pkt)
         endTimeMs = (time.time() + 5) * 1000
 
         main.step("Checking total number of flow reports from DeepInsight")
@@ -71,10 +72,7 @@
         intTest.cleanUp(main)
 
     def CASE2 (self, main):
-        """
-        Send a packet with invalid VLAN from one host to another host and check
-        if DeepInsight receives drop reports.
-        """
+        main.case("Send a packet with invalid VLAN from one host to another host and check if DeepInsight receives drop reports")
         import time
         import socket
         from core import utilities
@@ -104,7 +102,10 @@
             UDP(sport={}, dport={}) /
             ("A"*30)
         )""".format(srcMac, dstMac, srcIp, dstIp, srcPort, dstPort)
-        main.h1.sendPacket(iface=srcIfaceName, packet=pkt)
+        # Send multiple packets incase the server or DeepInsight drop the report accidently
+        # FIXME: Find the root cause, might be misconfiguration or Linux(e.g., rp_filter?) issue.
+        for _ in range(0, 5):
+            main.h1.sendPacket(iface=srcIfaceName, packet=pkt)
         endTimeMs = (time.time() + 5) * 1000
 
         main.step("Checking drop report from DeepInsight")
@@ -127,10 +128,10 @@
             attempts=60,
         )
 
-        utilities.assert_equals(
-            expect=1, actual=len(dropAnomalies),
-            onpass="Got 1 drop anomaly from DeepInsight as expected.",
-            onfail="Got %d drop anomaly from DeepInsight, expect 1" % (len(dropAnomalies))
+        utilities.assert_lesser(
+            expect=0, actual=len(dropAnomalies),
+            onpass="Got %d drop anomaly from DeepInsight." % (len(dropAnomalies)),
+            onfail="Got no drop anomaly from DeepInsight."
         )
 
         main.step("Checking drop reason from the report")
@@ -148,10 +149,7 @@
         intTest.cleanUp(main)
 
     def CASE3 (self, main):
-        """
-        Send a packet with IP TTL value 1 from one host to another host and check
-        if DeepInsight receives drop reports.
-        """
+        main.case("Send a packet with IP TTL value 1 from one host to another host and check if DeepInsight receives drop reports")
         import time
         import socket
         from core import utilities
@@ -180,7 +178,10 @@
             UDP(sport={}, dport={}) /
             ("A"*30)
         )""".format(srcMac, dstMac, srcIp, dstIp, srcPort, dstPort)
-        main.h1.sendPacket(iface=srcIfaceName, packet=pkt)
+        # Send multiple packets incase the server or DeepInsight drop the report accidently
+        # FIXME: Find the root cause, might be misconfiguration or Linux(e.g., rp_filter?) issue.
+        for _ in range(0, 5):
+            main.h1.sendPacket(iface=srcIfaceName, packet=pkt)
         endTimeMs = (time.time() + 5) * 1000
 
         main.step("Checking drop report from DeepInsight")
@@ -203,10 +204,10 @@
             attempts=60,
         )
 
-        utilities.assert_equals(
-            expect=1, actual=len(dropAnomalies),
-            onpass="Got 1 drop anomaly from DeepInsight as expected.",
-            onfail="Got %d drop anomaly from DeepInsight, expect '1'." % (len(dropAnomalies))
+        utilities.assert_lesser(
+            expect=0, actual=len(dropAnomalies),
+            onpass="Got %d drop anomaly from DeepInsight." % (len(dropAnomalies)),
+            onfail="Got no drop anomaly from DeepInsight."
         )
 
         main.step("Checking drop reason from report")
@@ -223,9 +224,7 @@
         intTest.cleanUp(main)
 
     def CASE4(self, main):
-        """
-        Generate traffic at high rate and expect queue congestion reports in DeepInsight.
-        """
+        main.case("Generate traffic at high rate and expect queue congestion reports in DeepInsight")
         from core import utilities
         import time
         from tests.USECASE.SegmentRouting.INT.dependencies.IntTest import IntTest
@@ -268,7 +267,7 @@
         queueAnomalies = utilities.retry(
             f=getQueueAnomaly,
             retValue=[[]],
-            attempts=60,
+            attempts=120,
         )
 
         # We should get at least two congestion records
diff --git a/TestON/tests/USECASE/SegmentRouting/QOS/QOS.py b/TestON/tests/USECASE/SegmentRouting/QOS/QOS.py
index df535c5..315328f 100644
--- a/TestON/tests/USECASE/SegmentRouting/QOS/QOS.py
+++ b/TestON/tests/USECASE/SegmentRouting/QOS/QOS.py
@@ -4,6 +4,7 @@
         self.default = ''
 
     def CASE1(self, main):
+        main.case("Leaf-Edge with Mobile Traffic Classification")
         # Leaf-Edge-Mobile
         # Attach 2 UEs with different QFI
         # Generate traffic with Trex for the two UEs
diff --git a/TestON/tests/USECASE/SegmentRouting/UP4/UP4.py b/TestON/tests/USECASE/SegmentRouting/UP4/UP4.py
index cc3ed10..556304b 100644
--- a/TestON/tests/USECASE/SegmentRouting/UP4/UP4.py
+++ b/TestON/tests/USECASE/SegmentRouting/UP4/UP4.py
@@ -36,10 +36,8 @@
         # Get the P4RT client connected to UP4 in the first available ONOS instance
         up4.setup(main.Cluster.active(0).p4rtUp4)
 
-        main.step("Program PDRs and FARs via UP4")
+        main.step("Program and Verify PDRs and FARs via UP4")
         up4.attachUes()
-
-        main.step("Verify PDRs and FARs in ONOS")
         up4.verifyUp4Flow(onos_cli)
 
         # ------- Test Upstream traffic (enb->pdn)
@@ -50,10 +48,8 @@
         main.step("Test downstream traffic")
         up4.testDownstreamTraffic()
 
-        main.step("Remove PDRs and FARs via UP4")
+        main.step("Remove and Verify PDRs and FARs via UP4")
         up4.detachUes()
-
-        main.step("Verify removed PDRs and FARs from ONOS")
         up4.verifyNoUesFlow(onos_cli)
 
         main.step("Stop scapy and p4rt client")
@@ -108,10 +104,8 @@
         pdn_host = up4.pdn_host
         pdn_interface = up4.pdn_interface
 
-        main.step("Program PDRs and FARs for UEs via UP4")
+        main.step("Program and Verify PDRs and FARs for UEs via UP4")
         up4.attachUes()
-
-        main.step("Verify PDRs and FARs in ONOS")
         up4.verifyUp4Flow(onos_cli)
 
         # ------------------- UPSTREAM -------------------
@@ -239,10 +233,8 @@
                                    n_packets, tot_packets))
         # ------------------------------------------------
 
-        main.step("Remove PDRs and FARs for UEs via UP4")
+        main.step("Remove and Verify PDRs and FARs for UEs via UP4")
         up4.detachUes()
-
-        main.step("Verify removed PDRs and FARs from ONOS")
         up4.verifyNoUesFlow(onos_cli)
 
         main.step("Stop scapy and p4rt client")
@@ -283,7 +275,7 @@
         up4_1 = UP4()
         up4_2 = UP4()
 
-        main.step("Program PDRs and FARs via UP4 on ONOS 0")
+        main.step("Program and Verify PDRs and FARs 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)
@@ -320,7 +312,7 @@
                 onos_0_flow_count, onos_1_flow_count, onos_2_flow_count)
         )
 
-        main.step("Remove PDRs and FARs via UP4 on ONOS 2")
+        main.step("Remove and Verify PDRs and FARs via UP4 on ONOS 2")
         up4_2.detachUes()
         up4_2.verifyNoUesFlow(onos_cli_2)
 
@@ -402,7 +394,7 @@
         up4_1 = UP4()
         up4_2 = UP4()
 
-        main.step("Program PDRs and FARs via UP4 on ONOS 0")
+        main.step("Program and Verify PDRs and FARs 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)
@@ -434,7 +426,7 @@
             onfail="Wrong number of PDRs and FARs"
         )
 
-        main.step("Remove PDRs and FARs via UP4 on ONOS 2")
+        main.step("Remove and Verify PDRs and FARs via UP4 on ONOS 2")
         up4_2.detachUes()
         up4_2.verifyNoUesFlow(onos_cli_2)