test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V1] framework/test_case: removed bind_nic_driver common func to framework
@ 2021-11-17  9:26 DongJunX
  2021-11-22 15:15 ` Tu, Lijuan
  0 siblings, 1 reply; 2+ messages in thread
From: DongJunX @ 2021-11-17  9:26 UTC (permalink / raw)
  To: dts; +Cc: PingX.Yu, weix.ling, junx.dong

Signed-off-by: DongJunX <junx.dong@intel.com>
---
 framework/test_case.py                       |  7 ++++++
 tests/TestSuite_ddp_gtp.py                   | 18 +-------------
 tests/TestSuite_ddp_mpls.py                  | 18 --------------
 tests/TestSuite_iavf.py                      | 24 -------------------
 tests/TestSuite_kernelpf_iavf.py             | 25 --------------------
 tests/TestSuite_port_control.py              | 25 --------------------
 tests/TestSuite_shutdown_api.py              | 15 ------------
 tests/TestSuite_vf_daemon.py                 | 17 -------------
 tests/TestSuite_vf_jumboframe.py             | 25 --------------------
 tests/TestSuite_vf_vlan.py                   | 25 --------------------
 tests/TestSuite_vhost_cbdma.py               |  9 -------
 tests/TestSuite_vhost_event_idx_interrupt.py |  9 -------
 tests/TestSuite_vm2vm_virtio_net_perf.py     | 16 -------------
 tests/TestSuite_vm2vm_virtio_pmd.py          |  9 -------
 tests/TestSuite_vm2vm_virtio_user.py         | 16 -------------
 15 files changed, 8 insertions(+), 250 deletions(-)

diff --git a/framework/test_case.py b/framework/test_case.py
index af4683da..6fa14583 100644
--- a/framework/test_case.py
+++ b/framework/test_case.py
@@ -533,6 +533,13 @@ class TestCase(object):
 
         return bitrate * num_ports / 8 / (frame_size + 20)
 
+    def bind_nic_driver(self, ports, driver=""):
+        for port in ports:
+            netdev = self.dut.ports_info[port]['port']
+            driver_now = netdev.get_nic_driver()
+            driver_new = driver if driver else netdev.default_driver
+            if driver_new != driver_now:
+                netdev.bind_driver(driver=driver_new)
 
 def skip_unsupported_pkg(pkgs):
     """
diff --git a/tests/TestSuite_ddp_gtp.py b/tests/TestSuite_ddp_gtp.py
index f2037e91..c86b07b3 100644
--- a/tests/TestSuite_ddp_gtp.py
+++ b/tests/TestSuite_ddp_gtp.py
@@ -125,26 +125,10 @@ class TestDdpGtp(TestCase):
         else:
             if Q_strip is self.VF_Q_strip:
                 queue = res.group(1)
-            else :
+            else:
                 queue = res.group(2)
             return int(queue)
 
-    def bind_nic_driver(self, ports, driver=""):
-        if driver == "igb_uio":
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver = netdev.get_nic_driver()
-                if driver != 'igb_uio':
-                    netdev.bind_driver(driver='igb_uio')
-        else:
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver_now = netdev.get_nic_driver()
-                if driver == "":
-                    driver = netdev.default_driver
-                if driver != driver_now:
-                    netdev.bind_driver(driver=driver)
-
     def setup_vm_env(self, driver='igb_uio'):
         """
         Create testing environment with VF generated from 1PF
diff --git a/tests/TestSuite_ddp_mpls.py b/tests/TestSuite_ddp_mpls.py
index c0fabe8b..12d04573 100644
--- a/tests/TestSuite_ddp_mpls.py
+++ b/tests/TestSuite_ddp_mpls.py
@@ -72,24 +72,6 @@ class Testddp_mpls(TestCase):
     def set_up(self):
         self.setup_vm_env()
 
-
-    def bind_nic_driver(self, ports, driver=""):
-        if driver == "igb_uio":
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver = netdev.get_nic_driver()
-                if driver != 'igb_uio':
-                    netdev.bind_driver(driver='igb_uio')
-        else:
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver_now = netdev.get_nic_driver()
-                if driver == "":
-                    driver = netdev.default_driver
-                if driver != driver_now:
-                    netdev.bind_driver(driver=driver)
-
-
     def setup_vm_env(self, driver='default'):
         """
         Create testing environment with VF generated from 1PF
diff --git a/tests/TestSuite_iavf.py b/tests/TestSuite_iavf.py
index 01942b5e..9ff8aba6 100644
--- a/tests/TestSuite_iavf.py
+++ b/tests/TestSuite_iavf.py
@@ -150,30 +150,6 @@ class TestIavf(TestCase):
         self.vm0_testpmd = PmdOutput(self.vm_dut_0)
         self.env_done = True
 
-    def bind_nic_driver(self, ports, driver=""):
-        # modprobe vfio driver
-        if driver == "vfio-pci":
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver = netdev.get_nic_driver()
-                if driver != 'vfio-pci':
-                    netdev.bind_driver(driver='vfio-pci')
-        elif driver == "igb_uio":
-            # igb_uio should insmod as default, no need to check
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver = netdev.get_nic_driver()
-                if driver != 'igb_uio':
-                    netdev.bind_driver(driver='igb_uio')
-        else:
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver_now = netdev.get_nic_driver()
-                if driver == "":
-                    driver = netdev.default_driver
-                if driver != driver_now:
-                    netdev.bind_driver(driver=driver)
-
     def destroy_vm_env(self):
         if getattr(self, 'vm0', None):
             if getattr(self, 'vm_dut_0', None):
diff --git a/tests/TestSuite_kernelpf_iavf.py b/tests/TestSuite_kernelpf_iavf.py
index 540a4e98..3d320f12 100644
--- a/tests/TestSuite_kernelpf_iavf.py
+++ b/tests/TestSuite_kernelpf_iavf.py
@@ -114,31 +114,6 @@ class TestKernelpfIavf(TestCase):
         elif self.env_done is False:
             self.setup_vm_env()
 
-    def bind_nic_driver(self, ports, driver=""):
-        # modprobe vfio driver
-        if driver == "vfio-pci":
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver = netdev.get_nic_driver()
-                if driver != 'vfio-pci':
-                    netdev.bind_driver(driver='vfio-pci')
-
-        elif driver == "igb_uio":
-            # igb_uio should insmod as default, no need to check
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver = netdev.get_nic_driver()
-                if driver != 'igb_uio':
-                    netdev.bind_driver(driver='igb_uio')
-        else:
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver_now = netdev.get_nic_driver()
-                if driver is None:
-                    driver = netdev.default_driver
-                if driver != driver_now:
-                    netdev.bind_driver(driver=driver)
-
     def setup_vm_env(self, driver='default', set_vf_mac=True):
         """
         Create testing environment with 1VF generated from 1PF
diff --git a/tests/TestSuite_port_control.py b/tests/TestSuite_port_control.py
index 299714e1..d5f26ff0 100755
--- a/tests/TestSuite_port_control.py
+++ b/tests/TestSuite_port_control.py
@@ -125,31 +125,6 @@ class TestPortControl(TestCase):
 
         self.env_done = False
 
-    def bind_nic_driver(self, ports, driver=""):
-        # modprobe vfio driver
-        if driver == "vfio-pci":
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver = netdev.get_nic_driver()
-                if driver != 'vfio-pci':
-                    netdev.bind_driver(driver='vfio-pci')
-
-        elif driver == "igb_uio":
-            # igb_uio should insmod as default, no need to check
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver = netdev.get_nic_driver()
-                if driver != 'igb_uio':
-                    netdev.bind_driver(driver='igb_uio')
-        else:
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver_now = netdev.get_nic_driver()
-                if driver is None:
-                    driver = netdev.default_driver
-                if driver != driver_now:
-                    netdev.bind_driver(driver=driver)
-
     def start_vf_pmd(self, terminal):
 
         drive_info = terminal.send_expect("./usertools/dpdk-devbind.py -s", "#")
diff --git a/tests/TestSuite_shutdown_api.py b/tests/TestSuite_shutdown_api.py
index 624f46d5..9f40d232 100644
--- a/tests/TestSuite_shutdown_api.py
+++ b/tests/TestSuite_shutdown_api.py
@@ -216,21 +216,6 @@ class TestShutdownApi(TestCase):
                 break
         self.verify("Link status: up" in out, "VF link down!!!")
 
-    def bind_nic_driver(self, ports, driver=""):
-        if driver == "igb_uio":
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver = netdev.get_nic_driver()
-                if driver != 'igb_uio':
-                    netdev.bind_driver(driver='igb_uio')
-        else:
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver_now = netdev.get_nic_driver()
-                if driver == "":
-                    driver = netdev.default_driver
-                if driver != driver_now:
-                    netdev.bind_driver(driver=driver)
     def setup_vm_env(self, driver='default'):
         """
         Create testing environment with 1VF generated from 1PF
diff --git a/tests/TestSuite_vf_daemon.py b/tests/TestSuite_vf_daemon.py
index 62996ade..19cecddf 100644
--- a/tests/TestSuite_vf_daemon.py
+++ b/tests/TestSuite_vf_daemon.py
@@ -84,23 +84,6 @@ class TestVfDaemon(TestCase):
                 break
         self.verify("Link status: up" in out, "VF link down!!!")
 
-    def bind_nic_driver(self, ports, driver=""):
-        if driver == "igb_uio":
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver = netdev.get_nic_driver()
-                if driver != 'igb_uio':
-                    netdev.bind_driver(driver='igb_uio')
-        else:
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver_now = netdev.get_nic_driver()
-                if driver == "":
-                    driver = netdev.default_driver
-                if driver != driver_now:
-                    netdev.bind_driver(driver=driver)
-
-
     def setup_vm_env(self, driver='default'):
         """
         Create testing environment with 2VFs generated from 1PF
diff --git a/tests/TestSuite_vf_jumboframe.py b/tests/TestSuite_vf_jumboframe.py
index 9c5db0ae..2a7b1261 100644
--- a/tests/TestSuite_vf_jumboframe.py
+++ b/tests/TestSuite_vf_jumboframe.py
@@ -84,31 +84,6 @@ class TestVfJumboFrame(TestCase):
     def set_up(self):
         pass
 
-    def bind_nic_driver(self, ports, driver=""):
-        # modprobe vfio driver
-        if driver == "vfio-pci":
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver = netdev.get_nic_driver()
-                if driver != 'vfio-pci':
-                    netdev.bind_driver(driver='vfio-pci')
-
-        elif driver == "igb_uio":
-            # igb_uio should insmod as default, no need to check
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver = netdev.get_nic_driver()
-                if driver != 'igb_uio':
-                    netdev.bind_driver(driver='igb_uio')
-        else:
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver_now = netdev.get_nic_driver()
-                if driver == None:
-                    driver = netdev.default_driver
-                if driver != driver_now:
-                    netdev.bind_driver(driver=driver)
-
     def setup_vm_env(self, driver='default'):
         """
         Create testing environment with 1VF generated from 1PF
diff --git a/tests/TestSuite_vf_vlan.py b/tests/TestSuite_vf_vlan.py
index 429f9038..cfefdbe9 100644
--- a/tests/TestSuite_vf_vlan.py
+++ b/tests/TestSuite_vf_vlan.py
@@ -78,31 +78,6 @@ class TestVfVlan(TestCase):
     def set_up(self):
         self.setup_vm_env()
 
-    def bind_nic_driver(self, ports, driver=""):
-        # modprobe vfio driver
-        if driver == "vfio-pci":
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver = netdev.get_nic_driver()
-                if driver != 'vfio-pci':
-                    netdev.bind_driver(driver='vfio-pci')
-
-        elif driver == "igb_uio":
-            # igb_uio should insmod as default, no need to check
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver = netdev.get_nic_driver()
-                if driver != 'igb_uio':
-                    netdev.bind_driver(driver='igb_uio')
-        else:
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver_now = netdev.get_nic_driver()
-                if driver == "":
-                    driver = netdev.default_driver
-                if driver != driver_now:
-                    netdev.bind_driver(driver=driver)
-
     def setup_vm_env(self, driver='default'):
         """
         Create testing environment with 2VFs generated from 2PFs
diff --git a/tests/TestSuite_vhost_cbdma.py b/tests/TestSuite_vhost_cbdma.py
index 034b9b24..9330a558 100644
--- a/tests/TestSuite_vhost_cbdma.py
+++ b/tests/TestSuite_vhost_cbdma.py
@@ -112,15 +112,6 @@ class TestVirTioVhostCbdma(TestCase):
         self.dut.send_expect("rm -rf /tmp/s0", "#")
         self.mode_list = []
 
-    def bind_nic_driver(self, ports, driver=""):
-        for port in ports:
-            netdev = self.dut.ports_info[port]['port']
-            driver_now = netdev.get_nic_driver()
-            if driver == "":
-                driver = netdev.default_driver
-            if driver != driver_now:
-                netdev.bind_driver(driver=driver)
-
     def get_cbdma_ports_info_and_bind_to_dpdk(self, cbdma_num):
         """
         get all cbdma ports
diff --git a/tests/TestSuite_vhost_event_idx_interrupt.py b/tests/TestSuite_vhost_event_idx_interrupt.py
index 4e318b6b..be934677 100644
--- a/tests/TestSuite_vhost_event_idx_interrupt.py
+++ b/tests/TestSuite_vhost_event_idx_interrupt.py
@@ -280,15 +280,6 @@ class TestVhostEventIdxInterrupt(TestCase):
                 session_info[sess_index].send_expect("^c", "#")
                 self.vm_dut[vm_index].close_session(session_info[sess_index])
 
-    def bind_nic_driver(self, ports, driver=""):
-        for port in ports:
-            netdev = self.dut.ports_info[port]['port']
-            driver_now = netdev.get_nic_driver()
-            if driver == "":
-                driver = netdev.default_driver
-            if driver != driver_now:
-                netdev.bind_driver(driver=driver)
-
     def get_cbdma_ports_info_and_bind_to_dpdk(self):
         """
         get all cbdma ports
diff --git a/tests/TestSuite_vm2vm_virtio_net_perf.py b/tests/TestSuite_vm2vm_virtio_net_perf.py
index ae9b3d2f..c627bd96 100644
--- a/tests/TestSuite_vm2vm_virtio_net_perf.py
+++ b/tests/TestSuite_vm2vm_virtio_net_perf.py
@@ -339,22 +339,6 @@ class TestVM2VMVirtioNetPerf(TestCase):
         md5_revd = md5_revd[: md5_revd.find(' ')]
         self.verify(md5_send == md5_revd, 'the received file is different with send file')
 
-    def bind_nic_driver(self, ports, driver=""):
-        if driver == "igb_uio":
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver = netdev.get_nic_driver()
-                if driver != 'igb_uio':
-                    netdev.bind_driver(driver='igb_uio')
-        else:
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver_now = netdev.get_nic_driver()
-                if driver == "":
-                    driver = netdev.default_driver
-                if driver != driver_now:
-                    netdev.bind_driver(driver=driver)
-
     def test_vm2vm_split_ring_iperf_with_tso(self):
         """
         TestCase1: VM2VM split ring vhost-user/virtio-net test with tcp traffic
diff --git a/tests/TestSuite_vm2vm_virtio_pmd.py b/tests/TestSuite_vm2vm_virtio_pmd.py
index f2af6d85..5e0148b2 100644
--- a/tests/TestSuite_vm2vm_virtio_pmd.py
+++ b/tests/TestSuite_vm2vm_virtio_pmd.py
@@ -733,15 +733,6 @@ class TestVM2VMVirtioPMD(TestCase):
             self.dut.send_expect('./usertools/dpdk-devbind.py -u %s' % self.device_str, '# ', 30)
             self.dut.send_expect('./usertools/dpdk-devbind.py --force --bind=ioatdma  %s' % self.device_str, '# ', 60)
 
-    def bind_nic_driver(self, ports, driver=""):
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver_now = netdev.get_nic_driver()
-                if driver == "":
-                    driver = netdev.default_driver
-                if driver != driver_now:
-                    netdev.bind_driver(driver=driver)
-
     def tear_down(self):
         #
         # Run after each test case.
diff --git a/tests/TestSuite_vm2vm_virtio_user.py b/tests/TestSuite_vm2vm_virtio_user.py
index f758ab76..9c6bad1b 100644
--- a/tests/TestSuite_vm2vm_virtio_user.py
+++ b/tests/TestSuite_vm2vm_virtio_user.py
@@ -738,22 +738,6 @@ class TestVM2VMVirtioUser(TestCase):
             self.dut.send_expect('./usertools/dpdk-devbind.py -u %s' % self.device_str, '# ', 30)
             self.dut.send_expect('./usertools/dpdk-devbind.py --force --bind=ioatdma  %s' % self.device_str, '# ', 60)
 
-    def bind_nic_driver(self, ports, driver=""):
-        if driver == "igb_uio":
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver = netdev.get_nic_driver()
-                if driver != 'igb_uio':
-                    netdev.bind_driver(driver='igb_uio')
-        else:
-            for port in ports:
-                netdev = self.dut.ports_info[port]['port']
-                driver_now = netdev.get_nic_driver()
-                if driver == "":
-                    driver = netdev.default_driver
-                if driver != driver_now:
-                    netdev.bind_driver(driver=driver)
-
     def test_vm2vm_virtio_user_split_virtqueue_inorder_mergeable_path_with_cbdma(self):
         """
         Test Case 12: split virtqueue vm2vm inorder mergeable path multi-queues payload check with cbdma enabled
-- 
2.33.1.windows.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [dts] [PATCH V1] framework/test_case: removed bind_nic_driver common func to framework
  2021-11-17  9:26 [dts] [PATCH V1] framework/test_case: removed bind_nic_driver common func to framework DongJunX
@ 2021-11-22 15:15 ` Tu, Lijuan
  0 siblings, 0 replies; 2+ messages in thread
From: Tu, Lijuan @ 2021-11-22 15:15 UTC (permalink / raw)
  To: Dong, JunX, dts; +Cc: Yu, PingX, Ling, WeiX, Dong, JunX

> -----Original Message-----
> From: DongJunX <junx.dong@intel.com>
> Sent: 2021年11月17日 17:27
> To: dts@dpdk.org
> Cc: Yu, PingX <pingx.yu@intel.com>; Ling, WeiX <weix.ling@intel.com>; Dong,
> JunX <junx.dong@intel.com>
> Subject: [dts] [PATCH V1] framework/test_case: removed bind_nic_driver
> common func to framework
> 
> Signed-off-by: DongJunX <junx.dong@intel.com>

Acked-by: Lijuan Tu <lijuan.tu@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-22 15:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-17  9:26 [dts] [PATCH V1] framework/test_case: removed bind_nic_driver common func to framework DongJunX
2021-11-22 15:15 ` Tu, Lijuan

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).