@Test public void testMaxageLsa() throws Exception { lsaWrapper = EasyMock.createMock(LsaWrapperImpl.class); ospfArea = new OspfAreaImpl(); lsdbAge = new LsdbAgeImpl(ospfArea); lsaWrapper.setLsdbAge(lsdbAge); lsdbAge.addLsaToMaxAgeBin("lsa1", lsaWrapper); lsaBin = new LsaBinImpl(1); lsaBin.addOspfLsa("1", lsaWrapper); lsaWrapper = EasyMock.createMock(LsaWrapperImpl.class); lsdbAge.addLsaToMaxAgeBin("lsa2", lsaWrapper); lsaBin.addOspfLsa("2", lsaWrapper); lsdbAge.startDbAging(); lsdbAge = new LsdbAgeImpl(new OspfAreaImpl()); lsdbAge.ageLsaAndFlood(); lsdbAge.maxAgeLsa(); assertThat(lsdbAge, is(notNullValue())); }
public void maxAgeLsa() { if (ageCounter == 0) { return; } LsaBin lsaBin = ageBins.get(ageCounter - 1); if (lsaBin == null) { return; } Map lsaBinMap = lsaBin.listOfLsa(); for (Object key : lsaBinMap.keySet()) { LsaWrapper lsa = (LsaWrapper) lsaBinMap.get((String) key); if (lsa.currentAge() == OspfParameters.MAXAGE) { lsa.setLsaProcessing(OspfParameters.MAXAGELSA); log.debug("Lsa picked for maxage flooding. Age Counter: {}, AgeCounterRollover: {}, " + "AgeCounterRollover WhenAddedToDb: {}, LSA Type: {}, LSA Key: {}", ageCounter, ageCounterRollOver, lsa.currentAge(), lsa.lsaType(), key); try { lsaQueue.put(lsa); lsaBin.removeOspfLsa((String) key, lsa); } catch (InterruptedException e) { log.debug("Error::LSDBAge::maxAgeLsa::{}", e.getMessage()); } } } Map lsaMaxAgeBinMap = maxAgeBin.listOfLsa(); for (Object key : lsaMaxAgeBinMap.keySet()) { LsaWrapper lsa = (LsaWrapper) lsaMaxAgeBinMap.get((String) key); lsa.setLsaProcessing(OspfParameters.MAXAGELSA); log.debug("Lsa picked for maxage flooding. Age Counter: {}, LSA Type: {}, LSA Key: {}", ageCounter, lsa.lsaType(), key); try { lsaQueue.put(lsa); maxAgeBin.removeOspfLsa((String) key, lsa); } catch (InterruptedException e) { log.debug("Error::LSDBAge::maxAgeLsa::{}", e.getMessage()); } } }
LsdbAgeImpl implements LsdbAge { public void maxAgeLsa() { if (ageCounter == 0) { return; } LsaBin lsaBin = ageBins.get(ageCounter - 1); if (lsaBin == null) { return; } Map lsaBinMap = lsaBin.listOfLsa(); for (Object key : lsaBinMap.keySet()) { LsaWrapper lsa = (LsaWrapper) lsaBinMap.get((String) key); if (lsa.currentAge() == OspfParameters.MAXAGE) { lsa.setLsaProcessing(OspfParameters.MAXAGELSA); log.debug("Lsa picked for maxage flooding. Age Counter: {}, AgeCounterRollover: {}, " + "AgeCounterRollover WhenAddedToDb: {}, LSA Type: {}, LSA Key: {}", ageCounter, ageCounterRollOver, lsa.currentAge(), lsa.lsaType(), key); try { lsaQueue.put(lsa); lsaBin.removeOspfLsa((String) key, lsa); } catch (InterruptedException e) { log.debug("Error::LSDBAge::maxAgeLsa::{}", e.getMessage()); } } } Map lsaMaxAgeBinMap = maxAgeBin.listOfLsa(); for (Object key : lsaMaxAgeBinMap.keySet()) { LsaWrapper lsa = (LsaWrapper) lsaMaxAgeBinMap.get((String) key); lsa.setLsaProcessing(OspfParameters.MAXAGELSA); log.debug("Lsa picked for maxage flooding. Age Counter: {}, LSA Type: {}, LSA Key: {}", ageCounter, lsa.lsaType(), key); try { lsaQueue.put(lsa); maxAgeBin.removeOspfLsa((String) key, lsa); } catch (InterruptedException e) { log.debug("Error::LSDBAge::maxAgeLsa::{}", e.getMessage()); } } } }
LsdbAgeImpl implements LsdbAge { public void maxAgeLsa() { if (ageCounter == 0) { return; } LsaBin lsaBin = ageBins.get(ageCounter - 1); if (lsaBin == null) { return; } Map lsaBinMap = lsaBin.listOfLsa(); for (Object key : lsaBinMap.keySet()) { LsaWrapper lsa = (LsaWrapper) lsaBinMap.get((String) key); if (lsa.currentAge() == OspfParameters.MAXAGE) { lsa.setLsaProcessing(OspfParameters.MAXAGELSA); log.debug("Lsa picked for maxage flooding. Age Counter: {}, AgeCounterRollover: {}, " + "AgeCounterRollover WhenAddedToDb: {}, LSA Type: {}, LSA Key: {}", ageCounter, ageCounterRollOver, lsa.currentAge(), lsa.lsaType(), key); try { lsaQueue.put(lsa); lsaBin.removeOspfLsa((String) key, lsa); } catch (InterruptedException e) { log.debug("Error::LSDBAge::maxAgeLsa::{}", e.getMessage()); } } } Map lsaMaxAgeBinMap = maxAgeBin.listOfLsa(); for (Object key : lsaMaxAgeBinMap.keySet()) { LsaWrapper lsa = (LsaWrapper) lsaMaxAgeBinMap.get((String) key); lsa.setLsaProcessing(OspfParameters.MAXAGELSA); log.debug("Lsa picked for maxage flooding. Age Counter: {}, LSA Type: {}, LSA Key: {}", ageCounter, lsa.lsaType(), key); try { lsaQueue.put(lsa); maxAgeBin.removeOspfLsa((String) key, lsa); } catch (InterruptedException e) { log.debug("Error::LSDBAge::maxAgeLsa::{}", e.getMessage()); } } } LsdbAgeImpl(OspfArea ospfArea); }
LsdbAgeImpl implements LsdbAge { public void maxAgeLsa() { if (ageCounter == 0) { return; } LsaBin lsaBin = ageBins.get(ageCounter - 1); if (lsaBin == null) { return; } Map lsaBinMap = lsaBin.listOfLsa(); for (Object key : lsaBinMap.keySet()) { LsaWrapper lsa = (LsaWrapper) lsaBinMap.get((String) key); if (lsa.currentAge() == OspfParameters.MAXAGE) { lsa.setLsaProcessing(OspfParameters.MAXAGELSA); log.debug("Lsa picked for maxage flooding. Age Counter: {}, AgeCounterRollover: {}, " + "AgeCounterRollover WhenAddedToDb: {}, LSA Type: {}, LSA Key: {}", ageCounter, ageCounterRollOver, lsa.currentAge(), lsa.lsaType(), key); try { lsaQueue.put(lsa); lsaBin.removeOspfLsa((String) key, lsa); } catch (InterruptedException e) { log.debug("Error::LSDBAge::maxAgeLsa::{}", e.getMessage()); } } } Map lsaMaxAgeBinMap = maxAgeBin.listOfLsa(); for (Object key : lsaMaxAgeBinMap.keySet()) { LsaWrapper lsa = (LsaWrapper) lsaMaxAgeBinMap.get((String) key); lsa.setLsaProcessing(OspfParameters.MAXAGELSA); log.debug("Lsa picked for maxage flooding. Age Counter: {}, LSA Type: {}, LSA Key: {}", ageCounter, lsa.lsaType(), key); try { lsaQueue.put(lsa); maxAgeBin.removeOspfLsa((String) key, lsa); } catch (InterruptedException e) { log.debug("Error::LSDBAge::maxAgeLsa::{}", e.getMessage()); } } } LsdbAgeImpl(OspfArea ospfArea); @Override boolean equals(Object o); @Override int hashCode(); void addLsaBin(Integer binKey, LsaBin lsaBin); LsaBin getLsaBin(Integer binKey); void addLsaToMaxAgeBin(String key, LsaWrapper wrapper); void removeLsaFromBin(LsaWrapper lsaWrapper); void startDbAging(); void ageLsaAndFlood(); void maxAgeLsa(); void refreshLsa(); void checkAges(); Channel getChannel(); void setChannel(Channel channel); int getAgeCounter(); int getAgeCounterRollOver(); LsaBin getMaxAgeBin(); int age2Bin(int x); }
LsdbAgeImpl implements LsdbAge { public void maxAgeLsa() { if (ageCounter == 0) { return; } LsaBin lsaBin = ageBins.get(ageCounter - 1); if (lsaBin == null) { return; } Map lsaBinMap = lsaBin.listOfLsa(); for (Object key : lsaBinMap.keySet()) { LsaWrapper lsa = (LsaWrapper) lsaBinMap.get((String) key); if (lsa.currentAge() == OspfParameters.MAXAGE) { lsa.setLsaProcessing(OspfParameters.MAXAGELSA); log.debug("Lsa picked for maxage flooding. Age Counter: {}, AgeCounterRollover: {}, " + "AgeCounterRollover WhenAddedToDb: {}, LSA Type: {}, LSA Key: {}", ageCounter, ageCounterRollOver, lsa.currentAge(), lsa.lsaType(), key); try { lsaQueue.put(lsa); lsaBin.removeOspfLsa((String) key, lsa); } catch (InterruptedException e) { log.debug("Error::LSDBAge::maxAgeLsa::{}", e.getMessage()); } } } Map lsaMaxAgeBinMap = maxAgeBin.listOfLsa(); for (Object key : lsaMaxAgeBinMap.keySet()) { LsaWrapper lsa = (LsaWrapper) lsaMaxAgeBinMap.get((String) key); lsa.setLsaProcessing(OspfParameters.MAXAGELSA); log.debug("Lsa picked for maxage flooding. Age Counter: {}, LSA Type: {}, LSA Key: {}", ageCounter, lsa.lsaType(), key); try { lsaQueue.put(lsa); maxAgeBin.removeOspfLsa((String) key, lsa); } catch (InterruptedException e) { log.debug("Error::LSDBAge::maxAgeLsa::{}", e.getMessage()); } } } LsdbAgeImpl(OspfArea ospfArea); @Override boolean equals(Object o); @Override int hashCode(); void addLsaBin(Integer binKey, LsaBin lsaBin); LsaBin getLsaBin(Integer binKey); void addLsaToMaxAgeBin(String key, LsaWrapper wrapper); void removeLsaFromBin(LsaWrapper lsaWrapper); void startDbAging(); void ageLsaAndFlood(); void maxAgeLsa(); void refreshLsa(); void checkAges(); Channel getChannel(); void setChannel(Channel channel); int getAgeCounter(); int getAgeCounterRollOver(); LsaBin getMaxAgeBin(); int age2Bin(int x);  }