Hello everyone,<br><br>The rules I wrote are <br><br><br>rule "Test 1 Rule"<br> salience 1000<br> when<br> <span style="font-weight: bold;"> Line ( $admin : line)</span><br style="font-weight: bold;">
<span style="font-weight: bold;"> eval ( $admin.matches("^.*@\\S*[#>]\\s*show\\s+interface[s]*\\s*$"))</span><br> Line ( $lineSecond : line)<br> eval ( $lineSecond.matches("^\\s*(\\S+)\\s+is\\s+(up|down|administratively down),\\s*line\\s+protocol\\s+is\\s+(up|down)\\s*$"))
<br> device : Device()<br> then<br> System.out.println("********************************************");<br> device.setVendorType("Foundry");<br> <br>end<br><br>rule "Juniper Show Interface CanIParse() Rule"
<br> salience 5000<br> <br> when<br> Line ( $regex : line)<br> eval ( $regex.matches("^.*@\\S*[#>]\\s*show\\s+interface[s]*\\s*$"))<br> Line ( $lineStr : line)<br> eval ( $lineStr.matches("^.*\\s*Physical\\s+interface:\\s*([^,\\s]+),\\s+([^,]+),.*$"))
<br> device : Device()<br> then<br> System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");<br> device.setVendorType("Juniper");<br>end<br><br><br>Basically the rules are searching for two regular expressions, of which one is same for the both of the
rules.But when i write the rules like the above<br>I do not get the correct o/p, but however if i change my rules to (bold) as below, I get the correct output.So is it necessary the the declaration has<br>to be same if the both the rules have same regex
<br><br>rule "Test 1 Rule"<br>
salience 1000<br>
when<br>
<span style="font-weight: bold;">Line ( $regex : line)</span><br style="font-weight: bold;"><span style="font-weight: bold;">
eval ( $regex.matches("^.*@\\S*[#>]\\s*show\\s+interface[s]*\\s*$"</span>))<br>
Line ( $lineSecond : line)<br>
eval (
$lineSecond.matches("^\\s*(\\S+)\\s+is\\s+(up|down|administratively
down),\\s*line\\s+protocol\\s+is\\s+(up|down)\\s*$"))<br>
device : Device()<br>
then<br>
System.out.println("********************************************");<br>
device.setVendorType("Foundry");<br>
<br>
end<br>
<br>
rule "Juniper Show Interface CanIParse() Rule"<br>
salience 5000<br>
<br>
when<br>
Line ( $regex : line)<br>
eval ( $regex.matches("^.*@\\S*[#>]\\s*show\\s+interface[s]*\\s*$"))<br>
Line ( $lineStr : line)<br>
eval ( $lineStr.matches("^.*\\s*Physical\\s+interface:\\s*([^,\\s]+),\\s+([^,]+),.*$")) <br>
device : Device()<br>
then<br>
System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");<br>
device.setVendorType("Juniper");<br>
end<br><br>Thanks<br>Shiva<br>