Skip to content

Commit 8bc8fa9

Browse files
committed
FIX 'defaults' handing in clab topo file
1 parent 9f2ffc2 commit 8bc8fa9

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

nornir_srl/fsc.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,17 +303,21 @@ def cli(
303303
else:
304304
prefix = f"{topo['prefix']}-{lab_name}-"
305305
hosts: Dict[str, Dict[str, Any]] = {}
306-
def_kind = topo["topology"].get("defaults", {}).get("kind")
306+
srlinux_def = (
307+
True
308+
if "srlinux:" in topo["topology"].get("defaults", {}).get("image", "")
309+
else False
310+
)
307311
srl_kinds = [
308312
k
309313
for k, v in topo["topology"].get("kinds", {}).items()
310314
if "srlinux:" in v.get("image")
311315
]
312316
clab_nodes: Dict[str, Dict] = topo["topology"]["nodes"]
313317
for node, node_spec in clab_nodes.items():
314-
if node_spec.get("kind") == None:
315-
node_spec["kind"] = def_kind
316-
if node_spec["kind"] in srl_kinds:
318+
if (not "kind" in node_spec and srlinux_def) or node_spec.get(
319+
"kind"
320+
) in srl_kinds:
317321
hosts[f"{prefix}{node}"] = {
318322
"hostname": f"{prefix}{node}",
319323
"platform": "srlinux",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "nornir-srl"
3-
version = "0.2.11"
3+
version = "0.2.12"
44
description = "Nornir connection plugin for SRLinux"
55
authors = ["Walter De Smedt <walter.de.smedt@gmail.com>"]
66
readme = "README.md"

0 commit comments

Comments
 (0)