cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1591
Views
0
Helpful
2
Replies

Prime CLI Template for IP helper change

vantipov
Level 1
Level 1

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

2 Replies 2

josh.clarke
Level 1
Level 1

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:

var.PNG

sanothom
Level 1
Level 1
Did you find a solution for this? I have a similar requirement