Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions workflows/l2vpn/create_l2vpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions workflows/l2vpn/terminate_l2vpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Comment thread
Mark90 marked this conversation as resolved.
saps = subscription.virtual_circuit.saps

remove_saps_in_netbox(saps)
Expand Down
Loading