• Stars
    star
    179
  • Rank 214,039 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Collection of scripts and examples of Python code, libraries, and utilities for working with Network Devices.

Useful Python Libraries for Network Engineers

Collection of scripts and examples of Python code, libraries, and utilities for working with Network Devices.

The code in this repository is used in a demonstrations, talks, and labs as part of Cisco DevNet and specifically NetDevOps Live!.

Hands On Lab

Included in this repo is a short hands on lab guide that walks through many of the libraries discussed and used through the examples. You can view the lab guide here.

Setting Up to Run Examples

Clone and Prep the Environment

  1. Clone the code repo

    git clone https://github.com/hpreston/python_networking
    cd python_networking
  2. Setup Python Virtual Environment.

    # MacOS or Linux
    python3.6 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
    • Note: If on Linux, you will need to install the Python3.6 development files. On CentOS this is done with yum install -y python36u-devel
    # Windows - recommendation to use git-bash terminal
    py -3 -m venv venv
    source venv/Scripts/activate
    pip install -r requirements-win.txt
    • Note: Creation and activation of a venv in Windows is slightly different. Also Ansible and pyATS aren't currently supported on Windows so the requirements-win.txt doesn't contain those libraries.

Infrastructure Resources

The example scripts for data_manipulation require nothing other than the files in this repository and the Python libraries installed with pip install above.

The example scripts for device_apis & network_testing leverage DevNet Always On Sandboxes that are publicly available, with no VPN connection needed. The details for these infrastructure are included in the scripts.

There is also a Vagrantfile included in the repo that can be used to spin up a local IOS XE device to use for the API examples. You'll need to have Vagrant and a box already available. You can find details on obtaining and using Vagrant boxes for Cisco devices at github.com/hpreston/vagrant_net_prog. If you do do this, the following line would need to be changed in the code examples.

from device_info import ios_xe1 as device -> from device_info import vagrant_iosxe as device

Infrastructure for Configuration Management Demonstrations

The configuration management scripts in this repository are written to target a sample network topology built as Core > Dist > Access with IOS XE devices in the Core, and NX-OS devices for Dist and Access. The demo network can be run with Cisco VIRL or CML, and the topology.virl file in the repo has the details. If you do not have your own VIRL server, you can reserve a free DevNet Multi-IOS VIRL Sandbox to use.

  1. After connecting to the Sandbox with VPN, start the development network. This single line command will start the simulation, wait to completely start, and then lay down an initial configuration with Ansible.

    virl up --provision \
      && virl generate ansible -o setup/default_inventory.yaml \
      && cd setup \
      && ansible-playbook network_deploy.yaml \
      && cd ../

More Repositories

1

netdevops_demos

Resources and details for a variety of NetDevOps Demos.
Python
109
star
2

vagrant_net_prog

Sample Vagrant Files and things for Network Programmability Development
Ruby
69
star
3

rpi-networklab

The Raspberry Pi is an inexpensive computer that makes a great addition to everyone's network lab. In fact, you might want to pickup a few of them for your lab. This repository includes some documents I've put together with some ideas on how and where a RPi can be used in a network lab, as well as some quick guides to help you get started quickly. This repository is a work in progress, and some of the guides may not be complete yet.
56
star
4

webexteamsbot

Python package for creating Webex Teams chat bots.
Python
47
star
5

nxos-netbox-sync

Demonstration of how to keep your NX-OS switch configuration aligned with a Netbox Source of Truth
Python
39
star
6

cisco_cloud

Sample Python Libraryโ€™s and Scripts for working with Ciscoโ€™s Cloud Software Packages. Including: UCS Director Intercloud Fabric Director Prime Service Catalog VACS
Python
26
star
7

intro-network-tests

Demos, examples, content for the talk "Introduction to Writing Network Tests with pyATS"
Python
24
star
8

genie-config-diff

Easily track configuration changes with Cisco Genie
Python
24
star
9

nso-getting-started

