GNS3 Lab: Network Automation Get Interfaces

Network automation uses programmable logic to manage network resources and services. Network automation allows network operations (NetOps) teams to configure, scale, protect, and integrate network infrastructure and application services more quickly than when performed manually by users. With everyday network tasks and functions automated and repetitive processes controlled and managed automatically, network service availability improves.

Automating network resource and service management allows network operations teams to become more agile and flexible and effectively support modern business demands.

Network automation can work with command line automation and automation software.

More information on network automation can be found on Red Hat Website

For this Lab Netmiko and Paramiko, to access our devices(S1 and S2) in the network.

Paramiko is more of a generic SSH module that you can use to automate specific SSH tasks. In contrast, Netmiko is broader and well-optimized for managing network devices such as switches and routers.

image

Configure the Switches

For S1 and S2 configure an interface vlan1 with IPs for this lab it was 192.168.161.72->S1 and 192.168.161.73->S2 

Set username <tajode> password <cisco> for the switches.

Set ssh to IP version 2 which is going to be used by Paramiko to access the switches.

These commands needs to be ran on both switches:

 

crypto key generate rsa (enter and type 1024)
ip ssh version 2
no aaa new-model
line vty 0 15
transport input ssh
login local

After setting up S1 and S2 ensure you can SSH into the devices by using a terminal. (for this lab a Linux Debian OS has been used )

 

 

After setting up S1 and S2 ensure you can SSH into the devices by using a terminal. (for this lab a Linux Debian OS has been used )

 

 

image
image

Install netmiko and paramiko python modules

Create a virtual terminal to run the Python scripts

  • netmiko1s1.py
  • netmiko2s2.py

After taking the above steps you can run the scripts using python or python3:

python netmiko1s1.py

For this lab, it is a simple automation script that shows the brief status of the switches interfaces on the terminal and stores the information on the test log file.

This is a summary of the documentation of the Lab on Network Automation using a Python Script to see the Interfaces that are UP or DOWN in a switch.

Leave a Comment