Skip to content
Snippets Groups Projects

Feature/update iptrunk migration input form

Merged Karel van Klink requested to merge feature/update-iptrunk-migration-input-form into develop
2 files
+ 5
3
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -7,7 +7,6 @@ configured to run from A to C. B is then no longer associated with this IP trunk
@@ -7,7 +7,6 @@ configured to run from A to C. B is then no longer associated with this IP trunk
import copy
import copy
import json
import json
import re
import re
from typing import NoReturn
from uuid import uuid4
from uuid import uuid4
from orchestrator import step, workflow
from orchestrator import step, workflow
@@ -44,7 +43,7 @@ from gso.utils.helpers import (
@@ -44,7 +43,7 @@ from gso.utils.helpers import (
from gso.utils.workflow_steps import set_isis_to_90000
from gso.utils.workflow_steps import set_isis_to_90000
def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator: # type: ignore[PLR0914]
"""Gather input from the operator on the new router that the IP trunk should connect to."""
"""Gather input from the operator on the new router that the IP trunk should connect to."""
subscription = Iptrunk.from_subscription(subscription_id)
subscription = Iptrunk.from_subscription(subscription_id)
form_title = (
form_title = (
@@ -88,7 +87,9 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
@@ -88,7 +87,9 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
not migrate_form_input.migrate_to_different_site
not migrate_form_input.migrate_to_different_site
and current_router_site.subscription_id != old_side_site.owner_subscription_id
and current_router_site.subscription_id != old_side_site.owner_subscription_id
):
):
 
# We want to stay on the same site, so all routers that are in different sites get skipped.
continue
continue
 
# If migrate_to_different_site is true, we can add ALL routers to the result map
routers[str(router_id)] = router["description"]
routers[str(router_id)] = router["description"]
new_router_enum = Choice("Select a new router", zip(routers.keys(), routers.items(), strict=True)) # type: ignore[arg-type]
new_router_enum = Choice("Select a new router", zip(routers.keys(), routers.items(), strict=True)) # type: ignore[arg-type]
@@ -148,7 +149,7 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
@@ -148,7 +149,7 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
new_lag_member_interfaces: ae_members # type: ignore[valid-type]
new_lag_member_interfaces: ae_members # type: ignore[valid-type]
@validator("new_lag_interface", allow_reuse=True, pre=True, always=True)
@validator("new_lag_interface", allow_reuse=True, pre=True, always=True)
def lag_interface_proper_name(cls, new_lag_interface: str) -> str | NoReturn:
def lag_interface_proper_name(cls, new_lag_interface: str) -> str:
if get_router_vendor(new_router) == RouterVendor.JUNIPER:
if get_router_vendor(new_router) == RouterVendor.JUNIPER:
juniper_lag_re = re.compile("^ae\\d{1,2}$")
juniper_lag_re = re.compile("^ae\\d{1,2}$")
if not juniper_lag_re.match(new_lag_interface):
if not juniper_lag_re.match(new_lag_interface):
Loading