Search in sources :

Example 51 with BroadcastDomain

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

the class BroadcastDomainTest method testTwoBridgeTwoCalculationReverse.

@Test
public void testTwoBridgeTwoCalculationReverse() {
    TwoNodeTopology topology = new TwoNodeTopology();
    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();
    List<SharedSegment> shsegs = ndbt.getDomain().getTopology();
    assertEquals(3, shsegs.size());
    domain.addBridge(new Bridge(topology.nodeBId));
    domain.setBridgeElements(topology.elemlist);
    ndbt.addUpdatedBFT(domain.getBridge(topology.nodeBId), topology.bftB);
    ndbt.calculate();
    topology.check2nodeTopology(ndbt.getDomain(), false);
    assertEquals(topology.nodeAId, domain.getRootBridgeId());
}
Also used : BroadcastDomain(org.opennms.netmgt.model.topology.BroadcastDomain) SharedSegment(org.opennms.netmgt.model.topology.SharedSegment) Bridge(org.opennms.netmgt.model.topology.Bridge) Test(org.junit.Test)

Example 52 with BroadcastDomain

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

the class BroadcastDomainTest method testFiveSwitchTopologyEDCBA.

@Test
public void testFiveSwitchTopologyEDCBA() {
    FiveSwitchTopology topology = new FiveSwitchTopology();
    BroadcastDomain domain = new BroadcastDomain();
    domain.addBridge(new Bridge(topology.nodeAId));
    domain.addBridge(new Bridge(topology.nodeBId));
    domain.addBridge(new Bridge(topology.nodeCId));
    domain.addBridge(new Bridge(topology.nodeDId));
    domain.addBridge(new Bridge(topology.nodeEId));
    domain.setBridgeElements(topology.elemlist);
    NodeDiscoveryBridgeTopology ndbtE = new NodeDiscoveryBridgeTopology(linkd, new Node(topology.nodeEId, null, null, null, location));
    ndbtE.setDomain(domain);
    ndbtE.addUpdatedBFT(domain.getBridge(topology.nodeEId), topology.bftE);
    ndbtE.calculate();
    NodeDiscoveryBridgeTopology ndbtD = new NodeDiscoveryBridgeTopology(linkd, new Node(topology.nodeDId, null, null, null, location));
    ndbtD.setDomain(domain);
    ndbtD.addUpdatedBFT(domain.getBridge(topology.nodeDId), topology.bftD);
    ndbtD.calculate();
    NodeDiscoveryBridgeTopology ndbtC = new NodeDiscoveryBridgeTopology(linkd, new Node(topology.nodeCId, null, null, null, location));
    ndbtC.setDomain(domain);
    ndbtC.addUpdatedBFT(domain.getBridge(topology.nodeCId), topology.bftC);
    ndbtC.calculate();
    NodeDiscoveryBridgeTopology ndbtB = new NodeDiscoveryBridgeTopology(linkd, new Node(topology.nodeBId, null, null, null, location));
    ndbtB.setDomain(domain);
    ndbtB.addUpdatedBFT(domain.getBridge(topology.nodeBId), topology.bftB);
    ndbtB.calculate();
    NodeDiscoveryBridgeTopology ndbtA = new NodeDiscoveryBridgeTopology(linkd, new Node(topology.nodeAId, null, null, null, location));
    ndbtA.setDomain(domain);
    ndbtA.addUpdatedBFT(domain.getBridge(topology.nodeAId), topology.bftA);
    ndbtA.calculate();
    Bridge bridgeB = domain.getBridge(topology.nodeBId);
    domain.hierarchySetUp(bridgeB);
    topology.check(domain);
}
Also used : BroadcastDomain(org.opennms.netmgt.model.topology.BroadcastDomain) Bridge(org.opennms.netmgt.model.topology.Bridge) Test(org.junit.Test)

Example 53 with BroadcastDomain

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

the class BroadcastDomainTest method testBThenCA.

