cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1384
Views
0
Helpful
0
Comments
cherifi.m85
Level 1
Level 1

In Feb 2021 (One year ago), I have contributed to Cisco DevNet Code Exchange Community with a project called Genie_Webex which promoted in April as Use Case in Automation Exchange. It was great for me after being par of a great Cisco DevNet Class of 2020.

This project combines two Cisco solution : Webex Teams and Genie/pyATS. The goal is to check the state of the routers if there is any change in the desired configuration. Cisco Webex Teams is used to receive alerts for the result: Configuration change or not. Genie/pyATS is used to test and compare the configuration with its functions and APIs.

For the simulation and testing purposes, I have used GNS3 with WSL. All the dependencies installed in a virtual environment. You can find the packages in requirements.txt file in the GitHub repo. Alternatively, you can use DevNet CML sandbox, here the link https://devnetsandbox.cisco.com/RM/Topology.  I will drop at the end of this blog the link to the GitHub repo for details how to install the dependencies.

 

How to use the project

Here the topology used for the testing phase :

Topology.png

 

First, You must create the Golden_Config folder before running multi_golden_config.py script in order to save the golden configuration in the desired configuration state of the devices. If you use the golden configuration files provided for each router used in this project (Refer to Golden_Config folder), you need to create RSA Keys to enable SSH. The credentials used could be found in connex.yml file. You must create the Golden_Config folder before running multi_golden_config.py script in order to save the golden configuration in the desired configuration state of the devices. If you use the golden configuration files provided for each router used in this project (Refer to Golden_Config folder), you need to create RSA Keys to enable SSH. The credentials used could be found in connex.yml file.

In multi_config_stat.py, I used Disk0 to store the startup-config (golden configuration in desired state), you must change it according to your device configuration. To save it, use the command : copy running-config disk0:startup-config in each device. The following figure shows the content of Disk0 for R1 router:

 

startup-config_R1.png

 

Please update the access_token and room_id in multi_config_stat.py according to your setting in Webex Teams.

Before running the test, please ensure that you run the multi_golden_config.py script in order to ensure the golden configuration (Desired configuration) in the folder Golden_Config for comparison purposes.

 

python3 multi_golden_config.py

 

golden_config_tree.png

 

The configuration is saved as string dictionary as indicated in the following figure.

golden_config_R3.png

 

 

Test and Results

 

Here the flowchart of the project scenario :

Flowchart.png

 

Scenario in case no change

 

Here we run the script multi_config_stat.py

python3 multi_config_stat.py

Here the result in Genie_Webex space

 

No_change.png

Scenario in case of change

 

In this case a loopback interface is configured in R2 as follows :

 

lo0_R2.png

 

Then we run the script multi_config_stat.py again:

python3 multi_config_stat.py

Here the result sended to Webex Teams space:

 

After_change.png

 

Here the content of the file change_R2.txt

change_R2.txt.png

 

The golden configuration restoring process is applied (by exploiting the command configure replace disk0:startup-config force) as indicated in the following figure:

startup-config_restoring_R2.png

 

I hope you have enjoyed this blog and you found it relevant. Comments and suggestions are welcome. Here the linkst o the project:

GitHubhttps://github.com/cherifimehdi/Genie_Webex

DevNet Code Exchangehttps://developer.cisco.com/codeexchange/github/repo/cherifimehdi/Genie_Webex

DevNet Automation Exchangehttps://developer.cisco.com/network-automation/detail/7d247071-83eb-11eb-81c2-1e23f581908f/

 

About me

PhD in Electronics and an active Cisco CCAI Instructor and Network Engineering Trainer. Part of Cisco DevNet Class 2020. Cisco DevNet Code Exchange and Automation Exchange Contributor. I am interesting in all about NetDevOps, Networking programmability and automation. I am a Cisco contents fan.

 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: