Implementation of bidirectional field per request

- Instead applying bidir option independantly from service demands (json or xls)
  the "bidirectional" attribute is introduced per request in the json.
  This enables bidirectional option per requests.
  if --bidir option is used on the main program, the field is set
  to true for all demands in case demands are expressed in an excel
  sheet. --bidir option does not change bidir field if the service
  file is in json format.
  Default value of "bidirectional" attribute is False.
- As a result the reversed path is propagated only if the birectional
  field of the request is True. (remember that the reversed path must
  be computed whatever the option because it is needed to compute
  spectral occupation on both directions).

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
This commit is contained in:
EstherLerouzic
2019-09-13 15:25:17 +01:00
parent 024f6ff963
commit 56f158113d
2 changed files with 28 additions and 15 deletions

View File

@@ -32,7 +32,7 @@ from math import ceil
logger = getLogger(__name__)
RequestParams = namedtuple('RequestParams','request_id source destination trx_type'+
RequestParams = namedtuple('RequestParams','request_id source destination bidir trx_type'+
' trx_mode nodes_list loose_list spacing power nb_channel f_min f_max format baud_rate OSNR bit_rate roll_off tx_osnr min_spacing cost path_bandwidth')
DisjunctionParams = namedtuple('DisjunctionParams','disjunction_id relaxable link_diverse node_diverse disjunctions_req')
@@ -42,6 +42,7 @@ class Path_request:
self.request_id = params.request_id
self.source = params.source
self.destination = params.destination
self.bidir = params.bidir
self.tsp = params.trx_type
self.tsp_mode = params.trx_mode
self.baud_rate = params.baud_rate
@@ -168,35 +169,45 @@ class Result_element(Element):
return pro_list
@property
def path_properties(self):
return {
'path-metric': [
def path_metric(p,r):
return [
{
'metric-type': 'SNR-bandwidth',
'accumulative-value': round(mean(self.computed_path[-1].snr),2)
'accumulative-value': round(mean(p[-1].snr),2)
},
{
'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(p[-1].snr+lin2db(r.baud_rate/12.5e9)),2)
},
{
'metric-type': 'OSNR-bandwidth',
'accumulative-value': round(mean(self.computed_path[-1].osnr_ase),2)
'accumulative-value': round(mean(p[-1].osnr_ase),2)
},
{
'metric-type': 'OSNR-0.1nm',
'accumulative-value': round(mean(self.computed_path[-1].osnr_ase_01nm),2)
'accumulative-value': round(mean(p[-1].osnr_ase_01nm),2)
},
{
'metric-type': 'reference_power',
'accumulative-value': self.path_request.power
'accumulative-value': r.power
},
{
'metric-type': 'path_bandwidth',
'accumulative-value': self.path_request.path_bandwidth
'accumulative-value': r.path_bandwidth
}
],
]
if self.path_request.bidir:
path_properties = {
'path-metric' : path_metric(self.computed_path,self.path_request),
'z-a-path-metric' : path_metric(self.reversed_computed_path,self.path_request),
'path-route-objects': self.detailed_path_json
}
}
else:
path_properties = {
'path-metric' : path_metric(self.computed_path,self.path_request),
'path-route-objects': self.detailed_path_json
}
return path_properties
@property
def pathresult(self):