Staged preview refinement for vpc_pair with additional tests - #503
Staged preview refinement for vpc_pair with additional tests#503sivakasi-cisco wants to merge 2 commits into
Conversation
allenrobel
left a comment
There was a problem hiding this comment.
Code review
Two observations on the sync-state refinement — one comment/dead-code cleanup in query.py, one question about the changed promotion in resources.py. The utils.py OperationType.UPDATE fix looks correct (verified register_action_api_call has a single caller, and the per-call Results scoping means no blast radius).
🤖 Generated with Claude Code
|
Just a comment rather than a review comment, but it would be helpful to reviewers if you describe what this PR does in the PR description, along with a description of the changes and why they are needed. |
Hi Allen, True. I moved it from draft to open and had missed it |
|
Could you please confirm whether this is the intended behavior for |
Problem scenarioA vPC pair deletion can be staged using During the staged deletion, the controller removes the pair from the vPC pair inventory before the switch-side removal is saved or deployed. When the module is subsequently invoked with The later invocation therefore returns Steps to reproduce
Controller intent verificationAfter the second module invocation returned Subsequent pendingConfigs:
- no interface port-channel500
- no interface Vlan3600
- no vlan 3600
- no vpc domain 1
- no feature vpc
# plus peer-link member cleanup and interface restoration commandsThis confirms that the staged removal intent was still available to the controller even though the pair was no longer present in the pair inventory. Calling |
|
I noticed that |
|
Impact: Low Problem scenarioA vPC pair can be saved without being deployed using Repeating the identical save-only operation performs another Steps to reproduce
- cisco.nd.nd_manage_vpc_pair:
fabric_name: "<fabric>"
state: merged
config:
- peer1_switch_id: "<peer1>"
peer2_switch_id: "<peer2>"
use_virtual_peer_link: false
config_actions:
save: false
deploy: false
type: switch
- cisco.nd.nd_manage_vpc_pair:
fabric_name: "<fabric>"
state: merged
config:
- peer1_switch_id: "<peer1>"
peer2_switch_id: "<peer2>"
use_virtual_peer_link: false
config_actions:
save: true
deploy: false
type: switch
Observed behaviorThe repeated save-only invocation returns: changed: true
class_diff:
created: []
updated: []
deleted: []
deployment_changed: true
deployment_needed: true
deployment_paths:
- /api/v1/manage/fabrics/<fabric>/actions/configSaveThe API trace for the repeated invocation contains: It contains no vPC-pair Direct The repeated task is therefore reported as |
Hi Nikhil, thank you for the comments. There is one more PR where the config_actions are explictly handled for vpc pair here. Just to avoid repetitive changes, I have handled the default deploy to false in that. |
This PR fixes the "stage now, deploy later" flow for vPC pairs.
Before, re-running to deploy a previously staged pair did nothing (changed: false) and left it stuck pending.
Now the module detects pending work on save (not just deploy), trusts the switch's real status over the controller's optimistic summary, and reports changed: true correctly.
Added 4 integration tests in addition (staged ladder, check-mode, deploy-scope, negative).