Giter Club home page Giter Club logo

dnac-assurance's Introduction

Assurance API Test Script

This script shows how to use the Cisco DNA Center assurance API's.

DNA Center 1.2.5 is required as it has the platform API, which include Assurance.

Installing

If you are running python2 you will need the requests library. If you are running and old version of the SSL library you will need to update that.

pip install -r requirements.txt

Running the script

The script uses the dnac_config.py file to specify the DNA Center, username and password. These can also be set using environment variables too. Run the following commands in the shell (changing the appropriate values)

export DNAC="1.1.1.1"
export DNAC_USER="admin"
export DNAC_PASSWORD="password"
export DNAC_PORT=443

Once the credentials are set, the script can be run without arguments. This will assume the current time as a timestamp and access the following API

  • site-health - shows the health score for the sites
  • device-health - shows the health score for network devices
  • client-health - shows the health score for clients (user devices)

The --raw option is used to get raw json output and the --timestamp argument returns health score at a specific time (historical). This timestamp is in milliseconds. Some examples include

./assurance.py
./assurance.py --raw
./assurnace.py --timestamp <epoc>

The following options return client-detail and device-detail information. Again they can be called with --raw and --timestamp

#  these can also be run with --raw and --timestamp
./assurance.py --mac 00:26:08:E0:F4:97
./assurance.py --hostName 3504_WLC

Example

$ ./assurance.py
https://adam-dnac:443/dna/intent/api/v1/site-health?timestamp=
Site Health
SiteName            SiteType  Issues  RouterHealth  AccessHealth  
 All Sites          area      None    100           80            
NSD-5               building  None    None          None          
 All Buildings      building  None    100           80            
DMZ                 building  None    100           None          
san jose            building  None    None          None          
MEL1                building  None    None          None          
Melbourne           area      None    None          None          
Melbourne Campus1   area      None    None          None          
STL-3               building  None    100           100           
Sydney              area      None    100           100           


https://adam-dnac:443/dna/intent/api/v1/client-health?timestamp=1539408888000
Client health @ 2018-10-13 16:27:00 <-> 2018-10-13 16:32:00 (1539408420000-1539408720000)
ALL 12
WIRED 9
 POOR (1) rootCause:AAA(1)
 FAIR (0) 
 GOOD (8) 
 IDLE (0) 
 NEW (0) 
WIRELESS 3
 POOR (1) rootCause:OTHER(1)
 FAIR (0) 
 GOOD (2) 
 IDLE (0) 
 NEW (0) 


https://adam-dnac:443/dna/intent/api/v1/network-health?timestamp=
Network Health: 89% at 2018-10-13 16:26:00

 Devices Monitored 17, unMonitored 2
Category   Score     Good%     KPI
 Access    60        60        MEMORY:POOR  
 Router    100       100       
 Wireless  86        85.7  
 WLC       100       100       
 AP        83        83.3 


The client detail shows a view of the topology for the client. Client is connected to "SDA-Guest" ssid, then to a 3802 AP then a 3504 WLC.

$ ./assurance.py --mac B8:27:EB:70:9F:83
https://adam-dnac:443/dna/intent/api/v1/client-detail?timestamp=&macAddress=B8:27:EB:70:9F:83
Client Detail for:00:F6:63:34:6A:C0 at 2018-10-14 12:11:29 (1539479489498)
HostType: WIRELESS connected to 3804_sda

10.11.200.23(None)[Linux-Workstation] - Health:1 ->
SSID: SDA-Guest(2.4 GHZ) ->
3804_sda:10.11.250.14:AIR-AP3802E-Z-K9(8.5.131.0) - Health:10 ->
3504:10.10.10.147:AIR-CT3504-K9(8.5.131.0) - Health:10

Enrichment

this is only enabled if the serviceNow integration bundle is selected. The ./enrichment.py file can be used to exercise these API.

There are 4 types of enrichment

  • user: get details of the user
  • client: similar to user, but also includes issues associated with the userid/mac
  • issue: Takes an issue_id or mac_address and finds matching issues
  • device: takes an ip_address or mac_address

Some examples:

./enrichment.py --mac_address 00:26:08:E0:F4:97 --etype user
./enrichment.py --network_user_id brad --etype client
./enrichment.py --mac_address 00:26:08:E0:F4:97 --etype issue
./enrichment.py --ip_address 10.10.6.2 --etype device

dnac-assurance's People

Contributors

aradford123 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.