summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-10-18 18:14:13 -0700
committerRoss Brattain <ross.b.brattain@intel.com>2017-10-18 18:19:21 -0700
commit7ed018cddf88ac1c5a92f71fa5e421e66d259bc0 (patch)
tree069d186b6edcf9b3668c6dec0b60df060ab1ea84
parent67ce9cc75d1bf2c11a6392a3ad2edfdba168ba91 (diff)
NSB: fix trex config to use dpdk port number
From some reason Heat/Neutron is now creating interfaces such that xe0 and xe1 are swapped. xe0 fa:16:3e:38:c7:66 0000:00:05.0 xe1 fa:16:3e:2f:f3:e2 0000:00:03.0 this causes the DPDK port numbering to be swapped. xe0 is DPDK port 1 because it has higher PCI address xe1 is DPDK port 0 because it has lower PCI address. The VNF is configured correctly because it uses DPDK port numbers, whereas TRex was using interface list ordering. Modify trex_cfg.yaml to use DPDK port ordering. This also requires running generate_cfg() after setup() in instantiate() +------------------------------------+-------------------+------------------------------+--------+ | Name | MAC Address | Fixed IP Addresses | Status | +------------------------------------+-------------------+------------------------------+--------+ | vnf_0.yardstick-af5ccb47-xe0-port | fa:16:3e:66:a5:e4 | ip_address='10.1.0.7', | ACTIVE | | vnf_0.yardstick-af5ccb47-mgmt-port | fa:16:3e:fa:98:fe | ip_address='10.0.1.10', | ACTIVE | | tg_0.yardstick-af5ccb47-xe1-port | fa:16:3e:2f:f3:e2 | ip_address='10.1.1.9', | ACTIVE | | vnf_0.yardstick-af5ccb47-xe1-port | fa:16:3e:f3:1d:f5 | ip_address='10.1.1.4', | ACTIVE | | | fa:16:3e:e3:8c:65 | ip_address='10.0.1.1', | ACTIVE | | | fa:16:3e:ff:d1:b7 | ip_address='11.191.14.110', | N/A | | tg_0.yardstick-af5ccb47-xe0-port | fa:16:3e:38:c7:66 | ip_address='10.1.0.8', | ACTIVE | | | fa:16:3e:ff:53:5f | ip_address='11.191.14.101', | DOWN | | | fa:16:3e:23:5d:2c | ip_address='10.0.1.2', | ACTIVE | | tg_0.yardstick-af5ccb47-mgmt-port | fa:16:3e:7a:df:4e | ip_address='10.0.1.5', | ACTIVE | | | fa:16:3e:22:65:36 | ip_address='11.191.14.109', | N/A | +------------------------------------+-------------------+------------------------------+--------+ /sys/devices/pci0000:00/0000:00:03.0/virtio0/net/ens3/address:fa:16:3e:2f:f3:e2 /sys/devices/pci0000:00/0000:00:05.0/virtio2/net/ens5/address:fa:16:3e:38:c7:66 Change-Id: Iaef2c7d9a5af7f45bd805a8ad6ee545ce0495cb1 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
-rw-r--r--yardstick/network_services/vnf_generic/vnf/sample_vnf.py3
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_trex.py25
2 files changed, 16 insertions, 12 deletions
diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
index b5cf03477..08ec44f65 100644
--- a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
+++ b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
@@ -924,8 +924,9 @@ class SampleVNFTrafficGen(GenericTrafficGen):
def instantiate(self, scenario_cfg, context_cfg):
self.scenario_helper.scenario_cfg = scenario_cfg
- self.resource_helper.generate_cfg()
self.resource_helper.setup()
+ # must generate_cfg after DPDK bind because we need port number
+ self.resource_helper.generate_cfg()
LOG.info("Starting %s server...", self.APP_NAME)
name = "{}-{}-{}".format(self.name, self.APP_NAME, os.getpid())
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_trex.py b/yardstick/network_services/vnf_generic/vnf/tg_trex.py
index fe435f63e..458f1b844 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_trex.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_trex.py
@@ -49,30 +49,33 @@ class TrexResourceHelper(ClientResourceHelper):
SYNC_PORT = 4501
def generate_cfg(self):
- ext_intf = self.vnfd_helper.interfaces
+ port_names = self.vnfd_helper.port_pairs.all_ports
vpci_list = []
port_list = []
- trex_cfg = {
- 'interfaces': vpci_list,
- 'port_info': port_list,
- "port_limit": len(ext_intf),
- "version": '2',
- }
- cfg_file = [trex_cfg]
- for interface in ext_intf:
+ port_nums = sorted(self.vnfd_helper.port_nums(port_names))
+ for port_num in port_nums:
+ interface = self.vnfd_helper.find_interface_by_port(port_num)
virtual_interface = interface['virtual-interface']
- vpci_list.append(virtual_interface["vpci"])
dst_mac = virtual_interface["dst_mac"]
+ # why skip?, ordering is based on DPDK port number so we can't skip
if not dst_mac:
continue
-
+ # TRex ports must be in DPDK port number, so order of append matters
+ vpci_list.append(virtual_interface["vpci"])
local_mac = virtual_interface["local_mac"]
port_list.append({
"src_mac": mac_address_to_hex_list(local_mac),
"dest_mac": mac_address_to_hex_list(dst_mac),
})
+ trex_cfg = {
+ 'interfaces': vpci_list,
+ 'port_info': port_list,
+ "port_limit": len(port_names),
+ "version": '2',
+ }
+ cfg_file = [trex_cfg]
cfg_str = yaml.safe_dump(cfg_file, default_flow_style=False, explicit_start=True)
self.ssh_helper.upload_config_file(os.path.basename(self.CONF_FILE), cfg_str)