mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-11-02 11:07:57 +00:00
changes to improve quality
minor name refactor indent corrections minor fixes for spacing Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
This commit is contained in:
@@ -162,7 +162,8 @@ class Result_element(Element):
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'metric-type': 'SNR-0.1nm',
|
'metric-type': 'SNR-0.1nm',
|
||||||
'accumulative-value': round(mean(self.computed_path[-1].snr+lin2db(self.path_request.baud_rate/12.5e9)),2)
|
'accumulative-value': round(mean(self.computed_path[-1]. snr + \
|
||||||
|
lin2db(self.path_request.baud_rate/12.5e9)), 2)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'metric-type': 'OSNR-bandwidth',
|
'metric-type': 'OSNR-bandwidth',
|
||||||
@@ -402,10 +403,10 @@ def jsontocsv(json_data,equipment,fileout):
|
|||||||
tspjsondata = equipment['Transceiver']
|
tspjsondata = equipment['Transceiver']
|
||||||
#print(tspjsondata)
|
#print(tspjsondata)
|
||||||
|
|
||||||
for p in json_data['response']:
|
for pth_el in json_data['response']:
|
||||||
path_id = p['response-id']
|
path_id = pth_el['response-id']
|
||||||
try:
|
try:
|
||||||
if p['no-path'] :
|
if pth_el['no-path'] :
|
||||||
source = ''
|
source = ''
|
||||||
destination = ''
|
destination = ''
|
||||||
tsp = ''
|
tsp = ''
|
||||||
@@ -421,13 +422,14 @@ def jsontocsv(json_data,equipment,fileout):
|
|||||||
total_cost = ''
|
total_cost = ''
|
||||||
pth = ''
|
pth = ''
|
||||||
except KeyError:
|
except KeyError:
|
||||||
source = p['path-properties']['path-route-objects'][0]\
|
|
||||||
|
source = pth_el['path-properties']['path-route-objects'][0]\
|
||||||
['path-route-object']['num-unnum-hop']['node-id']
|
['path-route-object']['num-unnum-hop']['node-id']
|
||||||
destination = p['path-properties']['path-route-objects'][-2]\
|
destination = pth_el['path-properties']['path-route-objects'][-2]\
|
||||||
['path-route-object']['num-unnum-hop']['node-id']
|
['path-route-object']['num-unnum-hop']['node-id']
|
||||||
# selects only roadm nodes
|
# selects only roadm nodes
|
||||||
temp = []
|
temp = []
|
||||||
for e in p['path-properties']['path-route-objects'] :
|
for e in pth_el['path-properties']['path-route-objects']:
|
||||||
try :
|
try :
|
||||||
temp.append(e['path-route-object']['num-unnum-hop']['node-id'])
|
temp.append(e['path-route-object']['num-unnum-hop']['node-id'])
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@@ -446,19 +448,18 @@ def jsontocsv(json_data,equipment,fileout):
|
|||||||
for m in equipment['Transceiver'][tsp].mode if m['format']==mode)
|
for m in equipment['Transceiver'][tsp].mode if m['format']==mode)
|
||||||
# else:
|
# else:
|
||||||
# [minosnr, baud_rate, bit_rate] = ['','','','']
|
# [minosnr, baud_rate, bit_rate] = ['','','','']
|
||||||
|
|
||||||
output_snr = next(e['accumulative-value']
|
output_snr = next(e['accumulative-value']
|
||||||
for e in p['path-properties']['path-metric'] if e['metric-type'] == 'SNR-0.1nm')
|
for e in pth_el['path-properties']['path-metric'] if e['metric-type'] == 'SNR-0.1nm')
|
||||||
output_snrbandwidth = next(e['accumulative-value']
|
output_snrbandwidth = next(e['accumulative-value']
|
||||||
for e in p['path-properties']['path-metric'] if e['metric-type'] == 'SNR-bandwidth')
|
for e in pth_el['path-properties']['path-metric'] if e['metric-type'] == 'SNR-bandwidth')
|
||||||
output_osnr = next(e['accumulative-value']
|
output_osnr = next(e['accumulative-value']
|
||||||
for e in p['path-properties']['path-metric'] if e['metric-type'] == 'OSNR-0.1nm')
|
for e in pth_el['path-properties']['path-metric'] if e['metric-type'] == 'OSNR-0.1nm')
|
||||||
output_osnrbandwidth = next(e['accumulative-value']
|
output_osnrbandwidth = next(e['accumulative-value']
|
||||||
for e in p['path-properties']['path-metric'] if e['metric-type'] == 'OSNR-bandwidth')
|
for e in pth_el['path-properties']['path-metric'] if e['metric-type'] == 'OSNR-bandwidth')
|
||||||
power = next(e['accumulative-value']
|
power = next(e['accumulative-value']
|
||||||
for e in p['path-properties']['path-metric'] if e['metric-type'] == 'reference_power')
|
for e in pth_el['path-properties']['path-metric'] if e['metric-type'] == 'reference_power')
|
||||||
path_bandwidth = next(e['accumulative-value']
|
path_bandwidth = next(e['accumulative-value']
|
||||||
for e in p['path-properties']['path-metric'] if e['metric-type'] == 'path_bandwidth')
|
for e in pth_el['path-properties']['path-metric'] if e['metric-type'] == 'path_bandwidth')
|
||||||
if isinstance(output_snr, str):
|
if isinstance(output_snr, str):
|
||||||
isok = False
|
isok = False
|
||||||
nb_tsp = 0
|
nb_tsp = 0
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
"link-tp-id": null
|
"link-tp-id": null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user