Get complete Device list inventory with location details from DNAC.
Project description
dnac_device_list
dnac_device_list is a Python library that makes your life easier when you want to programatically find out the location name and location id of any given device that is managed by Cisco DNA Center.
Installation
Use the package manager pip to install dnac_device_list.
pip install dnac_device_list
Use Case 1 (Use existing token for authorization)
from dnac_device_list import device_list
token = "eyJhbRciOiJSUzI1NiIsInR5cGI6IkpXVCJ9.eyJzdWIiOiI2MTE2YmI0YWU3YjUwODZiNTLjMTI5ZjQiLCJhdXRoU291cmNlIjoiaW50ZXJuYWwiLCJ0ZW5hbnROYW1lIjoiVE5UMCIsInJvbGVzIjpbIjYxMTZiYjQ4ZTliNTA4NmI1M2MxMjlmMyJdLCJ0ZW5hbnRJZCI6IjYxMTZiYjQ4ZTliNTA4NmI1M2MxMjlmMSIsImV4cCI6MTY4ODQwMzMxMSwiaWF0IjoxNjg4Mzk5NzExLCJqdGkiOiJhNzliMjgwMC04NjdkLTRiZmQtYWJmMy02NjJiOGUzNmY4OTgiLCJ1c2VybmFtZSI6ImFkbWluIn0.hqvLkQL-07Oiwjy_RzEj5b556nlDiNpIZw-78xmEUu9FLIBuE0bWvoLgmK-2AIdAsB2bbPZ61uDmrE4YK__IINDNl6zeK6NfBGSDCzpJ9VvT_ywnLdqSpGfBArcnGcr2Wwa1DRSmGBn5uF7o0SBcE-K2--KneGsIKjZblCAPD4G1F8QwmL_FgNv6cVI-FMdhLxtYuM2pCYpE23oBmHaSIm-0xyPc71vlQiAYbZ1vnQVx64zdVNA5SPvyAvOZUY5YTixhOU0qw3rcABSk0GbVO8jZlE-QJLuC6hhh5LwM6yDnWPekWS7KPqdhXGTAEzPhxNvnAmZlXrY0nrJFJBpkkg"
# initializes class
dnac = device_list.Dnac(base_url="https://dnac.example.com", token=token, verify=False)
# returns 'list of devices'
devices = dnac.get_device_list_with_location()
Use Case 2 (Use username and password for authorization)
from dnac_device_list import device_list
# initializes class
dnac = device_list.Dnac(base_url="https://dnac.example.com", username="admin", password="Cisco123", verify=False)
# returns 'list of devices'
devices = dnac.get_device_list_with_location()
Response json (devices variable)
{
"response": [
{
"reachabilityFailureReason": "string",
"reachabilityStatus": "string",
"series": "string",
"snmpContact": "string",
"snmpLocation": "string",
"tagCount": "string",
"tunnelUdpPort": {},
"uptimeSeconds": "integer",
"waasDeviceMode": {},
"serialNumber": "string",
"lastUpdateTime": "integer",
"macAddress": "string",
"upTime": "string",
"deviceSupportLevel": "string",
"hostname": "string",
"type": "string",
"memorySize": "string",
"family": "string",
"errorCode": "string",
"softwareType": "string",
"softwareVersion": "string",
"description": "string",
"roleSource": "string",
"location": "string",
"role": "string",
"collectionInterval": "string",
"inventoryStatusDetail": "string",
"apEthernetMacAddress": {},
"apManagerInterfaceIp": "string",
"associatedWlcIp": "string",
"bootDateTime": "string",
"collectionStatus": "string",
"errorDescription": "string",
"interfaceCount": "string",
"lastUpdated": "string",
"lineCardCount": "string",
"lineCardId": "string",
"locationName": "string",
"managedAtleastOnce": "boolean",
"managementIpAddress": "string",
"platformId": "string",
"managementState": "string",
"instanceTenantId": "string",
"instanceUuid": "string",
"id": "string"
}]
}
Contributing
Pull requests are welcome. For major changes, please reach out to author via email first. to discuss what you would like to change. https://github.com/alekos3/DNAC_Device_Location
License
Authors
Alexios Nersessian email: nersessian@gmail.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dnac_device_list-1.2.tar.gz
.
File metadata
- Download URL: dnac_device_list-1.2.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1d41a64b35da3a757900e384f432d7be0c79c91248a8fee225e6ec13056be75 |
|
MD5 | 0960709e7d3c2aa878bef23a95079668 |
|
BLAKE2b-256 | 751a2ec71202c4547d1e09d7fea9337a30ed2f10e632bf447df551538be083e3 |
File details
Details for the file dnac_device_list-1.2-py3-none-any.whl
.
File metadata
- Download URL: dnac_device_list-1.2-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1310c52c1ca95d3bfd6fc4ed805ae647d4c3caff218c9a7c43cbab86808b661b |
|
MD5 | ca49c2e98b52d7b762e5e7f532ddf3c0 |
|
BLAKE2b-256 | 0bdd4ac3755c6f3e85b97d38e1b859756aad77a2f1e58eebd077640fa02d86a5 |