From fbf2b7caf6879e4f05f6491df3bce3d82fde46cb Mon Sep 17 00:00:00 2001 From: Gert van der Weijde Date: Tue, 30 Jun 2026 15:23:58 +0200 Subject: [PATCH 1/2] add note about idempotency in ims_create_vlans and ims_remove_vlans --- workflows/l2vpn/create_l2vpn.py | 3 +++ workflows/l2vpn/terminate_l2vpn.py | 3 +++ 2 files changed, 6 insertions(+) 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) From 19c6e0a0b59dce877dc8558b0dcdf6c342f58028 Mon Sep 17 00:00:00 2001 From: Gert van der Weijde Date: Mon, 6 Jul 2026 12:58:33 +0200 Subject: [PATCH 2/2] update README with warning on idempotence --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) 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