Resources to help engineers get started with Cisco NSO.
Makefile
23
star
10

network_info_scripts

Collection of Sample Scripts to Gather Network Information
Python
16
star
11

twtv_netdevops_webinar

Code, setup and info for the TechWise TV Webinar on February 14, 2018
Shell
15
star
12

myhero_demo

This is provided as a very simple application that can be used to demonstrate Cisco Mantl.
Shell
15
star
13

workshops

Code used in DEVNET Workshops at Cisco Live Events
Python
14
star
14

summer2021-devasc-prep-network-inventory-01

This repository provides code and examples as part of a DevNet Associate Certification Preparation Webinar.
Python
13
star
15

nso-netbox

This will be an NSO package for interacting with NetBox as a source of truth.
Python
11
star
16

demo_mac_to_interface_tool

This is an example script that leverages pyATS to lookup the switch interfaces where MAC Addresses are located.
Python
10
star
17

lab_chucknorris_spark

Code and Lab for Chuck Norris Spark Bot Lab
Python
9
star
18

devbox

Standard Development Workstation Setup Resources
Ruby
9
star
19

netdevops-lab-as-code

Sample scripts and examples for deploying network devices and other lab elements.
PowerShell
8
star
20

summer2021-devasc-prep-interface-config

This repository provides code and examples as part of a DevNet Associate Certification Preparation Webinar.
Python
8
star
21

summer2021-devasc-prep-network-inventory-02

This repository provides code and examples as part of a DevNet Associate Certification Preparation Webinar.
Python
8
star
22

python-logging-example

Simple example on using Python logging
Python
7
star
23

netconf_yang_blog

Simple NETCONF/YANG example for how to get started using NETCONF/YANG for network configuration.
Python
7
star
24

summer2021-devasc-prep-troubleshooting-assistant

This repository provides code and examples as part of a DevNet Associate Certification Preparation Webinar.
Python
6
star
25

minecraftpython

Python
4
star
26

cicd_learning_lab

HTML
4
star
27

webinar_restconf

Code and Samples for the Cisco Learning Network Webinar on RESTCONF
4
star
28

drone-spark

Drone plugin for sending notifications with Cisco Spark.
Python
4
star
29

nso-zabbix

Sample scripts/templates used to monitor NSO from Zabbix
Python
3
star
30

eem_python_examples

Random assortment of EEM + Python Examples
Python
2
star
31

mod_general_development

Basic Development Tools and Skills
HTML
2
star
32

DEVNET-2585-Guide

This is the lab guide for CLUS 2017 DEVNET-2585
Python
2
star
33

gitlab-teams

GitLab Event Listener for Cisco Webex Teams
Python
2
star
34

techwisedemo_network_ansible

Playbooks and information used on TechWise TV Demo
2
star
35

myhero_ui

Front End UI for the MyHero Demo Application
HTML
1
star
36

myhero_objsetup

Shell
1
star
37

exploring_network_logging

Resources for exploring network logging.
1
star
38

mantl-info

1
star
39

cicd_demoapp

Sample "app" for some testing and playing around.
Shell
1
star
40

myhero_mvp

A demonstration application for SuperHero Voting
Python
1
star
41

ansible-snmp-community

Python
1
star
42

haciendo_aio

Demo app for Refactoring Lab
Python
1
star
43

nso-package-tacacs-auth

A project to enable TACACS based external authentication for NSO
Python
1
star
44

nso-package-network-fabric

A Cisco NSO Package for managing network fabrics
Python
1
star
45

myhero_spark

Simple Cisco Spark Bot for the MyHero Demo
Python
1
star
46

netdevops_cicd_lab

Setup and exercises for exploring Continuous Development practices and tools for NetDevOps
Shell
1
star
47

spark_oauth2_authenticator

Simple application to authorize Spark OAUTH2 Integrations
Python
1
star
48

haciendo_lab

Refactoring Learning Lab to accompany the app haciendo_aio
1
star