Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

Attention: The Community will be in read-only mode on 12/14/2017 from 12:00 am pacific to 11:30 am.

During this time you will only be able to see content. Other interactions such as posting, replying to questions, or marking content as helpful will be disabled for few hours.

We apologize for the inconvenience while we perform important updates to the Community.

New Member

Cisco Prime using Database Variables in CLI Templates

Has anyone ever got the following doc example to work?  I have changed it from shutdown a port to change the description as otherwise I would lose access to my switch (high quality example there Cisco) but nothing is deployed.  I have created an file as stated.  What isn't clear is how exactly that file gets invoked by that CLI template.  This section of the manual is poor to say the least.  Anybody been successful with this 'feature' ?




Managing Database Variables in CLI Templates

You can use database (DB) variables for the following reasons:

  • DB variable is one of the data types in CLI templates. You can create DB variables to find the exact device and generate the accurate commands.
  • DB variables are predefined variables. All other variables are user-defined variables.
  • To view the predefined DB variables go to the following path:

Note You can find the file inside the InventoryTagsInTemplate folder that contains the list of predefined DB variables.


  • For example, SysObjectID, IPAddress, ProductSeries, ImageVersion are DB variables.When a device is added to Prime Infrastructure, the complete details of the device is collected in the DB variables. That is, the OID of the devices is collected in SysObjeectID, product series in ProductSeries, image versions of the device in ImageVersion, and so on.
  • Using the data collected by the DB variables, accurate commands can be generated to the device.
  • You can select the DB variable in the Type field (using the Managed Variables page). Expand the name field and fill in the default value field with any of the DB variables which you want to use.
  • When a device is discovered and added to Prime Infrastructure, you can use the database values that were gathered during the inventory collection to create CLI templates.

For example, if you want to create and deploy a CLI template to shut down all interfaces in a branch, create a CLI template that contains the following commands:

#foreach ($interfaceName in $interfaceNameList)
interface $interfaceName

where $interfaceNameList is the database variable type whose value will be retrieved from the database. $interfaceNameList has a default value of IntfName. You need to create the interfaceNameList variable as DB data type (using the managed variable dialog box) and add set the default to IntfName. If you have not specified a default value, you can specify it when you deploy the CLI template.

To populate interfaceNameList with the value from the database, you must create a properties file to capture the query string and save it in the /opt/CSCOlumos/conf/ifm/template/inventoryTagsInTemplate folder. This is a sample of a property file called

# for interface name tag->Name
IntfName=select name from EthernetProtocolEndpoint u where owningEntityId =

After you create the CLI template and the property file and deploy the CLI template, the following CLI is configured on the devices. This output assumes that the device has two interfaces (Gigabitethernet0/1 and Gigabitethernet0/0):

interface GigabitEthernet0/0
interface GigabitEthernet0/1





Hi Nicholas!,did you get this

Hi Nicholas!,

did you get this configuration example to work?, I have the same issue :(

Best Regards!!

New Member



does anyone was able to get the db values to work? What about the other values e.g. ProduktSeries? Can anyone provide some examples?

New Member

What is missing from the

What is missing from the example is the fact that you need to create a Variable in the Manage Variable List for the $interfaceNameList object. Here is what I did:

Template Detail:

CLI Content:

#foreach ($interfaceName in $interfaceNameList)
        interface $interfaceName

Next hightlight the interfaceNameList name and then click on the Manage Variables icon (upper right corner of the dialog). This will create a new variable of type String called interfaceNameList. Edit this new variable and change it to:

Type: DB

Default Value: IntfName

Note: IntfName was retrieved from the list of predefined variables listed in /opt/CSCOlumos/conf/ifm/template/inventoryTagsInTemplate mentioned above.



New Member

Thank you MARIO POIER it


it worked fine with me but it only apply the commands under the physical interfaces

can we make any modification to apply the commands also under tunnel interfaces?



CreatePlease to create content