Skip to content

Run cEOS postdeploy through container runtime - #3280

Open
orrious wants to merge 3 commits into
srl-labs:mainfrom
orrious:feature/ceos-runtime-exec
Open

Run cEOS postdeploy through container runtime#3280
orrious wants to merge 3 commits into
srl-labs:mainfrom
orrious:feature/ceos-runtime-exec

Conversation

@orrious

@orrious orrious commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@ankudinov ankudinov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@orrious Not sure what is this PR about but as it's not in a draft status - please add the docs and tests required before making it ready for review.

@orrious

orrious commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the requested follow-up on this PR.

Changes pushed:

  • added cEOS postdeploy unit tests
  • added cEOS coverage for runtime-assigned Management0 IPv4 in Robot
  • added the corresponding docs note
  • fixed the unit test endpoint type issue

Validation:

  • real x86 runner: go test ./nodes/ceos and build passed
  • real ARM runner: go test ./nodes/ceos and build passed
  • GitHub-hosted build/unit/docs jobs also passed on amd64 and arm64; hosted cEOS integration failed only on GHCR image pull

@orrious

orrious commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@ankudinov Following up on your July 28 review: the requested docs and tests are now added on this branch, along with the cEOS Robot coverage described in the latest update. Please take another look when you have a moment.

@orrious
orrious force-pushed the feature/ceos-runtime-exec branch from 34fe3e4 to 896e7e1 Compare August 5, 2026 13:13
@orrious

orrious commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@ankudinov I rebased this branch onto current main today (August 5, 2026), so the requested docs/tests follow-up is now on top of the latest base as well. When you have a moment, please take another look.

@ankudinov ankudinov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@orrious Thank you for adding the tests! This PR deserves a better description explaining the problem and what it's changing. And this description must be correctly reflected in docs. Even after reading the recent doc update it is still not clear what this PR solves.

Here is the AI generated summary at a cost of few tokens burned. If you agree - please rewrite and add this to the doc in a shortened from:

Existing lifecycle:
deploy → cEOS PostDeploy() → configure interfaces/IPs

Before:
Scrapligo → spawn `docker/podman exec -it ... Cli` subprocess
            → interactive EOS CLI session
After:
cEOS PostDeploy() → containerlab Runtime.Exec()
                  → run EOS `Cli -c ...` as one batch command
Why do it?
Use containerlab’s native Docker/Podman runtime connection instead of spawning a host-side CLI binary.
Avoid interactive TTY/Scrapligo behavior.
Capture return code, stdout and stderr properly.
Retry CLI startup up to 60 times, rather than the old unbounded retry.
Make execution more consistent with runtime configuration, particularly Podman.
It also changes the EOS command sequence slightly:
Adds configure terminal.
Uses --abort-on-error.
Ends with end and write memory.
Adds unit and integration tests confirming management/data-interface addresses are applied.
My take: the title is misleading. This is a cEOS-specific transport refactor/robustness change, not a new post-deploy feature. Furthermore, the old implementation already selected either the docker or podman executable, so the PR’s practical motivation is not explained especially well. There is no PR description or linked bug.

I'd also explain a bit more about post-deploy in the doc. However this isn't directly related to this PR and can be skipped for now.

Comment thread nodes/ceos/ceos.go
cliCmd := "Cli -p 15 --abort-on-error -c $'" + strings.Join(cfgs, "\n") + "'"

for range 60 {
execCmd := clabexec.NewExecCmdFromSlice([]string{"/bin/bash", "-lc", cliCmd})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we really involve bash here? Is there a specific use case for that? Is direct Cli call an option?

clabexec.NewExecCmdFromSlice([]string{
    "Cli",
    "-p", "15",
    "--abort-on-error",
    "-c", strings.Join(cfgs, "\n"),
})

Comment thread nodes/ceos/ceos.go
var lastResp *clabexec.ExecResult
cliCmd := "Cli -p 15 --abort-on-error -c $'" + strings.Join(cfgs, "\n") + "'"

for range 60 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If understand this correctly, this simply throws the whatever post deploy command at cEOS 60 times without any possibility to detect syntax errors, unsupported commands, etc. While I'd expect this line to be healthy in general and not have all of that, can we consider an alternative approach?

  1. loop 60 times to detect readiness with some simple CLI
  2. once CLI is ready - stop looping and send post deploy once
  3. Return any configuration error immediately with stderr

Comment thread nodes/ceos/ceos.go
lastErr = err
lastResp = resp
log.Debugf("%s - Cli not ready (%v, %v) - waiting.", nodeCfg.LongName, err, resp)
ceosPostDeploySleep(2 * time.Second)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

have to test that in a live lab, but I suspect cancellation will not stop this loop. Please check and fix if it's the case. I'll run this fork in my lab during the final review.

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