[dts] [PATCH V2 3/4] Move function accepted_nic to dts module

Yong Liu yong.liu at intel.com
Fri Aug 7 07:36:10 CEST 2015


From: Marvin Liu <yong.liu at intel.com>

This function will use varaiable in dts. Moved to dts module will make
settings module independent from it.

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

diff --git a/framework/dut.py b/framework/dut.py
index a5c9db3..1199fc6 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -322,7 +322,7 @@ class Dut(Crb):
 
         current_nic = 0
         for (pci_bus, pci_id) in self.pci_devices_info:
-            if settings.accepted_nic(pci_id):
+            if dts.accepted_nic(pci_id):
                 if self.is_ssh_session_port(pci_bus):
                     continue
 
@@ -345,7 +345,7 @@ class Dut(Crb):
 
         current_nic = 0
         for (pci_bus, pci_id) in self.pci_devices_info:
-            if settings.accepted_nic(pci_id):
+            if dts.accepted_nic(pci_id):
                 if self.is_ssh_session_port(pci_bus):
                     continue
 
@@ -671,7 +671,7 @@ class Dut(Crb):
 
         for (pci_bus, pci_id) in self.pci_devices_info:
 
-            if not settings.accepted_nic(pci_id):
+            if not dts.accepted_nic(pci_id):
                 self.logger.info("DUT: [%s %s] %s" % (pci_bus, pci_id,
                                                       skipped))
                 continue
diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py
index 7b6e1ae..e0009d3 100644
--- a/framework/project_dpdk.py
+++ b/framework/project_dpdk.py
@@ -39,7 +39,7 @@ from crb import Crb
 from dut import Dut
 from tester import Tester
 from logger import getLogger
-from settings import IXIA, accepted_nic
+from settings import IXIA
 
 
 class DPDKdut(Dut):
@@ -112,7 +112,7 @@ class DPDKdut(Dut):
         binding_list = ''
 
         for (pci_bus, pci_id) in self.pci_devices_info:
-            if accepted_nic(pci_id):
+            if dts.accepted_nic(pci_id):
                 binding_list += '%s,' % (pci_bus)
 
         self.send_expect("kldunload if_ixgbe.ko", "#")
diff --git a/framework/settings.py b/framework/settings.py
index 631bd32..6b02e4d 100644
--- a/framework/settings.py
+++ b/framework/settings.py
@@ -33,7 +33,6 @@ Folders for framework running enviornment.
 """
 import re
 import socket
-import dts
 
 FOLDERS = {
     'Framework': 'framework',
@@ -179,23 +178,6 @@ def get_nic_driver(pci_id):
     return driver
 
 
-def accepted_nic(pci_id):
-    """
-    Return True if the pci_id is a known NIC card in the settings file and if
-    it is selected in the execution file, otherwise it returns False.
-    """
-    if pci_id not in NICS.values():
-        return False
-
-    if dts.nic is 'any':
-        return True
-
-    else:
-        if pci_id == NICS[dts.nic]:
-            return True
-
-    return False
-
 def get_netdev(crb, pci):
     for port in crb.ports_info:
         if pci == port['pci']:
-- 
1.9.3



More information about the dts mailing list