aboutsummaryrefslogtreecommitdiffstats
path: root/resources/traffic_scripts/ipfix_check.py
diff options
context:
space:
mode:
authorMatej Klotton <mklotton@cisco.com>2017-01-30 12:36:34 +0100
committerMatej Klotton <mklotton@cisco.com>2017-02-23 16:16:14 +0100
commit66919d66b8ab63369266eaab8db1628501e884aa (patch)
tree7a7ffa4c278244e7b9fe9c30a4972811f93066f2 /resources/traffic_scripts/ipfix_check.py
parent8c465631f6029b174e6d2549e1305b5b4cb8b8de (diff)
Add pypcap python requirement
Using pypcap's L2listen instead of standard AF_PACKET scapy can see received Dot1Q tag. Change-Id: Icb3dcb272a9611158a26a83fede7550bba3f367e Signed-off-by: Matej Klotton <mklotton@cisco.com>
Diffstat (limited to 'resources/traffic_scripts/ipfix_check.py')
-rwxr-xr-xresources/traffic_scripts/ipfix_check.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/resources/traffic_scripts/ipfix_check.py b/resources/traffic_scripts/ipfix_check.py
index aa04b24038..2a08f0ce85 100755
--- a/resources/traffic_scripts/ipfix_check.py
+++ b/resources/traffic_scripts/ipfix_check.py
@@ -16,16 +16,16 @@
"""Traffic script - IPFIX listener."""
import sys
-from ipaddress import IPv4Address, IPv6Address, AddressValueError
+from ipaddress import IPv4Address, IPv6Address, AddressValueError
from scapy.layers.inet import IP, TCP, UDP
from scapy.layers.inet6 import IPv6
from scapy.layers.l2 import Ether
-from resources.libraries.python.telemetry.IPFIXUtil import IPFIXHandler, \
- IPFIXData
from resources.libraries.python.PacketVerifier import RxQueue, TxQueue, auto_pad
from resources.libraries.python.TrafficScriptArg import TrafficScriptArg
+from resources.libraries.python.telemetry.IPFIXUtil import IPFIXHandler, \
+ IPFIXData
def valid_ipv4(ip):
@@ -117,17 +117,10 @@ def main():
# allow scapy to recognize IPFIX headers and templates
ipfix = IPFIXHandler()
-
- # clear receive buffer
- while True:
- pkt = rxq.recv(1, ignore=ignore, verbose=verbose)
- if pkt is None:
- break
-
data = None
# get IPFIX template and data
while True:
- pkt = rxq.recv(5)
+ pkt = rxq.recv(10, ignore=ignore, verbose=verbose)
if pkt is None:
raise RuntimeError("RX timeout")
if pkt.haslayer("IPFIXHeader"):
@@ -194,5 +187,4 @@ def main():
if __name__ == "__main__":
-
main()