Home

Awesome

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 github@schlueter-online.net

nornir_cdp_map.py

Illustrate the following conecepts:

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:

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:

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.