aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick
diff options
context:
space:
mode:
authorVolodymyr Mytnyk <volodymyrx.mytnyk@intel.com>2018-11-14 16:22:36 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-11-14 16:22:36 +0000
commit3f37af01bc959e886b10d399e172e2c5ac943abe (patch)
treec4c37b5b6bf86d1d8266545c6d367f2e0ade787a /yardstick
parent1da538e0382baf0dfcbb397db664b9eff805890f (diff)
parentc2a8982e943aff22945884fa3f7c9218a1dd5e0c (diff)
Merge "Add option to pass config file to vPE"
Diffstat (limited to 'yardstick')
-rw-r--r--yardstick/network_services/pipeline.py2
-rw-r--r--yardstick/network_services/vnf_generic/vnf/sample_vnf.py4
-rw-r--r--yardstick/network_services/vnf_generic/vnf/vpe_vnf.py38
3 files changed, 27 insertions, 17 deletions
diff --git a/yardstick/network_services/pipeline.py b/yardstick/network_services/pipeline.py
index 7155480d4..4fbe7967f 100644
--- a/yardstick/network_services/pipeline.py
+++ b/yardstick/network_services/pipeline.py
@@ -22,7 +22,7 @@ from yardstick.common import utils
FIREWALL_ADD_DEFAULT = "p {0} firewall add default 1"
FIREWALL_ADD_PRIO = """\
-p {0} firewall add priority 1 ipv4 {1} 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0"""
+p {0} firewall add priority 1 ipv4 {1} 24 0.0.0.0 0 0 65535 0 65535 17 0xFF port 0"""
FLOW_ADD_QINQ_RULES = """\
p {0} flow add qinq 128 512 port 0 id 1
diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
index b2c5a98bc..673344f4e 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):
+ def _build_pipeline_kwargs(self, cfg_file=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
@@ -200,7 +200,7 @@ class DpdkVnfSetupEnvHelper(SetupEnvHelper):
hwlb = ' --hwlb %s' % worker_threads
self.pipeline_kwargs = {
- 'cfg_file': self.CFG_CONFIG,
+ 'cfg_file': cfg_file if cfg_file else self.CFG_CONFIG,
'script': self.CFG_SCRIPT,
'port_mask_hex': ports_mask_hex,
'tool_path': tool_path,
diff --git a/yardstick/network_services/vnf_generic/vnf/vpe_vnf.py b/yardstick/network_services/vnf_generic/vnf/vpe_vnf.py
index b7cf8b35e..642894e07 100644
--- a/yardstick/network_services/vnf_generic/vnf/vpe_vnf.py
+++ b/yardstick/network_services/vnf_generic/vnf/vpe_vnf.py
@@ -24,6 +24,7 @@ import posixpath
from six.moves import configparser, zip
+from yardstick.common import utils
from yardstick.common.process import check_if_process_failed
from yardstick.network_services.helpers.samplevnf_helper import PortPairs
from yardstick.network_services.pipeline import PipelineRules
@@ -236,11 +237,9 @@ class ConfigCreate(object):
if os.path.exists(vnf_cfg):
return open(vnf_cfg).read()
-
class VpeApproxSetupEnvHelper(DpdkVnfSetupEnvHelper):
APP_NAME = 'vPE_vnf'
- CFG_CONFIG = "/tmp/vpe_config"
CFG_SCRIPT = "/tmp/vpe_script"
TM_CONFIG = "/tmp/full_tm_profile_10G.cfg"
CORES = ['0', '1', '2', '3', '4', '5']
@@ -253,33 +252,44 @@ class VpeApproxSetupEnvHelper(DpdkVnfSetupEnvHelper):
self.all_ports = self._port_pairs.all_ports
def build_config(self):
+ vnf_cfg = self.scenario_helper.vnf_cfg
+ task_path = self.scenario_helper.task_path
+ 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')
vpe_vars = {
"bin_path": self.ssh_helper.bin_path,
"socket": self.socket,
}
-
self._build_vnf_ports()
vpe_conf = ConfigCreate(self.vnfd_helper, self.socket)
- vpe_conf.create_vpe_config(self.scenario_helper.vnf_cfg)
- config_basename = posixpath.basename(self.CFG_CONFIG)
+ config_basename = posixpath.basename(config_file)
script_basename = posixpath.basename(self.CFG_SCRIPT)
- tm_basename = posixpath.basename(self.TM_CONFIG)
- with open(self.CFG_CONFIG) as handle:
- vpe_config = handle.read()
- self.ssh_helper.upload_config_file(config_basename, vpe_config.format(**vpe_vars))
+ with utils.open_relative_file(action_bulk_file, task_path) as handle:
+ action_bulk = handle.read()
+
+ with utils.open_relative_file(full_tm_profile_file, task_path) as handle:
+ full_tm_profile = handle.read()
+ 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))
-
- tm_config = vpe_conf.generate_tm_cfg(self.scenario_helper.vnf_cfg)
- self.ssh_helper.upload_config_file(tm_basename, tm_config)
+ self.ssh_helper.upload_config_file(posixpath.basename(action_bulk_file),
+ action_bulk.format(**vpe_vars))
+ self.ssh_helper.upload_config_file(posixpath.basename(full_tm_profile_file),
+ full_tm_profile.format(**vpe_vars))
LOG.info("Provision and start the %s", self.APP_NAME)
- LOG.info(self.CFG_CONFIG)
+ LOG.info(config_file)
LOG.info(self.CFG_SCRIPT)
- self._build_pipeline_kwargs()
+ self._build_pipeline_kwargs(cfg_file='/tmp/' + config_basename)
return self.PIPELINE_COMMAND.format(**self.pipeline_kwargs)