PortAudit
Description
Script that iterates over a list of network devices (i.e switches, routers) specified on a CSV file and generates a report of their port status (Interface name, description, IP address and Administrative status).
It does this using the RESTCONF Protocol.
About the LAB to run the demo.
The routers.csv file contains the CSR1000v Always-on DevNet sandbox as part of this demo.
Sandbox URL: https://devnetsandbox.cisco.com/RM/Diagram/Index/27d9747a-db48-4565-8d44-df318fce37ad?diagramType=Topology
CSR1000V Host: ios-xe-mgmt.cisco.com
SSH Port: 8181
NETCONF Port: 10000
RESTCONF Ports: 9443 (HTTPS)
Credentials of this public available Sandbox to specify when prompted for it:
Username: developer
Password: C1sco12345
Usage
- Clone this repo in your local machine typing on your terminal:
https://github.com/agmanuelian/PortAudit.git
- Install the required dependencies specified on the requirements.txt file:
pip install requirements.txt
- Edit the routers.csv file with the parameters (IP address and RESTCONF port) of the list of devices that you want to configure.
- Modify on the port_audit.py script the directory from where the routers.csv file is read, specifying your local directory. Also, modify the directory where output_interfaces.csv will be written to.
- Run the port_audit.py script.
- You will be prompted to enter your TACACS credentials (demo credentials specified on previous section) to access the list of devices.
- The script will run the report, display it on the terminal and write the output_interfaces.csv file (the port audit results) to the specified directory.
Terminal output
Output CSV file, with the port audit results
REF: TACACS is a network device access management protocol. If you have that configure to access all your network devices, you could use your TACACS credentials to access the network devices. Otherwise, using local authentication will work, too.