Skip to content
Snippets Groups Projects
Commit 1beb5eeb authored by Hakan Calim's avatar Hakan Calim Committed by Neda Moeini
Browse files

NAT-329: fixed iteration over LAGMember list

parent 85efbaf9
Branches
Tags
1 merge request!122Feature/nat 329 interface names should validated 3
This commit is part of merge request !122. Comments created here will be created in the context of that merge request.
...@@ -279,15 +279,12 @@ def validate_interface_name_list(interface_name_list: list) -> list: ...@@ -279,15 +279,12 @@ def validate_interface_name_list(interface_name_list: list) -> list:
Returns: Returns:
------- -------
list: The list of interface names if all match was successfull. list: The list of interface names if all match was successful, otherwise it will throw a ValueError exception.
Otherwise it will throw a ValueError exception.
""" """
pattern = re.compile(r"^(ge|et|xe)-[0-9]/[0-9]/[0-9]$") pattern = re.compile(r"^(ge|et|xe)-[0-9]/[0-9]/[0-9]$")
for interface_name in interface_name_list: for interface in interface_name_list:
if not bool(pattern.match(interface_name)): if not bool(pattern.match(interface.interface_name)):
error_msg = ( raise ValueError(
f"Invalid interface name. The interface name should be of format: " f"Invalid interface name. The interface name should be of format: "
f"xe-1/0/0. Got: [{interface_name}]") f"xe-1/0/0. Got: [{interface.interface_name}]")
raise ValueError(error_msg)
return interface_name_list return interface_name_list
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment