python312Packages.homematicip: 1.1.2 -> 1.1.3 (#356780)
[NixPkgs.git] / nixos / tests / birdwatcher.nix
blob5c41b4d0e4f3a672ef68fe8ab3a37f894a629201
1 # This test does a basic functionality check for birdwatcher
3 { system ? builtins.currentSystem
4 , pkgs ? import ../.. { inherit system; config = { }; }
5 }:
7 let
8   inherit (import ../lib/testing-python.nix { inherit system pkgs; }) makeTest;
9   inherit (pkgs.lib) optionalString;
11 makeTest {
12   name = "birdwatcher";
13   nodes = {
14     host1 = {
15       environment.systemPackages = with pkgs; [ jq ];
16       services.bird2 = {
17         enable = true;
18         config = ''
19           log syslog all;
21           debug protocols all;
23           router id 10.0.0.1;
25           protocol device {
26           }
28           protocol kernel kernel4 {
29             ipv4 {
30               import none;
31               export all;
32             };
33           }
35           protocol kernel kernel6 {
36             ipv6 {
37               import none;
38               export all;
39             };
40           }
41         '';
42       };
43       services.birdwatcher = {
44         enable = true;
45         settings = ''
46           [server]
47           allow_from = []
48           allow_uncached = false
49           modules_enabled = ["status",
50                              "protocols",
51                              "protocols_bgp",
52                              "protocols_short",
53                              "routes_protocol",
54                              "routes_peer",
55                              "routes_table",
56                              "routes_table_filtered",
57                              "routes_table_peer",
58                              "routes_filtered",
59                              "routes_prefixed",
60                              "routes_noexport",
61                              "routes_pipe_filtered_count",
62                              "routes_pipe_filtered"
63                             ]
64           [status]
65           reconfig_timestamp_source = "bird"
66           reconfig_timestamp_match = "# created: (.*)"
67           filter_fields = []
68           [bird]
69           listen = "0.0.0.0:29184"
70           config = "/etc/bird/bird2.conf"
71           birdc  = "${pkgs.bird}/bin/birdc"
72           ttl = 5 # time to live (in minutes) for caching of cli output
73           [parser]
74           filter_fields = []
75           [cache]
76           use_redis = false # if not using redis cache, activate housekeeping to save memory!
77           [housekeeping]
78           interval = 5
79           force_release_memory = true
80         '';
81       };
82     };
83   };
85   testScript = ''
86     start_all()
88     host1.wait_for_unit("bird2.service")
89     host1.wait_for_unit("birdwatcher.service")
90     host1.wait_for_open_port(29184)
91     host1.succeed("curl http://[::]:29184/status | jq -r .status.message | grep 'Daemon is up and running'")
92     host1.succeed("curl http://[::]:29184/protocols | jq -r .protocols.device1.state | grep 'up'")
93   '';