@Test public void testAddToOtherNeighborLsaTxList() throws Exception { ospfArea.setOspfInterfaceList(ospfInterfaces); ospfArea.addToOtherNeighborLsaTxList(routerLsa); assertThat(ospfArea, is(notNullValue())); opaqueLsa10.setLsType(OspfParameters.LINK_LOCAL_OPAQUE_LSA); ospfArea.addToOtherNeighborLsaTxList(opaqueLsa10); assertThat(ospfArea, is(notNullValue())); }
public void addToOtherNeighborLsaTxList(LsaHeader recLsa) { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList"); List<OspfInterface> ospfInterfaces = ospfInterfaceList(); for (OspfInterface ospfInterfaceFromArea : ospfInterfaces) { Map neighbors = ospfInterfaceFromArea.listOfNeighbors(); for (Object neighborIP : neighbors.keySet()) { OspfNbrImpl nbr = (OspfNbrImpl) neighbors.get(neighborIP); if (nbr.getState().getValue() < OspfNeighborState.EXCHANGE.getValue()) { continue; } String key = database.getLsaKey(recLsa); if (nbr.getState() == OspfNeighborState.EXCHANGE || nbr.getState() == OspfNeighborState.LOADING) { if (nbr.getLsReqList().containsKey(key)) { LsaWrapper lsWrapper = lsaLookup(recLsa); if (lsWrapper != null) { LsaHeader ownLsa = (LsaHeader) lsWrapper.ospfLsa(); String status = isNewerOrSameLsa(recLsa, ownLsa); if (status.equals("old")) { continue; } else if (status.equals("same")) { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: " + "Removing lsa from reTxtList {}", key); nbr.getLsReqList().remove(key); continue; } else { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: " + "Removing lsa from reTxtList {}", key); nbr.getLsReqList().remove(key); } } } } if (recLsa.advertisingRouter().equals((String) neighborIP)) { continue; } if ((recLsa.lsType() == OspfParameters.LINK_LOCAL_OPAQUE_LSA || recLsa.lsType() == OspfParameters.AREA_LOCAL_OPAQUE_LSA)) { if (nbr.isOpaqueCapable()) { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: Adding lsa to reTxtList {}", recLsa); nbr.getReTxList().put(key, recLsa); } } else { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: Adding lsa to reTxtList {}", recLsa); nbr.getReTxList().put(key, recLsa); } } } }
OspfAreaImpl implements OspfArea { public void addToOtherNeighborLsaTxList(LsaHeader recLsa) { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList"); List<OspfInterface> ospfInterfaces = ospfInterfaceList(); for (OspfInterface ospfInterfaceFromArea : ospfInterfaces) { Map neighbors = ospfInterfaceFromArea.listOfNeighbors(); for (Object neighborIP : neighbors.keySet()) { OspfNbrImpl nbr = (OspfNbrImpl) neighbors.get(neighborIP); if (nbr.getState().getValue() < OspfNeighborState.EXCHANGE.getValue()) { continue; } String key = database.getLsaKey(recLsa); if (nbr.getState() == OspfNeighborState.EXCHANGE || nbr.getState() == OspfNeighborState.LOADING) { if (nbr.getLsReqList().containsKey(key)) { LsaWrapper lsWrapper = lsaLookup(recLsa); if (lsWrapper != null) { LsaHeader ownLsa = (LsaHeader) lsWrapper.ospfLsa(); String status = isNewerOrSameLsa(recLsa, ownLsa); if (status.equals("old")) { continue; } else if (status.equals("same")) { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: " + "Removing lsa from reTxtList {}", key); nbr.getLsReqList().remove(key); continue; } else { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: " + "Removing lsa from reTxtList {}", key); nbr.getLsReqList().remove(key); } } } } if (recLsa.advertisingRouter().equals((String) neighborIP)) { continue; } if ((recLsa.lsType() == OspfParameters.LINK_LOCAL_OPAQUE_LSA || recLsa.lsType() == OspfParameters.AREA_LOCAL_OPAQUE_LSA)) { if (nbr.isOpaqueCapable()) { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: Adding lsa to reTxtList {}", recLsa); nbr.getReTxList().put(key, recLsa); } } else { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: Adding lsa to reTxtList {}", recLsa); nbr.getReTxList().put(key, recLsa); } } } } }
OspfAreaImpl implements OspfArea { public void addToOtherNeighborLsaTxList(LsaHeader recLsa) { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList"); List<OspfInterface> ospfInterfaces = ospfInterfaceList(); for (OspfInterface ospfInterfaceFromArea : ospfInterfaces) { Map neighbors = ospfInterfaceFromArea.listOfNeighbors(); for (Object neighborIP : neighbors.keySet()) { OspfNbrImpl nbr = (OspfNbrImpl) neighbors.get(neighborIP); if (nbr.getState().getValue() < OspfNeighborState.EXCHANGE.getValue()) { continue; } String key = database.getLsaKey(recLsa); if (nbr.getState() == OspfNeighborState.EXCHANGE || nbr.getState() == OspfNeighborState.LOADING) { if (nbr.getLsReqList().containsKey(key)) { LsaWrapper lsWrapper = lsaLookup(recLsa); if (lsWrapper != null) { LsaHeader ownLsa = (LsaHeader) lsWrapper.ospfLsa(); String status = isNewerOrSameLsa(recLsa, ownLsa); if (status.equals("old")) { continue; } else if (status.equals("same")) { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: " + "Removing lsa from reTxtList {}", key); nbr.getLsReqList().remove(key); continue; } else { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: " + "Removing lsa from reTxtList {}", key); nbr.getLsReqList().remove(key); } } } } if (recLsa.advertisingRouter().equals((String) neighborIP)) { continue; } if ((recLsa.lsType() == OspfParameters.LINK_LOCAL_OPAQUE_LSA || recLsa.lsType() == OspfParameters.AREA_LOCAL_OPAQUE_LSA)) { if (nbr.isOpaqueCapable()) { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: Adding lsa to reTxtList {}", recLsa); nbr.getReTxList().put(key, recLsa); } } else { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: Adding lsa to reTxtList {}", recLsa); nbr.getReTxList().put(key, recLsa); } } } } OspfAreaImpl(); }
OspfAreaImpl implements OspfArea { public void addToOtherNeighborLsaTxList(LsaHeader recLsa) { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList"); List<OspfInterface> ospfInterfaces = ospfInterfaceList(); for (OspfInterface ospfInterfaceFromArea : ospfInterfaces) { Map neighbors = ospfInterfaceFromArea.listOfNeighbors(); for (Object neighborIP : neighbors.keySet()) { OspfNbrImpl nbr = (OspfNbrImpl) neighbors.get(neighborIP); if (nbr.getState().getValue() < OspfNeighborState.EXCHANGE.getValue()) { continue; } String key = database.getLsaKey(recLsa); if (nbr.getState() == OspfNeighborState.EXCHANGE || nbr.getState() == OspfNeighborState.LOADING) { if (nbr.getLsReqList().containsKey(key)) { LsaWrapper lsWrapper = lsaLookup(recLsa); if (lsWrapper != null) { LsaHeader ownLsa = (LsaHeader) lsWrapper.ospfLsa(); String status = isNewerOrSameLsa(recLsa, ownLsa); if (status.equals("old")) { continue; } else if (status.equals("same")) { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: " + "Removing lsa from reTxtList {}", key); nbr.getLsReqList().remove(key); continue; } else { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: " + "Removing lsa from reTxtList {}", key); nbr.getLsReqList().remove(key); } } } } if (recLsa.advertisingRouter().equals((String) neighborIP)) { continue; } if ((recLsa.lsType() == OspfParameters.LINK_LOCAL_OPAQUE_LSA || recLsa.lsType() == OspfParameters.AREA_LOCAL_OPAQUE_LSA)) { if (nbr.isOpaqueCapable()) { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: Adding lsa to reTxtList {}", recLsa); nbr.getReTxList().put(key, recLsa); } } else { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: Adding lsa to reTxtList {}", recLsa); nbr.getReTxList().put(key, recLsa); } } } } OspfAreaImpl(); @Override boolean equals(Object o); @Override int hashCode(); Ip4Address routerId(); @JsonProperty("routerId") void setRouterId(Ip4Address routerId); @JsonProperty("isOpaqueEnable") void setIsOpaqueEnabled(boolean isOpaqueEnable); boolean isOpaqueEnabled(); void initializeDb(); @Override void refreshArea(OspfInterface ospfInterface); NetworkLsa buildNetworkLsa(Ip4Address interfaceIp, Ip4Address mask); RouterLsa buildRouterLsa(OspfInterface ospfInterface); Ip4Address areaId(); @JsonProperty("areaId") void setAreaId(Ip4Address areaId); boolean isExternalRoutingCapability(); @JsonProperty("externalRoutingCapability") void setExternalRoutingCapability(boolean externalRoutingCapability); List<OspfInterface> ospfInterfaceList(); @JsonProperty("interface") void setOspfInterfaceList(List<OspfInterface> ospfInterfaceList); boolean noNeighborInLsaExchangeProcess(); List getLsaHeaders(boolean excludeMaxAgeLsa, boolean isOpaquecapable); LsaWrapper getLsa(int lsType, String linkStateID, String advertisingRouter); LsaWrapper lsaLookup(OspfLsa lookupLsa); String isNewerOrSameLsa(OspfLsa lsa1, OspfLsa lsa2); void addLsa(OspfLsa ospfLsa, OspfInterface ospfInterface); void addLsa(OspfLsa ospfLsa, boolean isSelfOriginated, OspfInterface ospfInterface); void addLsaToMaxAgeBin(String key, LsaWrapper wrapper); void setDbRouterSequenceNumber(long newSequenceNumber); void deleteLsa(LsaHeader ospfLsa); void removeLsaFromBin(LsaWrapper lsaWrapper); @Override String toString(); List<OspfNbr> getNeighborsInFullState(OspfInterface ospfInterface); String getLsaKey(LsaHeader lsaHeader); void addToOtherNeighborLsaTxList(LsaHeader recLsa); int options(); void setOptions(int options); int opaqueEnabledOptions(); OspfLsdb database(); }
OspfAreaImpl implements OspfArea { public void addToOtherNeighborLsaTxList(LsaHeader recLsa) { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList"); List<OspfInterface> ospfInterfaces = ospfInterfaceList(); for (OspfInterface ospfInterfaceFromArea : ospfInterfaces) { Map neighbors = ospfInterfaceFromArea.listOfNeighbors(); for (Object neighborIP : neighbors.keySet()) { OspfNbrImpl nbr = (OspfNbrImpl) neighbors.get(neighborIP); if (nbr.getState().getValue() < OspfNeighborState.EXCHANGE.getValue()) { continue; } String key = database.getLsaKey(recLsa); if (nbr.getState() == OspfNeighborState.EXCHANGE || nbr.getState() == OspfNeighborState.LOADING) { if (nbr.getLsReqList().containsKey(key)) { LsaWrapper lsWrapper = lsaLookup(recLsa); if (lsWrapper != null) { LsaHeader ownLsa = (LsaHeader) lsWrapper.ospfLsa(); String status = isNewerOrSameLsa(recLsa, ownLsa); if (status.equals("old")) { continue; } else if (status.equals("same")) { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: " + "Removing lsa from reTxtList {}", key); nbr.getLsReqList().remove(key); continue; } else { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: " + "Removing lsa from reTxtList {}", key); nbr.getLsReqList().remove(key); } } } } if (recLsa.advertisingRouter().equals((String) neighborIP)) { continue; } if ((recLsa.lsType() == OspfParameters.LINK_LOCAL_OPAQUE_LSA || recLsa.lsType() == OspfParameters.AREA_LOCAL_OPAQUE_LSA)) { if (nbr.isOpaqueCapable()) { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: Adding lsa to reTxtList {}", recLsa); nbr.getReTxList().put(key, recLsa); } } else { log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: Adding lsa to reTxtList {}", recLsa); nbr.getReTxList().put(key, recLsa); } } } } OspfAreaImpl(); @Override boolean equals(Object o); @Override int hashCode(); Ip4Address routerId(); @JsonProperty("routerId") void setRouterId(Ip4Address routerId); @JsonProperty("isOpaqueEnable") void setIsOpaqueEnabled(boolean isOpaqueEnable); boolean isOpaqueEnabled(); void initializeDb(); @Override void refreshArea(OspfInterface ospfInterface); NetworkLsa buildNetworkLsa(Ip4Address interfaceIp, Ip4Address mask); RouterLsa buildRouterLsa(OspfInterface ospfInterface); Ip4Address areaId(); @JsonProperty("areaId") void setAreaId(Ip4Address areaId); boolean isExternalRoutingCapability(); @JsonProperty("externalRoutingCapability") void setExternalRoutingCapability(boolean externalRoutingCapability); List<OspfInterface> ospfInterfaceList(); @JsonProperty("interface") void setOspfInterfaceList(List<OspfInterface> ospfInterfaceList); boolean noNeighborInLsaExchangeProcess(); List getLsaHeaders(boolean excludeMaxAgeLsa, boolean isOpaquecapable); LsaWrapper getLsa(int lsType, String linkStateID, String advertisingRouter); LsaWrapper lsaLookup(OspfLsa lookupLsa); String isNewerOrSameLsa(OspfLsa lsa1, OspfLsa lsa2); void addLsa(OspfLsa ospfLsa, OspfInterface ospfInterface); void addLsa(OspfLsa ospfLsa, boolean isSelfOriginated, OspfInterface ospfInterface); void addLsaToMaxAgeBin(String key, LsaWrapper wrapper); void setDbRouterSequenceNumber(long newSequenceNumber); void deleteLsa(LsaHeader ospfLsa); void removeLsaFromBin(LsaWrapper lsaWrapper); @Override String toString(); List<OspfNbr> getNeighborsInFullState(OspfInterface ospfInterface); String getLsaKey(LsaHeader lsaHeader); void addToOtherNeighborLsaTxList(LsaHeader recLsa); int options(); void setOptions(int options); int opaqueEnabledOptions(); OspfLsdb database();  }