mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-11-02 02:57:52 +00:00
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:
@@ -275,6 +275,7 @@ def compute_constrained_path(network, req):
|
|||||||
destination = next(el for el in trx if el.uid == req.destination)
|
destination = next(el for el in trx if el.uid == req.destination)
|
||||||
nodes_list = []
|
nodes_list = []
|
||||||
for n in req.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.append(next(el for el in anytypenode if el.uid == n))
|
||||||
# nodes_list contains at least the destination
|
# nodes_list contains at least the destination
|
||||||
if nodes_list is None :
|
if nodes_list is None :
|
||||||
@@ -296,7 +297,7 @@ def compute_constrained_path(network, req):
|
|||||||
total_path = []
|
total_path = []
|
||||||
else :
|
else :
|
||||||
all_simp_pths = list(all_simple_paths(network,source=source,\
|
all_simp_pths = list(all_simple_paths(network,source=source,\
|
||||||
target=destination))
|
target=destination, cutoff=120))
|
||||||
candidate = []
|
candidate = []
|
||||||
for p in all_simp_pths :
|
for p in all_simp_pths :
|
||||||
if ispart(nodes_list, p) :
|
if ispart(nodes_list, p) :
|
||||||
@@ -463,7 +464,7 @@ def jsontocsv(json_data,equipment,fileout):
|
|||||||
# selects only roadm nodes
|
# selects only roadm nodes
|
||||||
pth = ' | '.join([ e['path-route-object']['unnumbered-hop']['node-id']
|
pth = ' | '.join([ e['path-route-object']['unnumbered-hop']['node-id']
|
||||||
for e in p['path-properties']['path-route-objects']
|
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]\
|
[tsp,mode] = p['path-properties']['path-route-objects'][0]\
|
||||||
['path-route-object']['unnumbered-hop']['hop-type'].split(' - ')
|
['path-route-object']['unnumbered-hop']['hop-type'].split(' - ')
|
||||||
|
|||||||
Reference in New Issue
Block a user