Vrf_lite module for Ansible ND 4.x - #281
Conversation
There was a problem hiding this comment.
Code review
Found 6 issues, posted as inline comments below so each can be resolved individually.
Highlights: the module is built on the abandoned nd_v2 NDModule transport instead of the Gen-3 orchestrator RestSend path; the switch inventory is fetched twice per run, bypassing FabricContext; and validation issues a per-attachment GET (N+1).
Also, a couple general comments.
- It would be helpful for reviewers if the PR Description template was completed so that we have a summary of what the PR contains, design decisions, caveats, workarounds required, unit test coverage, etc.
- The title of the PR implies this is a draft. Since, it's now labeled "Ready for Review" you might want to edit the title to remove "initial draft"
🤖 Generated with Claude Code
- If this code review was useful, please react with 👍. Otherwise, react with 👎.
Thank you for the comments, Akshay. On the offline comments you had shared, I have addressed the possible items.
|
…mpty VRF and tests for bulk merge
d2fe8ba to
9fe5866
Compare
00dbd70 to
5898c51
Compare
5898c51 to
a3147a2
Compare
allenrobel
left a comment
There was a problem hiding this comment.
Re-review after the new commits (my earlier approval was dismissed by the June pushes).
First, credit where due: I verified all 15 previously-raised review threads against the current code, and every one is genuinely addressed — deploy targets now derive from the state-machine operation journal (with real wire-payload tests proving replaced/overridden removals deploy to the removed switches, including check mode), config_actions.type correctly scopes deploy, the check-mode preflight exists, nd_v2 is gone, FabricContext is used with a shared inventory cache, and the bulk validation N+1 is fixed with request-count tests. The unit suite is largely real-assertion (wire payloads, request counts, exact endpoint paths). Nice work.
The inline comments below are new findings from this pass, roughly ordered by severity:
- Two framework-level concerns in
nd_state_machine.py/models/base.py: the merged-stateallow_supersetdiff change applies ungated to every Gen-3 module (with a concrete idempotency regression scenario on shipped interface modules), and diff/merge now disagree about list semantics. - Two model-validation range bugs (
dot1q,vlan_id) confirmed against the ND 4.2.1 OpenAPI schema, plus avrf_namelength that matches no schema constraint. - A failure-detection gap that can report a failed attachment as success.
- Check-mode vs real-run validation divergence.
- Several unmarked ND-API workarounds that need
TODO(X.Y.Z) <slug>markers per the repo convention. - Endpoint-layer duplication/dead code, the
ignore-2.15.txtsanity file, integration teardown leaving deployed config on switches, and a typing convention inutils.py.
|
I had resolved the comments here, but for the vault-note mentions on TODO(4.2.1) markers, could you pls help me with some reference? |
Replied via Webex with references. |
There was a problem hiding this comment.
LGTM after comments were addressed.
One minor nit, the TODO(4.2.1) marker should not contain 'slug: '.
Example (correct):
TODO(4.2.1) vrf-lite-vlan-shape-drift
Example (incorrect):
TODO(4.2.1) slug: vrf-lite-vlan-shape-drift
But this is a consistency/style nit. Functionally, 'slug: ' works, but it's more verbose.
Addressed them in the last changes. Confirmed that there is no "slug:" form anywhere in the code. |
Related Issue(s)
This PR adds a new
nd_manage_vrf_litemodule for managing VRF Lite attachments on Nexus Dashboard / NDFC 4.x fabrics.The module supports:
gatheredmergedreplacedoverriddendeletedThe implementation uses the existing
NDStateMachinepattern, but keeps the VRF Lite-specific API details in a dedicated orchestrator and helper files underplugins/module_utils/manage_vrf_lite.Main things included in this PR:
cisco.nd.nd_manage_vrf_litemoduleconfig_actions.saveandconfig_actions.deployNote:
issubset()list matching changed from greedy to bipartite matching. This affects all callers (includingnd.pyidempotency checks), strictly in the "fewer falsechanged" direction.