cisco-en-programmability/dnacentersdk

sync_devices doesnt give proper guidance

Closed this issue · 4 comments

Prerequisites

  • [yes ] Have you tested the operation in the API directly?
  • [ yes] Do you have the latest SDK version?
  • [ yes] Review the compatibility matrix before opening an issue.

Describe the bug
When using the sync_devices function in the dnacentersdk module to update the management IP address of a device, the updateMgmtIPaddressList parameter does not work with a list of dictionaries. However, when making a raw JSON API call with the same data, it works without issues.

This code works with a raw JSON API call:
"updateMgmtIPaddressList": [{
"existMgmtIpAddress": "{{ old_ip }}",
"newMgmtIpAddress": "{{ new_ip }}"
}]
However, this code does not work with the sync_devices function:
updateMgmtIPaddressList = [{"existMgmtIpAddress": old_ip, "newMgmtIpAddress": new_ip}]
The DNAC API documentation specifies that updateMgmtIPaddressList should be a list of objects. What should the object for the new IP address be? Can we just copy the existing DNAC object for the device and replace the IP address with the new one? If that is the case, can the update_dnac_mgmt_ip function be modified to match the format expected by the DNAC API and the documentation?

dnacentersdk==2.5.6

@youngblackkid Your recommendation "Can we just copy the existing DNAC object for the device and replace the IP address with the new one?" could be considered for the Cisco DNA Center roadmap, maybe for a future version of the API. Changing the existing API according with your recommendation would break backward compatibility. It could be implemented in the SDK only, but that could be challenging as most developers would attempt to follow the Cisco DNA Center API docs. The implementation of the Python SDK API call would also be different with our Terraform provider and maybe Ansible modules.

Ok but what are the object that should go into the updateMgmtIPaddressList varibale?

Hi @youngblackkid ,
Could you pass me the bodies or screenshots you used for both api and sync_devices call, and their respective responses.
I performed tests, it worked fine, so to see what could be wrong with it.
Also the lab version of DNAC you are using

Hi @youngblackkid If we do not receive a response, the issue will be closed in the next 24 hours.