Skip to content

Config Actions: Wire nd_manage_switches to the Common Save and Deploy Framework - #499

Open
AKDRG wants to merge 9 commits into
CiscoDevNet:developfrom
AKDRG:config_actions_switches_integration
Open

Config Actions: Wire nd_manage_switches to the Common Save and Deploy Framework#499
AKDRG wants to merge 9 commits into
CiscoDevNet:developfrom
AKDRG:config_actions_switches_integration

Conversation

@AKDRG

@AKDRG AKDRG commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Related Issue(s)

Related to #368

Merge dependency on common framework #498

Proposed Changes

  • Wire nd_manage_switches into the shared config_actions framework.
  • Parse and validate switch module config_actions through the common policy-driven parser.
  • Add a switch-specific config actions backend for:
    • fabric config save
    • switch-scoped deploy
    • global fabric deploy
  • Preserve existing switch module defaults:
    • config_actions.save: true
    • config_actions.deploy: true
    • config_actions.type: switch
  • Enforce common validation behavior:
    • reject explicit empty config_actions: {}
    • reject deploy: true with save: false
    • reject unsupported deploy types for switch workflows
  • Route switch finalize flows through the common controller while preserving existing add, migrate, re-add, POAP, preprovision, RMA, and idempotent deploy behavior.
  • Add result registration for config save/deploy actions so config action execution is visible in module output.
  • Keep idempotent out-of-sync switches deployable on a later run when config_actions.deploy is enabled.
  • Add focused unit coverage for switch config action finalize behavior and common framework integration.

Test Notes

  • Ran formatting:

    • black --check -l 159 plugins tests
    • Result: passed
  • Ran targeted sanity checks:

    • ansible-test sanity --test pep8 --color --truncate 0
    • ansible-test sanity --test pylint --color --truncate 0
    • Result: passed
  • Ran full sanity from a materialized collection tree:

    • ansible-test sanity --color --truncate 0
    • Result: passed
    • Note: Python 3.10 and 3.12 compile/import checks were skipped locally because those interpreters are not installed.
  • Live tested switch config actions on AK-VXLAN:

    • 8-switch import with config save and switch-level deploy enabled.
    • Switch-level deploy flow completed.
    • Global deploy flow was exercised.
    • Subsequent deploy run after a staged/non-deployed run was validated.
    • Cleanup/removal workflow was tested.

Cisco Nexus Dashboard Version

Cisco Nexus Dashboard 4.2.1

Related ND API Resource Category

  • analyze
  • infa
  • manage
  • onemanage
  • other

Checklist

  • Latest commit is rebased from develop with merge conflicts resolved
  • New or updates to documentation has been made accordingly
  • Assigned the proper reviewers

@AKDRG AKDRG changed the title Config actions switches integration Config Actions: Wire nd_manage_switches to the Common Save and Deploy Framework Aug 10, 2026
@AKDRG AKDRG self-assigned this Aug 10, 2026
@AKDRG AKDRG added the ready for review Submitter is requesting a PR review label Aug 10, 2026

@allenrobel allenrobel 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.

Code review

Reviewed the switch-module wiring into the common config-actions framework (findings in the config_actions/ package itself are out of scope here since they land via #498). Two findings, posted inline.

🤖 Generated with Claude Code

switch_ids=tuple(serial_numbers or ()),
)
controller = ConfigActionsController(SWITCH_CONFIG_ACTIONS, SwitchConfigActionsBackend(self.fabric_utils))
result = controller.execute(actions, context)

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.

When deploy_type is switch and serial_numbers is empty, the controller returns status: "skipped", error: "no_targets" for the deploy step and the module still reports success. The code this replaces fell back to a global deploy with a warning in exactly that case ("Switch-level deploy requested but no serial numbers provided — falling back to global deploy", removed in this hunk).

The idempotent config-sync paths call finalize(serial_numbers=sync_serials) (three sites, ~L3241/L3389/L3528) where sync_serials is built from a filtered comprehension (switch_id must be truthy) and can legitimately be empty while a deploy is still required — in that case pending config-sync now goes undeployed, with the skip visible only in the nested DATA.actions[].error field.

Suggest either restoring the global-deploy fallback for this path, or at minimum warning/failing when a requested deploy is skipped for lack of targets, so the pending config doesn't silently stay undeployed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Great catch.
Since we are specfically targeting "switch" deploy_type, doing a global deploy should not be done. So, I'm throwing up an error now.

Comment thread plugins/module_utils/manage_switches/config_actions_backend.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review Submitter is requesting a PR review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants