From a05e1e653a85f61fd8f19522ebed12e999d19698 Mon Sep 17 00:00:00 2001 From: catvayor Date: Sat, 7 Dec 2024 19:48:28 +0100 Subject: [PATCH] feat: support ex4100-f-48P, ex4400-24X & ex4400-em-4Y --- ex4100-f-48P.nix | 96 ++++++++++++++++++++++++++++++++++++++++++++++++ ex4400-24X.nix | 43 ++++++++++++++++++++++ ex4400-em-4Y.nix | 17 +++++++++ netconf-hive.nix | 78 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 234 insertions(+) create mode 100644 ex4100-f-48P.nix create mode 100644 ex4400-24X.nix create mode 100644 ex4400-em-4Y.nix diff --git a/ex4100-f-48P.nix b/ex4100-f-48P.nix new file mode 100644 index 0000000..65484ea --- /dev/null +++ b/ex4100-f-48P.nix @@ -0,0 +1,96 @@ +{ lib, ... }: +let + poe = [ + "ge-0/0/0" + "ge-0/0/1" + "ge-0/0/2" + "ge-0/0/3" + "ge-0/0/4" + "ge-0/0/5" + "ge-0/0/6" + "ge-0/0/7" + "ge-0/0/8" + "ge-0/0/9" + "ge-0/0/10" + "ge-0/0/11" + "ge-0/0/12" + "ge-0/0/13" + "ge-0/0/14" + "ge-0/0/15" + "ge-0/0/16" + "ge-0/0/17" + "ge-0/0/18" + "ge-0/0/19" + "ge-0/0/20" + "ge-0/0/21" + "ge-0/0/22" + "ge-0/0/23" + "ge-0/0/24" + "ge-0/0/25" + "ge-0/0/26" + "ge-0/0/27" + "ge-0/0/28" + "ge-0/0/29" + "ge-0/0/30" + "ge-0/0/31" + "ge-0/0/32" + "ge-0/0/33" + "ge-0/0/34" + "ge-0/0/35" + "ge-0/0/36" + "ge-0/0/37" + "ge-0/0/38" + "ge-0/0/39" + "ge-0/0/40" + "ge-0/0/41" + "ge-0/0/42" + "ge-0/0/43" + "ge-0/0/44" + "ge-0/0/45" + "ge-0/0/46" + "ge-0/0/47" + ]; + non_poe = [ + # sfp ports + "ge-0/1/0" + "ge-0/1/1" + "ge-0/1/2" + "ge-0/1/3" + + "xe-0/1/0" + "xe-0/1/1" + "xe-0/1/2" + "xe-0/1/3" + + "et-0/1/0" + "et-0/1/1" + "et-0/1/2" + "et-0/1/3" + + # uplink block + "ge-0/2/0" + "ge-0/2/1" + "ge-0/2/2" + "ge-0/2/3" + + "xe-0/2/0" + "xe-0/2/1" + "xe-0/2/2" + "xe-0/2/3" + ]; +in +{ + netconf.mandatoryInterfaces = + lib.listToAttrs ( + map (name: { + inherit name; + value.supportPoE = true; + }) poe + ) + // lib.listToAttrs ( + map (name: { + inherit name; + value.supportPoE = false; + }) non_poe + ); +} diff --git a/ex4400-24X.nix b/ex4400-24X.nix new file mode 100644 index 0000000..6170f94 --- /dev/null +++ b/ex4400-24X.nix @@ -0,0 +1,43 @@ +{ lib, ... }: +let + gexe = [ + "0/0" + "0/1" + "0/2" + "0/3" + "0/4" + "0/5" + "0/6" + "0/7" + "0/8" + "0/9" + "0/10" + "0/11" + "0/12" + "0/13" + "0/14" + "0/15" + "0/16" + "0/17" + "0/18" + "0/19" + "0/20" + "0/21" + "0/22" + "0/23" + ]; + ge = gexe; + xe = gexe; + et = [ + "1/0" + "1/1" + ]; +in +{ + netconf.mandatoryInterfaces = lib.listToAttrs ( + map (name: { + inherit name; + value.supportPoE = false; + }) (map (i: "ge-0/" + i) ge ++ map (i: "xe-0/" + i) xe ++ map (i: "et-0/" + i) et) + ); +} diff --git a/ex4400-em-4Y.nix b/ex4400-em-4Y.nix new file mode 100644 index 0000000..24cfc75 --- /dev/null +++ b/ex4400-em-4Y.nix @@ -0,0 +1,17 @@ +{ lib, ... }: +let + full = [ + "2/0" + "2/1" + "2/2" + "2/3" + ]; +in +{ + netconf.mandatoryInterfaces = lib.listToAttrs ( + map (name: { + inherit name; + value.supportPoE = false; + }) (map (i: "ge-0/" + i) full ++ map (i: "xe-0/" + i) full ++ map (i: "et-0/" + i) full) + ); +} diff --git a/netconf-hive.nix b/netconf-hive.nix index 44f07b4..c156bd2 100644 --- a/netconf-hive.nix +++ b/netconf-hive.nix @@ -161,4 +161,82 @@ in "irb".inet6.addresses = [ "fd26:baf9:d250:8000::2001/64" ]; }; }; + + netaccess00 = { + deployment.targetHost = "netaccess00.dgn"; + + imports = [ + ./ex4100-f-48P.nix + default + ]; + + dgn-interfaces = + let + admin-intf.ethernet-switching = { + interface-mode = "trunk"; + vlans = [ "all" ]; + }; + in + { + "xe-0/1/0" = admin-intf; + "ge-0/1/0" = admin-intf; + "et-0/1/0" = admin-intf; + "xe-0/1/1" = admin-intf; + "ge-0/1/1" = admin-intf; + "et-0/1/1" = admin-intf; + "xe-0/1/2" = admin-intf; + "ge-0/1/2" = admin-intf; + "et-0/1/2" = admin-intf; + "xe-0/1/3" = admin-intf; + "ge-0/1/3" = admin-intf; + "et-0/1/3" = admin-intf; + + "xe-0/2/0" = admin-intf; + "ge-0/2/0" = admin-intf; + "xe-0/2/1" = admin-intf; + "ge-0/2/1" = admin-intf; + "xe-0/2/2" = admin-intf; + "ge-0/2/2" = admin-intf; + "xe-0/2/3" = admin-intf; + "ge-0/2/3" = admin-intf; + + "ge-0/0/47".ethernet-switching = { + interface-mode = "trunk"; + vlans = [ "all" ]; + }; + + # management + "me0".inet.addresses = [ "192.168.2.2/24" ]; + "irb".inet6.addresses = [ "fd26:baf9:d250:8000::200f/64" ]; + }; + }; + + netcore00 = { + deployment.targetHost = "netcore00.dgn"; + + imports = [ + ./ex4400-24X.nix + ./ex4400-em-4Y.nix + default + ]; + + dgn-interfaces = + let + admin-intf.ethernet-switching = { + interface-mode = "trunk"; + vlans = [ "all" ]; + }; + in + { + "xe-0/2/0" = admin-intf; + "ge-0/2/0" = admin-intf; + "et-0/2/0" = admin-intf; + + "ge-0/0/22" = admin-intf; + "xe-0/0/22" = admin-intf; + + "me0".inet.addresses = [ "192.168.2.3/24" ]; + "irb".inet6.addresses = [ "fd26:baf9:d250:8000::100f/64" ]; + }; + }; }