Add N and M in the json response

The label object is added in the response. It contains center index N value
and number of slots M, required by the request according to the computation.

The label object directly follows the hop attribute as detailed in
draft-ietf-teas-yang-path-computation.

If the path is not blocked this changes the index of the last hop information
(-3 instead of -2) and the index of the transponder for the first hop
(2 instead of 1)

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
This commit is contained in:
EstherLerouzic
2019-09-10 18:54:03 +01:00
parent aa9b4aefbe
commit ea21cce1c0

View File

@@ -137,6 +137,18 @@ class Result_element(Element):
}
pro_list.append(temp)
index += 1
if self.path_request.M > 0:
temp = {
'path-route-object': {
'index': index,
"label-hop": {
"N": self.path_request.N,
"M": self.path_request.M
},
}
}
pro_list.append(temp)
index += 1
if isinstance(element, Transceiver) :
temp = {
'path-route-object': {
@@ -523,10 +535,10 @@ def jsontocsv(json_data, equipment, fileout):
# when label will be assigned destination will be with index -3, and transponder with index 2
source = pth_el['path-properties']['path-route-objects'][0]\
['path-route-object']['num-unnum-hop']['node-id']
destination = pth_el['path-properties']['path-route-objects'][-2]\
destination = pth_el['path-properties']['path-route-objects'][-3]\
['path-route-object']['num-unnum-hop']['node-id']
# selects only roadm nodes
temp_tsp = pth_el['path-properties']['path-route-objects'][1]\
temp_tsp = pth_el['path-properties']['path-route-objects'][2]\
['path-route-object']['transponder']
tsp = temp_tsp['transponder-type']
mode = temp_tsp['transponder-mode']