diff --git a/gnpy/core/parameters.py b/gnpy/core/parameters.py index 917651b7e..4a9cbd6e6 100644 --- a/gnpy/core/parameters.py +++ b/gnpy/core/parameters.py @@ -130,7 +130,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 diff --git a/gnpy/example-data/eqpt_config.json b/gnpy/example-data/eqpt_config.json index d612764b1..66e212ac6 100644 --- a/gnpy/example-data/eqpt_config.json +++ b/gnpy/example-data/eqpt_config.json @@ -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 @@ -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 @@ -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 @@ -278,7 +278,7 @@ "roadm-ptyp": -12, "roadm-osnr": 41, "roadm-noise-figure": 15 - } + }] } ] } diff --git a/gnpy/tools/json_io.py b/gnpy/tools/json_io.py index 757887694..32d0b84f7 100644 --- a/gnpy/tools/json_io.py +++ b/gnpy/tools/json_io.py @@ -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' diff --git a/tests/data/eqpt_config.json b/tests/data/eqpt_config.json index abe9b4189..49d5f6032 100644 --- a/tests/data/eqpt_config.json +++ b/tests/data/eqpt_config.json @@ -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 @@ -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 @@ -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 @@ -147,7 +148,7 @@ "roadm-ptyp": -12, "roadm-osnr": 41, "roadm-noise-figure": 15 - } + }] }] }, { "target_pch_out_db": -20, diff --git a/tests/invocation/logs_path_request b/tests/invocation/logs_path_request index a97202482..b0badcd0d 100644 --- a/tests/invocation/logs_path_request +++ b/tests/invocation/logs_path_request @@ -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 diff --git a/tests/invocation/logs_path_requests_run_CD_PMD_PDL_missing b/tests/invocation/logs_path_requests_run_CD_PMD_PDL_missing index ec43f23a8..087f743e9 100644 --- a/tests/invocation/logs_path_requests_run_CD_PMD_PDL_missing +++ b/tests/invocation/logs_path_requests_run_CD_PMD_PDL_missing @@ -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 diff --git a/tests/invocation/logs_power_sweep_example b/tests/invocation/logs_power_sweep_example index a38ee412b..b4f0ccb05 100644 --- a/tests/invocation/logs_power_sweep_example +++ b/tests/invocation/logs_power_sweep_example @@ -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 diff --git a/tests/invocation/logs_transmission_main_example__path b/tests/invocation/logs_transmission_main_example__path new file mode 100644 index 000000000..f9ca644bb --- /dev/null +++ b/tests/invocation/logs_transmission_main_example__path @@ -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) diff --git a/tests/invocation/logs_transmission_saturated b/tests/invocation/logs_transmission_saturated index a14ddfe6e..108ce0815 100644 --- a/tests/invocation/logs_transmission_saturated +++ b/tests/invocation/logs_transmission_saturated @@ -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 diff --git a/tests/test_equalization.py b/tests/test_equalization.py index 206e0c8cb..2611bed4a 100644 --- a/tests/test_equalization.py +++ b/tests/test_equalization.py @@ -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) diff --git a/tests/test_roadm_restrictions.py b/tests/test_roadm_restrictions.py index 44519fb8e..439f92492 100644 --- a/tests/test_roadm_restrictions.py +++ b/tests/test_roadm_restrictions.py @@ -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'