Skip to content
Snippets Groups Projects

Feature/nat 329 interface names should validated 3

Merged Hakan Calim requested to merge feature/NAT-329-interface-names-should-validated-3 into develop
All threads resolved!
1 file
+ 5
8
Compare changes
  • Side-by-side
  • Inline
+ 5
8
@@ -279,15 +279,12 @@ def validate_interface_name_list(interface_name_list: list) -> list:
Returns:
-------
list: The list of interface names if all match was successfull.
Otherwise it will throw a ValueError exception.
list: The list of interface names if all match was successful, otherwise it will throw a ValueError exception.
"""
pattern = re.compile(r"^(ge|et|xe)-[0-9]/[0-9]/[0-9]$")
for interface_name in interface_name_list:
if not bool(pattern.match(interface_name)):
error_msg = (
for interface in interface_name_list:
if not bool(pattern.match(interface.interface_name)):
raise ValueError(
f"Invalid interface name. The interface name should be of format: "
f"xe-1/0/0. Got: [{interface_name}]")
raise ValueError(error_msg)
f"xe-1/0/0. Got: [{interface.interface_name}]")
return interface_name_list
Loading