new example

This commit is contained in:
2026-03-25 15:31:06 +03:00
parent 4c69be99e0
commit c6b97b7a13
2 changed files with 5 additions and 0 deletions
+4
View File
@@ -66,6 +66,10 @@ class Interface:
"Interface 'itype' must be one of 'physical', 'virtual', 'bridge', 'vlan', or None" "Interface 'itype' must be one of 'physical', 'virtual', 'bridge', 'vlan', or None"
) )
# print(
# f"Creating interface '{name}' with itype='{itype}', adapter='{adapter}', slave_interfaces='{slave_interfaces}', parent_interface='{parent_interface}', ip_address='{ip_address}', network='{network}', subnet_mask='{subnet_mask}', default_gateway='{default_gateway}'"
# )
if itype == "bridge" and not slave_interfaces: if itype == "bridge" and not slave_interfaces:
raise ValueError("Bridge interfaces must have 'slave_interfaces' defined") raise ValueError("Bridge interfaces must have 'slave_interfaces' defined")
if itype == "vlan" and not parent_interface: if itype == "vlan" and not parent_interface:
+1
View File
@@ -90,6 +90,7 @@ def add_interfaces(devices: list[Device], raw_devices: list[RawDevices]) -> None
if _get_from_field(raw_device.fields, "SLAVES") if _get_from_field(raw_device.fields, "SLAVES")
else None else None
), ),
parent_interface=_get_from_field(raw_device.fields, "PARENT"),
ip_address=_get_from_field(raw_device.fields, "IP_ADDRESS"), ip_address=_get_from_field(raw_device.fields, "IP_ADDRESS"),
network=_get_from_field(raw_device.fields, "NETWORK_NAME"), network=_get_from_field(raw_device.fields, "NETWORK_NAME"),
default_gateway=_get_from_field(raw_device.fields, "DEFAULT_GATEWAY"), default_gateway=_get_from_field(raw_device.fields, "DEFAULT_GATEWAY"),