Ansible ND 4.X | WIP | ND Manage Switches Module + Pydantic Models + Smart Endpoints#198
Ansible ND 4.X | WIP | ND Manage Switches Module + Pydantic Models + Smart Endpoints#198AKDRG wants to merge 5 commits intoCiscoDevNet:nd42_integrationfrom
Conversation
…ible-nd into switch_int_pr
| ticket_id: Optional[str] = Field(default=None, min_length=1, description="Change control ticket ID") | ||
|
|
||
|
|
||
| class _V1ManageCredentialsSwitchesBase(BaseModel): |
There was a problem hiding this comment.
I see V1 prepended to the class name, where in Gaspard PR and the clusterhealth classes this is not the case should those be removed?
| class _V1ManageCredentialsSwitchesBase(BaseModel): | |
| class _ManageCredentialsSwitchesBase(BaseModel): |
This is a generic comment that would apply to all the classes you have defined.
There was a problem hiding this comment.
same comment applies to other endpoints
| ticket_id: Optional[str] = Field(default=None, min_length=1, description="Change control ticket ID") | ||
|
|
||
|
|
||
| class _V1ManageCredentialsSwitchesBase(BaseModel): |
There was a problem hiding this comment.
should this be NDEndpointBaseModel?
| class _V1ManageCredentialsSwitchesBase(BaseModel): | |
| class _V1ManageCredentialsSwitchesBase(NDEndpointBaseModel): |
There was a problem hiding this comment.
same comment applies to other endpoints
| ``` | ||
| """ | ||
|
|
||
| ticket_id: Optional[str] = Field(default=None, min_length=1, description="Change control ticket ID") |
There was a problem hiding this comment.
Is there a reason to not have a Mixin class for ticket_id?
There was a problem hiding this comment.
same comment applies to other endpoints
| api_version: Literal["v1"] = Field(default="v1", description="ND API version for this endpoint") | ||
| min_controller_version: str = Field(default="3.0.0", description="Minimum ND version supporting this endpoint") |
There was a problem hiding this comment.
This should be defined in NDEndpointBaseModel, so I think it could be removed when NDEndpointBaseModel is used.
| class_name: Literal["V1ManageCredentialsSwitchesPost"] = Field( | ||
| default="V1ManageCredentialsSwitchesPost", description="Class name for backward compatibility" | ||
| ) |
There was a problem hiding this comment.
should this be frozen=true?
| class_name: Literal["V1ManageCredentialsSwitchesPost"] = Field( | |
| default="V1ManageCredentialsSwitchesPost", description="Class name for backward compatibility" | |
| ) | |
| class_name: Literal["V1ManageCredentialsSwitchesPost"] = Field( | |
| default="V1ManageCredentialsSwitchesPost", frozen=True, description="Class name for backward compatibility" | |
| ) |
| ) | ||
|
|
||
| # Common config for basic validation | ||
| COMMON_CONFIG = ConfigDict(validate_assignment=True) |
There was a problem hiding this comment.
why is this constant defined here and only used one time in _V1ManageFabricBootstrapBase?
|
|
||
| - max: Maximum number of results to return (optional) | ||
| - offset: Pagination offset (optional) | ||
| - filter: Lucene filter expression (optional) |
There was a problem hiding this comment.
Why do some of the endpoint params include filter? What is this used for?
This PR introduces the initial implementation of ND Manage switch lifecycle support in the cisco.nd collection.
It adds a new switch management resource layer, endpoint wrappers, Pydantic model hierarchy, utility helpers.
What’s Included
Added a full resource engine in plugins/module_utils/nd_switch_resources.py
Implements state handling for:
Adds structured operation sequencing:
Added endpoint models under plugins/module_utils/endpoints/v1/nd_manage_switches:
Added shared model base and nested infrastructure:
Added model consolidation in:
plugins/module_utils/models/nd_manage_switches/summary_models.py
Added helpers in plugins/module_utils/utils/nd_manage_switches:
These utilities centralize grouping, payload shaping, wait/retry logic, and fabric operations.