Search in sources :

Example 6 with BroadcastDomain

use of org.opennms.netmgt.model.topology.BroadcastDomain in project opennms by OpenNMS.

the class BroadcastDomainTest method testAThenBC.

@Test
public void testAThenBC() {
    ABCTopology topology = new ABCTopology();
    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();
    domain.addBridge(new Bridge(topology.nodeBId));
    domain.addBridge(new Bridge(topology.nodeCId));
    domain.setBridgeElements(topology.elemlist);
    ndbt.addUpdatedBFT(domain.getBridge(topology.nodeBId), topology.bftB);
    ndbt.addUpdatedBFT(domain.getBridge(topology.nodeCId), topology.bftC);
    ndbt.calculate();
    topology.check(ndbt.getDomain());
}
Also used : BroadcastDomain(org.opennms.netmgt.model.topology.BroadcastDomain) Bridge(org.opennms.netmgt.model.topology.Bridge) Test(org.junit.Test)

Example 7 with BroadcastDomain

use of org.opennms.netmgt.model.topology.BroadcastDomain in project opennms by OpenNMS.

the class BroadcastDomainTest method testTwoBridgeWithBackbonePortsUsingBridgeAddressInBft.

@Test
public void testTwoBridgeWithBackbonePortsUsingBridgeAddressInBft() {
    TwoBridgeWithBackbonePortsTopologyWithBridgeinBft topology = new TwoBridgeWithBackbonePortsTopologyWithBridgeinBft();
    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.nodeBId, 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.nodeBId.intValue(), domain.getRootBridge().getId().intValue());
    topology.check(ndbt.getDomain());
}
Also used : BroadcastDomain(org.opennms.netmgt.model.topology.BroadcastDomain) Bridge(org.opennms.netmgt.model.topology.Bridge) Test(org.junit.Test)

Example 8 with BroadcastDomain

use of org.opennms.netmgt.model.topology.BroadcastDomain 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);
        }
    }
}
Also used : BroadcastDomain(org.opennms.netmgt.model.topology.BroadcastDomain) SharedSegment(org.opennms.netmgt.model.topology.SharedSegment) BridgeMacLink(org.opennms.netmgt.model.BridgeMacLink) Bridge(org.opennms.netmgt.model.topology.Bridge) Test(org.junit.Test)

Example 9 with BroadcastDomain

use of org.opennms.netmgt.model.topology.BroadcastDomain in project opennms by OpenNMS.

the class BroadcastDomainTest method testCA.

@Test
public void testCA() {
    ABCTopology topology = new ABCTopology();
    BroadcastDomain domain = new BroadcastDomain();
    domain.addBridge(new Bridge(topology.nodeCId));
    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.nodeCId), topology.bftC);
    ndbt.addUpdatedBFT(domain.getBridge(topology.nodeAId), topology.bftA);
    ndbt.calculate();
    topology.checkAC(ndbt.getDomain());
}
Also used : BroadcastDomain(org.opennms.netmgt.model.topology.BroadcastDomain) Bridge(org.opennms.netmgt.model.topology.Bridge) Test(org.junit.Test)

Example 10 with BroadcastDomain

use of org.opennms.netmgt.model.topology.BroadcastDomain in project opennms by OpenNMS.

the class BroadcastDomainTest method testBAThenC.

@Test
public void testBAThenC() {
    ABCTopology topology = new ABCTopology();
    BroadcastDomain domain = new BroadcastDomain();
    domain.addBridge(new Bridge(topology.nodeBId));
    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.nodeBId), topology.bftB);
    ndbt.addUpdatedBFT(domain.getBridge(topology.nodeAId), topology.bftA);
    ndbt.calculate();
    topology.checkAB(ndbt.getDomain());
    domain.addBridge(new Bridge(topology.nodeCId));
    domain.setBridgeElements(topology.elemlist);
    ndbt.addUpdatedBFT(domain.getBridge(topology.nodeCId), topology.bftC);
    ndbt.calculate();
    topology.check(ndbt.getDomain());
}
Also used : BroadcastDomain(org.opennms.netmgt.model.topology.BroadcastDomain) Bridge(org.opennms.netmgt.model.topology.Bridge) Test(org.junit.Test)

Aggregations

BroadcastDomain (org.opennms.netmgt.model.topology.BroadcastDomain)46 Test (org.junit.Test)39 Bridge (org.opennms.netmgt.model.topology.Bridge)36 BridgeMacLink (org.opennms.netmgt.model.BridgeMacLink)9 SharedSegment (org.opennms.netmgt.model.topology.SharedSegment)7 BridgeBridgeLink (org.opennms.netmgt.model.BridgeBridgeLink)6 OnmsNode (org.opennms.netmgt.model.OnmsNode)4 HashSet (java.util.HashSet)3 NetworkBuilder (org.opennms.netmgt.model.NetworkBuilder)3 Nms10205bNetworkBuilder (org.opennms.netmgt.nb.Nms10205bNetworkBuilder)3 Nms17216NetworkBuilder (org.opennms.netmgt.nb.Nms17216NetworkBuilder)3 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 List (java.util.List)1 Set (java.util.Set)1 AbstractVertex (org.opennms.features.topology.api.topo.AbstractVertex)1 Vertex (org.opennms.features.topology.api.topo.Vertex)1 ReadyRunnable (org.opennms.netmgt.enlinkd.scheduler.ReadyRunnable)1 OnmsIpInterface (org.opennms.netmgt.model.OnmsIpInterface)1 OnmsMonitoringLocation (org.opennms.netmgt.model.monitoringLocations.OnmsMonitoringLocation)1