Make TRex latency statistics optional 15/61115/1
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Mon, 20 Aug 2018 11:39:27 +0000 (12:39 +0100)
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Mon, 20 Aug 2018 14:23:53 +0000 (15:23 +0100)
Because of performance issues in TRex due to the extra power needed to
retrieve the latency statistics, this parameter will be optional and disabled
by default.

JIRA: YARDSTICK-1388

Change-Id: I07c0ec7bef86fd438d078cbd6748b98bc8cc0b37
Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
samples/vnf_samples/traffic_profiles/ipv4_throughput-10.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput-2.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput-3.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput-4.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput.yaml
samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml
samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_cgnapt.yaml
samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml
yardstick/network_services/traffic_profile/base.py
yardstick/network_services/traffic_profile/rfc2544.py
yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py

index 98b1bf9..c1acb69 100644 (file)
@@ -44,6 +44,7 @@ traffic_profile:
   traffic_type: RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
   frame_rate: 100  # pc of linerate
   duration: {{ duration }}
+  enable_latency: False
 
 uplink_0:
   ipv4:
index ee04153..54f42b2 100644 (file)
@@ -44,6 +44,7 @@ traffic_profile:
   traffic_type: RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
   frame_rate: 100  # pc of linerate
   duration: {{ duration }}
+  enable_latency: False
 
 uplink_0:
   ipv4:
index 19f0836..06fb220 100644 (file)
@@ -44,6 +44,7 @@ traffic_profile:
   traffic_type: RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
   frame_rate: 100  # pc of linerate
   duration: {{ duration }}
+  enable_latency: False
 
 uplink_0:
   ipv4:
index 95fa0b6..f6a12eb 100644 (file)
@@ -44,6 +44,7 @@ traffic_profile:
   traffic_type: RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
   frame_rate: 100  # pc of linerate
   duration: {{ duration }}
+  enable_latency: False
 
 uplink_0:
   ipv4:
index c267e76..194bcd9 100644 (file)
@@ -43,6 +43,7 @@ traffic_profile:
   traffic_type : RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
   frame_rate : 100  # pc of linerate
   duration: {{ duration }}
+  enable_latency: False
 
 uplink_0:
       ipv4:
index 5074914..9067937 100644 (file)
@@ -29,6 +29,7 @@ traffic_profile:
   traffic_type : IXIARFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
   frame_rate : 100  # pc of linerate
   duration: {{ duration }}
+  enable_latency: True
 
 uplink_0:
       ipv4:
index 3cbd7cd..6e2f8ec 100644 (file)
@@ -29,6 +29,7 @@ traffic_profile:
   traffic_type : IXIARFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
   frame_rate : 100  # pc of linerate
   duration: {{ duration }}
+  enable_latency: True
 
 uplink_0:
       ipv4:
index edff361..cfc5f1e 100644 (file)
@@ -43,6 +43,7 @@ traffic_profile:
   traffic_type : IXIARFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
   frame_rate : 100  # pc of linerate
   injection_time: {{ injection_time }}
+  enable_latency: True
 
 uplink_0:
       ipv4:
index a8f950b..4fbceea 100644 (file)
@@ -44,6 +44,7 @@ class TrafficProfileConfig(object):
         self.lower_bound = tprofile.get('lower_bound')
         self.upper_bound = tprofile.get('upper_bound')
         self.step_interval = tprofile.get('step_interval')
