Search in sources :

Example 1 with IsIsElement

use of org.opennms.netmgt.model.IsIsElement in project opennms by OpenNMS.

the class EnLinkdSnmpIT method testIsisSysObjectWalk.

@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = SIEGFRIE_IP, port = 161, resource = SIEGFRIE_SNMP_RESOURCE) })
public void testIsisSysObjectWalk() throws Exception {
    String trackerName = "isisSysObject";
    SnmpAgentConfig config = SnmpPeerFactory.getInstance().getAgentConfig(InetAddress.getByName(SIEGFRIE_IP));
    IsisSysObjectGroupTracker tracker = new IsisSysObjectGroupTracker();
    try {
        m_client.walk(config, tracker).withDescription(trackerName).withLocation(null).execute().get();
    } catch (final InterruptedException e) {
        LOG.error("run: collection interrupted, exiting", e);
        return;
    }
    IsIsElement eiA = tracker.getIsisElement();
    System.err.println("Is-Is Sys Id: " + eiA.getIsisSysID());
    System.err.println("Is-Is Sys Admin State: " + IsisAdminState.getTypeString(eiA.getIsisSysAdminState().getValue()));
    assertEquals(SIEGFRIE_ISIS_SYS_ID, eiA.getIsisSysID());
    assertEquals(IsisAdminState.on, eiA.getIsisSysAdminState());
}
Also used : SnmpAgentConfig(org.opennms.netmgt.snmp.SnmpAgentConfig) IsisSysObjectGroupTracker(org.opennms.netmgt.enlinkd.snmp.IsisSysObjectGroupTracker) IsIsElement(org.opennms.netmgt.model.IsIsElement) Test(org.junit.Test) JUnitSnmpAgents(org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)

Example 2 with IsIsElement

use of org.opennms.netmgt.model.IsIsElement in project opennms by OpenNMS.

the class EnLinkdElementFactory method convertFromModel.

@Transactional
@SuppressWarnings("deprecation")
private IsisLinkNode convertFromModel(int nodeid, IsIsLink link) {
    IsisLinkNode linknode = new IsisLinkNode();
    linknode.setIsisCircIfIndex(link.getIsisCircIfIndex());
    linknode.setIsisCircAdminState(IsisAdminState.getTypeString(link.getIsisCircAdminState().getValue()));
    IsIsElement isiselement = m_isisElementDao.findByIsIsSysId(link.getIsisISAdjNeighSysID());
    if (isiselement != null) {
        linknode.setIsisISAdjNeighSysID(getAdjSysIDString(link.getIsisISAdjNeighSysID(), isiselement.getNode().getLabel()));
        linknode.setIsisISAdjUrl(getNodeUrl(isiselement.getNode().getId()));
    } else {
        linknode.setIsisISAdjNeighSysID(link.getIsisISAdjNeighSysID());
    }
    linknode.setIsisISAdjNeighSysType(IsisISAdjNeighSysType.getTypeString(link.getIsisISAdjNeighSysType().getValue()));
    linknode.setIsisISAdjNeighSNPAAddress(link.getIsisISAdjNeighSNPAAddress());
    linknode.setIsisISAdjState(IsisISAdjState.get(link.getIsisISAdjState().getValue()).toString());
    linknode.setIsisISAdjNbrExtendedCircID(link.getIsisISAdjNbrExtendedCircID());
    OnmsSnmpInterface remiface = null;
    if (isiselement != null) {
        IsIsLink adjLink = m_isisLinkDao.get(isiselement.getNode().getId(), link.getIsisISAdjIndex(), link.getIsisCircIndex());
        if (adjLink != null) {
            remiface = m_snmpInterfaceDao.findByNodeIdAndIfIndex(isiselement.getNode().getId(), adjLink.getIsisCircIfIndex());
        }
    }
    if (remiface == null) {
        remiface = getFromPhysAddress(link.getIsisISAdjNeighSNPAAddress());
    }
    if (remiface != null) {
        linknode.setIsisISAdjNeighPort(getPortString(remiface.getIfIndex(), remiface.getIfName(), remiface.getIfAlias()));
        linknode.setIsisISAdjUrl(getSnmpInterfaceUrl(remiface.getNode().getId(), remiface.getIfIndex()));
    } else {
        linknode.setIsisISAdjNeighPort("(Isis IS Adj Index: " + link.getIsisISAdjIndex() + ")");
    }
    linknode.setIsisLinkCreateTime(Util.formatDateToUIString(link.getIsisLinkCreateTime()));
    linknode.setIsisLinkLastPollTime(Util.formatDateToUIString(link.getIsisLinkLastPollTime()));
    return linknode;
}
Also used : IsIsLink(org.opennms.netmgt.model.IsIsLink) IsIsElement(org.opennms.netmgt.model.IsIsElement) OnmsSnmpInterface(org.opennms.netmgt.model.OnmsSnmpInterface) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with IsIsElement

use of org.opennms.netmgt.model.IsIsElement in project opennms by OpenNMS.

the class EnhancedLinkdServiceImpl method store.

@Override
@Transactional
public void store(int nodeId, IsIsElement element) {
    if (element == null)
        return;
    final OnmsNode node = m_nodeDao.get(nodeId);
    if (node == null)
        return;
    IsIsElement dbelement = node.getIsisElement();
    if (dbelement != null) {
        dbelement.merge(element);
        node.setIsisElement(dbelement);
    } else {
        element.setNode(node);
        element.setIsisNodeLastPollTime(element.getIsisNodeCreateTime());
        node.setIsisElement(element);
    }
    m_nodeDao.saveOrUpdate(node);
    m_nodeDao.flush();
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) IsIsElement(org.opennms.netmgt.model.IsIsElement) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with IsIsElement

use of org.opennms.netmgt.model.IsIsElement in project opennms by OpenNMS.

the class IsisSysObjectGroupTracker method getIsisElement.

public IsIsElement getIsisElement() {
    IsIsElement element = new IsIsElement();
    element.setIsisSysID(getIsisSysId());
    element.setIsisSysAdminState(IsisAdminState.get(getIsisSysAdminState()));
    return element;
}
Also used : IsIsElement(org.opennms.netmgt.model.IsIsElement)

Example 5 with IsIsElement

use of org.opennms.netmgt.model.IsIsElement in project opennms by OpenNMS.

the class EnhancedLinkdServiceImpl method reconcileIsis.

@Override
public void reconcileIsis(int nodeId, Date now) {
    IsIsElement element = m_isisElementDao.findByNodeId(nodeId);
    if (element != null && element.getIsisNodeLastPollTime().getTime() < now.getTime()) {
        m_isisElementDao.delete(element);
        m_isisElementDao.flush();
    }
    m_isisLinkDao.deleteByNodeIdOlderThen(nodeId, now);
    m_isisLinkDao.flush();
}
Also used : IsIsElement(org.opennms.netmgt.model.IsIsElement)

Aggregations

IsIsElement (org.opennms.netmgt.model.IsIsElement)5 Transactional (org.springframework.transaction.annotation.Transactional)2 Test (org.junit.Test)1 JUnitSnmpAgents (org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)1 IsisSysObjectGroupTracker (org.opennms.netmgt.enlinkd.snmp.IsisSysObjectGroupTracker)1 IsIsLink (org.opennms.netmgt.model.IsIsLink)1 OnmsNode (org.opennms.netmgt.model.OnmsNode)1 OnmsSnmpInterface (org.opennms.netmgt.model.OnmsSnmpInterface)1 SnmpAgentConfig (org.opennms.netmgt.snmp.SnmpAgentConfig)1