@Test public void testGetDeleteRouterInformation() throws Exception { OspfAreaImpl ospfArea = new OspfAreaImpl(); ospfArea.setRouterId(Ip4Address.valueOf("5.5.5.5")); topologyForDeviceAndLink.updateLinkInformation(createOspfLsa(), ospfArea); List list = topologyForDeviceAndLink.getDeleteRouterInformation(createOspfLsa(), ospfArea); assertThat(list, is(notNullValue())); }
public List<String> getDeleteRouterInformation(OspfLsa ospfLsa, OspfArea ospfArea) { List<String> removedLinkList = new ArrayList<>(); if (ospfLsa.getOspfLsaType().equals(OspfLsaType.ROUTER)) { RouterLsa routerLsa = (RouterLsa) ospfLsa; List<OspfLsaLink> ospfLsaLinkList = routerLsa.routerLink(); for (OspfLsaLink link : ospfLsaLinkList) { if (link.linkType == 1 || link.linkType == 2) { if ((routerLsa.advertisingRouter().equals(ospfArea.routerId())) || (link.equals(ospfArea.routerId()))) { log.debug("OspfInterface information will not display in web "); } else { String key = routerLsa.advertisingRouter() + "-" + link.linkData(); Set<OspfLsaLink> linkInformations = deviceAndLinkInformation.get(key); if (linkInformations.contains(link)) { linkInformations.remove(link); deviceAndLinkInformation.put(key, linkInformations); } } } Set<String> keys = deviceAndLinkInformation.keySet(); for (String key : keys) { Set<OspfLsaLink> linkInformations = deviceAndLinkInformation.get(key); for (OspfLsaLink link1 : linkInformations) { String removedLink = link1.linkId(); removedLinkList.add(removedLink); } } } } return removedLinkList; }
TopologyForDeviceAndLinkImpl implements TopologyForDeviceAndLink { public List<String> getDeleteRouterInformation(OspfLsa ospfLsa, OspfArea ospfArea) { List<String> removedLinkList = new ArrayList<>(); if (ospfLsa.getOspfLsaType().equals(OspfLsaType.ROUTER)) { RouterLsa routerLsa = (RouterLsa) ospfLsa; List<OspfLsaLink> ospfLsaLinkList = routerLsa.routerLink(); for (OspfLsaLink link : ospfLsaLinkList) { if (link.linkType == 1 || link.linkType == 2) { if ((routerLsa.advertisingRouter().equals(ospfArea.routerId())) || (link.equals(ospfArea.routerId()))) { log.debug("OspfInterface information will not display in web "); } else { String key = routerLsa.advertisingRouter() + "-" + link.linkData(); Set<OspfLsaLink> linkInformations = deviceAndLinkInformation.get(key); if (linkInformations.contains(link)) { linkInformations.remove(link); deviceAndLinkInformation.put(key, linkInformations); } } } Set<String> keys = deviceAndLinkInformation.keySet(); for (String key : keys) { Set<OspfLsaLink> linkInformations = deviceAndLinkInformation.get(key); for (OspfLsaLink link1 : linkInformations) { String removedLink = link1.linkId(); removedLinkList.add(removedLink); } } } } return removedLinkList; } }
TopologyForDeviceAndLinkImpl implements TopologyForDeviceAndLink { public List<String> getDeleteRouterInformation(OspfLsa ospfLsa, OspfArea ospfArea) { List<String> removedLinkList = new ArrayList<>(); if (ospfLsa.getOspfLsaType().equals(OspfLsaType.ROUTER)) { RouterLsa routerLsa = (RouterLsa) ospfLsa; List<OspfLsaLink> ospfLsaLinkList = routerLsa.routerLink(); for (OspfLsaLink link : ospfLsaLinkList) { if (link.linkType == 1 || link.linkType == 2) { if ((routerLsa.advertisingRouter().equals(ospfArea.routerId())) || (link.equals(ospfArea.routerId()))) { log.debug("OspfInterface information will not display in web "); } else { String key = routerLsa.advertisingRouter() + "-" + link.linkData(); Set<OspfLsaLink> linkInformations = deviceAndLinkInformation.get(key); if (linkInformations.contains(link)) { linkInformations.remove(link); deviceAndLinkInformation.put(key, linkInformations); } } } Set<String> keys = deviceAndLinkInformation.keySet(); for (String key : keys) { Set<OspfLsaLink> linkInformations = deviceAndLinkInformation.get(key); for (OspfLsaLink link1 : linkInformations) { String removedLink = link1.linkId(); removedLinkList.add(removedLink); } } } } return removedLinkList; }  }
TopologyForDeviceAndLinkImpl implements TopologyForDeviceAndLink { public List<String> getDeleteRouterInformation(OspfLsa ospfLsa, OspfArea ospfArea) { List<String> removedLinkList = new ArrayList<>(); if (ospfLsa.getOspfLsaType().equals(OspfLsaType.ROUTER)) { RouterLsa routerLsa = (RouterLsa) ospfLsa; List<OspfLsaLink> ospfLsaLinkList = routerLsa.routerLink(); for (OspfLsaLink link : ospfLsaLinkList) { if (link.linkType == 1 || link.linkType == 2) { if ((routerLsa.advertisingRouter().equals(ospfArea.routerId())) || (link.equals(ospfArea.routerId()))) { log.debug("OspfInterface information will not display in web "); } else { String key = routerLsa.advertisingRouter() + "-" + link.linkData(); Set<OspfLsaLink> linkInformations = deviceAndLinkInformation.get(key); if (linkInformations.contains(link)) { linkInformations.remove(link); deviceAndLinkInformation.put(key, linkInformations); } } } Set<String> keys = deviceAndLinkInformation.keySet(); for (String key : keys) { Set<OspfLsaLink> linkInformations = deviceAndLinkInformation.get(key); for (OspfLsaLink link1 : linkInformations) { String removedLink = link1.linkId(); removedLinkList.add(removedLink); } } } } return removedLinkList; }  Map<String, DeviceInformation> deviceInformationMap(); void setDeviceInformationMap(String key, DeviceInformation deviceInformationMap); Map<String, DeviceInformation> deviceInformationMapForPointToPoint(); void setDeviceInformationMapForPointToPoint(String key, DeviceInformation deviceInformationMap); Map<String, DeviceInformation> deviceInformationMapToDelete(); void setDeviceInformationMapToDelete(String key, DeviceInformation deviceInformationMapToDelete); void removeDeviceInformationMapFromDeleteMap(String key); DeviceInformation deviceInformation(String key); void removeDeviceInformationMap(String key); Map<String, LinkInformation> linkInformationMap(); void setLinkInformationMap(String key, LinkInformation linkInformationMap); Map<String, LinkInformation> linkInformationMapForPointToPoint(); void setLinkInformationMapForPointToPoint(String key, LinkInformation linkInformationMap); void removeLinkInformationMap(String key); OspfLinkTed getOspfLinkTedHashMap(String key); void addLocalDevice(OspfLsa ospfLsa, OspfInterface ospfInterface, OspfArea ospfArea); void addLocalLink(String advertisingRouter, Ip4Address linkData, Ip4Address linkSrc, Ip4Address linkDest,
                             boolean opaqueEnabled, boolean linkSrcIdNotRouterId); void addLocalLinkForPointToPoint(String advertisingRouter, Ip4Address linkData, Ip4Address linkSrc,
                                            Ip4Address linkDest, boolean opaqueEnabled, boolean linkSrcIdNotRouterId); void removeLinks(Ip4Address routerId); void removeDevice(Ip4Address routerId); void updateLinkInformation(OspfLsa ospfLsa, OspfArea ospfArea); List<String> getDeleteRouterInformation(OspfLsa ospfLsa, OspfArea ospfArea); }
