Policies in Provisiond return by default "false" if a SNMP attribute is null

Description

We can use regular expressions to control the behavior for data collection and to decide which interfaces should be persisted in the database during a snmp scan with the MatchingSnmpInterfacePolicy. To match the policy we have the possibility to use different snmp interface attributes like ifAlias, ifDescription or ifType. The match behavior for all policies is defined in a method match(String s, STring matcher) in

opennms-provision/opennms-provision-api/src/main/java/org/opennms/netmgmt/provision/BasePolicy.java

The current behavior returns always "false" also in the case a ifAlias/ifDescription is not set in the device. So it is not possible to define a police like this:

DO NOT PERSIST every interface with an empty ifDescription or ifAlias

It could be easier to control the regex behavior if we handle also null values as empty string.

In this case we have to consider side effects. I don't know if its a common behavior to retrieve a null SNMP interface attribute of an existing interface, instead of getting an empty string from an unset SNMP interface attribute.

Environment

Debian Squeeze and OpenNMS 1.8.14 stable from debian opennms repository

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Details

Assignee

Reporter

Labels

Tracking Code

ORG

Components

Affects versions

Priority

PagerDuty

Created October 15, 2011 at 2:50 PM
Updated September 21, 2021 at 6:24 PM