From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E293CA04F1; Mon, 13 Jan 2020 08:38:57 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6CD911D625; Mon, 13 Jan 2020 08:38:57 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id D20471D61B for ; Mon, 13 Jan 2020 08:38:55 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jan 2020 23:38:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,428,1571727600"; d="scan'208";a="397082434" Received: from unknown (HELO dpdk-xinfengx-dut.sh.intel.com) ([10.67.117.16]) by orsmga005.jf.intel.com with ESMTP; 12 Jan 2020 23:38:54 -0800 From: xinfengx To: dts@dpdk.org Cc: xinfengx Date: Mon, 13 Jan 2020 06:18:30 +0800 Message-Id: <20200112221831.12192-5-xinfengx.zhao@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200112221831.12192-1-xinfengx.zhao@intel.com> References: <20200112221831.12192-1-xinfengx.zhao@intel.com> Subject: [dts] [next][PATCH V1 4/5] nics: modify dts nics to support python3 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: , Errors-To: dts-bounces@dpdk.org Sender: "dts" Signed-off-by: xinfengx --- nics/atwood.py | 6 +++--- nics/br.py | 20 ++++++++++---------- nics/net_device.py | 14 +++++++------- nics/perf_report.py | 6 +++--- nics/rrc.py | 20 ++++++++++---------- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/nics/atwood.py b/nics/atwood.py index e1491c7..cf7a551 100644 --- a/nics/atwood.py +++ b/nics/atwood.py @@ -96,16 +96,16 @@ class Atwood(NetDevice): port_cfg = portconf.get_ports_config()[pci_addr] - if 'tp_ip' not in port_cfg.keys(): + if 'tp_ip' not in list(port_cfg.keys()): raise PortConfigParseException("Atwood must configure test point ip") - if 'passwd' not in port_cfg.keys(): + if 'passwd' not in list(port_cfg.keys()): raise PortConfigParseException("Atwood must configure host password") crb = {} crb['IP'] = port_cfg['tp_ip'] crb['pass'] = port_cfg['passwd'] - if 'tp_path' in port_cfg.keys(): + if 'tp_path' in list(port_cfg.keys()): self.tp_path = port_cfg['tp_path'] # create additional session diff --git a/nics/br.py b/nics/br.py index d95a5f9..88125e5 100644 --- a/nics/br.py +++ b/nics/br.py @@ -116,9 +116,9 @@ class BoulderRapid(NetDevice): port_cfg = portconf.get_ports_config()[pci_addr] # secondary port do not need reinitialize - if 'sec_port' in port_cfg.keys(): - print GREEN("Skip init second port test point session") - if 'first_port' not in port_cfg.keys(): + if 'sec_port' in list(port_cfg.keys()): + print(GREEN("Skip init second port test point session")) + if 'first_port' not in list(port_cfg.keys()): raise PortConfigParseException("BoulderRapid second port must configure first port") # find net_device by pci_addr first_addr = port_cfg['first_port'] @@ -132,16 +132,16 @@ class BoulderRapid(NetDevice): return - if 'tp_ip' not in port_cfg.keys(): + if 'tp_ip' not in list(port_cfg.keys()): raise PortConfigParseException("BoulderRapid must configure test point ip") - if 'passwd' not in port_cfg.keys(): + if 'passwd' not in list(port_cfg.keys()): raise PortConfigParseException("BoulderRapid must configure host password") crb = {} crb['IP'] = port_cfg['tp_ip'] crb['pass'] = port_cfg['passwd'] - if 'tp_path' in port_cfg.keys(): + if 'tp_path' in list(port_cfg.keys()): self.tp_path = port_cfg['tp_path'] # create additional session @@ -187,7 +187,7 @@ class BoulderRapid(NetDevice): Before any execution, must enable test point first """ if self.sec_port: - print GREEN("Skip start second port testpoint") + print(GREEN("Skip start second port testpoint")) return self.ctrl_crb.send_expect("cd %s" % self.tp_path, "# ") @@ -251,7 +251,7 @@ class BoulderRapid(NetDevice): s = re.compile(pattern) res = s.search(dmac) if res is None: - print RED("search none mac filter") + print(RED("search none mac filter")) return None else: mac_filter = res.group(2) @@ -259,7 +259,7 @@ class BoulderRapid(NetDevice): s = re.compile(pattern) res = s.search(out) if res is None: - print RED("search none port value") + print(RED("search none port value")) return None else: port_value = res.group(2) @@ -268,7 +268,7 @@ class BoulderRapid(NetDevice): s = re.compile(pattern) res = s.search(out) if res is None: - print RED("search none port glort id") + print(RED("search none port glort id")) return None else: port_glortid = res.group(1) diff --git a/nics/net_device.py b/nics/net_device.py index a85f9ce..c7d4c00 100644 --- a/nics/net_device.py +++ b/nics/net_device.py @@ -240,7 +240,7 @@ class NetDevice(object): Set mac address of specified vf device on linux. """ if self.current_driver != self.default_driver: - print "Only support when PF bound to default driver" + print("Only support when PF bound to default driver") return self.__send_expect("ip link set %s vf %d mac %s" % (intf, vf_idx, mac), "# ") @@ -620,7 +620,7 @@ class NetDevice(object): vf_uevent).group(1) sriov_vfs_pci.append(vf_pci) except Exception as e: - print "Scan linux port [%s:%s.%s] sriov vf failed: %s" % (domain_id, bus_id, devfun_id, e) + print("Scan linux port [%s:%s.%s] sriov vf failed: %s" % (domain_id, bus_id, devfun_id, e)) return sriov_vfs_pci @@ -720,13 +720,13 @@ class NetDevice(object): bind_vf_driver = getattr(self, 'bind_driver_%s' % self.__get_os_type()) if not driver: if not self.default_vf_driver: - print "Must specify a driver because default VF driver is NULL!" + print("Must specify a driver because default VF driver is NULL!") return driver = self.default_vf_driver if not pci: if not self.sriov_vfs_pci: - print "No VFs on the nic [%s]!" % self.pci + print("No VFs on the nic [%s]!" % self.pci) return for vf_pci in self.sriov_vfs_pci: addr_array = vf_pci.split(':') @@ -750,7 +750,7 @@ class NetDevice(object): bind_driver = getattr(self, 'bind_driver_%s' % self.__get_os_type()) if not driver: if not self.default_driver: - print "Must specify a driver because default driver is NULL!" + print("Must specify a driver because default driver is NULL!") return driver = self.default_driver ret = bind_driver(self.domain_id, self.bus_id, self.devfun_id, driver) @@ -849,10 +849,10 @@ class NetDevice(object): def enable_jumbo(self, framesize=0): if self.intf_name == "N/A": - print RED("Enable jumbo must based on kernel interface!!!") + print(RED("Enable jumbo must based on kernel interface!!!")) return if framesize < MIN_MTU: - print RED("Enable jumbo must over %d !!!" % MIN_MTU) + print(RED("Enable jumbo must over %d !!!" % MIN_MTU)) return mtu = self._cal_mtu(framesize) diff --git a/nics/perf_report.py b/nics/perf_report.py index e833d6c..b80067b 100644 --- a/nics/perf_report.py +++ b/nics/perf_report.py @@ -101,9 +101,9 @@ def send_email(sender, mailto, message, smtp_server): smtp = smtplib.SMTP(smtp_server) smtp.sendmail(sender, mailto, message.as_string()) smtp.quit() - print utils.GREEN("Email sent successfully.") - except Exception, e: - print utils.RED("Failed to send email " + str(e)) + print(utils.GREEN("Email sent successfully.")) + except Exception as e: + print(utils.RED("Failed to send email " + str(e))) def send_html_report(sender, mailto, subject, html_msg, smtp_server): diff --git a/nics/rrc.py b/nics/rrc.py index 099a6b1..d019885 100644 --- a/nics/rrc.py +++ b/nics/rrc.py @@ -117,9 +117,9 @@ class RedRockCanyou(NetDevice): port_cfg = portconf.get_ports_config()[pci_addr] # secondary port do not need reinitialize - if 'sec_port' in port_cfg.keys(): - print GREEN("Skip init second port test point session") - if 'first_port' not in port_cfg.keys(): + if 'sec_port' in list(port_cfg.keys()): + print(GREEN("Skip init second port test point session")) + if 'first_port' not in list(port_cfg.keys()): raise PortConfigParseException("RRC second port must configure first port") # find net_device by pci_addr first_addr = port_cfg['first_port'] @@ -132,17 +132,17 @@ class RedRockCanyou(NetDevice): self.sec_port = True return - if 'tp_ip' not in port_cfg.keys(): + if 'tp_ip' not in list(port_cfg.keys()): raise PortConfigParseException("RRC must configure test point ip") crb = {} crb['IP'] = port_cfg['tp_ip'] - if 'passwd' not in port_cfg.keys(): + if 'passwd' not in list(port_cfg.keys()): crb['pass'] = DEF_PASSWD else: crb['pass'] = port_cfg['passwd'] - if 'tp_path' in port_cfg.keys(): + if 'tp_path' in list(port_cfg.keys()): self.tp_path = port_cfg['tp_path'] # create additional session @@ -188,7 +188,7 @@ class RedRockCanyou(NetDevice): Before any execution, must enable test point first """ if self.sec_port: - print GREEN("Skip start second port testpoint") + print(GREEN("Skip start second port testpoint")) return self.ctrl_crb.send_expect("cd %s" % self.tp_path, "# ") if self.tp_path != "~": @@ -247,7 +247,7 @@ class RedRockCanyou(NetDevice): s = re.compile(pattern) res = s.search(dmac) if res is None: - print "search none mac filter" + print("search none mac filter") return None else: mac_filter = res.group(2) @@ -255,7 +255,7 @@ class RedRockCanyou(NetDevice): s = re.compile(pattern) res = s.search(out) if res is None: - print "search none port value" + print("search none port value") return None else: port_value = res.group(2) @@ -264,7 +264,7 @@ class RedRockCanyou(NetDevice): s = re.compile(pattern) res = s.search(out) if res is None: - print "search none port glort id" + print("search none port glort id") return None else: port_glortid = res.group(1) -- 2.17.1