02-11-2020 01:10 PM
I am attempting to utilize certain DNAC APIs to accomplish automating the process of adding an edge node to the fabric.
Steps I would like to automate via python are identified below:
Add device to inventory (Add Device)
Assign to site (Assign Device To Site)
*Update ISE NAD location & group (utilizing ISE APIs)
Join to fabric (Add edge device in SDA Fabric)
Update interfaces for user device & closed auth (Add Port assignment for user device in SDA Fabric)
I am currently working through phase 1 (adding device). Thus far I am able to obtain a token to use for later calls. However, when issuing the requests.post with what I think is the proper headers and json data I get this error from DNAC:
{"response":{"errorCode":"Bad Request","message":"Invalid parameters specified for required operation","detail":"The parameter is not in valid format. It should be letters only."},"version":"1.0"}
Has anyone had success with automating this/these type of processes and/or similar ones? A concern I have is ensuring there is proper delay as I move throughout different phases. Please see attached for a scrubbed version of what I am currently working with. Any suggestions? I am new with utilizing DNAC APIs, but have experience with ISE. The DNAC platform documentation is not helping at the moment. Thanks in advance.
Solved! Go to Solution.
02-12-2020 03:43 AM - edited 02-12-2020 03:44 AM
Hi Mike,
I can see in your request:
"snmpMode" : "Authentication and Privacy"
I run quick test and change it to:
"snmpMode" : "RW"
and I can see this request has been successfully accepted.
Still, to have the task to complete successfully you need:
1) change cliTransport from SSH2 to ssh:
"cliTransport" : "ssh"
2) Change computeDevice from True to False (as device cannot be network device and compute device at the same time):
"computeDevice" : False
3) Increase length of SNMP passphrase to >=8 characters:
"snmpAuthPassphrase" : "passpass"
"snmpPrivPassphrase" : "passpass"
At the end, my request content that allow my new device to be added to DNA-Center looks as followinng:
"type" : "NETWORK_DEVICE",
"computeDevice" : False,
"snmpVersion" : "V3",
"snmpUserName" : "user",
"snmpMode" : "RW",
"snmpAuthProtocol" : "SHA",
"snmpAuthPassphrase" : "passpass",
"snmpPrivProtocol" : "AES128",
"snmpPrivPassphrase" : "passpass",
"snmpRetry" : "3",
"snmpTimeout" : "5",
"cliTransport" : "ssh",
"userName" : "user",
"password" : "pass",
"enablePassword" : "pass",
}
Hope it helps,
Mariusz
02-11-2020 02:17 PM
You may want to post code snippet of post request so people can help taking a look what went wrong.
Thanks
02-12-2020 06:47 AM
Hi Yawming,
Mike attached it in the original post (just search for an attachment called: add_device_scrub.docx - used source code is there :)).
Regards, Mariusz
02-11-2020 05:30 PM
Hey Mike,
I have not personally done this yet however I would be interested in working with you to accomplish these tasks. Feel free to shoot me an email at danirowe@cisco.com and we can schedule a WebEx to discuss and work on your phases.
02-12-2020 03:43 AM - edited 02-12-2020 03:44 AM
Hi Mike,
I can see in your request:
"snmpMode" : "Authentication and Privacy"
I run quick test and change it to:
"snmpMode" : "RW"
and I can see this request has been successfully accepted.
Still, to have the task to complete successfully you need:
1) change cliTransport from SSH2 to ssh:
"cliTransport" : "ssh"
2) Change computeDevice from True to False (as device cannot be network device and compute device at the same time):
"computeDevice" : False
3) Increase length of SNMP passphrase to >=8 characters:
"snmpAuthPassphrase" : "passpass"
"snmpPrivPassphrase" : "passpass"
At the end, my request content that allow my new device to be added to DNA-Center looks as followinng:
"type" : "NETWORK_DEVICE",
"computeDevice" : False,
"snmpVersion" : "V3",
"snmpUserName" : "user",
"snmpMode" : "RW",
"snmpAuthProtocol" : "SHA",
"snmpAuthPassphrase" : "passpass",
"snmpPrivProtocol" : "AES128",
"snmpPrivPassphrase" : "passpass",
"snmpRetry" : "3",
"snmpTimeout" : "5",
"cliTransport" : "ssh",
"userName" : "user",
"password" : "pass",
"enablePassword" : "pass",
}
Hope it helps,
Mariusz
02-13-2020 04:17 AM
Hi,
As discussed separately, please find attached Postman collection to further automate DNA-Center functionality which I presented as part of Cisco Live:
DEVNET-2087: Intent APIs in Cisco DNA Center
DEVNET-2412: Accelerate Cisco DNA SD-Access deployments through Business API orchestration
Best regards,
Mariusz
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide