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