12-11-2019 01:26 AM
Hi,
I'd like to create configuration (day-n) templates with some multiline commands. The <MLTCMD> doesn't provide me the correct output for:
- interface macro's
- banners (containing some special characters ($,"(),#,-)
I tried #INTERACTIVE mode, but that didn't help either. Can anyone provide me a template snippet in order to get the above (multiline) commands to work?
12-11-2019 08:38 AM
Hey Ben,
Please make sure you follow rules listed below:
* <MLTCMD> and </MLTCMD> tags are case-sensitive and must be entered as uppercase. * The multi-line commands must be inserted between the <MLTCMD> and </MLTCMD> tags. * The tag cannot be started with a space. * The <MLTCMD> and </MLTCMD> tags cannot be used in a single line.
Here is a template snippet which provides an example of multiline command being used for banner:
<MLTCMD>banner login ^ line 1 line 2 line 3 ^C</MLTCMD>
Here is a snippet of how I have used macros to apply configuration to device interfaces:
#macro(interface_config) switchport
switchport mode access
switchport access vlan 1050 #end interface ${interface} #interface_config
Best Regards,
12-12-2019 12:01 AM
Hi Dani,
I applied the <MTLCMD> with the banner as you mentioned above. However, it's skipping some special characters (#):
--------------------------------------------
########################################
This device is managed...
########################################
--------------------------------------------
Best regards
Ben
12-24-2019 07:24 AM
Hey Ben,
Velocity Template Language (VTL) does have some issues with special characters. If you plan to use special characters in your banner, it is recommended to configure the banner from DNAC Design -> Network Settings instead of through a configuration template.
12-24-2019 08:46 AM
01-09-2020 05:10 PM
Can you provide an example of a command you are trying to use?
Thanks,
Chuck
07-31-2020 03:20 AM
Hi,
The problem I have is when I try to add a templete to configure a banner like this
<MLTCMD>banner login ^ line 1 line 2 line 3 ^C</MLTCMD>
I have DNA-C 1.3.3.6 and the switch is a 9300 with IOS-XE 16.12.3s.
Though the provision is successfully, the banner appears with a blank line between the lines I have defined.
Is there any issue with this config or a possible bug with the interpreter of DNA-C?
Thanks in advance and best regards
08-12-2020 07:35 PM
I have the same issue. When applying the multi line command from DNAC, it adds an extra line that is blank between lines 1,2, and 3.
05-07-2023 02:26 PM
Hi,
With what commands can I choose several interfaces in a switch to perform trunk, always using a DayN, does anyone have a link about it?
Thanks a lots !
Ciro Gustavo Mele.
05-07-2023 02:45 PM
Go here and read about building templates and also utilizing the system variables. Please also build your templates in Jinja language.
Enjoy!
05-08-2023 09:06 AM
Ciro, first, you can create a Multi-select bind-to-source variable with the list of interfaces available on the device (see attached image for example). Then use a for loop to iterate through that list.
#foreach($i in $int)
interface $i.portName
!some commands
#end
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