cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
179
Views
0
Helpful
1
Replies

2.3.5.6 Velocity Template issue

shane.carnahan
Level 1
Level 1

I'm trying to write a template to push AutoConf templates to ports and I'm having issues when I bind the input to the source.

I have bound the $interface_range to the source, inventory, interface, portName

when I run the simulation it never replaces the characters and always just puts in the $interface_range_cleaned in the output. The exception is if I manually set the input with something like "#set( $interface_range = '[TenGigabitEthernet1/0/1, TenGigabitEthernet1/0/2, TenGigabitEthernet1/0/3, TenGigabitEthernet1/0/4, TenGigabitEthernet1/0/5, TenGigabitEthernet1/0/6, TenGigabitEthernet1/0/7, TenGigabitEthernet1/0/8, TenGigabitEthernet1/0/9, TenGigabitEthernet1/0/10]' )". This works as expected.

I have inserted a Debug command to confirm the input is there and it is.

I have tried using the replaceAll method to utilize regex and get the same results. Wondering is anyone else has run into this and figured out a fix?

I have attached a screenshot of the variable input as well in case that helps.

!Debug: Interface Range is $interface_range

#set ( $interface_range_cleaned = $interface_range.replace("[", "").replace("]", ""))

interface range $interface_range_cleaned
  source template DEFAULT_USER_ACCESS_TEMPLATE

1 Accepted Solution

Accepted Solutions

shane.carnahan
Level 1
Level 1

I'm posting this in case someone else finds it helpful. I wasn't able to get my original solution to work, which I think would have been a bit more optimized. I did get this to work however.

!Debug: Interface Range is $interface_range
#foreach ($interface in $interface_range)
interface $interface
source template DEFAULT_USER_ACCESS_TEMPLATE
#end
 

 

View solution in original post

1 Reply 1

shane.carnahan
Level 1
Level 1

I'm posting this in case someone else finds it helpful. I wasn't able to get my original solution to work, which I think would have been a bit more optimized. I did get this to work however.

!Debug: Interface Range is $interface_range
#foreach ($interface in $interface_range)
interface $interface
source template DEFAULT_USER_ACCESS_TEMPLATE
#end
 

 

Review Cisco Networking for a $25 gift card