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