<div dir="ltr"><div><div><div><div><div>Hello list,</div><div><br></div><div>Hope you all doing well!<br></div>I am trying to ease the management of LCR routing rules, since once we begin to have multiple prefixes, multiple GWs and so on, the visualization and management of the rules priorities becomes exponentially hard to do.<br></div>So first thing I am trying to achieve is an easy way of retrieving the rules in an ordered manner. I couldn't find any tool to do such thing and source code was not very friendly.... so I've come up with this Postgresql query that I think retrieves all rules in the same order I expect LCR to select the GWs.<br><span style="font-family:monospace,monospace"><br>SELECT lr.lcr_id, lr.prefix, lrt.priority, lg.gw_name, lg.ip_addr <br></span></div><div><span style="font-family:monospace,monospace">FROM lcr_rule lr <br>JOIN lcr_rule_target lrt ON lrt.lcr_id = lr.lcr_id AND lrt.rule_id = <a href="http://lr.id">lr.id</a> <br>JOIN lcr_gw lg ON lg.lcr_id = lr.lcr_id AND <a href="http://lg.id">lg.id</a> = lrt.gw_id <br>WHERE lr.enabled = 1 AND lg.defunct = 0 AND lr.lcr_id = ID AND lr.prefix SIMILAR TO '(|PREFIX%)'<br>ORDER BY lr.lcr_id, LENGTH(lr.prefix) DESC, lrt.priority;</span><br><br></div>It is missing the weights calculation, but it is rather complex and I am not using it anyway.... Other than that does anyone did something similar to check if my query really matches what LCR engine does?<br><br></div>Thanks,<br></div>Patrick Wakano<br></div>