Search in sources :

Example 1 with BridgeMacLink

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

the class SharedSegment method getBridgeMacLink.

private BridgeMacLink getBridgeMacLink(BridgePort bp, String mac) {
    BridgeMacLink maclink = new BridgeMacLink();
    maclink.setNode(bp.getNode());
    maclink.setBridgePort(bp.getBridgePort());
    maclink.setBridgePortIfIndex(bp.getBridgePortIfIndex());
    maclink.setBridgePortIfName(bp.getBridgePortIfName());
    maclink.setMacAddress(mac);
    maclink.setBridgeDot1qTpFdbStatus(BridgeDot1qTpFdbStatus.DOT1D_TP_FDB_STATUS_LEARNED);
    maclink.setVlan(bp.getVlan());
    maclink.setBridgeMacLinkCreateTime(bp.getCreateTime());
    maclink.setBridgeMacLinkLastPollTime(bp.getPollTime());
    return maclink;
}
Also used : BridgeMacLink(org.opennms.netmgt.model.BridgeMacLink)

Example 2 with BridgeMacLink

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

the class SharedSegment method printTopology.

public String printTopology() {
    StringBuffer strbfr = new StringBuffer();
    strbfr.append("segment:[bridges:");
    strbfr.append(getBridgeIdsOnSegment());
    strbfr.append(", designated bridge:[");
    strbfr.append(getDesignatedBridge());
    strbfr.append("], designated port:");
    strbfr.append(getDesignatedPort());
    strbfr.append(", macs:");
    strbfr.append(getMacsOnSegment());
    strbfr.append("]\n");
    for (BridgeBridgeLink blink : getBridgeBridgeLinks()) strbfr.append(blink.printTopology());
    for (BridgeMacLink mlink : getBridgeMacLinks()) strbfr.append(mlink.printTopology());
    return strbfr.toString();
}
Also used : BridgeBridgeLink(org.opennms.netmgt.model.BridgeBridgeLink) BridgeMacLink(org.opennms.netmgt.model.BridgeMacLink)

Example 3 with BridgeMacLink

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

the class EnLinkdTestHelper method addBridgeForwardingTableEntry.

public List<BridgeMacLink> addBridgeForwardingTableEntry(OnmsNode node, Integer bridgeport, String mac, List<BridgeMacLink> bft) {
    BridgeMacLink link = new BridgeMacLink();
    link.setNode(node);
    link.setBridgePort(bridgeport);
    link.setMacAddress(mac);
    link.setBridgeDot1qTpFdbStatus(BridgeDot1qTpFdbStatus.DOT1D_TP_FDB_STATUS_LEARNED);
    bft.add(link);
    return bft;
}
Also used : BridgeMacLink(org.opennms.netmgt.model.BridgeMacLink)

Example 4 with BridgeMacLink

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

the class EnLinkdSnmpIT method testDot1dTpFdbTableWalk.

@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = DLINK1_IP, port = 161, resource = DLINK1_SNMP_RESOURCE) })
public void testDot1dTpFdbTableWalk() throws Exception {
    String trackerName = "dot1dTpFdbTable";
    final List<BridgeMacLink> links = new ArrayList<BridgeMacLink>();
    SnmpAgentConfig config = SnmpPeerFactory.getInstance().getAgentConfig(InetAddress.getByName(DLINK1_IP));
    Dot1dTpFdbTableTracker tracker = new Dot1dTpFdbTableTracker() {

        @Override
        public void processDot1dTpFdbRow(final Dot1dTpFdbRow row) {
            links.add(row.getLink());
        }
    };
    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(17, links.size());
    for (BridgeMacLink link : links) {
        assertEquals(BridgeDot1qTpFdbStatus.DOT1D_TP_FDB_STATUS_LEARNED, link.getBridgeDot1qTpFdbStatus());
        System.out.println(link.getMacAddress());
        if (link.getMacAddress().equals("000c29dcc076")) {
            assertEquals(24, link.getBridgePort().intValue());
        } else if (link.getMacAddress().equals("000ffeb10d1e")) {
            assertEquals(6, link.getBridgePort().intValue());
        } else if (link.getMacAddress().equals("000ffeb10e26")) {
            assertEquals(6, link.getBridgePort().intValue());
        } else if (link.getMacAddress().equals("001a4b802790")) {
            assertEquals(6, link.getBridgePort().intValue());
        } else if (link.getMacAddress().equals("001d6004acbc")) {
            assertEquals(6, link.getBridgePort().intValue());
        } else if (link.getMacAddress().equals("001e58865d0f")) {
            assertEquals(6, link.getBridgePort().intValue());
        } else if (link.getMacAddress().equals("0021913b5108")) {
            assertEquals(6, link.getBridgePort().intValue());
        } else if (link.getMacAddress().equals("002401ad3416")) {
            assertEquals(6, link.getBridgePort().intValue());
        } else if (link.getMacAddress().equals("00248c4c8bd0")) {
            assertEquals(6, link.getBridgePort().intValue());
        } else if (link.getMacAddress().equals("0024d608693e")) {
            assertEquals(6, link.getBridgePort().intValue());
        } else if (link.getMacAddress().equals("000ffeb10d1e")) {
            assertEquals(6, link.getBridgePort().intValue());
        } else if (link.getMacAddress().equals("1caff737cc33")) {
            assertEquals(6, link.getBridgePort().intValue());
        } else if (link.getMacAddress().equals("1caff7443339")) {
            assertEquals(6, link.getBridgePort().intValue());
        } else if (link.getMacAddress().equals("1cbdb9b56160")) {
            assertEquals(6, link.getBridgePort().intValue());
        } else if (link.getMacAddress().equals("5cd998667abb")) {
            assertEquals(6, link.getBridgePort().intValue());
        } else if (link.getMacAddress().equals("e0cb4e3e7fc0")) {
            assertEquals(6, link.getBridgePort().intValue());
        } else if (link.getMacAddress().equals("f07d68711f89")) {
            assertEquals(24, link.getBridgePort().intValue());
        } else if (link.getMacAddress().equals("f07d6876c565")) {
            assertEquals(24, link.getBridgePort().intValue());
        } else {
            assertEquals(false, true);
        }
    }
}
Also used : SnmpAgentConfig(org.opennms.netmgt.snmp.SnmpAgentConfig) ArrayList(java.util.ArrayList) Dot1dTpFdbTableTracker(org.opennms.netmgt.enlinkd.snmp.Dot1dTpFdbTableTracker) BridgeMacLink(org.opennms.netmgt.model.BridgeMacLink) Test(org.junit.Test) JUnitSnmpAgents(org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)

