assert len(contents) == 1
self.trex_dir = os.path.join(trex_base_dir, contents[0])
- def run_server(self, traffic_profile, vlan_tagging, filename='/etc/trex_cfg.yaml'):
+ def run_server(self, generator_config, filename='/etc/trex_cfg.yaml'):
"""
Runs TRex server for specified traffic profile.
:param traffic_profile: traffic profile object based on config file
:param filename: path where to save TRex config file
"""
- cfg = self.__save_config(traffic_profile, filename)
- cores = traffic_profile.cores
- sw_mode = "--software" if traffic_profile.generator_config.software_mode else ""
- vlan_opt = "--vlan" if vlan_tagging else ""
+ cfg = self.__save_config(generator_config, filename)
+ cores = generator_config.cores
+ sw_mode = "--software" if generator_config.software_mode else ""
+ vlan_opt = "--vlan" if generator_config.vlan_tagging else ""
subprocess.Popen(['nohup', '/bin/bash', '-c',
'./t-rex-64 -i -c {} --iom 0 --no-scapy-server --close-at-end {} '
'{} --cfg {} &> /tmp/trex.log & disown'.format(cores, sw_mode,
cwd=self.trex_dir)
LOG.info('TRex server is running...')
- def __save_config(self, traffic_profile, filename):
- ifs = ",".join([repr(pci) for pci in traffic_profile.pcis])
+ def __save_config(self, generator_config, filename):
+ ifs = ",".join([repr(pci) for pci in generator_config.pcis])
- result = """# Config generated by NFVBench tool
+ result = """# Config generated by NFVbench
- port_limit : 2
version : 2
interfaces : [{ifs}]""".format(ifs=ifs)