[dts] [PATCH 1/3] nics fm10k: fix nic object incorrect issue

Yong Liu yong.liu at intel.com
Wed Jan 20 09:41:19 CET 2016


This issue happened at dut/tester have same pci address net device.
Net_device module check they will be same devices, so will return
incorrect net device object.

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

diff --git a/framework/dts.py b/framework/dts.py
index 1e60a01..6c3808b 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -39,6 +39,7 @@ import atexit       # register callback when exit
 import json         # json format
 import signal       # signal module for debug mode
 import time         # time module for unique output folder
+import copy         # copy module for duplicate variable
 
 import rst          # rst file support
 import sys          # system module
@@ -252,8 +253,12 @@ def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nic, virtt
                                        '/.%s.cache' % crbInst['IP'])
     serializer.load_from_file()
 
-    dut = get_project_obj(project, Dut, crbInst, serializer)
-    tester = get_project_obj(project, Tester, crbInst, serializer)
+    dutInst = copy.copy(crbInst)
+    dutInst['My IP'] =  crbInst['IP']
+    dut = get_project_obj(project, Dut, dutInst, serializer)
+    testInst = copy.copy(crbInst)
+    testInst['My IP'] =  crbInst['tester IP']
+    tester = get_project_obj(project, Tester, testInst, serializer)
     dts_log_execution(log_handler)
     dut.tester = tester
     tester.dut = dut
diff --git a/framework/packet.py b/framework/packet.py
index a7853e9..b151021 100755
--- a/framework/packet.py
+++ b/framework/packet.py
@@ -196,7 +196,7 @@ class scapy(object):
         if element == 'src':
             value = layer.sport
         elif element == 'dst':
-            valude = layer.dport
+            value = layer.dport
 
         return value
 
diff --git a/nics/net_device.py b/nics/net_device.py
index c3b3755..0286aa4 100644
--- a/nics/net_device.py
+++ b/nics/net_device.py
@@ -820,7 +820,7 @@ def GetNicObj(crb, bus_id, devfun_id):
     object different from default.
     """
     # find existed NetDevice object
-    obj = get_from_list(crb.crb['IP'], bus_id, devfun_id)
+    obj = get_from_list(crb.crb['My IP'], bus_id, devfun_id)
     if obj:
         return obj
 
@@ -831,8 +831,12 @@ def GetNicObj(crb, bus_id, devfun_id):
         # redrockcanyou nic need special initialization
         from fm10k import RedRockCanyou
         obj = RedRockCanyou(crb, bus_id, devfun_id)
+    elif nic == 'atwood':
+        # atwood nic need special initialization
+        from atwood import Atwood
+        obj = Atwood(crb, bus_id, devfun_id)
     else:
         obj = NetDevice(crb, bus_id, devfun_id)
 
-    add_to_list(crb.crb['IP'], obj)
+    add_to_list(crb.crb['My IP'], obj)
     return obj
-- 
2.4.3



More information about the dts mailing list