diff options
author | Martin Banszel <martinx.banszel@intel.com> | 2017-07-19 19:35:02 +0000 |
---|---|---|
committer | Ross Brattain <ross.b.brattain@intel.com> | 2017-09-18 01:28:28 -0700 |
commit | 86083c8023f40d368f6339d2ab68d49c9ac8b8ee (patch) | |
tree | 0ca209f5bf0f00e36e856ffecd21184921265077 /yardstick/network_services/vnf_generic/vnf/tg_ping.py | |
parent | 38eb33a092e903b9854267d3e36496c919517103 (diff) |
NSB: fix port topology
Add a new PortPair class to resolve the
topology into list of public and private ports.
Before we were calculating public/private in multiple
locations and using different conventions.
In addition for all the DPDK test we need to use the DPDK
port number and no rely on interface ordering or interface naming
conventions.
We used to use xe0 -> 0, xe1 -> 1, etc. This is not the DPDK port
number.
Use the new dpdknicbind_helper class to parse the output of
dpdk-devbind.py to find the actual DPDK port number at runtime.
We then use this DPDK port number to correctly calculate the
port_mask_hex.
The port mask maps the DPDK port num (PMD ID) to the LINK ID
used in the pipeline config
We also need to make sure we only use the interfaces matched to the
topology and not use all the interfaces, because in some cases we will
have unused interfaces. In particular TRex always requires an even
number of interfaces, so for single port TRex tests we have to create
the second port and not use it.
Thus we had to modify the traffic generator stats code to only dump
stats for used ports and no unused ports.
Ixia was using interface ordering to map to Ixia ports, instead we use
the dpdk_port_num which must be hardcoded for Ixia.
Renamed traffic_profile.execute to traffic_profile.execute_traffic so
we can trace the code easier.
We pass the port used by the traffic profile to generate_samples so we
don't get stats for unused ports.
Fixed up vPE config creation and bring up issues.
Fixed up CGNAPT and UDP_Replay to work correctly.
Tested with 4-port scale-out
Change-Id: I2e4f328bff2904108081e92a4bf712333fa73869
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Edward MacGillivray <edward.s.macgillivray@intel.com>
Diffstat (limited to 'yardstick/network_services/vnf_generic/vnf/tg_ping.py')
-rw-r--r-- | yardstick/network_services/vnf_generic/vnf/tg_ping.py | 74 |
1 files changed, 47 insertions, 27 deletions
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_ping.py b/yardstick/network_services/vnf_generic/vnf/tg_ping.py index e65296287..9cd9f2574 100644 --- a/yardstick/network_services/vnf_generic/vnf/tg_ping.py +++ b/yardstick/network_services/vnf_generic/vnf/tg_ping.py @@ -23,6 +23,7 @@ from ipaddress import IPv4Interface from yardstick.network_services.vnf_generic.vnf.sample_vnf import SampleVNFTrafficGen from yardstick.network_services.vnf_generic.vnf.sample_vnf import DpdkVnfSetupEnvHelper +from yardstick.network_services.vnf_generic.vnf.sample_vnf import ClientResourceHelper LOG = logging.getLogger(__name__) @@ -59,7 +60,38 @@ class PingParser(object): class PingSetupEnvHelper(DpdkVnfSetupEnvHelper): def setup_vnf_environment(self): - self._bind_kernel_devices() + for intf in self.vnfd_helper.interfaces: + vi = intf['virtual-interface'] + vi['local_iface_name'] = self.get_local_iface_name_by_vpci(vi['vpci']) + + +class PingResourceHelper(ClientResourceHelper): + + def __init__(self, setup_helper): + super(PingResourceHelper, self).__init__(setup_helper) + self._queue = Queue() + self._parser = PingParser(self._queue) + + def run_traffic(self, traffic_profile): + # drop the connection in order to force a new one + self.ssh_helper.drop_connection() + + self.client_started.value = 1 + cmd_list = [ + "sudo ip addr flush {local_if_name}", + "sudo ip addr add {local_ip}/24 dev {local_if_name}", + "sudo ip link set {local_if_name} up", + ] + + self.cmd_kwargs['packet_size'] = traffic_profile.params['traffic_profile']['frame_size'] + + for cmd in cmd_list: + self.ssh_helper.execute(cmd.format(**self.cmd_kwargs)) + + ping_cmd = "nohup ping -s {packet_size} {target_ip}&" + self.ssh_helper.run(ping_cmd.format(**self.cmd_kwargs), + stdout=self._parser, + keep_stdin_open=True, pty=True) class PingTrafficGen(SampleVNFTrafficGen): @@ -69,16 +101,17 @@ class PingTrafficGen(SampleVNFTrafficGen): """ TG_NAME = 'Ping' + APP_NAME = 'Ping' RUN_WAIT = 4 def __init__(self, name, vnfd, setup_env_helper_type=None, resource_helper_type=None): if setup_env_helper_type is None: setup_env_helper_type = PingSetupEnvHelper + if resource_helper_type is None: + resource_helper_type = PingResourceHelper super(PingTrafficGen, self).__init__(name, vnfd, setup_env_helper_type, resource_helper_type) - self._queue = Queue() - self._parser = PingParser(self._queue) self._result = {} def scale(self, flavor=""): @@ -89,12 +122,23 @@ class PingTrafficGen(SampleVNFTrafficGen): return self._tg_process.is_alive() def instantiate(self, scenario_cfg, context_cfg): + self._start_server() self._result = { "packets_received": 0, "rtt": 0, } + intf = self.vnfd_helper.interfaces[0]["virtual-interface"] + self.resource_helper.cmd_kwargs = { + 'target_ip': IPv4Interface(intf["dst_ip"]).ip.exploded, + 'local_ip': IPv4Interface(intf["local_ip"]).ip.exploded, + 'local_if_name': intf["local_iface_name"].split('/')[0], + } + self.setup_helper.setup_vnf_environment() + def wait_for_instantiate(self): + pass + def listen_traffic(self, traffic_profile): """ Not needed for ping @@ -102,27 +146,3 @@ class PingTrafficGen(SampleVNFTrafficGen): :return: """ pass - - def _traffic_runner(self, traffic_profile): - intf = self.vnfd_helper.interfaces[0]["virtual-interface"] - profile = traffic_profile.params["traffic_profile"] - cmd_kwargs = { - 'target_ip': IPv4Interface(intf["dst_ip"]).ip.exploded, - 'local_ip': IPv4Interface(intf["local_ip"]).ip.exploded, - 'local_if_name': intf["local_iface_name"].split('/')[0], - 'packet_size': profile["frame_size"], - } - - cmd_list = [ - "sudo ip addr flush {local_if_name}", - "sudo ip addr add {local_ip}/24 dev {local_if_name}", - "sudo ip link set {local_if_name} up", - ] - - for cmd in cmd_list: - self.ssh_helper.execute(cmd.format(**cmd_kwargs)) - - ping_cmd = "ping -s {packet_size} {target_ip}" - self.ssh_helper.run(ping_cmd.format(**cmd_kwargs), - stdout=self._parser, - keep_stdin_open=True, pty=True) |