Giter VIP home page Giter VIP logo

nornir3_cdp_map's Introduction

published Python 3.6 Python 3.7 Python 3.8 Python 3.9

Nornir3_CDP_map

Set descriptions on interfaces according to the hostname collected from connected CDP-Neighbor.

Author: nouse4it [email protected]

nornir_cdp_map.py

Illustrate the following conecepts:

  • Set descriptions on interfaces according to the hostname collected from connected CDP-Neighbor
  • This script also collects the description of the corresponding pyhsical member interfaces of port-channel and renames the PO accordingly

Use Case Description

The script is intended to automatically put the correct desription on every port. The script collects all cdp neighbor information from all ports. It then configures the collected hostname informaiton on the corresponding interface (incl. Port-channel) The script is able to perform the update on multiple devices in parallel. This makes it possible to run the script on many devices at once.

As aneasy example you have small topology here:

Topology

Installation

Pleae use at least NORNIR Version 3.0 Following Packtes, Modules and Requirements are needed:

genie==21.2.3
nornir==3.1.0
nornir-jinja2==0.1.2
nornir-napalm==0.1.2
nornir-netmiko==0.1.1
nornir-utils==0.1.2
paramiko==2.7.2
pyats==21.2

For more informations see ---> https://github.com/nornir-automation/nornir Python Version must be at least v3.6.8

Usage

Please create the neccessary inventory files (see in inventory folder) that nornir works with, and adjust them to your enviroment. For that please use the following files:

  • config.yaml ---> basis config of how nornir should handle connections and where to gather informations
  • defaults.yaml ---> can be left empty, but must be present as a file
  • groups.yaml ---> is used to group your hosts an provide a plattform info (used for authentication)
  • hosts.yaml ---> is used to put in the hosts you want to run the scripts against in yaml format

For more help how to setup a inventory please see ---> https://nornir.readthedocs.io/en/latest/tutorial/inventory.html

When you finished setting up the inventory you can run the script with python3 nornir3_cdp_map.py The scripts start an will ask you for the follwing input:

  • Username for login on the switches
  • Password for login on the switches

Licensing info

Please see LICENSE

Credit

The original idea and basic setup of this script came from @IPvZero Please check out his repo here on github I added the possibility to rename port channels and enable CDP on specific ports in a VLAN.

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.