Skip to content

VPC Pair 4.x Implementation#197

Open
sivakasi-cisco wants to merge 45 commits intoCiscoDevNet:nd42_integrationfrom
sivakasi-cisco:vpc_pair_4x_nd
Open

VPC Pair 4.x Implementation#197
sivakasi-cisco wants to merge 45 commits intoCiscoDevNet:nd42_integrationfrom
sivakasi-cisco:vpc_pair_4x_nd

Conversation

@sivakasi-cisco
Copy link
Copy Markdown

@sivakasi-cisco sivakasi-cisco commented Mar 9, 2026

vPC Pair support for ND 4.x

  • nd_manage_vpc_pair can create, update, delete, override, and gather vPC pairs.

  • The big module logic was split into focused helper files (query, validation, actions, deploy, etc.)

  • We added dedicated vPC Pair endpoints/models/schemas and connected them through the orchestrator + state machine flow.

  • Integration tests were added across all main scenarios (merge/replace/override/delete/gather).

@sivakasi-cisco
Copy link
Copy Markdown
Author

Continuation of sivakasi-cisco#1

- VpcPairResourceService handles NDStateMachine orchestration
- Custom actions use RestSend (NDModuleV2) for HTTP with retry logic
"""
argument_spec = dict(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We decided that it would be better to include this as part of our pydantic models and update argument_spec from the model.

Here is an example:

https://github.com/CiscoDevNet/ansible-nd/pull/207/changes#diff-e8e57d176067341e720b4349c4569795b5155338208dd655a3d4ad739e462be4R1368

https://github.com/CiscoDevNet/ansible-nd/pull/207/changes#diff-e8e57d176067341e720b4349c4569795b5155338208dd655a3d4ad739e462be4R1283

This should be added to the pydantic model that represents your playbook configuration. I did not see one for your playbook configuration so for now you could add it to the vpc_pair_models.py file but we should discuss adding a pydantic model the represents the playbook config the user would provide.

)

# State-specific parameter validations
state = module.params.get("state", "merged")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Curious why you default to merged here since the argument spec above already defaults state to merged?

deploy = module.params.get("deploy")
dry_run = module.params.get("dry_run")

if state == "gathered" and deploy:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We need to discuss this more for this module but state: gathered must adhere to the playbook ansible argument spec so that it can be cut an pasted into a playbook

This should follow the Ansible argspec and if used in a playbook with state overridden would result in no changes to the controller

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's discuss alternatives to what you are doing since I believe you are using your current version of state: gathered for testing

),
)

module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
Copy link
Copy Markdown
Collaborator

@mikewiebe mikewiebe Mar 17, 2026

Choose a reason for hiding this comment

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

You should not need a separate dry_run parameter in the playbook. When you instantiate your module here using the supports_check_mode option you should be able to check using

if module.check_mode:
  <handle check_mode code>

@sivakasi-cisco sivakasi-cisco changed the title VPC Pair 4.x Implementation [WIP] VPC Pair 4.x Implementation Mar 18, 2026
@sivakasi-cisco sivakasi-cisco changed the title [WIP] VPC Pair 4.x Implementation VPC Pair 4.x Implementation Mar 24, 2026
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