1{ pkgs, lib, ... }:
2
3{
4 name = "fastnetmon-advanced";
5 meta.maintainers = lib.teams.wdz.members;
6
7 nodes = {
8 bird = { ... }: {
9 networking.firewall.allowedTCPPorts = [ 179 ];
10 services.bird2 = {
11 enable = true;
12 config = ''
13 router id 192.168.1.1;
14
15 protocol bgp fnm {
16 local 192.168.1.1 as 64513;
17 neighbor 192.168.1.2 as 64514;
18 multihop;
19 ipv4 {
20 import all;
21 export none;
22 };
23 }
24 '';
25 };
26 };
27 fnm = { ... }: {
28 networking.firewall.allowedTCPPorts = [ 179 ];
29 services.fastnetmon-advanced = {
30 enable = true;
31 settings = {
32 networks_list = [ "172.23.42.0/24" ];
33 gobgp = true;
34 gobgp_flow_spec_announces = true;
35 };
36 bgpPeers = {
37 bird = {
38 local_asn = 64514;
39 remote_asn = 64513;
40 local_address = "192.168.1.2";
41 remote_address = "192.168.1.1";
42
43 description = "Bird";
44 ipv4_unicast = true;
45 multihop = true;
46 active = true;
47 };
48 };
49 };
50 };
51 };
52
53 testScript = { nodes, ... }: ''
54 start_all()
55 fnm.wait_for_unit("fastnetmon.service")
56 bird.wait_for_unit("bird2.service")
57
58 fnm.wait_until_succeeds('journalctl -eu fastnetmon.service | grep "BGP daemon restarted correctly"')
59 fnm.wait_until_succeeds("journalctl -eu gobgp.service | grep BGP_FSM_OPENCONFIRM")
60 bird.wait_until_succeeds("birdc show protocol fnm | grep Estab")
61 fnm.wait_until_succeeds('journalctl -eu fastnetmon.service | grep "API server listening"')
62 fnm.succeed("fcli set blackhole 172.23.42.123")
63 bird.succeed("birdc show route | grep 172.23.42.123")
64 '';
65}