diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2017-09-19 01:07:15 -0700 |
---|---|---|
committer | Ross Brattain <ross.b.brattain@intel.com> | 2017-09-25 08:30:20 -0700 |
commit | 70c9e00bd597a60eab2da5d16f61edf61e21b0ef (patch) | |
tree | 336797021ed26d8f14030450bb90d7299d0f7a08 /yardstick/network_services | |
parent | f42ea3f21a50310f1ecfb9b82356f99e48fce025 (diff) |
prox: pass prox_config_dict between Processes using queue
we generate the prox_config_dict in the _run Process,
but we also need it in the _traffic_runner Process to
get core info.
use a queue to pass the config list between the processes
enable collect_kpi
Change-Id: Ibaf41d606e559a87addf43d6ddaed206dbd2d20c
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Edward MacGillivray <edward.s.macgillivray@intel.com>
Diffstat (limited to 'yardstick/network_services')
3 files changed, 25 insertions, 19 deletions
diff --git a/yardstick/network_services/traffic_profile/prox_profile.py b/yardstick/network_services/traffic_profile/prox_profile.py index daeaf42ed..0a9de9bb6 100644 --- a/yardstick/network_services/traffic_profile/prox_profile.py +++ b/yardstick/network_services/traffic_profile/prox_profile.py @@ -88,7 +88,7 @@ class ProxProfile(TrafficProfile): def run_test_with_pkt_size(self, traffic_generator, pkt_size, duration): raise NotImplementedError - def execute(self, traffic_generator): + def execute_traffic(self, traffic_generator): try: pkt_size = next(self.pkt_size_iterator) except StopIteration: diff --git a/yardstick/network_services/vnf_generic/vnf/prox_helpers.py b/yardstick/network_services/vnf_generic/vnf/prox_helpers.py index 00ab6c24c..30524a192 100644 --- a/yardstick/network_services/vnf_generic/vnf/prox_helpers.py +++ b/yardstick/network_services/vnf_generic/vnf/prox_helpers.py @@ -28,6 +28,7 @@ from contextlib import contextmanager from itertools import repeat, chain import six +from multiprocessing import Queue from six.moves import zip, StringIO from six.moves import cStringIO @@ -597,8 +598,9 @@ class ProxDpdkVnfSetupEnvHelper(DpdkVnfSetupEnvHelper): self.remote_path = None super(ProxDpdkVnfSetupEnvHelper, self).__init__(vnfd_helper, ssh_helper, scenario_helper) self.remote_prox_file_name = None - self.prox_config_dict = None + self._prox_config_data = None self.additional_files = {} + self.config_queue = Queue() def _build_pipeline_kwargs(self): tool_path = self.ssh_helper.provision_tool(tool_file=self.APP_NAME) @@ -758,6 +760,15 @@ class ProxDpdkVnfSetupEnvHelper(DpdkVnfSetupEnvHelper): return remote_path + CONFIG_QUEUE_TIMEOUT = 120 + + @property + def prox_config_data(self): + if self._prox_config_data is None: + # this will block, but it needs too + self._prox_config_data = self.config_queue.get(True, self.CONFIG_QUEUE_TIMEOUT) + return self._prox_config_data + def build_config_file(self): task_path = self.scenario_helper.task_path options = self.scenario_helper.options @@ -774,10 +785,13 @@ class ProxDpdkVnfSetupEnvHelper(DpdkVnfSetupEnvHelper): remote_prox_file = self.copy_to_target(key_prox_file, base_prox_file) self.additional_files[base_prox_file] = remote_prox_file - self.prox_config_dict = self.generate_prox_config_file(config_path) - self.remote_path = self.upload_prox_config(config_file, self.prox_config_dict) + self._prox_config_data = self.generate_prox_config_file(config_path) + # copy config to queue so we can read it from traffic_runner process + self.config_queue.put(self._prox_config_data) + self.remote_path = self.upload_prox_config(config_file, self._prox_config_data) def build_config(self): + self.build_config_file() options = self.scenario_helper.options @@ -793,6 +807,7 @@ class ProxDpdkVnfSetupEnvHelper(DpdkVnfSetupEnvHelper): return prox_cmd +# this might be bad, sometimes we want regular ResourceHelper methods, like collect_kpi class ProxResourceHelper(ClientResourceHelper): RESOURCE_WORD = 'prox' @@ -891,8 +906,9 @@ class ProxResourceHelper(ClientResourceHelper): LOG.debug("tg_prox done") self._terminated.value = 1 - def start_collect(self): - pass + # use ResourceHelper method to collect KPIs directly. + def collect_kpi(self): + return self._collect_resource_kpi() def terminate(self): # should not be called, use VNF terminate @@ -966,7 +982,7 @@ class ProxResourceHelper(ClientResourceHelper): def get_test_type(self): test_type = None - for section_name, section in self.setup_helper.prox_config_dict: + for section_name, section in self.setup_helper.prox_config_data: if section_name != "global": continue @@ -979,7 +995,7 @@ class ProxResourceHelper(ClientResourceHelper): def get_cores(self, mode): cores = [] - for section_name, section in self.setup_helper.prox_config_dict: + for section_name, section in self.setup_helper.prox_config_data: if not section_name.startswith("core"): continue @@ -994,7 +1010,7 @@ class ProxResourceHelper(ClientResourceHelper): def get_cores_mpls(self, mode=PROX_CORE_GEN_MODE): cores_tagged = [] cores_plain = [] - for section_name, section in self.setup_helper.prox_config_dict: + for section_name, section in self.setup_helper.prox_config_data: if not section_name.startswith("core"): continue @@ -1023,9 +1039,6 @@ class ProxResourceHelper(ClientResourceHelper): return self.sut.lat_stats(self._latency_cores) return [] - def _get_logical_if_name(self, vpci): - return self._vpci_to_if_name_map[vpci] - def _connect(self, client=None): """Run and connect to prox on the remote system """ # De-allocating a large amount of hugepages takes some time. If a new diff --git a/yardstick/network_services/vnf_generic/vnf/prox_vnf.py b/yardstick/network_services/vnf_generic/vnf/prox_vnf.py index bef7c5a33..e87d452b4 100644 --- a/yardstick/network_services/vnf_generic/vnf/prox_vnf.py +++ b/yardstick/network_services/vnf_generic/vnf/prox_vnf.py @@ -102,10 +102,3 @@ class ProxApproxVnf(SampleVNF): self.setup_helper.kill_vnf() self._tear_down() self.resource_helper.stop_collect() - - def instantiate(self, scenario_cfg, context_cfg): - # build config in parent process so we can access - # config from TG subprocesses - self.scenario_helper.scenario_cfg = scenario_cfg - self.setup_helper.build_config_file() - super(ProxApproxVnf, self).instantiate(scenario_cfg, context_cfg) |