Skip to content

Conversation

@fullstopdev
Copy link

@fullstopdev fullstopdev commented Nov 8, 2025

  • Create inventory_parser.go to parse ansible-inventory.yml
  • Modify save command to load per-node/per-kind credentials
  • Use dynamic approach: skip only non-network node kinds
  • Credentials loaded in-memory, not persisted to topology
  • Supports host-level and group-level credential fallback

- Create inventory_parser.go to parse ansible-inventory.yml
- Modify save command to load per-node/per-kind credentials
- Use dynamic approach: skip only non-network node kinds
- Credentials loaded in-memory, not persisted to topology
- Supports host-level and group-level credential fallback

Closes srl-labs#2924
@fullstopdev
Copy link
Author

fullstopdev commented Nov 8, 2025

Ansible inventory example:

nokia_srsim:
vars:
ansible_network_os: nokia.sros.md
# default connection type for nodes of this kind
# feel free to override this in your inventory
ansible_connection: ansible.netcommon.network_cli
ansible_user: admin
ansible_password: NokiaSrl1!

hosts:
dcgw1:
ansible_host: 172.80.80.51
dcgw2:
ansible_host: 172.80.80.52

./containerlab save -t /tmp/srl-sros-telemetry-lab/st.clab.yml
21:45:10 INFO Parsing & checking topology file=st.clab.yml
21:45:10 INFO Using credentials from ansible-inventory.yml for nokia_srsim nodes (user: admin)
21:45:10 INFO Using credentials from ansible-inventory.yml for nokia_srlinux nodes (user: admin)
21:45:10 INFO Saved running configuration node=dcgw2 addr=dcgw2
21:45:10 INFO Saved running configuration node=dcgw1 addr=dcgw1
21:45:11 INFO saved SR Linux configuration from spine1 node. Output:
/system:
Saved current running configuration as initial (startup) configuration '/etc/opt/srlinux/config.json'

21:45:11 INFO saved SR Linux configuration from spine2 node. Output:
/system:
Saved current running configuration as initial (startup) configuration '/etc/opt/srlinux/config.json'

21:45:11 INFO saved SR Linux configuration from leaf3 node. Output:
/system:
Saved current running configuration as initial (startup) configuration '/etc/opt/srlinux/config.json'

21:45:11 INFO saved SR Linux configuration from leaf2 node. Output:
/system:
Saved current running configuration as initial (startup) configuration '/etc/opt/srlinux/config.json'

21:45:11 INFO saved SR Linux configuration from leaf1 node. Output:
/system:
Saved current running configuration as initial (startup) configuration '/etc/opt/srlinux/config.json'

@fullstopdev fullstopdev closed this Nov 8, 2025
@fullstopdev fullstopdev deleted the feat/clab-save-creds-load-2924 branch November 8, 2025 21:05
@fullstopdev fullstopdev restored the feat/clab-save-creds-load-2924 branch November 8, 2025 21:13
@fullstopdev fullstopdev reopened this Nov 8, 2025
@fullstopdev
Copy link
Author

can be tested with other username than admin which should have administrative rights:
[gl:/configure system security user-params local-user user "moussa"]
A:admin@dcgw1# info
password "$2y$10$S25cubWLYVEIafDa9Z.EU.sLWcsanISntEJcEqWSiIkw10qUojlpe"
access {
console true
netconf true
grpc true
}
console {
member ["administrative"]
}

netconfKinds := []string{
"nokia_sros", "vr-sros", "nokia_srsim", // Nokia SROS variants
"nokia_srlinux", "srl", // Nokia SRL (for consistency, though uses local CLI)
"c8000", // Cisco 8000
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are not conform with the schema and should not use deprecated kinds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants