| name | cnf-core-network-review |
| description | Use this skill to review code changes in the `tests/cnf/core/network` directory. |
| disable-model-invocation | true |
tests/cnf/core/network code review
Scope and constraints
- Review the changes on this branch, focusing on
tests/cnf/core/network/**.
- Do not make code changes unless you are explicitly asked.
- Output should be review comments supported by code and a final PR verdict.
Go version
This repository is using the latest stable Go version (check go.mod to verify). Ensure any suspected issues are still valid with the latest Go version.
Project structure (orientation)
There is a top-level shared tests/internal directory and, under tests/cnf/core/network, a shared internal directory along with directories for each test suite: accelerator, cni, day1day2, dpdk, metallb, policy, security, and sriov.
Shared internal packages (tests/cnf/core/network/internal)
netinittools: exports APIClient (*clients.Settings) and NetConfig (*netconfig.NetworkConfig). An init() function auto-initializes both on package load. Designed for dot-import (. "…/netinittools") so APIClient and NetConfig are available without a package prefix.
netconfig: configuration via default.yaml and ECO_CNF_CORE_NET_* environment variables (struct tags: envconfig:"ECO_CNF_CORE_NET_…").
netenv: cluster environment helpers (IsSNOCluster(), DoesClusterHasEnoughNodes(), DeployPerformanceProfile(), SetStaticRoute(), etc.).
netparam: shared constants (IP families, subnets, timeouts, labels) and types (e.g. BFDDescription).
cmd: command and connectivity helpers (ICMPConnectivityCheck(), ValidateTCPTraffic(), RunCommandOnHostNetworkPod(), GetSrIovPf()). Also provides Juniper switch management (NewSession() → Junos type with Config(), RunCommand(), SaveInterfaceConfigs(), etc.).
define: NAD builders (TapNad(), MacVlanNad(), VlanNad(), IPVlanNad(), HostDeviceNad(), CreateExternalNad()).
ipaddr: IP address utilities (RemovePrefix()).
frrconfig: FRR daemon configuration generation (DefineBaseConfig(), CreateStaticIPAnnotations()).
netnmstate: NMState instance helpers (CreateNewNMStateAndWaitUntilItsRunning(), CreatePolicyAndWaitUntilItsAvailable(), ConfigureVFsAndWaitUntilItsConfigured(), CheckThatWorkersDeployedWithBondVfs(), etc.).
Test suite directory layout
Inside each test suite directory (e.g. sriov/, metallb/), there are typically:
internal/: suite-specific helpers and params
internal/tsparams/: parameters and constants for the suite (avoid test assertions here)
internal/*env/: optional environment/setup helpers (e.g. sriovenv, metallbenv, dpdkenv)
- Other suite-specific packages (e.g.
metallb/internal/frr/, metallb/internal/prometheus/, metallb/internal/cmd/, day1day2/internal/juniper/, dpdk/internal/link/)
tests/: test cases (.go files, not _test.go)
*_suite_test.go: Ginkgo suite entrypoint (suite-wide setup/teardown + reporting)
Cleanup
- Per-test cleanup commonly uses
namespace.NewBuilder(APIClient, nsName).CleanObjects(…) in AfterEach to remove pods/resources.
- Suite-level cleanup deletes the test namespace in
AfterSuite.
- Resources modified during a test (e.g. SR-IOV policies, NMState policies) must be restored in
AfterAll or AfterEach, even on failure.
By() blocks
By("description") is used extensively to document logical steps inside test cases. New tests should follow this convention.
Review workflow (do this in order)
- Summarize the change set:
- List the changed files and their role (suite test vs suite
internal vs shared tests/cnf/core/network/internal).
- Briefly describe what behavior the change is trying to add/fix.
- Review file-by-file, prioritizing correctness and flake-risk:
- Check logic, error handling, cleanup/teardown, timeouts/retries, and any API interactions.
- Apply the checklist below (only mention items that are violated; don't restate the whole checklist).
Output format (be consistent)
- Start with:
- Summary: 2-6 bullets of what changed + main risks
- What I did not validate: e.g., "not runnable without a cluster/env"
- Then list Comments, grouped by severity and globally numbered:
- Blocker (must fix), Major, Minor, Nit
- Each comment must include:
- Location:
path/to/file.go (+ function name and/or approximate line range)
- Evidence: a small code quote
- Why it matters: correctness/maintenance/flake-risk
- Suggested fix: concrete change
- End with Verdict: Approve / Approve with nits / Request changes.
Code review checklist
Functionality
Style
Reuse / placement
Automated checks