summaryrefslogtreecommitdiffstats
path: root/test/vpp_pg_interface.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/vpp_pg_interface.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/vpp_pg_interface.py')
-rwxr-xr-xtest/vpp_pg_interface.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/test/vpp_pg_interface.py b/test/vpp_pg_interface.py
index 4858aa7aef7..c4b2e0a96db 100755
--- a/test/vpp_pg_interface.py
+++ b/test/vpp_pg_interface.py
@@ -442,14 +442,16 @@ class VppPGInterface(VppInterface):
ARP(op=ARP.who_has, pdst=self.local_ip4,
psrc=self.remote_ip4, hwsrc=self.remote_mac))
- def create_ndp_req(self):
+ def create_ndp_req(self, addr=None):
"""Create NDP - NS applicable for this interface"""
- nsma = in6_getnsma(inet_pton(socket.AF_INET6, self.local_ip6))
+ if not addr:
+ addr = self.local_ip6
+ nsma = in6_getnsma(inet_pton(socket.AF_INET6, addr))
d = inet_ntop(socket.AF_INET6, nsma)
return (Ether(dst=in6_getnsmac(nsma)) /
IPv6(dst=d, src=self.remote_ip6) /
- ICMPv6ND_NS(tgt=self.local_ip6) /
+ ICMPv6ND_NS(tgt=addr) /
ICMPv6NDOptSrcLLAddr(lladdr=self.remote_mac))
def resolve_arp(self, pg_interface=None):
@@ -488,19 +490,22 @@ class VppPGInterface(VppInterface):
ppp("Unexpected response to ARP request:", captured_packet))
raise
- def resolve_ndp(self, pg_interface=None, timeout=1):
+ def resolve_ndp(self, pg_interface=None, timeout=1, link_layer=False):
"""Resolve NDP using provided packet-generator interface
:param pg_interface: interface used to resolve, if None then this
interface is used
:param timeout: how long to wait for response before giving up
+ :param link_layer: resolve for global address if False (default)
+ or for link-layer address if True
"""
if pg_interface is None:
pg_interface = self
+ addr = self.local_ip6_ll if link_layer else self.local_ip6
self.test.logger.info("Sending NDP request for %s on port %s" %
- (self.local_ip6, pg_interface.name))
- ndp_req = self.create_ndp_req()
+ (addr, pg_interface.name))
+ ndp_req = self.create_ndp_req(addr)
pg_interface.add_stream(ndp_req)
pg_interface.enable_capture()
self.test.pg_start()