bgpwtf: move tests from eoip to gretap
This removes our dependency on a userspace EoIP implementation that is
mildly broken, and that doesn't build correctly on new gcc versions.
Change-Id: I404c79585336ebaf3bc1761b54ee2433f0841324
diff --git a/bgpwtf/machines/modules/eoip.nix b/bgpwtf/machines/modules/eoip.nix
deleted file mode 100644
index 5ce04f3..0000000
--- a/bgpwtf/machines/modules/eoip.nix
+++ /dev/null
@@ -1,75 +0,0 @@
-# A small Ethernet-over-IP service implementation.
-# Yes, that's the Mikrotik EoIP implementation. This one is somewhat sketchy
-# (notably, it pumps huge zero-padded frames into tap), so doesn't use it for
-# production. We currently only use it in the edge01.waw test framework to
-# bring vlans across test VMs.
-
-{ config, pkgs, lib, ... }:
-
-with lib;
-
-let
- eoip = pkgs.stdenv.mkDerivation {
- pname = "eoip";
- version = "20180119";
- nativeBuildInputs = with pkgs; [ cmake ];
- src = pkgs.fetchFromGitHub {
- owner = "amphineko";
- repo = "eoiptapd";
- rev = "5573a905bcbc001b503308665f098e82f451dc33";
- sha256 = "0np9dzcw5w6jarzdv2yh3mbzz0wgw10sjqyi6pxan4ipr75v1b8s";
- };
- installPhase = ''
- mkdir -p $out/bin
- cp eoiptapd $out/bin/eoiptapd
- '';
- };
-
- cfg = config.hscloud.eoip;
-
-in {
- options.hscloud.eoip = {
- interfaces = mkOption {
- type = with types; attrsOf (submodule {
- options = {
- localV4 = mkOption {
- type = types.str;
- description = "Local outer IPv4 address";
- };
- remoteV4 = mkOption {
- type = types.str;
- description = "Remote outer IPv4 address";
- };
- id = mkOption {
- type = types.int;
- description = "Tunnel ID";
- };
- parent = mkOption {
- type = types.str;
- description = "Parent/outer device";
- };
- };
- });
- description = ''
- EoIP interfaces to create.
- '';
- };
- };
-
- config.systemd.services = mapAttrs' (name: value: nameValuePair "${name}-eoip" {
- wantedBy = [ "network.target" ];
- wants = [
- "${name}-netdev.service"
- "network-addresses-${value.parent}.service"
- ];
- after = [
- "network-addresses-${value.parent}.service"
- ];
- serviceConfig = {
- Type = "simple";
- ExecStart = "${eoip}/bin/eoiptapd -i ${name} -l ${value.localV4} -r ${value.remoteV4} -t ${toString value.id}";
- Restart = "always";
- RestartSec = "1";
- };
- }) cfg.interfaces;
-}
diff --git a/bgpwtf/machines/modules/gretap.nix b/bgpwtf/machines/modules/gretap.nix
new file mode 100644
index 0000000..f4e1a7b
--- /dev/null
+++ b/bgpwtf/machines/modules/gretap.nix
@@ -0,0 +1,62 @@
+# Support for GRETap interfaces in NixOS' scripted networking.
+#
+# We currently only use it in the edge01.waw test framework to bring vlans
+# across test VMs.
+
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+ cfg = config.hscloud.gretap;
+
+in {
+ options.hscloud.gretap = {
+ interfaces = mkOption {
+ type = with types; attrsOf (submodule {
+ options = {
+ localV4 = mkOption {
+ type = types.str;
+ description = "Local outer IPv4 address";
+ };
+ remoteV4 = mkOption {
+ type = types.str;
+ description = "Remote outer IPv4 address";
+ };
+ id = mkOption {
+ type = types.int;
+ description = "Tunnel ID";
+ };
+ parent = mkOption {
+ type = types.str;
+ description = "Parent/outer device";
+ };
+ };
+ });
+ description = ''
+ GRETap interfaces to create.
+ '';
+ };
+ };
+
+ config.boot.kernelModules = [ "fou" ];
+ config.systemd.services = mapAttrs' (name: value: nameValuePair "${name}-gretap" {
+ wants = [
+ "${name}-netdev.service"
+ "network-addresses-${value.parent}.service"
+ ];
+ after = [
+ "network-addresses-${value.parent}.service"
+ ];
+ before = [
+ "network-addresses-${name}.service"
+ ];
+ wantedBy = [
+ "network-addresses-${name}.service"
+ ];
+ serviceConfig = {
+ Type = "oneshot";
+ ExecStart = "${pkgs.iproute}/bin/ip link add name ${name} type gretap remote ${value.remoteV4} local ${value.localV4} key ${toString value.id}";
+ };
+ }) cfg.interfaces;
+}
diff --git a/bgpwtf/machines/tests/edge01-waw.nix b/bgpwtf/machines/tests/edge01-waw.nix
index 535418f..1d724e1 100644
--- a/bgpwtf/machines/tests/edge01-waw.nix
+++ b/bgpwtf/machines/tests/edge01-waw.nix
@@ -5,9 +5,9 @@
# - bgpspeaker, which simulates bgp upstreams
# - customs, which simulates customs.hackerspace.pl.
#
-# We use EoIP to build up virtual ethernet links between the machines, and
-# to run VLANs on that. We don't just use plain 'vlans' from NixOS tests as
-# we actually want to run 802.1q ourselves from the edge01 config.
+# We use GRETap to build up virtual ethernet links between the machines, and to
+# run VLANs on that. We don't just use plain 'vlans' from NixOS tests as we
+# actually want to run 802.1q ourselves from the edge01 config.
#
# Everything else is pretty much straightforward. Bring up everything, ping
# stuff. We don't really test much else than internet routing.
@@ -31,19 +31,15 @@
virtualisation.memorySize = 1024;
virtualisation.vlans = [ 1 ];
imports = [
- ../modules/eoip.nix
+ ../modules/gretap.nix
];
- hscloud.eoip.interfaces."nnet" = {
+ hscloud.gretap.interfaces."nnet" = {
parent = "eth1";
localV4 = "192.168.1.3";
remoteV4 = "192.168.1.2";
id = 100;
};
- networking.interfaces."nnet" = {
- virtual = true;
- virtualType = "tap";
- };
networking.vlans = {
"vl-globalmix" = { interface = "nnet"; id = 466; };
};
@@ -142,27 +138,20 @@
dut = { config, pkgs, ... }: {
imports = [
../edge01.waw.bgp.wtf.nix
- ../modules/eoip.nix
+ ../modules/gretap.nix
];
virtualisation.memorySize = 1024;
virtualisation.vlans = [
1 2
];
- hscloud.eoip.interfaces = {
+ hscloud.gretap.interfaces = {
"e1-nnet" = { parent = "eth1"; localV4 = "192.168.1.2"; remoteV4 = "192.168.1.3"; id = 100; };
"e2-customs" = { parent = "eth2"; localV4 = "192.168.2.2"; remoteV4 = "192.168.2.1"; id = 200; };
"e3-mgmt" = { parent = "eth2"; localV4 = "192.168.2.2"; remoteV4 = "192.168.2.111"; id = 300; }; # not connected
"e4-oob" = { parent = "eth2"; localV4 = "192.168.2.2"; remoteV4 = "192.168.2.112"; id = 400; }; # not connected
"e7-dcsw" = { parent = "eth2"; localV4 = "192.168.2.2"; remoteV4 = "192.168.2.113"; id = 500; }; # not connected
};
- networking.interfaces = {
- "e1-nnet" = { virtual = true; virtualType = "tap"; };
- "e2-customs" = { virtual = true; virtualType = "tap"; };
- "e3-mgmt" = { virtual = true; virtualType = "tap"; };
- "e4-oob" = { virtual = true; virtualType = "tap"; };
- "e7-dcsw" = { virtual = true; virtualType = "tap"; };
- };
hscloud.anchorvm = {
blkdev = "/anchor.img";
ram = 32;
@@ -180,7 +169,7 @@
customs = { config, pkgs, ... }: {
imports = [
- ../modules/eoip.nix
+ ../modules/gretap.nix
];
environment.systemPackages = with pkgs; [
tcpdump htop dstat file dhcpcd
@@ -194,12 +183,10 @@
networking.defaultGateway = "185.236.240.4";
networking.defaultGateway6 = "2a0d:eb00:2137:1::2";
networking.interfaces."edge" = {
- virtual = true;
- virtualType = "tap";
ipv4.addresses = [{ address = "185.236.240.5"; prefixLength = 31; }];
ipv6.addresses = [{ address = "2a0d:eb00:2137:1::3"; prefixLength = 127; }];
};
- hscloud.eoip.interfaces."edge" = {
+ hscloud.gretap.interfaces."edge" = {
parent = "eth2";
localV4 = "192.168.2.1";
remoteV4 = "192.168.2.2";