From 0cce2819d798b5365d15dc174f6b4e6d06c18fbf Mon Sep 17 00:00:00 2001 From: Oleksandr Naumets Date: Tue, 12 Feb 2019 18:40:26 +0000 Subject: Extend TRex RFC2544 test case collected stats Added new fields into Yardstick NSB TRex RFC2544 test case results: - Iteration - PktSize - Status JIRA: YARDSTICK-1592 Change-Id: Id746b537a0ef55a891653719cc1db29ef7e994fc Signed-off-by: Oleksandr Naumets --- .../network_services/libs/ixia_libs/ixnet/ixnet_api.py | 6 ++++-- .../network_services/traffic_profile/ixia_rfc2544.py | 17 ++++------------- yardstick/network_services/traffic_profile/rfc2544.py | 11 ++++++++++- .../traffic_profile/trex_traffic_profile.py | 15 +++++++++++++++ .../network_services/vnf_generic/vnf/tg_rfc2544_ixia.py | 16 ++++++++-------- 5 files changed, 41 insertions(+), 24 deletions(-) (limited to 'yardstick/network_services') diff --git a/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py b/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py index cb8ba1771..ebef7fd9a 100644 --- a/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py +++ b/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py @@ -477,7 +477,8 @@ class IxNextgen(object): # pragma: no cover self._create_flow_groups(uplink_endpoints, downlink_endpoints) self._setup_config_elements(traffic_profile=traffic_profile) - def create_ipv4_traffic_model(self, uplink_endpoints, downlink_endpoints): + def create_ipv4_traffic_model(self, uplink_endpoints, downlink_endpoints, + traffic_profile): """Create a traffic item and the needed flow groups Each flow group inside the traffic item (only one is present) @@ -490,7 +491,8 @@ class IxNextgen(object): # pragma: no cover """ self._create_traffic_item('ipv4') self._create_flow_groups(uplink_endpoints, downlink_endpoints) - self._setup_config_elements(False) + self._setup_config_elements(traffic_profile=traffic_profile, + add_default_proto=False) def _update_frame_mac(self, ethernet_descriptor, field, mac_address): """Set the MAC address in a config element stack Ethernet field diff --git a/yardstick/network_services/traffic_profile/ixia_rfc2544.py b/yardstick/network_services/traffic_profile/ixia_rfc2544.py index aded2d347..5a9c06aba 100644 --- a/yardstick/network_services/traffic_profile/ixia_rfc2544.py +++ b/yardstick/network_services/traffic_profile/ixia_rfc2544.py @@ -35,6 +35,7 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile): super(IXIARFC2544Profile, self).__init__(yaml_data) self.rate = self.config.frame_rate self.rate_unit = self.config.rate_unit + self.iteration = 0 self.full_profile = {} def _get_ip_and_mask(self, ip_range): @@ -170,19 +171,6 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile): self.ports = [port for port in port_generator()] - def _get_framesize(self): - framesizes = [] - traffic = self._get_ixia_traffic_profile(self.full_profile) - for v in traffic.values(): - framesize = v['outer_l2']['framesize'] - for size in (s for s, w in framesize.items() if int(w) != 0): - framesizes.append(size) - if len(set(framesizes)) == 0: - return '' - elif len(set(framesizes)) == 1: - return framesizes[0] - return 'IMIX' - def execute_traffic(self, traffic_generator, ixia_obj=None, mac=None): mac = {} if mac is None else mac first_run = self.first_run @@ -194,6 +182,7 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile): else: self.rate = self._get_next_rate() + self.iteration = traffic_generator.rfc_helper.iteration.value traffic = self._get_ixia_traffic_profile(self.full_profile, mac) self._ixia_traffic_generate(traffic, ixia_obj, traffic_generator) return first_run @@ -278,6 +267,7 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile): samples['latency_ns_max'] = latency_ns_max samples['Rate'] = last_rate samples['PktSize'] = self._get_framesize() + samples['Iteration'] = self.iteration return completed, samples @@ -401,6 +391,7 @@ class IXIARFC2544PppoeScenarioProfile(IXIARFC2544Profile): samples['priority'] = priority_stats samples['Rate'] = last_rate samples['PktSize'] = self._get_framesize() + samples['Iteration'] = self.iteration samples.update(summary_subs_stats) if tc_rfc2544_opts: diff --git a/yardstick/network_services/traffic_profile/rfc2544.py b/yardstick/network_services/traffic_profile/rfc2544.py index b838bf814..4225f31b7 100644 --- a/yardstick/network_services/traffic_profile/rfc2544.py +++ b/yardstick/network_services/traffic_profile/rfc2544.py @@ -72,10 +72,13 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): """TRex RFC2544 traffic profile""" TOLERANCE_LIMIT = 0.01 + STATUS_SUCCESS = "Success" + STATUS_FAIL = "Failure" def __init__(self, traffic_generator): super(RFC2544Profile, self).__init__(traffic_generator) self.generator = None + self.iteration = 0 self.rate = self.config.frame_rate self.max_rate = self.config.frame_rate self.min_rate = 0 @@ -126,6 +129,7 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): self.generator.client.start(ports=ports, duration=self.config.duration, force=True) + self.iteration = self.generator.rfc2544_helper.iteration.value return ports, port_pg_id def _create_profile(self, profile_data, rate, port_pg_id, enable_latency): @@ -274,6 +278,7 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): correlated_traffic, resolution): """Calculate the drop percentage and run the traffic""" completed = False + status = self.STATUS_FAIL out_pkt_end = sum(port['out_packets'] for port in samples[-1].values()) in_pkt_end = sum(port['in_packets'] for port in samples[-1].values()) out_pkt_ini = sum(port['out_packets'] for port in samples[0].values()) @@ -304,6 +309,7 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): elif drop_percent < tol_low: self.min_rate = self.rate else: + status = self.STATUS_SUCCESS completed = True last_rate = self.rate @@ -332,6 +338,9 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): 'Throughput': throughput, 'DropPercentage': self.drop_percent_max, 'Rate': last_rate, - 'Latency': latency + 'Latency': latency, + 'PktSize': self._get_framesize(), + 'Iteration': self.iteration, + 'Status': status } return completed, output diff --git a/yardstick/network_services/traffic_profile/trex_traffic_profile.py b/yardstick/network_services/traffic_profile/trex_traffic_profile.py index 2d2c2d8b6..cf538d488 100644 --- a/yardstick/network_services/traffic_profile/trex_traffic_profile.py +++ b/yardstick/network_services/traffic_profile/trex_traffic_profile.py @@ -344,6 +344,21 @@ class TrexProfile(base.TrafficProfile): rate = round(float(self.max_rate + self.min_rate)/2.0, self.RATE_ROUND) return rate + def _get_framesize(self): + framesizes = [] + for traffickey, value in self.params.items(): + if not traffickey.startswith((self.UPLINK, self.DOWNLINK)): + continue + for _, data in value.items(): + framesize = data['outer_l2']['framesize'] + for size in (s for s, w in framesize.items() if int(w) != 0): + framesizes.append(size) + if len(set(framesizes)) == 0: + return '' + elif len(set(framesizes)) == 1: + return framesizes[0] + return 'IMIX' + @classmethod def _count_ip(cls, start_ip, end_ip): start = ipaddress.ip_address(six.u(start_ip)) diff --git a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py index 5d69fc8c8..5d64a8cba 100644 --- a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py +++ b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py @@ -54,13 +54,13 @@ class IxiaBasicScenario(object): def stop_protocols(self): pass - def create_traffic_model(self, traffic_profile=None): - # pylint: disable=unused-argument + def create_traffic_model(self, traffic_profile): vports = self.client.get_vports() self._uplink_vports = vports[::2] self._downlink_vports = vports[1::2] self.client.create_traffic_model(self._uplink_vports, - self._downlink_vports, traffic_profile) + self._downlink_vports, + traffic_profile) def _get_stats(self): return self.client.get_statistics() @@ -169,8 +169,7 @@ class IxiaL3Scenario(IxiaBasicScenario): self._add_interfaces() self._add_static_ips() - def create_traffic_model(self, traffic_profile=None): - # pylint: disable=unused-argument + def create_traffic_model(self, traffic_profile): vports = self.client.get_vports() self._uplink_vports = vports[::2] self._downlink_vports = vports[1::2] @@ -181,7 +180,8 @@ class IxiaL3Scenario(IxiaBasicScenario): for port in self._downlink_vports] self.client.create_ipv4_traffic_model(uplink_endpoints, - downlink_endpoints) + downlink_endpoints, + traffic_profile) class IxiaPppoeClientScenario(object): @@ -220,7 +220,8 @@ class IxiaPppoeClientScenario(object): uplink_endpoints = self._access_topologies downlink_endpoints = self._core_topologies self.client.create_ipv4_traffic_model(uplink_endpoints, - downlink_endpoints) + downlink_endpoints, + traffic_profile) def run_protocols(self): LOG.info('PPPoE Scenario - Start Protocols') @@ -816,7 +817,6 @@ class IxiaResourceHelper(ClientResourceHelper): completed, samples = traffic_profile.get_drop_percentage( samples, min_tol, max_tol, precision, resolution, first_run=first_run) - samples['Iteration'] = self.rfc_helper.iteration.value self._queue.put(samples) if completed: -- cgit 1.2.3-korg