mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-11-01 02:28:05 +00:00
implement the use of TSP f_min
- tsp fmin is used instead of default SI value Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
This commit is contained in:
@@ -59,11 +59,12 @@ def requests_from_json(json_data,equipment):
|
|||||||
params['destination'] = req['dst-tp-id']
|
params['destination'] = req['dst-tp-id']
|
||||||
params['trx_type'] = req['path-constraints']['te-bandwidth']['trx_type']
|
params['trx_type'] = req['path-constraints']['te-bandwidth']['trx_type']
|
||||||
params['trx_mode'] = req['path-constraints']['te-bandwidth']['trx_mode']
|
params['trx_mode'] = req['path-constraints']['te-bandwidth']['trx_mode']
|
||||||
|
params['frequency'] = tsp_lib[params['trx_type']].frequency
|
||||||
try:
|
try:
|
||||||
extra_params = next(m
|
extra_params = next(m
|
||||||
for m in tsp_lib[params['trx_type']].mode if m['format'] == params['trx_mode'])
|
for m in tsp_lib[params['trx_type']].mode if m['format'] == params['trx_mode'])
|
||||||
except StopIteration :
|
except StopIteration :
|
||||||
msg = f'could not find tsp : {params} with mode: {params} in eqpt library'
|
msg = f'could not find tsp : {params["trx_type"]} with mode: {params["trx_mode"]} in eqpt library'
|
||||||
raise ValueError(msg)
|
raise ValueError(msg)
|
||||||
nd_list = req['optimizations']['explicit-route-include-objects']
|
nd_list = req['optimizations']['explicit-route-include-objects']
|
||||||
params['nodes_list'] = [n['unnumbered-hop']['node-id'] for n in nd_list]
|
params['nodes_list'] = [n['unnumbered-hop']['node-id'] for n in nd_list]
|
||||||
@@ -87,50 +88,7 @@ def load_requests(filename,eqpt_filename):
|
|||||||
json_data = loads(f.read())
|
json_data = loads(f.read())
|
||||||
return json_data
|
return json_data
|
||||||
|
|
||||||
# def compute_constrained_path(network, 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]
|
|
||||||
# for n in req.nodes_list:
|
|
||||||
# # print(n)
|
|
||||||
# try :
|
|
||||||
# node = next(el for el in trx if el.uid == n)
|
|
||||||
# except StopIteration:
|
|
||||||
# try:
|
|
||||||
# node = next(el for el in roadm if el.uid == f'roadm {n}')
|
|
||||||
# except StopIteration:
|
|
||||||
# try:
|
|
||||||
# node = next(el for el in edfa
|
|
||||||
# if el.uid.startswith(f'egress edfa in {n}'))
|
|
||||||
# except StopIteration:
|
|
||||||
# msg = f'could not find node : {n} in network topology: \
|
|
||||||
# not a trx, roadm, edfa or fused element'
|
|
||||||
# logger.critical(msg)
|
|
||||||
# raise ValueError(msg)
|
|
||||||
# # extend path list without repeating source -> skip first element in the list
|
|
||||||
# try:
|
|
||||||
# total_path.extend(dijkstra_path(network, source, node)[1:])
|
|
||||||
# source = node
|
|
||||||
# except NetworkXNoPath:
|
|
||||||
# # for debug
|
|
||||||
# # print(req.loose_list)
|
|
||||||
# # print(req.nodes_list.index(n))
|
|
||||||
# if req.loose_list[req.nodes_list.index(n)] == 'loose':
|
|
||||||
# print(f'could not find a path from {source.uid} to loose node : {n} in network topology')
|
|
||||||
# print(f'node {n} is skipped')
|
|
||||||
# else:
|
|
||||||
# msg = f'could not find a path from {source.uid} to node : {n} in network topology'
|
|
||||||
# logger.critical(msg)
|
|
||||||
# raise ValueError(msg)
|
|
||||||
# return total_path
|
|
||||||
|
|
||||||
def compute_path(network, pathreqlist):
|
def compute_path(network, pathreqlist):
|
||||||
# temporary : repeats calls from transmission_main_example
|
|
||||||
# to be merged when ready
|
|
||||||
|
|
||||||
path_res_list = []
|
path_res_list = []
|
||||||
|
|
||||||
|
|||||||
@@ -141,9 +141,11 @@ if __name__ == '__main__':
|
|||||||
params['spacing'] = 50e9
|
params['spacing'] = 50e9
|
||||||
params['power'] = 0
|
params['power'] = 0
|
||||||
params['nb_channel'] = 97
|
params['nb_channel'] = 97
|
||||||
|
params['frequency'] = equipment['Transceiver'][params['trx_type']].frequency
|
||||||
try:
|
try:
|
||||||
extra_params = next(m
|
extra_params = next(m
|
||||||
for m in equipment['Transceiver'][params['trx_type']].mode if m['format'] == params['trx_mode'])
|
for m in equipment['Transceiver'][params['trx_type']].mode
|
||||||
|
if m['format'] == params['trx_mode'])
|
||||||
except StopIteration :
|
except StopIteration :
|
||||||
msg = f'could not find tsp : {params} with mode: {params} in eqpt library'
|
msg = f'could not find tsp : {params} with mode: {params} in eqpt library'
|
||||||
raise ValueError(msg)
|
raise ValueError(msg)
|
||||||
|
|||||||
@@ -36,24 +36,23 @@ from numpy import log10
|
|||||||
|
|
||||||
|
|
||||||
RequestParams = namedtuple('RequestParams','request_id source destination trx_type'+
|
RequestParams = namedtuple('RequestParams','request_id source destination trx_type'+
|
||||||
' trx_mode nodes_list loose_list spacing power nb_channel format baudrate OSNR bit_rate')
|
' trx_mode nodes_list loose_list spacing power nb_channel frequency format baudrate OSNR bit_rate')
|
||||||
|
|
||||||
class Path_request:
|
class Path_request:
|
||||||
def __init__(self, *args, **params):
|
def __init__(self, *args, **params):
|
||||||
params = RequestParams(**params)
|
params = RequestParams(**params)
|
||||||
self.request_id = params.request_id
|
self.request_id = params.request_id
|
||||||
self.source = params.source
|
self.source = params.source
|
||||||
self.destination = params.destination
|
self.destination = params.destination
|
||||||
self.tsp = params.trx_type
|
self.tsp = params.trx_type
|
||||||
self.tsp_mode = params.trx_mode
|
self.tsp_mode = params.trx_mode
|
||||||
# retrieve baudrate out of transponder type and mode (format)
|
self.baudrate = params.baudrate
|
||||||
|
|
||||||
self.baudrate = params.baudrate
|
|
||||||
self.nodes_list = params.nodes_list
|
self.nodes_list = params.nodes_list
|
||||||
self.loose_list = params.loose_list
|
self.loose_list = params.loose_list
|
||||||
self.spacing = params.spacing
|
self.spacing = params.spacing
|
||||||
self.power = params.power
|
self.power = params.power
|
||||||
self.nb_channel = params.nb_channel
|
self.nb_channel = params.nb_channel
|
||||||
|
self.frequency = params.frequency
|
||||||
self.format = params.format
|
self.format = params.format
|
||||||
self.OSNR = params.OSNR
|
self.OSNR = params.OSNR
|
||||||
self.bit_rate = params.bit_rate
|
self.bit_rate = params.bit_rate
|
||||||
@@ -175,9 +174,8 @@ def compute_constrained_path(network, req):
|
|||||||
def propagate(path,req,equipment, show=False):
|
def propagate(path,req,equipment, show=False):
|
||||||
default_si_data = equipment['SI']['default']
|
default_si_data = equipment['SI']['default']
|
||||||
si = create_input_spectral_information(
|
si = create_input_spectral_information(
|
||||||
default_si_data.f_min, default_si_data.roll_off,
|
req.frequency['min'], default_si_data.roll_off,
|
||||||
req.baudrate, req.power, req.spacing, req.nb_channel)
|
req.baudrate, req.power, req.spacing, req.nb_channel)
|
||||||
# TODO : use tsp f_min instead of default
|
|
||||||
for el in path:
|
for el in path:
|
||||||
si = el(si)
|
si = el(si)
|
||||||
if show :
|
if show :
|
||||||
|
|||||||
Reference in New Issue
Block a user