cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1500
Views
5
Helpful
8
Replies

Use split function in DNAC Template

DanielN6427
Level 1
Level 1

Hello,

I have a problem with the split function in the dnac template editor.

In the simulation the script is working but its not working on an 9300L.


See the affected code below:

 

#set($desc = $line.split(':'))        <- $line is "I am a port description:25"
#set($description = $desc[0])    <- this output is correct in the interface so "I am a port description"
#set($vlan = $desc[1])              <- If I delete this line the code above is working, if used -> DNAC not use this template.

 

so does anyone have an idea?

 

Thank you!
BR
Daniel

8 Replies 8

Preston Chilcote
Cisco Employee
Cisco Employee

Hi Daniel,

Can you be more specific about what the issue is and which Cisco DNA version you are testing on?

 

I created a template with the following:

#set($desc = $line.split(':'))
#set($description = $desc[0])
#set($vlan = $desc[1])

 

interface vlan $vlan
description $description

 

for a 9300 (non-L).  After I added the template to my network profile for that site, it provisioned as expected.

Hi Preston,

Yes sure, I use my template in a sequence at the last step.

If I delete the line #set($vlan = $desc[1]) the template is working.

With the line it ends with the template before (in the sequence).
There is also no issue / warning, so in the logging tab (provision -> device -> template status) I cannot see the last template.

DNAC Version 1.3.3.5

I also tried to rename the variables, not working.

Thanks!
BR
Daniel

Are your templates part of a composite template, or just multiple regular templates? 

 

I found a bug, CSCvt96529 (Provisioning shows as Success even if second template was not configured ) that explains that it is possible that the provision can be reported as a success even if it wasn't.  I don't believe it is fixed yet in the 1.3.3 train.  I think the easiest way to troubleshoot it is to try to apply only the one template with the questionable line included.  Expect it to fail, and expect to see an error explaining why in the status logs.

Hey, 

thanks for the idea, I tried it as seperate template (so not using it in the sequence) and its still not working.

BR
Daniel

 

Hi Daniel,

It wasn't expected to work.  The hope is that it will not pretend to succeed.  Can you be more specific about what happens with the single template when you try to provision?  Any errors shown?

Hey, the template is even not listed in "provision list". So like if the template does not exist.

 

Please open a TAC case, with the exact template you are trying to use, so they can repro if necessary and get to the bottom of this for you.

JL421-Retired
Level 1
Level 1

Have you tried a different variable name? I believe some variables are reserved by the system, so while the template might pass validation, when you actually go to apply it, the variable conflicts and it fails. Maybe try #set($intVlan = $desc[1])?

Review Cisco Networking for a $25 gift card