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