From 94e635e9f38a33012fe1de9dbc7c3abe4f45e609 Mon Sep 17 00:00:00 2001 From: Dmitrii Gudov Date: Mon, 16 Mar 2026 02:05:31 +0300 Subject: [PATCH] edit output yaml --- .gitignore | 1 + examples/2hostsswitch/table.csv | 8 ++++---- src/netdiag/output/file_convert.py | 11 +++++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 4414f4f..08d2f3e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ data/ +plan.md # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/examples/2hostsswitch/table.csv b/examples/2hostsswitch/table.csv index ddc651b..4c2ba61 100644 --- a/examples/2hostsswitch/table.csv +++ b/examples/2hostsswitch/table.csv @@ -1,10 +1,10 @@ Name,Role,Adapter,Interface,Master Interface,Network,VLAN,Network IP,Mask,Device IP,Default Gateway PC1,Host,Adapter1,eth1,vlan7,A,,,,, -PC1,Host,,vlan7,,7,10.10.10.0,/24,10.10.10.7,0.0.0.0, +PC1,Host,,vlan7,,,7,10.10.10.0,/24,10.10.10.7,0.0.0.0 PC2,Host,Adapter1,eth1,vlan9,B,,,,, -PC2,Host,,vlan9,,9,10.10.10.0,/24,10.10.10.9,0.0.0.0, -com,Switch,Adapter1,eth2,vlan7,A,7,,,, -com,Switch,Adapter2,eth3,vlan9,B,9,,,, +PC2,Host,,vlan9,,,9,10.10.10.0,/24,10.10.10.9,0.0.0.0 +com,Switch,Adapter1,eth1,vlan7,A,7,,,, +com,Switch,Adapter2,eth2,vlan9,B,9,,,, com,Switch,,vlan7,bridge,,,,,, com,Switch,,vlan9,bridge,,,,,, com,Switch,,bridge,,,,,,, \ No newline at end of file diff --git a/src/netdiag/output/file_convert.py b/src/netdiag/output/file_convert.py index e142111..20df0cf 100644 --- a/src/netdiag/output/file_convert.py +++ b/src/netdiag/output/file_convert.py @@ -21,11 +21,14 @@ def make_yaml(topology: Topology, output_path: Path) -> None: if len(interfaces_with_device) >= 2: data["networks"].append( + # { + # network.name: [ + # f"{iface.device.name}.{iface.name}" + # for iface in interfaces_with_device + # ] + # } { - network.name: [ - f"{iface.device.name}.{iface.name}" - for iface in interfaces_with_device - ] + "name": network.name, } )