cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1119
Views
0
Helpful
3
Replies

Velocity Template Catalyst Center Boolean

eberzani
Level 1
Level 1

Hello everyone! 

I am looking for some help in having CAT-C recognize the Boolean in my code. Now it can be true that I may have wrong expectations and if I do I wish to be corrected.

  • I have Cisco Prime Infrastructure and we will be migrating soon to Cisco Catalyst Center.
  • We have migrated most of the Network Devices and Sites and now we want to migrate the Templates. 
  • Most of the templates were recreated and Cat-C managed to find a way to get the attributes too when I copy pasted the code

However I am stuck on one template: 

neighbor ${ORG}-VPS prefix-list ${TSO}-VPS-IN in
 neighbor ${ORG}-VPS prefix-list VPS-OUT out
#if ( $Role eq "true" )
 neighbor ${ORG}-VPS route-map AS PREP out
#else
#end
neighbor $bgp_neig peer-group ${ORG}-VPS

In Cisco Prime the above template gives me a checkbox that, when I check it, it will add the configuration on a secondary device. 
What I am looking for is how to do the same in Cat-C ? 
Checking some guides online I managed to modify the code to this: 

#if ( $Role == "true" )

 neighbor ${ORG}-VPS route-map AS PREP out

#end
 
However all I see is no DATA TYPE as Boolean or Cat-C is not recognizing the code as such. 
Any thoughts? 

Regards, 
Eugen

 

3 Replies 3

gchellia
Cisco Employee
Cisco Employee

Hi,

Currently Catalyst Center does not support Boolean variable for VTL. You can easily get the desired configurations with the below VTL script.

You can define a variable called "ROLE" and pass the value as "PRIMARY" or "SECONDARY" and get the desired configs.

Here is the VTL script.

hostname $hostname

router bgp $AS_NUM

#if($ROLES == "PRIMARY")
neighbor ${ORG}-VPS prefix-list TSO-VPS-IN in
neighbor ${ORG}-VPS prefix-list VPS-OUT out

#elseif($ROLES == "SECONDARY")
neighbor ${ORG}-VPS prefix-list TSO-VPS-IN in
neighbor ${ORG}-VPS prefix-list VPS-OUT out
neighbor ${ORG}-VPS route-map AS PREP out

#end

Did a quick test in the Catalyst Center and it is working. Attached the screenshots.

 

 

Dear GChellia, 

 

I apologize as I do not seem to observe your name. 

Thank you for taking the time to respond! 

Perhaps you may need a bit more information to help me better. 
- How do I Simulate the template to be pushed on two routers at the same time? The current Simulation only allows me one router
- Could you elaborate further on the $hostname part? What is it supposed to do?
- For some reason CC cannot push anything when I enter a HOSTNAME ---> Declared as a Variable type ---> Multiple options. I select the hostname AND I select PRIMARY or SECONDARY and nothing is pushed. 

Would you by any chance be free for a short call with me? at your convenience and less than 30 minutes would be sufficient. We wish to migrate from PRIME to CC and this is a showstopper at the moment  

Kind regards, 
Eugen Berzani

Chloeharper
Level 1
Level 1

Not entirely sure what’s going wrong here but Velocity templates have some weird quirks with null checks and booleans. It does not always follow standard logic which can be frustrating.

Chloe Harper | Contact Support: support@arzhost.com
Reliable & scalable hosting services at arzhost.com