Merge "Suppress log outputs in test_ixnet_api"
[yardstick.git] / yardstick / network_services / vnf_generic / vnf / vpe_vnf.py
index 349ef78..dd32213 100644 (file)
@@ -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)