03-25-2011 06:30 AM
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
Solved! Go to Solution.
03-30-2011 01:04 AM
03-25-2011 07:12 PM
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.
03-27-2011 01:58 PM
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
03-27-2011 02:26 PM
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 .
03-28-2011 04:35 AM
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
03-28-2011 08:26 AM
Export the template you created and post it here.
03-28-2011 11:47 PM
03-30-2011 01:04 AM
04-07-2011 02:59 AM
Thanks. It worked very well!
GunnarR
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide