Search in sources :

Example 1 with IsIsLink

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

the class EnLinkdSnmpIT method testIsisISAdjTableWalk.

@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = SIEGFRIE_IP, port = 161, resource = SIEGFRIE_SNMP_RESOURCE) })
public void testIsisISAdjTableWalk() throws Exception {
    final List<IsIsLink> links = new ArrayList<IsIsLink>();
    String trackerName = "isisISAdjTable";
    SnmpAgentConfig config = SnmpPeerFactory.getInstance().getAgentConfig(InetAddress.getByName(SIEGFRIE_IP));
    IsisISAdjTableTracker tracker = new IsisISAdjTableTracker() {

        public void processIsisAdjRow(final IsIsAdjRow row) {
            assertEquals(5, row.getColumnCount());
            links.add(row.getIsisLink());
        }
    };
    try {
        m_client.walk(config, tracker).withDescription(trackerName).withLocation(null).execute().get();
    } catch (final InterruptedException e) {
        LOG.error("run: collection interrupted, exiting", e);
        return;
    }
    assertEquals(2, links.size());
    for (final IsIsLink link : links) {
        assertEquals(1, link.getIsisISAdjIndex().intValue());
        assertEquals(IsisISAdjState.up, link.getIsisISAdjState());
        assertEquals(IsisISAdjNeighSysType.l1_IntermediateSystem, link.getIsisISAdjNeighSysType());
        assertEquals(0, link.getIsisISAdjNbrExtendedCircID().intValue());
        if (link.getIsisCircIndex().intValue() == 533) {
            assertEquals("001f12accbf0", link.getIsisISAdjNeighSNPAAddress());
            assertEquals("000110255062", link.getIsisISAdjNeighSysID());
        } else if (link.getIsisCircIndex().intValue() == 552) {
            assertEquals("0021590e47c2", link.getIsisISAdjNeighSNPAAddress());
            assertEquals("000110088500", link.getIsisISAdjNeighSysID());
        } else {
            assertEquals(true, false);
        }
    }
}
Also used : SnmpAgentConfig(org.opennms.netmgt.snmp.SnmpAgentConfig) IsIsLink(org.opennms.netmgt.model.IsIsLink) ArrayList(java.util.ArrayList) IsisISAdjTableTracker(org.opennms.netmgt.enlinkd.snmp.IsisISAdjTableTracker) Test(org.junit.Test) JUnitSnmpAgents(org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)

Example 2 with IsIsLink

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

the class LinkdEdgeStatusProviderTest method createIsIsLink.

private IsIsLink createIsIsLink(OnmsNode node, int isisCircIndex, int isisCircIfindex, int isisAdjIndex, int isisCircAdmin, String isisIsAdjNeighsnpaadress, String isisisAdjNeighSysid) {
    final IsIsLink isisLink = new IsIsLink();
    isisLink.setNode(node);
    isisLink.setIsisCircIndex(isisCircIndex);
    isisLink.setIsisCircIfIndex(isisCircIfindex);
    isisLink.setIsisISAdjIndex(isisAdjIndex);
    isisLink.setIsisCircAdminState(IsIsElement.IsisAdminState.get(isisCircAdmin));
    isisLink.setIsisISAdjNeighSNPAAddress(isisIsAdjNeighsnpaadress);
    isisLink.setIsisISAdjNeighSysID(isisisAdjNeighSysid);
    return isisLink;
}
Also used : IsIsLink(org.opennms.netmgt.model.IsIsLink)

Example 3 with IsIsLink

use of org.opennms.netmgt.model.IsIsLink 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 4 with IsIsLink

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

the class NodeDiscoveryIsis method runCollection.

