From b74b327985ff29895b07425e32d918ff0685dcec Mon Sep 17 00:00:00 2001 From: Karel van Klink <karel.vanklink@geant.org> Date: Mon, 16 Sep 2024 16:26:10 +0100 Subject: [PATCH] Make router creation workflow use helper method --- gso/workflows/router/create_router.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/gso/workflows/router/create_router.py b/gso/workflows/router/create_router.py index 04d38b75..928fca58 100644 --- a/gso/workflows/router/create_router.py +++ b/gso/workflows/router/create_router.py @@ -4,7 +4,7 @@ from typing import Self from orchestrator.config.assignee import Assignee from orchestrator.forms import FormPage -from orchestrator.forms.validators import Choice, Label +from orchestrator.forms.validators import Label from orchestrator.targets import Target from orchestrator.types import FormGenerator, State, SubscriptionLifecycle, UUIDstr from orchestrator.utils.errors import ProcessFailureError @@ -17,13 +17,13 @@ from pydantic_forms.validators import ReadOnlyField from gso.products.product_blocks.router import RouterRole from gso.products.product_types.router import RouterInactive, RouterProvisioning from gso.products.product_types.site import Site -from gso.services import infoblox, subscriptions +from gso.services import infoblox from gso.services.lso_client import lso_interaction from gso.services.netbox_client import NetboxClient from gso.services.partners import get_partner_by_name from gso.services.sharepoint import SharePointClient from gso.settings import load_oss_params -from gso.utils.helpers import generate_fqdn, iso_from_ipv4 +from gso.utils.helpers import active_site_selector, generate_fqdn, iso_from_ipv4 from gso.utils.shared_enums import Vendor from gso.utils.types.ip_address import PortNumber from gso.utils.types.tt_number import TTNumber @@ -35,15 +35,6 @@ from gso.utils.workflow_steps import ( ) -def _site_selector() -> Choice: - site_subscriptions = {} - for site in subscriptions.get_active_site_subscriptions(includes=["subscription_id", "description"]): - site_subscriptions[str(site["subscription_id"])] = site["description"] - - # noinspection PyTypeChecker - return Choice("Select a site", zip(site_subscriptions.keys(), site_subscriptions.items(), strict=True)) # type: ignore[arg-type] - - def initial_input_form_generator(product_name: str) -> FormGenerator: """Gather information about the new router from the operator.""" @@ -53,7 +44,7 @@ def initial_input_form_generator(product_name: str) -> FormGenerator: tt_number: TTNumber partner: ReadOnlyField("GEANT", default_type=str) # type: ignore[valid-type] vendor: Vendor - router_site: _site_selector() # type: ignore[valid-type] + router_site: active_site_selector() hostname: str ts_port: PortNumber router_role: RouterRole -- GitLab