aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/network_services/traffic_profile
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/network_services/traffic_profile')
-rw-r--r--yardstick/network_services/traffic_profile/base.py3
-rw-r--r--yardstick/network_services/traffic_profile/http.py4
-rw-r--r--yardstick/network_services/traffic_profile/http_ixload.py103
-rw-r--r--yardstick/network_services/traffic_profile/ixia_rfc2544.py145
-rw-r--r--yardstick/network_services/traffic_profile/prox_binsearch.py9
-rw-r--r--yardstick/network_services/traffic_profile/prox_profile.py5
6 files changed, 198 insertions, 71 deletions
diff --git a/yardstick/network_services/traffic_profile/base.py b/yardstick/network_services/traffic_profile/base.py
index 4fbceea9b..ea3f17874 100644
--- a/yardstick/network_services/traffic_profile/base.py
+++ b/yardstick/network_services/traffic_profile/base.py
@@ -97,6 +97,9 @@ class TrafficProfile(object):
self.params = tp_config
self.config = TrafficProfileConfig(tp_config)
+ def is_ended(self):
+ return False
+
def execute_traffic(self, traffic_generator, **kawrgs):
""" This methods defines the behavior of the traffic generator.
It will be called in a loop until the traffic generator exits.
diff --git a/yardstick/network_services/traffic_profile/http.py b/yardstick/network_services/traffic_profile/http.py
index 2d00fb849..31ab17ef7 100644
--- a/yardstick/network_services/traffic_profile/http.py
+++ b/yardstick/network_services/traffic_profile/http.py
@@ -24,6 +24,10 @@ class TrafficProfileGenericHTTP(TrafficProfile):
def __init__(self, TrafficProfile):
super(TrafficProfileGenericHTTP, self).__init__(TrafficProfile)
+ def get_links_param(self):
+ return {k: v for k, v in self.params.items() if
+ "uplink" in k or "downlink" in k}
+
def execute(self, traffic_generator):
''' send run traffic for a selected traffic generator'''
pass
diff --git a/yardstick/network_services/traffic_profile/http_ixload.py b/yardstick/network_services/traffic_profile/http_ixload.py
index 39ee16b42..9210f3c6d 100644
--- a/yardstick/network_services/traffic_profile/http_ixload.py
+++ b/yardstick/network_services/traffic_profile/http_ixload.py
@@ -114,8 +114,10 @@ class IXLOADHttpTest(object):
self.chassis = None
self.card = None
self.ports_to_reassign = None
+ self.links_param = None
self.test_input = jsonutils.loads(test_input)
self.parse_run_test()
+ self.test = None
@staticmethod
def format_ports_for_reassignment(ports):
@@ -179,6 +181,90 @@ class IXLOADHttpTest(object):
LOG.error('Error: IxLoad config file not found: %s', config_file)
raise
+ def update_network_address(self, net_traffic, address, gateway, prefix):
+ """Update ip address and gateway for net_traffic object
+
+ This function update field which configure source addresses for
+ traffic which is described by net_traffic object.
+ Do not return anything
+
+ :param net_traffic: (IxLoadObjectProxy) proxy obj to tcl net_traffic object
+ :param address: (str) Ipv4 range start address
+ :param gateway: (str) Ipv4 address of gateway
+ :param prefix: (int) subnet prefix
+ :return:
+ """
+ try:
+ ethernet = net_traffic.network.getL1Plugin()
+ ix_net_l2_ethernet_plugin = ethernet.childrenList[0]
+ ix_net_ip_v4_v6_plugin = ix_net_l2_ethernet_plugin.childrenList[0]
+ ix_net_ip_v4_v6_range = ix_net_ip_v4_v6_plugin.rangeList[0]
+
+ ix_net_ip_v4_v6_range.config(
+ prefix=prefix,
+ ipAddress=address,
+ gatewayAddress=gateway)
+ except Exception:
+ raise exceptions.InvalidRxfFile
+
+ def update_network_mac_address(self, net_traffic, mac):
+ """Update MACaddress for net_traffic object
+
+ This function update field which configure MACaddresses for
+ traffic which is described by net_traffic object.
+ If mac == "auto" then will be configured auto generated mac
+ Do not return anything.
+
+ :param net_traffic: (IxLoadObjectProxy) proxy obj to tcl net_traffic object
+ :param mac: (str) MAC
+ :return:
+ """
+ try:
+ ethernet = net_traffic.network.getL1Plugin()
+ ix_net_l2_ethernet_plugin = ethernet.childrenList[0]
+ ix_net_ip_v4_v6_plugin = ix_net_l2_ethernet_plugin.childrenList[0]
+ ix_net_ip_v4_v6_range = ix_net_ip_v4_v6_plugin.rangeList[0]
+
+ if str(mac).lower() == "auto":
+ ix_net_ip_v4_v6_range.config(autoMacGeneration=True)
+ else:
+ ix_net_ip_v4_v6_range.config(autoMacGeneration=False)
+ mac_range = ix_net_ip_v4_v6_range.getLowerRelatedRange(
+ "MacRange")
+ mac_range.config(mac=mac)
+ except Exception:
+ raise exceptions.InvalidRxfFile
+
+ def update_network_param(self, net_traffic, param):
+ """Update net_traffic by parameters specified in param"""
+
+ self.update_network_address(net_traffic, param["address"],
+ param["gateway"], param["subnet_prefix"])
+
+ self.update_network_mac_address(net_traffic, param["mac"])
+
+ def update_config(self):
+ """Update some fields by parameters from traffic profile"""
+
+ net_traffics = {}
+ # self.test.communityList is a IxLoadObjectProxy to some tcl object
+ # which contain all net_traffic objects in scenario.
+ # net_traffic item has a name in format "activity_name@item_name"
+ try:
+ for item in self.test.communityList:
+ net_traffics[item.name.split('@')[1]] = item
+ except Exception: # pylint: disable=broad-except
+ pass
+
+ for name, net_traffic in net_traffics.items():
+ try:
+ param = self.links_param[name]
+ except KeyError:
+ LOG.debug('There is no param for net_traffic %s', name)
+ continue
+
+ self.update_network_param(net_traffic, param["ip"])
+
def start_http_test(self):
self.ix_load = IxLoad()
@@ -205,16 +291,18 @@ class IXLOADHttpTest(object):
# Get the first test on the testList
test_name = repository.testList[0].cget("name")
- test = repository.testList.getItem(test_name)
+ self.test = repository.testList.getItem(test_name)
self.set_results_dir(test_controller, self.results_on_windows)
- test.config(statsRequired=1, enableResetPorts=1, csvInterval=2,
- enableForceOwnership=True)
+ self.test.config(statsRequired=1, enableResetPorts=1, csvInterval=2,
+ enableForceOwnership=True)
+
+ self.update_config()
# ---- Remap ports ----
try:
- self.reassign_ports(test, repository, self.ports_to_reassign)
+ self.reassign_ports(self.test, repository, self.ports_to_reassign)
except Exception: # pylint: disable=broad-except
LOG.exception("Exception occurred during reassign_ports")
@@ -254,7 +342,7 @@ class IXLOADHttpTest(object):
self.stat_utils.StartCollector(self.IxL_StatCollectorCommand)
- test_controller.run(test)
+ test_controller.run(self.test)
self.ix_load.waitForTestFinish()
test_controller.releaseConfigWaitFinish()
@@ -266,7 +354,7 @@ class IXLOADHttpTest(object):
test_controller.generateReport(detailedReport=1, format="PDF;HTML")
test_controller.releaseConfigWaitFinish()
- self.ix_load.delete(test)
+ self.ix_load.delete(self.test)
self.ix_load.delete(test_controller)
self.ix_load.delete(logger)
self.ix_load.delete(log_engine)
@@ -304,6 +392,9 @@ class IXLOADHttpTest(object):
LOG.debug("Ports to be reassigned: %s", self.ports_to_reassign)
+ self.links_param = self.test_input["links_param"]
+ LOG.debug("Links param to be applied: %s", self.links_param)
+
def main(args):
# Get the args from cmdline and parse and run the test
diff --git a/yardstick/network_services/traffic_profile/ixia_rfc2544.py b/yardstick/network_services/traffic_profile/ixia_rfc2544.py
index 44bf2eafc..0b7a78c2c 100644
--- a/yardstick/network_services/traffic_profile/ixia_rfc2544.py
+++ b/yardstick/network_services/traffic_profile/ixia_rfc2544.py
@@ -28,6 +28,8 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile):
DOWNLINK = 'downlink'
DROP_PERCENT_ROUND = 6
RATE_ROUND = 5
+ STATUS_SUCCESS = "Success"
+ STATUS_FAIL = "Failure"
def __init__(self, yaml_data):
super(IXIARFC2544Profile, self).__init__(yaml_data)
@@ -56,68 +58,83 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile):
if not traffickey.startswith((self.UPLINK, self.DOWNLINK)):
continue
+ # values should be single-item dict, so just grab the first item
try:
- # values should be single-item dict, so just grab the first item
- try:
- key, value = next(iter(values.items()))
- except StopIteration:
- result[traffickey] = {}
- continue
-
- port_id = value.get('id', 1)
- port_index = port_id - 1
-
- if value.get('outer_l3v4'):
- ip = value['outer_l3v4']
- src_key, dst_key = 'srcip4', 'dstip4'
- else:
- ip = value['outer_l3v6']
- src_key, dst_key = 'srcip6', 'dstip6'
-
- srcip, srcmask = self._get_ip_and_mask(ip[src_key])
- dstip, dstmask = self._get_ip_and_mask(ip[dst_key])
-
- outer_l4 = value.get('outer_l4')
- src_port, src_port_mask = self._get_fixed_and_mask(outer_l4['srcport'])
- dst_port, dst_port_mask = self._get_fixed_and_mask(outer_l4['dstport'])
- result[traffickey] = {
- 'bidir': False,
- 'id': port_id,
- 'rate': self.rate,
- 'rate_unit': self.rate_unit,
- '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)],
- },
- 'outer_l3': {
- 'count': ip['count'],
- 'dscp': ip['dscp'],
- 'ttl': ip['ttl'],
- 'srcseed': ip.get('srcseed', 1),
- 'dstseed': ip.get('dstseed', 1),
- 'srcip': srcip,
- 'dstip': dstip,
- 'srcmask': srcmask,
- 'dstmask': dstmask,
- 'type': key,
- 'proto': ip['proto'],
- },
- 'outer_l4': {
- 'srcport': src_port,
- 'dstport': dst_port,
- 'srcportmask': src_port_mask,
- 'dstportmask': dst_port_mask,
- 'count': outer_l4['count'],
- 'seed': outer_l4.get('seed', 1)
- }
-
- }
- except KeyError:
+ key, value = next(iter(values.items()))
+ except StopIteration:
+ result[traffickey] = {}
continue
+ port_id = value.get('id', 1)
+ port_index = port_id - 1
+
+ result[traffickey] = {
+ 'bidir': False,
+ 'id': port_id,
+ 'rate': self.rate,
+ 'rate_unit': self.rate_unit,
+ 'outer_l2': {},
+ 'outer_l3': {},
+ 'outer_l4': {},
+ }
+
+ outer_l2 = value.get('outer_l2')
+ if outer_l2:
+ result[traffickey]['outer_l2'].update({
+ 'framesize': outer_l2.get('framesize'),
+ 'framesPerSecond': True,
+ 'QinQ': outer_l2.get('QinQ'),
+ 'srcmac': mac.get('src_mac_{}'.format(port_index)),
+ 'dstmac': mac.get('dst_mac_{}'.format(port_index)),
+ })
+
+ if value.get('outer_l3v4'):
+ outer_l3 = value['outer_l3v4']
+ src_key, dst_key = 'srcip4', 'dstip4'
+ else:
+ outer_l3 = value.get('outer_l3v6')
+ src_key, dst_key = 'srcip6', 'dstip6'
+ if outer_l3:
+ srcip = srcmask = dstip = dstmask = None
+ if outer_l3.get(src_key):
+ srcip, srcmask = self._get_ip_and_mask(outer_l3[src_key])
+ if outer_l3.get(dst_key):
+ dstip, dstmask = self._get_ip_and_mask(outer_l3[dst_key])
+
+ result[traffickey]['outer_l3'].update({
+ 'count': outer_l3.get('count', 1),
+ 'dscp': outer_l3.get('dscp'),
+ 'ttl': outer_l3.get('ttl'),
+ 'srcseed': outer_l3.get('srcseed', 1),
+ 'dstseed': outer_l3.get('dstseed', 1),
+ 'srcip': srcip,
+ 'dstip': dstip,
+ 'srcmask': srcmask,
+ 'dstmask': dstmask,
+ 'type': key,
+ 'proto': outer_l3.get('proto'),
+ })
+
+ outer_l4 = value.get('outer_l4')
+ if outer_l4:
+ src_port = src_port_mask = dst_port = dst_port_mask = None
+ if outer_l4.get('srcport'):
+ src_port, src_port_mask = (
+ self._get_fixed_and_mask(outer_l4['srcport']))
+
+ if outer_l4.get('dstport'):
+ dst_port, dst_port_mask = (
+ self._get_fixed_and_mask(outer_l4['dstport']))
+
+ result[traffickey]['outer_l4'].update({
+ 'srcport': src_port,
+ 'dstport': dst_port,
+ 'srcportmask': src_port_mask,
+ 'dstportmask': dst_port_mask,
+ 'count': outer_l4.get('count', 1),
+ 'seed': outer_l4.get('seed', 1),
+ })
+
return result
def _ixia_traffic_generate(self, traffic, ixia_obj):
@@ -159,7 +176,7 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile):
self._ixia_traffic_generate(traffic, ixia_obj)
return first_run
- def get_drop_percentage(self, samples, tol_min, tolerance,
+ def get_drop_percentage(self, samples, tol_min, tolerance, precision,
first_run=False):
completed = False
drop_percent = 100
@@ -193,6 +210,10 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile):
else:
completed = True
+ LOG.debug("tolerance=%s, tolerance_precision=%s drop_percent=%s "
+ "completed=%s", tolerance, precision, drop_percent,
+ completed)
+
latency_ns_avg = float(
sum([samples[iface]['Store-Forward_Avg_latency_ns']
for iface in samples])) / num_ifaces
@@ -203,6 +224,10 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile):
sum([samples[iface]['Store-Forward_Max_latency_ns']
for iface in samples])) / num_ifaces
+ samples['Status'] = self.STATUS_FAIL
+ if round(drop_percent, precision) <= tolerance:
+ samples['Status'] = self.STATUS_SUCCESS
+
samples['TxThroughput'] = tx_throughput
samples['RxThroughput'] = rx_throughput
samples['DropPercentage'] = drop_percent
diff --git a/yardstick/network_services/traffic_profile/prox_binsearch.py b/yardstick/network_services/traffic_profile/prox_binsearch.py
index 16a0411ec..f924cf419 100644
--- a/yardstick/network_services/traffic_profile/prox_binsearch.py
+++ b/yardstick/network_services/traffic_profile/prox_binsearch.py
@@ -66,6 +66,9 @@ class ProxBinSearchProfile(ProxProfile):
yield test_value
test_value = self.mid_point
+ def is_ended(self):
+ return self.done.is_set()
+
def run_test_with_pkt_size(self, traffic_gen, pkt_size, duration):
"""Run the test for a single packet size.
@@ -93,7 +96,7 @@ class ProxBinSearchProfile(ProxProfile):
# success, the binary search will complete on an integer multiple
# of the precision, rather than on a fraction of it.
- theor_max_thruput = 0
+ theor_max_thruput = 0.0
result_samples = {}
@@ -195,9 +198,9 @@ class ProxBinSearchProfile(ProxProfile):
LOG.info(
">>>##>> Result Reached PktSize %s Theor_Max_Thruput %s Actual_throughput %s",
- pkt_size, theor_max_thruput, result_samples.get("RxThroughput", 0))
+ pkt_size, theor_max_thruput, result_samples.get("RxThroughput", 0.0))
result_samples["Status"] = STATUS_RESULT
result_samples["Next_Step"] = ""
- result_samples["Actual_throughput"] = result_samples.get("RxThroughput", 0)
+ result_samples["Actual_throughput"] = result_samples.get("RxThroughput", 0.0)
result_samples["theor_max_throughput"] = theor_max_thruput
self.queue.put(result_samples)
diff --git a/yardstick/network_services/traffic_profile/prox_profile.py b/yardstick/network_services/traffic_profile/prox_profile.py
index 343ef1da2..de4b3f9a0 100644
--- a/yardstick/network_services/traffic_profile/prox_profile.py
+++ b/yardstick/network_services/traffic_profile/prox_profile.py
@@ -16,6 +16,7 @@
from __future__ import absolute_import
import logging
+import multiprocessing
from yardstick.network_services.traffic_profile.base import TrafficProfile
from yardstick.network_services.vnf_generic.vnf.prox_helpers import ProxProfileHelper
@@ -56,7 +57,7 @@ class ProxProfile(TrafficProfile):
def __init__(self, tp_config):
super(ProxProfile, self).__init__(tp_config)
self.queue = None
- self.done = False
+ self.done = multiprocessing.Event()
self.results = []
# TODO: get init values from tp_config
@@ -116,7 +117,7 @@ class ProxProfile(TrafficProfile):
try:
pkt_size = next(self.pkt_size_iterator)
except StopIteration:
- self.done = True
+ self.done.set()
return
# Adjust packet size upwards if it's less than the minimum