VAT-to-PAPI: VPPCounters
[csit.git] / resources / traffic_scripts / ipfix_sessions.py
index 385d213..11e77fa 100755 (executable)
@@ -22,7 +22,8 @@ from scapy.layers.inet import IP, TCP, UDP
 from scapy.layers.inet6 import IPv6
 from scapy.layers.l2 import Ether
 
-from resources.libraries.python.IPFIXUtil import IPFIXHandler, IPFIXData
+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
 
@@ -133,8 +134,6 @@ def main():
     tx_if = args.get_arg('tx_if')
 
     protocol = args.get_arg('protocol')
-    source_port = int(args.get_arg('port'))
-    destination_port = int(args.get_arg('port'))
     count = int(args.get_arg('count'))
     sessions = int(args.get_arg('sessions'))
 
@@ -167,8 +166,8 @@ def main():
 
     # do not print details for sent packets
     verbose = False
-    print("Sending more than one packet. Details will be filtered for\
-    all packets sent.")
+    print("Sending more than one packet. Details will be filtered for "
+          "all packets sent.")
 
     ignore = []
     for x in range(sessions):
@@ -193,6 +192,11 @@ def main():
         pkt = rxq.recv(5)
         if pkt is None:
             raise RuntimeError("RX timeout")
+
+        if pkt.haslayer("ICMPv6ND_NS"):
+            # read another packet in the queue if the current one is ICMPv6ND_NS
+            continue
+
         if pkt.haslayer("IPFIXHeader"):
             if pkt.haslayer("IPFIXTemplate"):
                 # create or update template for IPFIX data packets
@@ -220,6 +224,6 @@ def main():
             raise RuntimeError("Received non-IPFIX packet or IPFIX header was"
                                "not recognized.")
 
-if __name__ == "__main__":
 
+if __name__ == "__main__":
     main()