mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2026-01-27 02:21:40 +00:00
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:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user