add a limit cutoff for path search

all_simple_path search leads to a very long time process in case of large network
a cutoff parameters has been added to avoid this. Value needs to be parametrized:
right now correspond to my experience

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
This commit is contained in:
EstherLerouzic
2018-12-13 11:37:26 +00:00
parent 2d515eea4c
commit 3cdc8511a8

View File

@@ -275,6 +275,7 @@ def compute_constrained_path(network, req):
destination = next(el for el in trx if el.uid == req.destination)
nodes_list = []
for n in req.nodes_list :
# for debug excel print(n)
nodes_list.append(next(el for el in anytypenode if el.uid == n))
# nodes_list contains at least the destination
if nodes_list is None :
@@ -296,7 +297,7 @@ def compute_constrained_path(network, req):
total_path = []
else :
all_simp_pths = list(all_simple_paths(network,source=source,\
target=destination))
target=destination, cutoff=120))
candidate = []
for p in all_simp_pths :
if ispart(nodes_list, p) :
@@ -463,7 +464,7 @@ def jsontocsv(json_data,equipment,fileout):
# selects only roadm nodes
pth = ' | '.join([ e['path-route-object']['unnumbered-hop']['node-id']
for e in p['path-properties']['path-route-objects']
if e['path-route-object']['unnumbered-hop']['node-id'].startswith('roadm')])
if e['path-route-object']['unnumbered-hop']['node-id'].startswith('roadm') or e['path-route-object']['unnumbered-hop']['node-id'].startswith('Edfa')])
[tsp,mode] = p['path-properties']['path-route-objects'][0]\
['path-route-object']['unnumbered-hop']['hop-type'].split(' - ')