From 92d0631ed6dd48d7c323c4bf76350be6e920176f Mon Sep 17 00:00:00 2001 From: DanielMartinBuckley Date: Wed, 19 Dec 2018 17:41:42 +0000 Subject: NSB support for [core x-y] NSB PROX NFVI configuration JIRA: YARDSTICK-1571 Cores in PROX support multiple configurations NSB supports today the more basic one, i.e. [core x] When one wants to use multiple cores sharing the same configuration, instead of copying the whole [core] section, PROX support the following syntax [core x-y] where x is the 1st core and y the last one or (for instance) [core x,y,z] NSB Now supports [core a,b,c,d] [core a-d] [core a,c-d] Change-Id: I34cd107143c89e16d58e7a99e1887ffbf720a5d1 Signed-off-by: Daniel Martin Buckley --- .../vnf_generic/vnf/prox_helpers.py | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'yardstick/network_services/vnf_generic/vnf/prox_helpers.py') diff --git a/yardstick/network_services/vnf_generic/vnf/prox_helpers.py b/yardstick/network_services/vnf_generic/vnf/prox_helpers.py index 5d980037a..cd3035ef8 100644 --- a/yardstick/network_services/vnf_generic/vnf/prox_helpers.py +++ b/yardstick/network_services/vnf_generic/vnf/prox_helpers.py @@ -870,6 +870,30 @@ class ProxDpdkVnfSetupEnvHelper(DpdkVnfSetupEnvHelper): file_str[1] = self.additional_files[base_name] return '"'.join(file_str) + def _make_core_list(self, inputStr): + + my_input = inputStr.split("core ", 1)[1] + ok_list = set() + + substrs = [x.strip() for x in my_input.split(',')] + for i in substrs: + try: + ok_list.add(int(i)) + + except ValueError: + try: + substr = [int(k.strip()) for k in i.split('-')] + if len(substr) > 1: + startstr = substr[0] + endstr = substr[len(substr) - 1] + for z in range(startstr, endstr + 1): + ok_list.add(z) + except ValueError: + LOG.error("Error in cores list ... resuming ") + return ok_list + + return ok_list + def generate_prox_config_file(self, config_path): sections = [] prox_config = ConfigParser(config_path, sections) @@ -889,6 +913,18 @@ class ProxDpdkVnfSetupEnvHelper(DpdkVnfSetupEnvHelper): if section_data[0] == "mac": section_data[1] = "hardware" + # adjust for range of cores + new_sections = [] + for section_name, section in sections: + if section_name.startswith('core') and section_name.find('$') == -1: + core_list = self._make_core_list(section_name) + for core in core_list: + new_sections.append(["core " + str(core), section]) + else: + new_sections.append([section_name, section]) + + sections = new_sections + # search for dst mac for _, section in sections: for section_data in section: -- cgit 1.2.3-korg