diff options
Diffstat (limited to 'yardstick/network_services')
7 files changed, 77 insertions, 32 deletions
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 06c6b0bcb..8274ff9ce 100644 --- a/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py +++ b/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py @@ -34,6 +34,13 @@ PROTO_UDP = 'udp' PROTO_TCP = 'tcp' PROTO_VLAN = 'vlan' +SINGLE_VALUE = "singleValue" + +S_VLAN = 0 +C_VLAN = 1 + +ETHER_TYPE_802_1ad = '0x88a8' + IP_VERSION_4_MASK = 24 IP_VERSION_6_MASK = 64 @@ -367,10 +374,28 @@ class IxNextgen(object): # pragma: no cover traffic_param['outer_l2']['framesize']) srcmac = str(traffic_param.get('srcmac', '00:00:00:00:00:01')) dstmac = str(traffic_param.get('dstmac', '00:00:00:00:00:02')) - # NOTE(ralonsoh): add QinQ tagging when - # traffic_param['outer_l2']['QinQ'] exists. - # s_vlan = traffic_param['outer_l2']['QinQ']['S-VLAN'] - # c_vlan = traffic_param['outer_l2']['QinQ']['C-VLAN'] + + if traffic_param['outer_l2']['QinQ']: + s_vlan = traffic_param['outer_l2']['QinQ']['S-VLAN'] + c_vlan = traffic_param['outer_l2']['QinQ']['C-VLAN'] + + field_descriptor = self._get_field_in_stack_item( + self._get_stack_item(fg_id, PROTO_ETHERNET)[0], + 'etherType') + + self.ixnet.setMultiAttribute(field_descriptor, + '-auto', 'false', + '-singleValue', ETHER_TYPE_802_1ad, + '-fieldValue', ETHER_TYPE_802_1ad, + '-valueType', SINGLE_VALUE) + + self._append_procotol_to_stack( + PROTO_VLAN, config_element + '/stack:"ethernet-1"') + self._append_procotol_to_stack( + PROTO_VLAN, config_element + '/stack:"ethernet-1"') + + self._update_vlan_tag(fg_id, s_vlan, S_VLAN) + self._update_vlan_tag(fg_id, c_vlan, C_VLAN) self.ixnet.setMultiAttribute( config_element + '/transmissionControl', @@ -391,6 +416,27 @@ class IxNextgen(object): # pragma: no cover self._get_stack_item(fg_id, PROTO_ETHERNET)[0], 'sourceAddress', srcmac) + def _update_vlan_tag(self, fg_id, params, vlan=0): + field_to_param_map = { + 'vlanUserPriority': 'priority', + 'cfi': 'cfi', + 'vlanID': 'id' + } + for field, param in field_to_param_map.items(): + value = params.get(param) + if value: + field_descriptor = self._get_field_in_stack_item( + self._get_stack_item(fg_id, PROTO_VLAN)[vlan], + field) + + self.ixnet.setMultiAttribute(field_descriptor, + '-auto', 'false', + '-singleValue', value, + '-fieldValue', value, + '-valueType', SINGLE_VALUE) + + self.ixnet.commit() + def _update_ipv4_address(self, ip_descriptor, field, ip_address, seed, mask, count): """Set the IPv4 address in a config element stack IP field diff --git a/yardstick/network_services/traffic_profile/ixia_rfc2544.py b/yardstick/network_services/traffic_profile/ixia_rfc2544.py index 241fd7598..760b1e8d3 100644 --- a/yardstick/network_services/traffic_profile/ixia_rfc2544.py +++ b/yardstick/network_services/traffic_profile/ixia_rfc2544.py @@ -88,6 +88,7 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile): 'outer_l2': { 'framesize': value['outer_l2']['framesize'], 'framesPerSecond': True, + 'QinQ': value['outer_l2'].get('QinQ'), 'srcmac': mac['src_mac_{}'.format(port_index)], 'dstmac': mac['dst_mac_{}'.format(port_index)], }, diff --git a/yardstick/network_services/traffic_profile/prox_binsearch.py b/yardstick/network_services/traffic_profile/prox_binsearch.py index 9457096c8..506a880e0 100644 --- a/yardstick/network_services/traffic_profile/prox_binsearch.py +++ b/yardstick/network_services/traffic_profile/prox_binsearch.py @@ -88,11 +88,6 @@ class ProxBinSearchProfile(ProxProfile): theor_max_thruput = actual_max_thruput = 0 result_samples = {} - rate_samples = {} - pos_retry = 0 - neg_retry = 0 - total_retry = 0 - ok_retry = 0 # Store one time only value in influxdb single_samples = { @@ -110,15 +105,11 @@ class ProxBinSearchProfile(ProxProfile): "interface_speed_gbps", constants.NIC_GBPS_DEFAULT) * constants.ONE_GIGABIT_IN_BITS ok_retry = traffic_gen.scenario_helper.scenario_cfg["runner"].get("confirmation", 0) - for test_value in self.bounds_iterator(LOG): + for step_id, test_value in enumerate(self.bounds_iterator(LOG)): pos_retry = 0 neg_retry = 0 total_retry = 0 - rate_samples["MAX_Rate"] = self.current_upper - rate_samples["MIN_Rate"] = self.current_lower - rate_samples["Test_Rate"] = test_value - self.queue.put(rate_samples, True, overall_constants.QUEUE_PUT_TIMEOUT) LOG.info("Checking MAX %s MIN %s TEST %s", self.current_upper, self.lower_bound, test_value) while (pos_retry <= ok_retry) and (neg_retry <= ok_retry): @@ -188,6 +179,11 @@ class ProxBinSearchProfile(ProxProfile): self.queue.put({'theor_max_throughput': theor_max_thruput}) LOG.info(">>>##>>Collect TG KPIs %s %s", datetime.datetime.now(), samples) + samples["MAX_Rate"] = self.current_upper + samples["MIN_Rate"] = self.current_lower + samples["Test_Rate"] = test_value + samples["Step_Id"] = step_id + samples["Confirmation_Retry"] = total_retry self.queue.put(samples, True, overall_constants.QUEUE_PUT_TIMEOUT) LOG.info(">>>##>> Result Reached PktSize %s Theor_Max_Thruput %s Actual_throughput %s", diff --git a/yardstick/network_services/traffic_profile/rfc2544.py b/yardstick/network_services/traffic_profile/rfc2544.py index 0e1dbd592..b54fc575f 100644 --- a/yardstick/network_services/traffic_profile/rfc2544.py +++ b/yardstick/network_services/traffic_profile/rfc2544.py @@ -70,7 +70,7 @@ class PortPgIDMap(object): class RFC2544Profile(trex_traffic_profile.TrexProfile): """TRex RFC2544 traffic profile""" - TOLERANCE_LIMIT = 0.05 + TOLERANCE_LIMIT = 0.01 def __init__(self, traffic_generator): super(RFC2544Profile, self).__init__(traffic_generator) @@ -246,6 +246,7 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): def get_drop_percentage(self, samples, tol_low, tol_high, correlated_traffic): """Calculate the drop percentage and run the traffic""" + completed = False tx_rate_fps = 0 rx_rate_fps = 0 for sample in samples: @@ -266,15 +267,15 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): drop_percent = round( (float(abs(out_packets - in_packets)) / out_packets) * 100, 5) - tol_high = tol_high if tol_high > self.TOLERANCE_LIMIT else tol_high - tol_low = tol_low if tol_low > self.TOLERANCE_LIMIT else tol_low + tol_high = max(tol_high, self.TOLERANCE_LIMIT) + tol_low = min(tol_low, self.TOLERANCE_LIMIT) if drop_percent > tol_high: self.max_rate = self.rate elif drop_percent < tol_low: self.min_rate = self.rate - # else: - # NOTE(ralonsoh): the test should finish here - # pass + else: + completed = True + last_rate = self.rate self.rate = round(float(self.max_rate + self.min_rate) / 2.0, 5) @@ -295,4 +296,4 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): 'Rate': last_rate, 'Latency': latency } - return output + return completed, output diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py index 3ef7c33c5..a09f2a7a9 100644 --- a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py +++ b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py @@ -426,7 +426,8 @@ class ClientResourceHelper(ResourceHelper): iteration_index = 0 while self._terminated.value == 0: iteration_index += 1 - self._run_traffic_once(traffic_profile) + if self._run_traffic_once(traffic_profile): + self._terminated.value = 1 mq_producer.tg_method_iteration(iteration_index) self.client.stop(self.all_ports) 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 2b04c864c..8b1687450 100644 --- a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py +++ b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py @@ -60,7 +60,7 @@ class IxiaResourceHelper(ClientResourceHelper): def stop_collect(self): self._terminated.value = 1 - def generate_samples(self, ports, duration, key=None): + def generate_samples(self, ports, duration): stats = self.get_stats() samples = {} @@ -81,14 +81,13 @@ class IxiaResourceHelper(ClientResourceHelper): "RxThroughput": float(stats["Valid_Frames_Rx"][port_num]) / duration, "TxThroughput": float(stats["Frames_Tx"][port_num]) / duration, } - if key: - avg_latency = stats["Store-Forward_Avg_latency_ns"][port_num] - min_latency = stats["Store-Forward_Min_latency_ns"][port_num] - max_latency = stats["Store-Forward_Max_latency_ns"][port_num] - samples[port_name][key] = \ - {"Store-Forward_Avg_latency_ns": avg_latency, - "Store-Forward_Min_latency_ns": min_latency, - "Store-Forward_Max_latency_ns": max_latency} + avg_latency = stats["Store-Forward_Avg_latency_ns"][port_num] + min_latency = stats["Store-Forward_Min_latency_ns"][port_num] + max_latency = stats["Store-Forward_Max_latency_ns"][port_num] + samples[port_name] = { + "Store-Forward_Avg_latency_ns": avg_latency, + "Store-Forward_Min_latency_ns": min_latency, + "Store-Forward_Max_latency_ns": max_latency} except IndexError: pass diff --git a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_trex.py b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_trex.py index cdbb41485..7ecb12478 100644 --- a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_trex.py +++ b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_trex.py @@ -45,11 +45,12 @@ class TrexRfcResourceHelper(tg_trex.TrexResourceHelper): time.sleep(self.SAMPLING_PERIOD) traffic_profile.stop_traffic(self) - output = traffic_profile.get_drop_percentage( + completed, output = traffic_profile.get_drop_percentage( samples, self.rfc2544_helper.tolerance_low, self.rfc2544_helper.tolerance_high, self.rfc2544_helper.correlated_traffic) self._queue.put(output) + return completed def start_client(self, ports, mult=None, duration=None, force=True): self.client.start(ports=ports, mult=mult, duration=duration, force=force) |