use of org.opennms.netmgt.model.BridgeMacLink in project opennms by OpenNMS.
the class BroadcastDomainTest method testCleanTopology.
@Test
public void testCleanTopology() {
TwoBridgeWithBackbonePortsTopology topology = new TwoBridgeWithBackbonePortsTopology();
BroadcastDomain domain = new BroadcastDomain();
domain.addBridge(new Bridge(topology.nodeAId));
domain.addBridge(new Bridge(topology.nodeBId));
domain.setBridgeElements(topology.elemlist);
NodeDiscoveryBridgeTopology ndbt = new NodeDiscoveryBridgeTopology(linkd, new Node(topology.nodeAId, null, null, null, location));
ndbt.setDomain(domain);
ndbt.addUpdatedBFT(domain.getBridge(topology.nodeAId), topology.bftA);
ndbt.addUpdatedBFT(domain.getBridge(topology.nodeBId), topology.bftB);
ndbt.calculate();
domain.clearTopologyForBridge(topology.nodeBId);
assertEquals(topology.nodeAId.intValue(), domain.getRootBridge().getId().intValue());
assertEquals(2, domain.getTopology().size());
assertEquals(5, domain.getMacsOnDomain().size());
for (SharedSegment segment : domain.getTopology()) {
assertEquals(0, segment.getBridgeBridgeLinks().size());
assertEquals(1, segment.getBridgeIdsOnSegment().size());
assertEquals(topology.nodeAId.intValue(), segment.getBridgeIdsOnSegment().iterator().next().intValue());
if (segment.containsMac(topology.macA11) && segment.containsMac(topology.macA12)) {
assertEquals(2, segment.getMacsOnSegment().size());
assertEquals(2, segment.getBridgeMacLinks().size());
for (BridgeMacLink link : segment.getBridgeMacLinks()) {
assertEquals(topology.portA1.intValue(), link.getBridgePort().intValue());
}
} else if (segment.containsMac(topology.macB21) && segment.containsMac(topology.macB22) && segment.containsMac(topology.macAB)) {
assertEquals(3, segment.getMacsOnSegment().size());
assertEquals(3, segment.getBridgeMacLinks().size());
for (BridgeMacLink link : segment.getBridgeMacLinks()) {
assertEquals(topology.portAB.intValue(), link.getBridgePort().intValue());
}
} else {
assertEquals(true, false);
}
}
}
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 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