command execution

Does anyone knows how the commands in the device template work while getting the configs from devices is is first in first out or last in last out?. also does the reboot command is necessary for all templates I believe it is not required, it doesn't make sense to reload the device while getting configuration.

.

  • The commands in the Device Template should be 'By Reference only'. The order does not matter.

    To stitch a couple of things together with NCM that will hopefully make it easier to understand the entire process.

    In the example of downloading a device config.

    The main command is #1 in the below screenshot.

    <Command Name="DownloadConfig" Value="Show ${ConfigType}"/>

    This basically means that it is going to execute 'Show' plus whatever text is translated from the ${ConfigType} variable.

    #2 has config types defined as 'startup' and 'running'. So if I selected to back up a running config it would use 'Show ' + 'running'.

    You can see the defined config types under NCM Settings > Config Types

    When you're on the Config Management page, you'll see reference to your config types under the 'Download' button.



    So on the front end, you click Download > Running.

    On the back end, it reads the device template and parses the 'DownloadConfig' and 'Running' commands to execute a 'Show running'.


    To take another example of 'Reboot'

    <Command Name="Reboot" Value="reload${CRLF}y${CRLF}y"/>

    The device template has a command name of 'Reboot' that executes a 'Reload + <enter> + y <enter> + y'

    These device template commands can be referenced throughout NCM.

    If I was on the Config Manage page and clicked on the 'Execute Script' button, i could simply type ${reboot} and click execute.

    It would then go back to the Device Template to see if there is a reboot command and execute it if there is.

    My lab has permissions locked down, so the screenshot below shows the results of me executing that command (which was denied) of 'Reload' + <enter> + y <enter> + y'


    This means that you can have device templates have syntax specific commands while all using the same NCM variables. This can help with management across different vendor CLI.

    You can add whatever you want in the Device Template with other custom commands based on how you manage your network. The only requirement is to follow the correct XML markup.

  • so does it mean we can add any commands or values to the device template and use them whenever necessary either to call dynamically downloading the configs or through scripts. they do not execute until we call them externally?

  • Once you get a grasp of this, it becomes extremely powerful. And don't let the "Network" part of the name fool you, NCM can 100% do some pretty cool stuff with servers too. Essentially anything you can connect to for CLI, this is where you're going to make it happen.