Skip to content
Snippets Groups Projects
Commit a9809341 authored by Neda Moeini's avatar Neda Moeini
Browse files

Made ruff happy.

parent c193e290
No related branches found
No related tags found
1 merge request!122Feature/nat 329 interface names should validated 3
Pipeline #85033 passed
...@@ -75,9 +75,9 @@ def available_interfaces_choices(router_id: UUID, speed: str) -> Choice | None: ...@@ -75,9 +75,9 @@ def available_interfaces_choices(router_id: UUID, speed: str) -> Choice | None:
def available_interfaces_choices_including_current_members( def available_interfaces_choices_including_current_members(
router_id: UUID, router_id: UUID,
speed: str, speed: str,
interfaces: list[IptrunkInterfaceBlock], interfaces: list[IptrunkInterfaceBlock],
) -> Choice | None: ) -> Choice | None:
"""Return a list of available interfaces for a given router and speed including the current members. """Return a list of available interfaces for a given router and speed including the current members.
...@@ -288,7 +288,9 @@ def validate_interface_name_list(interface_name_list: list, vendor: str) -> list ...@@ -288,7 +288,9 @@ def validate_interface_name_list(interface_name_list: list, vendor: str) -> list
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 in interface_name_list: for interface in interface_name_list:
if not bool(pattern.match(interface.interface_name)): if not bool(pattern.match(interface.interface_name)):
raise ValueError( error_msg = (
f"Invalid interface name. The interface name should be of format: " f"Invalid interface name. The interface name should be of format: xe-1/0/0. "
f"xe-1/0/0. Got: [{interface.interface_name}]") f"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