Skip to content
Snippets Groups Projects

Feature/update router create workflow

Merged Karel van Klink requested to merge feature/update-router-create-workflow into develop
Files
4
@@ -2,11 +2,12 @@
from typing import Any
from orchestrator.config.assignee import Assignee
from orchestrator.forms import FormPage
from orchestrator.forms.validators import Choice
from orchestrator.forms.validators import Choice, Label
from orchestrator.targets import Target
from orchestrator.types import FormGenerator, State, SubscriptionLifecycle, UUIDstr
from orchestrator.workflow import StepList, conditional, done, init, step, workflow
from orchestrator.workflow import StepList, conditional, done, init, inputstep, step, workflow
from orchestrator.workflows.steps import resync, set_status, store_process_subscription
from orchestrator.workflows.utils import wrap_create_initial_input_form
from pydantic import validator
@@ -144,6 +145,59 @@ def verify_ipam_loopback(subscription: RouterProvisioning) -> State:
return {"subscription": subscription}
@inputstep("Prompt to reboot", assignee=Assignee.SYSTEM)
def prompt_reboot_router(subscription: RouterProvisioning) -> FormGenerator:
"""Wait for confirmation from an operator that the router has been rebooted."""
class RebootPrompt(FormPage):
class Config:
title = "Please reboot before continuing"
info_label_1: Label = (
f"Base config has been deployed. Please log in via the console using https://" # type: ignore[assignment]
f"{subscription.router.router_site.site_ts_address}."
)
info_label_2: Label = "Reboot the router, and once it is up again, press submit to continue the workflow." # type: ignore[assignment]0
yield RebootPrompt
return {}
@inputstep("Prompt to test the console", assignee=Assignee.SYSTEM)
def prompt_console_login() -> FormGenerator:
"""Wait for confirmation from an operator that the router can be logged into."""
class ConsolePrompt(FormPage):
class Config:
title = "Verify local authentication"
info_label_1: Label = (
"Verify that you are able to log in to the router via the console using the admin account." # type: ignore[assignment]
)
info_label_2: Label = "Once this is done, press submit to continue the workflow." # type: ignore[assignment]
yield ConsolePrompt
return {}
@inputstep("Prompt IMS insertion", assignee=Assignee.SYSTEM)
def prompt_insert_in_ims() -> FormGenerator:
"""Wait for confirmation from an operator that the router has been inserted in IMS."""
class IMSPrompt(FormPage):
class Config:
title = "Update IMS mediation server"
info_label_1: Label = "Insert the router into IMS." # type: ignore[assignment]
info_label_2: Label = "Once this is done, press submit to continue the workflow." # type: ignore[assignment]
yield IMSPrompt
return {}
@workflow(
"Create router",
initial_input_form=wrap_create_initial_input_form(initial_input_form_generator),
@@ -169,6 +223,9 @@ def create_router() -> StepList:
>> pp_interaction(deploy_base_config_dry)
>> pp_interaction(deploy_base_config_real)
>> verify_ipam_loopback
>> prompt_reboot_router
>> prompt_console_login
>> prompt_insert_in_ims
>> router_is_nokia(create_netbox_device)
>> pp_interaction(run_checks_after_base_config)
>> set_status(SubscriptionLifecycle.ACTIVE)
Loading