This repository contains examples of how to get started with automating Cisco
DNA Center REST APIs in Cisco pyATS | Genie test framework.
To run this demo, you should follow the pyATS | Genie installation guide,
and have it installed in your Python virtual environment. Eg:
bash$ pip install pyats genie
Genie CLI is a powerful linux-based command-line utility offering Genie Python
functionality directly from a linux terminal. It requires no previous knowledge
of Python or network programming, making it a great way to start getting
acquainted with Genie.
This demo focuses on being able to take a snapshots of Cisco DNA Center's REST
API outputs, save to file, and use it later for comparison/difference analysis.
# snapshot rest apis related to: interface, isis and ospf # and save to folder called "initial" bash$ genie dnac interface isis ospf --testbed-file dna.yaml --output initial --via dnac:rest --device dnac# now - if something changed, regardless of whether it was done intentionally # or not, you can take another snapshot, and compare it against your know-good states
# take the 2nd snapshot, save it into folder "modified" bash$ genie dnac interface isis ospf --testbed-file dna.yaml --output modified --via dnac:rest --device dnac
# do a diff between the two state snapshots bash$ genie diff initial modified # any differences will be displayed to screen
The next example uses the power of Genie triggers & verification concept,
building on reusable testcases. Here's our test plan:
The code necessary to run this example is included in this repository.
bash$ pyats run job dnac_job.py --testbed-file dna.yaml --html-logs .
The generated HTML log files will be available in this folder.
Copyright (c) 2019 Cisco Systems, Inc. and/or its affiliates
Genie CLI is a powerful linux-based command-line utility offering Genie Python functionality directly from a linux terminal. It requires no previous knowledge of Python or network programming, making it a great way to start getting acquainted with Genie.
This demo focuses on being able to take a snapshots of Cisco DNA Center's REST API outputs, save to file, and use it later for comparison/difference analysis.
Use Cases:
# snapshot rest apis related to: interface, isis and ospf# and save to folder called "initial"bash$ genie dnac interface isis ospf --testbed-file dna.yaml --output initial --via dnac:rest --device dnac# now - if something changed, regardless of whether it was done intentionally# or not, you can take another snapshot, and compare it against your know-good states# take the 2nd snapshot, save it into folder "modified"bash$ genie dnac interface isis ospf --testbed-file dna.yaml --output modified --via dnac:rest --device dnac# do a diff between the two state snapshotsbash$ genie diff initial modified# any differences will be displayed to screen
This example focuses on building re-usable test cases with Genie, focusing on testing your Cisco DNA Center managed topology as a whole, with the ability to trigger changes on both Cisco DNA Center, and on your southbound managed devices, seeing the topology states converge, and validating whether the expected new state is reached.
The code necessary to run this example is included in this repository.
bash$ pyats run job dnac_job.py --testbed-file dna.yaml --html-logs .
The generated HTML log files will be available in this folder.
Owner
Contributors
Categories
Products
Catalyst CenterpyATSProgramming Languages
HTMLLicense
Code Exchange Community
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community