mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-11-01 18:47:48 +00:00
JSON: ensure that node constraints use correct indexing
The program currently ignores the explicit `index` and reads the constraints in the JSON order of the list. However in general, it is not guaranteed that constraints are listed in order. Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com> Change-Id: Icefe271f5801cf9f7b43311c6666556564587c65 Signed-off-by: Jan Kundrát <jan.kundrat@telecominfraproject.com>
This commit is contained in:
committed by
Jan Kundrát
parent
e381138320
commit
1bcb3ce25c
@@ -547,7 +547,7 @@ def requests_from_json(json_data, equipment):
|
||||
params['format'] = params['trx_mode']
|
||||
params['spacing'] = req['path-constraints']['te-bandwidth']['spacing']
|
||||
try:
|
||||
nd_list = req['explicit-route-objects']['route-object-include-exclude']
|
||||
nd_list = sorted(req['explicit-route-objects']['route-object-include-exclude'], key=lambda x: x['index'])
|
||||
except KeyError:
|
||||
nd_list = []
|
||||
params['nodes_list'] = [n['num-unnum-hop']['node-id'] for n in nd_list]
|
||||
|
||||
Reference in New Issue
Block a user