Skip to content

Commit

Permalink
Merge pull request #22 from srl-labs/fix-clab-topo
Browse files Browse the repository at this point in the history
fix defaults handling in clab topo file
  • Loading branch information
wdesmedt authored Jul 21, 2024
2 parents 66d2560 + 1fc5388 commit 32a6ce4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions nornir_srl/fsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,15 +303,18 @@ def cli(
else:
prefix = f"{topo['prefix']}-{lab_name}-"
hosts: Dict[str, Dict[str, Any]] = {}
srlinux_def = (
True
if "srlinux:" in topo["topology"].get("defaults", {}).get("image", "")
else False
def_kind = topo["topology"].get("defaults", {}).get("kind")
def_image = (
topo["topology"].get("defaults", {}).get("image")
or topo["topology"]["kinds"].get(def_kind, {}).get("image")
if def_kind
else None
)
srlinux_def = True if def_image and "srlinux" in def_image else False
srl_kinds = [
k
for k, v in topo["topology"].get("kinds", {}).items()
if "srlinux:" in v.get("image")
if "srlinux" in v.get("image")
]
clab_nodes: Dict[str, Dict] = topo["topology"]["nodes"]
for node, node_spec in clab_nodes.items():
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nornir-srl"
version = "0.2.17"
version = "0.2.18"
description = "Nornir connection plugin for SRLinux"
authors = ["Walter De Smedt <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 32a6ce4

Please sign in to comment.