diff options
author | John O Loughlin <john.oloughlin@intel.com> | 2018-11-15 11:19:37 +0000 |
---|---|---|
committer | John O Loughlin <john.oloughlin@intel.com> | 2018-11-27 16:58:47 +0000 |
commit | 9e3f6bd7080c1b39b51047a97a9f0907d8658d05 (patch) | |
tree | 1a38b9989713030154c37073d7294085f2e63df5 /yardstick | |
parent | 11bfaf23160da0f0391a2152dddb19b3a0bae766 (diff) |
Add option to allow user to pass vpe_script
Add option to allow user to pass their own vpe_script
vpe_script will be auto-generated by default.
To use your own config file use the 'script' parameter in the config file
vnf_config: { file: './vpe_config/vpe_config_2_ports',
action_bulk_file: './vpe_config/action_bulk_512.txt',
full_tm_profile_file: './vpe_config/full_tm_profile_10G.cfg',
script_file: './vpe_config/vpe_script_sample }
JIRA: YARDSTICK-1525
Change-Id: Ie23e5705f4c0475e858be73b8a504a7df8898828
Signed-off-by: John O Loughlin <john.oloughlin@intel.com>
Diffstat (limited to 'yardstick')
-rw-r--r-- | yardstick/network_services/vnf_generic/vnf/sample_vnf.py | 4 | ||||
-rw-r--r-- | yardstick/network_services/vnf_generic/vnf/vpe_vnf.py | 16 |
2 files changed, 14 insertions, 6 deletions
diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py index 673344f4e..1cb5cdd8f 100644 --- a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py +++ b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py @@ -180,7 +180,7 @@ class DpdkVnfSetupEnvHelper(SetupEnvHelper): """No actions/rules (flows) by default""" return None - def _build_pipeline_kwargs(self, cfg_file=None): + def _build_pipeline_kwargs(self, cfg_file=None, script=None): tool_path = self.ssh_helper.provision_tool(tool_file=self.APP_NAME) # count the number of actual ports in the list of pairs # remove duplicate ports @@ -201,7 +201,7 @@ class DpdkVnfSetupEnvHelper(SetupEnvHelper): self.pipeline_kwargs = { 'cfg_file': cfg_file if cfg_file else self.CFG_CONFIG, - 'script': self.CFG_SCRIPT, + 'script': script if script else self.CFG_SCRIPT, 'port_mask_hex': ports_mask_hex, 'tool_path': tool_path, 'hwlb': hwlb, diff --git a/yardstick/network_services/vnf_generic/vnf/vpe_vnf.py b/yardstick/network_services/vnf_generic/vnf/vpe_vnf.py index 349ef7888..dd3221386 100644 --- a/yardstick/network_services/vnf_generic/vnf/vpe_vnf.py +++ b/yardstick/network_services/vnf_generic/vnf/vpe_vnf.py @@ -106,6 +106,7 @@ class VpeApproxSetupEnvHelper(DpdkVnfSetupEnvHelper): action_bulk_file = vnf_cfg.get('action_bulk_file', '/tmp/action_bulk_512.txt') full_tm_profile_file = vnf_cfg.get('full_tm_profile_file', '/tmp/full_tm_profile_10G.cfg') config_file = vnf_cfg.get('file', '/tmp/vpe_config') + script_file = vnf_cfg.get('script_file', None) vpe_vars = { "bin_path": self.ssh_helper.bin_path, "socket": self.socket, @@ -113,8 +114,16 @@ class VpeApproxSetupEnvHelper(DpdkVnfSetupEnvHelper): self._build_vnf_ports() vpe_conf = ConfigCreate(self.vnfd_helper, self.socket) + if script_file is None: + # autogenerate vpe_script if not given + vpe_script = vpe_conf.generate_vpe_script(self.vnfd_helper.interfaces) + script_file = self.CFG_SCRIPT + else: + with utils.open_relative_file(script_file, task_path) as handle: + vpe_script = handle.read() + config_basename = posixpath.basename(config_file) - script_basename = posixpath.basename(self.CFG_SCRIPT) + script_basename = posixpath.basename(script_file) with utils.open_relative_file(action_bulk_file, task_path) as handle: action_bulk = handle.read() @@ -125,8 +134,6 @@ class VpeApproxSetupEnvHelper(DpdkVnfSetupEnvHelper): with utils.open_relative_file(config_file, task_path) as handle: vpe_config = handle.read() - # vpe_script needs to be autogenerated - vpe_script = vpe_conf.generate_vpe_script(self.vnfd_helper.interfaces) # upload the 4 config files to the target server self.ssh_helper.upload_config_file(config_basename, vpe_config.format(**vpe_vars)) self.ssh_helper.upload_config_file(script_basename, vpe_script.format(**vpe_vars)) @@ -138,7 +145,8 @@ class VpeApproxSetupEnvHelper(DpdkVnfSetupEnvHelper): LOG.info("Provision and start the %s", self.APP_NAME) LOG.info(config_file) LOG.info(self.CFG_SCRIPT) - self._build_pipeline_kwargs(cfg_file='/tmp/' + config_basename) + self._build_pipeline_kwargs(cfg_file='/tmp/' + config_basename, + script='/tmp/' + script_basename) return self.PIPELINE_COMMAND.format(**self.pipeline_kwargs) |