Cisco DNA Center Device List, Device Config, and Network Health
This program is designed to export a Cisco DNAC device list and save them to an Excel sheet, device configurations and save them to text file, and network health and generate a bar chart.
Table of Contents
- Installation
- Getting Started
- Usage
- Collected Data from Device List Response
- Use it for your DNA Center
- References
- Previews
Installation
$ git clone https://github.com/Tes3awy/Cisco-DNA-Center-Device-List.git
$ cd Cisco-DNA-Center-Device-List
$ pip install -r requirements.txt --user
Getting Started
│ main.py
│ get_auth_token.py
│ get_device_list.py
│ get_device_config.py
│ get_network_health.py
│ export_device_list.py
│ export_device_config.py
│ export_network_health.py
│ notify.py
│ .env.example
│ requirements.txt
│ README.md
│ CONTRIBUTING.md
│ CODE_OF_CONDUCT.md
│ .pre-commit-config.yaml
│ .gitignore
│ LICENSE
│
├───.github
│ └───ISSUE_TEMPLATE
│ bug_report.md
│ feature_request.md
│
└───assets
preview.png
sandboxdnac2.cisco.com.jpg
script-logs.png
Usage
You need to provide your Cisco DNA Center credentials in a .env
file. Create a .env
file from .env.example
and DON'T delete the latter (Check Use it for your DNA Center section).
A .env
file in the current working directory will override the .env.example
values.
Then run:
Voila ✨! An Excel file is created automatically from the device list on Cisco DNAC in the current working directory, configuration files of those devices are created in configs/<DOMAIN>/<today>/<config_id>_<today>.txt
, and a network health diagram (a bar chart with a legend) is created in net_health/<BASE_URL>-<today>.jpg
.
Unlike handling text files, XlsxWriter
library does not have the option of appending new data to an existing Excel file. So every time you run the script, the Excel file will be overwritten.
NOTE: You have to close the Excel program before re-running the script.
For Windows Users ONLY
You will be notified with a native toast notification upon script successful completion.
Collected Data from Device List Response
- Hostname
- Device ID
- Management IP Address
- Serial Number
- Mac Address
- Platform ID (Device Model)
- Software Version
- Role
- Up Time
- Last Update
- Reachability Status
Use it for your DNA Center
This program is ready to be used for your deployed Cisco DNA Center.
Create a .env
file from .env.example
:
Repalce the .env
file values with your Cisco DNA Center credentials.
Example:
.env
DOMAIN=10.10.1.1 # without a trailing slash (/)
PORT=443
BASE_URL=https://${DOMAIN}:${PORT}
USERNAME=root
PASSWORD=C1sco12345
SSL_CERTIFICATE=False # set to True ONLY if you have a valid SSL certificate
References
API Endpoints
DNA Center Platform
Documentation
Cisco DNA Assurance User Guide
Previews
Script Logs
Excel File Preview
A demonstration for color formatting