protected void runCollection() {
    final Date now = new Date();
    final IsisSysObjectGroupTracker isisSysObject = new IsisSysObjectGroupTracker();
    SnmpAgentConfig peer = m_linkd.getSnmpAgentConfig(getPrimaryIpAddress(), getLocation());
    try {
        m_linkd.getLocationAwareSnmpClient().walk(peer, isisSysObject).withDescription("isisSysObjectCollection").withLocation(getLocation()).execute().get();
    } catch (ExecutionException e) {
        LOG.info("run: node [{}]. Agent error while scanning the isisSysObjectCollection table", getNodeId(), e);
        return;
    } catch (final InterruptedException e) {
        LOG.info("run: node [{}]. Is-Is Linkd node collection interrupted, exiting", getNodeId(), e);
        return;
    }
    if (isisSysObject.getIsisSysId() == null) {
        LOG.info("run: node [{}], address {}. Is-Is mib not supported ", getNodeId(), getPrimaryIpAddressString());
        return;
    }
    m_linkd.getQueryManager().store(getNodeId(), isisSysObject.getIsisElement());
    final List<IsIsLink> links = new ArrayList<IsIsLink>();
    final IsisISAdjTableTracker isisISAdjTableTracker = new IsisISAdjTableTracker() {

        @Override
        public void processIsisAdjRow(IsIsAdjRow row) {
            links.add(row.getIsisLink());
        }
    };
    try {
        m_linkd.getLocationAwareSnmpClient().walk(peer, isisISAdjTableTracker).withDescription("isisISAdjTable").withLocation(getLocation()).execute().get();
    } catch (ExecutionException e) {
        LOG.error("run: node [{}]. Is-Is collection execution failed, exiting", getNodeId(), e);
        return;
    } catch (final InterruptedException e) {
        LOG.error("run: node [{}]. Is-Is collection interrupted, exiting", getNodeId(), e);
        return;
    }
    final IsisCircTableTracker isisCircTableTracker = new IsisCircTableTracker() {

        @Override
        public void processIsisCircRow(IsIsCircRow row) {
            IsIsLink link = row.getIsisLink();
            for (IsIsLink adjlink : links) {
                if (link.getIsisCircIndex().intValue() == adjlink.getIsisCircIndex().intValue()) {
                    adjlink.setIsisCircIfIndex(link.getIsisCircIfIndex());
                    adjlink.setIsisCircAdminState(link.getIsisCircAdminState());
                }
            }
        }
    };
    try {
        m_linkd.getLocationAwareSnmpClient().walk(peer, isisCircTableTracker).withDescription("isisCircTable").withLocation(getLocation()).execute().get();
    } catch (ExecutionException e) {
        LOG.error("run: node [{}]. Is-Is collection execution failed, exiting", getNodeId(), e);
        return;
    } catch (final InterruptedException e) {
        LOG.error("run: node [{}]. Is-Is collection interrupted, exiting", getNodeId(), e);
        return;
    }
    for (IsIsLink link : links) m_linkd.getQueryManager().store(getNodeId(), link);
    m_linkd.getQueryManager().reconcileIsis(getNodeId(), now);
}
Also used : SnmpAgentConfig(org.opennms.netmgt.snmp.SnmpAgentConfig) IsIsLink(org.opennms.netmgt.model.IsIsLink) IsisSysObjectGroupTracker(org.opennms.netmgt.enlinkd.snmp.IsisSysObjectGroupTracker) ArrayList(java.util.ArrayList) IsisCircTableTracker(org.opennms.netmgt.enlinkd.snmp.IsisCircTableTracker) ExecutionException(java.util.concurrent.ExecutionException) IsisISAdjTableTracker(org.opennms.netmgt.enlinkd.snmp.IsisISAdjTableTracker) Date(java.util.Date)

Example 5 with IsIsLink

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

the class LinkdEdgeStatusProviderTest method setUp.

