feat(netaccess01): Add
This commit is contained in:
parent
cc9c057529
commit
0481eeb9c6
5 changed files with 118 additions and 52 deletions
13
default.nix
13
default.nix
|
@ -3,7 +3,15 @@
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
lib = pkgs.lib;
|
lib = pkgs.lib;
|
||||||
hive_mod = { lib, config, name, ... }: with lib; {
|
hive_mod =
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
name,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib;
|
||||||
|
{
|
||||||
options.deployment = {
|
options.deployment = {
|
||||||
targetHost = mkOption { type = types.str; };
|
targetHost = mkOption { type = types.str; };
|
||||||
rpc = mkOption {
|
rpc = mkOption {
|
||||||
|
@ -16,8 +24,7 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config.deployment = rec {
|
config.deployment = rec {
|
||||||
rpc =
|
rpc = pkgs.writeText "config-${name}_rpc.xml" ''
|
||||||
pkgs.writeText "config-${name}_rpc.xml" ''
|
|
||||||
<rpc>
|
<rpc>
|
||||||
<edit-config>
|
<edit-config>
|
||||||
<config>
|
<config>
|
||||||
|
|
|
@ -9,7 +9,9 @@ let
|
||||||
{ name, config, ... }:
|
{ name, config, ... }:
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
enable = mkEnableOption "the logical interface ${intf-name}.${name}" // { default = true; };
|
enable = mkEnableOption "the logical interface ${intf-name}.${name}" // {
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
family = {
|
family = {
|
||||||
ethernet-switching = {
|
ethernet-switching = {
|
||||||
enable = mkEnableOption "the ethernet on the logical interface ${intf-name}.${name}";
|
enable = mkEnableOption "the ethernet on the logical interface ${intf-name}.${name}";
|
||||||
|
@ -89,7 +91,10 @@ let
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
enable = mkEnableOption "the physical interface ${intf-name}";
|
enable = mkEnableOption "the physical interface ${intf-name}";
|
||||||
unit = mkOption { type = types.attrsOf (types.submodule unit); default = {}; };
|
unit = mkOption {
|
||||||
|
type = types.attrsOf (types.submodule unit);
|
||||||
|
default = { };
|
||||||
|
};
|
||||||
xml = mkOption {
|
xml = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
visible = false;
|
visible = false;
|
||||||
|
@ -120,9 +125,7 @@ in
|
||||||
};
|
};
|
||||||
config.netconf.xmls.interfaces = ''
|
config.netconf.xmls.interfaces = ''
|
||||||
<interfaces operation="replace">
|
<interfaces operation="replace">
|
||||||
${
|
${builtins.concatStringsSep "" (attrsets.mapAttrsToList (_: intf: intf.xml) config.interfaces)}
|
||||||
builtins.concatStringsSep "" (attrsets.mapAttrsToList (_: intf: intf.xml) config.interfaces)
|
|
||||||
}
|
|
||||||
</interfaces>
|
</interfaces>
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,9 @@ let
|
||||||
config.xml =
|
config.xml =
|
||||||
let
|
let
|
||||||
id = optionalString (!isNull config.id) "<vlan-id>${toString config.id}</vlan-id>";
|
id = optionalString (!isNull config.id) "<vlan-id>${toString config.id}</vlan-id>";
|
||||||
id-list = concatStringsSep "" (map (vlan: "<vlan-id-list>${toString vlan}</vlan-id-list>") config.id-list);
|
id-list = concatStringsSep "" (
|
||||||
|
map (vlan: "<vlan-id-list>${toString vlan}</vlan-id-list>") config.id-list
|
||||||
|
);
|
||||||
l3-intf = optionalString (
|
l3-intf = optionalString (
|
||||||
!isNull config.l3-interface
|
!isNull config.l3-interface
|
||||||
) "<l3-interface>${config.l3-interface}</l3-interface>";
|
) "<l3-interface>${config.l3-interface}</l3-interface>";
|
||||||
|
|
104
netconf-hive.nix
104
netconf-hive.nix
|
@ -1,7 +1,6 @@
|
||||||
let
|
let
|
||||||
vlansPlan = {
|
vlansPlan = {
|
||||||
"uplink-cri".id = 223;
|
"uplink-cri".id = 223;
|
||||||
"uplink-interne".id = 403;
|
|
||||||
|
|
||||||
"admin-core" = {
|
"admin-core" = {
|
||||||
id = 3000;
|
id = 3000;
|
||||||
|
@ -39,9 +38,21 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
netcore02 = {
|
netcore02 = {
|
||||||
deployment.targetHost = "jourdan01.dgn";
|
deployment.targetHost = "netcore02.dgn";
|
||||||
vlans = vlansPlan;
|
vlans = vlansPlan;
|
||||||
protocols.rstp = [
|
protocols.rstp = [
|
||||||
|
"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/12"
|
||||||
"ge-0/0/13"
|
"ge-0/0/13"
|
||||||
"ge-0/0/14"
|
"ge-0/0/14"
|
||||||
|
@ -57,12 +68,24 @@ in
|
||||||
"ge-0/1/3"
|
"ge-0/1/3"
|
||||||
];
|
];
|
||||||
interfaces = {
|
interfaces = {
|
||||||
"ge-0/0/12" = AP;
|
"ge-0/0/0" = AP-staging;
|
||||||
"ge-0/0/13" = AP;
|
"ge-0/0/1" = AP-staging;
|
||||||
"ge-0/0/14" = AP;
|
"ge-0/0/2" = AP-staging;
|
||||||
"ge-0/0/15" = AP;
|
"ge-0/0/3" = AP-staging;
|
||||||
"ge-0/0/16" = AP;
|
"ge-0/0/4" = AP-staging;
|
||||||
"ge-0/0/17" = AP;
|
"ge-0/0/5" = AP-staging;
|
||||||
|
"ge-0/0/6" = AP-staging;
|
||||||
|
"ge-0/0/7" = AP-staging;
|
||||||
|
"ge-0/0/8" = AP-staging;
|
||||||
|
"ge-0/0/9" = AP-staging;
|
||||||
|
"ge-0/0/10" = AP-staging;
|
||||||
|
"ge-0/0/11" = AP-staging;
|
||||||
|
"ge-0/0/12" = AP-staging;
|
||||||
|
"ge-0/0/13" = AP-staging;
|
||||||
|
"ge-0/0/14" = AP-staging;
|
||||||
|
"ge-0/0/15" = AP-staging;
|
||||||
|
"ge-0/0/16" = AP-staging;
|
||||||
|
"ge-0/0/17" = AP-staging;
|
||||||
|
|
||||||
"ge-0/0/42" = {
|
"ge-0/0/42" = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -108,7 +131,7 @@ in
|
||||||
unit."0".family.ethernet-switching = {
|
unit."0".family.ethernet-switching = {
|
||||||
enable = true;
|
enable = true;
|
||||||
interface-mode = "trunk";
|
interface-mode = "trunk";
|
||||||
vlans = [ "uplink-cri" "uplink-interne" ];
|
vlans = [ "uplink-cri" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -129,22 +152,53 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
# netaccess01 = {
|
netaccess01 = {
|
||||||
# deployement.targetHost = "root@192.168.42.6";
|
deployment.targetHost = "netaccess01.dgn";
|
||||||
|
|
||||||
# vlans = vlansPlan "fd26:baf9:d250:8000::2001/64";
|
vlans = vlansPlan;
|
||||||
# interfaces = {
|
|
||||||
# "xe-0/1/0" = {
|
|
||||||
# enable = true;
|
|
||||||
# interface-mode = "trunk";
|
|
||||||
# vlans = [ "all" ];
|
|
||||||
# dhcp_trusted = true;
|
|
||||||
# };
|
|
||||||
|
|
||||||
# "me0" = {
|
protocols.rstp = [
|
||||||
# enable = true;
|
"ge-0/0/0"
|
||||||
# management = "192.168.42.6/24";
|
"ge-0/0/1"
|
||||||
# };
|
"ge-0/0/2"
|
||||||
# };
|
"ge-0/0/3"
|
||||||
# };
|
"ge-0/0/4"
|
||||||
|
"ge-0/0/5"
|
||||||
|
|
||||||
|
"xe-0/1/0"
|
||||||
|
];
|
||||||
|
interfaces = {
|
||||||
|
"ge-0/0/0" = AP-staging;
|
||||||
|
"ge-0/0/1" = AP-staging;
|
||||||
|
"ge-0/0/2" = AP-staging;
|
||||||
|
"ge-0/0/3" = AP-staging;
|
||||||
|
"ge-0/0/4" = AP-staging;
|
||||||
|
"ge-0/0/5" = AP-staging;
|
||||||
|
|
||||||
|
"xe-0/1/0" = {
|
||||||
|
enable = true;
|
||||||
|
unit."0".family.ethernet-switching = {
|
||||||
|
enable = true;
|
||||||
|
interface-mode = "trunk";
|
||||||
|
vlans = [ "all" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"me0" = {
|
||||||
|
enable = true;
|
||||||
|
unit."0".family.inet = {
|
||||||
|
enable = true;
|
||||||
|
address = [ "192.168.42.6/24" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"irb" = {
|
||||||
|
enable = true;
|
||||||
|
unit."0".family.inet6 = {
|
||||||
|
enable = true;
|
||||||
|
address = [ "fd26:baf9:d250:8000::2001/64" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue