Skip to content

Add a new network resource module nd_local_user for local users on Nexus Dashboard v4.1.0 or higher (DCNE-543)#172

Open
gmicol wants to merge 28 commits intoCiscoDevNet:masterfrom
gmicol:add_network_ressource_nd_local_user
Open

Add a new network resource module nd_local_user for local users on Nexus Dashboard v4.1.0 or higher (DCNE-543)#172
gmicol wants to merge 28 commits intoCiscoDevNet:masterfrom
gmicol:add_network_ressource_nd_local_user

Conversation

@gmicol
Copy link
Collaborator

@gmicol gmicol commented Sep 3, 2025

No description provided.

@gmicol gmicol self-assigned this Sep 3, 2025
@gmicol gmicol added the jira-sync Sync this issue to Jira label Sep 3, 2025
@gmicol gmicol requested a review from shrsr as a code owner September 3, 2025 17:53
@github-actions github-actions bot changed the title Add a new network resource module nd_local_user for local users on Nexus Dashboard v4.1.0 or higher Add a new network resource module nd_local_user for local users on Nexus Dashboard v4.1.0 or higher (DCNE-543) Sep 3, 2025
@gmicol gmicol force-pushed the add_network_ressource_nd_local_user branch from a4b3de7 to 6a9aefd Compare September 3, 2025 17:55
@gmicol gmicol force-pushed the add_network_ressource_nd_local_user branch 3 times, most recently from e38fee8 to df74fbf Compare September 5, 2025 19:48
@gmicol gmicol force-pushed the add_network_ressource_nd_local_user branch from df74fbf to fe89c61 Compare September 22, 2025 17:45
Copy link
Collaborator

@anvitha-jain anvitha-jain left a comment

Choose a reason for hiding this comment

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

Add comments to exaplain how the class works (or what is happening within the class)

@gmicol gmicol force-pushed the add_network_ressource_nd_local_user branch 6 times, most recently from 4d04726 to 7c967c3 Compare December 18, 2025 14:17
sivakasi-cisco added a commit to sivakasi-cisco/ansible-nd that referenced this pull request Feb 17, 2026
- 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 added a commit to sivakasi-cisco/ansible-nd that referenced this pull request Feb 17, 2026
- 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>
…e.py based on comments. Add a get method and get_identifier_value function to NDBaseModel.
…tion of core design adding new methods which will be used in NDConfigCollection and NDNetworkResourceModule classes as well as basic error handling and simple docstrings.
…ign changing existing methods and adding new ones which will be used in NDNetworkResourceModule class as well as basic error handling and simple docstrings.
…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.
…s for orchestrating crud api operations with model instances and endpoints.
… built-in functionalities. Slightly modify models/base.py to enforce identifiers definitions in NDBaseModel subclasses. Added multiple notes to assert next steps.
…rt endpoints and Pydantic models modification (works for merge and replace states). Add comments for next steps.
…nts and changes to models/local_user.py and api_endpoints/base.py
…ons methods that work for single_identifier strategy (meant to be overridden if needed).
@gmicol gmicol force-pushed the add_network_ressource_nd_local_user branch from 389f4c2 to b41b5b8 Compare February 26, 2026 15:48
@gmicol gmicol requested a review from akinross March 5, 2026 00:38
gmicol added 2 commits March 6, 2026 13:35
…NDStateMachineand add custom Exception for it in common/exceptions dir. Set json mode for to_diff_dict method in NDBaseModel.
@gmicol gmicol force-pushed the add_network_ressource_nd_local_user branch from 36d5759 to cd8a631 Compare March 10, 2026 18:07
@@ -0,0 +1,179 @@
# -*- coding: utf-8 -*-

Copy link
Collaborator

Choose a reason for hiding this comment

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

endpoints dir structure to be refactored per Tuesday (3/10) standup

from ansible_collections.cisco.nd.plugins.module_utils.models.local_user import LocalUserModel
from ansible_collections.cisco.nd.plugins.module_utils.endpoints.base import NDBaseEndpoint
from ansible_collections.cisco.nd.plugins.module_utils.orchestrators.types import ResponseType
from ansible_collections.cisco.nd.plugins.module_utils.endpoints.v1.infra_aaa_local_users import (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given we're doing the directory structures based on API version and resource categorization, I think we need to do that here for orchestrator.

@@ -73,53 +72,27 @@ def cmp(a, b):


def issubset(subset, superset):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the intention to import from module_utils/utils.py?

self.state = self.module.params["state"]

# Initialize collections
self.nd_config_collection = NDConfigCollection[self.model_class]
Copy link
Collaborator

Choose a reason for hiding this comment

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

NDConfigCollection[self.model_class] returns a _GenericAlias at runtime, not a class. It happens to be callable (delegating to NDConfigCollection). I find this not to be obvious to readers/reviewers and is a subtle detail of generics that just works and don't see it provide any execution value since subsequent instantiations still require model_class to be passed explicitly. Is there a reason for line 44 that I'm missing vs just removing and using NDConfigCollection directly.

try:
response_data = self.model_orchestrator.query_all()
# State of configuration objects in ND before change execution
self.before = self.nd_config_collection.from_api_response(response_data=response_data, model_class=self.model_class)
Copy link
Collaborator

Choose a reason for hiding this comment

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

self.before = NDConfigCollection.from_api_response(response_data=response_data, model_class=self.model_class) to go with previous comment.

@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-

# Copyright: (c) 2025, Gaspard Micol (@gmicol) <gmicol@cisco.com>
Copy link
Collaborator

Choose a reason for hiding this comment

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

2026

@@ -0,0 +1,69 @@
# -*- coding: utf-8 -*-

# Copyright: (c) 2025, Gaspard Micol (@gmicol) <gmicol@cisco.com>
Copy link
Collaborator

Choose a reason for hiding this comment

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

2026

@@ -0,0 +1,179 @@
# -*- coding: utf-8 -*-

# Copyright: (c) 2025, Gaspard Micol (@gmicol) <gmicol@cisco.com>
Copy link
Collaborator

Choose a reason for hiding this comment

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

2026

@@ -0,0 +1,83 @@
# -*- coding: utf-8 -*-

# Copyright: (c) 2025, Gaspard Micol (@gmicol) <gmicol@cisco.com>
Copy link
Collaborator

Choose a reason for hiding this comment

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

2026

#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2025, Gaspard Micol (@gmicol) <gmicol@cisco.com>
Copy link
Collaborator

Choose a reason for hiding this comment

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

2026

gmicol added 2 commits March 11, 2026 11:48
…nd local_user.py. Add method to NDBaseModel and apply relevant changes to nd_config_collection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira-sync Sync this issue to Jira

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants