Skip to content

Commit 47ca5a3

Browse files
committed
Add CapacityEnvelopeAnalysis workflow step for Monte-Carlo capacity analysis
1 parent 5655960 commit 47ca5a3

5 files changed

Lines changed: 1082 additions & 3 deletions

File tree

docs/reference/api-full.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ For a curated, example-driven API guide, see **[api.md](api.md)**.
1010
> - **[CLI Reference](cli.md)** - Command-line interface
1111
> - **[DSL Reference](dsl.md)** - YAML syntax guide
1212
13-
**Generated from source code on:** June 13, 2025 at 10:43 UTC
13+
**Generated from source code on:** June 13, 2025 at 17:13 UTC
1414

15-
**Modules auto-discovered:** 37
15+
**Modules auto-discovered:** 38
1616

1717
---
1818

@@ -1785,6 +1785,46 @@ A workflow step that builds a StrictMultiDiGraph from scenario.network.
17851785

17861786
---
17871787

1788+
## ngraph.workflow.capacity_envelope_analysis
1789+
1790+
### CapacityEnvelopeAnalysis
1791+
1792+
A workflow step that samples maximum capacity between node groups across random failures.
1793+
1794+
Performs Monte-Carlo analysis by repeatedly applying failures and measuring capacity
1795+
to build statistical envelopes of network resilience.
1796+
1797+
Attributes:
1798+
source_path: Regex pattern to select source node groups.
1799+
sink_path: Regex pattern to select sink node groups.
1800+
mode: "combine" or "pairwise" flow analysis mode (default: "combine").
1801+
failure_policy: Name of failure policy in scenario.failure_policy_set (optional).
1802+
iterations: Number of Monte-Carlo trials (default: 1).
1803+
parallelism: Number of parallel worker processes (default: 1).
1804+
shortest_path: If True, use shortest paths only (default: False).
1805+
flow_placement: Flow placement strategy (default: PROPORTIONAL).
1806+
seed: Optional seed for deterministic results (for debugging).
1807+
1808+
**Attributes:**
1809+
1810+
- `name` (str)
1811+
- `source_path` (str)
1812+
- `sink_path` (str)
1813+
- `mode` (str) = combine
1814+
- `failure_policy` (str | None)
1815+
- `iterations` (int) = 1
1816+
- `parallelism` (int) = 1
1817+
- `shortest_path` (bool) = False
1818+
- `flow_placement` (FlowPlacement) = 1
1819+
- `seed` (int | None)
1820+
1821+
**Methods:**
1822+
1823+
- `run(self, scenario: "'Scenario'") -> 'None'`
1824+
- Execute the capacity envelope analysis workflow step.
1825+
1826+
---
1827+
17881828
## ngraph.workflow.capacity_probe
17891829

17901830
### CapacityProbe

docs/reference/dsl.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,18 @@ workflow:
472472
shortest_path: true | false # Use shortest path only vs full max flow
473473
flow_placement: "PROPORTIONAL" | "EQUAL_BALANCED" # How to distribute flow
474474
# Additional probe parameters available
475+
476+
- step_type: CapacityEnvelopeAnalysis
477+
name: "envelope_name" # Optional: Name for the analysis step
478+
source_path: "regex/for/source_nodes"
479+
sink_path: "regex/for/sink_nodes"
480+
mode: "combine" | "pairwise" # How to group sources and sinks
481+
failure_policy: "policy_name" # Optional: Named failure policy from failure_policy_set
482+
iterations: N # Number of Monte-Carlo trials (default: 1)
483+
parallelism: P # Number of parallel worker processes (default: 1)
484+
shortest_path: true | false # Use shortest path only (default: false)
485+
flow_placement: "PROPORTIONAL" | "EQUAL_BALANCED" # Flow placement strategy
486+
seed: S # Optional: Seed for deterministic results
475487
```
476488

477489
**Available Workflow Steps:**
@@ -480,6 +492,7 @@ workflow:
480492
- **`EnableNodes`**: Enables previously disabled nodes matching a path pattern
481493
- **`DistributeExternalConnectivity`**: Creates external connectivity across attachment points
482494
- **`CapacityProbe`**: Probes maximum flow capacity between node groups
495+
- **`CapacityEnvelopeAnalysis`**: Performs Monte-Carlo capacity analysis across failure scenarios
483496

484497
## Path Matching Regex Syntax - Reference
485498

@@ -606,6 +619,35 @@ workflow:
606619
source_path: "^(dc\\d+)/client" # Capturing group creates per-DC groups
607620
sink_path: "^(dc\\d+)/server"
608621
mode: pairwise # Test dc1 client -> dc1 server, dc2 client -> dc2 server
622+
623+
- step_type: CapacityEnvelopeAnalysis
624+
source_path: "(.+)" # Captures each node as its own group
625+
sink_path: "(.+)" # Creates N×N any-to-any analysis
626+
mode: pairwise # Required for per-node analysis
627+
```
628+
629+
### Any-to-Any Analysis Pattern
630+
631+
The pattern `(.+)` is a useful regex for comprehensive network analysis in workflow steps like `CapacityProbe` and `CapacityEnvelopeAnalysis`:
632+
633+
- **Individual Node Groups**: The capturing group `(.+)` matches each node name, creating separate groups for each node
634+
- **Automatic Combinations**: In pairwise mode, this creates N×N flow analysis for N nodes
635+
- **Comprehensive Coverage**: Tests connectivity between every pair of nodes in the network
636+
637+
**Example Use Cases:**
638+
```yaml
639+
# Test capacity between every pair of nodes in the network
640+
- step_type: CapacityEnvelopeAnalysis
641+
source_path: "(.+)" # Every node as source
642+
sink_path: "(.+)" # Every node as sink
643+
mode: pairwise # Creates all node-to-node combinations
644+
iterations: 100 # Monte-Carlo analysis across failures
645+
646+
# Test capacity from all datacenter nodes to all others
647+
- step_type: CapacityProbe
648+
source_path: "(datacenter.*)" # Each datacenter node individually
649+
sink_path: "(datacenter.*)" # Each datacenter node individually
650+
mode: pairwise # All datacenter-to-datacenter flows
609651
```
610652

611653
### Best Practices

ngraph/workflow/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
from .base import WorkflowStep, register_workflow_step
22
from .build_graph import BuildGraph
3+
from .capacity_envelope_analysis import CapacityEnvelopeAnalysis
34
from .capacity_probe import CapacityProbe
45

5-
__all__ = ["WorkflowStep", "register_workflow_step", "BuildGraph", "CapacityProbe"]
6+
__all__ = [
7+
"WorkflowStep",
8+
"register_workflow_step",
9+
"BuildGraph",
10+
"CapacityEnvelopeAnalysis",
11+
"CapacityProbe",
12+
]

0 commit comments

Comments
 (0)