SDK implementation for API Add Edge Device to Sda fabric on DNAC Version 2.3.3.0 inconsistent with previous DNAC versions implementation
ragadegithub opened this issue · 3 comments
Prerequisites
- [* ] Have you tested the operation in the API directly?
- [ *] Do you have the latest SDK version?
- [ *] Review the compatibility matrix before opening an issue.
Describe the bug
To add edge device to sda, the api implementation in 2.3.3.0 is missing input vars ( which is inconsistent with previous implementations).
Must include input vars 'deviceManagementIpAddress' and 'siteNameHierarchy'
in 2.2.3.3 method def --->
def add_edge_device(self,
deviceManagementIpAddress=None,
siteNameHierarchy=None,
headers=None,
payload=None,
active_validation=True,
**request_parameters):
in 2.3.3.0 method def -->
def add_edge_device(self,
headers=None,
payload=None,
active_validation=True,
**request_parameters):
Also 'payload' type set to 'list'. must be 'dict' which matches with expected API 'body' documentation as well as 2.2.3.3 implemenation of the same method
Expected behavior
- dnac_api.sda. add_edge_device() must provide option for input vars 'deviceManagementIpAddress' and 'siteNameHierarchy' ( consitent with 2.2.3.3 release implementation
- input var 'payload' type set to 'list'. must be 'dict' which matches with expected API 'body' documentation of DNAC API. as well as 2.2.3.3 implemenation of the same method
Screenshots
[Please provide an screenshot of the successful API call with cuRL, Postman, etc.]
links to both implementations from the docs.
https://dnacentersdk.readthedocs.io/en/latest/_modules/dnacentersdk/api/v2_3_3_0/sda.html#Sda.add_edge_device
https://dnacentersdk.readthedocs.io/en/latest/_modules/dnacentersdk/api/v2_2_3_3/sda.html#Sda.add_edge_device
Environment (please complete the following information):
- Cisco DNA Center Version and patch: 2.3.3.5
- Python version: 3.9
- SDK version: 2.5.6
- OS Version: Windows 11
Additional context
Add any other context about the problem here.
Code where the bug is identified:
device_payload = {
"deviceManagementIpAddress": mgmt_ip,
"siteNameHierarchy": site_name
}
**above device_payload causes an error. Debug shown below
edge_status = None
try:
add_edge_status = api_.sda.add_edge_device(payload=device_payload) #### --> had to change to this for 2.3.3.0 release from below method
#add_edge_status = api_.sda.add_edge_device(deviceManagementIpAddress=mgmt_ip,siteNameHierarchy = site_name) ### ---> this one can be used in 2.2.3.3 release
logger.info(add_edge_status)
pprint(add_edge_status)
**dnacentersdk output:
2023-04-22 15:06:10,999::main::-dnac_edge_disvoery::-: add_edge_device - ERROR :: - We were expecting to receive an instance of one of the following types: 'list'or 'None'; but instead we received {'deviceManagementIpAddress': '172.20.1.162', 'siteNameHierarchy': 'Global/United States/JFK'} which is a 'dict'.
2023-04-22 15:06:10,999::main::-dnac_edge_disvoery::-: add_edge_device - ERROR :: - Edge device not added to fabric : {'deviceManagementIpAddress': '172.20.1.162', 'siteNameHierarchy': 'Global/United States/JFK'}
@ragadegithub in v2.6.3
parameters were included, try it again and let us know if it works for you.
Thank you @fmunozmiranda. I pulled the latest 2.6.3 code, I do see that the change exists in code as expected.
Will post updates once i can run it on a DNAC 2.3.3.x.
Had a successful script execution with DNAC 2.3.3.x and dnacentersdk = 2.6.3
Below code works as expceted
add_edge_status = api_.sda.add_edge_device(
deviceManagementIpAddress=mgmt_ip, siteNameHierarchy=site_name
)
Below code works as expected:
device_payload = {
"deviceManagementIpAddress": mgmt_ip,
"siteNameHierarchy": site_name,
}
add_edge_status = api_.sda.add_edge_device(payload=device_payload)