s_update_dhcp_relay¶
-
s_update_dhcp_relay.
script_main
(session)¶ -
This script will scan the running configuration of the connected device looking for instances of old IP helper/DHCP relay addresses (IOS/NXOS) on interfaces and if found will update the helper/relay addresses with the newer ones. The new and old addresses that the script looks for is saved in the settings.ini file, as documented below.
This script will prompt you to run in “Check Mode”, where the configuration changes the script would be pushed to the device are ONLY written to a file and NO CHANGES will be made to the device. If you select “No” when prompted this script will push the configuration changes to the device. Also, when the changes are pushed to the device this script will save the running config before and after the changes are made, and will also output a log of the configuration session showing all the commands pushed.
Script Settings (found in settings/settings.ini):
- show_instructions - When True, displays a pop-up upon launching the scriptexplaining where to modify the list of commands sent to devices. This window alsoprompts the user if they want to continue seeing this message. If not, the scriptchanges this setting to False.
- old_relays - This is a comma separated list of IP addresses that the script shouldsearch for as relay addresses in the device’s configuration.
- new_relays - This is a comma separated list of IP addresses that are the new relayaddresses that should be added to any interface that has at least one of the oldhelper/relay addresses on it.
- remove_old_relays - If True, the script will add the new relays and REMOVE the oldrelays immediately after adding the new ones. If False (default), the script willonly add the new relays to interfaces where at least one old relay is found. Thisis useful when you want to push out new relays as part of a migration processwithout removing the old relays. Since this script will not try to push new relayaddresses that already exist on an interface, the script can be run again with thisoption set to True to later remove the old relays.
Parameters: session (sessions.Session) – A subclass of the sessions.Session object that represents this particular script session (either SecureCRTSession or DirectSession)