08-09-2017 09:15 AM
I am trying to create a CLI template for Prime 3 that will go through all L3 interfaces on a switch and if an interface has a specific ip helper-address entry then replace it with a new entry. For example, I may have 5 or 10 L3 VLAN interfaces on a switch, but I only want to make changes to the ones that have ip helper of 10.50.10.5 and replace that value with 10.100.10.5.
interface Vlan20
ip address 10.2.2.1 255.255.255.0
ip helper-address 10.10.10.20
ip helper-address 10.10.10.30
ip helper-address 10.10.10.40
end
interface Vlan30
ip address 10.3.2.1 255.255.255.0
ip helper-address 10.10.10.20
ip helper-address 10.10.10.30
ip helper-address 10.50.10.5
end
So the pseudo code would be something like this (not sure of the variable names):
#foreach ($VLAN_ID in $VLAN_ID_LIST)
#if ($IP_HELPER == '10.50.10.5')
interface $VLAN_ID
no ip helper-address 10.50.10.5
ip helper-address 10.100.10.5
#end
08-23-2017 02:09 AM
I have been trying to do the same thing and haven't been able to figure out a way to get the current helper-address as a variable. This is what I have used as a work around. It does a similar thing but you have to manually exclude specific VLANs and helpers. Hope it helps.
Add this as a CLI template:
#set($excludedVlans=(['Vlan1', 'Vlan245', 'Vlan10' ]) )
## Loop through all interfaces
#foreach($int in $interfaceNameList)
## Match Vlan interfaces only
#if ( $int.substring(0,4) == 'Vlan' )
## Exclude vlans that do not need a helper e.g. vlan1, routing vlans
#if ( $excludedVlans.contains($int))
## Do nothing
## Update helper on all other vlans
#else
interface $int
no ip helper-address 1.1.1.1
ip helper-address 2.2.2.2
exit
#end
#end
#end
Go to the Add Variable tab and add this variable to get the list of interfaces from the prime db:
09-18-2018 03:20 AM
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide