diff --git a/README.md b/README.md index 128f444..7c73620 100644 --- a/README.md +++ b/README.md @@ -894,6 +894,15 @@ subscriptions against the OSS and BSS. The decorators and the `@step` decorator is used to define workflow steps that can be used in any type of workflow. +### Workflow step idempotence + +It is good practice to define [idempotent](https://en.wikipedia.org/wiki/Idempotence) steps; a step may have to be +retried after failing partway through its execution. +Be aware that some example steps for L2VPN are not idempotent (yet): +- `ims_create_vlans` in `/workflows/l2vpn/create_l2vpn.py` +- `ims_remove_vlans` in `/workflows/l2vpn/terminate_l2vpn.py` +If you want to use these workflows, the above steps should be refactored to make them idempotent. + ### Workflow Architecture - Passing information from one step to the next Information between workflow steps is passed using `State`, which is diff --git a/workflows/l2vpn/create_l2vpn.py b/workflows/l2vpn/create_l2vpn.py index 516da11..5dd9593 100644 --- a/workflows/l2vpn/create_l2vpn.py +++ b/workflows/l2vpn/create_l2vpn.py @@ -118,6 +118,9 @@ def to_sap(port: UUIDstr) -> SAPBlockInactive: @step("Create VLANs in IMS") def ims_create_vlans(subscription: L2vpnProvisioning) -> State: + """Note: this step is not idempotent. + If you want to use this workflow, this step has to be + refactored to make it idempotent.""" saps = subscription.virtual_circuit.saps sap_payloads = create_saps_in_netbox(saps, subscription) diff --git a/workflows/l2vpn/terminate_l2vpn.py b/workflows/l2vpn/terminate_l2vpn.py index ae93088..96210cb 100644 --- a/workflows/l2vpn/terminate_l2vpn.py +++ b/workflows/l2vpn/terminate_l2vpn.py @@ -40,6 +40,9 @@ def ims_remove_l2vpn(subscription: L2vpn) -> None: @step("Remove VLANs from IMS") def ims_remove_vlans(subscription: L2vpn) -> None: + """Note: this step is not idempotent. + If you want to use this workflow, this step has to be + refactored to make it idempotent.""" saps = subscription.virtual_circuit.saps remove_saps_in_netbox(saps)