mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-10-29 17:22:42 +00:00
fix case where there are multiple multiband amps matching the sub amp type
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com> Change-Id: Ibe86499866f2f9e3dfd70b51a33b919d584b812b
This commit is contained in:
@@ -85,7 +85,7 @@ def trx_mode_params(equipment, trx_type_variety='', trx_mode='', error_message=F
|
||||
return trx_params
|
||||
|
||||
|
||||
def find_type_variety(amps: List[str], equipment: dict) -> str:
|
||||
def find_type_variety(amps: List[str], equipment: dict) -> List[str]:
|
||||
"""Returns the multiband type_variety associated with a list of single band type_varieties
|
||||
Args:
|
||||
amps (List[str]): A list of single band type_varieties.
|
||||
@@ -106,7 +106,7 @@ def find_type_variety(amps: List[str], equipment: dict) -> str:
|
||||
if not _found_type:
|
||||
msg = f'{amps} amps do not belong to the same amp type {listes}'
|
||||
raise ConfigurationError(msg)
|
||||
return _found_type[0]
|
||||
return _found_type
|
||||
|
||||
|
||||
def find_type_varieties(amps: List[str], equipment: dict) -> List[List[str]]:
|
||||
|
||||
@@ -961,7 +961,7 @@ def set_egress_amplifier(network: DiGraph, this_node: Union[elements.Roadm, elem
|
||||
deviation_db=deviation_db[band_name], tilt_target=tilt_target[band_name])
|
||||
amps_type_varieties = [a.type_variety for a in node.amplifiers.values()]
|
||||
try:
|
||||
node.type_variety = find_type_variety(amps_type_varieties, equipment)
|
||||
node.type_variety = find_type_variety(amps_type_varieties, equipment)[0]
|
||||
except ConfigurationError as e:
|
||||
# should never come here... only for debugging
|
||||
msg = f'In {node.uid}: {e}'
|
||||
|
||||
@@ -580,7 +580,7 @@ def network_from_json(json_data: dict, equipment: dict) -> DiGraph:
|
||||
except ConfigurationError as e:
|
||||
msg = f'Node {el_config["uid"]}: {e}'
|
||||
raise ConfigurationError(msg)
|
||||
if variety is not None and variety != multiband_type_variety:
|
||||
if variety is not None and variety not in multiband_type_variety:
|
||||
raise ConfigurationError(f'In node {el_config["uid"]}: multiband amplifier type_variety is not '
|
||||
+ 'consistent with its amps type varieties.')
|
||||
if not amps and extra_params is not None:
|
||||
|
||||
Reference in New Issue
Block a user