[SDFAB-988] QER rate limiting tests

Change-Id: I4c542a5c9a122c0595b36e5e96d2b093682cfc7c
diff --git a/TestON/tests/USECASE/SegmentRouting/QOS/QOS.params b/TestON/tests/USECASE/SegmentRouting/QOS/QOS.params
index 9f24236..21210b0 100644
--- a/TestON/tests/USECASE/SegmentRouting/QOS/QOS.params
+++ b/TestON/tests/USECASE/SegmentRouting/QOS/QOS.params
@@ -59,7 +59,7 @@
         <flows>
             <BE1_FROM_UE>
                 <name>Best Effort 1</name>
-                <l1_bps>40000000000</l1_bps>
+                <l1_bps>25000000000</l1_bps>
                 <trex_port>2</trex_port>
                 <packet>
                     <pktlen>1400</pktlen>
@@ -74,7 +74,7 @@
             </BE1_FROM_UE>
             <BE2_FROM_UE>
                 <name>Best Effort 2</name>
-                <l1_bps>35000000000</l1_bps>
+                <l1_bps>25000000000</l1_bps>
                 <trex_port>3</trex_port>
                 <packet>
                     <pktlen>1400</pktlen>
diff --git a/TestON/tests/USECASE/SegmentRouting/QOS/dependencies/QOSTest.py b/TestON/tests/USECASE/SegmentRouting/QOS/dependencies/QOSTest.py
index 217f639..801e30a 100644
--- a/TestON/tests/USECASE/SegmentRouting/QOS/dependencies/QOSTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/QOS/dependencies/QOSTest.py
@@ -22,47 +22,48 @@
         up4.setup(main.Cluster.active(0).p4rtUp4, no_host=True)
         trex.setup(main.TRexClient)
 
-        main.step("Program UPF entities via UP4")
-        up4.attachUes()
-        up4.verifyUp4Flow(onos_cli)
+        try:
+            main.step("Program UPF entities via UP4")
+            up4.attachUes()
+            up4.verifyUp4Flow(onos_cli)
 
-        # Load traffic config for the current test case
-        main.step("Load test JSON config")
-        cfgFile = main.configPath + "/tests/" + "CASE_%d.json" % test_idx
-        with open(cfgFile) as cfg:
-            testCfg = json.load(cfg)
+            # Load traffic config for the current test case
+            main.step("Load test JSON config")
+            cfgFile = main.configPath + "/tests/" + "CASE_%d.json" % test_idx
+            with open(cfgFile) as cfg:
+                testCfg = json.load(cfg)
 
-        main.step("Send traffic with TRex")
-        for flow in testCfg["flows"]:
-            trex.createFlow(flow)
-        results = trex.sendAndReceiveTraffic(testCfg["duration"])
-        trex.verifyCongestion(
-            results,
-            multiplier=float(testCfg.get("multiplier", "1"))
-        )
+            for flow in testCfg["flows"]:
+                trex.createFlow(flow)
+            results = trex.sendAndReceiveTraffic(testCfg["duration"])
+            main.step("Verify congestion")
+            trex.verifyCongestion(
+                results,
+                multiplier=float(testCfg.get("multiplier", "1"))
+            )
 
-        main.step("Log port and flow stats")
-        trex.logPortStats()
-        for flow in testCfg["flows"]:
-            trex.logFlowStats(flow)
+            main.step("Log port and flow stats")
+            trex.logPortStats()
+            for flow in testCfg["flows"]:
+                trex.logFlowStats(flow)
 
-        # Assert Flow Stats
-        for flow in testCfg["flows"]:
-            if trex.isFlowStats(flow):
-                main.step("{}: Assert RX Packets".format(flow))
-                trex.assertRxPackets(flow)
-                main.step("{}: Assert Dropped Packets".format(flow))
-                trex.assertDroppedPacket(flow)
-                main.step("{}: Assert 90 Percentile Latency".format(flow))
-                trex.assert90PercentileLatency(flow)
-                main.step("{}: Assert 99.9 Percentile Latency".format(flow))
-                trex.assert99_9PercentileLatency(flow)
+            # Assert Flow Stats
+            for flow in testCfg["flows"]:
+                if trex.isFlowStats(flow):
+                    main.step("{}: Assert RX Packets".format(flow))
+                    trex.assertRxPackets(flow)
+                    main.step("{}: Assert Dropped Packets".format(flow))
+                    trex.assertDroppedPacket(flow)
+                    main.step("{}: Assert 90 Percentile Latency".format(flow))
+                    trex.assert90PercentileLatency(flow)
+                    main.step("{}: Assert 99.9 Percentile Latency".format(flow))
+                    trex.assert99_9PercentileLatency(flow)
+        finally:
+            main.step("Remove UPF entities via UP4")
+            up4.detachUes()
+            up4.verifyNoUesFlow(onos_cli)
 
-        main.step("Remove UPF entities via UP4")
-        up4.detachUes()
-        up4.verifyNoUesFlow(onos_cli)
-
-        main.step("Teardown")
-        trex.teardown()
-        up4.teardown()
-        run.cleanup(main)
+            main.step("Teardown")
+            trex.teardown()
+            up4.teardown()
+            run.cleanup(main)