10-03-2018 01:54 PM - edited 10-04-2018 07:24 AM
Is there a way to add a pause between commands in a Prime 3.1 CLI template?
The goal is to make a template to disable a port and leave it disabled for a time before proceeding to re-enable the port.
Below is what I have so far. From what I understand, <timeout> is used in the "Reboot" system template to wait a specified amount of time to allow the switch to reboot before determining whether the deployment was successful (if the switch came back up) or not. However, by running this template as it is, it simply enters whatever number is specified for the Wait_time variable, which produces the error: "Error occured while executing the command 2.Command Output : 22^% Invalid input detected at '^' marker."
#if ( $Is_range eq "No" ) #MODE_ENABLE conf t int ${Interface} power inline never shut <timeout>${Wait_time}</timeout> no shut power inline auto end #MODE_END_ENABLE #else #MODE_ENABLE conf t int range ${Interface} power inline never shut <timeout>${Wait_time}</timeout> no shut power inline auto end #MODE_END_ENABLE #end
Solved! Go to Solution.
03-08-2019 12:06 PM - edited 03-08-2019 12:06 PM
After learning about "terminal shell" and "sleep," I was able to accomplish the goal. Here's the CLI content for anyone who's interested. "sleep 30" is what delays by 30 seconds (or however many seconds you choose).
#MODE_ENABLE terminal shell conf t #if ( $Is_range eq "No" ) int $Interface #else int range $Interface #end shut end sleep 30 conf t #if ( $Is_range eq "No" ) int $Interface #else int range $Interface #end no shut end terminal no shell #MODE_END_ENABLE
10-09-2018 05:56 AM
03-08-2019 12:06 PM - edited 03-08-2019 12:06 PM
After learning about "terminal shell" and "sleep," I was able to accomplish the goal. Here's the CLI content for anyone who's interested. "sleep 30" is what delays by 30 seconds (or however many seconds you choose).
#MODE_ENABLE terminal shell conf t #if ( $Is_range eq "No" ) int $Interface #else int range $Interface #end shut end sleep 30 conf t #if ( $Is_range eq "No" ) int $Interface #else int range $Interface #end no shut end terminal no shell #MODE_END_ENABLE
06-16-2019 11:21 AM - edited 06-16-2019 11:23 AM
When you issue the "term shell" command you can verify it is in effect with the "show term" command.
I have found that if you issue the "term shell" command, then enter config mode (conf t), when you exit config mode, the show term shows that the term shell is no longer in effect.
I issue the "term shell" command just before I use the "sleep x" command.
I have found the availability of the sleep command is not as great as have TCLsh available as in:
tclsh
after 10000
exit
which will sleep for 10 seconds.
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