@Test
public void testBThenCA() {
    ABCTopology topology = new ABCTopology();
    BroadcastDomain domain = new BroadcastDomain();
    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.nodeBId), topology.bftB);
    ndbt.calculate();
    domain.addBridge(new Bridge(topology.nodeCId));
    domain.addBridge(new Bridge(topology.nodeAId));
    domain.setBridgeElements(topology.elemlist);
    ndbt.addUpdatedBFT(domain.getBridge(topology.nodeCId), topology.bftC);
    ndbt.addUpdatedBFT(domain.getBridge(topology.nodeAId), topology.bftA);
    ndbt.calculate();
    domain.hierarchySetUp(domain.getBridge(topology.nodeAId));
    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 54 with BroadcastDomain

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

the class BroadcastDomainTest method testFiveSwitchTopologyBCADE.

@Test
public void testFiveSwitchTopologyBCADE() {
    FiveSwitchTopology topology = new FiveSwitchTopology();
    BroadcastDomain domain = new BroadcastDomain();
    domain.addBridge(new Bridge(topology.nodeAId));
    domain.addBridge(new Bridge(topology.nodeBId));
    domain.addBridge(new Bridge(topology.nodeCId));
    domain.addBridge(new Bridge(topology.nodeDId));
    domain.addBridge(new Bridge(topology.nodeEId));
    domain.setBridgeElements(topology.elemlist);
    NodeDiscoveryBridgeTopology ndbtB = new NodeDiscoveryBridgeTopology(linkd, new Node(topology.nodeBId, null, null, null, location));
    ndbtB.setDomain(domain);
    ndbtB.addUpdatedBFT(domain.getBridge(topology.nodeBId), topology.bftB);
    ndbtB.calculate();
    NodeDiscoveryBridgeTopology ndbtC = new NodeDiscoveryBridgeTopology(linkd, new Node(topology.nodeCId, null, null, null, location));
    ndbtC.setDomain(domain);
    ndbtC.addUpdatedBFT(domain.getBridge(topology.nodeCId), topology.bftC);
    ndbtC.calculate();
    NodeDiscoveryBridgeTopology ndbtA = new NodeDiscoveryBridgeTopology(linkd, new Node(topology.nodeAId, null, null, null, location));
    ndbtA.setDomain(domain);
    ndbtA.addUpdatedBFT(domain.getBridge(topology.nodeAId), topology.bftA);
    ndbtA.calculate();
    NodeDiscoveryBridgeTopology ndbtD = new NodeDiscoveryBridgeTopology(linkd, new Node(topology.nodeDId, null, null, null, location));
    ndbtD.setDomain(domain);
    ndbtD.addUpdatedBFT(domain.getBridge(topology.nodeDId), topology.bftD);
    ndbtD.calculate();
    NodeDiscoveryBridgeTopology ndbtE = new NodeDiscoveryBridgeTopology(linkd, new Node(topology.nodeEId, null, null, null, location));
    ndbtE.setDomain(domain);
    ndbtE.addUpdatedBFT(domain.getBridge(topology.nodeEId), topology.bftE);
    ndbtE.calculate();
    topology.check(domain);
}
Also used : BroadcastDomain(org.opennms.netmgt.model.topology.BroadcastDomain) Bridge(org.opennms.netmgt.model.topology.Bridge) Test(org.junit.Test)

Example 55 with BroadcastDomain

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

the class EnLinkdIT method testLoadFourLevelTopology.

/*
     * 1400=
     *      [1544, 1534]
     *             1534=
     *                   [1364, 405, 1310]}
     *                    1364=
     *                          [2965, 5022]
     */
