@Test public void testIsNewerOrSameLsp() throws Exception { result = defaultIsisLsdb.isNewerOrSameLsp(lsPdu, lsPdu); assertThat(result, is("same")); }
public String isNewerOrSameLsp(IsisMessage lsp1, IsisMessage lsp2) { LsPdu receivedLsp = (LsPdu) lsp1; LsPdu lspFromDb = (LsPdu) lsp2; if (receivedLsp.sequenceNumber() > lspFromDb.sequenceNumber() || receivedLsp.checkSum() != lspFromDb.checkSum()) { return "latest"; } else if (receivedLsp.sequenceNumber() < lspFromDb.sequenceNumber()) { return "old"; } else if (receivedLsp.sequenceNumber() == lspFromDb.sequenceNumber()) { return "same"; } return ""; }
DefaultIsisLsdb implements IsisLsdb { public String isNewerOrSameLsp(IsisMessage lsp1, IsisMessage lsp2) { LsPdu receivedLsp = (LsPdu) lsp1; LsPdu lspFromDb = (LsPdu) lsp2; if (receivedLsp.sequenceNumber() > lspFromDb.sequenceNumber() || receivedLsp.checkSum() != lspFromDb.checkSum()) { return "latest"; } else if (receivedLsp.sequenceNumber() < lspFromDb.sequenceNumber()) { return "old"; } else if (receivedLsp.sequenceNumber() == lspFromDb.sequenceNumber()) { return "same"; } return ""; } }
DefaultIsisLsdb implements IsisLsdb { public String isNewerOrSameLsp(IsisMessage lsp1, IsisMessage lsp2) { LsPdu receivedLsp = (LsPdu) lsp1; LsPdu lspFromDb = (LsPdu) lsp2; if (receivedLsp.sequenceNumber() > lspFromDb.sequenceNumber() || receivedLsp.checkSum() != lspFromDb.checkSum()) { return "latest"; } else if (receivedLsp.sequenceNumber() < lspFromDb.sequenceNumber()) { return "old"; } else if (receivedLsp.sequenceNumber() == lspFromDb.sequenceNumber()) { return "same"; } return ""; } DefaultIsisLsdb(); }
DefaultIsisLsdb implements IsisLsdb { public String isNewerOrSameLsp(IsisMessage lsp1, IsisMessage lsp2) { LsPdu receivedLsp = (LsPdu) lsp1; LsPdu lspFromDb = (LsPdu) lsp2; if (receivedLsp.sequenceNumber() > lspFromDb.sequenceNumber() || receivedLsp.checkSum() != lspFromDb.checkSum()) { return "latest"; } else if (receivedLsp.sequenceNumber() < lspFromDb.sequenceNumber()) { return "old"; } else if (receivedLsp.sequenceNumber() == lspFromDb.sequenceNumber()) { return "same"; } return ""; } DefaultIsisLsdb(); void setController(Controller controller); void setIsisInterface(List<IsisInterface> isisInterfaceList); void initializeDb(); void setL1LspSeqNo(int l1LspSeqNo); void setL2LspSeqNo(int l2LspSeqNo); String lspKey(String systemId); Map<String, LspWrapper> getL1Db(); Map<String, LspWrapper> getL2Db(); IsisLsdb isisLsdb(); List<LspWrapper> allLspHeaders(boolean excludeMaxAgeLsp); LspWrapper findLsp(IsisPduType pduType, String lspId); boolean addLsp(IsisMessage isisMessage, boolean isSelfOriginated, IsisInterface isisInterface); void removeLspFromBin(LspWrapper lsaWrapper); String isNewerOrSameLsp(IsisMessage lsp1, IsisMessage lsp2); int lsSequenceNumber(IsisPduType lspType); void deleteLsp(IsisMessage lspMessage); void removeTopology(IsisNeighbor neighbor, IsisInterface isisInterface); }
DefaultIsisLsdb implements IsisLsdb { public String isNewerOrSameLsp(IsisMessage lsp1, IsisMessage lsp2) { LsPdu receivedLsp = (LsPdu) lsp1; LsPdu lspFromDb = (LsPdu) lsp2; if (receivedLsp.sequenceNumber() > lspFromDb.sequenceNumber() || receivedLsp.checkSum() != lspFromDb.checkSum()) { return "latest"; } else if (receivedLsp.sequenceNumber() < lspFromDb.sequenceNumber()) { return "old"; } else if (receivedLsp.sequenceNumber() == lspFromDb.sequenceNumber()) { return "same"; } return ""; } DefaultIsisLsdb(); void setController(Controller controller); void setIsisInterface(List<IsisInterface> isisInterfaceList); void initializeDb(); void setL1LspSeqNo(int l1LspSeqNo); void setL2LspSeqNo(int l2LspSeqNo); String lspKey(String systemId); Map<String, LspWrapper> getL1Db(); Map<String, LspWrapper> getL2Db(); IsisLsdb isisLsdb(); List<LspWrapper> allLspHeaders(boolean excludeMaxAgeLsp); LspWrapper findLsp(IsisPduType pduType, String lspId); boolean addLsp(IsisMessage isisMessage, boolean isSelfOriginated, IsisInterface isisInterface); void removeLspFromBin(LspWrapper lsaWrapper); String isNewerOrSameLsp(IsisMessage lsp1, IsisMessage lsp2); int lsSequenceNumber(IsisPduType lspType); void deleteLsp(IsisMessage lspMessage); void removeTopology(IsisNeighbor neighbor, IsisInterface isisInterface);  }