Ip6GreNetnsTunnelRecipe

class lnst.Recipes.ENRT.Ip6GreNetnsTunnelRecipe.Ip6GreNetnsTunnelRecipe(**kwargs)

Bases: MTUHWConfigMixin, PauseFramesHWConfigMixin, OffloadSubConfigMixin, BaseTunnelRecipe

This class implements a recipe that configures a IP6GRE tunnel between two network namespaces on two hosts.

                     .--------.
        .------------| switch |--------.
        |            '--------'        |
        |                              |
.-------|------------.         .-------|------------.
|    .--'---.        |         |    .--'---.        |
|    | eth0 |        |         |    | eth0 |        |
|    '------'        |         |    '------'        |
|       \            |         |       \            |
|        .--------.  |         |        .--------.  |
|        | bridge |  |         |        | bridge |  |
|        '--------'  |         |        '--------'  |
|       /            |         |       /            |
|   .-------.        |         |   .-------.        |
|   | veth0 |        |         |   | veth0 |        |
|   '--.----'        |         |   '--.----'        |
|  .----\---------.  |         |  .----\---------.  |
|  |     \  netns |  |         |  |     \  netns |  |
|  |  .---\---.   |  |         |  |  .---\---.   |  |
|  |  |veth0_1|   |  |         |  |  |veth0_1|   |  |
|  |  '-------'   |  |         |  |  '-------'   |  |
|  |      | |     |  |         |  |      | |     |  |
|  |  ----' '---- |  |         |  |  ----' '---- |  |
|  |  gre6 tunnel |  |         |  |  gre6 tunnel |  |
|  |  ----------- |  |         |  |  ----------- |  |
|  '--------------'  |         |  '--------------'  |
|                    |         |                    |
|        host1       |         |        host1       |
'--------------------'         '--------------------'

The actual test machinery is implemented in the BaseEnrtRecipe class.

The test wide configuration is implemented in the BaseTunnelRecipe class.

configure_underlying_network(config: EnrtConfiguration) tuple[RemoteDevice, RemoteDevice]

The underlying network for the tunnel consists of

  • an Ethernet device on each of the matched hosts

  • a pair of veth devices on each host with one end of the pair connected to Ethernet device through bridge and the second one moved to a network namespace

The veth devices in the namespaces are assigned an IPv6 address and will be used as tunnel endpoints

create_tunnel(config: EnrtConfiguration, tunnel_endpoints: tuple[RemoteDevice, RemoteDevice]) tuple[RemoteDevice, RemoteDevice]

The GRE tunnel devices are created in the network namespaces and configured with local and remote ip addresses matching the veth devices IP addresses.

The IP6GRE tunnel devices are configured with IPv4 and IPv6 addresses of individual networks. Routes are configured accordingly.

generate_ping_endpoints(config)

The ping endpoints for this recipe are simply the tunnel endpoints

Returned as:

[PingEndpoints(self.matched.host1.newns.gre6_tunnel, self.matched.host2.newns.gre6_tunnel)]
get_packet_assert_config(ping_config)

The packet assert test configuration contains filter for ip6 protocol and grep patterns to match the ICMP or ICMP6 echo requests encapsulated by GRE.