From 733f04258dd709ce4a704a1511e35b6ec16315f6 Mon Sep 17 00:00:00 2001 From: Astro Date: Sun, 7 Nov 2021 03:21:39 +0100 Subject: [PATCH] pkgs/network-graphs: add up* to physical-graph --- nix/pkgs/network-graphs.nix | 24 +++++++++++++++--------- salt-pillar/vlans/init.sls | 2 +- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/nix/pkgs/network-graphs.nix b/nix/pkgs/network-graphs.nix index ea5dde9..5dea150 100644 --- a/nix/pkgs/network-graphs.nix +++ b/nix/pkgs/network-graphs.nix @@ -7,13 +7,10 @@ let then "grey" else if net == "mgmt" then "brown" - else if net == "c3d2" - then "orange" - else if net == "serv" - then "orange2" - else if net == "pub" + else if builtins.elem net [ "c3d2" "serv" "cluster" ] then "green" - else if builtins.match "up.+" net != null + else if builtins.match "up.+" net != null || + builtins.match "anon.+" net != null then "red" else if builtins.match "priv.+" net != null then "blue" @@ -108,16 +105,25 @@ in rec { lib.filterAttrs (_: { links, ... }: links != {} ) config.site.hosts + ) // builtins.mapAttrs (_: _: { + shape = "circle"; + }) ( + lib.filterAttrs (net: _: + builtins.match "up.*" net != null + ) config.site.net ); links = builtins.concatMap (hostName: map (link: { pair = [ hostName link ]; - startLabel = lib.concatStringsSep "," - config.site.hosts.${hostName}.links.${link}.ports; + startLabel = ( #lib.optionalString (config.site.hosts.${hostName}.links ? ${link}) ( + lib.concatStringsSep "," + config.site.hosts.${hostName}.links.${link}.ports + ); }) ( builtins.filter (link: - config.site.hosts ? ${link} + config.site.hosts ? ${link} || + builtins.trace "link ${hostName} ${link}" (builtins.match "up.*" link != null) ) (builtins.attrNames config.site.hosts.${hostName}.links) ) ) (builtins.attrNames config.site.hosts); diff --git a/salt-pillar/vlans/init.sls b/salt-pillar/vlans/init.sls index 94fceb8..2a424f9 100644 --- a/salt-pillar/vlans/init.sls +++ b/salt-pillar/vlans/init.sls @@ -12,7 +12,7 @@ vlans: cluster: 6 bmx: 7 # Modems -{%- for i in range(1, 9) %} +{%- for i in range(1, 5) %} up{{ i }}: {{ i + 9 }} {%- endfor %} # Neighbor subnets