From 8c82fc18a1508f867923fc065bba78028c79998f Mon Sep 17 00:00:00 2001 From: Dmitrii Gudov Date: Wed, 8 Apr 2026 17:09:45 +0300 Subject: [PATCH] fix vlan and bridge setup --- src/netdiag/output/file_convert.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/netdiag/output/file_convert.py b/src/netdiag/output/file_convert.py index f6f5244..1d4f043 100644 --- a/src/netdiag/output/file_convert.py +++ b/src/netdiag/output/file_convert.py @@ -30,8 +30,8 @@ def make_yaml(topology: Topology, output_path: Path) -> None: for _, device in topology.devices.items(): interfaces = dict() - interfaces["bridges"] = [] - interfaces["vlans"] = [] + bridges = [] + vlans = [] for interface_name, interface in device.interfaces.items(): ip = interface.ip_address if interface.ip_address else None @@ -55,7 +55,7 @@ def make_yaml(topology: Topology, output_path: Path) -> None: index = int(interface.adapter[7:]) if interface.itype == "bridge": - interfaces["bridges"].append( + bridges.append( { "name": interface.name, "members": interface.slave_interfaces, @@ -69,7 +69,7 @@ def make_yaml(topology: Topology, output_path: Path) -> None: ) continue if interface.itype == "vlan": - interfaces["vlans"].append( + vlans.append( { "name": interface.name, "parent": interface.parent_interface, @@ -93,7 +93,13 @@ def make_yaml(topology: Topology, output_path: Path) -> None: } data["nodes"].append( - {"role": device.role, "name": device.name, "interfaces": interfaces} + { + "role": device.role, + "name": device.name, + "interfaces": interfaces, + "bridges": bridges, + "vlans": vlans, + } ) with open(str(output_path), "w", encoding="utf-8") as f: