[dts] [PATCH V1] framework/packet: add Dot1BR module to sys search path

Dong, JunX junx.dong at intel.com
Wed Oct 27 12:19:53 CEST 2021


From: "Dong, JunX" <junx.dong at intel.com>

Signed-off-by: Dong, JunX <junx.dong at intel.com>
---
 framework/packet.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/framework/packet.py b/framework/packet.py
index e6fd74a0..633dd36f 100644
--- a/framework/packet.py
+++ b/framework/packet.py
@@ -35,22 +35,24 @@ Base on scapy(python program for packet manipulation)
 
 from importlib import import_module
 from socket import AF_INET6
-
 from scapy.all import *
-
 from .utils import convert_int2ip, convert_ip2int
 
 # load extension layers
 exec_file = os.path.realpath(__file__)
 DTS_PATH = exec_file.replace('/framework/packet.py', '')
+
 # exec_file might be .pyc file, if so, remove 'c'.
 TMP_PATH = DTS_PATH[:-1] + '/output/tmp/pcap/' if exec_file.endswith('.pyc') else DTS_PATH + '/output/tmp/pcap/'
 if not os.path.exists(TMP_PATH):
     os.system('mkdir -p %s' % TMP_PATH)
 
+# add /tmp/dep to sys.path
+sys.path.append('/tmp/dep')
+
 scapy_modules_required = {'scapy.contrib.gtp': ['GTP_U_Header', 'GTPPDUSessionContainer'],
                           'scapy.contrib.lldp': ['LLDPDU', 'LLDPDUManagementAddress'],
-                          'dep.scapy_modules.Dot1BR': ['Dot1BR'],
+                          'Dot1BR': ['Dot1BR'],
                           'scapy.contrib.pfcp': ['PFCP'],
                           'scapy.contrib.nsh': ['NSH'],
                           'scapy.contrib.igmp': ['IGMP'],
-- 
2.24.1.windows.2



More information about the dts mailing list