2 import ./make-test-python.nix ({ pkgs, lib, ...} : {
4 meta = with pkgs.lib.maintainers; {
5 maintainers = [ hexa ];
9 { client = { pkgs, lib, ... }:
11 virtualisation.vlans = [ 10 ];
16 ipv4.addresses = lib.mkForce [ { address = "192.168.10.2"; prefixLength = 24; } ];
17 ipv4.routes = lib.mkForce [ { address = "0.0.0.0"; prefixLength = 0; via = "192.168.10.1"; } ];
18 ipv6.addresses = lib.mkForce [ { address = "2001:db8:10::2"; prefixLength = 64; } ];
19 ipv6.routes = lib.mkForce [ { address = "::"; prefixLength = 0; via = "2001:db8:10::1"; } ];
24 local_router = { pkgs, lib, ... }:
26 virtualisation.vlans = [ 10 20 ];
30 firewall.enable = false;
33 ipv4.addresses = lib.mkForce [ { address = "192.168.10.1"; prefixLength = 24; } ];
34 ipv6.addresses = lib.mkForce [ { address = "2001:db8:10::1"; prefixLength = 64; } ];
38 ipv4.addresses = lib.mkForce [ { address = "192.168.20.1"; prefixLength = 24; } ];
39 ipv6.addresses = lib.mkForce [ { address = "2001:db8:20::1"; prefixLength = 64; } ];
50 local-port-readwrite 33123
52 import-table 254 # main
53 export-table 254 # main
55 in ip 192.168.10.0/24 deny
56 in ip 192.168.20.0/24 deny
57 in ip 2001:db8:10::/64 deny
58 in ip 2001:db8:20::/64 deny
60 in ip 192.168.30.0/24 allow
61 in ip 2001:db8:30::/64 allow
65 redistribute local proto 2
66 redistribute local deny
70 remote_router = { pkgs, lib, ... }:
72 virtualisation.vlans = [ 20 30 ];
76 firewall.enable = false;
79 ipv4.addresses = lib.mkForce [ { address = "192.168.20.2"; prefixLength = 24; } ];
80 ipv6.addresses = lib.mkForce [ { address = "2001:db8:20::2"; prefixLength = 64; } ];
84 ipv4.addresses = lib.mkForce [ { address = "192.168.30.1"; prefixLength = 24; } ];
85 ipv6.addresses = lib.mkForce [ { address = "2001:db8:30::1"; prefixLength = 64; } ];
96 local-port-readwrite 33123
98 import-table 254 # main
99 export-table 254 # main
101 in ip 192.168.20.0/24 deny
102 in ip 192.168.30.0/24 deny
103 in ip 2001:db8:20::/64 deny
104 in ip 2001:db8:30::/64 deny
106 in ip 192.168.10.0/24 allow
107 in ip 2001:db8:10::/64 allow
111 redistribute local proto 2
112 redistribute local deny
123 local_router.wait_for_unit("babeld.service")
124 remote_router.wait_for_unit("babeld.service")
126 local_router.wait_until_succeeds("ip route get 192.168.30.1")
127 local_router.wait_until_succeeds("ip route get 2001:db8:30::1")
129 remote_router.wait_until_succeeds("ip route get 192.168.10.1")
130 remote_router.wait_until_succeeds("ip route get 2001:db8:10::1")
132 client.succeed("ping -c1 192.168.30.1")
133 client.succeed("ping -c1 2001:db8:30::1")
135 remote_router.succeed("ping -c1 192.168.10.2")
136 remote_router.succeed("ping -c1 2001:db8:10::2")