From b663301f29115a54a032329dc12617a2db6eaf9c Mon Sep 17 00:00:00 2001 From: Nikolay Stanchev <ns17@it-innovation.soton.ac.uk> Date: Wed, 6 Mar 2019 13:08:10 +0000 Subject: [PATCH] Updates network topology builder to update latencies if an edge already existed --- src/service/clmcservice/graphapi/utilities.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/service/clmcservice/graphapi/utilities.py b/src/service/clmcservice/graphapi/utilities.py index b8e736d..05082e9 100644 --- a/src/service/clmcservice/graphapi/utilities.py +++ b/src/service/clmcservice/graphapi/utilities.py @@ -389,7 +389,11 @@ def build_network_graph(graph, switches, links, clusters, ues): new_switches_count += 1 # create the link between the two nodes - find_or_create_edge(graph, "linkedTo", from_node, to_node, latency=latency) + edge = find_or_create_edge(graph, "linkedTo", from_node, to_node, latency=latency) + if edge["latency"] != latency: + log.info("Updating latency for edge {0}, old latency {1}, new latency {2}".format(edge, edge["latency"], latency)) + edge["latency"] = latency # make sure that the latency is updated if the edge already existed + graph.push(edge) # update the relationship in the DB # check whether the source service router connects a particular cluster or a particular UE if create_node_from_mapping(graph, from_node, source, clusters, "Cluster"): -- GitLab