test suite reviews and discussions
 help / color / mirror / Atom feed
From: xinfengx <xinfengx.zhao@intel.com>
To: dts@dpdk.org
Cc: xinfengx <xinfengx.zhao@intel.com>
Subject: [dts] [next][PATCH V1 4/5] nics: modify dts nics to support python3
Date: Mon, 13 Jan 2020 06:18:30 +0800	[thread overview]
Message-ID: <20200112221831.12192-5-xinfengx.zhao@intel.com> (raw)
In-Reply-To: <20200112221831.12192-1-xinfengx.zhao@intel.com>

Signed-off-by: xinfengx <xinfengx.zhao@intel.com>
---
 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


  parent reply	other threads:[~2020-01-13  7:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-12 22:18 [dts] [next][PATCH V1 0/5] dts: modify dts " xinfengx
2020-01-12 22:18 ` [dts] [next][PATCH V1 1/5] framework: modify dts framework " xinfengx
2020-01-12 22:18 ` [dts] [next][PATCH V1 2/5] tests: modify test suites " xinfengx
2020-01-12 22:18 ` [dts] [next][PATCH V1 3/5] dep: modify dts dep " xinfengx
2020-01-12 22:18 ` xinfengx [this message]
2020-01-12 22:18 ` [dts] [next][PATCH V1 5/5] tools: modify dts tools " xinfengx
2020-01-16  5:47 ` [dts] [next][PATCH V1 0/5] dts: modify dts " Tu, Lijuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200112221831.12192-5-xinfengx.zhao@intel.com \
    --to=xinfengx.zhao@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).