@Test public void testFindlsa() throws Exception { opaqueLsaHeader = new OpaqueLsaHeader(); opaqueLsaHeader.setLsType(1); key = ospfLsdb.getLsaKey(opaqueLsaHeader); ospfLsdb.addLsa(new RouterLsa(), false, new OspfInterfaceImpl()); lsaWrapper = (LsaWrapperImpl) ospfLsdb.findLsa(opaqueLsaHeader.lsType(), key); assertThat(lsaWrapper, is(nullValue())); opaqueLsaHeader = new OpaqueLsaHeader(); opaqueLsaHeader.setLsType(2); key = ospfLsdb.getLsaKey(opaqueLsaHeader); ospfLsdb.addLsa(new RouterLsa(), false, new OspfInterfaceImpl()); lsaWrapper = (LsaWrapperImpl) ospfLsdb.findLsa(opaqueLsaHeader.lsType(), key); assertThat(lsaWrapper, is(nullValue())); opaqueLsaHeader = new OpaqueLsaHeader(); opaqueLsaHeader.setLsType(3); key = ospfLsdb.getLsaKey(opaqueLsaHeader); ospfLsdb.addLsa(new RouterLsa(), false, new OspfInterfaceImpl()); lsaWrapper = (LsaWrapperImpl) ospfLsdb.findLsa(opaqueLsaHeader.lsType(), key); assertThat(lsaWrapper, is(nullValue())); opaqueLsaHeader = new OpaqueLsaHeader(); opaqueLsaHeader.setLsType(4); key = ospfLsdb.getLsaKey(opaqueLsaHeader); ospfLsdb.addLsa(new RouterLsa(), false, new OspfInterfaceImpl()); lsaWrapper = (LsaWrapperImpl) ospfLsdb.findLsa(opaqueLsaHeader.lsType(), key); assertThat(lsaWrapper, is(nullValue())); opaqueLsaHeader = new OpaqueLsaHeader(); opaqueLsaHeader.setLsType(5); key = ospfLsdb.getLsaKey(opaqueLsaHeader); ospfLsdb.addLsa(new RouterLsa(), false, new OspfInterfaceImpl()); lsaWrapper = (LsaWrapperImpl) ospfLsdb.findLsa(opaqueLsaHeader.lsType(), key); assertThat(lsaWrapper, is(nullValue())); opaqueLsaHeader = new OpaqueLsaHeader(); opaqueLsaHeader.setLsType(9); key = ospfLsdb.getLsaKey(opaqueLsaHeader); ospfLsdb.addLsa(new RouterLsa(), false, new OspfInterfaceImpl()); lsaWrapper = (LsaWrapperImpl) ospfLsdb.findLsa(opaqueLsaHeader.lsType(), key); assertThat(lsaWrapper, is(nullValue())); opaqueLsaHeader = new OpaqueLsaHeader(); opaqueLsaHeader.setLsType(10); key = ospfLsdb.getLsaKey(opaqueLsaHeader); ospfLsdb.addLsa(new RouterLsa(), false, new OspfInterfaceImpl()); lsaWrapper = (LsaWrapperImpl) ospfLsdb.findLsa(opaqueLsaHeader.lsType(), key); assertThat(lsaWrapper, is(nullValue())); opaqueLsaHeader = new OpaqueLsaHeader(); opaqueLsaHeader.setLsType(11); key = ospfLsdb.getLsaKey(opaqueLsaHeader); ospfLsdb.addLsa(new RouterLsa(), false, new OspfInterfaceImpl()); lsaWrapper = (LsaWrapperImpl) ospfLsdb.findLsa(opaqueLsaHeader.lsType(), key); assertThat(lsaWrapper, is(nullValue())); }
public LsaWrapper findLsa(int lsType, String lsaKey) { LsaWrapper lsaWrapper = null; switch (lsType) { case OspfParameters.LINK_LOCAL_OPAQUE_LSA: lsaWrapper = (LsaWrapper) opaque9Lsas.get(lsaKey); break; case OspfParameters.AREA_LOCAL_OPAQUE_LSA: lsaWrapper = (LsaWrapper) opaque10Lsas.get(lsaKey); break; case OspfParameters.AS_OPAQUE_LSA: lsaWrapper = (LsaWrapper) opaque11Lsas.get(lsaKey); break; case OspfParameters.ROUTER: lsaWrapper = (LsaWrapper) routerLsas.get(lsaKey); break; case OspfParameters.NETWORK: lsaWrapper = (LsaWrapper) networkLsas.get(lsaKey); break; case OspfParameters.ASBR_SUMMARY: lsaWrapper = (LsaWrapper) asbrSummaryLSAs.get(lsaKey); break; case OspfParameters.SUMMARY: lsaWrapper = (LsaWrapper) summaryLsas.get(lsaKey); break; case OspfParameters.EXTERNAL_LSA: lsaWrapper = (LsaWrapper) externalLsas.get(lsaKey); break; default: log.debug("Unknown LSA type..!!!"); break; } if (lsaWrapper != null) { ((LsaWrapperImpl) lsaWrapper).lsaHeader().setAge(lsaWrapper.currentAge()); ((LsaHeader) lsaWrapper.ospfLsa()).setAge(lsaWrapper.currentAge()); } return lsaWrapper; }
OspfLsdbImpl implements OspfLsdb { public LsaWrapper findLsa(int lsType, String lsaKey) { LsaWrapper lsaWrapper = null; switch (lsType) { case OspfParameters.LINK_LOCAL_OPAQUE_LSA: lsaWrapper = (LsaWrapper) opaque9Lsas.get(lsaKey); break; case OspfParameters.AREA_LOCAL_OPAQUE_LSA: lsaWrapper = (LsaWrapper) opaque10Lsas.get(lsaKey); break; case OspfParameters.AS_OPAQUE_LSA: lsaWrapper = (LsaWrapper) opaque11Lsas.get(lsaKey); break; case OspfParameters.ROUTER: lsaWrapper = (LsaWrapper) routerLsas.get(lsaKey); break; case OspfParameters.NETWORK: lsaWrapper = (LsaWrapper) networkLsas.get(lsaKey); break; case OspfParameters.ASBR_SUMMARY: lsaWrapper = (LsaWrapper) asbrSummaryLSAs.get(lsaKey); break; case OspfParameters.SUMMARY: lsaWrapper = (LsaWrapper) summaryLsas.get(lsaKey); break; case OspfParameters.EXTERNAL_LSA: lsaWrapper = (LsaWrapper) externalLsas.get(lsaKey); break; default: log.debug("Unknown LSA type..!!!"); break; } if (lsaWrapper != null) { ((LsaWrapperImpl) lsaWrapper).lsaHeader().setAge(lsaWrapper.currentAge()); ((LsaHeader) lsaWrapper.ospfLsa()).setAge(lsaWrapper.currentAge()); } return lsaWrapper; } }
OspfLsdbImpl implements OspfLsdb { public LsaWrapper findLsa(int lsType, String lsaKey) { LsaWrapper lsaWrapper = null; switch (lsType) { case OspfParameters.LINK_LOCAL_OPAQUE_LSA: lsaWrapper = (LsaWrapper) opaque9Lsas.get(lsaKey); break; case OspfParameters.AREA_LOCAL_OPAQUE_LSA: lsaWrapper = (LsaWrapper) opaque10Lsas.get(lsaKey); break; case OspfParameters.AS_OPAQUE_LSA: lsaWrapper = (LsaWrapper) opaque11Lsas.get(lsaKey); break; case OspfParameters.ROUTER: lsaWrapper = (LsaWrapper) routerLsas.get(lsaKey); break; case OspfParameters.NETWORK: lsaWrapper = (LsaWrapper) networkLsas.get(lsaKey); break; case OspfParameters.ASBR_SUMMARY: lsaWrapper = (LsaWrapper) asbrSummaryLSAs.get(lsaKey); break; case OspfParameters.SUMMARY: lsaWrapper = (LsaWrapper) summaryLsas.get(lsaKey); break; case OspfParameters.EXTERNAL_LSA: lsaWrapper = (LsaWrapper) externalLsas.get(lsaKey); break; default: log.debug("Unknown LSA type..!!!"); break; } if (lsaWrapper != null) { ((LsaWrapperImpl) lsaWrapper).lsaHeader().setAge(lsaWrapper.currentAge()); ((LsaHeader) lsaWrapper.ospfLsa()).setAge(lsaWrapper.currentAge()); } return lsaWrapper; } OspfLsdbImpl(OspfArea ospfArea); }
OspfLsdbImpl implements OspfLsdb { public LsaWrapper findLsa(int lsType, String lsaKey) { LsaWrapper lsaWrapper = null; switch (lsType) { case OspfParameters.LINK_LOCAL_OPAQUE_LSA: lsaWrapper = (LsaWrapper) opaque9Lsas.get(lsaKey); break; case OspfParameters.AREA_LOCAL_OPAQUE_LSA: lsaWrapper = (LsaWrapper) opaque10Lsas.get(lsaKey); break; case OspfParameters.AS_OPAQUE_LSA: lsaWrapper = (LsaWrapper) opaque11Lsas.get(lsaKey); break; case OspfParameters.ROUTER: lsaWrapper = (LsaWrapper) routerLsas.get(lsaKey); break; case OspfParameters.NETWORK: lsaWrapper = (LsaWrapper) networkLsas.get(lsaKey); break; case OspfParameters.ASBR_SUMMARY: lsaWrapper = (LsaWrapper) asbrSummaryLSAs.get(lsaKey); break; case OspfParameters.SUMMARY: lsaWrapper = (LsaWrapper) summaryLsas.get(lsaKey); break; case OspfParameters.EXTERNAL_LSA: lsaWrapper = (LsaWrapper) externalLsas.get(lsaKey); break; default: log.debug("Unknown LSA type..!!!"); break; } if (lsaWrapper != null) { ((LsaWrapperImpl) lsaWrapper).lsaHeader().setAge(lsaWrapper.currentAge()); ((LsaHeader) lsaWrapper.ospfLsa()).setAge(lsaWrapper.currentAge()); } return lsaWrapper; } 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 LsaWrapper findLsa(int lsType, String lsaKey) { LsaWrapper lsaWrapper = null; switch (lsType) { case OspfParameters.LINK_LOCAL_OPAQUE_LSA: lsaWrapper = (LsaWrapper) opaque9Lsas.get(lsaKey); break; case OspfParameters.AREA_LOCAL_OPAQUE_LSA: lsaWrapper = (LsaWrapper) opaque10Lsas.get(lsaKey); break; case OspfParameters.AS_OPAQUE_LSA: lsaWrapper = (LsaWrapper) opaque11Lsas.get(lsaKey); break; case OspfParameters.ROUTER: lsaWrapper = (LsaWrapper) routerLsas.get(lsaKey); break; case OspfParameters.NETWORK: lsaWrapper = (LsaWrapper) networkLsas.get(lsaKey); break; case OspfParameters.ASBR_SUMMARY: lsaWrapper = (LsaWrapper) asbrSummaryLSAs.get(lsaKey); break; case OspfParameters.SUMMARY: lsaWrapper = (LsaWrapper) summaryLsas.get(lsaKey); break; case OspfParameters.EXTERNAL_LSA: lsaWrapper = (LsaWrapper) externalLsas.get(lsaKey); break; default: log.debug("Unknown LSA type..!!!"); break; } if (lsaWrapper != null) { ((LsaWrapperImpl) lsaWrapper).lsaHeader().setAge(lsaWrapper.currentAge()); ((LsaHeader) lsaWrapper.ospfLsa()).setAge(lsaWrapper.currentAge()); } return lsaWrapper; } 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);  }