fix: save network_name

network_name was not correctly exported in json output.

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: Ia4ae6bf82e5d147d3c99e195151942abc21be3f3
This commit is contained in:
EstherLerouzic
2025-02-27 11:30:17 +01:00
parent 6603a50e78
commit d43fee5945

View File

@@ -626,6 +626,7 @@ def network_from_json(json_data: dict, equipment: dict) -> DiGraph:
# too closely to the graph library
# from networkx import node_link_graph
g = DiGraph()
g.graph['network_name'] = json_data.get('network_name', None)
for el_config in json_data['elements']:
typ = el_config.pop('type')
variety = el_config.pop('type_variety', 'default')
@@ -740,6 +741,8 @@ def network_to_json(network: DiGraph) -> dict:
for next_n in network.successors(n) if next_n is not None]
}
data.update(connections)
if network.graph['network_name']:
data['network_name'] = network.graph['network_name']
return data