[V1] framework/packet: remove sctp in required scapy module

Message ID 20210113053321.4580-1-haiyangx.zhao@intel.com (mailing list archive)
State Accepted
Headers
Series [V1] framework/packet: remove sctp in required scapy module |

Commit Message

Zhao, HaiyangX Jan. 13, 2021, 5:33 a.m. UTC
  sctp is in scapy.layers and is been imported by default,
so remove the importing sctp code.

Signed-off-by: Haiyang Zhao <haiyangx.zhao@intel.com>
---
 framework/packet.py | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
  

Comments

Zhao, HaiyangX Jan. 13, 2021, 5:42 a.m. UTC | #1
Tested-by:  Haiyang Zhao <haiyangx.zhao@intel.com>

Best Regards,
Zhao Haiyang

> -----Original Message-----
> From: Haiyang Zhao <haiyangx.zhao@intel.com>
> Sent: Wednesday, January 13, 2021 13:33
> To: dts@dpdk.org; Tu, Lijuan <lijuan.tu@intel.com>
> Cc: Zhao, HaiyangX <haiyangx.zhao@intel.com>
> Subject: [dts][PATCH V1] framework/packet: remove sctp in required scapy
> module
  
Tu, Lijuan Jan. 13, 2021, 8:49 a.m. UTC | #2
> sctp is in scapy.layers and is been imported by default, so remove the
> importing sctp code.
> 
> Signed-off-by: Haiyang Zhao <haiyangx.zhao@intel.com>

Applied
  

Patch

diff --git a/framework/packet.py b/framework/packet.py
index 2cd64d02..6d9bf246 100644
--- a/framework/packet.py
+++ b/framework/packet.py
@@ -52,8 +52,13 @@  from utils import convert_ip2int
 from utils import convert_int2ip
 
 scapy_modules_required = {'gtp': ['GTP_U_Header', 'GTPPDUSessionContainer'],
-                          'lldp': ['LLDPDU', 'LLDPDUManagementAddress'], 'Dot1BR': ['Dot1BR'], 'pfcp': ['PFCP'],
-                          'nsh': ['NSH'], 'igmp': ['IGMP'], 'mpls': ['MPLS'], 'sctp': ['SCTP', 'SCTPChunkData']}
+                          'lldp': ['LLDPDU', 'LLDPDUManagementAddress'],
+                          'Dot1BR': ['Dot1BR'],
+                          'pfcp': ['PFCP'],
+                          'nsh': ['NSH'],
+                          'igmp': ['IGMP'],
+                          'mpls': ['MPLS'],
+                          }
 local_modules = [m[:-3] for m in os.listdir(DEP_FOLDER + '/scapy_modules') if (m.endswith('.py') and not m.startswith('__'))]
 
 for m in scapy_modules_required:
@@ -63,14 +68,9 @@  for m in scapy_modules_required:
             for clazz in scapy_modules_required[m]:
                 locals().update({clazz: getattr(module, clazz)})
         else:
-            if m == 'sctp':
-                module = import_module(f'scapy.layers.{m}')
-                for clazz in scapy_modules_required[m]:
-                    locals().update({clazz: getattr(module, clazz)})
-            else:
-                module = import_module(f'scapy.contrib.{m}')
-                for clazz in scapy_modules_required[m]:
-                    locals().update({clazz: getattr(module, clazz)})
+            module = import_module(f'scapy.contrib.{m}')
+            for clazz in scapy_modules_required[m]:
+                locals().update({clazz: getattr(module, clazz)})
     except Exception as e:
         print(e)