+ def test_gre6(self):
+ """ GRE IPv6 tunnel Tests """
+
+ self.pg1.config_ip6()
+ self.pg1.resolve_ndp()
+
+ #
+ # Create an L3 GRE tunnel.
+ # - set it admin up
+ # - assign an IP Address
+ # - Add a route via the tunnel
+ #
+ gre_if = VppGreInterface(self,
+ self.pg2.local_ip6,
+ "1002::1")
+ gre_if.add_vpp_config()
+ gre_if.admin_up()
+ gre_if.config_ip6()
+
+ route_via_tun = VppIpRoute(self, "4004::1", 128,
+ [VppRoutePath("0::0",
+ gre_if.sw_if_index)])
+
+ route_via_tun.add_vpp_config()
+
+ #
+ # Send a packet stream that is routed into the tunnel
+ # - they are all dropped since the tunnel's destintation IP
+ # is unresolved - or resolves via the default route - which
+ # which is a drop.
+ #
+ tx = self.create_stream_ip6(self.pg2, "5005::1", "4004::1")
+ self.send_and_assert_no_replies(
+ self.pg2, tx,
+ "GRE packets forwarded without DIP resolved")
+
+ #
+ # Add a route that resolves the tunnel's destination
+ #
+ route_tun_dst = VppIpRoute(self, "1002::1", 128,
+ [VppRoutePath(self.pg2.remote_ip6,
+ self.pg2.sw_if_index)])
+ route_tun_dst.add_vpp_config()
+
+ #
+ # Send a packet stream that is routed into the tunnel
+ # - packets are GRE encapped
+ #
+ tx = self.create_stream_ip6(self.pg2, "5005::1", "4004::1")
+ rx = self.send_and_expect(self.pg2, tx, self.pg2)
+ self.verify_tunneled_6o6(self.pg2, rx, tx,
+ self.pg2.local_ip6, "1002::1")
+
+ #
+ # Test decap. decapped packets go out pg1
+ #
+ tx = self.create_tunnel_stream_6o6(self.pg2,
+ "1002::1",
+ self.pg2.local_ip6,
+ "2001::1",
+ self.pg1.remote_ip6)
+ rx = self.send_and_expect(self.pg2, tx, self.pg1)
+
+ #
+ # RX'd packet is UDP over IPv6, test the GRE header is gone.
+ #
+ self.assertFalse(rx[0].haslayer(GRE))
+ self.assertEqual(rx[0][IPv6].dst, self.pg1.remote_ip6)
+
+ #
+ # Send v4 over v6
+ #
+ route4_via_tun = VppIpRoute(self, "1.1.1.1", 32,
+ [VppRoutePath("0.0.0.0",
+ gre_if.sw_if_index)])
+ route4_via_tun.add_vpp_config()
+
+ tx = self.create_stream_ip4(self.pg0, "1.1.1.2", "1.1.1.1")
+ rx = self.send_and_expect(self.pg0, tx, self.pg2)
+
+ self.verify_tunneled_4o6(self.pg0, rx, tx,
+ self.pg2.local_ip6, "1002::1")
+
+ #
+ # test case cleanup
+ #
+ route_tun_dst.remove_vpp_config()
+ route_via_tun.remove_vpp_config()
+ route4_via_tun.remove_vpp_config()
+ gre_if.remove_vpp_config()
+
+ self.pg2.unconfig_ip6()
+ self.pg1.unconfig_ip6()
+