@Test public void testAddLsa() throws Exception { routerLsa.setLsType(1); assertThat(ospfLsdb.addLsa(routerLsa, false, new OspfInterfaceImpl()), is(true)); networkLsa.setLsType(2); assertThat(ospfLsdb.addLsa(networkLsa, false, new OspfInterfaceImpl()), is(true)); summaryLsa.setLsType(3); assertThat(ospfLsdb.addLsa(summaryLsa, false, new OspfInterfaceImpl()), is(true)); asbrSummaryLsa.setLsType(4); assertThat(ospfLsdb.addLsa(asbrSummaryLsa, false, new OspfInterfaceImpl()), is(true)); externalLsa.setLsType(5); assertThat(ospfLsdb.addLsa(externalLsa, false, new OspfInterfaceImpl()), is(true)); opaqueLsa9.setLsType(9); assertThat(ospfLsdb.addLsa(opaqueLsa9, false, new OspfInterfaceImpl()), is(true)); opaqueLsa10.setLsType(10); assertThat(ospfLsdb.addLsa(opaqueLsa10, false, new OspfInterfaceImpl()), is(true)); opaqueLsa11.setLsType(11); assertThat(ospfLsdb.addLsa(opaqueLsa11, false, new OspfInterfaceImpl()), is(true)); }
public boolean addLsa(LsaHeader newLsa, boolean isSelfOriginated, OspfInterface ospfInterface) { LsaWrapperImpl lsaWrapper = new LsaWrapperImpl(); lsaWrapper.setLsaType(newLsa.getOspfLsaType()); lsaWrapper.setOspfLsa(newLsa); lsaWrapper.setLsaHeader(newLsa); lsaWrapper.setLsaAgeReceived(newLsa.age()); lsaWrapper.setAgeCounterWhenReceived(lsdbAge.getAgeCounter()); lsaWrapper.setAgeCounterRollOverWhenAdded(lsdbAge.getAgeCounterRollOver()); lsaWrapper.setIsSelfOriginated(isSelfOriginated); lsaWrapper.setIsSelfOriginated(isSelfOriginated); lsaWrapper.setOspfInterface(ospfInterface); lsaWrapper.setLsdbAge(lsdbAge); addLsa(lsaWrapper); log.debug("Added LSA In LSDB: {}", newLsa); return true; }
OspfLsdbImpl implements OspfLsdb { public boolean addLsa(LsaHeader newLsa, boolean isSelfOriginated, OspfInterface ospfInterface) { LsaWrapperImpl lsaWrapper = new LsaWrapperImpl(); lsaWrapper.setLsaType(newLsa.getOspfLsaType()); lsaWrapper.setOspfLsa(newLsa); lsaWrapper.setLsaHeader(newLsa); lsaWrapper.setLsaAgeReceived(newLsa.age()); lsaWrapper.setAgeCounterWhenReceived(lsdbAge.getAgeCounter()); lsaWrapper.setAgeCounterRollOverWhenAdded(lsdbAge.getAgeCounterRollOver()); lsaWrapper.setIsSelfOriginated(isSelfOriginated); lsaWrapper.setIsSelfOriginated(isSelfOriginated); lsaWrapper.setOspfInterface(ospfInterface); lsaWrapper.setLsdbAge(lsdbAge); addLsa(lsaWrapper); log.debug("Added LSA In LSDB: {}", newLsa); return true; } }
OspfLsdbImpl implements OspfLsdb { public boolean addLsa(LsaHeader newLsa, boolean isSelfOriginated, OspfInterface ospfInterface) { LsaWrapperImpl lsaWrapper = new LsaWrapperImpl(); lsaWrapper.setLsaType(newLsa.getOspfLsaType()); lsaWrapper.setOspfLsa(newLsa); lsaWrapper.setLsaHeader(newLsa); lsaWrapper.setLsaAgeReceived(newLsa.age()); lsaWrapper.setAgeCounterWhenReceived(lsdbAge.getAgeCounter()); lsaWrapper.setAgeCounterRollOverWhenAdded(lsdbAge.getAgeCounterRollOver()); lsaWrapper.setIsSelfOriginated(isSelfOriginated); lsaWrapper.setIsSelfOriginated(isSelfOriginated); lsaWrapper.setOspfInterface(ospfInterface); lsaWrapper.setLsdbAge(lsdbAge); addLsa(lsaWrapper); log.debug("Added LSA In LSDB: {}", newLsa); return true; } OspfLsdbImpl(OspfArea ospfArea); }
OspfLsdbImpl implements OspfLsdb { public boolean addLsa(LsaHeader newLsa, boolean isSelfOriginated, OspfInterface ospfInterface) { LsaWrapperImpl lsaWrapper = new LsaWrapperImpl(); lsaWrapper.setLsaType(newLsa.getOspfLsaType()); lsaWrapper.setOspfLsa(newLsa); lsaWrapper.setLsaHeader(newLsa); lsaWrapper.setLsaAgeReceived(newLsa.age()); lsaWrapper.setAgeCounterWhenReceived(lsdbAge.getAgeCounter()); lsaWrapper.setAgeCounterRollOverWhenAdded(lsdbAge.getAgeCounterRollOver()); lsaWrapper.setIsSelfOriginated(isSelfOriginated); lsaWrapper.setIsSelfOriginated(isSelfOriginated); lsaWrapper.setOspfInterface(ospfInterface); lsaWrapper.setLsdbAge(lsdbAge); addLsa(lsaWrapper); log.debug("Added LSA In LSDB: {}", newLsa); return true; } OspfLsdbImpl(OspfArea ospfArea); @Override boolean equals(Object o); @Override int hashCode(); void initializeDb(); List getAllLsaHeaders(boolean excludeMaxAgeLsa, boolean isOpaqueCapable); String getLsaKey(LsaHeader lsaHeader); LsaWrapper lsaLookup(LsaHeader lsaHeader); LsaWrapper findLsa(int lsType, String lsaKey); boolean addLsa(LsaHeader newLsa, boolean isSelfOriginated, OspfInterface ospfInterface); void addLsaToMaxAgeBin(String key, Object wrapper); void removeLsaFromBin(Object lsaWrapper); String isNewerOrSameLsa(LsaHeader lsa1, LsaHeader lsa2); long getLsSequenceNumber(OspfLsaType lsaType); void deleteLsa(LsaHeader lsaHeader); void setRouterLsaSeqNo(long routerLsaSeqNo); void setNetworkLsaSeqNo(long networkLsaSeqNo); }
OspfLsdbImpl implements OspfLsdb { public boolean addLsa(LsaHeader newLsa, boolean isSelfOriginated, OspfInterface ospfInterface) { LsaWrapperImpl lsaWrapper = new LsaWrapperImpl(); lsaWrapper.setLsaType(newLsa.getOspfLsaType()); lsaWrapper.setOspfLsa(newLsa); lsaWrapper.setLsaHeader(newLsa); lsaWrapper.setLsaAgeReceived(newLsa.age()); lsaWrapper.setAgeCounterWhenReceived(lsdbAge.getAgeCounter()); lsaWrapper.setAgeCounterRollOverWhenAdded(lsdbAge.getAgeCounterRollOver()); lsaWrapper.setIsSelfOriginated(isSelfOriginated); lsaWrapper.setIsSelfOriginated(isSelfOriginated); lsaWrapper.setOspfInterface(ospfInterface); lsaWrapper.setLsdbAge(lsdbAge); addLsa(lsaWrapper); log.debug("Added LSA In LSDB: {}", newLsa); return true; } OspfLsdbImpl(OspfArea ospfArea); @Override boolean equals(Object o); @Override int hashCode(); void initializeDb(); List getAllLsaHeaders(boolean excludeMaxAgeLsa, boolean isOpaqueCapable); String getLsaKey(LsaHeader lsaHeader); LsaWrapper lsaLookup(LsaHeader lsaHeader); LsaWrapper findLsa(int lsType, String lsaKey); boolean addLsa(LsaHeader newLsa, boolean isSelfOriginated, OspfInterface ospfInterface); void addLsaToMaxAgeBin(String key, Object wrapper); void removeLsaFromBin(Object lsaWrapper); String isNewerOrSameLsa(LsaHeader lsa1, LsaHeader lsa2); long getLsSequenceNumber(OspfLsaType lsaType); void deleteLsa(LsaHeader lsaHeader); void setRouterLsaSeqNo(long routerLsaSeqNo); void setNetworkLsaSeqNo(long networkLsaSeqNo);  }