@Test public void testProcessLsas() throws Exception { ospfLsaList = new ArrayList(); RouterLsa routerLsa = new RouterLsa(); routerLsa.setLsType(1); ospfLsaList.add(routerLsa); NetworkLsa networkLsa = new NetworkLsa(); routerLsa.setLsType(2); ospfLsaList.add(networkLsa); routerLsa.setLsType(3); ospfLsaList.add(routerLsa); ospfNbr.processLsas(ospfLsaList); assertThat(ospfNbr, is(notNullValue())); }
public void processLsas(List ddPayload) throws Exception { log.debug("OSPFNbr::processLsas...!!!"); OspfLsa nextLsa; Iterator lsas = ddPayload.iterator(); while (lsas.hasNext()) { nextLsa = (OspfLsa) lsas.next(); if (((nextLsa.getOspfLsaType().value() > OspfLsaType.EXTERNAL_LSA.value()) && (nextLsa.getOspfLsaType().value() < OspfLsaType.LINK_LOCAL_OPAQUE_LSA.value())) || (nextLsa.getOspfLsaType().value() > OspfLsaType.AS_OPAQUE_LSA.value())) { seqNumMismatch("LS Type found was unknown."); return; } if ((nextLsa.getOspfLsaType() == OspfLsaType.EXTERNAL_LSA) && !ospfArea.isExternalRoutingCapability()) { seqNumMismatch("External LSA found although area is stub."); return; } LsaWrapper lsaHasInstance = ospfArea.lsaLookup(nextLsa); if (lsaHasInstance == null) { lsReqList.put(((OspfAreaImpl) ospfArea).getLsaKey((LsaHeader) nextLsa), nextLsa); } else { String isNew = ((OspfAreaImpl) ospfArea).isNewerOrSameLsa(nextLsa, lsaHasInstance.ospfLsa()); if (isNew.equals("latest")) { lsReqList.put(((OspfAreaImpl) ospfArea).getLsaKey((LsaHeader) nextLsa), nextLsa); } } } }
OspfNbrImpl implements OspfNbr { public void processLsas(List ddPayload) throws Exception { log.debug("OSPFNbr::processLsas...!!!"); OspfLsa nextLsa; Iterator lsas = ddPayload.iterator(); while (lsas.hasNext()) { nextLsa = (OspfLsa) lsas.next(); if (((nextLsa.getOspfLsaType().value() > OspfLsaType.EXTERNAL_LSA.value()) && (nextLsa.getOspfLsaType().value() < OspfLsaType.LINK_LOCAL_OPAQUE_LSA.value())) || (nextLsa.getOspfLsaType().value() > OspfLsaType.AS_OPAQUE_LSA.value())) { seqNumMismatch("LS Type found was unknown."); return; } if ((nextLsa.getOspfLsaType() == OspfLsaType.EXTERNAL_LSA) && !ospfArea.isExternalRoutingCapability()) { seqNumMismatch("External LSA found although area is stub."); return; } LsaWrapper lsaHasInstance = ospfArea.lsaLookup(nextLsa); if (lsaHasInstance == null) { lsReqList.put(((OspfAreaImpl) ospfArea).getLsaKey((LsaHeader) nextLsa), nextLsa); } else { String isNew = ((OspfAreaImpl) ospfArea).isNewerOrSameLsa(nextLsa, lsaHasInstance.ospfLsa()); if (isNew.equals("latest")) { lsReqList.put(((OspfAreaImpl) ospfArea).getLsaKey((LsaHeader) nextLsa), nextLsa); } } } } }
OspfNbrImpl implements OspfNbr { public void processLsas(List ddPayload) throws Exception { log.debug("OSPFNbr::processLsas...!!!"); OspfLsa nextLsa; Iterator lsas = ddPayload.iterator(); while (lsas.hasNext()) { nextLsa = (OspfLsa) lsas.next(); if (((nextLsa.getOspfLsaType().value() > OspfLsaType.EXTERNAL_LSA.value()) && (nextLsa.getOspfLsaType().value() < OspfLsaType.LINK_LOCAL_OPAQUE_LSA.value())) || (nextLsa.getOspfLsaType().value() > OspfLsaType.AS_OPAQUE_LSA.value())) { seqNumMismatch("LS Type found was unknown."); return; } if ((nextLsa.getOspfLsaType() == OspfLsaType.EXTERNAL_LSA) && !ospfArea.isExternalRoutingCapability()) { seqNumMismatch("External LSA found although area is stub."); return; } LsaWrapper lsaHasInstance = ospfArea.lsaLookup(nextLsa); if (lsaHasInstance == null) { lsReqList.put(((OspfAreaImpl) ospfArea).getLsaKey((LsaHeader) nextLsa), nextLsa); } else { String isNew = ((OspfAreaImpl) ospfArea).isNewerOrSameLsa(nextLsa, lsaHasInstance.ospfLsa()); if (isNew.equals("latest")) { lsReqList.put(((OspfAreaImpl) ospfArea).getLsaKey((LsaHeader) nextLsa), nextLsa); } } } } OspfNbrImpl(OspfArea paramOspfArea, OspfInterface paramOspfInterface,
                       Ip4Address ipAddr, Ip4Address routerId, int options,
                       TopologyForDeviceAndLink topologyForDeviceAndLinkCommon); }
