Skip to content
Snippets Groups Projects
Verified Commit e59ecad2 authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

Update router creation workflow to use sharepoint client

parent 9d1f2ea2
No related branches found
No related tags found
1 merge request!211Feature/add sharepoint service
...@@ -20,7 +20,7 @@ from gso.services import infoblox, subscriptions ...@@ -20,7 +20,7 @@ from gso.services import infoblox, subscriptions
from gso.services.lso_client import lso_interaction from gso.services.lso_client import lso_interaction
from gso.services.netbox_client import NetboxClient from gso.services.netbox_client import NetboxClient
from gso.services.partners import get_partner_by_name 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.helpers import generate_fqdn, iso_from_ipv4
from gso.utils.shared_enums import PortNumber, Vendor 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 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: ...@@ -218,19 +218,23 @@ def prompt_insert_in_radius(subscription: RouterInactive) -> FormGenerator:
return {} 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) @inputstep("Prompt for new Sharepoint checklist", assignee=Assignee.SYSTEM)
def prompt_start_new_checklist(subscription: RouterProvisioning) -> FormGenerator: def prompt_sharepoint_checklist_url(checklist_url: str) -> FormGenerator:
"""Prompt the operator to start a new checklist in Sharepoint for approving this new router.""" """Prompt the operator with the checklist in SharePoint for approving this new router."""
oss_params = load_oss_params()
class SharepointPrompt(FormPage): class SharepointPrompt(FormPage):
model_config = ConfigDict(title="Start new checklist") model_config = ConfigDict(title="Complete new checklist")
info_label_1: Label = ( info_label_1: Label = f"A new checklist has been created at: {checklist_url}"
f"Visit {oss_params.SHAREPOINT.checklist_site_url} and start a new Sharepoint checklist for " info_label_2: Label = "Click proceed to finish the workflow."
f"{subscription.router.router_fqdn}."
)
info_label_2: Label = "Once this is done, click proceed to finish the workflow."
yield SharepointPrompt yield SharepointPrompt
...@@ -269,7 +273,8 @@ def create_router() -> StepList: ...@@ -269,7 +273,8 @@ def create_router() -> StepList:
>> router_is_nokia(create_netbox_device) >> router_is_nokia(create_netbox_device)
>> lso_interaction(run_checks_after_base_config) >> lso_interaction(run_checks_after_base_config)
>> set_status(SubscriptionLifecycle.PROVISIONING) >> set_status(SubscriptionLifecycle.PROVISIONING)
>> prompt_start_new_checklist >> create_new_sharepoint_checklist
>> prompt_sharepoint_checklist_url
>> resync >> resync
>> done >> done
) )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment