This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Delay for Config Change Templates

I've searched around here but have not been able to find a way to do a "delay" when creating a Config Change Template.

I've tried the following...

{
  string @PipeSymbol='|'
  string @PausePlease='${Delay:5}'
  // Enter configuration mode
  CLI 
  {
   configure terminal
  }
 
  // Loop through selected ports
  foreach (@portItem in @TargetPorts)
  {
CLI
{
interface @portItem.InterfaceDescription
shut
@PausePlease
no shut
end
@PausePlease
sh ip int brief @PipeSymbol incl @portItem.InterfaceDescription
}
  }

}

as well as a few other variants but either the delay is ignored, invalid when Validating or comes up with an error. 

Has anyone figured out how to delay scripts during a run in Config Change Templates and have it work?  I'm going to continue hacking at it but if someone's figured it out, I would love to know.

  • Hi ,

    Thank you for the reply.  I tried deleting the post as I found the answer very shortly thereafter.  I was using the ${Delay:x} macro in the script above.  My issue turned out to be my wait periods were not long enough for me to notice that the Delay worked.  So here is what I did to fix my problem in case others need to do the same.

    script ShutNoShutPorts (    
                            NCM.Nodes @ContextNode, 
                            NCM.Interfaces[] @TargetPorts 
    						)
    
    {
      // DEFINE THE PIPE SYMBOL FOR LATER USE AS THE PIPE SYMBOL ADDED DIRECTLY IN THE SCRIPT WON'T WORK
      string @PipeSymbol='|'
      
      // DEFINE 2 PAUSES. ONE FOR 2 SECONDS AND ONE FOR 20 SECONDS TO ALLOW FOR THE SCRIPT TIME TO DO IT'S THING.
      string @PausePlease2='${Delay:2}'
      string @PausePlease20='${Delay:20}'
      
      // Enter configuration mode
      CLI 
      {
       configure terminal
      }
     
      // Loop through selected ports
      foreach (@portItem in @TargetPorts)
      {
    CLI
    {
    interface @portItem.InterfaceDescription
    shut
    @PausePlease2
    no shut
    end
    @PausePlease20
    !
    !
    sh ip int brief @PipeSymbol incl @portItem.InterfaceDescription
    }
      }
    
    }

    Hope this helps and thank you once again for your input !  Much appreciated!