fix(Pylint): Small fixes
[csit.git] / GPL / traffic_scripts / lisp / lispgpe_check.py
index 79d2ccf..cffb486 100644 (file)
@@ -29,7 +29,6 @@ packet.
 """
 
 import sys
-import ipaddress
 
 from scapy.all import bind_layers, Packet
 from scapy.fields import FlagsField, BitField, XBitField, IntField
@@ -41,6 +40,7 @@ from scapy.packet import Raw
 
 from ..PacketVerifier import RxQueue, TxQueue
 from ..TrafficScriptArg import TrafficScriptArg
+from ..ValidIp import valid_ipv4, valid_ipv6
 
 
 class LispGPEHeader(Packet):
@@ -92,22 +92,6 @@ class LispGPEInnerNSH(Packet):
     """
 
 
-def valid_ipv4(ip):
-    try:
-        ipaddress.IPv4Address(ip)
-        return True
-    except (AttributeError, ipaddress.AddressValueError):
-        return False
-
-
-def valid_ipv6(ip):
-    try:
-        ipaddress.IPv6Address(ip)
-        return True
-    except (AttributeError, ipaddress.AddressValueError):
-        return False
-
-
 def main():
     """Send IP ICMP packet from one traffic generator interface to the other.
 
@@ -193,7 +177,7 @@ def main():
         if not isinstance(ip, IPv6):
             raise RuntimeError(f"Not an IP packet received {ip!r}")
     elif not isinstance(ip, ip_format):
-            raise RuntimeError(f"Not an IP packet received {ip!r}")
+        raise RuntimeError(f"Not an IP packet received {ip!r}")
 
     lisp = ether.getlayer(LispGPEHeader).underlayer
     if not lisp: