Skip to main content

Code style: black codecov published

dnac-sidekick

DNAC Sidekick is a CLI app used to interact with Cisco DNA Center (DNAC). It's built using the Click and Rich libraries. The Rich library is what helps make the output look cleaner to the end-user.

The goal of the tool is to provide a clean and user-friendly CLI interface to quickly pull information from DNA Center. All interactions with DNAC uses DNA Center's REST API, so please make sure that the REST API is enabled and the user account(s) used with this tool have proper API permissions.

Installation

Install using pip or any other PyPi package manager:

pip install dnac-sidekick

Getting Started

Authenticating to DNAC

DNAC-Sidekick pulls all user-specific information from environmnet variables. Ideally, this would be a more automated process with less manual work for the user, but for now, the following environment variables must be set manually before using the tool:

export DNAC_URL=<https://dnac_url>
export DNAC_USER=<username>
export DNAC_PASS=<password>

Once set, we will need to generate a bearer token, which is used to authenticate to the DNAC REST API. You can manually generate this token using curl or Postman, but there's also a built-in command that will generate one for you. This will only work if the URL, username, and password environment variables are set.

dnac-sidekick login 

Token generated successfully!
Copy token below and set as environment variable for future requests:
eyJhbGciOiJS.....

IMPORTANT: Please make sure to generate the bearer token using the dnac-sidekick login command AFTER setting the necessary environment variables. Once the token is generated, don't forget to set it as an environment variable as well.

export DNAC_TOKEN=<token>

Usage

To see what commands are available, use the --help option. Here's a brief look at the current root commands available:

Options:
  --help  Show this message and exit.

Commands:
  command-runner  Run 'show' commands on network devices in DNAC.
  generate        Action to generate testbeds and inventory files.
  get             Action for read-only tasks and gathering information.
  login           Use username and password to authenticate to DNAC.

Feature Highlights

The goal is to provide features that help extract the most useful information from DNAC for the user. The tool is not built to have a command for every available DNAC API call - it's simply meant to be an engineer's sidekick 😁 when interacting with Cisco DNA Center. This feature list will grow, but here are the current tasks that can be performed using DNAC Sidekick:

Inventory

  • Device information (all devices or a specific device via hostname)
    • Hostname
    • Device type
    • Serial number
    • Software version
  • Device license information
    • Network license level
    • DNA license level
    • License validity (valid or expired)
    • Virtual account
    • Device UDI

Assurance

  • Device health
  • Client health
    • All
    • Wired
    • Wireless

Command Runner

  • Run valid show commands on any device in DNAC inventory
    • Valid show commands are dictated by DNAC

Generate

  • Ability to generate a pyATS testbed file from DNAC inventory
  • Ability to generate an Ansible inventory file from DNAC inventory

Examples:

Inventory

# All devices
dnac-sidekick get inventory devices

# Specific device
dnac-sidekick get inventory devices --hostname leaf1.abc.inc

# License info
dnac-sidekick get licenses

Assurance

# Device health
dnac-sidekick get health devices

# Client health
dnac-sidekick get health clients

Command Runner

dnac-sidekick command-runner --device leaf1.abc.inc --command "show run"

Generate

# pyATS testbed
dnac-sidekick generate pyats-testbed

# Ansible inventory
dnac-sidekick generate ansible-inventory
Sample Outputs

All sample outputs use the Cisco DevNet Always-on DNAC sandbox.

Network Inventory

Network Inventory

Network Inventory - Specific Device

Inventory - Specific Device

Device Licensing

Device Licensing

Device Health

Device Health

Client Health

Client Health


Compatibility

Tested with:

  • DNA Center 2.2.3.4
  • DNA Center 2.2.3.6
  • DNA Center 2.3.4.0

If you are able to test with other versions, please open a PR and add it to the list!

Credits

This section is dedicated to those that have helped test and make this tool better!

Metadata

Release files for dnac-sidekick 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dnac-sidekick 0.1.3
File Size Uploaded Provenance Actions
dnac-sidekick-0.1.3.tar.gz 16.1 kB Without provenance Details for dnac-sidekick-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dnac-sidekick 0.1.3
File Interpreter ABI Platform Actions
dnac_sidekick-0.1.3-py3-none-any.whl Python 3 none any Details for dnac_sidekick-0.1.3-py3-none-any.whl

Total release size: 34.5 kB

Release files / dnac-sidekick-0.1.3.tar.gz

Download URL dnac-sidekick-0.1.3.tar.gz
Size 16.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c8f9f2a3623dc64bdb6158933212b779860be8489ea056a0ff9fd14e312051a7
BLAKE2b-256 checksum
How to use checksums
d44139a4d6096fedc2409a76b44af8dfc3bb9b229edd50e3bcde0e9c36cc0ac2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0 CPython/3.9.13 Darwin/21.6.0

Release files / dnac_sidekick-0.1.3-py3-none-any.whl

Download URL dnac_sidekick-0.1.3-py3-none-any.whl
Size 18.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e027b0284a496f443a5efb81bf55b6f4b5b346e38a486215f45f1b77d2d6baaf
BLAKE2b-256 checksum
How to use checksums
4b305d9c9a1d5db307284c5da878d8065d329186d68e97be4b80cdb5511bc9b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0 CPython/3.9.13 Darwin/21.6.0

Security for dnac-sidekick 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page