From b7b0897f9a0c410095934f584156841622e7f0cc Mon Sep 17 00:00:00 2001 From: Hakan Calim <hakan.calim@fau.de> Date: Tue, 28 Nov 2023 14:53:50 +0100 Subject: [PATCH] NAT-329: moved router vendor to vlidator to simplfy the complexity --- gso/utils/helpers.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gso/utils/helpers.py b/gso/utils/helpers.py index 357651cf..92b7e555 100644 --- a/gso/utils/helpers.py +++ b/gso/utils/helpers.py @@ -223,6 +223,7 @@ def validate_site_name(site_name: str) -> str: return site_name +<<<<<<< HEAD class BaseSiteValidatorModel(BaseModel): """A base site validator model extended by create site and by import site.""" @@ -265,7 +266,7 @@ class BaseSiteValidatorModel(BaseModel): return site_name -def validate_interface_name_list(interface_name_list: list) -> list: +def validate_interface_name_list(interface_name_list: list, vendor: str) -> list: """Validate that the provided interface name matches the expected pattern. The expected pattern for the interface name is one of 'ge', 'et', 'xe' followed by a dash '-', @@ -276,11 +277,15 @@ def validate_interface_name_list(interface_name_list: list) -> list: Args: ---- interface_name_list: List of interface names to validate. + vendor: Router vendor to check interface names Returns: ------- list: The list of interface names if all match was successful, otherwise it will throw a ValueError exception. """ + # For Nokia nothing to do + if vendor == RouterVendor.NOKIA: + return interface_name_list pattern = re.compile(r"^(ge|et|xe)-[0-9]/[0-9]/[0-9]$") for interface in interface_name_list: if not bool(pattern.match(interface.interface_name)): -- GitLab