cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1666
Views
0
Helpful
8
Replies

Template in LMS 4.0

rognseth
Level 1
Level 1

Hi

I'm trying to create a template in LMS under Configuration>Compliance Templates>Templates that will check on the trunks of the switches for a particular VLAN that is used in "switch port trunk allowed vlan", and if it is there, it should also be added another VLAN to the trunk.

I have tried many different ways to write it, but since the help files do not contain anything about how syntacs the expressions should be, it becomes a little difficult to find the right expression.

Does anyone have an idea of how to do it?

Regards, GunnarR

1 Accepted Solution

Accepted Solutions

Try this version instead.

View solution in original post

8 Replies 8

Joe Clarke
Cisco Employee
Cisco Employee

Can you provide a sample of CLI you'd like to test and deploy?  I think I understand what you want, but I want to be sure.

What I am trying is to check the command "switch port trunk allowed vlan 1,2,4,5" or "switch port trunk allowed vlan 2,4,5" on uplinks if vlan 2 is there. If it is I will run the command "switcport trunk allowed vlan add 3".

In most cases, vlan 2 is not present, and if so I do not need vlan 3 neither. In many cases, "switchport trunk allowed vlan" starts with 1, and on other uplinks it starts with 2.

By the way. Do you know where I can find a referance to how the syntax for templates shall be? I can't find much help in the help files.

GunnarR

You'll need two commandlets:

Name: CheckVLAN2

IsPrereq: Yes

Sub-mode: interface [#.*Ethernet.*#]

Body:

+ switchport trunk allowed vlan [#(^2,|.*,2,)(?!3)#]

Name: AddVLAN3

IsPrereq: No

Prereq: CheckVLAN2

Parent: CheckVLAN2

Body:

+ switchport trunk allowed vlan add 3

The sample templates are good guides to get you started.  For help building the regular expressions, see http://download.oracle.com/javase/1.4.2/docs/api/java/util/regex/Pattern.html .

I do not understand what I am doing wrong. If i try "Compliance Check" the job fails with the reason "Device compliance comparison failed:CM0152 Prerequisite Commands does not exist in device archive." If I try "Direct Deploy" and I choose "Enter Data From User Interface", and chooses one switch for testing in step 2 of 5, I have to choose the same switch in "Device List" in step 3. I don't know what it should stand in "Device", but it is not possible to write any ting there, so that's OK. In "CommandLets" I have some  radio buttons, and no matter which radio button I am marking, or if I do it at all, I get an error message saying "DCMA0025: You have not given any input for the devices. Please give input for at least one device."


Either I am doing something wrong, or it is something wrong in the template. Can you give me a hint?

GunnarR

Export the template you created and post it here.

Tryed to make the template in "Basic" mode, but the error message was the same. The template (made in "Advanced" mode) are enclosed.
Hope you can make some sense of it.

GunnarR

Try this version instead.

Thanks. It worked very well!

GunnarR

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: