diff --git a/gso/workflows/router/create_router.py b/gso/workflows/router/create_router.py index 48fb14a9854da7ae4301ebd676225bef83929881..7e7f55bd0f2a816d9b3b524a2373e69a94366407 100644 --- a/gso/workflows/router/create_router.py +++ b/gso/workflows/router/create_router.py @@ -20,7 +20,7 @@ from gso.services import infoblox, subscriptions 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.settings import load_oss_params +from gso.services.sharepoint import SPClient from gso.utils.helpers import generate_fqdn, iso_from_ipv4 from gso.utils.shared_enums import PortNumber, Vendor from gso.utils.workflow_steps import deploy_base_config_dry, deploy_base_config_real, run_checks_after_base_config @@ -218,19 +218,23 @@ def prompt_insert_in_radius(subscription: RouterInactive) -> FormGenerator: return {} +@step("Create a new SharePoint checklist") +def create_new_sharepoint_checklist(subscription: RouterProvisioning) -> State: + """Create a new checklist in SharePoint for approving this router.""" + new_list_item_url = SPClient().add_list_item("p_router", {"Title": subscription.router.router_fqdn}) + + return {"checklist_url": new_list_item_url} + + @inputstep("Prompt for new Sharepoint checklist", assignee=Assignee.SYSTEM) -def prompt_start_new_checklist(subscription: RouterProvisioning) -> FormGenerator: - """Prompt the operator to start a new checklist in Sharepoint for approving this new router.""" - oss_params = load_oss_params() +def prompt_sharepoint_checklist_url(checklist_url: str) -> FormGenerator: + """Prompt the operator with the checklist in SharePoint for approving this new router.""" class SharepointPrompt(FormPage): - model_config = ConfigDict(title="Start new checklist") + model_config = ConfigDict(title="Complete new checklist") - info_label_1: Label = ( - f"Visit {oss_params.SHAREPOINT.checklist_site_url} and start a new Sharepoint checklist for " - f"{subscription.router.router_fqdn}." - ) - info_label_2: Label = "Once this is done, click proceed to finish the workflow." + info_label_1: Label = f"A new checklist has been created at: {checklist_url}" + info_label_2: Label = "Click proceed to finish the workflow." yield SharepointPrompt @@ -269,7 +273,8 @@ def create_router() -> StepList: >> router_is_nokia(create_netbox_device) >> lso_interaction(run_checks_after_base_config) >> set_status(SubscriptionLifecycle.PROVISIONING) - >> prompt_start_new_checklist + >> create_new_sharepoint_checklist + >> prompt_sharepoint_checklist_url >> resync >> done )