Class OnmsNode

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<OnmsNode>

    @Entity
    public class OnmsNode
    extends OnmsEntity
    implements java.io.Serializable, java.lang.Comparable<OnmsNode>
    Contains information on nodes discovered and potentially managed by OpenNMS. sys* properties map to SNMP MIB 2 system table information.
    See Also:
    Serialized Form
    Hibernate class:
    table="node"
    • Constructor Detail

      • OnmsNode

        public OnmsNode()

        Constructor for OnmsNode. This constructor should only be used by JAXB and by unit tests that do not need to persist the OnmsNode in the database. It does not associate the OnmsNode with a required OnmsMonitoringLocation.

      • OnmsNode

        public OnmsNode​(OnmsMonitoringLocation location)

        Constructor for OnmsNode.

        Parameters:
        location - The location where this node is located
      • OnmsNode

        public OnmsNode​(OnmsMonitoringLocation location,
                        java.lang.String label)

        Constructor for OnmsNode.

        Parameters:
        location - The location where this node is located
        label - The node label
    • Method Detail

      • getId

        public java.lang.Integer getId()
        Unique identifier for node.
        Returns:
        a Integer object.
      • getNodeId

        public java.lang.String getNodeId()

        getNodeId

        Returns:
        a String object.
      • setId

        public void setId​(java.lang.Integer nodeid)

        setId

        Parameters:
        nodeid - a Integer object.
      • setNodeId

        public void setNodeId​(java.lang.String nodeid)

        setNodeId

        Parameters:
        nodeid - a String object.
      • getCreateTime

        public java.util.Date getCreateTime()
        Time node was added to the database.
        Returns:
        a Date object.
        Hibernate property:
        column="nodecreatetime" length="8" not-null="true"
      • setCreateTime

        public void setCreateTime​(java.util.Date nodecreatetime)

        setCreateTime

        Parameters:
        nodecreatetime - a Date object.
      • getParent

        public OnmsNode getParent()
        In the case that the node is virtual or an independent device in a chassis that should be reflected as a subcomponent or "child", this field reflects the nodeID of the chassis/physical node/"parent" device.
        Returns:
        a OnmsNode object.
      • setParent

        public void setParent​(OnmsNode parent)

        setParent

        Parameters:
        parent - a OnmsNode object.
      • getType

        public OnmsNode.NodeType getType()
        Flag indicating status of node - 'A' - active - 'D' - deleted TODO: Eventually this will be deprecated and deleted nodes will actually be deleted.
        Returns:
        a String object.
      • setType

        public void setType​(OnmsNode.NodeType nodetype)

        setType

        Parameters:
        nodetype - a String object.
      • getSysObjectId

        public java.lang.String getSysObjectId()
        SNMP MIB-2 system.sysObjectID.0
        Returns:
        a String object.
      • setSysObjectId

        public void setSysObjectId​(java.lang.String nodesysoid)

        setSysObjectId

        Parameters:
        nodesysoid - a String object.
      • getSysName

        public java.lang.String getSysName()
        SNMP MIB-2 system.sysName.0
        Returns:
        a String object.
      • setSysName

        public void setSysName​(java.lang.String nodesysname)

        setSysName

        Parameters:
        nodesysname - a String object.
      • getHasFlows

        public boolean getHasFlows()
      • getHasIngressFlows

        public boolean getHasIngressFlows()
      • getHasEgressFlows

        public boolean getHasEgressFlows()
      • getLastIngressFlow

        public java.util.Date getLastIngressFlow()
      • setLastIngressFlow

        public void setLastIngressFlow​(java.util.Date lastIngressFlow)
      • getLastEgressFlow

        public java.util.Date getLastEgressFlow()
      • setLastEgressFlow

        public void setLastEgressFlow​(java.util.Date lastEgressFlow)
      • getSysDescription

        public java.lang.String getSysDescription()
        SNMP MIB-2 system.sysDescr.0
        Returns:
        a String object.
      • setSysDescription

        public void setSysDescription​(java.lang.String nodesysdescription)

        setSysDescription

        Parameters:
        nodesysdescription - a String object.
      • getSysLocation

        public java.lang.String getSysLocation()
        SNMP MIB-2 system.sysLocation.0
        Returns:
        a String object.
      • setSysLocation

        public void setSysLocation​(java.lang.String nodesyslocation)

        setSysLocation

        Parameters:
        nodesyslocation - a String object.
      • getSysContact

        public java.lang.String getSysContact()
        SNMP MIB-2 system.sysContact.0
        Returns:
        a String object.
      • setSysContact

        public void setSysContact​(java.lang.String nodesyscontact)

        setSysContact

        Parameters:
        nodesyscontact - a String object.
      • getLabel

        public java.lang.String getLabel()
        User-friendly name associated with the node.
        Returns:
        a String object.
      • setLabel

        public void setLabel​(java.lang.String nodelabel)

        setLabel

        Parameters:
        nodelabel - a String object.
      • getLabelSource

        public OnmsNode.NodeLabelSource getLabelSource()
        Flag indicating source of nodeLabel - 'U' = user defined - 'H' = IP hostname - 'S' = sysName - 'A' = IP address TODO: change this to an enum
        Returns:
        a String object.
      • setLabelSource

        public void setLabelSource​(OnmsNode.NodeLabelSource nodelabelsource)

        setLabelSource

        Parameters:
        nodelabelsource - a String object.
      • getNetBiosName

        public java.lang.String getNetBiosName()
        NetBIOS workstation name associated with the node.
        Returns:
        a String object.
      • setNetBiosName

        public void setNetBiosName​(java.lang.String nodenetbiosname)

        setNetBiosName

        Parameters:
        nodenetbiosname - a String object.
      • getNetBiosDomain

        public java.lang.String getNetBiosDomain()
        NetBIOS domain name associated with the node.
        Returns:
        a String object.
      • setNetBiosDomain

        public void setNetBiosDomain​(java.lang.String nodedomainname)

        setNetBiosDomain

        Parameters:
        nodedomainname - a String object.
      • getOperatingSystem

        public java.lang.String getOperatingSystem()
        Operating system running on the node.
        Returns:
        a String object.
      • setOperatingSystem

        public void setOperatingSystem​(java.lang.String operatingsystem)

        setOperatingSystem

        Parameters:
        operatingsystem - a String object.
      • getLastCapsdPoll

        public java.util.Date getLastCapsdPoll()
        Date and time of last Capsd scan.
        Returns:
        a Date object.
      • setLastCapsdPoll

        public void setLastCapsdPoll​(java.util.Date lastcapsdpoll)

        setLastCapsdPoll

        Parameters:
        lastcapsdpoll - a Date object.
      • getForeignId

        public java.lang.String getForeignId()

        getForeignId

        Returns:
        a String object.
      • setForeignId

        public void setForeignId​(java.lang.String foreignId)

        setForeignId

        Parameters:
        foreignId - a String object.
      • getForeignSource

        public java.lang.String getForeignSource()

        getForeignSource

        Returns:
        a String object.
      • setForeignSource

        public void setForeignSource​(java.lang.String foreignSource)

        setForeignSource

        Parameters:
        foreignSource - a String object.
      • setLocation

        public void setLocation​(OnmsMonitoringLocation location)
        Set the monitoring location that this node is located in.
      • setPathElement

        public void setPathElement​(PathElement pathElement)

        setPathElement

        Parameters:
        pathElement - a PathElement object.
      • getIpInterfaces

        public java.util.Set<OnmsIpInterface> getIpInterfaces()
        The interfaces on this node
        Returns:
        a Set object.
      • setIpInterfaces

        public void setIpInterfaces​(java.util.Set<OnmsIpInterface> ipinterfaces)

        setIpInterfaces

        Parameters:
        ipinterfaces - a Set object.
      • removeIpInterface

        public void removeIpInterface​(OnmsIpInterface iface)
      • getSnmpInterfaces

        public java.util.Set<OnmsSnmpInterface> getSnmpInterfaces()
        The information from the SNMP interfaces/ipAddrTables for the node
        Returns:
        a Set object.
      • setSnmpInterfaces

        public void setSnmpInterfaces​(java.util.Set<OnmsSnmpInterface> snmpinterfaces)

        setSnmpInterfaces

        Parameters:
        snmpinterfaces - a Set object.
      • getCategories

        public java.util.Set<OnmsCategory> getCategories()

        getCategories

        Returns:
        a Set object.
      • setCategories

        public void setCategories​(java.util.Set<OnmsCategory> categories)

        setCategories

        Parameters:
        categories - a Set object.
      • addCategory

        public boolean addCategory​(OnmsCategory category)

        addCategory

        Parameters:
        category - a OnmsCategory object.
        Returns:
        a boolean.
      • removeCategory

        public boolean removeCategory​(OnmsCategory category)

        removeCategory

        Parameters:
        category - a OnmsCategory object.
        Returns:
        a boolean.
      • hasCategory

        public boolean hasCategory​(java.lang.String categoryName)

        hasCategory

        Parameters:
        categoryName - a String object.
        Returns:
        a boolean.
      • getRequisitionedCategories

        public java.util.Set<java.lang.String> getRequisitionedCategories()
      • setRequisitionedCategories

        public void setRequisitionedCategories​(java.util.Set<java.lang.String> categories)
      • addRequisitionedCategory

        public void addRequisitionedCategory​(java.lang.String category)
      • removeRequisitionedCategory

        public void removeRequisitionedCategory​(java.lang.String category)
      • getMetaData

        public java.util.List<OnmsMetaData> getMetaData()
      • findMetaDataForContextAndKey

        public java.util.Optional<OnmsMetaData> findMetaDataForContextAndKey​(java.lang.String context,
                                                                             java.lang.String key)
      • setMetaData

        public void setMetaData​(java.util.List<OnmsMetaData> metaData)
      • addMetaData

        public void addMetaData​(java.lang.String context,
                                java.lang.String key,
                                java.lang.String value)
      • removeMetaData

        public void removeMetaData​(java.lang.String context,
                                   java.lang.String key)
      • removeMetaData

        public void removeMetaData​(java.lang.String context)
      • getRequisitionedMetaData

        public java.util.List<OnmsMetaData> getRequisitionedMetaData()
      • setRequisionedMetaData

        public void setRequisionedMetaData​(java.util.List<OnmsMetaData> requisitionedMetaData)
      • addRequisionedMetaData

        public void addRequisionedMetaData​(OnmsMetaData onmsMetaData)
      • toString

        public java.lang.String toString()

        toString

        Overrides:
        toString in class java.lang.Object
        Returns:
        a String object.
      • isDown

        public boolean isDown()

        isDown

        Returns:
        a boolean.
      • getSnmpInterfaceWithIfIndex

        public OnmsSnmpInterface getSnmpInterfaceWithIfIndex​(int ifIndex)

        getSnmpInterfaceWithIfIndex

        Parameters:
        ifIndex - a int.
        Returns:
        a OnmsSnmpInterface object.
      • getIpInterfaceByIpAddress

        public OnmsIpInterface getIpInterfaceByIpAddress​(java.lang.String ipAddress)

        getIpInterfaceByIpAddress

        Parameters:
        ipAddress - a String object.
        Returns:
        a OnmsIpInterface object.
      • getIpInterfaceByIpAddress

        public OnmsIpInterface getIpInterfaceByIpAddress​(java.net.InetAddress ipAddress)

        getIpInterfaceByIpAddress

        Parameters:
        ipAddress - a String object.
        Returns:
        a OnmsIpInterface object.
      • compareTo

        public int compareTo​(OnmsNode o)

        compareTo

        Specified by:
        compareTo in interface java.lang.Comparable<OnmsNode>
        Parameters:
        o - a OnmsNode object.
        Returns:
        a int.
      • getPrimaryInterface

        public OnmsIpInterface getPrimaryInterface()

        getPrimaryInterface

        This function should be kept similar to IpInterfaceDao#findPrimaryInterfaceByNodeId().
        Returns:
        a OnmsIpInterface object.
      • getInterfaceWithService

        public OnmsIpInterface getInterfaceWithService​(java.lang.String svcName)

        getInterfaceWithService

        Parameters:
        svcName - a String object.
        Returns:
        a OnmsIpInterface object.
      • getInterfacesWithService

        public java.util.List<OnmsIpInterface> getInterfacesWithService​(java.lang.String svcName)

        getInterfacesWithService

        Parameters:
        svcName - a String object.
        Returns:
        a List of OnmsIpInterface objects.
      • getInterfaceWithAddress

        public OnmsIpInterface getInterfaceWithAddress​(java.net.InetAddress addr)
      • mergeAgentAttributes

        public void mergeAgentAttributes​(OnmsNode scannedNode)

        mergeAgentAttributes

        Parameters:
        scannedNode - a OnmsNode object.
      • mergeNodeAttributes

        public void mergeNodeAttributes​(OnmsNode scannedNode,
                                        EventForwarder eventForwarder)

        mergeNodeAttributes

        Parameters:
        scannedNode - a OnmsNode object.
      • mergeSnmpInterfaces

        public void mergeSnmpInterfaces​(OnmsNode scannedNode,
                                        boolean deleteMissing)

        mergeSnmpInterfaces

        Parameters:
        scannedNode - a OnmsNode object.
        deleteMissing - a boolean.
      • mergeIpInterfaces

        public void mergeIpInterfaces​(OnmsNode scannedNode,
                                      EventForwarder eventForwarder,
                                      boolean deleteMissing)

        mergeIpInterfaces

        Parameters:
        scannedNode - a OnmsNode object.
        eventForwarder - a EventForwarder object.
        deleteMissing - a boolean.
      • mergeCategorySet

        public void mergeCategorySet​(OnmsNode scannedNode)

        mergeCategorySet

        Parameters:
        scannedNode - a OnmsNode object.
      • mergeAssets

        public void mergeAssets​(OnmsNode scannedNode)
        Truly merges the node's assert record
        Parameters:
        scannedNode - a OnmsNode object.
      • mergeMetaData

        public void mergeMetaData​(OnmsNode scanned)
        Truly merges the node's meta-data
        Parameters:
        scannedNode - a OnmsNode object.
      • replaceCurrentAssetRecord

        public void replaceCurrentAssetRecord​(OnmsNode scannedNode)
        Simply replaces the current asset record with the new record
        Parameters:
        scannedNode - a OnmsNode object.
      • mergeNode

        public void mergeNode​(OnmsNode scannedNode,
                              EventForwarder eventForwarder,
                              boolean deleteMissing)

        mergeNode

        Parameters:
        scannedNode - a OnmsNode object.
        eventForwarder - a EventForwarder object.
        deleteMissing - a boolean.
      • containsService

        public boolean containsService​(java.net.InetAddress addr,
                                       java.lang.String service)
      • containsInterface

        public boolean containsInterface​(java.net.InetAddress addr)