aboutsummaryrefslogtreecommitdiffstats
path: root/resources/traffic_scripts/span_check.py
diff options
context:
space:
mode:
authorJan Gelety <jgelety@cisco.com>2017-09-08 11:38:38 +0200
committerTibor Frank <tifrank@cisco.com>2017-09-18 12:05:49 +0000
commit2a848f49308868dfe6fa3a9cb78bd085f8c16f40 (patch)
tree180c45ea5db2cc095c65d3b698a3e05a6ee819fe /resources/traffic_scripts/span_check.py
parent6928a6be42016a6c5edade6369041670fe544f39 (diff)
Ignore unexpected ICMPv6 Neighbor Discovery - Neighbor Solicitation packets
We need to adapt all functional traffic scripts related to functional IPv6 tests to ingore receiving of unexpected ICMPv6ND_NS (ICMPv6 Neighbor Discovery - Neighbor Solicitation) packets that are sent automatically and we cannot avoid to receive them. The reason is to prevent false negative test results in case of csit functional tests that could block creation of new operational branch (csit weekly jobs), usage of new vpp builds (csit semiweekly jobs) and merging patches - csit as well as vpp. Change-Id: I43c90e7c766762fa769a81661338759a11b401a1 Signed-off-by: Jan Gelety <jgelety@cisco.com>
Diffstat (limited to 'resources/traffic_scripts/span_check.py')
-rwxr-xr-xresources/traffic_scripts/span_check.py27
1 files changed, 19 insertions, 8 deletions
diff --git a/resources/traffic_scripts/span_check.py b/resources/traffic_scripts/span_check.py
index c7ca8a7374..cbf65d3aaf 100755
--- a/resources/traffic_scripts/span_check.py
+++ b/resources/traffic_scripts/span_check.py
@@ -21,7 +21,7 @@ import sys
import ipaddress
from scapy.layers.inet import IP, ICMP, ARP
-from scapy.layers.inet6 import IPv6, ICMPv6EchoRequest, ICMPv6EchoReply
+from scapy.layers.inet6 import IPv6, ICMPv6EchoRequest, ICMPv6ND_NS
from scapy.layers.l2 import Ether
from resources.libraries.python.PacketVerifier import RxQueue, TxQueue, auto_pad
@@ -64,8 +64,8 @@ def main():
"""Send a simple L2 or ICMP packet from one TG interface to DUT, then
receive a copy of the packet on the second TG interface, and a copy of
the ICMP reply."""
- args = TrafficScriptArg(
- ['tg_src_mac', 'src_ip', 'dst_ip', 'dut_if1_mac', 'ptype'])
+ args = TrafficScriptArg(['tg_src_mac', 'src_ip', 'dst_ip', 'dut_if1_mac',
+ 'ptype'])
src_mac = args.get_arg('tg_src_mac')
dst_mac = args.get_arg('dut_if1_mac')
@@ -104,11 +104,20 @@ def main():
txq.send(pkt_raw)
sent.append(auto_pad(pkt_raw))
- ether = rxq_mirrored.recv(2)
# Receive copy of Rx packet.
- if ether is None:
- raise RuntimeError("Rx timeout of mirrored Rx packet")
+ while True:
+ ether = rxq_mirrored.recv(2)
+ if ether is None:
+ raise RuntimeError("Rx timeout of mirrored Rx packet")
+
+ if ether.haslayer(ICMPv6ND_NS):
+ # read another packet in the queue if the current one is ICMPv6ND_NS
+ continue
+ else:
+ # otherwise process the current packet
+ break
+
pkt = auto_pad(pkt_raw)
if str(ether) != str(pkt):
print("Mirrored Rx packet doesn't match the original Rx packet.")
@@ -148,15 +157,17 @@ def main():
# Receive reply on TG Tx port.
ether_repl = rxq_tx.recv(2, sent)
+
if ether_repl is None:
raise RuntimeError("Reply not received on TG Tx port.")
- else:
- print("Reply received on TG Tx port.\n")
+
+ print("Reply received on TG Tx port.\n")
# Receive copy of Tx packet.
ether = rxq_mirrored.recv(2)
if ether is None:
raise RuntimeError("Rx timeout of mirrored Tx packet")
+
if str(ether) != str(ether_repl):
print("Mirrored Tx packet doesn't match the received Tx packet.")
if ether.src != ether_repl.src or ether.dst != ether_repl.dst: