Skip to content

Commit

Permalink
Merge pull request #12 from srl-labs/fix-clabtopo
Browse files Browse the repository at this point in the history
Fix issue with getting srlinux kinds from clab file
  • Loading branch information
wdesmedt authored Nov 30, 2023
2 parents 7c41a16 + 39b3d54 commit 90cd1e3
Show file tree
Hide file tree
Showing 3 changed files with 195 additions and 179 deletions.
10 changes: 9 additions & 1 deletion nornir_srl/fsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,17 @@ def cli(
else:
prefix = f"{topo['prefix']}-{lab_name}-"
hosts: Dict[str, Dict[str, Any]] = {}
def_kind = topo["topology"].get("defaults", {}).get("kind")
srl_kinds = [
k
for k, v in topo["topology"].get("kinds", {}).items()
if "srlinux:" in v.get("image")
]
clab_nodes: Dict[str, Dict] = topo["topology"]["nodes"]
for node, node_spec in clab_nodes.items():
if node_spec["kind"] == "srl":
if node_spec.get("kind") == None:
node_spec["kind"] = def_kind
if node_spec["kind"] in srl_kinds:
hosts[f"{prefix}{node}"] = {
"hostname": f"{prefix}{node}",
"platform": "srlinux",
Expand Down
Loading

0 comments on commit 90cd1e3

Please sign in to comment.