use of org.opennms.netmgt.model.topology.BroadcastDomain in project opennms by OpenNMS.
the class BridgeTopologyDaoInMemory method clean.
@Override
public synchronized void clean() {
Set<BroadcastDomain> empties = new HashSet<BroadcastDomain>();
for (BroadcastDomain domain : m_domains) {
if (domain.isEmpty())
empties.add(domain);
}
m_domains.removeAll(empties);
}
use of org.opennms.netmgt.model.topology.BroadcastDomain in project opennms by OpenNMS.
the class BroadcastDomainTest method testOneBridgeComplete.
@Test
public void testOneBridgeComplete() throws Exception {
OneBridgeCompleteTopology topology = new OneBridgeCompleteTopology();
BroadcastDomain domain = new BroadcastDomain();
domain.addBridge(new Bridge(topology.nodeAId));
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.calculate();
assertEquals(topology.nodeAId.intValue(), domain.getRootBridge().getId().intValue());
topology.check(ndbt.getDomain());
}
use of org.opennms.netmgt.model.topology.BroadcastDomain in project opennms by OpenNMS.
the class BroadcastDomainTest method testABC.
@Test
public void testABC() {
ABCTopology topology = new ABCTopology();
BroadcastDomain domain = new BroadcastDomain();
domain.addBridge(new Bridge(topology.nodeAId));
domain.addBridge(new Bridge(topology.nodeBId));
domain.addBridge(new Bridge(topology.nodeCId));
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.addUpdatedBFT(domain.getBridge(topology.nodeCId), topology.bftC);
ndbt.calculate();
topology.check(ndbt.getDomain());
}
use of org.opennms.netmgt.model.topology.BroadcastDomain in project opennms by OpenNMS.
the class BroadcastDomainTest method testCleanTopologyRoot.
@Test
public void testCleanTopologyRoot() {
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.nodeAId);
assertEquals(5, domain.getMacsOnDomain().size());
assertEquals(topology.nodeBId.intValue(), domain.getRootBridge().getId().intValue());
assertEquals(2, domain.getTopology().size());
for (SharedSegment segment : domain.getTopology()) {
assertEquals(0, segment.getBridgeBridgeLinks().size());
assertEquals(1, segment.getBridgeIdsOnSegment().size());
assertEquals(topology.nodeBId.intValue(), segment.getBridgeIdsOnSegment().iterator().next().intValue());
if (segment.containsMac(topology.macA11) && segment.containsMac(topology.macA12) && segment.containsMac(topology.macAB)) {
assertEquals(3, segment.getMacsOnSegment().size());
assertEquals(3, segment.getBridgeMacLinks().size());
for (BridgeMacLink link : segment.getBridgeMacLinks()) {
assertEquals(topology.portBA.intValue(), link.getBridgePort().intValue());
}
} else if (segment.containsMac(topology.macB21) && segment.containsMac(topology.macB22)) {
assertEquals(2, segment.getMacsOnSegment().size());
assertEquals(2, segment.getBridgeMacLinks().size());
for (BridgeMacLink link : segment.getBridgeMacLinks()) {
assertEquals(topology.portB2.intValue(), link.getBridgePort().intValue());
}
} else {
assertEquals(true, false);
}
}
}
use of org.opennms.netmgt.model.topology.BroadcastDomain in project opennms by OpenNMS.
the class BroadcastDomainTest method testTwoBridgeWithBackbonePorts.
@Test
public void testTwoBridgeWithBackbonePorts() {
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();
assertEquals(topology.nodeAId.intValue(), domain.getRootBridge().getId().intValue());
topology.check(ndbt.getDomain());
}
Aggregations