@Before
public void setUp() {
    m_node1 = new OnmsNode();
    m_node1.setId(1);
    m_node2 = new OnmsNode();
    m_node2.setId(2);
    m_node3 = new OnmsNode();
    m_node3.setId(3);
    m_node4 = new OnmsNode();
    m_node4.setId(4);
    m_node5 = new OnmsNode();
    m_node5.setId(5);
    m_nodeDehli = new OnmsNode();
    m_nodeDehli.setId(10);
    m_nodeChennai = new OnmsNode();
    m_nodeChennai.setId(14);
    m_edges = new ArrayList<LinkdEdge>();
    Vertex sourceCloud = new AbstractVertex("nodes", "1", "source");
    // Cloud is identified by the designated bridge and designated port
    Vertex cloud = new AbstractVertex("nodes", "1:48", "cloud");
    Vertex targetCloud1 = new AbstractVertex("nodes", "2", "target1");
    Vertex targetCloud2 = new AbstractVertex("nodes", "3", "target2");
    Vertex source = new AbstractVertex("nodes", "4", "source");
    Vertex target = new AbstractVertex("nodes", "5", "target");
    Vertex dehli = new AbstractVertex("nodes", "10", "dehli");
    Vertex chennai = new AbstractVertex("nodes", "14", "chennai");
    // identification of link is done with targets id..that is port or mac        
    BridgePort bpnode1port48 = new BridgePort();
    bpnode1port48.setNode(m_node1);
    bpnode1port48.setBridgePort(48);
    bpnode1port48.setBridgePortIfIndex(48);
    m_edges.add(connectVertices(bpnode1port48, cloud, sourceCloud, BRIDGE_EDGE_NAMESPACE));
    BridgePort bpnode2port24 = new BridgePort();
    bpnode2port24.setNode(m_node2);
    bpnode2port24.setBridgePort(24);
    bpnode2port24.setBridgePortIfIndex(24);
    m_edges.add(connectVertices(bpnode2port24, cloud, targetCloud1, BRIDGE_EDGE_NAMESPACE));
    m_edges.add(connectCloudMacVertices("a8d0e5a0a467", cloud, targetCloud2, BRIDGE_EDGE_NAMESPACE));
    // isis link
    IsIsLink link1 = createIsIsLink(m_node4, 599, 599, 1, 1, "001f12accbf1", "000110255062");
    link1.setId(104);
    IsIsLink link2 = createIsIsLink(m_node5, 578, 578, 1, 1, "0021590e47c1", "000110088500");
    link2.setId(105);
    m_edges.add(connectVertices(new IsIsLinkDetail(Math.min(link1.getId(), link2.getId()) + "|" + Math.max(link1.getId(), link2.getId()), source, link1.getId(), link1.getIsisCircIfIndex(), target, link2.getId(), link2.getIsisCircIfIndex()), ISIS_EDGE_NAMESPACE));
    // lldp link
    LldpLink link3 = new LldpLink(m_node4, 12, 1, "node4PortId", "node4PortDescr", LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, "node4ChassisId", "node4SysName", LldpChassisIdSubType.LLDP_CHASSISID_SUBTYPE_LOCAL, "node4PortId", LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, "node2PortDescr");
    link3.setId(204);
    LldpLink link4 = new LldpLink(m_node5, 21, 2, "node5PortId", "node5PortDescr", LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, "node5ChassisId", "node5SysName", LldpChassisIdSubType.LLDP_CHASSISID_SUBTYPE_LOCAL, "node5PortId", LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, "node1PortDescr");
    link4.setId(205);
    m_edges.add(connectVertices(new LldpLinkDetail(Math.min(link3.getId(), link4.getId()) + "|" + Math.max(link3.getId(), link4.getId()), source, link3, target, link4), LLDP_EDGE_NAMESPACE));
    //ospf link
    OspfLink link5 = createOspfLink(m_node4, "192.168.100.246", "255.255.255.252", 0, 10101, "192.168.100.249", "192.168.100.245", 0);
    link5.setId(404);
    OspfLink link6 = createOspfLink(m_node5, "192.168.100.245", "255.255.255.252", 0, 10100, "192.168.100.250", "192.168.100.246", 0);
    link6.setId(405);
    m_edges.add(connectVertices(new OspfLinkDetail(Math.min(link5.getId(), link6.getId()) + "|" + Math.max(link5.getId(), link6.getId()), source, link5, target, link6), OSPF_EDGE_NAMESPACE));
    //cdp link
    LinkdEdge edgeG = new LinkdEdge(EnhancedLinkdTopologyProvider.CDP_EDGE_NAMESPACE, "504|505", source, target);
    edgeG.setSourceNodeid(m_node4.getId());
    edgeG.setTargetNodeid(m_node5.getId());
    edgeG.setSourceEndPoint("101");
    edgeG.setTargetEndPoint("100");
    m_edges.add(edgeG);
    // another ospf link
    LinkdEdge edgeChennaiTodehli = new LinkdEdge(EnhancedLinkdTopologyProvider.OSPF_EDGE_NAMESPACE, "310|314", dehli, chennai);
    edgeChennaiTodehli.setSourceNodeid(m_nodeDehli.getId());
    edgeChennaiTodehli.setTargetNodeid(m_nodeChennai.getId());
    edgeChennaiTodehli.setSourceEndPoint("13");
    edgeChennaiTodehli.setTargetEndPoint("13");
    m_edges.add(edgeChennaiTodehli);
    m_alarmDao = EasyMock.createMock(AlarmDao.class);
    m_edgeProvider = EasyMock.createMock(EdgeProvider.class);
    m_statusProvider = new LinkdEdgeStatusProvider();
    m_statusProvider.setAlarmDao(m_alarmDao);
}
Also used : Vertex(org.opennms.features.topology.api.topo.Vertex) AbstractVertex(org.opennms.features.topology.api.topo.AbstractVertex) BridgePort(org.opennms.netmgt.model.topology.BridgePort) IsIsLink(org.opennms.netmgt.model.IsIsLink) OnmsNode(org.opennms.netmgt.model.OnmsNode) LldpLink(org.opennms.netmgt.model.LldpLink) EdgeProvider(org.opennms.features.topology.api.topo.EdgeProvider) AlarmDao(org.opennms.netmgt.dao.api.AlarmDao) AbstractVertex(org.opennms.features.topology.api.topo.AbstractVertex) OspfLink(org.opennms.netmgt.model.OspfLink) Before(org.junit.Before)

Aggregations

IsIsLink (org.opennms.netmgt.model.IsIsLink)9 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 JUnitSnmpAgents (org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)4 OnmsNode (org.opennms.netmgt.model.OnmsNode)3 SnmpAgentConfig (org.opennms.netmgt.snmp.SnmpAgentConfig)3 IsisCircTableTracker (org.opennms.netmgt.enlinkd.snmp.IsisCircTableTracker)2 IsisISAdjTableTracker (org.opennms.netmgt.enlinkd.snmp.IsisISAdjTableTracker)2 Date (java.util.Date)1 ExecutionException (java.util.concurrent.ExecutionException)1 Before (org.junit.Before)1 AbstractVertex (org.opennms.features.topology.api.topo.AbstractVertex)1 EdgeProvider (org.opennms.features.topology.api.topo.EdgeProvider)1 Vertex (org.opennms.features.topology.api.topo.Vertex)1 AlarmDao (org.opennms.netmgt.dao.api.AlarmDao)1 IsisSysObjectGroupTracker (org.opennms.netmgt.enlinkd.snmp.IsisSysObjectGroupTracker)1 IsIsElement (org.opennms.netmgt.model.IsIsElement)1 LldpLink (org.opennms.netmgt.model.LldpLink)1 OnmsSnmpInterface (org.opennms.netmgt.model.OnmsSnmpInterface)1 OspfLink (org.opennms.netmgt.model.OspfLink)1