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.

Testing inside of a Config Change Template

Hi

I have a simple config change template.  

script TestPing (NCM.Nodes @ContextNode)

{

  CLI

  {

ping 172.25.230.249

  }

}

When this runs this is the script results.

1/25/2018 10:32:19 AM on test-router.test.com (172.1.10.13) by tim

ping 8.8.8.8

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 5/7/11 ms

Does SW NCM support an if clause that will test the results eg

if ($output contains '!!!!!')  {continue script}

else

{end}

Thanks

Tim

  • All of my experiments has shown that it is not possible to do logic within a change template or script. You can do extremely basic string manipulation (String AB = StringA + StringB). However if that functionality is absolutely required for the config change your are trying to push you could look into leveraging scripts on the device itself and used by NCM. I have done this several times and it while not straight forward or simple, it can fill some of the gaps in NCM.

    If you are using Cisco devices you will want to look at their Embedded Event Manager and TCL scripting. I have had to use them in conjunction mainly because I don't know TCL very well. I would push an EEM script that will do the config change portion and then when I am ready to perform the desired change with logic I perform the logic with TCL and call the EEM script within the TCL script with the correct attributes. As I said not straight forward or simple, but it can be effective.

    Another option would be run that script on the desired devices, run a sql query to examine the transfer logs and use those results to change a custom property. Then you just push you config based on the custom property value. i would probably use this method if I just needed to know if command 'x' returned result 'y'. The first way I mentioned  would be more useful for ready the contents of the config and using those contents again (added new static routes for the site's backup connection, implementing a VRF and so on). Hope this helpedeven though it is likely not the news you were wanting to hear.