cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1507
Views
0
Helpful
6
Replies

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

mkoschay123
Level 1
Level 1

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   

6 Replies 6

mkoschay123
Level 1
Level 1

FYI...

This issue is now filed in CSCuq66335 PI: Dbvariable for operationalVlanMode needed

thank you.

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
Level 1
Level 1

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
Level 1
Level 1

Hi, mkoschay123,

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

Thanks.

Regards,

Guillaume.

Jean Matthew
Level 1
Level 1

Can we set the "spd" and "duplexField" fields as mandatory and then change the code to

 

#foreach ($Interface in $AccessInt)

        interface $Interface

                   speed $spd

                    duplex $duplexField

exit  

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: