-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolved the previous PR comments and have added single addition in P… #48
Conversation
plugins/modules/pnp_intent.py
Outdated
template_name = self.want.get("template_name") | ||
if template_name: | ||
if template_list and isinstance(template_list, list): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can remove this new line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is changed
plugins/modules/pnp_intent.py
Outdated
(site_exists, site_id) = self.site_exists() | ||
if not isinstance(self.want.get("site_name"), str) and \ | ||
not self.want.get('pnp_params').get('deviceInfo').get('add_device_method'): | ||
self.module.fail_json(msg="Name of the site must be a string", response=[]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we set the self (status, msg) and return self from here. Check the get_have().check_return_status in main. Can we followup in all the cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
plugins/modules/pnp_intent.py
Outdated
self.module.fail_json(msg="Project Not Found or Project is Empty", response=[]) | ||
|
||
else: | ||
self.module.fail_json(msg="Project Not Found \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set and return instead of failing Json. this should be taken care in check_return_status..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
plugins/modules/pnp_intent.py
Outdated
else: | ||
self.module.fail_json(msg="Site not found", response=[]) | ||
if not self.want.get('pnp_params').get('deviceInfo').get('add_device_method'): | ||
self.module.fail_json(msg="Site not found", response=[]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set and return instead of failing Json. this should be taken care in check_return_status..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
plugins/modules/pnp_intent.py
Outdated
self.want["vlanId"] = config.get('vlanId') | ||
self.want["ipInterfaceName"] = config.get('ipInterfaceName') | ||
if self.want["pnp_type"] != "Default": | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New line not required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
plugins/modules/pnp_intent.py
Outdated
self.module.fail_json(msg="Device needs to be added before claiming", response=[]) | ||
else: | ||
if not self.want["site_name"]: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new line not required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
plugins/modules/pnp_intent.py
Outdated
self.result['diff'] = self.validated_config | ||
self.result['changed'] = True | ||
else: | ||
self.module.fail_json(msg="Device Addition Failed", response=[]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set and return instead of failing Json. this should be taken care in check_return_status.... We can check the failure condition and return from there itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
plugins/modules/pnp_intent.py
Outdated
self.result['diff'] = self.validated_config | ||
self.result['changed'] = True | ||
else: | ||
self.module.fail_json(msg="Device Claim Failed", response=[]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set and return instead of failing Json. this should be taken care in check_return_status..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Initialize an instance of class . | ||
|
||
Parameters: | ||
module (ModuleType): The Python module associated with this instance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can leave 2 spaces then start with -
Parameters:
- module (ModuleType): The Python module associated with this instance.
Attributes:
- module (ModuleType): The provided module.
- test_data (dict): The loaded playbook data from the module.
- playbook_config (dict): The playbook configuration.
- playbook_config_missing_param (dict): The playbook configuration with missing parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Mocks the initialization and execution of the Cisco DNA Center SDK to isolate testing from actual SDK operations. | ||
|
||
Mocked attributes: | ||
- mock_dnac_init: Mocks the initialization of the DNACSDK class. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same style as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
New changes are added |
latest changes 04/15/2024
Problem description: Adding single device in PnP
Fix: Single addition is possible with add_device_method in the playbook
Design consideration: Device is not added
Testing Information: Tested with multiple scenarios and have also added idempotency