06-25-2025 09:01 PM
I am trying to write a template that sets the switch VTP mode 3, configures domain and password and then depending if the hostname contains core or distro, sets the mode to server, and if it's core to also set to primary server.
For the core, via cli this would be done like :
conf t
vtp domain xxxx
vtp password yyyy
vtp ver 3
vtp mode server
exit
vtp primary
(then there is a prompt:)
This system is becoming primary server for feature vlan
No conflicting VTP3 devices found.
Do you want to continue? [confirm]
(hit enter after the prompt)
I am using jinja templates, and it's easy enough to do the first lot of commands, but the enable mode command is tricky as it has a multiline question and the answer is just to hit enter.
From what I gather it's going to be an #IINTERACTIVE inside a #MODE_ENABLE like this.
#MODE_ENABLE
#INTERACTIVE
vtp primary<IQ>This system is becoming primary server for feature vlan
No conflicting VTP3 devices found.
<R> ...something goes here to send and enter...
#ENDS_INTERACTIVE
#MODE_END_ENABLE
I can't work out how to get it firstly to recognise multiline prompt (if it even needs to? Or does it just need to see the last line 'Do you want to continue? [confirm]' and secondly how to tell it to just sent an 'enter/return'?
06-26-2025 05:34 AM
Since it doesn't require a response, try using this with no response text:
#MODE_ENABLE
#INTERACTIVE
vtp primary<IQ>Do you want to continue<R>
#ENDS_INTERACTIVE
#MODE_END_ENABLE
Here's the reference:
07-07-2025 06:05 PM - edited 07-07-2025 07:43 PM
So, I had thought about just using the 'force' option for the command, but then I lose the feedback of the check that it does.
Then I realised I'm not entirely sure what the check does. I thought it was checking to see if there was already a primary server allocated in the domain, but I tried it myself with two switches in server mode, setting one to vtp primary, then doing it on the other and the check comes back fine with no issues.
So if it's not checking for existing primary server, what is it checking for, and what do I lose by doing the 'force' option?
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