test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH 1/3] framework dut: add port stop when execution exit
@ 2016-01-20  1:47 Yong Liu
  2016-01-20  1:47 ` [dts] [PATCH 2/3] framework packet: support strip packet payload Yong Liu
  2016-01-20  1:47 ` [dts] [PATCH 3/3] nics fm10k: support optimize rule and vlan/jumbo setting Yong Liu
  0 siblings, 2 replies; 3+ messages in thread
From: Yong Liu @ 2016-01-20  1:47 UTC (permalink / raw)
  To: dts

Some nic like RRC required additional setup like testpoint start-up. So
when execution done, need call additional stop function.

Signed-off-by: Marvin Liu <yong.liu@intel.com>

diff --git a/framework/dts.py b/framework/dts.py
index 2dd511b..1e60a01 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -341,6 +341,7 @@ def dts_run_target(crbInst, targets, test_suites, nic, scenario):
         scene.destroy_scene()
         scene = None
 
+    dut.stop_ports()
     dut.restore_interfaces()
     tester.restore_interfaces()
 
diff --git a/framework/dut.py b/framework/dut.py
index 178c35f..afb5204 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -225,6 +225,23 @@ class Dut(Crb):
         self.send_expect("kldunload contigmem.ko", "#")
         self.send_expect("kldload if_ixgbe.ko", "#", 20)
 
+    def stop_ports(self):
+        """
+        After all execution done, some special nic like fm10k should be stop
+        """
+        for port in self.ports_info:
+            pci_bus = port['pci']
+            pci_id = port['type']
+            # get device driver
+            driver = settings.get_nic_driver(pci_id)
+            if driver is not None:
+                # unbind device driver
+                addr_array = pci_bus.split(':')
+                bus_id = addr_array[0]
+                devfun_id = addr_array[1]
+                port = GetNicObj(self, bus_id, devfun_id)
+                port.stop()
+
     def restore_interfaces_linux(self):
         """
         Restore Linux interfaces.
@@ -824,7 +841,7 @@ class Dut(Crb):
             dutpci = self.ports_info[dutPort]['pci']
             if peer is not None:
                 for remotePort in range(len(self.tester.ports_info)):
-                    if self.tester.ports_info[remotePort]['pci'] == peer:
+                    if self.tester.ports_info[remotePort]['pci'].lower() == peer.lower():
                         hits[remotePort] = True
                         self.ports_map[dutPort] = remotePort
                         break
diff --git a/nics/net_device.py b/nics/net_device.py
index 2b0517b..c3b3755 100644
--- a/nics/net_device.py
+++ b/nics/net_device.py
@@ -64,6 +64,9 @@ class NetDevice(object):
         self.get_interface_name()
         self.socket = self.get_nic_socket()
 
+    def stop(self):
+        pass
+
     def close(self):
         pass
 
-- 
2.4.3

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

end of thread, other threads:[~2016-01-20  1:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-20  1:47 [dts] [PATCH 1/3] framework dut: add port stop when execution exit Yong Liu
2016-01-20  1:47 ` [dts] [PATCH 2/3] framework packet: support strip packet payload Yong Liu
2016-01-20  1:47 ` [dts] [PATCH 3/3] nics fm10k: support optimize rule and vlan/jumbo setting Yong Liu

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