aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/PacketVerifier.py
diff options
context:
space:
mode:
authorselias <samelias@cisco.com>2016-09-30 14:04:06 +0200
committerselias <samelias@cisco.com>2016-10-04 10:05:53 +0200
commita912d105f3a1d8fed0b4cf6b18e0ef7789be81bf (patch)
tree72fbbaa05aec1c7e3b903eff45624800a8c1d607 /resources/libraries/python/PacketVerifier.py
parentedd554cdb32b124136f49cb17f711ecda0f0176c (diff)
Fix pylint warnings in python libraries
- no functional changes - fixes 80+ PEP-8 violations Change-Id: Icf414778ec40d5cb44364fa69a876f9a1870c3c7 Signed-off-by: selias <samelias@cisco.com>
Diffstat (limited to 'resources/libraries/python/PacketVerifier.py')
-rw-r--r--resources/libraries/python/PacketVerifier.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/resources/libraries/python/PacketVerifier.py b/resources/libraries/python/PacketVerifier.py
index 59ea2db5a3..bbfdfe8688 100644
--- a/resources/libraries/python/PacketVerifier.py
+++ b/resources/libraries/python/PacketVerifier.py
@@ -68,7 +68,7 @@ import socket
import select
from scapy.all import ETH_P_IP, ETH_P_IPV6, ETH_P_ALL, ETH_P_ARP
-from scapy.all import Ether, ARP, Packet
+from scapy.all import Ether, ARP
from scapy.layers.inet6 import IPv6
__all__ = ['RxQueue', 'TxQueue', 'Interface', 'create_gratuitous_arp_request',
@@ -276,17 +276,32 @@ class TxQueue(PacketVerifier):
class Interface(object):
+ """Class for network interfaces. Contains methods for sending and receiving
+ packets."""
def __init__(self, if_name):
+ """Initialize the interface class.
+
+ :param if_name: Name of the interface.
+ :type if_name: str
+ """
self.if_name = if_name
self.sent_packets = []
self.rxq = RxQueue(if_name)
self.txq = TxQueue(if_name)
def send_pkt(self, pkt):
+ """Send the provided packet out the interface."""
self.sent_packets.append(pkt)
self.txq.send(pkt)
def recv_pkt(self, timeout=3):
+ """Read one packet from the interface's receive queue.
+
+ :param timeout: Timeout value in seconds.
+ :type timeout: int
+ :return: Ether() initialized object from packet data.
+ :rtype: scapy.Ether
+ """
return self.rxq.recv(timeout, self.sent_packets)