Our doc team has dedicated an entire chapter in the Orion NCM Admin Guide called "Modifying Device Command Templates", so I won't spend the time to rewrite this into a blog post ;-)  However, given the number of thwack posts around modifying device templates, I thought it would be useful to go through some fundamentals to ensure you've got a solid footing before you try to extend NCM device support yourself.

1. What are device templates?

All NCM device support is based on device command templates or device templates for short.   Device templates define the series of native device commands NCM will use to execute config management actions for a particular device type (e.g., download configs, upload configs, reboot device).  For example, the native device command to show the running config on a Cisco IOS device is "show running".   So, in the device template, we map that value to the DownloadConfig command.   In some cases a single device template can be defined for an entire class of devices (e.g. Cisco IOS based), while in other cases a template specific to one type of device must be created (e.g. Cisco PIX Firewall).

NCM provides out of the box support for over 15 different vendors and 100s of different device models. For devices not supported out of the box, NCM includes the ability to extend the default device support by creating or modifying device templates. 

2. Where are device templates stored?

All device templates are located in the \Solarwinds\Configuration Management\DeviceTypes folder on the NCM server.

3. How does NCM determine which device template to use for a specific device?

NCM uses the system OID of the device retrieved during discovery to automatically identify which device template maps to which device(s).  NCM matches using a best case algorithm by choosing the template that matches the most digits of the device's system OID.   This allows you to have a generic Cisco IOS device template that is used if no more specific device template exists.   For example, if you have a Cisco ASA device with system OID, NCM would normally use the default Cisco IOS device template based on a match of the   However, because there is a specific Cisco ASA device template that matches exactly, NCM would use that one instead.

NOTE: You can override automatic mapping by editing the device in the NCM client application and changing Device Command Template from "Auto Determine" to a specific template.

4. What does a device template look like?

Here's the device template used for standard Cisco IOS devices:

<!--SolarWinds Network Management Tools-->
<!--Copyright 2005 SolarWinds.Net All rights reserved-->
<Configuration-Management Device="Cisco Devices" SystemOID="">
        <Command Name="RESET" Value="terminal width 0${CRLF}terminal length 0"/>
        <Command Name="Reboot" Value="reload${CRLF}y${CRLF}y"/>
        <Command Name="EnterConfigMode" Value="config terminal"/>
        <Command Name="ExitConfigMode" Value="end"/>
        <Command Name="Startup" Value="startup"/>
        <Command Name="Running" Value="running"/>
        <Command Name="DownloadConfig" Value="Show ${ConfigType}"/>
        <Command Name="UploadConfig" Value="${EnterConfigMode}${CRLF}${ConfigText}${CRLF}${ExitConfigMode}"/>
        <Command Name="DownloadConfigIndirect" Value="copy ${ConfigType} ${TransferProtocol}://${StorageAddress}/${StorageFilename}${CRLF}${CRLF}${CRLF}"/>
        <Command Name="UploadConfigIndirect" Value="copy ${TransferProtocol}://${StorageAddress}/${StorageFilename}  ${ConfigType}${CRLF}${CRLF}"/>
        <Command Name="EraseConfig" Value="write erase${CRLF}Y"/>
        <Command Name="SaveConfig" Value="write memory"/>
        <Command Name="Version" Value="show version"/>

Just as an example, if you had a device that required a different command to show the running configuration (e.g. more system:running-config), you could easily copy this device command template, change the name and system OID as appropriate, and change the value of the DownloadConfig command to be "more system:running-config".  Voila, new device command template!

5. After modifying a template, how do I troubleshoot it?

When troubleshooting existing or custom device templates, you should always enable NCM session tracing.   To enable session tracing in NCM, go to File > Settings > Session Tracing.   Attempt to verify login and download a config from the problematic device.   Then, you can find the session trace for your device in \SolarWinds\Configuration Management\Session-Trace.  

The session trace will show you the command interaction between NCM and the device and where there are issues (e.g., non-standard login prompts, non-standard enable prompts, requirement for precommand to go into CLI mode, etc.) that you can then easily correct with simple modifications to the device template.    See Orion NCM Admin Guide (Command Template Commands) for list of commands that can be used to modify interaction between NCM and your device.

To save yourself some time, don't forget to check out the Content Exchange to see if there's a community-created device template already available for your device.