03-18-2024 09:23 AM
Does anyone know of a way to run a show command from a template & creating a variable from a the output (depending on the output format) to be used elsewhere in the template.
I am trying to determin te number of switches in a stack to allow interface configs to be generated & applied.
Or is this not possible in templating?
03-18-2024 10:21 AM
You can't really run a show command, but you can leverage system variables. The system variable $__device.serialNumber will give you a list of all the serial numbers. You can then do a "for loop" to loop through the list and generate interface commands on each iteration.
03-18-2024 11:55 AM
03-18-2024 12:09 PM
The number of switches in the stack is the number of serial numbers listed in the $__device.serialNumber system variable.
03-19-2024 11:27 AM - edited 03-19-2024 11:58 AM
Here's some VTL code to get you started:
#set( $stack_serial_numbers = $__device.serialNumber.split(",") )
#set( $stack_member_count = $stack_serial_numbers.size() )
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