Skip to content
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

Sda.adds_border_device boolean not accepted for connectedToInternet and borderWithExternalConnectivity #65

Closed
2 tasks done
nextnoob opened this issue Aug 9, 2022 · 3 comments
Labels
api-improvement DNA Center API should include this as improvement. bug Something isn't working in-progress Team is working to solve issue.

Comments

@nextnoob
Copy link

nextnoob commented Aug 9, 2022

Prerequisites

  • Have you tested the operation in the API directly?

Yes →

Example Payload:

[
    {
        "deviceManagementIpAddress": "172.22.4.2",
        "siteNameHierarchy": "Global/SH-2",
        "deviceRole": [
            "Border_Node", 
            "Control_Plane_Node",
            "Edge_Node"
        ],
        "externalDomainRoutingProtocolName": "BGP",
        "externalConnectivityIpPoolName": "L3-Handoff",
        "internalAutonomouSystemNumber": "65101",
        "borderPriority": "10",
        "borderSessionType": "ANYWHERE",
        "connectedToInternet": "True",
        "borderWithExternalConnectivity": "False",
    }
]
  • Do you have the latest SDK version?
pip show dnacentersdk
Name: dnacentersdk
Version: 2.5.2
Summary: Cisco DNA Center Platform SDK
Home-page: https://dnacentersdk.readthedocs.io/en/latest/
Author: Jose Bogarin Solano
Author-email: [email protected]
License: MIT
Location: c:\users\username\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages
Requires: fastjsonschema, future, requests, requests-toolbelt
Required-by: 

Describe the bug

Class: classSda
Function: adds_border_device(headers=None, payload=None, active_validation=True, **request_parameters)

First issue:
The scheme under Developer DNAC Docs wants booleans for the keys borderWithExternalConnectivity and connectedToInternet as values. Unfortunately, in reality only strings are accepted by the DNA Center here.

Payload:

[
    {
        "deviceManagementIpAddress": "172.22.4.2",
        "siteNameHierarchy": "Global/SH-2",
        "deviceRole": [
            "Border_Node", 
            "Control_Plane_Node",
            "Edge_Node"
        ],
        "externalDomainRoutingProtocolName": "BGP",
        "externalConnectivityIpPoolName": "L3-Handoff",
        "internalAutonomouSystemNumber": "65101",
        "borderPriority": "10",
        "borderSessionType": "ANYWHERE",
        "connectedToInternet": True,
        "borderWithExternalConnectivity": False,
    }
]

Error message:

PS E:\Users\username\ios-xe-nc-trial> python3 .\add_border_node.py
Traceback (most recent call last):
  File "E:\Users\username\ios-xe-nc-trial\add_border_node.py", line 70, in <module>
    dnac.sda.adds_border_device(payload = payload)
  File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\dnacentersdk\api\v2_3_3_0\sda.py", line 370, in adds_border_device
    json_data = self._session.post(endpoint_full_url, params=_params,
  File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\dnacentersdk\restsession.py", line 619, in post
    response = self.request('POST', url, erc, 0, params=params,
  File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\dnacentersdk\restsession.py", line 471, in request  
    check_response_code(response, erc)
  File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\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.

When I adjust the validator, the API call works.

"borderWithExternalConnectivity": {
"type": "string"
},
"connectedToInternet": {
"type": "string"
},

Also following values are accepted with adjusted validators:

"connectedToInternet": true,
"borderWithExternalConnectivity": false,

Expected behavior
The API should accept Boolean according to the schema, but it does not.

Screenshots
image
image

Environment (please complete the following information):

  • Cisco DNA Center Version and patch: Version 2.3.3.4
  • Python version: Python 3.10.6
  • SDK version: 2.5.2
  • OS Version: Python:3 Windows 10, 21H2

Additional context

Thanks for maintaining the very good SDK 😊

@nextnoob nextnoob changed the title Sda_adds_border_device virtualNetwork bolean not accepted for connectedToInternet and borderWithExternalConnectivity Sda_adds_border_device boolean not accepted for connectedToInternet and borderWithExternalConnectivity Aug 9, 2022
@nextnoob nextnoob changed the title Sda_adds_border_device boolean not accepted for connectedToInternet and borderWithExternalConnectivity Sda.adds_border_device boolean not accepted for connectedToInternet and borderWithExternalConnectivity Aug 9, 2022
@fmunozmiranda fmunozmiranda added bug Something isn't working in-progress Team is working to solve issue. labels Aug 9, 2022
fmunozmiranda pushed a commit that referenced this issue Aug 9, 2022
@fmunozmiranda fmunozmiranda added the api-improvement DNA Center API should include this as improvement. label Aug 9, 2022
@fmunozmiranda
Copy link
Collaborator

Hey @nextnoob , there´s a new version of dnacentersdk (2.5.3) with solved problem, try it and let us know if it works for you.

@nextnoob
Copy link
Author

nextnoob commented Aug 9, 2022

Hey @fmunozmiranda ,

the implementation worked, thank you very much!

What about the DNAC API docs? Will this be adapted or can it be that in newer DNAC versions only Boolean will be accepted again?

@fmunozmiranda
Copy link
Collaborator

We are going to report it, however that does not fall on us, we only provide support to the sdk. If there´s anything else, please close issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-improvement DNA Center API should include this as improvement. bug Something isn't working in-progress Team is working to solve issue.
Projects
None yet
Development

No branches or pull requests

2 participants