X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=nfvbench%2Ftraffic_server.py;h=2239ec37814994c2f439e495c476a66f97942c4d;hb=391dcf76fefb747888a3411ae3b8df7b1ad26685;hp=dcb83fba456c315f9d8ed1c2d60c0fd7aa5ce713;hpb=99260f95219301bb5c0b58921e793bcad6ec4990;p=nfvbench.git diff --git a/nfvbench/traffic_server.py b/nfvbench/traffic_server.py index dcb83fb..2239ec3 100644 --- a/nfvbench/traffic_server.py +++ b/nfvbench/traffic_server.py @@ -34,17 +34,17 @@ class TRexTrafficServer(TrafficServer): 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, @@ -52,10 +52,10 @@ class TRexTrafficServer(TrafficServer): 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)