@Test public void testGetLsaKey() throws Exception { opaqueLsaHeader = new OpaqueLsaHeader(); opaqueLsaHeader.setLsType(1); assertThat(ospfLsdb.getLsaKey(opaqueLsaHeader), is(notNullValue())); opaqueLsaHeader = new OpaqueLsaHeader(); opaqueLsaHeader.setLsType(2); assertThat(ospfLsdb.getLsaKey(opaqueLsaHeader), is(notNullValue())); opaqueLsaHeader = new OpaqueLsaHeader(); opaqueLsaHeader.setLsType(3); assertThat(ospfLsdb.getLsaKey(opaqueLsaHeader), is(notNullValue())); opaqueLsaHeader = new OpaqueLsaHeader(); opaqueLsaHeader.setLsType(4); assertThat(ospfLsdb.getLsaKey(opaqueLsaHeader), is(notNullValue())); opaqueLsaHeader = new OpaqueLsaHeader(); opaqueLsaHeader.setLsType(5); assertThat(ospfLsdb.getLsaKey(opaqueLsaHeader), is(notNullValue())); opaqueLsaHeader = new OpaqueLsaHeader(); opaqueLsaHeader.setLsType(9); assertThat(ospfLsdb.getLsaKey(opaqueLsaHeader), is(notNullValue())); opaqueLsaHeader = new OpaqueLsaHeader(); opaqueLsaHeader.setLsType(10); assertThat(ospfLsdb.getLsaKey(opaqueLsaHeader), is(notNullValue())); opaqueLsaHeader = new OpaqueLsaHeader(); opaqueLsaHeader.setLsType(11); assertThat(ospfLsdb.getLsaKey(opaqueLsaHeader), is(notNullValue())); }
public String getLsaKey(LsaHeader lsaHeader) { String lsaKey = ""; switch (lsaHeader.lsType()) { case OspfParameters.LINK_LOCAL_OPAQUE_LSA: case OspfParameters.AREA_LOCAL_OPAQUE_LSA: case OspfParameters.AS_OPAQUE_LSA: OpaqueLsaHeader header = (OpaqueLsaHeader) lsaHeader; lsaKey = lsaHeader.lsType() + "-" + header.opaqueType() + header.opaqueId() + "-" + lsaHeader.advertisingRouter(); break; case OspfParameters.ROUTER: case OspfParameters.NETWORK: case OspfParameters.ASBR_SUMMARY: case OspfParameters.SUMMARY: case OspfParameters.EXTERNAL_LSA: lsaKey = lsaHeader.lsType() + "-" + lsaHeader.linkStateId() + "-" + lsaHeader.advertisingRouter(); break; default: log.debug("Unknown LSA type..!!!"); break; } return lsaKey; }
OspfLsdbImpl implements OspfLsdb { public String getLsaKey(LsaHeader lsaHeader) { String lsaKey = ""; switch (lsaHeader.lsType()) { case OspfParameters.LINK_LOCAL_OPAQUE_LSA: case OspfParameters.AREA_LOCAL_OPAQUE_LSA: case OspfParameters.AS_OPAQUE_LSA: OpaqueLsaHeader header = (OpaqueLsaHeader) lsaHeader; lsaKey = lsaHeader.lsType() + "-" + header.opaqueType() + header.opaqueId() + "-" + lsaHeader.advertisingRouter(); break; case OspfParameters.ROUTER: case OspfParameters.NETWORK: case OspfParameters.ASBR_SUMMARY: case OspfParameters.SUMMARY: case OspfParameters.EXTERNAL_LSA: lsaKey = lsaHeader.lsType() + "-" + lsaHeader.linkStateId() + "-" + lsaHeader.advertisingRouter(); break; default: log.debug("Unknown LSA type..!!!"); break; } return lsaKey; } }
OspfLsdbImpl implements OspfLsdb { public String getLsaKey(LsaHeader lsaHeader) { String lsaKey = ""; switch (lsaHeader.lsType()) { case OspfParameters.LINK_LOCAL_OPAQUE_LSA: case OspfParameters.AREA_LOCAL_OPAQUE_LSA: case OspfParameters.AS_OPAQUE_LSA: OpaqueLsaHeader header = (OpaqueLsaHeader) lsaHeader; lsaKey = lsaHeader.lsType() + "-" + header.opaqueType() + header.opaqueId() + "-" + lsaHeader.advertisingRouter(); break; case OspfParameters.ROUTER: case OspfParameters.NETWORK: case OspfParameters.ASBR_SUMMARY: case OspfParameters.SUMMARY: case OspfParameters.EXTERNAL_LSA: lsaKey = lsaHeader.lsType() + "-" + lsaHeader.linkStateId() + "-" + lsaHeader.advertisingRouter(); break; default: log.debug("Unknown LSA type..!!!"); break; } return lsaKey; } OspfLsdbImpl(OspfArea ospfArea); }
OspfLsdbImpl implements OspfLsdb { public String getLsaKey(LsaHeader lsaHeader) { String lsaKey = ""; switch (lsaHeader.lsType()) { case OspfParameters.LINK_LOCAL_OPAQUE_LSA: case OspfParameters.AREA_LOCAL_OPAQUE_LSA: case OspfParameters.AS_OPAQUE_LSA: OpaqueLsaHeader header = (OpaqueLsaHeader) lsaHeader; lsaKey = lsaHeader.lsType() + "-" + header.opaqueType() + header.opaqueId() + "-" + lsaHeader.advertisingRouter(); break; case OspfParameters.ROUTER: case OspfParameters.NETWORK: case OspfParameters.ASBR_SUMMARY: case OspfParameters.SUMMARY: case OspfParameters.EXTERNAL_LSA: lsaKey = lsaHeader.lsType() + "-" + lsaHeader.linkStateId() + "-" + lsaHeader.advertisingRouter(); break; default: log.debug("Unknown LSA type..!!!"); break; } return lsaKey; } 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 String getLsaKey(LsaHeader lsaHeader) { String lsaKey = ""; switch (lsaHeader.lsType()) { case OspfParameters.LINK_LOCAL_OPAQUE_LSA: case OspfParameters.AREA_LOCAL_OPAQUE_LSA: case OspfParameters.AS_OPAQUE_LSA: OpaqueLsaHeader header = (OpaqueLsaHeader) lsaHeader; lsaKey = lsaHeader.lsType() + "-" + header.opaqueType() + header.opaqueId() + "-" + lsaHeader.advertisingRouter(); break; case OspfParameters.ROUTER: case OspfParameters.NETWORK: case OspfParameters.ASBR_SUMMARY: case OspfParameters.SUMMARY: case OspfParameters.EXTERNAL_LSA: lsaKey = lsaHeader.lsType() + "-" + lsaHeader.linkStateId() + "-" + lsaHeader.advertisingRouter(); break; default: log.debug("Unknown LSA type..!!!"); break; } return lsaKey; } 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);  }