VxlanNetnsTunnelRecipe

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

Bases: PauseFramesHWConfigMixin, OffloadSubConfigMixin, BaseTunnelRecipe

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

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

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 IPv4 address and will be used as tunnel endpoints

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

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

The VXLAN 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.vxlan_tunnel, self.matched.host2.newns.vxlan_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 VXLAN.