OspfNbrImpl implements OspfNbr { public void processLsas(List ddPayload) throws Exception { log.debug("OSPFNbr::processLsas...!!!"); OspfLsa nextLsa; Iterator lsas = ddPayload.iterator(); while (lsas.hasNext()) { nextLsa = (OspfLsa) lsas.next(); if (((nextLsa.getOspfLsaType().value() > OspfLsaType.EXTERNAL_LSA.value()) && (nextLsa.getOspfLsaType().value() < OspfLsaType.LINK_LOCAL_OPAQUE_LSA.value())) || (nextLsa.getOspfLsaType().value() > OspfLsaType.AS_OPAQUE_LSA.value())) { seqNumMismatch("LS Type found was unknown."); return; } if ((nextLsa.getOspfLsaType() == OspfLsaType.EXTERNAL_LSA) && !ospfArea.isExternalRoutingCapability()) { seqNumMismatch("External LSA found although area is stub."); return; } LsaWrapper lsaHasInstance = ospfArea.lsaLookup(nextLsa); if (lsaHasInstance == null) { lsReqList.put(((OspfAreaImpl) ospfArea).getLsaKey((LsaHeader) nextLsa), nextLsa); } else { String isNew = ((OspfAreaImpl) ospfArea).isNewerOrSameLsa(nextLsa, lsaHasInstance.ospfLsa()); if (isNew.equals("latest")) { lsReqList.put(((OspfAreaImpl) ospfArea).getLsaKey((LsaHeader) nextLsa), nextLsa); } } } } OspfNbrImpl(OspfArea paramOspfArea, OspfInterface paramOspfInterface,
                       Ip4Address ipAddr, Ip4Address routerId, int options,
                       TopologyForDeviceAndLink topologyForDeviceAndLinkCommon); Ip4Address neighborIpAddr(); boolean isOpaqueCapable(); void setIsOpaqueCapable(boolean isOpaqueCapable); void setRouterDeadInterval(int routerDeadInterval); void oneWayReceived(OspfMessage ospfHello, Channel channel); void twoWayReceived(OspfMessage ospfMessage, Channel channel); void negotiationDone(OspfMessage ospfMessage,
                                boolean neighborIsMaster, List payload, Channel ch); void processLsas(List ddPayload); OspfMessage seqNumMismatch(String reason); void badLSReq(Channel ch); void processDdPacket(boolean neighborIsMaster, DdPacket dataDescPkt,
                                Channel ch); void exchangeDone(OspfMessage message, Channel ch); void adjOk(Channel ch); void processLsUpdate(LsUpdate lsUpdPkt, Channel ch); void loadingDone(); boolean processReceivedLsa(LsaHeader recLsa,
                                      boolean receivedViaFlooding, Channel ch, Ip4Address sourceIp); String isNullorLatest(LsaWrapper lsWrapper, LsaHeader recLsa); void processSelfOriginatedLsa(); void sendLsa(LsaHeader lsa, Ip4Address destination, Channel ch); void directAcknowledge(LsaHeader ackLsa, Channel ch, Ip4Address sourceIp); void neighborDown(); void startInactivityTimeCheck(); void stopInactivityTimeCheck(); void startFloodingTimer(Channel channel); void stopFloodingTimer(); void stopRxMtDdTimer(); void stopRxMtLsrTimer(); DdPacket lastDdPacket(); void setLastDdPacket(DdPacket lastDdPacket); Ip4Address neighborId(); void setNeighborId(Ip4Address neighborId); Ip4Address neighborDr(); void setNeighborDr(Ip4Address neighborDr); Ip4Address neighborBdr(); void setNeighborBdr(Ip4Address neighborBdr); int routerPriority(); void setRouterPriority(int routerPriority); int options(); void setOptions(int options); long ddSeqNum(); void setDdSeqNum(long ddSeqNum); int isMaster(); DdPacket lastSentDdPacket(); void setLastSentDdPacket(DdPacket lastSentDdPacket); LsRequest getLastSentLsrPacket(); void setLastSentLsrPacket(LsRequest lastSentLsrPacket); OspfNeighborState getState(); void setState(OspfNeighborState state); void setIsMaster(int isMaster); Hashtable getLsReqList(); Map getReTxList(); Map<String, OspfLsa> getPendingReTxList(); }