@Test
public void testLoadFourLevelTopology() {
    final OnmsMonitoringLocation location = new OnmsMonitoringLocation(MonitoringLocationDao.DEFAULT_MONITORING_LOCATION_ID, MonitoringLocationDao.DEFAULT_MONITORING_LOCATION_ID);
    OnmsNode lnode1400 = new OnmsNode();
    lnode1400.setId(1400);
    lnode1400.setForeignSource("linkd");
    lnode1400.setForeignId("lnode1400");
    lnode1400.setLabel("lnode1400");
    lnode1400.setLocation(location);
    OnmsNode lnode1544 = new OnmsNode();
    lnode1544.setId(1544);
    lnode1544.setForeignSource("linkd");
    lnode1544.setForeignId("lnode1544");
    lnode1544.setLabel("lnode1544");
    lnode1544.setLocation(location);
    OnmsNode lnode1534 = new OnmsNode();
    lnode1534.setId(1534);
    lnode1534.setForeignSource("linkd");
    lnode1534.setForeignId("lnode1534");
    lnode1534.setLabel("lnode1534");
    lnode1534.setLocation(location);
    OnmsNode lnode1364 = new OnmsNode();
    lnode1364.setId(1364);
    lnode1364.setForeignSource("linkd");
    lnode1364.setForeignId("lnode1364");
    lnode1364.setLabel("lnode1364");
    lnode1364.setLocation(location);
    OnmsNode lnode1310 = new OnmsNode();
    lnode1310.setId(1310);
    lnode1310.setForeignSource("linkd");
    lnode1310.setForeignId("lnode1310");
    lnode1310.setLabel("lnode1310");
    lnode1310.setLocation(location);
    OnmsNode lnode405 = new OnmsNode();
    lnode405.setId(405);
    lnode405.setForeignSource("linkd");
    lnode405.setForeignId("lnode405");
    lnode405.setLabel("lnode405");
    lnode405.setLocation(location);
    OnmsNode lnode2965 = new OnmsNode();
    lnode2965.setId(2965);
    lnode2965.setForeignSource("linkd");
    lnode2965.setForeignId("lnode2965");
    lnode2965.setLabel("lnode2965");
    lnode2965.setLocation(location);
    OnmsNode lnode5022 = new OnmsNode();
    lnode5022.setId(5022);
    lnode5022.setForeignSource("linkd");
    lnode5022.setForeignId("lnode5022");
    lnode5022.setLabel("lnode5022");
    lnode5022.setLocation(location);
    m_nodeDao.save(lnode1400);
    m_nodeDao.save(lnode1544);
    m_nodeDao.save(lnode1534);
    m_nodeDao.save(lnode1364);
    m_nodeDao.save(lnode1310);
    m_nodeDao.save(lnode405);
    m_nodeDao.save(lnode2965);
    m_nodeDao.save(lnode5022);
    OnmsNode node1400 = m_nodeDao.findByForeignId("linkd", "lnode1400");
    OnmsNode node1544 = m_nodeDao.findByForeignId("linkd", "lnode1544");
    OnmsNode node1534 = m_nodeDao.findByForeignId("linkd", "lnode1534");
    OnmsNode node1364 = m_nodeDao.findByForeignId("linkd", "lnode1364");
    OnmsNode node1310 = m_nodeDao.findByForeignId("linkd", "lnode1310");
    OnmsNode node405 = m_nodeDao.findByForeignId("linkd", "lnode405");
    OnmsNode node2965 = m_nodeDao.findByForeignId("linkd", "lnode2965");
    OnmsNode node5022 = m_nodeDao.findByForeignId("linkd", "lnode5022");
    BridgeBridgeLink link7 = new BridgeBridgeLink();
    link7.setNode(node5022);
    link7.setBridgePort(4);
    link7.setDesignatedNode(node2965);
    link7.setDesignatedPort(5);
    link7.setBridgeBridgeLinkLastPollTime(link7.getBridgeBridgeLinkCreateTime());
    m_bridgeBridgeLinkDao.save(link7);
    m_bridgeBridgeLinkDao.flush();
    BridgeBridgeLink link1 = new BridgeBridgeLink();
    link1.setNode(node1544);
    link1.setBridgePort(15);
    link1.setDesignatedNode(node1400);
    link1.setDesignatedPort(1);
    link1.setBridgeBridgeLinkLastPollTime(link1.getBridgeBridgeLinkCreateTime());
    m_bridgeBridgeLinkDao.save(link1);
    m_bridgeBridgeLinkDao.flush();
    BridgeBridgeLink link3 = new BridgeBridgeLink();
    link3.setNode(node1310);
    link3.setBridgePort(1);
    link3.setDesignatedNode(node1534);
    link3.setDesignatedPort(1);
    link3.setBridgeBridgeLinkLastPollTime(link3.getBridgeBridgeLinkCreateTime());
    m_bridgeBridgeLinkDao.save(link3);
    m_bridgeBridgeLinkDao.flush();
    BridgeBridgeLink link4 = new BridgeBridgeLink();
    link4.setNode(node1364);
    link4.setBridgePort(24);
    link4.setDesignatedNode(node1534);
    link4.setDesignatedPort(4);
    link4.setBridgeBridgeLinkLastPollTime(link4.getBridgeBridgeLinkCreateTime());
    m_bridgeBridgeLinkDao.save(link4);
    m_bridgeBridgeLinkDao.flush();
    BridgeBridgeLink link2 = new BridgeBridgeLink();
    link2.setNode(node1534);
    link2.setBridgePort(11);
    link2.setDesignatedNode(node1400);
    link2.setDesignatedPort(11);
    link2.setBridgeBridgeLinkLastPollTime(link2.getBridgeBridgeLinkCreateTime());
    m_bridgeBridgeLinkDao.save(link2);
    m_bridgeBridgeLinkDao.flush();
    BridgeBridgeLink link6 = new BridgeBridgeLink();
    link6.setNode(node2965);
    link6.setBridgePort(2);
    link6.setDesignatedNode(node1364);
    link6.setDesignatedPort(5);
    link6.setBridgeBridgeLinkLastPollTime(link6.getBridgeBridgeLinkCreateTime());
    m_bridgeBridgeLinkDao.save(link6);
    m_bridgeBridgeLinkDao.flush();
    BridgeBridgeLink link5 = new BridgeBridgeLink();
    link5.setNode(node405);
    link5.setBridgePort(1);
    link5.setDesignatedNode(node1534);
    link5.setDesignatedPort(1);
    link5.setBridgeBridgeLinkLastPollTime(link5.getBridgeBridgeLinkCreateTime());
    m_bridgeBridgeLinkDao.save(link5);
    m_bridgeBridgeLinkDao.flush();
    assertEquals(0, m_bridgeMacLinkDao.countAll());
    assertEquals(7, m_bridgeBridgeLinkDao.countAll());
    assertNotNull(m_bridgeTopologyDao);
    m_linkd.getQueryManager().loadBridgeTopology();
    assertEquals(1, m_linkd.getQueryManager().getAllBroadcastDomains().size());
    BroadcastDomain fourlevelDomain = m_linkd.getQueryManager().getAllBroadcastDomains().iterator().next();
    assertEquals(8, fourlevelDomain.getBridgeNodesOnDomain().size());
    System.err.println(fourlevelDomain.printTopology());
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) BroadcastDomain(org.opennms.netmgt.model.topology.BroadcastDomain) BridgeBridgeLink(org.opennms.netmgt.model.BridgeBridgeLink) OnmsMonitoringLocation(org.opennms.netmgt.model.monitoringLocations.OnmsMonitoringLocation) Test(org.junit.Test)

Aggregations

BroadcastDomain (org.opennms.netmgt.model.topology.BroadcastDomain)56 Test (org.junit.Test)48 Bridge (org.opennms.netmgt.model.topology.Bridge)45 BridgeMacLink (org.opennms.netmgt.model.BridgeMacLink)10 BridgeBridgeLink (org.opennms.netmgt.model.BridgeBridgeLink)8 SharedSegment (org.opennms.netmgt.model.topology.SharedSegment)8 OnmsNode (org.opennms.netmgt.model.OnmsNode)5 HashSet (java.util.HashSet)4 ArrayList (java.util.ArrayList)3 NetworkBuilder (org.opennms.netmgt.model.NetworkBuilder)3 Nms10205bNetworkBuilder (org.opennms.netmgt.nb.Nms10205bNetworkBuilder)3 Nms17216NetworkBuilder (org.opennms.netmgt.nb.Nms17216NetworkBuilder)3 List (java.util.List)2 Set (java.util.Set)2 OnmsMonitoringLocation (org.opennms.netmgt.model.monitoringLocations.OnmsMonitoringLocation)2 Date (java.util.Date)1 HashMap (java.util.HashMap)1 CopyOnWriteArraySet (java.util.concurrent.CopyOnWriteArraySet)1 AbstractVertex (org.opennms.features.topology.api.topo.AbstractVertex)1 Vertex (org.opennms.features.topology.api.topo.Vertex)1