From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id DA4A5B58D for ; Mon, 16 Feb 2015 04:08:00 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 15 Feb 2015 19:02:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,584,1418112000"; d="scan'208";a="527983201" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 15 Feb 2015 18:59:29 -0800 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t1G37stw022956; Mon, 16 Feb 2015 11:07:54 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t1G37qLb001316; Mon, 16 Feb 2015 11:07:54 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t1G37q8W001312; Mon, 16 Feb 2015 11:07:52 +0800 From: Yong Liu To: dts@dpdk.org Date: Mon, 16 Feb 2015 11:07:44 +0800 Message-Id: <1424056068-1156-2-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1424056068-1156-1-git-send-email-yong.liu@intel.com> References: <1423728550-14792-1-git-send-email-yong.liu@intel.com> <1424056068-1156-1-git-send-email-yong.liu@intel.com> Subject: [dts] [PATCH V3 1/5] framework: remove useless nic list, replaced by port configuration file X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Feb 2015 03:08:01 -0000 DTS used to support different types of nic by parameter nic_type. But in the process of running, DTS only take first four ports for validation. This may be cause confusion. Removed these logic for multi nic will be supported by port configuration file. In execution.cfg will only parse the first nic_type now. Fix bug that port act as tester should not be in dut port list. Signed-off-by: Marvinliu diff --git a/framework/dts.py b/framework/dts.py index f05024f..1c7a43e 100644 --- a/framework/dts.py +++ b/framework/dts.py @@ -64,7 +64,7 @@ results_table_rows = [] results_table_header = [] performance_only = False functional_only = False -nics = None +nic = None requested_tests = None dut = None tester = None @@ -151,13 +151,12 @@ def accepted_nic(pci_id): if pci_id not in NICS.values(): return False - if 'any' in nics: + if nic is 'any': return True else: - for selected_nic in nics: - if pci_id == NICS[selected_nic]: - return True + if pci_id == NICS[nic]: + return True return False @@ -211,9 +210,9 @@ def dts_parse_config(section): if suite == '': test_suites.remove(suite) - nics = [_.strip() for _ in paramDict['nic_type'].split(',')] + nic = [_.strip() for _ in paramDict['nic_type'].split(',')][0] - return duts[0], targets, test_suites, nics + return duts[0], targets, test_suites, nic def get_project_obj(project_name, super_class, crbInst, serializer): @@ -267,7 +266,7 @@ def dts_log_execution(log_handler): pass -def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nics): +def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nic): """ Create dts dut/tester instance and initialize them. """ @@ -282,7 +281,7 @@ def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nics): tester.dut = dut dut.set_speedup_options(read_cache, skip_setup) dut.set_directory(base_dir) - dut.set_nic_types(nics) + dut.set_nic_type(nic) tester.set_speedup_options(read_cache, skip_setup) show_speedup_options_messages(read_cache, skip_setup) dut.set_test_types(func_tests=functional_only, perf_tests=performance_only) @@ -315,7 +314,7 @@ def dts_run_prerequisties(pkgName, patch): return False -def dts_run_target(crbInst, targets, test_suites, nics): +def dts_run_target(crbInst, targets, test_suites, nic): """ Run each target in execution targets. """ @@ -336,8 +335,7 @@ def dts_run_target(crbInst, targets, test_suites, nics): if 'nic_type' not in paramDict: paramDict['nic_type'] = 'any' - nics = ['any'] - nic = nics[0] + nic = 'any' result.nic = nic dts_run_suite(crbInst, test_suites, target, nic) @@ -394,7 +392,7 @@ def run_all(config_file, pkgName, git, patch, skip_setup, global config global serializer - global nics + global nic global requested_tests global result global excel_report diff --git a/framework/dut.py b/framework/dut.py index 267e7f1..e11414f 100644 --- a/framework/dut.py +++ b/framework/dut.py @@ -82,12 +82,12 @@ class Dut(Crb): self.send_expect("sed -i 's/%s=.*$/%s=%s/' config/defconfig_%s" % (parameter, parameter, value, target), "# ") - def set_nic_types(self, nics): + def set_nic_type(self, nic): """ Set CRB NICS ready to validated. """ - self.nics = nics - if 'cfg' in nics: + self.nic = nic + if 'cfg' in nic: self.conf.load_ports_config(self.get_ip_address()) def set_toolchain(self, target): @@ -167,6 +167,8 @@ class Dut(Crb): self.mount_procfs() # auto detect network topology self.map_available_ports() + # print latest ports_info + self.logger.info(dts.pprint(self.ports_info)) if self.ports_map is None or len(self.ports_map) == 0: raise ValueError("ports_map should not be empty, please check all links") @@ -305,7 +307,6 @@ class Dut(Crb): Return DUT port list with the filter of NIC type, whether run IXIA performance test, whether request specified socket. """ - ports = [] candidates = [] @@ -313,33 +314,28 @@ class Dut(Crb): perf = self.want_perf_tests nictypes = [] - if nic_type == 'any' and perf: + if nic_type == 'any': + for portid in range(len(self.ports_info)): + ports.append(portid) return ports - - for nic in NICS.keys(): - if ('any' == nic_type) or (nic_type in nic): - nictypes.append(nic) - - for portid in range(len(self.ports_info)): - for nictype in nictypes: - - if self.ports_info[portid]['type'] == NICS[nictype]: + elif nic_type == 'cfg': + for portid in range(len(self.ports_info)): + if self.ports_info[portid]['source'] == 'cfg': + ports.append(portid) + return ports + else: + for portid in range(len(self.ports_info)): + port_info = self.ports_info[portid] + # match nic type + if port_info['type'] == NICS[nic_type]: + # match numa or none numa awareness if (socket is None or - self.ports_info[portid]['numa'] == -1 or - socket == self.ports_info[portid]['numa']): - - if (self.ports_info[portid]['ipv6'] != "Not connected" and + port_info['numa'] == -1 or + socket == port_info['numa']): + # port has link + if (port_info['ipv6'] != "Not connected" and self.tester.get_local_port(portid) != -1): - if perf and self.tester.get_local_port_type(portid) != "ixia": - candidates.append(portid) - continue - elif False == perf and self.tester.get_local_port_type(portid) == "ixia": - continue ports.append(portid) - - if perf and not self.tester.has_external_traffic_generator(): - return candidates - else: return ports def get_ports_performance(self, nic_type='any', perf=None, socket=None, @@ -410,6 +406,14 @@ class Dut(Crb): return self.ports_info[port_num]['numa'] + def get_port_info(self, pci): + """ + return port info by pci id + """ + for port_info in self.ports_info: + if port_info['pci'] == pci: + return port_info + def lcore_table_print(self, horizontal=False): if not horizontal: dts.results_table_add_header(['Socket', 'Core', 'Thread']) @@ -436,20 +440,17 @@ class Dut(Crb): Check that whether auto scanned ports ready to use """ pci_addr = "%s:%s" % (pci_bus, pci_id) - codenames = [] - for nic in self.nics: - if nic == 'any': - return True - elif nic == 'cfg': - if self.conf.check_port_available(pci_bus) is True: - return True - elif nic not in NICS.keys(): - self.logger.warning("NOT SUPPORTED NIC TYPE: %s" % nic) - else: - codenames.append(NICS[nic]) - - if pci_id in codenames: + if self.nic == 'any': return True + elif self.nic == 'cfg': + if self.conf.check_port_available(pci_bus) is True: + return True + elif self.nic not in NICS.keys(): + self.logger.warning("NOT SUPPORTED NIC TYPE: %s" % self.nic) + else: + codename = NICS[self.nic] + if pci_id == codename: + return True return False @@ -491,8 +492,6 @@ class Dut(Crb): self.scan_ports_uncached() self.serializer.save(self.PORT_INFO_CACHE_KEY, self.ports_info) - self.logger.info(dts.pprint(self.ports_info)) - def scan_ports_uncached(self): """ Scan ports and collect port's pci id, mac adress, ipv6 address. @@ -578,10 +577,10 @@ class Dut(Crb): else: port_cfg = {} - for key in ['intf', 'mac', 'numa', 'peer']: + for key in ['intf', 'mac', 'numa', 'peer', 'source']: if key in port_cfg: if key in port and port_cfg[key] != port[key]: - self.logger.warning("CONGGURED %s NOT SAME AS SCANNED!!!" % (key.upper())) + self.logger.warning("CONFIGURED %s NOT SAME AS SCANNED!!!" % (key.upper())) port[key] = port_cfg[key] def map_available_ports(self): @@ -594,17 +593,18 @@ class Dut(Crb): if not self.read_cache or self.ports_map is None: self.map_available_ports_uncached() self.serializer.save(self.PORT_MAP_CACHE_KEY, self.ports_map) - self.logger.warning("DUT PORT MAP: " + str(self.ports_map)) + + self.logger.warning("DUT PORT MAP: " + str(self.ports_map)) def map_available_ports_uncached(self): """ Generate network connection mapping list. """ - nrPorts = len(self.ports_info) if nrPorts == 0: return + remove = [] self.ports_map = [-1] * nrPorts hits = [False] * len(self.tester.ports_info) @@ -632,6 +632,7 @@ class Dut(Crb): if (self.crb['IP'] == self.crb['tester IP']) and (dutpci == remotepci): continue + # skip ping those not connected port ipv6 = self.get_ipv6_address(dutPort) if ipv6 == "Not connected": continue @@ -640,6 +641,18 @@ class Dut(Crb): if ('64 bytes from' in out): self.logger.info("PORT MAP: [dut %d: tester %d]" % (dutPort, remotePort)) - hits[remotePort] = True self.ports_map[dutPort] = remotePort + hits[remotePort] = True + if self.crb['IP'] == self.crb['tester IP']: + # remove dut port act as tester port + remove_port = self.get_port_info(remotepci) + if remove_port is not None: + remove.append(remove_port) + # skip ping from those port already act as dut port + testerPort = self.tester.get_local_index(dutpci) + if testerPort != -1: + hits[testerPort] = True break + + for port in remove: + self.ports_info.remove(port) -- 1.9.3