From 609cd94798ca99f93876552a45189a68ef797ee2 Mon Sep 17 00:00:00 2001 From: EstherLerouzic Date: Fri, 31 May 2019 16:14:12 +0100 Subject: [PATCH] Remove @ in path-metric names and extend type to decimal64 @ character not correctly read with OpenDayLight yang tool used for transportPCE project. https://docs.opendaylight.org/en/stable-nitrogen/developer-guide/yang-tools.html#working-with-yang-model. Changed the names of path metrics from osnr@ to osnr- Signed-off-by: EstherLerouzic --- gnpy/core/request.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/gnpy/core/request.py b/gnpy/core/request.py index fad3b06d..929b8623 100644 --- a/gnpy/core/request.py +++ b/gnpy/core/request.py @@ -157,19 +157,19 @@ class Result_element(Element): 'path-properties':{ 'path-metric': [ { - 'metric-type': 'SNR@bandwidth', + 'metric-type': 'SNR-bandwidth', 'accumulative-value': round(mean(self.computed_path[-1].snr),2) }, { - '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) }, { - 'metric-type': 'OSNR@bandwidth', + 'metric-type': 'OSNR-bandwidth', 'accumulative-value': round(mean(self.computed_path[-1].osnr_ase),2) }, { - 'metric-type': 'OSNR@0.1nm', + 'metric-type': 'OSNR-0.1nm', 'accumulative-value': round(mean(self.computed_path[-1].osnr_ase_01nm),2) }, { @@ -397,7 +397,7 @@ def jsontocsv(json_data,equipment,fileout): mywriter = writer(fileout) mywriter.writerow(('response-id','source','destination','path_bandwidth','Pass?',\ 'nb of tsp pairs','total cost','transponder-type','transponder-mode',\ - 'OSNR@0.1nm','SNR@0.1nm','SNR@bandwidth','baud rate (Gbaud)',\ + 'OSNR-0.1nm','SNR-0.1nm','SNR-bandwidth','baud rate (Gbaud)',\ 'input power (dBm)','path')) tspjsondata = equipment['Transceiver'] #print(tspjsondata) @@ -446,14 +446,15 @@ def jsontocsv(json_data,equipment,fileout): for m in equipment['Transceiver'][tsp].mode if m['format']==mode) # else: # [minosnr, baud_rate, bit_rate] = ['','','',''] + output_snr = next(e['accumulative-value'] - for e in p['path-properties']['path-metric'] if e['metric-type'] == 'SNR@0.1nm') + for e in p['path-properties']['path-metric'] if e['metric-type'] == 'SNR-0.1nm') output_snrbandwidth = next(e['accumulative-value'] - for e in p['path-properties']['path-metric'] if e['metric-type'] == 'SNR@bandwidth') + for e in p['path-properties']['path-metric'] if e['metric-type'] == 'SNR-bandwidth') output_osnr = next(e['accumulative-value'] - for e in p['path-properties']['path-metric'] if e['metric-type'] == 'OSNR@0.1nm') + for e in p['path-properties']['path-metric'] if e['metric-type'] == 'OSNR-0.1nm') output_osnrbandwidth = next(e['accumulative-value'] - for e in p['path-properties']['path-metric'] if e['metric-type'] == 'OSNR@bandwidth') + for e in p['path-properties']['path-metric'] if e['metric-type'] == 'OSNR-bandwidth') power = next(e['accumulative-value'] for e in p['path-properties']['path-metric'] if e['metric-type'] == 'reference_power') path_bandwidth = next(e['accumulative-value']