Search in sources :

Example 1 with Dot1dBaseTracker

use of org.opennms.netmgt.enlinkd.snmp.Dot1dBaseTracker in project opennms by OpenNMS.

the class NodeDiscoveryBridge method getDot1dBridgeBase.

private BridgeElement getDot1dBridgeBase(SnmpAgentConfig peer) {
    final Dot1dBaseTracker dot1dbase = new Dot1dBaseTracker();
    try {
        m_linkd.getLocationAwareSnmpClient().walk(peer, dot1dbase).withDescription("dot1dbase").withLocation(getLocation()).execute().get();
    } catch (ExecutionException e) {
        LOG.info("run: Agent error while scanning the dot1dbase table", e);
        return null;
    } catch (final InterruptedException e) {
        LOG.error("run: Bridge Linkd node collection interrupted, exiting", e);
        return null;
    }
    BridgeElement bridge = dot1dbase.getBridgeElement();
    if (bridge.getBaseBridgeAddress() == null) {
        LOG.info("run: node [{}]: base bridge address is null. BRIDGE_MIB not supported.", getNodeId());
        return null;
    }
    if (!isValidBridgeAddress(bridge.getBaseBridgeAddress())) {
        LOG.info("run: node [{}]: base bridge address {} is not valid on. BRIDGE_MIB not supported", getNodeId(), dot1dbase.getBridgeAddress());
        return null;
    }
    if (bridge.getBaseNumPorts() == null) {
        LOG.info("run: node [{}]: base bridge address {}: has 0 port active. BRIDGE_MIB not supported", getNodeId(), dot1dbase.getBridgeAddress());
        return null;
    }
    LOG.info("run: bridge {} has is if type {}, on: {}", dot1dbase.getBridgeAddress(), BridgeDot1dBaseType.getTypeString(dot1dbase.getBridgeType()), getNodeId());
    if (bridge.getBaseType() == BridgeDot1dBaseType.DOT1DBASETYPE_SOURCEROUTE_ONLY) {
        LOG.info("run: node [{}]: base bridge address {}: is source route bridge only. BRIDGE_MIB not supported", getNodeId(), dot1dbase.getBridgeAddress());
        return null;
    }
    return bridge;
}
Also used : BridgeElement(org.opennms.netmgt.model.BridgeElement) Dot1dBaseTracker(org.opennms.netmgt.enlinkd.snmp.Dot1dBaseTracker) ExecutionException(java.util.concurrent.ExecutionException)

Example 2 with Dot1dBaseTracker

use of org.opennms.netmgt.enlinkd.snmp.Dot1dBaseTracker in project opennms by OpenNMS.

the class EnLinkdSnmpIT method testDot1dBaseWalk.

@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = DLINK1_IP, port = 161, resource = DLINK1_SNMP_RESOURCE) })
public void testDot1dBaseWalk() throws Exception {
    String trackerName = "dot1dbase";
    SnmpAgentConfig config = SnmpPeerFactory.getInstance().getAgentConfig(InetAddress.getByName(DLINK1_IP));
    Dot1dBaseTracker tracker = new Dot1dBaseTracker();
    try {
        m_client.walk(config, tracker).withDescription(trackerName).withLocation(null).execute().get();
    } catch (final InterruptedException e) {
        LOG.error("run: collection interrupted, exiting", e);
        return;
    }
    final BridgeElement bridge = tracker.getBridgeElement();
    assertEquals("001e58a32fcd", bridge.getBaseBridgeAddress());
    assertEquals(26, bridge.getBaseNumPorts().intValue());
    assertEquals(BridgeDot1dBaseType.DOT1DBASETYPE_TRANSPARENT_ONLY, bridge.getBaseType());
    assertEquals(BridgeDot1dStpProtocolSpecification.DOT1D_STP_PROTOCOL_SPECIFICATION_IEEE8021D, bridge.getStpProtocolSpecification());
    assertEquals(32768, bridge.getStpPriority().intValue());
    assertEquals("0000000000000000", bridge.getStpDesignatedRoot());
    assertEquals(0, bridge.getStpRootCost().intValue());
    assertEquals(0, bridge.getStpRootPort().intValue());
}
Also used : SnmpAgentConfig(org.opennms.netmgt.snmp.SnmpAgentConfig) BridgeElement(org.opennms.netmgt.model.BridgeElement) Dot1dBaseTracker(org.opennms.netmgt.enlinkd.snmp.Dot1dBaseTracker) Test(org.junit.Test) JUnitSnmpAgents(org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)

Aggregations

Dot1dBaseTracker (org.opennms.netmgt.enlinkd.snmp.Dot1dBaseTracker)2 BridgeElement (org.opennms.netmgt.model.BridgeElement)2 ExecutionException (java.util.concurrent.ExecutionException)1 Test (org.junit.Test)1 JUnitSnmpAgents (org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)1 SnmpAgentConfig (org.opennms.netmgt.snmp.SnmpAgentConfig)1