Is it possible to iterate through all interfaces on a device without specifying them in "Define Variables"? The script below is meant to ask the user for a VRF name, then ask what ip addresses to place into the VRF. I achieve this by matching the IPAddress.InterfaceIndex to the Interface.InterfaceIndex to know which interface to apply the config against. I don't really need the user to specify which interfaces to inspect.
If there's a better way to do this I'm happy to hear it!
This template configures physical interfaces based on interface description. It was verified on a Cisco 2950 Catalyst Switch running IOS software version 12.1(12c).
Cisco, interface, VLAN, description, properties
The node the template will operate on. All templates require this by default. The target node is selected during the first part of the wizard so it will not be available for selection when defining values of variables.
Enter a VRF name that you would like on the device(s.
IP Addresses to place
Select IP addresses you'd like to plop into this VRF.
script ChangeInterfacesBasedOnDescription (
// Enter configuration mode
ip vrf @VRFName
foreach (@IP in @PlaceInVRF)
foreach (@Port in @AllPorts)
if (@IP.InterfaceIndex == @Port.InterfaceIndex)
ip vrf forwarding @VRFName
ip address @IP.IPAddress @IP.SubnetMask