test suite reviews and discussions
 help / color / mirror / Atom feed
From: "Juraj Linkeš" <juraj.linkes@pantheon.tech>
To: lijuan.tu@intel.com, ohilyard@iol.unh.edu
Cc: dts@dpdk.org, "Juraj Linkeš" <juraj.linkes@pantheon.tech>
Subject: [PATCH v1] framework/packet: fix pylama errors
Date: Mon,  6 Dec 2021 13:20:08 +0100	[thread overview]
Message-ID: <1638793208-2584-1-git-send-email-juraj.linkes@pantheon.tech> (raw)

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


             reply	other threads:[~2021-12-06 12:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 12:20 Juraj Linkeš [this message]
2021-12-13 15:45 ` [PATCH v2] " Juraj Linkeš
2022-01-14  8:56   ` Tu, Lijuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1638793208-2584-1-git-send-email-juraj.linkes@pantheon.tech \
    --to=juraj.linkes@pantheon.tech \
    --cc=dts@dpdk.org \
    --cc=lijuan.tu@intel.com \
    --cc=ohilyard@iol.unh.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).