private List<OspfLink> createOspfLinks() { List<OspfLink> links = new ArrayList<OspfLink>(); OspfLink link = createOspfLink( m_node1, "192.168.100.246", "255.255.255.252", 0, 10101, "192.168.100.249", "192.168.100.245", 0); link.setId(1); links.add(link); OspfLink link2 = createOspfLink( m_node2, "192.168.100.245", "255.255.255.252", 0, 10100, "192.168.100.250", "192.168.100.246", 0); link2.setId(2); links.add(link2); return links; }
private List<OnmsAlarm> createDownAlarm() { List<OnmsAlarm> alarms = new ArrayList<OnmsAlarm>(); OnmsAlarm alarm1 = new OnmsAlarm(); alarm1.setNode(m_node1); alarm1.setIfIndex(10101); alarm1.setUei("uei.opennms.org/internal/topology/linkDown"); alarms.add(alarm1); return alarms; }
private List<OspfLink> createChennaiDehliLinks() { List<OspfLink> links = new ArrayList<OspfLink>(); OspfLink link = createOspfLink( m_nodeChennai, "10.205.56.21", "255.255.0.0", 0, 13, "192.168.8.1", "10.205.56.8", 0); link.setId(7); links.add(link); OspfLink link2 = createOspfLink( m_nodeDehli, "10.205.56.8", "255.255.0.0", 0, 13, "192.168.6.1", "10.205.56.21", 0); link2.setId(8); links.add(link2); return links; }
@Test public void testGetOspfLinkStatusDown() { EasyMock.expect( m_alarmDao.findMatching(EasyMock.anyObject(org.opennms.core.criteria.Criteria.class))) .andReturn(createDownAlarm()); EasyMock.expect( m_ospfLinkDao.findMatching(EasyMock.<org.opennms.core.criteria.Criteria>anyObject())) .andReturn(createOspfLinks()); EasyMock.replay(m_alarmDao, m_ospfLinkDao); List<EdgeRef> edges = createEdges(); Map<EdgeRef, Status> statusMap = m_statusProvider.getStatusForEdges(m_edgeProvider, edges, new Criteria[0]); assertEquals(1, statusMap.size()); assertEquals(edges.get(0), new ArrayList<EdgeRef>(statusMap.keySet()).get(0)); Status status = statusMap.get(edges.get(0)); assertEquals("down", status.computeStatus()); }