static ip mgmt
This commit is contained in:
parent
c8fd1d84e7
commit
5741324cb7
2 changed files with 11 additions and 5 deletions
|
@ -29,7 +29,7 @@ let module_inst = {
|
|||
|
||||
"me0" = { # mgmt
|
||||
enable = true;
|
||||
management = true;
|
||||
management = "192.168.42.6/24";
|
||||
};
|
||||
};
|
||||
vlans = {
|
||||
|
|
|
@ -29,8 +29,9 @@ in with lib; {
|
|||
default = false;
|
||||
};
|
||||
management = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
# FIXME : support ipv4 and ipv6, either static or dhcp (with the coffee)
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
in builtins.listToAttrs (map (name: { inherit name; value = template name; }) interfaces);
|
||||
|
@ -46,7 +47,12 @@ in with lib; {
|
|||
intf_xmlGen = name: let
|
||||
disable_flag = if !cfg.interfaces.${name}.enable then "<disable/>" else "";
|
||||
# FIXME : need to enforce address in reality
|
||||
mgmt_fam = if cfg.interfaces.${name}.management then "<inet><dhcp/></inet>" else "";
|
||||
mgmt_fam = if !builtins.isNull cfg.interfaces.${name}.management then ''
|
||||
<inet>
|
||||
<address>
|
||||
${cfg.interfaces.${name}.management}
|
||||
</address>
|
||||
</inet>'' else "";
|
||||
members = map (vlan: "<members>${builtins.toString vlan}</members>") cfg.interfaces.${name}.vlans;
|
||||
eth_switch = if builtins.isNull cfg.interfaces.${name}.interface-mode then "" else ''
|
||||
<ethernet-switching>
|
||||
|
@ -68,7 +74,7 @@ in with lib; {
|
|||
interface_xmls = map intf_xmlGen interfaces;
|
||||
vlan_trust_table = let
|
||||
vlan_map = inter: vlan:
|
||||
if builtins.isString vlan then
|
||||
if builtins.isString vlan && cfg.interfaces.${inter}.enable then
|
||||
if cfg.interfaces.${inter}.dhcp_trusted then
|
||||
{ ${vlan}.trust = inter; }
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue