Search in sources :

Example 21 with Status

use of org.opennms.features.topology.api.topo.Status in project opennms by OpenNMS.

the class LinkdEdgeStatusProviderTest method testGetOspfLinkStatusDown.

@Test
public void testGetOspfLinkStatusDown() {
    EasyMock.expect(m_alarmDao.findMatching(EasyMock.anyObject(org.opennms.core.criteria.Criteria.class))).andReturn(createOspfDownAlarm()).anyTimes();
    List<EdgeRef> edges = getEdgeRefs();
    for (EdgeRef ref : edges) EasyMock.expect(m_edgeProvider.getEdge(ref)).andReturn(getEdgeFromRef(ref)).anyTimes();
    EasyMock.replay(m_alarmDao, m_edgeProvider);
    Map<EdgeRef, Status> statusMap = m_statusProvider.getStatusForEdges(m_edgeProvider, edges, new Criteria[0]);
    assertEquals(8, statusMap.size());
    assertEquals(edges.get(0), new ArrayList<EdgeRef>(statusMap.keySet()).get(0));
    assertEquals(statusMap.get(edges.get(0)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(1)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(2)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(3)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(4)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(6)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(7)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(5)).computeStatus(), "down");
}
Also used : Status(org.opennms.features.topology.api.topo.Status) ArrayList(java.util.ArrayList) EdgeRef(org.opennms.features.topology.api.topo.EdgeRef) Test(org.junit.Test)

Example 22 with Status

use of org.opennms.features.topology.api.topo.Status in project opennms by OpenNMS.

the class LinkdEdgeStatusProviderTest method testGetIsisLinkStatusDown.

@Test
public void testGetIsisLinkStatusDown() {
    EasyMock.expect(m_alarmDao.findMatching(EasyMock.anyObject(org.opennms.core.criteria.Criteria.class))).andReturn(createIsIsDownAlarm()).anyTimes();
    List<EdgeRef> edges = getEdgeRefs();
    for (EdgeRef ref : edges) EasyMock.expect(m_edgeProvider.getEdge(ref)).andReturn(getEdgeFromRef(ref)).anyTimes();
    EasyMock.replay(m_alarmDao, m_edgeProvider);
    Map<EdgeRef, Status> statusMap = m_statusProvider.getStatusForEdges(m_edgeProvider, edges, new Criteria[0]);
    assertEquals(8, statusMap.size());
    assertEquals(edges.get(0), new ArrayList<EdgeRef>(statusMap.keySet()).get(0));
    assertEquals(statusMap.get(edges.get(0)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(1)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(2)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(4)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(5)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(6)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(7)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(3)).computeStatus(), "down");
}
Also used : Status(org.opennms.features.topology.api.topo.Status) ArrayList(java.util.ArrayList) EdgeRef(org.opennms.features.topology.api.topo.EdgeRef) Test(org.junit.Test)

Example 23 with Status

use of org.opennms.features.topology.api.topo.Status in project opennms by OpenNMS.

the class LinkdEdgeStatusProviderTest method testGetLldpLinkStatusDown.

@Test
public void testGetLldpLinkStatusDown() {
    EasyMock.expect(m_alarmDao.findMatching(EasyMock.anyObject(org.opennms.core.criteria.Criteria.class))).andReturn(createLldpDownAlarm()).anyTimes();
    List<EdgeRef> edges = getEdgeRefs();
    for (EdgeRef ref : edges) EasyMock.expect(m_edgeProvider.getEdge(ref)).andReturn(getEdgeFromRef(ref)).anyTimes();
    EasyMock.replay(m_alarmDao, m_edgeProvider);
    Map<EdgeRef, Status> statusMap = m_statusProvider.getStatusForEdges(m_edgeProvider, edges, new Criteria[0]);
    assertEquals(8, statusMap.size());
    assertEquals(edges.get(0), new ArrayList<EdgeRef>(statusMap.keySet()).get(0));
    assertEquals(statusMap.get(edges.get(0)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(1)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(2)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(3)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(5)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(6)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(7)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(4)).computeStatus(), "down");
}
Also used : Status(org.opennms.features.topology.api.topo.Status) ArrayList(java.util.ArrayList) EdgeRef(org.opennms.features.topology.api.topo.EdgeRef) Test(org.junit.Test)

Example 24 with Status

use of org.opennms.features.topology.api.topo.Status in project opennms by OpenNMS.

the class LinkdEdgeStatusProviderTest method testGetBridgeLinkStatusOneDown.

@Test
public void testGetBridgeLinkStatusOneDown() {
    EasyMock.expect(m_alarmDao.findMatching(EasyMock.anyObject(org.opennms.core.criteria.Criteria.class))).andReturn(createBridgeDownAlarm()).anyTimes();
    List<EdgeRef> edges = getEdgeRefs();
    for (EdgeRef ref : edges) EasyMock.expect(m_edgeProvider.getEdge(ref)).andReturn(getEdgeFromRef(ref)).anyTimes();
    EasyMock.replay(m_alarmDao, m_edgeProvider);
    Map<EdgeRef, Status> statusMap = m_statusProvider.getStatusForEdges(m_edgeProvider, edges, new Criteria[0]);
    assertEquals(8, statusMap.size());
    assertEquals(edges.get(0), new ArrayList<EdgeRef>(statusMap.keySet()).get(0));
    assertEquals(statusMap.get(edges.get(0)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(2)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(3)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(4)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(5)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(6)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(7)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(1)).computeStatus(), "down");
}
Also used : Status(org.opennms.features.topology.api.topo.Status) ArrayList(java.util.ArrayList) EdgeRef(org.opennms.features.topology.api.topo.EdgeRef) Test(org.junit.Test)

Example 25 with Status

use of org.opennms.features.topology.api.topo.Status in project opennms by OpenNMS.

the class LinkdEdgeStatusProviderTest method testGetBridgeLinkStatusDesignatedCloudDown.

@Test
public void testGetBridgeLinkStatusDesignatedCloudDown() {
    EasyMock.expect(m_alarmDao.findMatching(EasyMock.anyObject(org.opennms.core.criteria.Criteria.class))).andReturn(createCloudDownAlarm()).anyTimes();
    List<EdgeRef> edges = getEdgeRefs();
    for (EdgeRef ref : edges) EasyMock.expect(m_edgeProvider.getEdge(ref)).andReturn(getEdgeFromRef(ref)).anyTimes();
    EasyMock.replay(m_alarmDao, m_edgeProvider);
    Map<EdgeRef, Status> statusMap = m_statusProvider.getStatusForEdges(m_edgeProvider, edges, new Criteria[0]);
    assertEquals(8, statusMap.size());
    assertEquals(edges.get(0), new ArrayList<EdgeRef>(statusMap.keySet()).get(0));
    assertEquals(statusMap.get(edges.get(1)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(2)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(3)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(4)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(5)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(6)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(7)).computeStatus(), "up");
    assertEquals(statusMap.get(edges.get(0)).computeStatus(), "down");
}
Also used : Status(org.opennms.features.topology.api.topo.Status) ArrayList(java.util.ArrayList) EdgeRef(org.opennms.features.topology.api.topo.EdgeRef) Test(org.junit.Test)

Aggregations

Status (org.opennms.features.topology.api.topo.Status)26 ArrayList (java.util.ArrayList)17 VertexRef (org.opennms.features.topology.api.topo.VertexRef)15 Test (org.junit.Test)14 Criteria (org.opennms.features.topology.api.topo.Criteria)14 List (java.util.List)13 Map (java.util.Map)13 Collectors (java.util.stream.Collectors)12 Lists (com.google.common.collect.Lists)10 StatusProvider (org.opennms.features.topology.api.topo.StatusProvider)9 OnmsSeverity (org.opennms.netmgt.model.OnmsSeverity)9 AlarmSummary (org.opennms.netmgt.model.alarm.AlarmSummary)9 Collection (java.util.Collection)8 Objects (java.util.Objects)7 AbstractVertex (org.opennms.features.topology.api.topo.AbstractVertex)7 EdgeRef (org.opennms.features.topology.api.topo.EdgeRef)7 VertexProvider (org.opennms.features.topology.api.topo.VertexProvider)7 GraphMLServiceAccessor (org.opennms.features.topology.plugins.topo.graphml.internal.GraphMLServiceAccessor)6 Paths (java.nio.file.Paths)5 Date (java.util.Date)5