BuildVRFIndex.py is a Python application created from the buildIndex() function in VRF Search Tool v0.0.10-beta. I created this stand-alone application so that an index of VRF names and their locations could be updated without having to run an application containing this function. This may be useful if run as a scheduled job.
Exscript module https://github.com/knipknap/exscript/
- This application is hard-coded to use the SSH2 protocol; If SSH v2 is not
enabled on your router(s), you will need to:
ip ssh version 2to your Cisco router(s) configuration and any associated access-list changes. or
- Alter the
default_protocolvariable in the
get_hosts_from_filefunction to use a different protocol enabled on your router(s).
- A valid username/password.
- Presence of a
routers.txtfile containing a list, one per line, of Hostnames or IP Addresses of routers on which VRF tunnels are configured. (If one is not provided, the application will create an example file for the user.)
- Presence of a
settings.cfgfile containing optional configuration settings to fully automate or alter the functionality of the application. (If one is not provided, the application will create an example file for the user.) Absence of custom settings in the
settings.cfgfile will cause the application to run in interactive mode with default settings.
- If a password is stored in
settings.cfgit must be base64-encoded.
- This application was written for use on Cisco IOS devices and cannot be guaranteed to work on other makes/model routers.
- This application assumes that you have enable privileges on each router
in order to execute the
show running-configcommand. If you do not have sufficient user privileges, this application will not work as designed.
- This application uses the same username/password to access ALL routers. If your routers use unique usernames/passwords, then this script will not work.
- Upon execution, the application will search its parent directory for the
presence of a file named
- If this file exists, the application will proceed to Step 3.
- If this file does not exist, the application will continue to Step 2.
- The application will create an example
settings.cfgfile in the parent directory and continue to Step 3.
- The application will open the
settings.cfgfile and retrieve any custom settings from the file and continue to Step 4.
- The application will search its parent directory for the presence of a file
- If this file exists, the application will continue to Step 5.
- If this file does not exist, the application will proceed to Step 6.
- The application will check to see if a username and password was specified
- If a username and password was set, the application will proceed to Step 8.
- If a username and password was not set, the application will continue to Step 7.
- The application will display instructions for the use of the
routers.txtfile. The application will also create an example file and place it in its parent directory end exit (END).
- The application will ask the user for their username and password. These
credentials will be used to login to each of the routers listed in the
routers.txtfile. Continue to Step 8.
- The application will log in to each of the routers listed in the
routers.txtfile using the username and password provided by the user or obtained from the
settings.cfgfile. Using the
show run | include crypto keyringcommand, the application will collect all the VRFs configured on each router and write them to the
index.txt.tmpfile. Continue to Step 9.
- Removing all the unnecessary information from the
index.txt.tmpfile, the application will copy the VRF Name, Customer Peer IP and Local Peer IP (separated by commas) into an
index.txtfile. The application will then remove the temporary file,
index.txt.tmpand exit (END). Note: If the
index.txtfile already exists, it will be overwritten during this step.