diff options
author | 2018-02-10 20:30:06 +0200 | |
---|---|---|
committer | 2018-03-01 14:14:41 +0000 | |
commit | c66c157da4a31248c39fda2b4d70d86ac159637c (patch) | |
tree | ac0bf10a3c990765a832f9bdb02a53f7ecd2a396 /yardstick/benchmark/scenarios/networking/vnf_generic.py | |
parent | 94f67c7535eaac09137f8639f8d9039c036b9ceb (diff) |
vFW scale-up template.
Added topology and traffic profile templates
Added support for using JinJa2 templates in topology definition
Added support for static pipeline configs for SampleVNFs
JIRA: YARDSTICK-1043
Change-Id: Iab99fd5b5ad69ca32ee70b9fe47779387ad27e7f
Signed-off-by: Chornyi, TarasX <tarasx.chornyi@intel.com>
Signed-off-by: Mytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>
Diffstat (limited to 'yardstick/benchmark/scenarios/networking/vnf_generic.py')
-rw-r--r-- | yardstick/benchmark/scenarios/networking/vnf_generic.py | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/yardstick/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py index c43dabfd4..45c151b59 100644 --- a/yardstick/benchmark/scenarios/networking/vnf_generic.py +++ b/yardstick/benchmark/scenarios/networking/vnf_generic.py @@ -28,7 +28,6 @@ from yardstick.benchmark.scenarios import base as scenario_base from yardstick.common.constants import LOG_DIR from yardstick.common.process import terminate_children from yardstick.common import utils -from yardstick.common.yaml_loader import yaml_load from yardstick.network_services.collector.subscriber import Collector from yardstick.network_services.vnf_generic import vnfdgen from yardstick.network_services.vnf_generic.vnf.base import GenericVNF @@ -100,12 +99,7 @@ class NetworkServiceTestCase(scenario_base.Scenario): self.scenario_cfg = scenario_cfg self.context_cfg = context_cfg - # fixme: create schema to validate all fields have been provided - with utils.open_relative_file(scenario_cfg["topology"], - scenario_cfg['task_path']) as stream: - topology_yaml = yaml_load(stream) - - self.topology = topology_yaml["nsd:nsd-catalog"]["nsd"][0] + self._render_topology() self.vnfs = [] self.collector = None self.traffic_profile = None @@ -184,6 +178,12 @@ class NetworkServiceTestCase(scenario_base.Scenario): with utils.open_relative_file(profile, path) as infile: return infile.read() + def _get_topology(self): + topology = self.scenario_cfg["topology"] + path = self.scenario_cfg["task_path"] + with utils.open_relative_file(topology, path) as infile: + return infile.read() + def _fill_traffic_profile(self): tprofile = self._get_traffic_profile() extra_args = self.scenario_cfg.get('extra_args', {}) @@ -198,6 +198,15 @@ class NetworkServiceTestCase(scenario_base.Scenario): traffic_vnfd = vnfdgen.generate_vnfd(tprofile, tprofile_data) self.traffic_profile = tprofile_base.TrafficProfile.get(traffic_vnfd) + def _render_topology(self): + topology = self._get_topology() + topology_args = self.scenario_cfg.get('extra_args', {}) + topolgy_data = { + 'extra_args': topology_args + } + topology_yaml = vnfdgen.generate_vnfd(topology, topolgy_data) + self.topology = topology_yaml["nsd:nsd-catalog"]["nsd"][0] + def _find_vnf_name_from_id(self, vnf_id): return next((vnfd["vnfd-id-ref"] for vnfd in self.topology["constituent-vnfd"] |