-
Notifications
You must be signed in to change notification settings - Fork 20
Description
What should we build?
As an Orchestrator User I want to be able to correct information in external systems with 1 click by running a Reconcile workflow.
A "Reconcile workflow" is nothing more than calling the Modify workflow that will reapply current configuration from the database. (e.g. running the Modify workflow with only empty input forms)
Implementation details
- The reconcile workflow will only run steps that update external systems. It does not include the:
- Input forms
- Subscription updates in Core DB
- The definition of those steps should be reused by both the modify and reconcile workflow
- The reconcile workflow still requires the subscription to be in sync before it can be started
- Only allow 1 Reconcile workflow per product
- See how this is implemented for Create workflows with
ProductTable.create_subscription_workflow_key
- See how this is implemented for Create workflows with
Intended usage in Orchestrator implementations
Below is an example for the modify workflow of one specific production.
These steps should be repeated for each product that need (and support) a reconcile workflow.
Example based on example-orchestrator modify_l2vpn:
- Add migration to add a row in Workflows table with
target=RECONCILE
andname="reconcile_l2vpn"
- Add
LazyWorkflowInstance
mapping the modulemodify_l2vpn
toreconcile_l2vpn
:
LazyWorkflowInstance("workflows.l2vpn.modify_l2vpn", "reconcile_l2vpn")
The modify_l2vpn.py
should be modified as well.
It currently looks like this:
@modify_workflow("Modify l2vpn", initial_input_form=initial_input_form_generator)
def modify_l2vpn() -> StepList:
return (
begin
>> set_status(SubscriptionLifecycle.PROVISIONING)
>> update_subscription
>> update_subscription_description
>> set_status(SubscriptionLifecycle.ACTIVE)
>> update_l2vpn_in_nrm
)
The steps responsible for updating external systems should be pulled out to a reusable variable:
update_l2vpn_in_external_systems = (
begin
>> update_l2vpn_in_nrm
)
@modify_workflow("Modify l2vpn", initial_input_form=initial_input_form_generator)
def modify_l2vpn() -> StepList:
return (
begin
>> set_status(SubscriptionLifecycle.PROVISIONING)
>> update_subscription
>> update_subscription_description
>> set_status(SubscriptionLifecycle.ACTIVE)
>> update_l2vpn_in_external_systems
)
The reconcile workflow then refers to the steps in that variable without going through the input forms.
It also does not update the subscription in the Core DB because there is nothing to update.
@reconcile_workflow("Reconcile l2vpn")
def reconcile_l2vpn() -> StepList:
return (
begin
>> update_l2vpn_in_external_systems
)
If some of the steps in update_l2vpn_in_external_systems
require default values to be in the state, an extra step can be added to provide this.
Tasks
In orchestrator-core:
- Add
Target.RECONCILE
- Ensure that reconcile workflows are returned by the endpoint
/api/subscriptions/workflows/<id>
- Ensure that reconcile workflows are returned by the endpoint
- Implement
@reconcile_workflow()
decorator- Create
wrap_reconcile_initial_input
(based onwrap_modify_initial_input_form
) to perform the validations inModifySubscriptionPage
and to provide the minimal state values - It should not accept an initial input form
- Use the correct
Target.RECONCILE
- Create
- Implement and test in all example-orchestrator modify workflows, such as modify_l2vpn
Related UI ticket: workfloworchestrator/orchestrator-ui-library#2081