Cisco Prime 2.x: Adding Inventory Tags in CLITemplateDbVariablesQuery.properties

Unanswered Question
Jun 16th, 2014
User Badges:

Hello,

I’m trying to build a template that configures all interfaces of my switches which are explicit in Operational Mode: static access

I find an inventory DB table which gives me the needed information in my Demo system:

 

ncsDiag DB query:           select * from VLANSWITCHPORTSETTINGS

 

ID           OWNINGENTITYID                         NAME                                  OPERATIONALVLANMODE         DESIREDVLANMODE                ACCESSVLAN     VOICEVLAN

2708706 2693691_192.168.2.200               FastEthernet0/1              10                                                          3                                             99                                null

//snip//

2708713 2693691_192.168.2.200               FastEthernet0/8              2                                                            3                                             99                                null

 

Adding the query with an inventory tag “AccessInt “ in CLITemplateDbVariablesQuery.properties file in /opt/CSCOlumos/conf/ifm/template/inventoryTagsInTemplate

 

AccessInt=select u.NAME from VLANSWITCHPORTSETTINGS u where u.OPERATIONALVLANMODE like '2' and u.owningEntityId =

 

I check with ncsDiag DB query that the correct output is given.

 

ncsDiag DB query: select u.NAME from VLANSWITCHPORTSETTINGS u where u.OPERATIONALVLANMODE like '2' and u.owningEntityId = '2693691_192.168.2.200'

 

Output returned: FastEthernet0/8

 

Then I create the CLI Template with form variables plus the new tagged DB inventory variable:

 

#foreach ($Interface in $AccessInt)

        interface $Interface

               #if(${spd}  == "Auto")

                   speed auto  

               #elseif(${spd}  == "10Mbps")

                   speed 10

               #elseif(${spd}  == "100Mbps")

                    speed 100

                #elseif(${spd}  == "1000Mbps")

                    speed 1000

               #end

               #if(${duplexField}  == "Auto")

                   duplex auto  

               #elseif(${duplexField}  == "Half")

                   duplex half

               #elseif(${duplexField}  == "Full")

                   duplex full

               #end

exit  

 

But the CLI preview complains about missing data: Commands are not generated due to insufficient information. Provide the required information to generate commands for the selected device.

Is there something wrong with this template script or is it not possible to add managed DB variables?

 

Thanks for any help   

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
mkoschay123 Tue, 05/24/2016 - 01:56
User Badges:

Bug still open... but found a working solution for me.

Adding in CLITemplateDbVariablesQuery.properties

Variable for Access Ports (access vlan or access vlan + voice vlan)

AccessInt=select vlan.name from VLANSwitchportSettings vlan where (vlan.operationalVlanMode = '2' or vlan.desiredVlanMode = '2' or  vlan.desiredVlanMode = '3') AND vlan.owningEntityId =

Variable for Trunk Ports

TrunkInt=select vlan.name from VLANSwitchportSettings vlan where (vlan.operationalVlanMode = '5' or  vlan.desiredVlanMode = '5') AND vlan.owningEntityId =


Tested with Prime 2.2, 3.0 and 3.1

Frank Benders Fri, 07/17/2015 - 01:52
User Badges:

I was having the same problem and found the following solution:

I think the problem here is that the table VLANSwitchportSettings is not mapped and you have to specify the full class name.

In your .properties file add the following entry (case sensitive!):

accessInt=select u.name from com.cisco.xmp.model.managed.standardTechnologies.vlansAndSpanningTree.vlans.VLANSwitchportSettings u where u.operationalVlanMode like '2' and u.owningEntityId =

This works for us on prime 2.2.0. I did not (yet) verify this with Cisco.

 

 

 

GuillaumeCisco Tue, 09/22/2015 - 02:46
User Badges:

Hi, mkoschay123,

How did you manage to get all the DB tables (the "ncsDiag" part) from the command line ?

Thanks.

Regards,

Guillaume.

Actions

This Discussion