m_update_interface_desc¶
-
m_update_interface_desc.
script_main
(script)¶ -
This script will grab the detailed CDP information from a Cisco IOS or NX-OS device and port-channel information and generate the commands to update interface descriptions. The user will be prompted to run in “Check Mode” which will write the configuration changes to a file (for verification or later manual application). If not, then the script will push the configuration commands to the device and save the configuration.
IMPORTANT: This script imports the script_main() function from the s_update_interface_desc.py to run a majority of the script logic. Much of this script is only handling multiple logins and calling the single-device version of this script.
Script Settings (found in settings/settings.ini):
- strip_domains - A list of domain names that will be stripped away if found inthe CDP remote device name.
- take_backups - If True, the script will save a copy of the running config beforeand after making changes.
- rollback_file - If True, the script will generate a rollback configuration scriptand save it to a file.
Parameters: script (scripts.Script) – A subclass of the scripts.Script object that represents the execution of this particular script (either CRTScript or DirectScript)
-
m_update_interface_desc.
per_device_work
(session, check_mode, enable_pass)¶ This function contains the code that should be executed on each device that this script connects to. It is called after establishing a connection to each device in the loop above.
You can either put your own code here, or if there is a single-device version of a script that performs the correct task, it can be imported and called here, essentially making this script connect to all the devices in the chosen CSV file and then running a single-device script on each of them.