This commit is contained in:
2026-03-18 18:19:19 +03:00
parent 31611cbbeb
commit d1973c0b5d
2 changed files with 12 additions and 2 deletions
+10 -1
View File
@@ -37,8 +37,17 @@ def make_yaml(topology: Topology, output_path: Path) -> None:
for _, device in topology.devices.items():
interfaces = dict()
for interface_name, interface in device.interfaces.items():
mask = (
topology.networks[interface.network].subnet_mask
if interface.network
else None
)
ip = f"{interface.ip_address}/{mask}" if interface.ip_address else None
if mask is None:
ip = interface.ip_address if interface.ip_address else None
interfaces[interface_name] = {
"ip": interface.ip_address if interface.ip_address else None,
"ip": ip,
"network": interface.network if interface.network else None,
"gateway": (
interface.default_gateway if interface.default_gateway else None