Skip to content

experiment switch to scrapligo v2 - #3435

Draft
hellt wants to merge 2 commits into
mainfrom
scrapligo-v2-switch
Draft

hellt wants to merge 2 commits into
mainfrom
scrapligo-v2-switch

Conversation

@hellt

@hellt hellt commented Oct 4, 2026

Copy link
Copy Markdown
Member

Experiment. Won't merge until we do manual tests

@hellt

hellt commented Oct 4, 2026

Copy link
Copy Markdown
Member Author

/tofarev review

@tofarev

tofarev Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

ToFaRev review — completed

Reviewed 37a38f8a7fed · Live OpenCode session · Workflow run

Finding Location
P2 - runningConfigCmds drops cisco_asa, regressing clab save for cisco_asav netconf/netconf.go:62-68
P3 - Swapped log.Errorf arguments in SpawnCLIviaExec utils/networkcli.go:67-71
P4 - SaveRunningConfig keeps an unused 5th parameter netconf/netconf.go:29-29
P4 - No runnable check guards the new platform-to-command gating in GetConfig netconf/netconf.go:60-80

Detailed findings:

P2 - runningConfigCmds drops cisco_asa, regressing clab save for cisco_asav

Location: netconf/netconf.go:62-68

Problem: The rewritten GetConfig replaces the base scrapligocfg path with an explicit runningConfigCmds allowlist, and that map omits cisco_asa, which scrapligocfg v1.0.0 supported with a core driver (alongside the five platforms that are present).

Trigger: clab save on a lab with a cisco_asav node: nodes/cisco_asav/cisco_asav.go sets scrapliPlatformName = "cisco_asa", embeds clabnodes.VRNode with no SaveConfig override, so VRNode.SaveConfig (nodes/vr_node.go:129-130) calls GetConfig with "cisco_asa" and hits the unsupported-platform branch.

Impact: A user-visible regression: clab save on cisco_asav nodes previously produced the running config and now returns retrieving the running config of the "cisco_asa" platform is not supported.

Suggested correction: Add "cisco_asa": "show running-config" to runningConfigCmds. While there, verify the remaining VRNode-inherited platforms (cisco_ftd, aruba_aoscx, paloalto_panos, dell_emc) against scrapligocfg v1's supported device list and include any that had community config drivers.

P3 - Swapped log.Errorf arguments in SpawnCLIviaExec

Location: utils/networkcli.go:67-71

Problem: The call is log.Errorf("failed to fetch platform instance for device %s; error: %+v\n", err, contName) — the error value is passed as the device-name argument and the container name as the error argument, producing logs like failed to fetch platform instance for device <error text>; error: clab-node-name. The pair was carried over from the base code, but this PR rewrites the whole function, making it the natural place to fix it.

Trigger: Any failure constructing the scrapligocli.Cli instance inside SpawnCLIviaExec.

Impact: Misleading operator-facing logs; the error text appears in the device slot and the container name in the error slot, hampering diagnosis. No functional consequence.

Suggested correction: Swap the arguments: log.Errorf("failed to fetch platform instance for device %s; error: %+v\n", contName, err).

P4 - SaveRunningConfig keeps an unused 5th parameter

Location: netconf/netconf.go:29-29

Problem: The signature func SaveRunningConfig(ctx context.Context, addr, username, password, _ string) error retains the scrapli platform parameter that scrapli v1 call sites consumed; in the scrapli v2 implementation it is dead, yet callers in nodes/xrd/xrd.go:136, nodes/c8000/c8000.go:83, nodes/vr_sros/vr-sros.go:267, and nodes/sros/sros.go:1705 still pass it.

Trigger: Any reader of the SaveRunningConfig call sites must infer what the final string argument does when it does nothing.

Impact: Maintainability only; the dead parameter invites meaningless copy-paste arguments at new call sites.

Suggested correction: Remove the fifth parameter from SaveRunningConfig and drop the argument at the four call sites.

P4 - No runnable check guards the new platform-to-command gating in GetConfig

Location: netconf/netconf.go:60-80

Problem: runningConfigCmds is now the decision table for which node kinds can be saved via VRNode.SaveConfig, and nothing in the repo pins it to the platforms registered by the nodes package; no unit test covers the new GetConfig code path (only unrelated VRNode tests mention scrapli).

