Skip to content

Some sda endpoints does not work #71

@fatman00

Description

@fatman00

Prerequisites

  • yes have tested with the API directly /dna/intent/api/v1/business/sda/fabric-site
  • version: dnacentersdk==2.5.4

When trying to get the sda fabric count and creating a new fabric site the SDK fails with an HTTP error 400

Cannot test the fabric count from the DNAC GUI as it is not on the list, but have tested the POST:fabric-site endpoint and I am able to create a fabric site using it on the DNAC GUI.
API endpoint: /dna/intent/api/v1/business/sda/fabric-site
request body:
{
"fabricName": "Default LAN Fabric",
"siteNameHierarchy": "Global/EMEA/Denmark/Aarhus/Tangen9, 8200"
}

Screenshots
image

Environment (please complete the following information):
2..2.3.6
Python 3.8.2
dnacentersdk==2.5.4
Windows 10

Additional context

from pprint import pprint


from dnacentersdk import api


# Create a DNACenterAPI connection object;
# it uses DNA Center sandbox URL, username and password, with DNA Center API version 2.2.3.3.
# and requests to verify the server's TLS certificate with verify=True.
dnac = api.DNACenterAPI(username="admin",
                        password="MySecret",
                        base_url="https://172.26.1.11:443",
                        version='2.2.3.3',
                        verify=False)

devices = dnac.devices.get_device_list()
print("Printing the hostname of all devices on the DNAC:")
for device in devices.response:
    print(device.hostname)

payload = {
    "fabricName": "Default LAN Fabric",
    "siteNameHierarchy": "Global/EMEA/Denmark/Aarhus/Tangen9, 8200"
}
task = dnac.sda.add_site(payload=payload)
print(task)

Error code:

python step02.py
Printing the hostname of all devices on the DNAC:
DK-SJ2-TEST.dna.das-i.dk
EXPO-FIAB.lab.sdalab.dk
Traceback (most recent call last):
  File "step02.py", line 25, in <module>
    task = dnac.sda.add_site(payload=payload)
  File "C:\Users\rael\Documents\Coding\DNAC-sdk\.venv\lib\site-packages\dnacentersdk\api\v2_2_3_3\sda.py", line 1456, in add_site
    json_data = self._session.post(endpoint_full_url, params=_params,
  File "C:\Users\rael\Documents\Coding\DNAC-sdk\.venv\lib\site-packages\dnacentersdk\restsession.py", line 619, in post
    response = self.request('POST', url, erc, 0, params=params,
  File "C:\Users\rael\Documents\Coding\DNAC-sdk\.venv\lib\site-packages\dnacentersdk\restsession.py", line 471, in request
    check_response_code(response, erc)
  File "C:\Users\rael\Documents\Coding\DNAC-sdk\.venv\lib\site-packages\dnacentersdk\utils.py", line 209, in check_response_code
    raise ApiError(response)
dnacentersdk.exceptions.ApiError: [400] Bad Request - The request was invalid or cannot be otherwise served.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions