Class InterfaceUtils

java.lang.Object
org.opennms.pris.util.InterfaceUtils
Direct Known Subclasses:
OcsInterfaceUtils

public class InterfaceUtils extends Object
Maintains IP black- and white-lists and matches IP addresses against them using IPLike patterns.
  • Constructor Details

    • InterfaceUtils

      public InterfaceUtils(InstanceConfiguration config)
      Creates interface utilities bound to the given instance configuration.
      Parameters:
      config - the configuration of the requisition instance
  • Method Details

    • isIpBlackListed

      public Boolean isIpBlackListed(String ipAddress)
      Checks whether the given IP address matches any entry on the black-list.
      Parameters:
      ipAddress - the IP address to test
      Returns:
      true if the address matches a black-list entry
    • isIpWhiteListed

      public Boolean isIpWhiteListed(String ipAddress)
      Checks whether the given IP address matches any entry on the white-list.
      Parameters:
      ipAddress - the IP address to test
      Returns:
      true if the address matches a white-list entry
    • addIpWhite

      public void addIpWhite(String ip)
      Adds an IPLike pattern to the white-list. Entries with invalid syntax are rejected and logged rather than added.
      Parameters:
      ip - the IPLike pattern to add
    • addIpBlack

      public void addIpBlack(String ip)
      Adds an IPLike pattern to the black-list. Entries with invalid syntax are rejected and logged rather than added.
      Parameters:
      ip - the IPLike pattern to add
    • initListsFromConfigs

      public void initListsFromConfigs()
      Loads the black- and white-lists from the blackList.properties and whiteList.properties files in the working directory, falling back to empty lists if the files cannot be read.