summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-08-21 09:33:21 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-08-21 09:33:21 +0000
commiteea4e0e9e2261ef27b5884c51d763b71ff324fb9 (patch)
treefb9f9191cba9328a87c340f402fc54b74ce9b1dc
parentaa4e2d2645497f04e9e389aacc0381ff776b0125 (diff)
parent087964a27c111205adb57d74321bee7f703cd844 (diff)
Merge "Make TRex latency statistics optional"
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput-10.yaml1
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput-2.yaml1
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput-3.yaml1
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput-4.yaml1
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput.yaml1
-rw-r--r--samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml1
-rw-r--r--samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_cgnapt.yaml1
-rw-r--r--samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml1
-rw-r--r--yardstick/network_services/traffic_profile/base.py1
-rw-r--r--yardstick/network_services/traffic_profile/rfc2544.py13
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py15
11 files changed, 25 insertions, 12 deletions
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput-10.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput-10.yaml
index 98b1bf96d..c1acb69a4 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput-10.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput-10.yaml
@@ -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:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput-2.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput-2.yaml
index ee0415371..54f42b2bc 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput-2.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput-2.yaml
@@ -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:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput-3.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput-3.yaml
index 19f083646..06fb220da 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput-3.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput-3.yaml
@@ -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:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput-4.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput-4.yaml
index 95fa0b6d8..f6a12eb31 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput-4.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput-4.yaml
@@ -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:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput.yaml
index c267e7677..194bcd978 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput.yaml
@@ -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:
diff --git a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml
index 507491446..906793740 100644
--- a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml
+++ b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml
@@ -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:
diff --git a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_cgnapt.yaml b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_cgnapt.yaml
index 3cbd7cd62..6e2f8ec7c 100644
--- a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_cgnapt.yaml
+++ b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_cgnapt.yaml
@@ -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:
diff --git a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml
index edff3612e..cfc5f1ea3 100644
--- a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml
+++ b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml
@@ -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:
diff --git a/yardstick/network_services/traffic_profile/base.py b/yardstick/network_services/traffic_profile/base.py
index a8f950b7b..4fbceea9b 100644
--- a/yardstick/network_services/traffic_profile/base.py
+++ b/yardstick/network_services/traffic_profile/base.py
@@ -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
diff --git a/yardstick/network_services/traffic_profile/rfc2544.py b/yardstick/network_services/traffic_profile/rfc2544.py
index b54fc575f..772e96716 100644
--- a/yardstick/network_services/traffic_profile/rfc2544.py
+++ b/yardstick/network_services/traffic_profile/rfc2544.py
@@ -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))
diff --git a/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py b/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py
index 2e0331e8e..20f67d71a 100644
--- a/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py
@@ -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)])