OspfNbrImpl implements OspfNbr { public void processLsas(List ddPayload) throws Exception { log.debug("OSPFNbr::processLsas...!!!"); OspfLsa nextLsa; Iterator lsas = ddPayload.iterator(); while (lsas.hasNext()) { nextLsa = (OspfLsa) lsas.next(); if (((nextLsa.getOspfLsaType().value() > OspfLsaType.EXTERNAL_LSA.value()) && (nextLsa.getOspfLsaType().value() < OspfLsaType.LINK_LOCAL_OPAQUE_LSA.value())) || (nextLsa.getOspfLsaType().value() > OspfLsaType.AS_OPAQUE_LSA.value())) { seqNumMismatch("LS Type found was unknown."); return; } if ((nextLsa.getOspfLsaType() == OspfLsaType.EXTERNAL_LSA) && !ospfArea.isExternalRoutingCapability()) { seqNumMismatch("External LSA found although area is stub."); return; } LsaWrapper lsaHasInstance = ospfArea.lsaLookup(nextLsa); if (lsaHasInstance == null) { lsReqList.put(((OspfAreaImpl) ospfArea).getLsaKey((LsaHeader) nextLsa), nextLsa); } else { String isNew = ((OspfAreaImpl) ospfArea).isNewerOrSameLsa(nextLsa, lsaHasInstance.ospfLsa()); if (isNew.equals("latest")) { lsReqList.put(((OspfAreaImpl) ospfArea).getLsaKey((LsaHeader) nextLsa), nextLsa); } } } } OspfNbrImpl(OspfArea paramOspfArea, OspfInterface paramOspfInterface,
                       Ip4Address ipAddr, Ip4Address routerId, int options,
                       TopologyForDeviceAndLink topologyForDeviceAndLinkCommon); Ip4Address neighborIpAddr(); boolean isOpaqueCapable(); void setIsOpaqueCapable(boolean isOpaqueCapable); void setRouterDeadInterval(int routerDeadInterval); void oneWayReceived(OspfMessage ospfHello, Channel channel); void twoWayReceived(OspfMessage ospfMessage, Channel channel); void negotiationDone(OspfMessage ospfMessage,
                                boolean neighborIsMaster, List payload, Channel ch); void processLsas(List ddPayload); OspfMessage seqNumMismatch(String reason); void badLSReq(Channel ch); void processDdPacket(boolean neighborIsMaster, DdPacket dataDescPkt,
                                Channel ch); void exchangeDone(OspfMessage message, Channel ch); void adjOk(Channel ch); void processLsUpdate(LsUpdate lsUpdPkt, Channel ch); void loadingDone(); boolean processReceivedLsa(LsaHeader recLsa,
                                      boolean receivedViaFlooding, Channel ch, Ip4Address sourceIp); String isNullorLatest(LsaWrapper lsWrapper, LsaHeader recLsa); void processSelfOriginatedLsa(); void sendLsa(LsaHeader lsa, Ip4Address destination, Channel ch); void directAcknowledge(LsaHeader ackLsa, Channel ch, Ip4Address sourceIp); void neighborDown(); void startInactivityTimeCheck(); void stopInactivityTimeCheck(); void startFloodingTimer(Channel channel); void stopFloodingTimer(); void stopRxMtDdTimer(); void stopRxMtLsrTimer(); DdPacket lastDdPacket(); void setLastDdPacket(DdPacket lastDdPacket); Ip4Address neighborId(); void setNeighborId(Ip4Address neighborId); Ip4Address neighborDr(); void setNeighborDr(Ip4Address neighborDr); Ip4Address neighborBdr(); void setNeighborBdr(Ip4Address neighborBdr); int routerPriority(); void setRouterPriority(int routerPriority); int options(); void setOptions(int options); long ddSeqNum(); void setDdSeqNum(long ddSeqNum); int isMaster(); DdPacket lastSentDdPacket(); void setLastSentDdPacket(DdPacket lastSentDdPacket); LsRequest getLastSentLsrPacket(); void setLastSentLsrPacket(LsRequest lastSentLsrPacket); OspfNeighborState getState(); void setState(OspfNeighborState state); void setIsMaster(int isMaster); Hashtable getLsReqList(); Map getReTxList(); Map<String, OspfLsa> getPendingReTxList();  }