add more matching patterns to MatchingIpInterfacePolicy

Description

I'm trying to setup a provisioning requisition for some routers that are acting in an HA pair.

<model-import date-stamp="2014-05-12T16:42:09.274-05:00" foreign-source="NetworkTeam" last-import="2014-05-12T16:47:09.635-05:00" xmlns="http://xmlns.opennms.org/xsd/config/model-import">
<node building="NetworkTeam" foreign-id="1399931194168" node-label="router-float">
<interface descr="" ip-addr="192.168.1.254" status="1" snmp-primary="P"/>
</node>
<node building="NetworkTeam" foreign-id="1399931160388" node-label="router-b">
<interface descr="" ip-addr="192.168.1.253" status="1" snmp-primary="P"/>
</node>
<node building="NetworkTeam" foreign-id="1399931115556" node-label="router-a">
<interface descr="" ip-addr="192.168.1.252" status="1" snmp-primary="P"/>
</node>
</model-import>

<foreign-source name="NetworkTeam" date-stamp="2013-09-25T10:40:08.903-05:00" xmlns="http://xmlns.opennms.org/xsd/config/foreign-source">
<scan-interval>1d</scan-interval>
<detectors>
<detector name="ICMP" class="org.opennms.netmgt.provision.detector.icmp.IcmpDetector"/>
<detector name="SNMP" class="org.opennms.netmgt.provision.detector.snmp.SnmpDetector"/>
</detectors>
<policies>
<policy name="Gateway IP Addresses" class="org.opennms.netmgt.provision.persist.policies.MatchingIpInterfacePolicy">
<parameter key="action" value="DO_NOT_PERSIST"/>
<parameter key="matchBehavior" value="ALL_PARAMETERS"/>
<parameter key="ipAddress" value="~^192\.168\.\d+\.254$"/>
</policy>
</policies>
</foreign-source>

Now suppose the above does not specify all ip addresses on the routers, and the interface scan adds 20 more vlan entries for each router. so router-a adds 192.168.10-29.252, router-b adds 192.168.10-29.253. Since router-a is currently the active router, router-float adds 192.168.10-29.252, and does not 192.168.10-29.254.

I'd like to be able to exclude all the .254 address using a DO_NOT_PERSIST for router-a and router-b, but not for router-float. And vice-versa, I'd like to exclude all the .252 and .253 from router-float, but not for router-a and router-b.

It would be nice to be able to specify a regular expression to use against either the foreign-id or node-label.

I suppose a way to accomplish this would be to use two different requisitions. Put all routers and their static ip addresses into one, and put the HA ip addresses into a second. Having an enhanced MatchingIpInterfacePolicy that would let me do that inside one requisitions would keep things a bit neater though, I think.

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Details

Assignee

Reporter

Labels

Affects versions

Priority

PagerDuty

Created May 12, 2014 at 6:24 PM
Updated September 21, 2021 at 9:14 PM

Flag notifications