You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/api-full.md
+60-8Lines changed: 60 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Quick links:
12
12
-[CLI Reference](cli.md)
13
13
-[DSL Reference](dsl.md)
14
14
15
-
Generated from source code on: August 11, 2025 at 21:22 UTC
15
+
Generated from source code on: August 12, 2025 at 16:01 UTC
16
16
17
17
Modules auto-discovered: 67
18
18
@@ -114,6 +114,34 @@ Example (YAML-like):
114
114
-`get(self, name: 'str') -> 'Optional[Component]'` - Retrieves a Component by its name from the library.
115
115
-`merge(self, other: 'ComponentsLibrary', override: 'bool' = True) -> 'ComponentsLibrary'` - Merges another ComponentsLibrary into this one. By default (override=True),
**When to use:** Core component for representing network structure. Used directly for programmatic topology creation or accessed via `scenario.network`.
51
51
52
52
```python
53
-
from ngraph.network import Network, Node, Link
53
+
from ngraph.model.network import Network, Node, Link
54
54
55
55
# Create network topology
56
56
network = Network()
@@ -126,7 +126,7 @@ Essential analysis capabilities for network evaluation.
126
126
**When to use:** Fundamental analysis for understanding network capacity, bottlenecks, and traffic engineering scenarios.
127
127
128
128
```python
129
-
from ngraph.core.algorithms.base import FlowPlacement
@@ -389,9 +389,9 @@ Advanced capabilities for custom analysis and low-level operations.
389
389
**When to use:** Custom analysis requiring NetworkX integration, performance-critical algorithms, or when you need direct control over graph operations.
390
390
391
391
```python
392
-
from ngraph.core.utilimport to_digraph, from_digraph
393
-
from ngraph.core.algorithms.spf import spf
394
-
from ngraph.core.algorithms.max_flow import calc_max_flow
392
+
from ngraph.graph.convertimport to_digraph, from_digraph
393
+
from ngraph.algorithms.spf import spf
394
+
from ngraph.algorithms.max_flow import calc_max_flow
- `match.conditions` uses the failure-policy language (same operators as below): `==`, `!=`, `<`, `<=`, `>`, `>=`, `contains`, `not_contains`, `any_value`, `no_value`.
152
167
- Conditions evaluate over a flat view of node attributes combining top-level fields (`name`, `disabled`, `risk_groups`) and `node.attrs`.
168
+
- `logic`in the `match` block accepts `"and"` or `"or"` (default `"or"`).
153
169
- Selectors filter node candidates before the adjacency `pattern` is applied.
154
170
- Cross-endpoint predicates (e.g., comparing a source attribute to a target attribute) are not supported.
155
171
172
+
Path semantics inside blueprints:
173
+
174
+
- Within a blueprint's `adjacency`, a leading `/` is treated as relative to the blueprint instantiation path, not a global root. For example, if a blueprint is used under group `pod1`, then `source: /leaf` resolves to `pod1/leaf`.
175
+
156
176
Example with OR logic to match multiple roles:
157
177
158
178
```yaml
@@ -191,15 +211,14 @@ Create multiple similar groups using bracket notation:
191
211
```yaml
192
212
network:
193
213
groups:
194
-
dc[1-3]/rack[a-b]: # Creates dc1/racka, dc1/rackb, dc2/racka, etc.
214
+
dc[1-3]/rack[a,b]: # Creates dc1/racka, dc1/rackb, dc2/racka, etc.
195
215
node_count: 4
196
216
name_template: "srv-{node_num}"
197
217
```
198
218
199
219
**Expansion Types:**
200
220
201
221
- Numeric ranges: `[1-4]`→ 1, 2, 3, 4
202
-
- Character ranges: `[a-c]`→ a, b, c
203
222
- Explicit lists: `[red,blue,green]`→ red, blue, green
204
223
205
224
### Variable Expansion in Adjacency
@@ -280,14 +299,20 @@ network:
280
299
link_overrides:
281
300
- source: "^pod1/leaf/.*$"
282
301
target: "^pod1/spine/.*$"
283
-
capacity: 100 # Override capacity
302
+
link_params:
303
+
capacity: 100 # Override capacity
284
304
- source: ".*/spine/.*"
285
305
target: ".*/spine/.*"
286
306
any_direction: true # Bidirectional matching
287
307
link_params:
288
308
cost: 5
289
309
attrs:
290
310
link_type: "backbone"
311
+
312
+
Notes:
313
+
314
+
- For `link_overrides`, only the keys `source`, `target`, `link_params`, and optional `any_direction` are allowed at the top level. All parameter changes must be nested under `link_params`.
315
+
- `any_direction`defaults to `true` if omitted.
291
316
```
292
317
293
318
## `components` - Hardware Library
@@ -444,29 +469,35 @@ Define failure policies for resilience testing:
444
469
```yaml
445
470
failure_policy_set:
446
471
single_link_failure:
447
-
rules:
448
-
- entity_scope: "link"
449
-
rule_type: "choice"
450
-
count: 1
472
+
modes: # Weighted modes; exactly one mode fires per iteration
473
+
- weight: 1.0
474
+
rules:
475
+
- entity_scope: "link"
476
+
rule_type: "choice"
477
+
count: 1
451
478
452
479
random_failures:
453
-
fail_risk_groups: true
454
-
rules:
455
-
- entity_scope: "node"
456
-
rule_type: "random"
457
-
probability: 0.001
458
-
- entity_scope: "link"
459
-
rule_type: "random"
460
-
probability: 0.002
480
+
fail_risk_groups: true # Optional expansion by shared-risk groups
481
+
modes:
482
+
- weight: 1.0
483
+
rules:
484
+
- entity_scope: "node"
485
+
rule_type: "random"
486
+
probability: 0.001
487
+
- entity_scope: "link"
488
+
rule_type: "random"
489
+
probability: 0.002
461
490
462
491
maintenance_scenario:
463
-
rules:
464
-
- entity_scope: "node"
465
-
conditions:
466
-
- attr: "maintenance_mode"
467
-
operator: "=="
468
-
value: "scheduled"
469
-
rule_type: "all"
492
+
modes:
493
+
- weight: 1.0
494
+
rules:
495
+
- entity_scope: "node"
496
+
conditions:
497
+
- attr: "maintenance_mode"
498
+
operator: "=="
499
+
value: "scheduled"
500
+
rule_type: "all"
470
501
```
471
502
472
503
**Rule Types:**
@@ -475,6 +506,12 @@ failure_policy_set:
475
506
- `choice`: Select specific count of entities
476
507
- `random`: Select entities with given probability
477
508
509
+
Notes:
510
+
511
+
- Policies are mode-based. Each mode has a non-negative `weight`. One mode is chosen per iteration with probability proportional to weights, then all rules in that mode are applied and their selections are unioned.
512
+
- Each rule has `entity_scope` ("node" | "link" | "risk_group"), optional `logic` ("and" | "or"; defaults to "or"), optional `conditions`, and one of `rule_type` parameters (`count` for choice, `probability` for random). `weight_by` can be provided for weighted sampling in `choice` rules.
513
+
- Condition language is the same as used in adjacency `match` selectors (see below) and supports: `==`, `!=`, `<`, `<=`, `>`, `>=`, `contains`, `not_contains`, `any_value`, `no_value`. Conditions evaluate on a flat attribute mapping that includes top-level fields and `attrs`.
0 commit comments