diff --git a/examples/path_requests_run.py b/examples/path_requests_run.py index 83432c1a..43fd8d9f 100755 --- a/examples/path_requests_run.py +++ b/examples/path_requests_run.py @@ -62,10 +62,17 @@ def requests_from_json(json_data,equipment): params['spacing'] = req['path-constraints']['te-bandwidth']['spacing'] # recover trx physical param (baudrate, ...) from type and mode + # in trx_mode_params optical power is read from equipment['SI']['default'] and + # nb_channel is computed based on min max frequency and spacing trx_params = trx_mode_params(equipment,params['trx_type'],params['trx_mode'],True) params.update(trx_params) - params['power'] = req['path-constraints']['te-bandwidth']['output-power'] - params['nb_channel'] = req['path-constraints']['te-bandwidth']['max-nb-of-channel'] + # optical power might be set differently in the request. if it is indicated then the + # params['power'] is updated + if req['path-constraints']['te-bandwidth']['output-power']: + params['power'] = req['path-constraints']['te-bandwidth']['output-power'] + # same process for nb-channel + if req['path-constraints']['te-bandwidth']['max-nb-of-channel'] : + params['nb_channel'] = req['path-constraints']['te-bandwidth']['max-nb-of-channel'] requests_list.append(Path_request(**params)) return requests_list diff --git a/gnpy/core/request.py b/gnpy/core/request.py index 04222641..580d6759 100644 --- a/gnpy/core/request.py +++ b/gnpy/core/request.py @@ -68,7 +68,8 @@ class Path_request: f'baud_rate:\t{self.baud_rate * 1e-9} Gbaud', f'bit_rate:\t{self.bit_rate * 1e-9} Gb/s', f'spacing:\t{self.spacing * 1e-9} GHz', - f'power: \t{round(lin2db(self.power)+30,2)} dBm' + f'power: \t{round(lin2db(self.power)+30,2)} dBm', + f'nb channels: \t{self.nb_channel}' '\n']) class Disjunction: def __init__(self, *args, **params): @@ -570,6 +571,7 @@ def compute_path_dsjctn(network, equipment, pathreqlist, disjunctions_list): for d in disjunctions_list : test_sol = True while test_sol: + # print('coucou') if candidates[d.disjunction_id] : for p in candidates[d.disjunction_id][0]: if allpaths[id(p)].req in pathreqlist_disjt: diff --git a/gnpy/core/service_sheet.py b/gnpy/core/service_sheet.py index 4af835c3..84e2fcbc 100644 --- a/gnpy/core/service_sheet.py +++ b/gnpy/core/service_sheet.py @@ -32,7 +32,7 @@ logger = getLogger(__name__) # Type for input data class Request(namedtuple('Request', 'request_id source destination trx_type mode \ spacing power nb_channel disjoint_from nodes_list is_loose')): - def __new__(cls, request_id, source, destination, trx_type, mode , spacing , power , nb_channel , disjoint_from ='' , nodes_list = None, is_loose = ''): + def __new__(cls, request_id, source, destination, trx_type, mode , spacing , power = None, nb_channel = None , disjoint_from ='' , nodes_list = None, is_loose = ''): return super().__new__(cls, request_id, source, destination, trx_type, mode, spacing, power, nb_channel, disjoint_from, nodes_list, is_loose) # Type for output data: // from dutc @@ -73,8 +73,14 @@ class Request_element(Element): exit() # excel input are in GHz and dBm self.spacing = Request.spacing * 1e9 - self.power = db2lin(Request.power) * 1e-3 - self.nb_channel = int(Request.nb_channel) + if Request.power : + self.power = db2lin(Request.power) * 1e-3 + else: + self.power = None + if Request.nb_channel : + self.nb_channel = int(Request.nb_channel) + else: + self.nb_channel = None if not isinstance(Request.disjoint_from,str): value = str(int(Request.disjoint_from)) if value.endswith('.0'):