Example 5 with BridgeMacLink

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

the class Nms7918EnIT method testNms7918SAMASW01BftCollection.

@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = SAMASW01_IP, port = 161, resource = SAMASW01_SNMP_RESOURCE) })
public void testNms7918SAMASW01BftCollection() throws Exception {
    final OnmsNode samasw01 = m_nodeDao.findByForeignId("linkd", SAMASW01_NAME);
    m_linkdConfig.getConfiguration().setUseBridgeDiscovery(true);
    m_linkdConfig.getConfiguration().setUseCdpDiscovery(false);
    m_linkdConfig.getConfiguration().setUseOspfDiscovery(false);
    m_linkdConfig.getConfiguration().setUseLldpDiscovery(false);
    m_linkdConfig.getConfiguration().setUseIsisDiscovery(false);
    assertTrue(!m_linkdConfig.useLldpDiscovery());
    assertTrue(!m_linkdConfig.useCdpDiscovery());
    assertTrue(!m_linkdConfig.useOspfDiscovery());
    assertTrue(m_linkdConfig.useBridgeDiscovery());
    assertTrue(!m_linkdConfig.useIsisDiscovery());
    assertTrue(m_linkd.scheduleNodeCollection(samasw01.getId()));
    assertEquals(0, m_bridgeBridgeLinkDao.countAll());
    assertEquals(0, m_bridgeMacLinkDao.countAll());
    assertTrue(m_linkd.runSingleSnmpCollection(samasw01.getId()));
    assertEquals(0, m_bridgeBridgeLinkDao.countAll());
    assertEquals(0, m_bridgeMacLinkDao.countAll());
    List<BridgeMacLink> links = m_linkd.getQueryManager().useBridgeTopologyUpdateBFT(samasw01.getId());
    assertEquals(31, links.size());
    for (BridgeMacLink link : links) {
        System.err.println(link.printTopology());
    }
    assertTrue(m_linkd.runTopologyDiscovery(samasw01.getId()));
    assertEquals(0, m_bridgeBridgeLinkDao.countAll());
    assertEquals(0, m_bridgeMacLinkDao.countAll());
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) BridgeMacLink(org.opennms.netmgt.model.BridgeMacLink) Test(org.junit.Test) JUnitSnmpAgents(org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)

Aggregations

BridgeMacLink (org.opennms.netmgt.model.BridgeMacLink)42 Test (org.junit.Test)15 OnmsNode (org.opennms.netmgt.model.OnmsNode)13 BridgeBridgeLink (org.opennms.netmgt.model.BridgeBridgeLink)12 SharedSegment (org.opennms.netmgt.model.topology.SharedSegment)10 ArrayList (java.util.ArrayList)9 HashSet (java.util.HashSet)9 BroadcastDomain (org.opennms.netmgt.model.topology.BroadcastDomain)9 JUnitSnmpAgents (org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)8 HashMap (java.util.HashMap)7 Bridge (org.opennms.netmgt.model.topology.Bridge)6 List (java.util.List)4 Date (java.util.Date)3 NetworkBuilder (org.opennms.netmgt.model.NetworkBuilder)3 OnmsIpInterface (org.opennms.netmgt.model.OnmsIpInterface)3 BridgePort (org.opennms.netmgt.model.topology.BridgePort)3 Nms10205bNetworkBuilder (org.opennms.netmgt.nb.Nms10205bNetworkBuilder)3 Nms17216NetworkBuilder (org.opennms.netmgt.nb.Nms17216NetworkBuilder)3 InetAddress (java.net.InetAddress)2 Set (java.util.Set)2