test suite reviews and discussions
 help / color / mirror / Atom feed
* [PATCH v1] framework/packet: fix pylama errors
@ 2021-12-06 12:20 Juraj Linkeš
  2021-12-13 15:45 ` [PATCH v2] " Juraj Linkeš
  0 siblings, 1 reply; 3+ messages in thread
From: Juraj Linkeš @ 2021-12-06 12:20 UTC (permalink / raw)
  To: lijuan.tu, ohilyard; +Cc: dts, Juraj Linkeš

Pylama found the following errors:
framework/packet.py:119: [E] E0102 class already defined line 38 [pylint]
framework/packet.py:121: [E] E0602 Undefined variable 'Ether' [pylint]
framework/packet.py:122: [E] E0602 Undefined variable 'Dot1Q' [pylint]
framework/packet.py:123: [E] E0602 Undefined variable 'Dot1BR' [pylint]
framework/packet.py:124: [E] E0602 Undefined variable 'Ether' [pylint]
framework/packet.py:125: [E] E0602 Undefined variable 'ARP' [pylint]
framework/packet.py:126: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:127: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:128: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:129: [E] E0602 Undefined variable 'IPv6' [pylint]
framework/packet.py:130: [E] E0602 Undefined variable 'IPv6' [pylint]
framework/packet.py:131: [E] E0602 Undefined variable 'IPv6' [pylint]
framework/packet.py:132: [E] E0602 Undefined variable 'UDP' [pylint]
framework/packet.py:133: [E] E0602 Undefined variable 'TCP' [pylint]
framework/packet.py:134: [E] E0602 Undefined variable 'SCTP' [pylint]
framework/packet.py:135: [E] E0602 Undefined variable 'ICMP' [pylint]
framework/packet.py:136: [E] E0602 Undefined variable 'GRE' [pylint]
framework/packet.py:138: [E] E0602 Undefined variable 'VXLAN' [pylint]
framework/packet.py:139: [E] E0602 Undefined variable 'NSH' [pylint]
framework/packet.py:140: [E] E0602 Undefined variable 'MPLS' [pylint]
framework/packet.py:142: [E] E0602 Undefined variable 'Ether' [pylint]
framework/packet.py:143: [E] E0602 Undefined variable 'Dot1Q' [pylint]
framework/packet.py:144: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:145: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:146: [E] E0602 Undefined variable 'IPv6' [pylint]
framework/packet.py:147: [E] E0602 Undefined variable 'IPv6' [pylint]
framework/packet.py:149: [E] E0602 Undefined variable 'TCP' [pylint]
framework/packet.py:150: [E] E0602 Undefined variable 'UDP' [pylint]
framework/packet.py:151: [E] E0602 Undefined variable 'SCTP' [pylint]
framework/packet.py:152: [E] E0602 Undefined variable 'ICMP' [pylint]
framework/packet.py:154: [E] E0602 Undefined variable 'LLDPDU' [pylint]
framework/packet.py:155: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:156: [E] E0602 Undefined variable 'IPv6' [pylint]
framework/packet.py:157: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:158: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:159: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:160: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:161: [E] E0602 Undefined variable 'GRE' [pylint]
framework/packet.py:212: [E] E0602 Undefined variable 'Dot1Q' [pylint]
framework/packet.py:230: [E] E0602 Undefined variable 'Dot1BR' [pylint]
framework/packet.py:381: [E] E0102 class already defined line 38 [pylint]
framework/packet.py:895: [E] E0704 The raise statement is not inside an except clause [pylint]
framework/packet.py:898: [E] E0704 The raise statement is not inside an except clause [pylint]

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
Lijuan, please add additional people to review if needed.
---
 framework/packet.py | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/framework/packet.py b/framework/packet.py
index 633dd36f..c6986f84 100644
--- a/framework/packet.py
+++ b/framework/packet.py
@@ -33,9 +33,30 @@ Generic packet create, transmit and analyze module
 Base on scapy(python program for packet manipulation)
 """
 
+import os
+import random
+import re
+import socket
+import struct
+import sys
+import time
 from importlib import import_module
 from socket import AF_INET6
-from scapy.all import *
+
+from scapy.contrib.lldp import LLDPDU, LLDPDUManagementAddress
+from scapy.contrib.mpls import MPLS
+from scapy.contrib.nsh import NSH
+from scapy.layers.inet import ICMP, IP, TCP, UDP
+from scapy.layers.inet6 import IPv6, IPv6ExtHdrFragment, IPv6ExtHdrRouting
+from scapy.layers.l2 import ARP, GRE, Dot1Q, Ether
+from scapy.layers.sctp import SCTP
+from scapy.layers.vxlan import VXLAN
+from scapy.packet import Raw
+from scapy.sendrecv import sendp
+from scapy.utils import hexstr, rdpcap, wrpcap
+
+from dep.scapy_modules.Dot1BR import Dot1BR
+
 from .utils import convert_int2ip, convert_ip2int
 
 # load extension layers
@@ -892,10 +913,10 @@ class Packet(object):
             name, config = layer
             if name not in self.pkt_layers:
                 print("[%s] is missing in packet!!!" % name)
-                raise
+                raise Exception(f"{name} is missing in packet!!!")
             if self.config_layer(name, config) is False:
                 print("[%s] failed to configure!!!" % name)
-                raise
+                raise Exception(f"{name} failed to configure!!!")
 
     def strip_layer_element(self, layer, element, p_index=0):
         """
-- 
2.20.1


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

* [PATCH v2] framework/packet: fix pylama errors
  2021-12-06 12:20 [PATCH v1] framework/packet: fix pylama errors Juraj Linkeš
@ 2021-12-13 15:45 ` Juraj Linkeš
  2022-01-14  8:56   ` Tu, Lijuan
  0 siblings, 1 reply; 3+ messages in thread
From: Juraj Linkeš @ 2021-12-13 15:45 UTC (permalink / raw)
  To: lijuan.tu, ohilyard, junx.dong; +Cc: dts, Juraj Linkeš

Pylama found the following errors:
framework/packet.py:119: [E] E0102 class already defined line 38 [pylint]
framework/packet.py:121: [E] E0602 Undefined variable 'Ether' [pylint]
framework/packet.py:122: [E] E0602 Undefined variable 'Dot1Q' [pylint]
framework/packet.py:123: [E] E0602 Undefined variable 'Dot1BR' [pylint]
framework/packet.py:124: [E] E0602 Undefined variable 'Ether' [pylint]
framework/packet.py:125: [E] E0602 Undefined variable 'ARP' [pylint]
framework/packet.py:126: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:127: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:128: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:129: [E] E0602 Undefined variable 'IPv6' [pylint]
framework/packet.py:130: [E] E0602 Undefined variable 'IPv6' [pylint]
framework/packet.py:131: [E] E0602 Undefined variable 'IPv6' [pylint]
framework/packet.py:132: [E] E0602 Undefined variable 'UDP' [pylint]
framework/packet.py:133: [E] E0602 Undefined variable 'TCP' [pylint]
framework/packet.py:134: [E] E0602 Undefined variable 'SCTP' [pylint]
framework/packet.py:135: [E] E0602 Undefined variable 'ICMP' [pylint]
framework/packet.py:136: [E] E0602 Undefined variable 'GRE' [pylint]
framework/packet.py:138: [E] E0602 Undefined variable 'VXLAN' [pylint]
framework/packet.py:139: [E] E0602 Undefined variable 'NSH' [pylint]
framework/packet.py:140: [E] E0602 Undefined variable 'MPLS' [pylint]
framework/packet.py:142: [E] E0602 Undefined variable 'Ether' [pylint]
framework/packet.py:143: [E] E0602 Undefined variable 'Dot1Q' [pylint]
framework/packet.py:144: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:145: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:146: [E] E0602 Undefined variable 'IPv6' [pylint]
framework/packet.py:147: [E] E0602 Undefined variable 'IPv6' [pylint]
framework/packet.py:149: [E] E0602 Undefined variable 'TCP' [pylint]
framework/packet.py:150: [E] E0602 Undefined variable 'UDP' [pylint]
framework/packet.py:151: [E] E0602 Undefined variable 'SCTP' [pylint]
framework/packet.py:152: [E] E0602 Undefined variable 'ICMP' [pylint]
framework/packet.py:154: [E] E0602 Undefined variable 'LLDPDU' [pylint]
framework/packet.py:155: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:156: [E] E0602 Undefined variable 'IPv6' [pylint]
framework/packet.py:157: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:158: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:159: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:160: [E] E0602 Undefined variable 'IP' [pylint]
framework/packet.py:161: [E] E0602 Undefined variable 'GRE' [pylint]
framework/packet.py:212: [E] E0602 Undefined variable 'Dot1Q' [pylint]
framework/packet.py:230: [E] E0602 Undefined variable 'Dot1BR' [pylint]
framework/packet.py:381: [E] E0102 class already defined line 38 [pylint]
framework/packet.py:895: [E] E0704 The raise statement is not inside an except clause [pylint]
framework/packet.py:898: [E] E0704 The raise statement is not inside an except clause [pylint]

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
Lijuan, please add additional people to review if needed.
---
 framework/packet.py | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/framework/packet.py b/framework/packet.py
index adfa985a..787cfaee 100644
--- a/framework/packet.py
+++ b/framework/packet.py
@@ -34,9 +34,30 @@ Base on scapy(python program for packet manipulation)
 """
 import shutil
 
+import os
+import random
+import re
+import socket
+import struct
+import sys
+import time
 from importlib import import_module
 from socket import AF_INET6
-from scapy.all import *
+
+from scapy.contrib.lldp import LLDPDU, LLDPDUManagementAddress
+from scapy.contrib.mpls import MPLS
+from scapy.contrib.nsh import NSH
+from scapy.layers.inet import ICMP, IP, TCP, UDP
+from scapy.layers.inet6 import IPv6, IPv6ExtHdrFragment, IPv6ExtHdrRouting
+from scapy.layers.l2 import ARP, GRE, Dot1Q, Ether
+from scapy.layers.sctp import SCTP
+from scapy.layers.vxlan import VXLAN
+from scapy.packet import Raw
+from scapy.sendrecv import sendp
+from scapy.utils import hexstr, rdpcap, wrpcap
+
+from dep.scapy_modules.Dot1BR import Dot1BR
+
 from .utils import convert_int2ip, convert_ip2int, get_module_path
 
 # load extension layers
@@ -893,10 +914,10 @@ class Packet(object):
             name, config = layer
             if name not in self.pkt_layers:
                 print("[%s] is missing in packet!!!" % name)
-                raise
+                raise Exception(f"{name} is missing in packet!!!")
             if self.config_layer(name, config) is False:
                 print("[%s] failed to configure!!!" % name)
-                raise
+                raise Exception(f"{name} failed to configure!!!")
 
     def strip_layer_element(self, layer, element, p_index=0):
         """
-- 
2.20.1


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

* RE: [PATCH v2] framework/packet: fix pylama errors
  2021-12-13 15:45 ` [PATCH v2] " Juraj Linkeš
