<br> Hmm, this seems like a bug... may I ask you please to open a JIRA and attach your test case?<br><br> Thank you,<br> Edson<br><br><div><span class="gmail_quote">2007/7/12, hare ram <<a href="mailto:hare.bond@gmail.com">
hare.bond@gmail.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">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>
<br>_______________________________________________<br>rules-dev mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">
https://lists.jboss.org/mailman/listinfo/rules-dev</a><br><br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646
<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>