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

Add new sharepoint interaction to iptrunk creation workflow

parent 734d5a52
No related branches found
No related tags found
1 merge request!211Feature/add sharepoint service
......@@ -5,13 +5,12 @@ from typing import Annotated
from uuid import uuid4
from annotated_types import Len
from orchestrator.config.assignee import Assignee
from orchestrator.forms import FormPage
from orchestrator.forms.validators import Choice, Label
from orchestrator.targets import Target
from orchestrator.types import FormGenerator, State, SubscriptionLifecycle, UUIDstr
from orchestrator.utils.json import json_dumps
from orchestrator.workflow import StepList, conditional, done, init, inputstep, step, workflow
from orchestrator.workflow import StepList, conditional, done, init, 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 AfterValidator, ConfigDict, field_validator
......@@ -30,6 +29,7 @@ from gso.services import infoblox, subscriptions
from gso.services.lso_client import execute_playbook, 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 (
LAGMember,
......@@ -42,6 +42,7 @@ from gso.utils.helpers import (
validate_tt_number,
)
from gso.utils.shared_enums import Vendor
from gso.utils.workflow_steps import prompt_sharepoint_checklist_url
def initial_input_form_generator(product_name: str) -> FormGenerator:
......@@ -492,24 +493,14 @@ def netbox_allocate_side_b_interfaces(subscription: IptrunkInactive) -> None:
_allocate_interfaces_in_netbox(subscription.iptrunk.iptrunk_sides[1])
@inputstep("Prompt for new Sharepoint checklist", assignee=Assignee.SYSTEM)
def prompt_start_new_checklist(subscription: IptrunkProvisioning) -> FormGenerator:
"""Prompt the operator to start a new checklist in Sharepoint for approving this new IP trunk."""
oss_params = load_oss_params()
class SharepointPrompt(FormPage):
model_config = ConfigDict(title="Start new checklist")
info_label_1: Label = (
f"Visit {oss_params.SHAREPOINT.checklist_site_url} and start a new Sharepoint checklist for an IPtrunk "
f"from {subscription.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_fqdn} to "
f"{subscription.iptrunk.iptrunk_sides[1].iptrunk_side_node.router_fqdn}."
)
info_label_2: Label = "Once this is done, click proceed to finish the workflow."
yield SharepointPrompt
@step("Create a new SharePoint checklist item")
def create_new_sharepoint_checklist(subscription: IptrunkProvisioning, tt_number: str) -> State:
"""Create a new checklist item in SharePoint for approving this IPtrunk."""
new_list_item_url = SharePointClient().add_list_item(
"ip_trunk", {"Title": subscription.iptrunk.iptrunk_description, "TT_NUMBER": tt_number}
)
return {}
return {"checklist_url": new_list_item_url}
@workflow(
......@@ -550,7 +541,8 @@ def create_iptrunk() -> StepList:
>> side_a_is_nokia(netbox_allocate_side_a_interfaces)
>> side_b_is_nokia(netbox_allocate_side_b_interfaces)
>> set_status(SubscriptionLifecycle.PROVISIONING)
>> prompt_start_new_checklist
>> create_new_sharepoint_checklist
>> prompt_sharepoint_checklist_url
>> resync
>> 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