cisco-en-programmability / dnacentersdk

Cisco DNA Center Python SDK
https://dnacentersdk.readthedocs.io/en/latest/
MIT License
70 stars 33 forks source link

Error in the network settings SDK payload leads to infinite loop #166

Open MUTHU-RAKESH-27 opened 1 month ago

MUTHU-RAKESH-27 commented 1 month ago

Prerequisites

Describe the bug For both the SDKs create_global_pool and and the update_global_pool, if we pass a wrong payload, the SDK is not returning anything and getting stuck in a infinite loop.

The sample payload (with error) - {'dhcpServerIps': ['204.192.3.40'], 'dnsServerIps': ['171.70.168.183'], 'ipPoolName': 'IP4-POOL1', 'ipPoolCidr': '12.0.1.0/24', 'gateway': '12.0.1.2/24', 'type': 'Generic', 'IpAddressSpace': 'IPv4'} Here the gateway should be "12.0.1.2" not "12.0.1.2/24".

In the second screen shot the last executed line was 2198 which was the last log statement after that it gets stuck in the SDK call.

While executing the API we could see that the create_global_pool and the update_global_pool api is returning a payload with an execution ID. So it is working as expected in the API but not in the SDK.

Expected behavior The SDK should not get stuck in an infinite loop and should return the message like the API.

Screenshots

Screenshot 2024-08-12 at 11 35 04 AM Screenshot 2024-08-12 at 11 34 39 AM

Environment (please complete the following information):

bvargasre commented 4 weeks ago

Hi @MUTHU-RAKESH-27 I tried to replicate the error mentioned, but unfortunately I did not get the same result. I used the same payload that you passed, and it worked for me in both create and update

Here is the code I used for the test

try:
    payload = {
        'dhcpServerIps': ['204.192.3.40'],
        'dnsServerIps': ['171.70.168.183'],
        'ipPoolName': 'IP4-POOL1',
        'ipPoolCidr': '12.0.1.0/24',
        'gateway': '12.0.1.2/24',
        'type': 'Generic',
        'IpAddressSpace': 'IPv4'
    }
    response = dnac.network_settings.create_global_pool(payload=payload)
    response = dnac.task.get_business_api_execution_details(execution_id=response.executionId)
    print("response", response)
except Exception as e:
    print("Error: ", e)

I attach the output of both operations: logs.txt

You can activate debug and send me the output, to review the API calls