Closed nextnoob closed 2 years ago
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.
Hey @fmunozmiranda ,
unfortunately the validation does not work yet.
Error Message:
Reason: data[0].externalConnectivitySettings[0].l3Handoff[0].virtualNetwork must be object
Detail:
PS E:\Users\username\ios-xe-nc-trial> python3 .\add_border_node.py
Traceback (most recent call last):
File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\dnacentersdk\models\validators\v2_3_3_0\jsd_b6f2d8e46cdd5f05bb06f52cd1b26fb2.py", line 142, in validate
self._validator(request)
File "<string>", line 124, in validate
fastjsonschema.exceptions.JsonSchemaValueException: data[0].externalConnectivitySettings[0].l3Handoff[0].virtualNetwork must be object
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Users\username\ios-xe-nc-trial\add_border_node.py", line 78, 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 355, in adds_border_device
File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\dnacentersdk\models\validators\v2_3_3_0\jsd_b6f2d8e46cdd5f05bb06f52cd1b26fb2.py", line 144, in validate
raise MalformedRequest(
dnacentersdk.exceptions.MalformedRequest: [{'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': 'True', 'externalConnectivitySettings': [{'interfaceName': 'GigabitEthernet1/0/24', 'interfaceDescription': 'Automated Value', 'externalAutonomouSystemNumber': '65100', 'l3Handoff': [{'virtualNetwork': [{'virtualNetworkName': 'INFRA_VN', 'vlanId': '3200'}]}, {'virtualNetwork': [{'virtualNetworkName': 'BECHTLAB', 'vlanId': '3201'}]}]}]}] is invalid. Reason: data[0].externalConnectivitySettings[0].l3Handoff[0].virtualNetwork must be object
@nextnoob, I see may be something wrong with the object creation. Malformed request details this structure:
"l3Handoff": [
{
"virtualNetwork": [
{
"virtualNetworkName": "INFRA_VN",
"vlanId": "3200"
}
]
},
{
"virtualNetwork": [
{
"virtualNetworkName": "BECHTLAB",
"vlanId": "3201"
}
]
}
]
A valid request, should be like this:
"l3Handoff": [
{
"virtualNetwork":
{
"virtualNetworkName": "INFRA_VN",
"vlanId": "3200"
}
},
{
"virtualNetwork":
{
"virtualNetworkName": "BECHTLAB",
"vlanId": "3201"
}
}
]
Oh, my mistake. I still had the "old" syntax from the DNAC API documentation.
Thank you for the fix.
Prerequisites
Yes →
Example Payload:
Describe the bug
Class: classSda Function: adds_border_device(headers=None, payload=None, active_validation=True, **request_parameters)
The scheme under Developer DNAC Docs wants arrays for the key virtualNetworkand as values. Unfortunately, in reality arrays are not accepted by the DNA Center here.
Payload:
Error message:
Expected behavior The API should accept arrays according to the schema, but it does not.
Screenshots
![image](https://user-images.githubusercontent.com/22887888/183749108-93723800-9926-4569-9a8b-3f258f6bf620.png)
Environment (please complete the following information):
Additional context
Thanks for maintaining the very good SDK :blush: