aboutsummaryrefslogtreecommitdiffstats
path: root/resources/traffic_scripts/send_icmp_check_multipath.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/send_icmp_check_multipath.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/send_icmp_check_multipath.py')
-rwxr-xr-xresources/traffic_scripts/send_icmp_check_multipath.py33
1 files changed, 22 insertions, 11 deletions
diff --git a/resources/traffic_scripts/send_icmp_check_multipath.py b/resources/traffic_scripts/send_icmp_check_multipath.py
index 4e39efdfcd..5da3b7b096 100755
--- a/resources/traffic_scripts/send_icmp_check_multipath.py
+++ b/resources/traffic_scripts/send_icmp_check_multipath.py
@@ -18,10 +18,9 @@ and check if it is divided into two paths."""
import sys
import ipaddress
-from scapy.layers.inet import ICMP, IP
-from scapy.layers.inet6 import IPv6
from scapy.all import Ether
-from scapy.layers.inet6 import ICMPv6EchoRequest
+from scapy.layers.inet import ICMP, IP
+from scapy.layers.inet6 import IPv6, ICMPv6EchoRequest, ICMPv6ND_NS
from resources.libraries.python.PacketVerifier import RxQueue, TxQueue
from resources.libraries.python.TrafficScriptArg import TrafficScriptArg
@@ -94,27 +93,38 @@ def main():
sent_packets.append(pkt_raw)
txq.send(pkt_raw)
- ether = rxq.recv(2)
+
+ while True:
+ ether = rxq.recv(2)
+ if ether is None:
+ raise RuntimeError('ICMPv6 echo reply Rx timeout')
+
+ if ether.haslayer(ICMPv6ND_NS):
+ # read another packet in the queue in case of ICMPv6ND_NS packet
+ continue
+ else:
+ # otherwise process the current packet
+ break
if ether is None:
raise RuntimeError("ICMP echo Rx timeout")
if not ether.haslayer(ip_format):
- raise RuntimeError("Not an IP packet received {0}"
- .format(ether.__repr__()))
+ raise RuntimeError("Not an IP packet received {0}".
+ format(ether.__repr__()))
- if ether['Ethernet'].src != dut_if2_mac:
+ if ether[Ether].src != dut_if2_mac:
raise RuntimeError("Source MAC address error")
- if ether['Ethernet'].dst == path_1_mac:
+ if ether[Ether].dst == path_1_mac:
path_1_counter += 1
- elif ether['Ethernet'].dst == path_2_mac:
+ elif ether[Ether].dst == path_2_mac:
path_2_counter += 1
else:
raise RuntimeError("Destination MAC address error")
if (path_1_counter + path_2_counter) != 100:
- raise RuntimeError("Packet loss: recevied only {} packets of 100 "
- .format(path_1_counter + path_2_counter))
+ raise RuntimeError("Packet loss: recevied only {} packets of 100 ".
+ format(path_1_counter + path_2_counter))
if path_1_counter == 0:
raise RuntimeError("Path 1 error!")
@@ -127,5 +137,6 @@ def main():
sys.exit(0)
+
if __name__ == "__main__":
main()