Class SnmpTrapSink

  • All Implemented Interfaces:
    java.io.Serializable, Destination

    public class SnmpTrapSink
    extends java.lang.Object
    implements Destination
    Configuration for the various SNMP Trap hosts to receive alarms via Traps.
    Author:
    Alejandro Galue
    See Also:
    Serialized Form
    • Field Detail

      • LOG

        public static final org.slf4j.Logger LOG
        The Constant LOG.
      • MAPPINGS_DIRECTORY_NAME

        public static final java.lang.String MAPPINGS_DIRECTORY_NAME
        The Constant MAPPINGS_DIRECTORY_NAME.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SnmpTrapSink

        public SnmpTrapSink()
    • Method Detail

      • isFirstOccurrenceOnly

        public boolean isFirstOccurrenceOnly()
        Description copied from interface: Destination
        Checks if is first occurrence only.
        Specified by:
        isFirstOccurrenceOnly in interface Destination
        Returns:
        true, if is first occurrence only
      • getName

        public java.lang.String getName()
        Description copied from interface: Destination
        Gets the destination name.
        Specified by:
        getName in interface Destination
        Returns:
        the destination name
      • getIpAddress

        public java.lang.String getIpAddress()
        Gets the IP address.
        Returns:
        the IP address
      • getPort

        public java.lang.Integer getPort()
        Gets the port.
        Returns:
        the port
      • getV1AgentIpAddress

        public java.lang.String getV1AgentIpAddress()
        Gets the v1 agent IP address.
        Returns:
        the v1 agent IP address
      • getVersion

        public SnmpVersion getVersion()
        Gets the version.
        Returns:
        the version
      • getCommunity

        public java.lang.String getCommunity()
        Gets the community.
        Returns:
        the community
      • getMappings

        public java.util.List<SnmpTrapMappingGroup> getMappings()
        Gets the mappings.
        Returns:
        the mappings
      • getImportMappings

        public java.util.List<java.lang.String> getImportMappings()
        Gets the import mappings.
        Returns:
        the import mappings
      • setName

        public void setName​(java.lang.String name)
        Sets the name.
        Parameters:
        name - the new name
      • setIpAddress

        public void setIpAddress​(java.lang.String ipAddress)
        Sets the IP address.
        Parameters:
        ipAddress - the new IP address
      • setPort

        public void setPort​(int port)
        Sets the port.
        Parameters:
        port - the new port
      • setV1AgentIpAddress

        public void setV1AgentIpAddress​(java.lang.String v1AgentIpAddress)
        Sets the v1 agent IP address.
        Parameters:
        v1AgentIpAddress - the new v1 agent IP address
      • setVersion

        public void setVersion​(SnmpVersion version)
        Sets the version.
        Parameters:
        version - the new version
      • setCommunity

        public void setCommunity​(java.lang.String community)
        Sets the community.
        Parameters:
        community - the new community
      • setMappings

        public void setMappings​(java.util.List<SnmpTrapMappingGroup> mappings)
        Sets the mappings.
        Parameters:
        mappings - the new mappings
      • setImportMappings

        public void setImportMappings​(java.util.List<java.lang.String> importMappings)
        Sets the import mappings.
        Parameters:
        importMappings - the new import mappings
      • addMappingGroup

        public void addMappingGroup​(SnmpTrapMappingGroup mappingGroup)
        Adds the mapping group.

        If there is a mapping group with the same name, the existing one will be overridden.

        Parameters:
        mappingGroup - the mapping group
      • getMappingGroupFileName

        public java.lang.String getMappingGroupFileName​(java.lang.String mappingName)
        Gets the mapping group file name.
        Parameters:
        mappingName - the mapping name
        Returns:
        the full path for the mapping group file name
      • getMappingGroupFile

        public java.io.File getMappingGroupFile​(java.lang.String mappingFileName)
        Gets the mapping group file.
        Parameters:
        mappingFileName - the mapping file name
        Returns:
        the mapping group file
      • getImportMapping

        public SnmpTrapMappingGroup getImportMapping​(java.lang.String mappingName)
                                              throws java.lang.Exception
        Gets the import mapping.
        Parameters:
        mappingName - the mapping name
        Returns:
        the import mapping
        Throws:
        java.lang.Exception - the exception
      • addImportMapping

        public void addImportMapping​(SnmpTrapMappingGroup mappingGroup)
                              throws java.lang.Exception
        Adds the import mapping.
        Parameters:
        mappingGroup - the mapping group
        fileName - the file name
        Throws:
        java.lang.Exception
      • removeImportMapping

        public boolean removeImportMapping​(java.lang.String mappingName)
        Removes the import mapping.
        Parameters:
        mappingName - the mapping name
        Returns:
        true, if successful
      • accepts

        public boolean accepts​(NorthboundAlarm alarm)
        Verifies if the sink accepts a given northbound alarm.
        Parameters:
        alarm - the northbound alarm
        Returns:
        true, if the alarm is accepted
      • cleanMappingGroups

        public void cleanMappingGroups()
        Clean mapping groups.

        This is intended to be used when saving the configuration on a file.

        All the groups that currently exist on the mappings list and also on the import-mappings list will be removed from the mapping list to avoid duplicates.