Regression: fix Python3 list of ports, update trex21 benchmark, other minor changes
authorYaroslav Brustinov <[email protected]>
Tue, 7 Mar 2017 23:25:25 +0000 (01:25 +0200)
committerYaroslav Brustinov <[email protected]>
Tue, 7 Mar 2017 23:25:25 +0000 (01:25 +0200)
Change-Id: Iad785f8c505af487e201751ad8a8bfb03205cb73
Signed-off-by: Yaroslav Brustinov <[email protected]>
scripts/automation/regression/setups/trex21/benchmark.yaml
scripts/automation/regression/stateless_tests/stl_client_test.py
scripts/automation/regression/stateless_tests/stl_rx_test.py
scripts/automation/regression/trex_unit_test.py
scripts/automation/trex_control_plane/server/trex_server.py

index b366b3f..8d77ae3 100644 (file)
@@ -153,3 +153,7 @@ test_CPU_benchmark:
         bw_per_core     : 1
 
 
+test_all_profiles :
+    mult      : "0.3%"
+    skip      : [mac]
+
index eb046e3..b9e1748 100644 (file)
@@ -172,11 +172,11 @@ class STLClient_Test(CStlGeneral_Test):
 
                 # cont. with duration should be quite percise - 5% error is relaxed enough
 
-                assert get_error_in_percentage(stats[self.tx_port]['opackets'], golden) < 0.05
-                assert get_error_in_percentage(stats[self.rx_port]['ipackets'], golden) < 0.05
+                assert get_error_in_percentage(golden, stats[self.tx_port]['opackets']) < 0.05
+                assert get_error_in_percentage(golden, stats[self.rx_port]['ipackets']) < 0.05
 
-                assert get_error_in_percentage(stats[self.rx_port]['opackets'], golden) < 0.05
-                assert get_error_in_percentage(stats[self.tx_port]['ipackets'], golden) < 0.05
+                assert get_error_in_percentage(golden, stats[self.rx_port]['opackets']) < 0.05
+                assert get_error_in_percentage(golden, stats[self.tx_port]['ipackets']) < 0.05
 
 
                 self.c.remove_all_streams(ports = [self.tx_port, self.rx_port])
@@ -244,23 +244,17 @@ class STLClient_Test(CStlGeneral_Test):
         skip_tests     = self.get_benchmark_param('skip',default=[])
 
         try:
-            print("\n");
-
-
             for profile in self.profiles:
+                print('\nProfile: %s' % profile[len(CTRexScenario.scripts_path):]);
 
-                skip=False
-                if skip_tests:
-                    for  skip_test in skip_tests:
-                        if skip_test in profile:
-                           skip=True;
-                           break;
+                skip = False
+                for skip_test in skip_tests:
+                    if skip_test in profile:
+                        skip = True
+                        break
                 if skip:
-                    print("skipping testing profile due to config file {0}...\n".format(profile))
-                    continue;
-
-                
-                print("now testing profile {0}...\n".format(profile))
+                    print('  * Skip due to config file...')
+                    continue
 
                 p1 = STLProfile.load(profile, port_id = self.tx_port)
                 p2 = STLProfile.load(profile, port_id = self.rx_port)
@@ -271,16 +265,16 @@ class STLClient_Test(CStlGeneral_Test):
 
                 if p1.has_custom_mac_addr() or p2.has_custom_mac_addr():
                     if self.is_virt_nics:
-                        print("\n*** profile needs promiscuous mode but running on virtual NICs - skipping... ***\n")
+                        print("  * Skip due to Virtual NICs and promiscuous mode requirement...")
                         continue
                     elif self.is_vf_nics:
-                        print("\n*** profile needs promiscuous mode but running on VF - skipping... ***\n")
+                        print("  * Skip due to VF NICs and promiscuous mode requirement...")
                         continue
                     else:
                         self.c.set_port_attr(ports = [self.tx_port, self.rx_port], promiscuous = True)
 
                 if p1.has_flow_stats() or p2.has_flow_stats():
-                    print("\n*** profile needs RX caps - skipping... ***\n")
+                    print("  * Skip due to RX caps requirement")
                     continue
 
                 self.c.add_streams(p1, ports = self.tx_port)
index 6735254..4e15e03 100644 (file)
@@ -540,7 +540,7 @@ class STLRX_Test(CStlGeneral_Test):
     def _run_fcs_stream (self,is_vm):
         """ this test send 1 64 byte packet with latency and check that all counters are reported as 64 bytes"""
         try:
-            ports = CTRexScenario.stl_ports_map['map'].keys()
+            ports = list(CTRexScenario.stl_ports_map['map'].keys())
             for lat in [True, False]:
                 print("\nSending from ports: {0}, has latency: {1} ".format(ports, lat))
                 self.send_1_burst(ports, lat, 100)
index 6d7f26f..f915448 100755 (executable)
@@ -483,12 +483,11 @@ class CTRexTestConfiguringPlugin(Plugin):
                 fatal('Could not restart TRex daemon server')
             print('Restarted.')
 
+        if not self.no_daemon:
             if self.kill_running:
                 client.kill_all_trexes()
-            else:
-                if client.get_trex_cmds():
-                    fatal('TRex is already running')
-        if not self.no_daemon:
+            elif client.get_trex_cmds():
+                fatal('TRex is already running. Use --kill-running flag to kill it.')
             try:
                 client.check_server_connectivity()
             except Exception as e:
index bcbec06..ecc72bd 100755 (executable)
@@ -42,7 +42,6 @@ logger = logging.getLogger('TRexServer')
 
 class CTRexServer(object):
     """This class defines the server side of the RESTfull interaction with TRex"""
-    DEFAULT_TREX_PATH = '/auto/proj-pcube-b/apps/PL-b/tools/bp_sim2/v1.55/' #'/auto/proj-pcube-b/apps/PL-b/tools/nightly/trex_latest'
     TREX_START_CMD    = './t-rex-64'
     DEFAULT_FILE_PATH = '/tmp/trex_files/'