mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-11-02 02:57:52 +00:00
Enabling the reading of N and M value from the json request
For this commit only the first element from the {N, M} list is read
and assigned.
This is better than not reading this value at all.
the commit also updates test_files and test data files with correct
values for the effective_freq_slot attribute
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: I1e60fe833ca1092b40de27c8cbfb13083810414e
This commit is contained in:
committed by
Jan Kundrát
parent
9bf6ed953a
commit
7f7c568160
@@ -14,8 +14,8 @@
|
||||
"trx_mode": null,
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"N": "null",
|
||||
"M": "null"
|
||||
"N": null,
|
||||
"M": null
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -39,8 +39,8 @@
|
||||
"trx_mode": "mode 1",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"N": "null",
|
||||
"M": "null"
|
||||
"N": null,
|
||||
"M": null
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -104,8 +104,8 @@
|
||||
"trx_mode": "mode 1",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"N": "null",
|
||||
"M": "null"
|
||||
"N": null,
|
||||
"M": null
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -129,8 +129,8 @@
|
||||
"trx_mode": null,
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"N": "null",
|
||||
"M": "null"
|
||||
"N": null,
|
||||
"M": null
|
||||
}
|
||||
],
|
||||
"spacing": 75000000000.0,
|
||||
@@ -154,8 +154,8 @@
|
||||
"trx_mode": "mode 2",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"N": "null",
|
||||
"M": "null"
|
||||
"N": null,
|
||||
"M": null
|
||||
}
|
||||
],
|
||||
"spacing": 75000000000.0,
|
||||
@@ -179,8 +179,8 @@
|
||||
"trx_mode": "mode 1",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"N": "null",
|
||||
"M": "null"
|
||||
"N": null,
|
||||
"M": null
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -204,8 +204,8 @@
|
||||
"trx_mode": "mode 1",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"N": "null",
|
||||
"M": "null"
|
||||
"N": null,
|
||||
"M": null
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -229,8 +229,8 @@
|
||||
"trx_mode": "mode 1",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"N": "null",
|
||||
"M": "null"
|
||||
"N": null,
|
||||
"M": null
|
||||
}
|
||||
],
|
||||
"spacing": 75000000000.0,
|
||||
|
||||
@@ -187,6 +187,7 @@ def transmission_main_example(args=None):
|
||||
params['loose_list'] = ['strict']
|
||||
params['format'] = ''
|
||||
params['path_bandwidth'] = 0
|
||||
params['effective_freq_slot'] = None
|
||||
trx_params = trx_mode_params(equipment)
|
||||
if args.power:
|
||||
trx_params['power'] = db2lin(float(args.power)) * 1e-3
|
||||
|
||||
@@ -485,6 +485,7 @@ def requests_from_json(json_data, equipment):
|
||||
params['nb_channel'] = automatic_nch(f_min, f_max_from_si, params['spacing'])
|
||||
except KeyError:
|
||||
params['nb_channel'] = automatic_nch(f_min, f_max_from_si, params['spacing'])
|
||||
params['effective_freq_slot'] = req['path-constraints']['te-bandwidth'].get('effective-freq-slot', [None])[0]
|
||||
_check_one_request(params, f_max_from_si)
|
||||
|
||||
try:
|
||||
|
||||
@@ -127,7 +127,7 @@ class Request_element(Element):
|
||||
'technology': 'flexi-grid',
|
||||
'trx_type': self.trx_type,
|
||||
'trx_mode': self.mode,
|
||||
'effective-freq-slot': [{'N': 'null', 'M': 'null'}],
|
||||
'effective-freq-slot': [{'N': None, 'M': None}],
|
||||
'spacing': self.spacing,
|
||||
'max-nb-of-channel': self.nb_channel,
|
||||
'output-power': self.power
|
||||
|
||||
@@ -35,7 +35,7 @@ LOGGER = getLogger(__name__)
|
||||
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')
|
||||
' min_spacing cost path_bandwidth effective_freq_slot')
|
||||
DisjunctionParams = namedtuple('DisjunctionParams', 'disjunction_id relaxable link' +
|
||||
'_diverse node_diverse disjunctions_req')
|
||||
|
||||
@@ -68,6 +68,9 @@ class PathRequest:
|
||||
self.min_spacing = params.min_spacing
|
||||
self.cost = params.cost
|
||||
self.path_bandwidth = params.path_bandwidth
|
||||
if params.effective_freq_slot is not None:
|
||||
self.N = params.effective_freq_slot['N']
|
||||
self.M = params.effective_freq_slot['M']
|
||||
|
||||
def __str__(self):
|
||||
return '\n\t'.join([f'{type(self).__name__} {self.request_id}',
|
||||
@@ -389,7 +392,6 @@ def propagate_and_optimize_mode(path, req, equipment):
|
||||
else:
|
||||
req.blocking_reason = 'NO_COMPUTED_SNR'
|
||||
return path, None
|
||||
|
||||
# only get to this point if no baudrate/mode satisfies OSNR requirement
|
||||
|
||||
# returns the last propagated path and mode
|
||||
|
||||
@@ -390,23 +390,35 @@ def pth_assign_spectrum(pths, rqs, oms_list, rpths):
|
||||
""" basic first fit assignment
|
||||
if reversed path are provided, means that occupation is bidir
|
||||
"""
|
||||
for i, pth in enumerate(pths):
|
||||
for pth, rq, rpth in zip(pths, rqs, rpths):
|
||||
# computes the number of channels required
|
||||
try:
|
||||
if rqs[i].blocking_reason:
|
||||
rqs[i].blocked = True
|
||||
rqs[i].N = 0
|
||||
rqs[i].M = 0
|
||||
if rq.blocking_reason:
|
||||
rq.blocked = True
|
||||
rq.N = 0
|
||||
rq.M = 0
|
||||
except AttributeError:
|
||||
nb_wl = ceil(rqs[i].path_bandwidth / rqs[i].bit_rate)
|
||||
nb_wl = ceil(rq.path_bandwidth / rq.bit_rate)
|
||||
# computes the total nb of slots according to requested spacing
|
||||
# TODO : express superchannels
|
||||
# assumes that all channels must be grouped
|
||||
# TODO : enables non contiguous reservation in case of blocking
|
||||
requested_m = ceil(rqs[i].spacing / 0.0125e12) * nb_wl
|
||||
# concatenate all path and reversed path elements to derive slots availability
|
||||
(center_n, startn, stopn), path_oms = spectrum_selection(pth + rpths[i], oms_list, requested_m,
|
||||
requested_n=None)
|
||||
requested_m = ceil(rq.spacing / 0.0125e12) * nb_wl
|
||||
if getattr(rq, 'M', None) is not None:
|
||||
# Consistency check between the requested M and path_bandwidth
|
||||
# M value should be bigger than the computed requested_m (simple estimate)
|
||||
# TODO: elaborate a more accurate estimate with nb_wl * tx_osnr + possibly guardbands in case of
|
||||
# superchannel closed packing.
|
||||
if requested_m <= rq.M:
|
||||
requested_m = rq.M
|
||||
else:
|
||||
rq.N = 0
|
||||
rq.M = 0
|
||||
rq.blocking_reason = 'NOT_ENOUGH_RESERVED_SPECTRUM'
|
||||
continue
|
||||
requested_n = getattr(rq, 'N', None)
|
||||
(center_n, startn, stopn), path_oms = spectrum_selection(pth + rpth, oms_list, requested_m,
|
||||
requested_n)
|
||||
# checks that requested_m is fitting startm and stopm
|
||||
# if not None, center_n and start, stop frequencies are applicable to all oms of pth
|
||||
# checks that spectrum is not None else indicate blocking reason
|
||||
@@ -420,12 +432,12 @@ def pth_assign_spectrum(pths, rqs, oms_list, rpths):
|
||||
|
||||
for oms_elem in path_oms:
|
||||
oms_list[oms_elem].assign_spectrum(center_n, requested_m)
|
||||
oms_list[oms_elem].add_service(rqs[i].request_id, nb_wl)
|
||||
rqs[i].blocked = False
|
||||
rqs[i].N = center_n
|
||||
rqs[i].M = requested_m
|
||||
oms_list[oms_elem].add_service(rq.request_id, nb_wl)
|
||||
rq.blocked = False
|
||||
rq.N = center_n
|
||||
rq.M = requested_m
|
||||
else:
|
||||
rqs[i].blocked = True
|
||||
rqs[i].N = 0
|
||||
rqs[i].M = 0
|
||||
rqs[i].blocking_reason = 'NO_SPECTRUM'
|
||||
rq.blocked = True
|
||||
rq.N = 0
|
||||
rq.M = 0
|
||||
rq.blocking_reason = 'NO_SPECTRUM'
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
"trx_mode": "mode 1",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"N": "null",
|
||||
"M": "null"
|
||||
"N": null,
|
||||
"M": null
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -39,8 +39,8 @@
|
||||
"trx_mode": "mode 1",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"N": "null",
|
||||
"M": "null"
|
||||
"N": null,
|
||||
"M": null
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -64,8 +64,8 @@
|
||||
"trx_mode": "mode 1",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"N": "null",
|
||||
"M": "null"
|
||||
"N": null,
|
||||
"M": null
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
"trx_mode": "mode 1",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"N": "null",
|
||||
"M": "null"
|
||||
"N": null,
|
||||
"M": null
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -39,8 +39,8 @@
|
||||
"trx_mode": "mode 1",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"N": "null",
|
||||
"M": "null"
|
||||
"N": null,
|
||||
"M": null
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -104,8 +104,8 @@
|
||||
"trx_mode": "mode 1",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"N": "null",
|
||||
"M": "null"
|
||||
"N": null,
|
||||
"M": null
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -129,8 +129,8 @@
|
||||
"trx_mode": "mode 2",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"N": "null",
|
||||
"M": "null"
|
||||
"N": null,
|
||||
"M": null
|
||||
}
|
||||
],
|
||||
"spacing": 75000000000.0,
|
||||
@@ -154,8 +154,8 @@
|
||||
"trx_mode": "mode 2",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"N": "null",
|
||||
"M": "null"
|
||||
"N": null,
|
||||
"M": null
|
||||
}
|
||||
],
|
||||
"spacing": 75000000000.0,
|
||||
@@ -179,8 +179,8 @@
|
||||
"trx_mode": "mode 2",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"N": "null",
|
||||
"M": "null"
|
||||
"N": null,
|
||||
"M": null
|
||||
}
|
||||
],
|
||||
"spacing": 75000000000.0,
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
"trx_mode": "16QAM",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"n": "null",
|
||||
"m": "null"
|
||||
"N":"null",
|
||||
"M":"null"
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -39,8 +39,8 @@
|
||||
"trx_mode": "PS_SP64_1",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"n": "null",
|
||||
"m": "null"
|
||||
"N":"null",
|
||||
"M":"null"
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -64,8 +64,8 @@
|
||||
"trx_mode": "PS_SP64_1",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"n": "null",
|
||||
"m": "null"
|
||||
"N":"null",
|
||||
"M":"null"
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -89,8 +89,8 @@
|
||||
"trx_mode": "PS_SP64_1",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"n": "null",
|
||||
"m": "null"
|
||||
"N":"null",
|
||||
"M":"null"
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -135,8 +135,8 @@
|
||||
"trx_mode": "mode 2 - fake",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"n": "null",
|
||||
"m": "null"
|
||||
"N":"null",
|
||||
"M":"null"
|
||||
}
|
||||
],
|
||||
"spacing": 75000000000.0,
|
||||
@@ -160,8 +160,8 @@
|
||||
"trx_mode": "mode 2",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"n": "null",
|
||||
"m": "null"
|
||||
"N":"null",
|
||||
"M":"null"
|
||||
}
|
||||
],
|
||||
"spacing": 75000000000.0,
|
||||
@@ -185,8 +185,8 @@
|
||||
"trx_mode": "PS_SP64_1",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"n": "null",
|
||||
"m": "null"
|
||||
"N":"null",
|
||||
"M":"null"
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -223,8 +223,8 @@
|
||||
"trx_mode": "mode 3",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"n": "null",
|
||||
"m": "null"
|
||||
"N":"null",
|
||||
"M":"null"
|
||||
}
|
||||
],
|
||||
"spacing": 62500000000.0,
|
||||
@@ -261,8 +261,8 @@
|
||||
"trx_mode": "PS_SP64_1",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"n": "null",
|
||||
"m": "null"
|
||||
"N":"null",
|
||||
"M":"null"
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -286,8 +286,8 @@
|
||||
"trx_mode": "PS_SP64_1",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"n": "null",
|
||||
"m": "null"
|
||||
"N":"null",
|
||||
"M":"null"
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -332,8 +332,8 @@
|
||||
"trx_mode": "16QAM",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"n": "null",
|
||||
"m": "null"
|
||||
"N":"null",
|
||||
"M":"null"
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -357,8 +357,8 @@
|
||||
"trx_mode": "mode 1",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"n": "null",
|
||||
"m": "null"
|
||||
"N":"null",
|
||||
"M":"null"
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -382,8 +382,8 @@
|
||||
"trx_mode": "PS_SP64_1",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"n": "null",
|
||||
"m": "null"
|
||||
"N":"null",
|
||||
"M":"null"
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -407,8 +407,8 @@
|
||||
"trx_mode": null,
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"n": "null",
|
||||
"m": "null"
|
||||
"N":"null",
|
||||
"M":"null"
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -453,8 +453,8 @@
|
||||
"trx_mode": null,
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"n": "null",
|
||||
"m": "null"
|
||||
"N":"null",
|
||||
"M":"null"
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -478,8 +478,8 @@
|
||||
"trx_mode": null,
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"n": "null",
|
||||
"m": "null"
|
||||
"N":"null",
|
||||
"M":"null"
|
||||
}
|
||||
],
|
||||
"spacing": 75000000000.0,
|
||||
@@ -503,8 +503,8 @@
|
||||
"trx_mode": null,
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"n": "null",
|
||||
"m": "null"
|
||||
"N":"null",
|
||||
"M":"null"
|
||||
}
|
||||
],
|
||||
"spacing": 50000000000.0,
|
||||
@@ -528,8 +528,8 @@
|
||||
"trx_mode": null,
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"n": "null",
|
||||
"m": "null"
|
||||
"N":"null",
|
||||
"M":"null"
|
||||
}
|
||||
],
|
||||
"spacing": 75000000000.0,
|
||||
@@ -553,8 +553,8 @@
|
||||
"trx_mode": null,
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"n": "null",
|
||||
"m": "null"
|
||||
"N":"null",
|
||||
"M":"null"
|
||||
}
|
||||
],
|
||||
"spacing": 30000000000.0,
|
||||
|
||||
@@ -122,7 +122,8 @@ def create_rq(equipment, srce, dest, bdir, node_list, loose_list, rqid='test_req
|
||||
'nodes_list': node_list,
|
||||
'loose_list': loose_list,
|
||||
'path_bandwidth': 100.0e9,
|
||||
'power': 1.0
|
||||
'power': 1.0,
|
||||
'effective_freq_slot': None,
|
||||
}
|
||||
params['format'] = params['trx_mode']
|
||||
trx_params = trx_mode_params(equipment, params['trx_type'], params['trx_mode'], True)
|
||||
|
||||
@@ -394,6 +394,7 @@ def test_excel_ila_constraints(source, destination, route_list, hoptype, expecte
|
||||
'nb_channel': 0,
|
||||
'power': 0,
|
||||
'path_bandwidth': 0,
|
||||
'effective_freq_slot': None
|
||||
}
|
||||
request = PathRequest(**params)
|
||||
|
||||
|
||||
@@ -244,6 +244,7 @@ def test_roadm_target_power(prev_node_type, effective_pch_out_db):
|
||||
params['loose_list'] = ['strict']
|
||||
params['format'] = ''
|
||||
params['path_bandwidth'] = 100e9
|
||||
params['effective_freq_slot'] = None
|
||||
trx_params = trx_mode_params(equipment)
|
||||
params.update(trx_params)
|
||||
req = PathRequest(**params)
|
||||
|
||||
Reference in New Issue
Block a user