cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2038
Views
15
Helpful
5
Replies

Add EN via Python

Mike.Cifelli
VIP Alumni
VIP Alumni

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.

1 Accepted Solution

Accepted Solutions

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

View solution in original post

5 Replies 5

yawming
Cisco Employee
Cisco Employee

You may want to post code snippet of post request so people can help taking a look what went wrong.

 

Thanks

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

Dan Rowe
Cisco Employee
Cisco Employee

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.

 

 

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

Mariusz Kazmierski
Cisco Employee
Cisco Employee

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

 

Review Cisco Networking for a $25 gift card