lib/config/options+legacy: add bgp
parent
8013241d6c
commit
aed29a54ce
|
@ -121,14 +121,25 @@ in
|
|||
|
||||
ospf =
|
||||
let
|
||||
hostPillar = self.lib.saltPillarFor name;
|
||||
ospfConf = hostPillar.ospf;
|
||||
in lib.optionalAttrs (hostPillar ? ospf && ospfConf ? stubnets-inet) {
|
||||
ospfConf = ctPillar.ospf;
|
||||
in lib.optionalAttrs (ctPillar ? ospf && ospfConf ? stubnets-inet) {
|
||||
stubNets4 = ospfConf.stubnets-inet;
|
||||
} // lib.optionalAttrs (hostPillar ? ospf && ospfConf ? stubnets-inet6) {
|
||||
} // lib.optionalAttrs (ctPillar ? ospf && ospfConf ? stubnets-inet6) {
|
||||
stubNets6 = ospfConf.stubnets-inet6;
|
||||
};
|
||||
|
||||
bgp =
|
||||
if ctPillar ? bgp
|
||||
then
|
||||
let
|
||||
bgpConf = ctPillar.bgp;
|
||||
in {
|
||||
inherit (bgpConf) asn;
|
||||
peers4 = bgpConf.peers-inet;
|
||||
peers6 = bgpConf.peers-inet6;
|
||||
}
|
||||
else null;
|
||||
|
||||
forwardPorts =
|
||||
if ctPillar ? port-forwarding
|
||||
then map ({ proto, port, to }: {
|
||||
|
|
|
@ -221,6 +221,32 @@ let
|
|||
}
|
||||
));
|
||||
};
|
||||
bgp = mkOption {
|
||||
default = null;
|
||||
type = with types; nullOr (submodule {
|
||||
options = bgpOpts;
|
||||
});
|
||||
};
|
||||
};
|
||||
};
|
||||
bgpPeerOpts = { name, ... }: {
|
||||
options = {
|
||||
asn = mkOption {
|
||||
type = types.int;
|
||||
};
|
||||
};
|
||||
};
|
||||
bgpOpts = {
|
||||
asn = mkOption {
|
||||
type = types.int;
|
||||
};
|
||||
peers4 = mkOption {
|
||||
type = with types; attrsOf (submodule bgpPeerOpts);
|
||||
default = {};
|
||||
};
|
||||
peers6 = mkOption {
|
||||
type = with types; attrsOf (submodule bgpPeerOpts);
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
in
|
||||
|
|
Loading…
Reference in New Issue