TopologyForDeviceAndLinkImpl implements TopologyForDeviceAndLink { public List<String> getDeleteRouterInformation(OspfLsa ospfLsa, OspfArea ospfArea) { List<String> removedLinkList = new ArrayList<>(); if (ospfLsa.getOspfLsaType().equals(OspfLsaType.ROUTER)) { RouterLsa routerLsa = (RouterLsa) ospfLsa; List<OspfLsaLink> ospfLsaLinkList = routerLsa.routerLink(); for (OspfLsaLink link : ospfLsaLinkList) { if (link.linkType == 1 || link.linkType == 2) { if ((routerLsa.advertisingRouter().equals(ospfArea.routerId())) || (link.equals(ospfArea.routerId()))) { log.debug("OspfInterface information will not display in web "); } else { String key = routerLsa.advertisingRouter() + "-" + link.linkData(); Set<OspfLsaLink> linkInformations = deviceAndLinkInformation.get(key); if (linkInformations.contains(link)) { linkInformations.remove(link); deviceAndLinkInformation.put(key, linkInformations); } } } Set<String> keys = deviceAndLinkInformation.keySet(); for (String key : keys) { Set<OspfLsaLink> linkInformations = deviceAndLinkInformation.get(key); for (OspfLsaLink link1 : linkInformations) { String removedLink = link1.linkId(); removedLinkList.add(removedLink); } } } } return removedLinkList; }  Map<String, DeviceInformation> deviceInformationMap(); void setDeviceInformationMap(String key, DeviceInformation deviceInformationMap); Map<String, DeviceInformation> deviceInformationMapForPointToPoint(); void setDeviceInformationMapForPointToPoint(String key, DeviceInformation deviceInformationMap); Map<String, DeviceInformation> deviceInformationMapToDelete(); void setDeviceInformationMapToDelete(String key, DeviceInformation deviceInformationMapToDelete); void removeDeviceInformationMapFromDeleteMap(String key); DeviceInformation deviceInformation(String key); void removeDeviceInformationMap(String key); Map<String, LinkInformation> linkInformationMap(); void setLinkInformationMap(String key, LinkInformation linkInformationMap); Map<String, LinkInformation> linkInformationMapForPointToPoint(); void setLinkInformationMapForPointToPoint(String key, LinkInformation linkInformationMap); void removeLinkInformationMap(String key); OspfLinkTed getOspfLinkTedHashMap(String key); void addLocalDevice(OspfLsa ospfLsa, OspfInterface ospfInterface, OspfArea ospfArea); void addLocalLink(String advertisingRouter, Ip4Address linkData, Ip4Address linkSrc, Ip4Address linkDest,
                             boolean opaqueEnabled, boolean linkSrcIdNotRouterId); void addLocalLinkForPointToPoint(String advertisingRouter, Ip4Address linkData, Ip4Address linkSrc,
                                            Ip4Address linkDest, boolean opaqueEnabled, boolean linkSrcIdNotRouterId); void removeLinks(Ip4Address routerId); void removeDevice(Ip4Address routerId); void updateLinkInformation(OspfLsa ospfLsa, OspfArea ospfArea); List<String> getDeleteRouterInformation(OspfLsa ospfLsa, OspfArea ospfArea);  }