summaryrefslogtreecommitdiffstats
path: root/test/test_ip6.py
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2021-01-18 19:25:38 +0100
committerNeale Ranns <neale@graphiant.com>2021-01-20 13:53:33 +0000
commit2699fe2ba8fcad06ce04715049e9a55587f02f1f (patch)
tree58686ffffd4ffc25f6262ef0ca586b3c16088ed7 /test/test_ip6.py
parent58a1915b501845c47676d529ff3b5840a876e39d (diff)
ip: add IPv6 ping test for link-layer address
Type: improvement Change-Id: I9f60e29462c7cb193a8594b7de06418b40573103 Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'test/test_ip6.py')
-rw-r--r--test/test_ip6.py58
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):