Add a new network resource module nd_local_user for local users on Nexus Dashboard v4.1.0 or higher (DCNE-543)#172
Conversation
a4b3de7 to
6a9aefd
Compare
e38fee8 to
df74fbf
Compare
df74fbf to
fe89c61
Compare
anvitha-jain
left a comment
There was a problem hiding this comment.
Add comments to exaplain how the class works (or what is happening within the class)
4d04726 to
7c967c3
Compare
- 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>
- 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.
…anges added to NDNetworkResourceModule.
…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).
389f4c2 to
b41b5b8
Compare
…or NDNestedModel. Add types.file. Various Renaming and small Modifications across the repo. WIP.
…i_endpoints. Adapt api_endpoints, models, orchestrators accordingly. Integration Tests passing for nd_local_user module. Still WIP.
…ome sanity issues.
…teration of (Mock Pydantic objects/methods) to pass sanity checks for Pydantic importation.
…NDStateMachineand add custom Exception for it in common/exceptions dir. Set json mode for to_diff_dict method in NDBaseModel.
36d5759 to
cd8a631
Compare
| @@ -0,0 +1,179 @@ | |||
| # -*- coding: utf-8 -*- | |||
|
|
|||
There was a problem hiding this comment.
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 ( |
There was a problem hiding this comment.
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): | |||
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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> | |||
| @@ -0,0 +1,69 @@ | |||
| # -*- coding: utf-8 -*- | |||
|
|
|||
| # Copyright: (c) 2025, Gaspard Micol (@gmicol) <gmicol@cisco.com> | |||
| @@ -0,0 +1,179 @@ | |||
| # -*- coding: utf-8 -*- | |||
|
|
|||
| # Copyright: (c) 2025, Gaspard Micol (@gmicol) <gmicol@cisco.com> | |||
| @@ -0,0 +1,83 @@ | |||
| # -*- coding: utf-8 -*- | |||
|
|
|||
| # Copyright: (c) 2025, Gaspard Micol (@gmicol) <gmicol@cisco.com> | |||
| #!/usr/bin/python | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| # Copyright: (c) 2025, Gaspard Micol (@gmicol) <gmicol@cisco.com> |
…nd local_user.py. Add method to NDBaseModel and apply relevant changes to nd_config_collection.
No description provided.