diff options
-rw-r--r-- | yardstick/network_services/vnf_generic/vnf/sample_vnf.py | 3 | ||||
-rw-r--r-- | yardstick/network_services/vnf_generic/vnf/tg_trex.py | 25 |
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) |