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());
}
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;
}
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();
}
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;
}
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();
}
Aggregations