Skip to content

Commit

Permalink
Feat: Enable multiple type_varieties for ROADM
Browse files Browse the repository at this point in the history
This commit introduces the 'type_variety' attribute for ROADM elements,
allowing the use of different types of ROADM specifications instead of
being limited to the default one.

If no type variety name is provided in the eqpt_config, the 'default'
name is used for backward compatibility with libraries. Additionally,
if no type variety is defined in the ROADM element in the topology,
the default one is used for backward compatibility with topologies.

The 'type_variety' attribute is included in the 'to_json' and
'display' methods for ROADM elements.

Signed-off-by: EstherLerouzic <[email protected]>
Change-Id: I61a2491f994e47ad0b08cf8eaef30d6d855aa706
  • Loading branch information
EstherLerouzic committed Jun 2, 2024
1 parent 29f4266 commit fb4195c
Show file tree
Hide file tree
Showing 23 changed files with 276 additions and 10 deletions.
4 changes: 3 additions & 1 deletion gnpy/core/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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}'])
Expand Down
10 changes: 10 additions & 0 deletions gnpy/example-data/eqpt_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,16 @@
"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": [{
Expand Down
15 changes: 9 additions & 6 deletions gnpy/tools/json_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def __init__(self, **kwargs):

class Roadm(_JsonThing):
default_values = {
'type_variety': 'default',
'add_drop_osnr': 100,
'pmd': 0,
'pdl': 0,
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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':
Expand Down
Loading

0 comments on commit fb4195c

Please sign in to comment.