diff --git a/gnpy/core/elements.py b/gnpy/core/elements.py index 7ae32b07e..e61adcbb1 100644 --- a/gnpy/core/elements.py +++ b/gnpy/core/elements.py @@ -273,9 +273,10 @@ def to_json(self): to_json = { 'uid': self.uid, 'type': type(self).__name__, + 'type_variety': self.type_variety, 'params': { equalisation: value, - 'restrictions': self.restrictions, + 'restrictions': self.restrictions }, 'metadata': { 'location': self.metadata['location']._asdict() @@ -299,6 +300,7 @@ def __str__(self): total_pch = pretty_summary_print(per_label_average(self.pch_out_dbm, self.propagated_labels)) return '\n'.join([f'{type(self).__name__} {self.uid}', + f' type_variety: {self.type_variety}', f' effective loss (dB): {self.ref_effective_loss:.2f}', f' reference pch out (dBm): {self.ref_pch_out_dbm:.2f}', f' actual pch out (dBm): {total_pch}']) diff --git a/gnpy/example-data/eqpt_config.json b/gnpy/example-data/eqpt_config.json index 3b87bab7c..556816188 100644 --- a/gnpy/example-data/eqpt_config.json +++ b/gnpy/example-data/eqpt_config.json @@ -1,4 +1,5 @@ -{ "Edfa":[{ +{ + "Edfa": [{ "type_variety": "high_detail_model_example", "type_def": "advanced_model", "gain_flatmax": 25, @@ -7,7 +8,7 @@ "advanced_config_from_json": "std_medium_gain_advanced_config.json", "out_voa_auto": false, "allowed_for_design": false - }, { + }, { "type_variety": "Juniper_BoosterHG", "type_def": "advanced_model", "gain_flatmax": 25, @@ -16,8 +17,7 @@ "advanced_config_from_json": "Juniper-BoosterHG.json", "out_voa_auto": false, "allowed_for_design": false - }, - { + }, { "type_variety": "operator_model_example", "type_def": "variable_gain", "gain_flatmax": 26, @@ -26,61 +26,54 @@ "nf_min": 6, "nf_max": 10, "out_voa_auto": false, - "allowed_for_design": false - }, - { + "allowed_for_design": false + }, { "type_variety": "openroadm_ila_low_noise", "type_def": "openroadm", "gain_flatmax": 27, "gain_min": 0, "p_max": 22, - "nf_coef": [-8.104e-4,-6.221e-2,-5.889e-1,37.62], + "nf_coef": [-8.104e-4, -6.221e-2, -5.889e-1, 37.62], "allowed_for_design": false - }, - { + }, { "type_variety": "openroadm_ila_standard", "type_def": "openroadm", "gain_flatmax": 27, "gain_min": 0, "p_max": 22, - "nf_coef": [-5.952e-4,-6.250e-2,-1.071,28.99], + "nf_coef": [-5.952e-4, -6.250e-2, -1.071, 28.99], "allowed_for_design": false - }, - { + }, { "type_variety": "openroadm_mw_mw_preamp", "type_def": "openroadm_preamp", "gain_flatmax": 27, "gain_min": 0, "p_max": 22, "allowed_for_design": false - }, - { + }, { "type_variety": "openroadm_mw_mw_preamp_typical_ver5", "type_def": "openroadm", "gain_flatmax": 27, "gain_min": 0, "p_max": 22, - "nf_coef": [-5.952e-4,-6.250e-2,-1.071,28.99], + "nf_coef": [-5.952e-4, -6.250e-2, -1.071, 28.99], "allowed_for_design": false - }, - { + }, { "type_variety": "openroadm_mw_mw_preamp_worstcase_ver5", "type_def": "openroadm", "gain_flatmax": 27, "gain_min": 0, "p_max": 22, - "nf_coef": [-5.952e-4,-6.250e-2,-1.071,27.99], + "nf_coef": [-5.952e-4, -6.250e-2, -1.071, 27.99], "allowed_for_design": false - }, - { + }, { "type_variety": "openroadm_mw_mw_booster", "type_def": "openroadm_booster", "gain_flatmax": 32, "gain_min": 0, "p_max": 22, "allowed_for_design": false - }, - { + }, { "type_variety": "std_high_gain", "type_def": "variable_gain", "gain_flatmax": 35, @@ -90,8 +83,7 @@ "nf_max": 7, "out_voa_auto": false, "allowed_for_design": true - }, - { + }, { "type_variety": "std_medium_gain", "type_def": "variable_gain", "gain_flatmax": 26, @@ -101,8 +93,7 @@ "nf_max": 10, "out_voa_auto": false, "allowed_for_design": true - }, - { + }, { "type_variety": "std_low_gain", "type_def": "variable_gain", "gain_flatmax": 16, @@ -112,8 +103,7 @@ "nf_max": 11, "out_voa_auto": false, "allowed_for_design": true - }, - { + }, { "type_variety": "high_power", "type_def": "variable_gain", "gain_flatmax": 16, @@ -123,8 +113,7 @@ "nf_max": 15, "out_voa_auto": false, "allowed_for_design": false - }, - { + }, { "type_variety": "std_fixed_gain", "type_def": "fixed_gain", "gain_flatmax": 21, @@ -132,8 +121,7 @@ "p_max": 21, "nf0": 5.5, "allowed_for_design": false - }, - { + }, { "type_variety": "4pumps_raman", "type_def": "fixed_gain", "gain_flatmax": 12, @@ -141,8 +129,7 @@ "p_max": 21, "nf0": -1, "allowed_for_design": false - }, - { + }, { "type_variety": "hybrid_4pumps_lowgain", "type_def": "dual_stage", "raman": true, @@ -150,8 +137,7 @@ "preamp_variety": "4pumps_raman", "booster_variety": "std_low_gain", "allowed_for_design": true - }, - { + }, { "type_variety": "hybrid_4pumps_mediumgain", "type_def": "dual_stage", "raman": true, @@ -159,53 +145,49 @@ "preamp_variety": "4pumps_raman", "booster_variety": "std_medium_gain", "allowed_for_design": true - }, - { + }, { "type_variety": "medium+low_gain", "type_def": "dual_stage", "gain_min": 25, "preamp_variety": "std_medium_gain", "booster_variety": "std_low_gain", "allowed_for_design": true - }, - { + }, { "type_variety": "medium+high_power", "type_def": "dual_stage", "gain_min": 25, "preamp_variety": "std_medium_gain", "booster_variety": "high_power", "allowed_for_design": false - } - ], - "Fiber":[{ + } + ], + "Fiber": [{ "type_variety": "SSMF", "dispersion": 1.67e-05, "effective_area": 83e-12, "pmd_coef": 1.265e-15 - }, - { + }, { "type_variety": "NZDF", "dispersion": 0.5e-05, "effective_area": 72e-12, "pmd_coef": 1.265e-15 - }, - { + }, { "type_variety": "LOF", "dispersion": 2.2e-05, "effective_area": 125e-12, "pmd_coef": 1.265e-15 - } - ], - "RamanFiber":[{ + } + ], + "RamanFiber": [{ "type_variety": "SSMF", "dispersion": 1.67e-05, "effective_area": 83e-12, "pmd_coef": 1.265e-15 - } - ], - "Span":[{ - "power_mode":true, - "delta_power_range_db": [-2,3,0.5], + } + ], + "Span": [{ + "power_mode": true, + "delta_power_range_db": [-2, 3, 0.5], "max_fiber_lineic_loss_for_raman": 0.25, "target_extended_gain": 2.5, "max_length": 150, @@ -215,109 +197,111 @@ "EOL": 0, "con_in": 0, "con_out": 0 - } - ], - "Roadm":[{ + } + ], + "Roadm": [{ "target_pch_out_db": -20, "add_drop_osnr": 38, "pmd": 0, "pdl": 0, "restrictions": { - "preamp_variety_list":[], - "booster_variety_list":[] - } - }], - "SI":[{ + "preamp_variety_list": [], + "booster_variety_list": [] + } + }, { + "type_variety": "roadm_type_1", + "target_pch_out_db": -18, + "add_drop_osnr": 35, + "pmd": 0, + "pdl": 0, + "restrictions": { + "preamp_variety_list": [], + "booster_variety_list": [] + } + } + ], + "SI": [{ "f_min": 191.3e12, "baud_rate": 32e9, - "f_max":195.1e12, + "f_max": 195.1e12, "spacing": 50e9, "power_dbm": 0, - "power_range_db": [0,0,1], + "power_range_db": [0, 0, 1], "roll_off": 0.15, "tx_osnr": 40, "sys_margins": 2 - }], - "Transceiver":[ - { + } + ], + "Transceiver": [{ "type_variety": "vendorA_trx-type1", - "frequency":{ - "min": 191.35e12, - "max": 196.1e12 - }, - "mode":[ - { - - "format": "mode 1", - "baud_rate": 32e9, - "OSNR": 11, - "bit_rate": 100e9, - "roll_off": 0.15, - "tx_osnr": 40, - "min_spacing": 37.5e9, - "cost":1 - }, - { - "format": "mode 2", - "baud_rate": 66e9, - "OSNR": 15, - "bit_rate": 200e9, - "roll_off": 0.15, - "tx_osnr": 40, - "min_spacing": 75e9, - "cost":1 - } - ] + "frequency": { + "min": 191.35e12, + "max": 196.1e12 }, - { + "mode": [{ + "format": "mode 1", + "baud_rate": 32e9, + "OSNR": 11, + "bit_rate": 100e9, + "roll_off": 0.15, + "tx_osnr": 40, + "min_spacing": 37.5e9, + "cost": 1 + }, { + "format": "mode 2", + "baud_rate": 66e9, + "OSNR": 15, + "bit_rate": 200e9, + "roll_off": 0.15, + "tx_osnr": 40, + "min_spacing": 75e9, + "cost": 1 + } + ] + }, { "type_variety": "Voyager", - "frequency":{ - "min": 191.35e12, - "max": 196.1e12 - }, - "mode":[ - { - "format": "mode 1", - "baud_rate": 32e9, - "OSNR": 12, - "bit_rate": 100e9, - "roll_off": 0.15, - "tx_osnr": 40, - "min_spacing": 37.5e9, - "cost":1 - }, - { - "format": "mode 3", - "baud_rate": 44e9, - "OSNR": 18, - "bit_rate": 300e9, - "roll_off": 0.15, - "tx_osnr": 40, - "min_spacing": 62.5e9, - "cost":1 - }, - { - "format": "mode 2", - "baud_rate": 66e9, - "OSNR": 21, - "bit_rate": 400e9, - "roll_off": 0.15, - "tx_osnr": 40, - "min_spacing": 75e9, - "cost":1 - }, - { - "format": "mode 4", - "baud_rate": 66e9, - "OSNR": 16, - "bit_rate": 200e9, - "roll_off": 0.15, - "tx_osnr": 40, - "min_spacing": 75e9, - "cost":1 - } - ] - } - ] - + "frequency": { + "min": 191.35e12, + "max": 196.1e12 + }, + "mode": [{ + "format": "mode 1", + "baud_rate": 32e9, + "OSNR": 12, + "bit_rate": 100e9, + "roll_off": 0.15, + "tx_osnr": 40, + "min_spacing": 37.5e9, + "cost": 1 + }, { + "format": "mode 3", + "baud_rate": 44e9, + "OSNR": 18, + "bit_rate": 300e9, + "roll_off": 0.15, + "tx_osnr": 40, + "min_spacing": 62.5e9, + "cost": 1 + }, { + "format": "mode 2", + "baud_rate": 66e9, + "OSNR": 21, + "bit_rate": 400e9, + "roll_off": 0.15, + "tx_osnr": 40, + "min_spacing": 75e9, + "cost": 1 + }, { + "format": "mode 4", + "baud_rate": 66e9, + "OSNR": 16, + "bit_rate": 200e9, + "roll_off": 0.15, + "tx_osnr": 40, + "min_spacing": 75e9, + "cost": 1 + } + ] + } + ] } diff --git a/gnpy/tools/json_io.py b/gnpy/tools/json_io.py index dbf30cb55..ce8cc5311 100644 --- a/gnpy/tools/json_io.py +++ b/gnpy/tools/json_io.py @@ -95,6 +95,7 @@ def __init__(self, **kwargs): class Roadm(_JsonThing): default_values = { + 'type_variety': 'default', 'add_drop_osnr': 100, 'pmd': 0, 'pdl': 0, @@ -361,11 +362,13 @@ def _update_dual_stage(equipment): def _roadm_restrictions_sanity_check(equipment): """verifies that booster and preamp restrictions specified in roadm equipment are listed in the edfa.""" - restrictions = equipment['Roadm']['default'].restrictions['booster_variety_list'] + \ - equipment['Roadm']['default'].restrictions['preamp_variety_list'] - for amp_name in restrictions: - if amp_name not in equipment['Edfa']: - raise EquipmentConfigError(f'ROADM restriction {amp_name} does not refer to a defined EDFA name') + for roadm_type, roadm_eqpt in equipment['Roadm'].items(): + restrictions = roadm_eqpt.restrictions['booster_variety_list'] + \ + roadm_eqpt.restrictions['preamp_variety_list'] + for amp_name in restrictions: + if amp_name not in equipment['Edfa']: + raise EquipmentConfigError(f'ROADM {roadm_type} restriction {amp_name} does not refer to a ' + + 'defined EDFA name') def _check_fiber_vs_raman_fiber(equipment): @@ -481,7 +484,7 @@ def network_from_json(json_data, equipment): temp = merge_amplifier_restrictions(temp, extra_params) el_config['params'] = temp el_config['type_variety'] = variety - elif (typ in ['Fiber', 'RamanFiber']): + elif (typ in ['Fiber', 'RamanFiber', 'Roadm']): raise ConfigurationError(f'The {typ} of variety type {variety} was not recognized:' '\nplease check it is properly defined in the eqpt_config json file') elif typ == 'Edfa': diff --git a/tests/data/CORONET_Global_Topology_auto_design_expected.json b/tests/data/CORONET_Global_Topology_auto_design_expected.json index 86120d591..6417fdbd0 100644 --- a/tests/data/CORONET_Global_Topology_auto_design_expected.json +++ b/tests/data/CORONET_Global_Topology_auto_design_expected.json @@ -1203,6 +1203,7 @@ { "uid": "roadm Abilene", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1226,6 +1227,7 @@ { "uid": "roadm Albany", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1249,6 +1251,7 @@ { "uid": "roadm Albuquerque", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1274,6 +1277,7 @@ { "uid": "roadm Atlanta", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1298,6 +1302,7 @@ { "uid": "roadm Austin", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1321,6 +1326,7 @@ { "uid": "roadm Baltimore", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1345,6 +1351,7 @@ { "uid": "roadm Baton_Rouge", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1368,6 +1375,7 @@ { "uid": "roadm Billings", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1392,6 +1400,7 @@ { "uid": "roadm Birmingham", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1416,6 +1425,7 @@ { "uid": "roadm Bismarck", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1439,6 +1449,7 @@ { "uid": "roadm Boston", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1462,6 +1473,7 @@ { "uid": "roadm Buffalo", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1485,6 +1497,7 @@ { "uid": "roadm Charleston", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1508,6 +1521,7 @@ { "uid": "roadm Charlotte", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1531,6 +1545,7 @@ { "uid": "roadm Chicago", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1555,6 +1570,7 @@ { "uid": "roadm Cincinnati", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1579,6 +1595,7 @@ { "uid": "roadm Cleveland", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1603,6 +1620,7 @@ { "uid": "roadm Columbus", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1627,6 +1645,7 @@ { "uid": "roadm Dallas", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1653,6 +1672,7 @@ { "uid": "roadm Denver", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1678,6 +1698,7 @@ { "uid": "roadm Detroit", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1701,6 +1722,7 @@ { "uid": "roadm El_Paso", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1726,6 +1748,7 @@ { "uid": "roadm Fresno", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1750,6 +1773,7 @@ { "uid": "roadm Greensboro", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1775,6 +1799,7 @@ { "uid": "roadm Hartford", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1798,6 +1823,7 @@ { "uid": "roadm Houston", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1822,6 +1848,7 @@ { "uid": "roadm Jacksonville", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1846,6 +1873,7 @@ { "uid": "roadm Kansas_City", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1870,6 +1898,7 @@ { "uid": "roadm Las_Vegas", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1895,6 +1924,7 @@ { "uid": "roadm Little_Rock", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1918,6 +1948,7 @@ { "uid": "roadm Long_Island", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1941,6 +1972,7 @@ { "uid": "roadm Los_Angeles", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1966,6 +1998,7 @@ { "uid": "roadm Louisville", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1991,6 +2024,7 @@ { "uid": "roadm Memphis", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2014,6 +2048,7 @@ { "uid": "roadm Miami", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2038,6 +2073,7 @@ { "uid": "roadm Milwaukee", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2061,6 +2097,7 @@ { "uid": "roadm Minneapolis", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2085,6 +2122,7 @@ { "uid": "roadm Nashville", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2109,6 +2147,7 @@ { "uid": "roadm New_Orleans", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2133,6 +2172,7 @@ { "uid": "roadm New_York", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2159,6 +2199,7 @@ { "uid": "roadm Newark", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2182,6 +2223,7 @@ { "uid": "roadm Norfolk", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2205,6 +2247,7 @@ { "uid": "roadm Oakland", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2231,6 +2274,7 @@ { "uid": "roadm Oklahoma_City", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2254,6 +2298,7 @@ { "uid": "roadm Omaha", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2278,6 +2323,7 @@ { "uid": "roadm Orlando", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2301,6 +2347,7 @@ { "uid": "roadm Philadelphia", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2325,6 +2372,7 @@ { "uid": "roadm Phoenix", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2349,6 +2397,7 @@ { "uid": "roadm Pittsburgh", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2373,6 +2422,7 @@ { "uid": "roadm Portland", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2398,6 +2448,7 @@ { "uid": "roadm Providence", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2421,6 +2472,7 @@ { "uid": "roadm Raleigh", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2445,6 +2497,7 @@ { "uid": "roadm Richmond", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2468,6 +2521,7 @@ { "uid": "roadm Rochester", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2491,6 +2545,7 @@ { "uid": "roadm Sacramento", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2514,6 +2569,7 @@ { "uid": "roadm Salt_Lake_City", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2539,6 +2595,7 @@ { "uid": "roadm San_Antonio", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2562,6 +2619,7 @@ { "uid": "roadm San_Diego", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2585,6 +2643,7 @@ { "uid": "roadm San_Francisco", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2608,6 +2667,7 @@ { "uid": "roadm San_Jose", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2631,6 +2691,7 @@ { "uid": "roadm Santa_Barbara", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2654,6 +2715,7 @@ { "uid": "roadm Scranton", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2679,6 +2741,7 @@ { "uid": "roadm Seattle", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2702,6 +2765,7 @@ { "uid": "roadm Spokane", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2725,6 +2789,7 @@ { "uid": "roadm Springfield", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2748,6 +2813,7 @@ { "uid": "roadm St_Louis", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2772,6 +2838,7 @@ { "uid": "roadm Syracuse", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2796,6 +2863,7 @@ { "uid": "roadm Tallahassee", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2819,6 +2887,7 @@ { "uid": "roadm Tampa", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2842,6 +2911,7 @@ { "uid": "roadm Toledo", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2865,6 +2935,7 @@ { "uid": "roadm Tucson", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2888,6 +2959,7 @@ { "uid": "roadm Tulsa", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2911,6 +2983,7 @@ { "uid": "roadm Washington_DC", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2936,6 +3009,7 @@ { "uid": "roadm West_Palm_Beach", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2959,6 +3033,7 @@ { "uid": "roadm Wilmington", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -2982,6 +3057,7 @@ { "uid": "roadm Amsterdam", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3007,6 +3083,7 @@ { "uid": "roadm Berlin", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3030,6 +3107,7 @@ { "uid": "roadm Brussels", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3053,6 +3131,7 @@ { "uid": "roadm Bucharest", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3076,6 +3155,7 @@ { "uid": "roadm Frankfurt", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3099,6 +3179,7 @@ { "uid": "roadm Istanbul", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3123,6 +3204,7 @@ { "uid": "roadm London", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3147,6 +3229,7 @@ { "uid": "roadm Madrid", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3170,6 +3253,7 @@ { "uid": "roadm Paris", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3194,6 +3278,7 @@ { "uid": "roadm Rome", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3219,6 +3304,7 @@ { "uid": "roadm Vienna", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3243,6 +3329,7 @@ { "uid": "roadm Warsaw", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3267,6 +3354,7 @@ { "uid": "roadm Zurich", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3290,6 +3378,7 @@ { "uid": "roadm Bangkok", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3313,6 +3402,7 @@ { "uid": "roadm Beijing", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3336,6 +3426,7 @@ { "uid": "roadm Delhi", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3360,6 +3451,7 @@ { "uid": "roadm Hong_Kong", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3385,6 +3477,7 @@ { "uid": "roadm Honolulu", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3409,6 +3502,7 @@ { "uid": "roadm Mumbai", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3433,6 +3527,7 @@ { "uid": "roadm Seoul", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3456,6 +3551,7 @@ { "uid": "roadm Shanghai", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3479,6 +3575,7 @@ { "uid": "roadm Singapore", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3502,6 +3599,7 @@ { "uid": "roadm Sydney", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3526,6 +3624,7 @@ { "uid": "roadm Taipei", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -3551,6 +3650,7 @@ { "uid": "roadm Tokyo", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { diff --git a/tests/data/eqpt_config.json b/tests/data/eqpt_config.json index 8585c12e2..414b8db61 100644 --- a/tests/data/eqpt_config.json +++ b/tests/data/eqpt_config.json @@ -1,4 +1,5 @@ -{ "Edfa":[{ +{ + "Edfa": [{ "type_variety": "CienaDB_medium_gain", "type_def": "advanced_model", "gain_flatmax": 25, @@ -7,10 +8,9 @@ "advanced_config_from_json": "std_medium_gain_advanced_config.json", "out_voa_auto": false, "allowed_for_design": true - }, - { + }, { "type_variety": "std_medium_gain", - "type_def": "variable_gain", + "type_def": "variable_gain", "gain_flatmax": 26, "gain_min": 15, "p_max": 21, @@ -18,10 +18,9 @@ "nf_max": 10, "out_voa_auto": false, "allowed_for_design": true - }, - { + }, { "type_variety": "std_low_gain", - "type_def": "variable_gain", + "type_def": "variable_gain", "gain_flatmax": 16, "gain_min": 8, "p_max": 21, @@ -29,8 +28,7 @@ "nf_max": 11, "out_voa_auto": false, "allowed_for_design": true - }, - { + }, { "type_variety": "test", "type_def": "variable_gain", "gain_flatmax": 25, @@ -40,8 +38,7 @@ "nf_max": 10, "out_voa_auto": false, "allowed_for_design": true - }, - { + }, { "type_variety": "test_fixed_gain", "type_def": "fixed_gain", "gain_flatmax": 21, @@ -49,8 +46,7 @@ "p_max": 21, "nf0": 5, "allowed_for_design": true - }, - { + }, { "type_variety": "std_booster", "type_def": "fixed_gain", "gain_flatmax": 21, @@ -58,18 +54,18 @@ "p_max": 21, "nf0": 5, "allowed_for_design": false - } - ], - "Fiber":[{ + } + ], + "Fiber": [{ "type_variety": "SSMF", "dispersion": 1.67e-05, "effective_area": 83e-12, "pmd_coef": 1.265e-15 - } - ], - "Span":[{ - "power_mode":true, - "delta_power_range_db": [0,0,0.5], + } + ], + "Span": [{ + "power_mode": true, + "delta_power_range_db": [0, 0, 0.5], "max_fiber_lineic_loss_for_raman": 0.25, "target_extended_gain": 2.5, "max_length": 150, @@ -79,157 +75,155 @@ "EOL": 0, "con_in": 0, "con_out": 0 + } + ], + "Roadm": [{ + "type_variety": "example_test", + "target_pch_out_db": -18, + "add_drop_osnr": 35, + "pmd": 1e-12, + "pdl": 0.5, + "restrictions": { + "preamp_variety_list": [], + "booster_variety_list": [] } - ], - "Roadm":[{ + }, { "target_pch_out_db": -20, "add_drop_osnr": 38, "pmd": 0, "pdl": 0, "restrictions": { - "preamp_variety_list":[], - "booster_variety_list":[] - } - }], - "SI":[{ + "preamp_variety_list": [], + "booster_variety_list": [] + } + } + ], + "SI": [{ "f_min": 191.3e12, - "f_max":196.1e12, + "f_max": 196.1e12, "baud_rate": 32e9, "spacing": 50e9, "power_dbm": 0, - "power_range_db": [0,0,0.5], + "power_range_db": [0, 0, 0.5], "roll_off": 0.15, "tx_osnr": 100, - "sys_margins": 0 - }], - "Transceiver":[ - { + "sys_margins": 0 + } + ], + "Transceiver": [{ "type_variety": "vendorA_trx-type1", - "frequency":{ - "min": 191.35e12, - "max": 196.1e12 - }, - "mode":[ - { - "format": "PS_SP64_1", - "baud_rate": 32e9, - "OSNR": 11, - "bit_rate": 100e9, - "roll_off": 0.15, - "tx_osnr": 100, - "min_spacing": 50e9, - "cost":1 - }, - { - "format": "PS_SP64_2", - "baud_rate": 64e9, - "OSNR": 15, - "bit_rate": 200e9, - "roll_off": 0.15, - "tx_osnr": 100, - "min_spacing": 75e9, - "cost":1 - }, - { - "format": "mode 1", - "baud_rate": 32e9, - "OSNR": 11, - "bit_rate": 100e9, - "roll_off": 0.15, - "tx_osnr": 100, - "min_spacing": 50e9, - "cost":1 - }, - { - "format": "mode 2", - "baud_rate": 64e9, - "OSNR": 15, - "bit_rate": 200e9, - "roll_off": 0.15, - "tx_osnr": 100, - "min_spacing": 75e9, - "cost":1 - } - ] + "frequency": { + "min": 191.35e12, + "max": 196.1e12 }, - { + "mode": [{ + "format": "PS_SP64_1", + "baud_rate": 32e9, + "OSNR": 11, + "bit_rate": 100e9, + "roll_off": 0.15, + "tx_osnr": 100, + "min_spacing": 50e9, + "cost": 1 + }, { + "format": "PS_SP64_2", + "baud_rate": 64e9, + "OSNR": 15, + "bit_rate": 200e9, + "roll_off": 0.15, + "tx_osnr": 100, + "min_spacing": 75e9, + "cost": 1 + }, { + "format": "mode 1", + "baud_rate": 32e9, + "OSNR": 11, + "bit_rate": 100e9, + "roll_off": 0.15, + "tx_osnr": 100, + "min_spacing": 50e9, + "cost": 1 + }, { + "format": "mode 2", + "baud_rate": 64e9, + "OSNR": 15, + "bit_rate": 200e9, + "roll_off": 0.15, + "tx_osnr": 100, + "min_spacing": 75e9, + "cost": 1 + } + ] + }, { "type_variety": "Voyager_16QAM", - "frequency":{ - "min": 191.35e12, - "max": 196.1e12 - }, - "mode":[ - { - "format": "16QAM", - "baud_rate": 32e9, - "OSNR": 19, - "bit_rate": 200e9, - "roll_off": 0.15, - "tx_osnr": 100, - "min_spacing": 50e9, - "cost":1 - } - ] + "frequency": { + "min": 191.35e12, + "max": 196.1e12 }, - { + "mode": [{ + "format": "16QAM", + "baud_rate": 32e9, + "OSNR": 19, + "bit_rate": 200e9, + "roll_off": 0.15, + "tx_osnr": 100, + "min_spacing": 50e9, + "cost": 1 + } + ] + }, { "type_variety": "Voyager", - "frequency":{ - "min": 191.35e12, - "max": 196.1e12 - }, - "mode":[ - { - "format": "mode 1", - "baud_rate": 32e9, - "OSNR": 12, - "bit_rate": 100e9, - "roll_off": 0.15, - "tx_osnr": 45, - "min_spacing": 50e9, - "cost":1 - }, - { - "format": "mode 3", - "baud_rate": 44e9, - "OSNR": 18, - "bit_rate": 300e9, - "roll_off": 0.15, - "tx_osnr": 45, - "min_spacing": 62.5e9, - "cost":1 - }, - { - "format": "mode 2", - "baud_rate": 66e9, - "OSNR": 21, - "bit_rate": 400e9, - "roll_off": 0.15, - "tx_osnr": 45, - "min_spacing": 75e9, - "cost":1 - }, - { - "format": "mode 2 - fake", - "baud_rate": 66e9, - "OSNR": 21, - "bit_rate": 400e9, - "roll_off": 0.15, - "tx_osnr": 45, - "min_spacing": 75e9, - "cost":1 - }, - { - "format": "mode 4", - "baud_rate": 66e9, - "OSNR": 16, - "bit_rate": 200e9, - "roll_off": 0.15, - "tx_osnr": 45, - "min_spacing": 75e9, - "cost":1 - } - ] - } - ] - + "frequency": { + "min": 191.35e12, + "max": 196.1e12 + }, + "mode": [{ + "format": "mode 1", + "baud_rate": 32e9, + "OSNR": 12, + "bit_rate": 100e9, + "roll_off": 0.15, + "tx_osnr": 45, + "min_spacing": 50e9, + "cost": 1 + }, { + "format": "mode 3", + "baud_rate": 44e9, + "OSNR": 18, + "bit_rate": 300e9, + "roll_off": 0.15, + "tx_osnr": 45, + "min_spacing": 62.5e9, + "cost": 1 + }, { + "format": "mode 2", + "baud_rate": 66e9, + "OSNR": 21, + "bit_rate": 400e9, + "roll_off": 0.15, + "tx_osnr": 45, + "min_spacing": 75e9, + "cost": 1 + }, { + "format": "mode 2 - fake", + "baud_rate": 66e9, + "OSNR": 21, + "bit_rate": 400e9, + "roll_off": 0.15, + "tx_osnr": 45, + "min_spacing": 75e9, + "cost": 1 + }, { + "format": "mode 4", + "baud_rate": 66e9, + "OSNR": 16, + "bit_rate": 200e9, + "roll_off": 0.15, + "tx_osnr": 45, + "min_spacing": 75e9, + "cost": 1 + } + ] + } + ] } diff --git a/tests/data/perdegreemeshTopologyExampleV2_auto_design_expected.json b/tests/data/perdegreemeshTopologyExampleV2_auto_design_expected.json index 1e7e25b94..d9e383817 100644 --- a/tests/data/perdegreemeshTopologyExampleV2_auto_design_expected.json +++ b/tests/data/perdegreemeshTopologyExampleV2_auto_design_expected.json @@ -63,6 +63,7 @@ { "uid": "roadm Lannion_CAS", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -18.6, "restrictions": { @@ -87,6 +88,7 @@ { "uid": "roadm Lorient_KMA", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -111,6 +113,7 @@ { "uid": "roadm Vannes_KBE", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -134,6 +137,7 @@ { "uid": "roadm Rennes_STA", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -157,6 +161,7 @@ { "uid": "roadm Brest_KLA", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -1668,4 +1673,4 @@ "to_node": "fiber (Ploermel → Vannes_KBE)-" } ] -} \ No newline at end of file +} diff --git a/tests/data/testTopology_auto_design_expected.json b/tests/data/testTopology_auto_design_expected.json index cd611236f..daca6b824 100644 --- a/tests/data/testTopology_auto_design_expected.json +++ b/tests/data/testTopology_auto_design_expected.json @@ -159,6 +159,7 @@ { "uid": "roadm Lannion_CAS", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -183,6 +184,7 @@ { "uid": "roadm Lorient_KMA", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -207,6 +209,7 @@ { "uid": "roadm Vannes_KBE", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -230,6 +233,7 @@ { "uid": "roadm Rennes_STA", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -253,6 +257,7 @@ { "uid": "roadm Brest_KLA", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -276,6 +281,7 @@ { "uid": "roadm a", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -301,6 +307,7 @@ { "uid": "roadm b", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -326,6 +333,7 @@ { "uid": "roadm c", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -350,6 +358,7 @@ { "uid": "roadm d", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -373,6 +382,7 @@ { "uid": "roadm e", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -396,6 +406,7 @@ { "uid": "roadm f", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -420,6 +431,7 @@ { "uid": "roadm g", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { @@ -443,6 +455,7 @@ { "uid": "roadm h", "type": "Roadm", + "type_variety": "default", "params": { "target_pch_out_db": -20, "restrictions": { diff --git a/tests/invocation/logs_path_request b/tests/invocation/logs_path_request index 4be3d0b5b..3db28623b 100644 --- a/tests/invocation/logs_path_request +++ b/tests/invocation/logs_path_request @@ -1,4 +1,7 @@ INFO gnpy.tools.cli_examples:cli_examples.py Computing path requests meshTopologyExampleV2.xls into JSON format +WARNING gnpy.tools.json_io:json_io.py + WARNING missing type_variety attribute in eqpt_config.json[Roadm] + default value is type_variety = default 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 7a902bd5b..24b3a8fef 100644 --- a/tests/invocation/logs_path_requests_run_CD_PMD_PDL_missing +++ b/tests/invocation/logs_path_requests_run_CD_PMD_PDL_missing @@ -1,4 +1,7 @@ INFO gnpy.tools.cli_examples:cli_examples.py Computing path requests CORONET_services.json into JSON format +WARNING gnpy.tools.json_io:json_io.py + WARNING missing type_variety attribute in eqpt_config.json[Roadm] + default value is type_variety = default 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 a3d4e771b..b94957400 100644 --- a/tests/invocation/logs_power_sweep_example +++ b/tests/invocation/logs_power_sweep_example @@ -1,3 +1,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 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_saturated b/tests/invocation/logs_transmission_saturated index ea272d327..6b2e42876 100644 --- a/tests/invocation/logs_transmission_saturated +++ b/tests/invocation/logs_transmission_saturated @@ -1,3 +1,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 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/invocation/openroadm-v4-Stockholm-Gothenburg b/tests/invocation/openroadm-v4-Stockholm-Gothenburg index bbba8ab64..66d7395a8 100644 --- a/tests/invocation/openroadm-v4-Stockholm-Gothenburg +++ b/tests/invocation/openroadm-v4-Stockholm-Gothenburg @@ -17,6 +17,7 @@ Transceiver trx_Stockholm PDL (dB): 0.00 Latency (ms): 0.00 Roadm roadm_Stockholm + type_variety: default effective loss (dB): 22.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 @@ -78,6 +79,7 @@ Edfa Edfa_preamp_roadm_Norrköping_from_fiber (Stockholm → Norrköping)_(2/2) actual pch out (dBm): 2.03 output VOA (dB): 0.00 Roadm roadm_Norrköping + type_variety: default effective loss (dB): 22.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 @@ -117,6 +119,7 @@ Edfa Edfa_preamp_roadm_Linköping_from_fiber (Norrköping → Linköping) actual pch out (dBm): 2.01 output VOA (dB): 0.00 Roadm roadm_Linköping + type_variety: default effective loss (dB): 22.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 @@ -156,6 +159,7 @@ Edfa Edfa_preamp_roadm_Jönköping_from_fiber (Linköping → Jönköping) actual pch out (dBm): 2.05 output VOA (dB): 0.00 Roadm roadm_Jönköping + type_variety: default effective loss (dB): 22.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 @@ -195,6 +199,7 @@ Edfa Edfa_preamp_roadm_Borås_from_fiber (Jönköping → Borås) actual pch out (dBm): 2.02 output VOA (dB): 0.00 Roadm roadm_Borås + type_variety: default effective loss (dB): 22.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 @@ -234,6 +239,7 @@ Edfa Edfa_preamp_roadm_Gothenburg_from_fiber (Borås → Gothenburg) actual pch out (dBm): 2.02 output VOA (dB): 0.00 Roadm roadm_Gothenburg + type_variety: default effective loss (dB): 22.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 diff --git a/tests/invocation/openroadm-v5-Stockholm-Gothenburg b/tests/invocation/openroadm-v5-Stockholm-Gothenburg index b0c06ddae..090b51ff3 100644 --- a/tests/invocation/openroadm-v5-Stockholm-Gothenburg +++ b/tests/invocation/openroadm-v5-Stockholm-Gothenburg @@ -17,6 +17,7 @@ Transceiver trx_Stockholm PDL (dB): 0.00 Latency (ms): 0.00 Roadm roadm_Stockholm + type_variety: default effective loss (dB): 22.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 @@ -78,6 +79,7 @@ Edfa Edfa_preamp_roadm_Norrköping_from_fiber (Stockholm → Norrköping)_(2/2) actual pch out (dBm): 2.03 output VOA (dB): 0.00 Roadm roadm_Norrköping + type_variety: default effective loss (dB): 22.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 @@ -117,6 +119,7 @@ Edfa Edfa_preamp_roadm_Linköping_from_fiber (Norrköping → Linköping) actual pch out (dBm): 2.01 output VOA (dB): 0.00 Roadm roadm_Linköping + type_variety: default effective loss (dB): 22.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 @@ -156,6 +159,7 @@ Edfa Edfa_preamp_roadm_Jönköping_from_fiber (Linköping → Jönköping) actual pch out (dBm): 2.04 output VOA (dB): 0.00 Roadm roadm_Jönköping + type_variety: default effective loss (dB): 22.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 @@ -195,6 +199,7 @@ Edfa Edfa_preamp_roadm_Borås_from_fiber (Jönköping → Borås) actual pch out (dBm): 2.02 output VOA (dB): 0.00 Roadm roadm_Borås + type_variety: default effective loss (dB): 22.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 @@ -234,6 +239,7 @@ Edfa Edfa_preamp_roadm_Gothenburg_from_fiber (Borås → Gothenburg) actual pch out (dBm): 2.02 output VOA (dB): 0.00 Roadm roadm_Gothenburg + type_variety: default effective loss (dB): 22.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 diff --git a/tests/invocation/spectrum1_transmission_main_example b/tests/invocation/spectrum1_transmission_main_example index 610d6f2d3..f699f794b 100644 --- a/tests/invocation/spectrum1_transmission_main_example +++ b/tests/invocation/spectrum1_transmission_main_example @@ -18,6 +18,7 @@ Transceiver trx Lannion_CAS PDL (dB): 0.00 Latency (ms): 0.00 Roadm roadm Lannion_CAS + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 @@ -79,6 +80,7 @@ Edfa west edfa in Lorient_KMA to Loudeac actual pch out (dBm): 1.05 output VOA (dB): 0.00 Roadm roadm Lorient_KMA + type_variety: default effective loss (dB): 21.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 diff --git a/tests/invocation/spectrum2_transmission_main_example b/tests/invocation/spectrum2_transmission_main_example index d4b8ab587..c5442838f 100644 --- a/tests/invocation/spectrum2_transmission_main_example +++ b/tests/invocation/spectrum2_transmission_main_example @@ -18,6 +18,7 @@ Transceiver trx Lannion_CAS PDL (dB): 0.00 Latency (ms): 0.00 Roadm roadm Lannion_CAS + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): mode_1: -20.00, mode_2: -20.00 @@ -79,6 +80,7 @@ Edfa west edfa in Lorient_KMA to Loudeac actual pch out (dBm): mode_1: 1.04, mode_2: 1.09 output VOA (dB): 0.00 Roadm roadm Lorient_KMA + type_variety: default effective loss (dB): 21.00 reference pch out (dBm): -20.00 actual pch out (dBm): mode_1: -20.00, mode_2: -20.00 diff --git a/tests/invocation/transmission_long_pow b/tests/invocation/transmission_long_pow index f7d2e3763..4b4aca9cf 100644 --- a/tests/invocation/transmission_long_pow +++ b/tests/invocation/transmission_long_pow @@ -18,6 +18,7 @@ Transceiver Site_A PDL (dB): 0.00 Latency (ms): 0.00 Roadm roadm Site A + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): mode_1: -20.00, mode_2: -20.00 @@ -145,6 +146,7 @@ Edfa Edfa5 actual pch out (dBm): mode_1: 0.05, mode_2: 0.08 output VOA (dB): 0.00 Roadm roadm Site C + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): mode_1: -20.00, mode_2: -20.00 @@ -272,6 +274,7 @@ Edfa Edfa10 actual pch out (dBm): mode_1: 0.05, mode_2: 0.08 output VOA (dB): 0.00 Roadm roadm Site D + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): mode_1: -20.00, mode_2: -20.00 @@ -333,6 +336,7 @@ Edfa Edfa12 actual pch out (dBm): mode_1: 0.03, mode_2: 0.04 output VOA (dB): 0.00 Roadm roadm Site E + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): mode_1: -20.00, mode_2: -20.00 @@ -416,6 +420,7 @@ Edfa Edfa15 actual pch out (dBm): mode_1: 0.03, mode_2: 0.05 output VOA (dB): 0.00 Roadm roadm Site B + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): mode_1: -20.00, mode_2: -20.00 diff --git a/tests/invocation/transmission_long_psd b/tests/invocation/transmission_long_psd index 774ded705..7b54bb2db 100644 --- a/tests/invocation/transmission_long_psd +++ b/tests/invocation/transmission_long_psd @@ -18,6 +18,7 @@ Transceiver Site_A PDL (dB): 0.00 Latency (ms): 0.00 Roadm roadm Site A + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): mode_1: -20.00, mode_2: -16.99 @@ -145,6 +146,7 @@ Edfa Edfa5 actual pch out (dBm): mode_1: 0.06, mode_2: 3.07 output VOA (dB): 0.00 Roadm roadm Site C + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): mode_1: -20.00, mode_2: -16.99 @@ -272,6 +274,7 @@ Edfa Edfa10 actual pch out (dBm): mode_1: 0.06, mode_2: 3.07 output VOA (dB): 0.00 Roadm roadm Site D + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): mode_1: -20.00, mode_2: -16.99 @@ -333,6 +336,7 @@ Edfa Edfa12 actual pch out (dBm): mode_1: 0.03, mode_2: 3.04 output VOA (dB): 0.00 Roadm roadm Site E + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): mode_1: -20.00, mode_2: -16.99 @@ -416,6 +420,7 @@ Edfa Edfa15 actual pch out (dBm): mode_1: 0.04, mode_2: 3.05 output VOA (dB): 0.00 Roadm roadm Site B + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): mode_1: -20.00, mode_2: -16.99 diff --git a/tests/invocation/transmission_long_psw b/tests/invocation/transmission_long_psw index 1a11cbbd2..e4d8803c6 100644 --- a/tests/invocation/transmission_long_psw +++ b/tests/invocation/transmission_long_psw @@ -18,6 +18,7 @@ Transceiver Site_A PDL (dB): 0.00 Latency (ms): 0.00 Roadm roadm Site A + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): mode_1: -20.00, mode_2: -18.24 @@ -145,6 +146,7 @@ Edfa Edfa5 actual pch out (dBm): mode_1: 0.05, mode_2: 1.82 output VOA (dB): 0.00 Roadm roadm Site C + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): mode_1: -20.00, mode_2: -18.24 @@ -272,6 +274,7 @@ Edfa Edfa10 actual pch out (dBm): mode_1: 0.05, mode_2: 1.82 output VOA (dB): 0.00 Roadm roadm Site D + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): mode_1: -20.00, mode_2: -18.24 @@ -333,6 +336,7 @@ Edfa Edfa12 actual pch out (dBm): mode_1: 0.03, mode_2: 1.79 output VOA (dB): 0.00 Roadm roadm Site E + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): mode_1: -20.00, mode_2: -18.24 @@ -416,6 +420,7 @@ Edfa Edfa15 actual pch out (dBm): mode_1: 0.03, mode_2: 1.80 output VOA (dB): 0.00 Roadm roadm Site B + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): mode_1: -20.00, mode_2: -18.24 diff --git a/tests/invocation/transmission_main_example_long b/tests/invocation/transmission_main_example_long index de509eedb..e31e19c75 100644 --- a/tests/invocation/transmission_main_example_long +++ b/tests/invocation/transmission_main_example_long @@ -17,6 +17,7 @@ Transceiver Site_A PDL (dB): 0.00 Latency (ms): 0.00 Roadm roadm Site A + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 @@ -144,6 +145,7 @@ Edfa Edfa5 actual pch out (dBm): 0.06 output VOA (dB): 0.00 Roadm roadm Site C + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 @@ -271,6 +273,7 @@ Edfa Edfa10 actual pch out (dBm): 0.06 output VOA (dB): 0.00 Roadm roadm Site D + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 @@ -332,6 +335,7 @@ Edfa Edfa12 actual pch out (dBm): 0.03 output VOA (dB): 0.00 Roadm roadm Site E + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 @@ -415,6 +419,7 @@ Edfa Edfa15 actual pch out (dBm): 0.04 output VOA (dB): 0.00 Roadm roadm Site B + type_variety: default effective loss (dB): 20.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 diff --git a/tests/invocation/transmission_saturated b/tests/invocation/transmission_saturated index ab608e08f..2cb4e0182 100644 --- a/tests/invocation/transmission_saturated +++ b/tests/invocation/transmission_saturated @@ -17,6 +17,7 @@ Transceiver trx Lannion_CAS PDL (dB): 0.00 Latency (ms): 0.00 Roadm roadm Lannion_CAS + type_variety: default effective loss (dB): 23.00 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 @@ -78,6 +79,7 @@ Edfa west edfa in Lorient_KMA to Loudeac actual pch out (dBm): 1.21 output VOA (dB): 0.00 Roadm roadm Lorient_KMA + type_variety: default effective loss (dB): 21.18 reference pch out (dBm): -20.00 actual pch out (dBm): -20.00 diff --git a/tests/test_equalization.py b/tests/test_equalization.py index 1277c753d..9f76fe3dd 100644 --- a/tests/test_equalization.py +++ b/tests/test_equalization.py @@ -54,6 +54,7 @@ def test_equalization_combination_degree(delta_pdb_per_channel, degree, equaliza roadm_config = { "uid": "roadm Lannion_CAS", + "type_variety": "default", "params": { "per_degree_pch_out_db": { "east edfa in Lannion_CAS to Corlay": -16 @@ -85,6 +86,7 @@ def test_equalization_combination_degree(delta_pdb_per_channel, degree, equaliza to_json_before_propagation = { 'uid': 'roadm Lannion_CAS', 'type': 'Roadm', + "type_variety": "default", 'params': { equalization_type: target, 'restrictions': {'preamp_variety_list': [], 'booster_variety_list': []}, diff --git a/tests/test_parser.py b/tests/test_parser.py index 27a09c7c4..f26806c7b 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -25,7 +25,7 @@ from copy import deepcopy from gnpy.core.utils import automatic_nch, lin2db from gnpy.core.network import build_network, add_missing_elements_in_network -from gnpy.core.exceptions import ServiceError +from gnpy.core.exceptions import ServiceError, ConfigurationError from gnpy.topology.request import (jsontocsv, requests_aggregation, compute_path_dsjctn, deduplicate_disjunctions, compute_path_with_disjunction, ResultElement, PathRequest) from gnpy.topology.spectrum_assignment import build_oms_list, pth_assign_spectrum @@ -565,3 +565,52 @@ def test_service_json_constraint_order(): rqs = requests_from_json(data, equipment) assert rqs[0].nodes_list == ['roadm Brest_KLA', 'roadm Lannion_CAS', 'roadm Lorient_KMA', 'roadm Vannes_KBE'] assert rqs[0].loose_list == ['STRICT', 'LOOSE', 'STRICT', 'STRICT'] + + +@pytest.mark.parametrize('type_variety, target_pch_out_db, correct_variety', [(None, -20, True), + ('example_test', -18, True), + ('example', None, False)]) +def test_roadm_type_variety(type_variety, target_pch_out_db, correct_variety): + """Checks that if element has no variety, the default one is applied, and if it has one + that the type_variety is correctly applied + """ + json_data = { + "elements": [{ + "uid": "roadm Oakland", + "type": "Roadm", + }], + "connections": [] + } + expected_roadm = { + "uid": "roadm Oakland", + "type": "Roadm", + "params": { + "restrictions": { + "preamp_variety_list": [], + "booster_variety_list": [] + } + }, + 'metadata': { + 'location': { + 'city': None, + 'latitude': 0, + 'longitude': 0, + 'region': None + } + } + } + if type_variety: + json_data['elements'][0]['type_variety'] = type_variety + expected_roadm['type_variety'] = type_variety + else: + # Do not add type variety in json_data to test that it creates a 'default' type_variety + expected_roadm['type_variety'] = 'default' + expected_roadm['params']['target_pch_out_db'] = target_pch_out_db + equipment = load_equipment(eqpt_filename) + if correct_variety: + network = network_from_json(json_data, equipment) + roadm = [n for n in network.nodes()][0] + assert roadm.to_json == expected_roadm + else: + with pytest.raises(ConfigurationError): + network = network_from_json(json_data, equipment) diff --git a/tests/test_roadm_restrictions.py b/tests/test_roadm_restrictions.py index 4055bb8d7..a37f3cbaf 100644 --- a/tests/test_roadm_restrictions.py +++ b/tests/test_roadm_restrictions.py @@ -19,11 +19,12 @@ from gnpy.core.elements import Fused, Roadm, Edfa, Transceiver, EdfaOperational, EdfaParams, Fiber from gnpy.core.parameters import FiberParams, RoadmParams, FusedParams from gnpy.core.network import build_network, design_network -from gnpy.tools.json_io import network_from_json, load_equipment, load_json, Amp +from gnpy.tools.json_io import network_from_json, load_equipment, load_json, Amp, _equipment_from_json from gnpy.core.equipment import trx_mode_params from gnpy.topology.request import PathRequest, compute_constrained_path, propagate from gnpy.core.info import create_input_spectral_information, Carrier from gnpy.core.utils import db2lin, dbm2watt +from gnpy.core.exceptions import ConfigurationError TEST_DIR = Path(__file__).parent @@ -527,3 +528,24 @@ def test_compare_design_propagation_settings(power_dbm, req_power, amp_with_delt getattr(getattr(element_copy, key), subkey), rtol=1e-12) else: assert getattr(getattr(element, key), subkey) == getattr(getattr(element_copy, key), subkey) + + +@pytest.mark.parametrize("restrictions, fail", [ + ({'preamp_variety_list': [], 'booster_variety_list':[]}, False), + ({'preamp_variety_list': ['std_medium_gain', 'std_low_gain'], 'booster_variety_list':['std_medium_gain']}, False), + # the two next amp type_variety do not exist + ({'preamp_variety_list': [], 'booster_variety_list':['booster_medium_gain']}, True), + ({'preamp_variety_list': ['std_medium_gain', 'preamp_high_gain'], 'booster_variety_list':[]}, True)]) +def test_wrong_restrictions(restrictions, fail): + """Check that sanity_check correctly raises an error when restriction is incorrect and that library + correctly includes restrictions. + """ + json_data = load_json(EQPT_LIBRARY_NAME) + # define wrong restriction + json_data['Roadm'][0]['restrictions'] = restrictions + if fail: + with pytest.raises(ConfigurationError): + _ = _equipment_from_json(json_data, EQPT_LIBRARY_NAME) + else: + equipment = _equipment_from_json(json_data, EQPT_LIBRARY_NAME) + assert equipment['Roadm']['example_test'].restrictions == restrictions