infrastructure/modules/netconf/dgn-isp.nix
catvayor 1ed3749c33
feat(netconf/dgn-isp): init
module to make isp switches description easier
2025-02-05 14:20:00 +01:00

97 lines
1.8 KiB
Nix

# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin.bailly@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{
config,
lib,
...
}:
let
inherit (lib)
mkEnableOption
mkIf
mkOption
;
inherit (lib.types)
listOf
str
;
cfg = config.dgn-isp;
in
{
options.dgn-isp = {
enable = mkEnableOption "Common isp configuration";
AP = mkOption {
type = listOf str;
default = [ ];
description = ''
Interfaces connected to one of our Access Point.
'';
};
staging-AP = mkOption {
type = listOf str;
default = [ ];
description = ''
Interfaces connected to one of our Access Point being deployed.
'';
};
admin-ip = mkOption {
type = str;
description = ''
Administrative IPv6.
'';
};
};
config = mkIf cfg.enable {
vlans = {
"uplink-cri".id = 223;
"admin-core" = {
id = 3000;
l3-interface = "irb.0";
};
"admin-ap".id = 3001;
"users".id-list = [
{
begin = 3045;
end = 4094;
}
];
"ap-staging".id = 2000;
"hypervisor".id = 2001;
};
dgn-interfaces."irb".inet6.addresses = [ cfg.admin-ip ];
dgn-profiles = {
AP = {
interfaces = cfg.AP;
configuration = {
poe = true;
ethernet-switching = {
interface-mode = "trunk";
vlans = [
"users"
"admin-ap"
];
};
};
};
staging-AP = {
interfaces = cfg.staging-AP;
configuration = {
poe = true;
ethernet-switching = {
interface-mode = "access";
vlans = [ "ap-staging" ];
};
};
};
};
};
}