pkgs/network-graphs: add up* to physical-graph

This commit is contained in:
Astro 2021-11-07 03:21:39 +01:00
parent f0c5f1d398
commit 733f04258d
2 changed files with 16 additions and 10 deletions

View File

@ -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);

View File

@ -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