-
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
Adding DNAC log levels for Discovery and PnP #119
Conversation
plugins/modules/discovery_intent.py
Outdated
@@ -721,7 +736,7 @@ def get_discovery_device_info(self, discovery_id=None, task_id=None): | |||
) | |||
devices = response.response | |||
|
|||
self.log(devices) | |||
self.log("Devices Information retrieved from the get discovered network devices by discovery id API is {0}".format(str(devices)), "DEBUG") |
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.
self.log("Retrieved device details using the API 'get_discovered_network_devices_by_discovery_id': {0}".format(str(devices)), "DEBUG")
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.
Resolved
plugins/modules/discovery_intent.py
Outdated
self.module.fail_json(msg=msg) | ||
|
||
self.log('Discovery network device with id {0} has not completed'.format(discovery_id), "INFO") |
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.
if not result, we set the msg with same message (line num: 751) and if the result is true then also we see the same message. Can you please check it?
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.
Thanks for pointing it. Resolved
plugins/modules/discovery_intent.py
Outdated
@@ -777,8 +794,9 @@ def delete_exist_discovery(self, params): | |||
params=params, | |||
) | |||
|
|||
self.log(response) | |||
self.log("Response collected from delete discovery by id API is {0}".format(str(response)), "DEBUG") |
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.
self.log("Response collected from API 'delete_discovery_by_id': {0}".format(str(response)), "DEBUG")
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.
Resolved
plugins/modules/pnp_intent.py
Outdated
self.module.fail_json(msg="Site not found", response=[]) | ||
|
||
if response: | ||
self.log(str(response)) | ||
self.log("Site details of {0} received are {1}".format(self.want.get("site_name"), str(response)), "DEBUG") |
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.
self.log("Received site details for '{0}': {1}".format(self.want.get("site_name"), str(response)), "DEBUG")
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.
Resolved
plugins/modules/pnp_intent.py
Outdated
site = response.get("response") | ||
if len(site) == 1: | ||
site_id = site[0].get("id") | ||
site_exists = True | ||
self.log("Site Id is {0} and site name is {1}".format(site_id, self.want.get("site_name")), "INFO") |
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 say
self.log("Site Name: {1}, Site ID: {0}".format(site_id, self.want.get("site_name")), "INFO")
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.
Resolved
plugins/modules/pnp_intent.py
Outdated
@@ -865,7 +908,7 @@ class instance for further use. | |||
"payload": update_payload}, | |||
op_modifies=True, | |||
) | |||
self.log(str(update_response)) | |||
self.log("Update in the device's config API response is {0}".format(str(update_response)), "DEBUG") |
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.
self.log("Response from 'update_device' API for device's config update: {0}".format(str(update_response)), "DEBUG")
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.
Resolved
plugins/modules/pnp_intent.py
Outdated
@@ -875,8 +918,9 @@ class instance for further use. | |||
params={"payload": reset_paramters}, | |||
op_modifies=True, | |||
) | |||
self.log(str(reset_response)) | |||
self.log("Errored state resolution response from the API is {0}".format(str(reset_response)), "DEBUG") |
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.
self.log("Response from 'update_device' API for errored state resolution: {0}".format(str(reset_response)), "DEBUG")
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.
Resolved
plugins/modules/pnp_intent.py
Outdated
if update_response.get("deviceInfo"): | ||
self.result['changed'] = True | ||
return self | ||
|
||
claim_params = self.get_claim_params() | ||
self.log(str(claim_params)) | ||
self.log("Paramters for claiming the device are {0}".format(str(claim_params)), "DEBUG") |
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.
self.log("Parameters for claiming the device: {0}".format(str(claim_params)), "DEBUG")
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.
Resolved
plugins/modules/pnp_intent.py
Outdated
@@ -934,7 +980,7 @@ def get_diff_deleted(self): | |||
function='get_device_list', | |||
params={"serial_number": device["deviceInfo"]["serialNumber"]} | |||
) | |||
|
|||
self.log("Device details for the serial number {0} are {1}".format(device["deviceInfo"]["serialNumber"], str(multi_device_response)), "DEBUG") |
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.
self.log("Response from 'claim_a_device_to_a_site' API for claiming: {0}".format(str(claim_response)), "DEBUG")
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.
Resolved
plugins/modules/pnp_intent.py
Outdated
@@ -945,22 +991,26 @@ def get_diff_deleted(self): | |||
params={"id": device_id}, | |||
) | |||
|
|||
self.log(str(response)) | |||
self.log("Device details for the device deleted with \ |
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.
self.log("Device details for the deleted device with serial number '{0}': {1}".format(device["deviceInfo"]["serialNumber"], str(response)), "DEBUG")
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.
Resolved
Problem Description: Logging based on various levels (CRITICAL, ERROR, WARNING, INFO, DEBUG)
Fix: We have added dnac_log_levels
Test cases: Have tested for default (WARNING and DEBUG)
Results: 1. WARNING gives logs for WARNINGS, CRITICAL AND ERROR
2. DEBUG logs all the messages including CRITICAL, ERROR, WARNING and INFO as well.