restore power management in transmission main

Signed-off-by: Jean-Luc Auge <jeanluc.auge@orange.com>
This commit is contained in:
Jean-Luc Auge
2018-07-13 17:35:39 +02:00
parent 4a756bf2a9
commit c6432e2c28
6 changed files with 88 additions and 52 deletions

View File

@@ -34,18 +34,27 @@ from gnpy.core.info import create_input_spectral_information, SpectralInformatio
from copy import copy, deepcopy
from numpy import log10
RequestParams = namedtuple('RequestParams','request_id source destination trx_type \
trx_mode nodes_list loose_list spacing power nb_channel frequency \
mode baudrate OSNR bit_rate')
RequestParams = namedtuple('RequestParams','request_id source destination trx_type'+
' trx_mode nodes_list loose_list spacing power nb_channel frequency format baudrate OSNR bit_rate')
class Path_request(RequestParams):
def __new__(cls, request_id=0, source='', destination='', trx_type='',
trx_mode='', nodes_list='', loose_list=['strict'],
spacing=50, power=1e-3, nb_channel=80, frequency={'min': 191.35e12, 'max': 196.10e12},
mode ='', baudrate=32, OSNR=15, bit_rate=100):
return super().__new__(cls, request_id, source, destination, trx_type,
trx_mode, nodes_list, loose_list, spacing, power, nb_channel, frequency,
mode, baudrate, OSNR, bit_rate)
class Path_request:
def __init__(self, *args, **params):
params = RequestParams(**params)
self.request_id = params.request_id
self.source = params.source
self.destination = params.destination
self.tsp = params.trx_type
self.tsp_mode = params.trx_mode
self.baudrate = params.baudrate
self.nodes_list = params.nodes_list
self.loose_list = params.loose_list
self.spacing = params.spacing
self.power = params.power
self.nb_channel = params.nb_channel
self.frequency = params.frequency
self.format = params.format
self.OSNR = params.OSNR
self.bit_rate = params.bit_rate
def __str__(self):
return '\n\t'.join([ f'{type(self).__name__} {self.request_id}',
@@ -120,10 +129,10 @@ class Result_element(Element):
return self.pathresult
def compute_constrained_path(network, req):
print('!!!!',req)
trx = [n for n in network.nodes() if isinstance(n, Transceiver)]
roadm = [n for n in network.nodes() if isinstance(n, Roadm)]
edfa = [n for n in network.nodes() if isinstance(n, Edfa)]
source = next(el for el in trx if el.uid == req.source)
# start the path with its source
total_path = [source]