@ 2022-01-14  8:56   ` Tu, Lijuan
  0 siblings, 0 replies; 3+ messages in thread
From: Tu, Lijuan @ 2022-01-14  8:56 UTC (permalink / raw)
  To: Juraj Linkeš, ohilyard, Dong, JunX; +Cc: dts

> -----Original Message-----
> From: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Sent: 2021年12月13日 23:46
> To: Tu, Lijuan <lijuan.tu@intel.com>; ohilyard@iol.unh.edu; Dong, JunX
> <junx.dong@intel.com>
> Cc: dts@dpdk.org; Juraj Linkeš <juraj.linkes@pantheon.tech>
> Subject: [PATCH v2] framework/packet: fix pylama errors
> 
> Pylama found the following errors:
> framework/packet.py:119: [E] E0102 class already defined line 38 [pylint]
> framework/packet.py:121: [E] E0602 Undefined variable 'Ether' [pylint]
> framework/packet.py:122: [E] E0602 Undefined variable 'Dot1Q' [pylint]
> framework/packet.py:123: [E] E0602 Undefined variable 'Dot1BR' [pylint]
> framework/packet.py:124: [E] E0602 Undefined variable 'Ether' [pylint]
> framework/packet.py:125: [E] E0602 Undefined variable 'ARP' [pylint]
> framework/packet.py:126: [E] E0602 Undefined variable 'IP' [pylint]
> framework/packet.py:127: [E] E0602 Undefined variable 'IP' [pylint]
> framework/packet.py:128: [E] E0602 Undefined variable 'IP' [pylint]
> framework/packet.py:129: [E] E0602 Undefined variable 'IPv6' [pylint]
> framework/packet.py:130: [E] E0602 Undefined variable 'IPv6' [pylint]
> framework/packet.py:131: [E] E0602 Undefined variable 'IPv6' [pylint]
> framework/packet.py:132: [E] E0602 Undefined variable 'UDP' [pylint]
> framework/packet.py:133: [E] E0602 Undefined variable 'TCP' [pylint]
> framework/packet.py:134: [E] E0602 Undefined variable 'SCTP' [pylint]
> framework/packet.py:135: [E] E0602 Undefined variable 'ICMP' [pylint]
> framework/packet.py:136: [E] E0602 Undefined variable 'GRE' [pylint]
> framework/packet.py:138: [E] E0602 Undefined variable 'VXLAN' [pylint]
> framework/packet.py:139: [E] E0602 Undefined variable 'NSH' [pylint]
> framework/packet.py:140: [E] E0602 Undefined variable 'MPLS' [pylint]
> framework/packet.py:142: [E] E0602 Undefined variable 'Ether' [pylint]
> framework/packet.py:143: [E] E0602 Undefined variable 'Dot1Q' [pylint]
> framework/packet.py:144: [E] E0602 Undefined variable 'IP' [pylint]
> framework/packet.py:145: [E] E0602 Undefined variable 'IP' [pylint]
> framework/packet.py:146: [E] E0602 Undefined variable 'IPv6' [pylint]
> framework/packet.py:147: [E] E0602 Undefined variable 'IPv6' [pylint]
> framework/packet.py:149: [E] E0602 Undefined variable 'TCP' [pylint]
> framework/packet.py:150: [E] E0602 Undefined variable 'UDP' [pylint]
> framework/packet.py:151: [E] E0602 Undefined variable 'SCTP' [pylint]
> framework/packet.py:152: [E] E0602 Undefined variable 'ICMP' [pylint]
> framework/packet.py:154: [E] E0602 Undefined variable 'LLDPDU' [pylint]
> framework/packet.py:155: [E] E0602 Undefined variable 'IP' [pylint]
> framework/packet.py:156: [E] E0602 Undefined variable 'IPv6' [pylint]
> framework/packet.py:157: [E] E0602 Undefined variable 'IP' [pylint]
> framework/packet.py:158: [E] E0602 Undefined variable 'IP' [pylint]
> framework/packet.py:159: [E] E0602 Undefined variable 'IP' [pylint]
> framework/packet.py:160: [E] E0602 Undefined variable 'IP' [pylint]
> framework/packet.py:161: [E] E0602 Undefined variable 'GRE' [pylint]
> framework/packet.py:212: [E] E0602 Undefined variable 'Dot1Q' [pylint]
> framework/packet.py:230: [E] E0602 Undefined variable 'Dot1BR' [pylint]
> framework/packet.py:381: [E] E0102 class already defined line 38 [pylint]
> framework/packet.py:895: [E] E0704 The raise statement is not inside an except
> clause [pylint]
> framework/packet.py:898: [E] E0704 The raise statement is not inside an except
> clause [pylint]
> 
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>

Applied

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

end of thread, other threads:[~2022-01-14  9:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06 12:20 [PATCH v1] framework/packet: fix pylama errors Juraj Linkeš
2021-12-13 15:45 ` [PATCH v2] " Juraj Linkeš
2022-01-14  8:56   ` Tu, Lijuan

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