diff options
Diffstat (limited to 'test/test_ip6.py')
-rw-r--r-- | test/test_ip6.py | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/test/test_ip6.py b/test/test_ip6.py index e6067f67dd9..99c63873afb 100644 --- a/test/test_ip6.py +++ b/test/test_ip6.py @@ -1169,6 +1169,7 @@ class TestICMPv6Echo(VppTestCase): for i in self.pg_interfaces: i.admin_up() i.config_ip6() + i.resolve_ndp(link_layer=True) i.resolve_ndp() def tearDown(self): @@ -1186,39 +1187,34 @@ class TestICMPv6Echo(VppTestCase): - Check outgoing ICMPv6 Echo Reply message on pg0 interface. """ - icmpv6_id = 0xb - icmpv6_seq = 5 - icmpv6_data = b'\x0a' * 18 - p_echo_request = (Ether(src=self.pg0.remote_mac, - dst=self.pg0.local_mac) / - IPv6(src=self.pg0.remote_ip6, - dst=self.pg0.local_ip6) / - ICMPv6EchoRequest( - id=icmpv6_id, - seq=icmpv6_seq, - data=icmpv6_data)) - - self.pg0.add_stream(p_echo_request) + # test both with global and local ipv6 addresses + dsts = (self.pg0.local_ip6, self.pg0.local_ip6_ll) + id = 0xb + seq = 5 + data = b'\x0a' * 18 + p = list() + for dst in dsts: + p.append((Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac) / + IPv6(src=self.pg0.remote_ip6, dst=dst) / + ICMPv6EchoRequest(id=id, seq=seq, data=data))) + + self.pg0.add_stream(p) self.pg_enable_capture(self.pg_interfaces) self.pg_start() - - rx = self.pg0.get_capture(1) - rx = rx[0] - ether = rx[Ether] - ipv6 = rx[IPv6] - icmpv6 = rx[ICMPv6EchoReply] - - self.assertEqual(ether.src, self.pg0.local_mac) - self.assertEqual(ether.dst, self.pg0.remote_mac) - - self.assertEqual(ipv6.src, self.pg0.local_ip6) - self.assertEqual(ipv6.dst, self.pg0.remote_ip6) - - self.assertEqual( - icmp6types[icmpv6.type], "Echo Reply") - self.assertEqual(icmpv6.id, icmpv6_id) - self.assertEqual(icmpv6.seq, icmpv6_seq) - self.assertEqual(icmpv6.data, icmpv6_data) + rxs = self.pg0.get_capture(len(dsts)) + + for rx, dst in zip(rxs, dsts): + ether = rx[Ether] + ipv6 = rx[IPv6] + icmpv6 = rx[ICMPv6EchoReply] + self.assertEqual(ether.src, self.pg0.local_mac) + self.assertEqual(ether.dst, self.pg0.remote_mac) + self.assertEqual(ipv6.src, dst) + self.assertEqual(ipv6.dst, self.pg0.remote_ip6) + self.assertEqual(icmp6types[icmpv6.type], "Echo Reply") + self.assertEqual(icmpv6.id, id) + self.assertEqual(icmpv6.seq, seq) + self.assertEqual(icmpv6.data, data) class TestIPv6RD(TestIPv6ND): |