1 import ./make-test-python.nix ({ pkgs, ... }:
3 ifAddr = node: iface: (pkgs.lib.head node.config.networking.interfaces.${iface}.ipv4.addresses).address;
7 meta = with pkgs.lib.maintainers; { maintainers = [ higebu ]; };
10 node1 = { nodes, ... }: {
11 environment.systemPackages = [ pkgs.gobgp ];
12 networking.firewall.allowedTCPPorts = [ 179 ];
19 router-id = "192.168.255.1";
24 neighbor-address = ifAddr nodes.node2 "eth1";
31 node2 = { nodes, ... }: {
32 environment.systemPackages = [ pkgs.gobgp ];
33 networking.firewall.allowedTCPPorts = [ 179 ];
40 router-id = "192.168.255.2";
45 neighbor-address = ifAddr nodes.node1 "eth1";
54 testScript = { nodes, ... }: let
55 addr1 = ifAddr nodes.node1 "eth1";
56 addr2 = ifAddr nodes.node2 "eth1";
61 for node in node1, node2:
62 with subtest("should start gobgpd node"):
63 node.wait_for_unit("gobgpd.service")
64 with subtest("should open port 179"):
65 node.wait_for_open_port(179)
67 with subtest("should show neighbors by gobgp cli and BGP state should be ESTABLISHED"):
68 node1.wait_until_succeeds("gobgp neighbor ${addr2} | grep -q ESTABLISHED")
69 node2.wait_until_succeeds("gobgp neighbor ${addr1} | grep -q ESTABLISHED")