Trigger: Adding or renaming a VRNode-based kind, or editing runningConfigCmds, without noticing that a registered platform is missing from the map.

Impact: Silent per-kind regressions of clab save discovered only by users — exactly how the cisco_asa omission slipped through.

Suggested correction: Add one small test: a table test that calls GetConfig with each registered VRNode platform name and asserts either that the name is present in runningConfigCmds (or a fake-injected equivalent) or, for known-unsupported ones, that the explicit "not supported" error is returned.

review conditions

Source inspection only; PR code, tests, and benchmarks were not executed.

  • Source-only review; tests were not executed. All 17 changed paths from the manifest were inspected along with relevant callers and base counterparts.
  • The snapshot does not include scrapli v2 module sources, so library-dependent behaviors could only be assessed by inference: (1) whether Cli.Open() on a single scrapligocli.Cli instance is safe to retry after a failed Open — the base SpawnCLIviaExec built a fresh platform and driver per retry, the head version reuses one instance in an unbounded retry loop that also uses context.Background() (unchanged behavior); (2) whether WithBinTransportOverrideArgs splits the space-joined openArgs string into argv elements; (3) whether dropping WithAuthNoStrictKey() everywhere is safe because scrapli v2 disables strict host-key checking by default — if not, every SSH2 session would fail loudly; (4) whether the nokia_srlinux, vyos_vyos, and nokia_sros_classic platform definitions all exist under scrapli v2 naming.
  • The base sros code wrapped addresses as fmt.Sprintf("[%s]") for netconf (SaveRunningConfig, MultiExec) and SSH CLI connections; the head passes the bare address. The purpose of the brackets under scrapli v1 could not be determined; if it was a v1 address-parsing workaround, IPv6 management-address scenarios should be validated.
  • VRNode-inherited kinds whose platforms are absent from runningConfigCmds (cisco_ftd, aruba_aoscx, paloalto_panos, dell_emc, ipinfusion_ocnos, notsupported for checkpoint_cloudguard) now fail with the explicit "not supported" error; whether these succeeded under scrapligocfg v1 community drivers could not be verified. cisco_vios ("cisco_ios") and huawei_vrp were already broken under v1's platform naming, so those are unchanged in practice.
  • Deferred Close placements were reviewed for all looped call sites (sonic_vm.deploySSHKeys, vr_sros.applyPartialConfig, ceos.ceosPostDeploy, vyos.PostDeploy) and are correct; the vyos change moving the debug log after the err check removes a potential nil-pointer dereference on resp.JoinedResult() that existed in the base.
  • No topology-schema changes are part of this PR, so no clab.schema.json review was needed; no release-note file under docs/rn/ was touched. Docs contain no stale vyatta_vyos references after the vyos_vyos platform rename.
  • Skipped head:docs/images/containerlab_black.png (LFS pointer).
  • Long lines in head:docs/images/containerlab_dark_no_text.svg exceed the read tool's per-line display limit.
  • 98 additional coverage limitations were recorded.

Powered by Nebius Token Factory

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor
Download Containerlab binaries for commit 37a38f8:

containerlab (linux/amd64)

curl -sL \
  -H "Authorization: Bearer $(gh auth token)" \
  "https://api.github.com/repos/srl-labs/containerlab/actions/artifacts/11314784583/zip" \
  -o containerlab.zip && unzip -p containerlab.zip containerlab > containerlab.tmp && \
  mv containerlab.tmp containerlab && rm containerlab.zip && chmod +x containerlab

containerlab-arm64 (linux/arm64)

curl -sL \
  -H "Authorization: Bearer $(gh auth token)" \
  "https://api.github.com/repos/srl-labs/containerlab/actions/artifacts/11314838639/zip" \
  -o containerlab-arm.zip && unzip -p containerlab-arm.zip containerlab > containerlab-arm.tmp && \
  mv containerlab-arm.tmp containerlab && rm containerlab-arm.zip && chmod +x containerlab

@ankudinov

Copy link
Copy Markdown
Contributor

Totally unrelated comment, but ToFaRev is a great name. 😂

@hellt

hellt commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

Totally unrelated comment, but ToFaRev is a great name. 😂

took me 5 seconds to come up with it as it was a natural fit :D

This branch has not been deployed

No deployments
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