+        self.enable_latency = tprofile.get('enable_latency', False)
 
     def _parse_rate(self, rate):
         """Parse traffic profile rate
index b54fc57..772e967 100644 (file)
@@ -118,7 +118,8 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile):
                 ports.append(port_num)
                 port_pg_id.add_port(port_num)
                 profile = self._create_profile(profile_data,
-                                               self.rate, port_pg_id)
+                                               self.rate, port_pg_id,
+                                               self.config.enable_latency)
                 self.generator.client.add_streams(profile, ports=[port_num])
 
         self.generator.client.start(ports=ports,
@@ -126,7 +127,7 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile):
                                     force=True)
         return ports, port_pg_id
 
-    def _create_profile(self, profile_data, rate, port_pg_id):
+    def _create_profile(self, profile_data, rate, port_pg_id, enable_latency):
         """Create a STL profile (list of streams) for a port"""
         streams = []
         for packet_name in profile_data:
@@ -134,7 +135,8 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile):
                     get('outer_l2', {}).get('framesize'))
             imix_data = self._create_imix_data(imix)
             self._create_vm(profile_data[packet_name])
-            _streams = self._create_streams(imix_data, rate, port_pg_id)
+            _streams = self._create_streams(imix_data, rate, port_pg_id,
+                                            enable_latency)
             streams.extend(_streams)
         return trex_stl_streams.STLProfile(streams)
 
@@ -213,7 +215,7 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile):
         return trex_stl_packet_builder_scapy.STLPktBuilder(
             pkt=base_pkt / pad, vm=self.trex_vm)
 
-    def _create_streams(self, imix_data, rate, port_pg_id):
+    def _create_streams(self, imix_data, rate, port_pg_id, enable_latency):
         """Create a list of streams per packet size
 
         The STL TX mode speed of the generated streams will depend on the frame
@@ -237,7 +239,8 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile):
                              in imix_data.items() if float(weight) > 0):
             packet = self._create_single_packet(size)
             pg_id = port_pg_id.increase_pg_id()
-            stl_flow = trex_stl_streams.STLFlowLatencyStats(pg_id=pg_id)
+            stl_flow = (trex_stl_streams.STLFlowLatencyStats(pg_id=pg_id) if
+                        enable_latency else None)
             mode = trex_stl_streams.STLTXCont(percentage=weight * rate / 100)
             streams.append(trex_stl_client.STLStream(
                 packet=packet, flow_stats=stl_flow, mode=mode))
index 2e0331e..20f67d7 100644 (file)
@@ -102,10 +102,10 @@ class TestRFC2544Profile(base.BaseUnitTestCase):
                 mock_create_profile:
             rfc2544_profile.execute_traffic(traffic_generator=mock_generator)
         mock_create_profile.assert_has_calls([
-            mock.call('profile1', rfc2544_profile.rate, mock.ANY),
-            mock.call('profile1', rfc2544_profile.rate, mock.ANY),
-            mock.call('profile2', rfc2544_profile.rate, mock.ANY),
-            mock.call('profile2', rfc2544_profile.rate, mock.ANY)])
+            mock.call('profile1', rfc2544_profile.rate, mock.ANY, False),
+            mock.call('profile1', rfc2544_profile.rate, mock.ANY, False),
+            mock.call('profile2', rfc2544_profile.rate, mock.ANY, False),
+            mock.call('profile2', rfc2544_profile.rate, mock.ANY, False)])
         mock_generator.client.add_streams.assert_has_calls([
             mock.call(mock.ANY, ports=[10]),
             mock.call(mock.ANY, ports=[20]),
@@ -129,13 +129,14 @@ class TestRFC2544Profile(base.BaseUnitTestCase):
                 mock_create_streams:
             mock_create_imix.return_value = 'imix_data'
             mock_create_streams.return_value = ['stream1']
-            rfc2544_profile._create_profile(profile_data, rate, port_pg_id)
+            rfc2544_profile._create_profile(profile_data, rate, port_pg_id,
+                                            True)
 
         mock_create_imix.assert_called_once_with('imix_info')
         mock_create_vm.assert_called_once_with(
             {'outer_l2': {'framesize': 'imix_info'}})
         mock_create_streams.assert_called_once_with('imix_data', 100,
-                                                    port_pg_id)
+                                                    port_pg_id, True)
         mock_stl_profile.assert_called_once_with(['stream1'])
 
     def test__create_imix_data(self):
@@ -208,7 +209,7 @@ class TestRFC2544Profile(base.BaseUnitTestCase):
         rfc2544_profile = rfc2544.RFC2544Profile(self.TRAFFIC_PROFILE)
         with mock.patch.object(rfc2544_profile, '_create_single_packet'):
             output = rfc2544_profile._create_streams(imix_data, rate,
-                                                     port_pg_id)
+                                                     port_pg_id, True)
         self.assertEqual(['stream1', 'stream2'], output)
         mock_latency.assert_has_calls([
             mock.call(pg_id=1), mock.call(pg_id=2)])