06-21-2011 05:44 AM
I am trying to write a baseline template that will check all of the major interfaces on a router looking for proper NetFlow commands, and checking the subinterfaces making sure no NetFlow is configured on them. I can get the major interfaces to work OK, but the subinterface regex is not working.
My XML output for the serial subinterface check is:
<Commandlet Name="ActiveSerialSubInt" ControlStmt="false" Parent="Global" Submode="true" Condition="true" Ordered="false">
<CommandInfo CheckType="2">
<Command>shutdown</Command>
</CommandInfo>
<ContextModeCommand>interface [#Serial(\d|/|:)+\.\d+.*#]</ContextModeCommand>
<PreCondition>Global</PreCondition>
<Commandlet Name="NoFlowsOnActiveSub" ControlStmt="false" Parent="ActiveSerialSubInt" Submode="false" Condition="false"
Ordered="false">
<CommandInfo CheckType="2">
<Command>ip flow ingress</Command>
</CommandInfo>
<CommandInfo CheckType="2">
<Command>ip flow egress</Command>
</CommandInfo>
<CommandInfo CheckType="2">
<Command>ip route-cache flow</Command>
</CommandInfo>
<ContextModeCommand></ContextModeCommand>
<PreCondition>ActiveSerialSubInt</PreCondition>
</Commandlet>
</Commandlet>
I went to a website that checks Java pattern match strings and it works with the following configuration string:
interface Serial0/0/0.777 point-to-point. I also used a Java application from the tutorials and it found the match as well.
I use something similar to the above for the major serial interfaces which works fine: [#Serial(\d|/|:)+]
Performing a debug (I removed the timestamps, level, and thread information for brevity) on the config job I see the following which is odd as it just skips right over the subinterface, but it does dive into the next major interface returning a false match.
Is there some issues with looking at subinterfaces with CiscoWorks baseline templates?
Any assistance would be appreciated.
Brian
com.cisco.nm.rmeng.dcma.template.comparator.ConfigTemplateComparator,findContextConfiglet,1313,Context command: interface Serial0/0/0.777 point-to-point
com.cisco.nm.rmeng.dcma.template.comparator.TemplatePatternMatcher,checkForPatternMatch,172,Comparing: interface [#Serial(\d|/|:)+\.\d+.*#] and interface Serial0/0/0.777 point-to-point
com.cisco.nm.rmeng.dcma.template.comparator.ConfigTemplateComparator,findContextConfiglet,1313,Context command: interface Serial0/0/1
com.cisco.nm.rmeng.dcma.template.comparator.TemplatePatternMatcher,checkForPatternMatch,172,Comparing: interface [#Serial(\d|/|:)+\.\d+.*#] and interface Serial0/0/1
com.cisco.nm.rmeng.dcma.template.comparator.TemplatePatternMatcher,checkForPatternMatch,206,Comparing: #Serial(\d|/|:)+\.\d+.*# and Serial0/0/1
com.cisco.nm.rmeng.dcma.template.comparator.TemplatePatternMatcher,checkForPatternMatch,236,Comparing: Serial(\d|/|:)+\.\d+.* and Serial0/0/1
com.cisco.nm.rmeng.dcma.template.comparator.TemplatePatternMatcher,checkForPatternMatch,242,Looking for a positive match
com.cisco.nm.rmeng.dcma.template.comparator.TemplatePatternMatcher,checkForPatternMatch,260,actoutput: false
com.cisco.nm.rmeng.dcma.template.comparator.TemplatePatternMatcher,checkForPatternMatch,280,b: false
06-22-2011 04:52 PM
Try this variable instead "interface [#.*#] [#.*#]" and this should take care of both the interface and subinterface. The syntax you have will only work for serial interface but not the subinterface.
Wrong:
interface [#Serial(\d|/|:)+\.\d+.*#]
Correct:
interface [#.*#] [#.*#]
or if you want to restrict to serial try the following:
interface [#Serial.*#] [#.*#]
Let me know if it works or not.
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