Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement clab save for IOL. #2403

Merged
merged 8 commits into from
Jan 17, 2025
Merged

Implement clab save for IOL. #2403

merged 8 commits into from
Jan 17, 2025

Conversation

kaelemc
Copy link
Contributor

@kaelemc kaelemc commented Jan 17, 2025

As per the title this PR:

  • Adds clab save for IOL
  • Minor regex cleanup in AllowedIntfRegexp

I've pretty much stolen the sample in the scrapligo README and modified it to exec write memory which does the same as copy run start, the difference being with write memory there is no pesky prompt that shows up to confirm you want to copy the config.

I'll add some tests, but let me know if you like it this way or would prefer something else.

FYI: "programmability" is not supported on IOL (this includes NETCONF).

There was redundant regex for the `eX/X` and `EthernetX/X` checks.

The regexp has been simplified so "e" vs "Ethernet" and the slot/port checks are in two separate capture groups.
`SaveConfig()` func is used which allows the "clab save" command to be used.

Uses the scrapligo network driver to send a basic `write memory` command which copies the running config -> startup config.
Comment on lines +384 to +385
// SaveConfig is used for "clab save" functionality -- it saves the running config to the startup configuration
func (n *iol) SaveConfig(_ context.Context) error {
Copy link
Member

Choose a reason for hiding this comment

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

@kaelemc can you add a simple robot test in the iol test suite?

Just call a command and check if it returns rc=0 at a mininum.

If you want to make it more proper, maybe you can check with some show command that the stratup has actually been written to

Some basic tests which use "containerlab save" to save all running configurations to the startup-configuration (in NVRAM).

The test then verifies the config was saved to the startup-config by checking the startup-config location contains a configuration with the nodes hostname.
@hellt hellt merged commit 0bd6b5a into srl-labs:main Jan 17, 2025
65 checks passed
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

Attention: Patch coverage is 61.29032% with 12 lines in your changes missing coverage. Please review.

Project coverage is 52.56%. Comparing base (3f31afd) to head (244940f).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
nodes/iol/iol.go 61.29% 8 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2403      +/-   ##
==========================================
+ Coverage   51.97%   52.56%   +0.59%     
==========================================
  Files         172      168       -4     
  Lines       17394    16940     -454     
==========================================
- Hits         9040     8905     -135     
+ Misses       7412     7122     -290     
+ Partials      942      913      -29     
Files with missing lines Coverage Δ
nodes/iol/iol.go 78.46% <61.29%> (-2.58%) ⬇️

... and 11 files with indirect coverage changes

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