From e11dce20c99775884877ad6dcf879e8995c78ebf Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Tue, 17 Dec 2019 00:14:26 +0000 Subject: nhrp: mGREv6 Type: test Change-Id: I7d0496c37e06d3b6eee325a262e5398860282b63 Signed-off-by: Neale Ranns --- MAINTAINERS | 5 ++++ src/vnet/nhrp/nhrp.c | 9 +++--- test/test_gre.py | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 4 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index ef3f6520476..32b8914a4cd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -181,6 +181,11 @@ I: cop M: Dave Barach F: src/vnet/cop/ +VNET NHRP +I: nhrp +M: Neale Ranns +F: src/vnet/nhrp/ + Crypto IA32 Plugin I: crypto-ia32 M: Damjan Marion diff --git a/src/vnet/nhrp/nhrp.c b/src/vnet/nhrp/nhrp.c index 6a616ba273d..a89f6cd9459 100644 --- a/src/vnet/nhrp/nhrp.c +++ b/src/vnet/nhrp/nhrp.c @@ -154,10 +154,11 @@ format_nhrp_entry (u8 * s, va_list * args) ne = nhrp_entry_get (nei); s = format (s, "[%d] ", nei); - s = format (s, "%U:%U ", format_vnet_sw_if_index_name, - vnm, ne->ne_key->nk_sw_if_index, - format_ip46_address, &ne->ne_key->nk_peer, IP46_TYPE_ANY); - s = format (s, "via %d:%U", + s = format (s, "%U:", format_vnet_sw_if_index_name, + vnm, ne->ne_key->nk_sw_if_index); + s = format (s, " %U", format_ip46_address, + &ne->ne_key->nk_peer, IP46_TYPE_ANY); + s = format (s, " via [%d]:%U", fib_table_get_table_id (ne->ne_fib_index, ne->ne_nh.fp_proto), format_fib_prefix, &ne->ne_nh); diff --git a/test/test_gre.py b/test/test_gre.py index c28c04b988c..96fe3042b4e 100644 --- a/test/test_gre.py +++ b/test/test_gre.py @@ -1050,6 +1050,84 @@ class TestGRE(VppTestCase): gre_if.admin_down() gre_if.unconfig_ip4() + def test_mgre6(self): + """ mGRE IPv6 tunnel Tests """ + + self.pg0.ip6_enable() + + for itf in self.pg_interfaces[3:]: + # + # one underlay nh for each overlay/tunnel peer + # + itf.config_ip6() + itf.generate_remote_hosts(4) + itf.configure_ipv6_neighbors() + + # + # Create an L3 GRE tunnel. + # - set it admin up + # - assign an IP Addres + # - Add a route via the tunnel + # + gre_if = VppGreInterface(self, + itf.local_ip6, + "::", + mode=(VppEnum.vl_api_gre_tunnel_mode_t. + GRE_API_TUNNEL_MODE_MP)) + gre_if.add_vpp_config() + gre_if.admin_up() + gre_if.config_ip6() + gre_if.generate_remote_hosts(4) + + # + # for-each peer + # + for ii in range(1, 4): + route_addr = "4::%d" % ii + + # + # route traffic via the peer + # + route_via_tun = VppIpRoute( + self, route_addr, 128, + [VppRoutePath(gre_if._remote_hosts[ii].ip6, + gre_if.sw_if_index)]) + route_via_tun.add_vpp_config() + + # + # Add a NHRP entry resolves the peer + # + nhrp = VppNhrp(self, gre_if, + gre_if._remote_hosts[ii].ip6, + itf._remote_hosts[ii].ip6) + nhrp.add_vpp_config() + + # + # Send a packet stream that is routed into the tunnel + # - packets are GRE encapped + # + tx = self.create_stream_ip6(self.pg0, "5::5", route_addr) + rx = self.send_and_expect(self.pg0, tx, itf) + self.verify_tunneled_6o6(self.pg0, rx, tx, + itf.local_ip6, + gre_if._remote_hosts[ii].ip6) + + # + # delete and re-add the NHRP + # + nhrp.remove_vpp_config() + self.send_and_assert_no_replies(self.pg0, tx) + + nhrp.add_vpp_config() + rx = self.send_and_expect(self.pg0, tx, itf) + self.verify_tunneled_6o6(self.pg0, rx, tx, + itf.local_ip6, + gre_if._remote_hosts[ii].ip6) + gre_if.admin_down() + gre_if.unconfig_ip4() + itf.unconfig_ip6() + self.pg0.ip6_disable() + if __name__ == '__main__': unittest.main(testRunner=VppTestRunner) -- cgit 1.2.3-korg