Skip to content

VPC Pair 4.x Implementation#1

Open
sivakasi-cisco wants to merge 27 commits intorest_send_integrationfrom
vpc_pair_4x
Open

VPC Pair 4.x Implementation#1
sivakasi-cisco wants to merge 27 commits intorest_send_integrationfrom
vpc_pair_4x

Conversation

@sivakasi-cisco
Copy link
Copy Markdown
Owner

Summary

This PR implements the VPC Pair management module for ND 4.x with comprehensive Pydantic validation.

Changes

  • Added nd_manage_vpc_pair module for VPC pair lifecycle management
  • Implemented Pydantic models for input validation
  • Added common utilities:
    • common/log.py: File-based logging for debugging
    • common/models.py: Pydantic model helper functions
  • Module supports states: query, present, absent, merged, replaced, overridden, deleted
  • Includes deploy and dry_run options

Files Changed

  • plugins/modules/nd_manage_vpc_pair.py (1,912 lines)
  • plugins/module_utils/manage/vpc_pair/model_playbook_vpc_pair.py (658 lines)
  • plugins/module_utils/manage/vpc_pair/__init__.py (90 lines)
  • plugins/module_utils/common/log.py (369 lines)
  • plugins/module_utils/common/models.py (111 lines)
  • plugins/module_utils/nd.py (61 lines modified)

Total: +3,200 insertions, -1 deletion across 6 files

@sivakasi-cisco sivakasi-cisco force-pushed the vpc_pair_4x branch 3 times, most recently from 42969a0 to e6b0609 Compare February 17, 2026 15:39
sivakasi-cisco and others added 6 commits February 17, 2026 21:19
commit a7f263d
Merge: 4d1a4b0 e4676e0
Author: Neil John <39439797+neiljohn-gh@users.noreply.github.com>
Date:   Mon Aug 18 16:26:10 2025 +0530

    Merge branch 'CiscoDevNet:master' into vpc_peers_module

commit 4d1a4b0
Author: neiljohn-gh <neiljohn9125@gmail.com>
Date:   Mon Aug 18 15:52:51 2025 +0530

    added deploy and dry_run options to nd_manage_vpc_pair.py with corresponding functionality and examples

commit b8bf64f
Author: neiljohn-gh <neiljohn9125@gmail.com>
Date:   Sun Aug 17 19:24:34 2025 +0530

    added merged, overridden, replaced and deleted (WIP)

commit 3b46915
Author: neiljohn-gh <neiljohn9125@gmail.com>
Date:   Tue Jul 29 19:01:57 2025 +0530

    added functionality for nd_manage_vpc_pair.py along with the pydantic model required
    1. Schema migration
    2. 4.x version update on create, update, delete with PUT
    3. Field name changes from peer1SwitchId to switchId and switch_id python attribute
    4. vpcAction discriminator for PUT EP
    5. Update in delete and merged
    6. Validation changes
- Add Pydantic-based NDBaseModel for network resource models
- Add NDConfigCollection for type-safe config management with O(1) lookups
- Add NDNetworkResourceModule base class for network resource modules
- Add nd_local_user module as reference implementation
- Supports merged/replaced/overridden/deleted states
- Implements composition pattern with actions_overwrite_map

Co-authored-by: Gaspard Micol <gmicol@cisco.com>
@sivakasi-cisco sivakasi-cisco changed the base branch from master to rest_send_integration February 17, 2026 17:51
@sivakasi-cisco sivakasi-cisco force-pushed the vpc_pair_4x branch 2 times, most recently from b1adc39 to 3b30fce Compare February 19, 2026 09:37
@sivakasi-cisco sivakasi-cisco self-assigned this Feb 20, 2026
raise ValueError(f"fabric_name must be a non-empty string. Got: {fabric_name!r}")

# Initialize RestSend via NDModuleV2
nd_v2 = NDModuleV2(nrm.module)
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

NDModuleV2 is used for vpc_pair module specific custom functions and used above as an argument

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

CReate, Update, Delete, deploy, query_all custom functions use NDModuleV2 custom RestSend path

