Modify Workflow

A modify workflow also follows a general pattern, like described below. The @modify_workflow decorator adds some additional steps to the workflow that are always needed.

@modify_workflow("Modify node", initial_input_form=initial_input_form_generator)
def modify_node() -> StepList:
    return (
        >> set_status(SubscriptionLifecycle.PROVISIONING)
        >> update_subscription
        >> update_node_in_ims
        >> update_node_in_nrm
        >> set_status(SubscriptionLifecycle.ACTIVE)
  1. Collect input from user (initial_input_form)
  2. Necessary subscription administration (@modify_workflow):
    1. Register modify process for this subscription
    2. Set subscription ‘out of sync’ to prevent the start of other processes
  3. Transition subscription to Provisioning (set_status)
  4. Update subscription with the user input
  5. Interact with OSS and/or BSS, in this example
    1. Update subscription in IMS (update_node_in ims)
    2. Update subscription in NRM (update_node_in nrm)
  6. Transition subscription to active (set_status)
  7. Set subscription ‘in sync’ (@modify_workflow)

Like a create workflow, the modify workflow also uses an initial input form but this time to only collect the values from the user that need to be changed. Usually, only a subset of the values may be changed. To assist the user, additional values can be shown in the input form using ReadOnlyField. In the example below, the name of the node is shown but cannot be changed, the node status can be changed and the dropdown is set to the current node status, and the node description is still optional.

class ModifyNodeForm(FormPage):
    node_name: ReadOnlyField(port.node.node_name)
    node_status: NodeStatusChoice = node.node_status
    node_description: str | None = node.node_description

After a summary form has been shown that lists the current and the new values, the modify workflow is started.

summary_fields = ["node_status", "node_name", "node_description"]
yield from modify_summary_form(user_input_dict, subscription.node, summary_fields)