mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-10-30 01:32:21 +00:00
Raise error if specified Edfa type_variety is missing in eqpt config
A recent patch introduced the possibility to define an Edfa in the topology file without specifying its type_variety: https://review.gerrithub.io/c/Telecominfraproject/oopt-gnpy/+/488967 But with the current implementation, if a user specifies a type_variety that is missing from the equipment configuration file (e.g. because of a spelling mistake) this is silently ignored and the type_variety is instead selected by auto design. I think this is not desired since it can lead to confusing results. This patch proposes to raise an error when the specified type_variety is missing while still allowing the user to not specify type_variety or set type_variety = '' for selection by auto design. A recently introduced test actually does exactly this, i.e. it defines Edfas with type_variety = 'std_high_gain' even though this type variety does not exist in the equipment config file used by the test. Therefore this patch also modifies the topology file used by that test. Change-Id: I7d2a1aa6d633b62d51a99b07e8270cafcbad505f Signed-off-by: Jonas Mårtensson <jonas.martensson@ri.se>
This commit is contained in:
@@ -349,7 +349,7 @@ def network_from_json(json_data, equipment):
|
||||
temp = merge_amplifier_restrictions(temp, extra_params.__dict__)
|
||||
el_config['params'] = temp
|
||||
el_config['type_variety'] = variety
|
||||
elif typ in ['Fiber', 'RamanFiber']: # catch it now because the code will crash later!
|
||||
elif (typ in ['Fiber', 'RamanFiber']) or (typ == 'Edfa' and variety not in ['default', '']):
|
||||
raise ConfigurationError(f'The {typ} of variety type {variety} was not recognized:'
|
||||
'\nplease check it is properly defined in the eqpt_config json file')
|
||||
el = cls(**el_config)
|
||||
|
||||
@@ -358,7 +358,7 @@
|
||||
{
|
||||
"uid": "east edfa in node B to ila2",
|
||||
"type": "Edfa",
|
||||
"type_variety": "std_high_gain",
|
||||
"type_variety": "std_medium_gain",
|
||||
"operational": {
|
||||
"gain_target": 35.0,
|
||||
"delta_p": 0.0,
|
||||
@@ -411,7 +411,7 @@
|
||||
{
|
||||
"uid": "Edfa0_roadm node B",
|
||||
"type": "Edfa",
|
||||
"type_variety": "std_high_gain",
|
||||
"type_variety": "std_medium_gain",
|
||||
"operational": {
|
||||
"gain_target": 19.0,
|
||||
"delta_p": -1.0,
|
||||
@@ -810,4 +810,4 @@
|
||||
"to_node": "fiber (ila4 → ila3)-"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user