VpcFieldNames,
)
from ansible_collections.cisco.nd.plugins.module_utils.manage.vpc_pair.vpc_pair_endpoints import (
EpVpcPairConsistencyGet,
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Added missing API usage for vPC support/consistency/list endpoints

@@ -888,6 +944,123 @@ def _get_recommendation_details(nd_v2, fabric_name: str, switch_id: str, timeout
raise


Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Added endpoint helpers

  • vpc_pairs_list
  • switch_vpc_support
  • switch_vpc_consistency
  • _extract_vpc_pairs_from_list_response
  • _get_pairing_support_details
  • _get_consistency_details

commit df99ff3
Author: Gaspard Micol <gmicol@cisco.com>
Date:   Thu Feb 26 14:09:18 2026 -0500

    [ignore] Make a small change to NDModule request function.

commit 9cdfa66
Author: Gaspard Micol <gmicol@cisco.com>
Date:   Thu Feb 26 14:01:24 2026 -0500

    [ignore] Rename NDNetworkResourceModule to NDStateMachine. Add file for NDNestedModel. Add types.file. Various Renaming and small Modifications across the repo. WIP.

commit b41b5b8
Author: Gaspard Micol <gmicol@cisco.com>
Date:   Thu Feb 26 10:44:23 2026 -0500

    [ignore] Fix  and  in nd_config_collections.py. Move  to utils.py.

commit e2101f9
Author: Gaspard Micol <gmicol@cisco.com>
Date:   Thu Feb 26 10:42:12 2026 -0500

    [ignore] Complete orchestrators/base.py by making simple CRUD operations methods that work for single_identifier strategy (meant to be overridden if needed).

commit 48b62be
Author: Gaspard Micol <gmicol@cisco.com>
Date:   Thu Feb 26 10:38:50 2026 -0500

    [ignore] Add  choice for  when no identifier is needed. Add quick comments and changes to models/local_user.py and api_endpoints/base.py

commit b04a82b
Author: Gaspard Micol <gmicol@cisco.com>
Date:   Wed Feb 25 08:24:28 2026 -0500

    [ignore] Default  to none and update condition for  regarding  in models/base.py.

commit 229af5a
Author: Gaspard Micol <gmicol@cisco.com>
Date:   Tue Feb 24 12:57:37 2026 -0500

    [ignore] Adapt the Network Resource Module architecture for ND to smart endpoints and Pydantic models modification (works for merge and replace states). Add comments for next steps.

commit 4b65c25
Author: Gaspard Micol <gmicol@cisco.com>
Date:   Wed Feb 18 01:23:37 2026 -0500

    [ignore] Modifiy models/local_user to take full advantage of Pydantic built-in functionalities. Slightly modify models/base.py to enforce identifiers definitions in NDBaseModel subclasses. Added multiple notes to assert next steps.

commit dead722
Author: Gaspard Micol <gmicol@cisco.com>
Date:   Tue Feb 17 13:46:10 2026 -0500

    [ignore] Add api_endpoints for configuring endpoints and orchestrators for orchestrating crud api operations with model instances and endpoints.

commit dc9649e
Author: Gaspard Micol <gmicol@cisco.com>
Date:   Fri Jan 23 14:37:44 2026 -0500

    [ignore] Modify nd_local_user based on Pydantic implementation and changes added to NDNetworkResourceModule.

commit b35fa8d
Author: Gaspard Micol <gmicol@cisco.com>
Date:   Fri Jan 23 13:51:54 2026 -0500

    [ignore] Pydantic Base ND Network Resource Module: Final proposition of core design changing existing methods and adding new ones which will be used in future as a based for ND network resource modules as well as basic error handling and simple docstrings.

commit d518bf3
Author: Gaspard Micol <gmicol@cisco.com>
Date:   Fri Jan 23 13:09:33 2026 -0500

    [ignore] Pydantic ND Config Collection: Final proposition of core design changing existing methods and adding new ones which will be used in NDNetworkResourceModule class as well as basic error handling and simple docstrings.

commit c4a4da2
Author: Gaspard Micol <gmicol@cisco.com>
Date:   Fri Jan 23 00:56:49 2026 -0500

    [ignore] Pydantic ND base models and local_user models: Final proposition of core design adding new methods which will be used in NDConfigCollection and NDNetworkResourceModule classes as well as basic error handling and simple docstrings.

commit fe944d0
Author: Gaspard Micol <gmicol@cisco.com>
Date:   Thu Jan 22 01:04:05 2026 -0500

    [ignore] Pydantic Models: Modify and Clean both local_user.py and base.py based on comments. Add a get method and get_identifier_value function to NDBaseModel.

commit 7089148
Author: Gaspard Micol <gmicol@cisco.com>
Date:   Tue Jan 20 13:17:35 2026 -0500

    [ignore] Second Pydantic Implementation: Create a NDBaseModel to be inherited from future class models. Modify class models for local_user.

commit a04235c
Author: Gaspard Micol <gmicol@cisco.com>
Date:   Thu Jan 15 11:47:32 2026 -0500

    [ignore] First Pydantic implementation: Add Pydantic Models for nd_local_user.

commit 2a27f38
Author: Gaspard Micol <gmicol@cisco.com>
Date:   Tue Aug 19 12:44:17 2025 -0400

    [minor_change] Add nd_local_user as a new network resource module for Nexus Dashboard v4.1.0 and higher.
and corresponding integration test refinements.
@sivakasi-cisco
Copy link
Copy Markdown
Owner Author

changes continued in CiscoDevNet#197

sivakasi-cisco added a commit that referenced this pull request Mar 25, 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.

1 participant