Skip to content

Commit

Permalink
feat: transform roadm-paths into list indexed with frequency band
Browse files Browse the repository at this point in the history
to be conformed with ietf + to prepare for next multiband case

Signed-off-by: EstherLerouzic <[email protected]>
Change-Id: If71857ef7dff9eaaa4c16e3837d3500bcef2fa72
  • Loading branch information
EstherLerouzic committed Mar 15, 2024
1 parent 3030499 commit d50d4be
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 34 deletions.
2 changes: 1 addition & 1 deletion gnpy/core/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def get_roadm_path_impairments(self, path_impairments_list):
for path_impairment in path_impairments_list:
index = path_impairment['roadm-path-impairments-id']
path_type = next(key for key in path_impairment if key in authorized_path_types.keys())
impairment_dict = dict({'path-type': authorized_path_types[path_type]}, **path_impairment[path_type])
impairment_dict = dict({'path-type': authorized_path_types[path_type]}, **path_impairment[path_type][0])
roadm_path_impairments[index] = RoadmImpairment(impairment_dict)
return roadm_path_impairments

Expand Down
12 changes: 6 additions & 6 deletions gnpy/example-data/eqpt_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
"roadm-path-impairments": [
{
"roadm-path-impairments-id": 0,
"roadm-express-path": {
"roadm-express-path": [{
"frequency-range": {
"lower-frequency": 191.3e12,
"upper-frequency": 196.1e12
Expand All @@ -242,10 +242,10 @@
"roadm-pdl": 0,
"roadm-inband-crosstalk": 0,
"roadm-maxloss": 16.5
}
}]
}, {
"roadm-path-impairments-id": 1,
"roadm-add-path": {
"roadm-add-path": [{
"frequency-range": {
"lower-frequency": 191.3e12,
"upper-frequency": 196.1e12
Expand All @@ -258,10 +258,10 @@
"roadm-pmax": 2.5,
"roadm-osnr": 41,
"roadm-noise-figure": 23
}
}]
}, {
"roadm-path-impairments-id": 2,
"roadm-drop-path": {
"roadm-drop-path": [{
"frequency-range": {
"lower-frequency": 191.3e12,
"upper-frequency": 196.1e12
Expand All @@ -278,7 +278,7 @@
"roadm-ptyp": -12,
"roadm-osnr": 41,
"roadm-noise-figure": 15
}
}]
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion gnpy/tools/json_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def update_attr(self, default_values, kwargs, name):
clean_kwargs = {k: v for k, v in kwargs.items() if v != ''}
for k, v in default_values.items():
setattr(self, k, clean_kwargs.get(k, v))
if k not in clean_kwargs and name != 'Amp' and v is not None:
if k not in clean_kwargs and name != 'Amp' and v is not None and v != []:
# do not show this warning if the default value is None
msg = f'\n\tWARNING missing {k} attribute in eqpt_config.json[{name}]' \
+ f'\n\tdefault value is {k} = {v}\n'
Expand Down
11 changes: 6 additions & 5 deletions tests/data/eqpt_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"roadm-path-impairments": [
{
"roadm-path-impairments-id": 0,
"roadm-express-path": {
"roadm-express-path": [{
"frequency-range": {
"lower-frequency": 191.3e12,
"upper-frequency": 196.1e12
Expand All @@ -112,9 +112,10 @@
"roadm-inband-crosstalk": 0,
"roadm-maxloss": 16.5
}
]
}, {
"roadm-path-impairments-id": 1,
"roadm-add-path": {
"roadm-add-path": [{
"frequency-range": {
"lower-frequency": 191.3e12,
"upper-frequency": 196.1e12
Expand All @@ -127,10 +128,10 @@
"roadm-pmax": 2.5,
"roadm-osnr": 41,
"roadm-noise-figure": 23
}
}]
}, {
"roadm-path-impairments-id": 2,
"roadm-drop-path": {
"roadm-drop-path": [{
"frequency-range": {
"lower-frequency": 191.3e12,
"upper-frequency": 196.1e12
Expand All @@ -147,7 +148,7 @@
"roadm-ptyp": -12,
"roadm-osnr": 41,
"roadm-noise-figure": 15
}
}]
}]
}, {
"target_pch_out_db": -20,
Expand Down
4 changes: 0 additions & 4 deletions tests/invocation/logs_path_request
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ WARNING gnpy.tools.json_io:json_io.py
WARNING missing type_variety attribute in eqpt_config.json[Roadm]
default value is type_variety = default

WARNING gnpy.tools.json_io:json_io.py
WARNING missing roadm-path-impairments attribute in eqpt_config.json[Roadm]
default value is roadm-path-impairments = []

INFO gnpy.tools.json_io:json_io.py Automatically converting requests from XLS to JSON
INFO gnpy.topology.request:request.py
request 0
Expand Down
4 changes: 0 additions & 4 deletions tests/invocation/logs_path_requests_run_CD_PMD_PDL_missing
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ WARNING gnpy.tools.json_io:json_io.py
WARNING missing type_variety attribute in eqpt_config.json[Roadm]
default value is type_variety = default

WARNING gnpy.tools.json_io:json_io.py
WARNING missing roadm-path-impairments attribute in eqpt_config.json[Roadm]
default value is roadm-path-impairments = []

INFO gnpy.topology.request:request.py
request 0
Computing path from trx Abilene to trx Albany
Expand Down
4 changes: 0 additions & 4 deletions tests/invocation/logs_power_sweep_example
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ WARNING gnpy.tools.json_io:json_io.py
WARNING missing type_variety attribute in eqpt_config.json[Roadm]
default value is type_variety = default

WARNING gnpy.tools.json_io:json_io.py
WARNING missing roadm-path-impairments attribute in eqpt_config.json[Roadm]
default value is roadm-path-impairments = []

INFO gnpy.tools.cli_examples:cli_examples.py source = 'brest'
INFO gnpy.tools.cli_examples:cli_examples.py destination = 'rennes'
WARNING gnpy.core.network:network.py
Expand Down
39 changes: 39 additions & 0 deletions tests/invocation/logs_transmission_main_example__path
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
WARNING gnpy.tools.json_io:json_io.py
WARNING missing type_variety attribute in eqpt_config.json[Roadm]
default value is type_variety = default

WARNING gnpy.tools.convert:convert.py missing header delta p
WARNING gnpy.tools.convert:convert.py missing header delta p
INFO gnpy.tools.cli_examples:cli_examples.py source = Transceiver(uid='trx Lorient_KMA', osnr_ase_01nm=None, osnr_ase=None, osnr_nli=None, snr=None, chromatic_dispersion=None, pmd=None, pdl=None, latency=None, penalties={})
INFO gnpy.tools.cli_examples:cli_examples.py destination = Transceiver(uid='trx Brest_KLA', osnr_ase_01nm=None, osnr_ase=None, osnr_nli=None, snr=None, chromatic_dispersion=None, pmd=None, pdl=None, latency=None, penalties={})
INFO gnpy.core.network:network.py
Reference used for design: (Input optical power reference in span = 0.00dBm
spacing = 50.000GHz
nb_channels = 96
WARNING gnpy.core.network:network.py
WARNING: effective gain in Node east edfa in Lannion_CAS to Stbrieuc
is above user specified amplifier std_low_gain
max flat gain: 16dB ; required gain: 20.0dB. Please check amplifier type.

WARNING gnpy.core.network:network.py
WARNING: effective gain in Node east edfa in Lannion_CAS to Morlaix
is above user specified amplifier std_low_gain
max flat gain: 16dB ; required gain: 20.5dB. Please check amplifier type.

WARNING gnpy.core.network:network.py
WARNING: effective gain in Node west edfa in Lannion_CAS to Corlay
is above user specified amplifier test
max flat gain: 25dB ; required gain: 28.0dB. Please check amplifier type.

WARNING gnpy.core.network:network.py
WARNING: effective gain in Node east edfa in Brest_KLA to Quimper
is above user specified amplifier std_low_gain
max flat gain: 16dB ; required gain: 20.0dB. Please check amplifier type.

INFO gnpy.tools.orange_worker_utils:orange_worker_utils.py Power mode is set to True=> it can be modified in eqpt_config.json - Span
INFO gnpy.tools.orange_worker_utils:orange_worker_utils.py Now propagating between trx Lorient_KMA and trx Brest_KLA
INFO gnpy.tools.orange_worker_utils:orange_worker_utils.py
Channels propagating: (Input optical power deviation in span = 0.00dB,
spacing = 50.00GHz,
transceiver output power = 0.00dBm,
nb_channels = 96)
4 changes: 0 additions & 4 deletions tests/invocation/logs_transmission_saturated
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ WARNING gnpy.tools.json_io:json_io.py
WARNING missing type_variety attribute in eqpt_config.json[Roadm]
default value is type_variety = default

WARNING gnpy.tools.json_io:json_io.py
WARNING missing roadm-path-impairments attribute in eqpt_config.json[Roadm]
default value is roadm-path-impairments = []

INFO gnpy.tools.cli_examples:cli_examples.py source = 'lannion'
INFO gnpy.tools.cli_examples:cli_examples.py destination = 'lorient'
WARNING gnpy.core.network:network.py
Expand Down
2 changes: 1 addition & 1 deletion tests/test_equalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ def test_tx_power(tx_power_dbm):
si = roadm(si, "east edfa in Lannion_CAS to Corlay", "trx Lannion_CAS")
# Checks that if tx_power on add port is below min required power, its equalization target can not be met
add_max_loss = next(e for e in getattr(equipment['Roadm']['example_detailed_impairments'], 'roadm-path-impairments')
if 'roadm-add-path' in e)['roadm-add-path']['roadm-maxloss']
if 'roadm-add-path' in e)['roadm-add-path'][0]['roadm-maxloss']
min_required_add_power = -20 + add_max_loss
power_reduction = max(0, min_required_add_power - tx_power_dbm)
assert_allclose(si.signal, dbm2watt(array([-20, -20 - power_reduction, -20])), rtol=1e-5)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_roadm_restrictions.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,16 +595,16 @@ def test_roadm_per_degree_impairments(type_variety, from_degree, to_degree, impa
json_data['Roadm'][2]['roadm-path-impairments'] = [
{
"roadm-path-impairments-id": 1,
"roadm-add-path": {
"roadm-add-path": [{
"roadm-osnr": 41,
}
}]
}, {
"roadm-path-impairments-id": 3,
"roadm-add-path": {
"roadm-add-path": [{
"roadm-inband-crosstalk": 0,
"roadm-osnr": 20,
"roadm-noise-figure": 23
}
}]
}]
equipment = _equipment_from_json(json_data, EQPT_LIBRARY_NAME)
assert equipment['Roadm']['default'].type_variety == 'default'
Expand Down

0 comments on commit d50d4be

Please sign in to comment.