Various small fixes
Change-Id: I83802169d0d968f7b88d4be2cedba74b15fdd7da
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfInterfaceImpl.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfInterfaceImpl.java
index 79b613a..7c1626b 100644
--- a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfInterfaceImpl.java
+++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfInterfaceImpl.java
@@ -138,6 +138,7 @@
*
* @return OSPF area instance
*/
+ @Override
public OspfArea ospfArea() {
return ospfArea;
}
@@ -156,6 +157,7 @@
*
* @param ospfArea OSPF area instance
*/
+ @Override
public void setOspfArea(OspfArea ospfArea) {
this.ospfArea = ospfArea;
}
@@ -188,6 +190,7 @@
*
* @return network mask
*/
+ @Override
public Ip4Address ipNetworkMask() {
return ipNetworkMask;
}
@@ -207,6 +210,7 @@
*
* @param ospfNbr ospfNbr instance
*/
+ @Override
public void addNeighbouringRouter(OspfNbr ospfNbr) {
listOfNeighbors.put(ospfNbr.neighborId().toString(), ospfNbr);
}
@@ -217,6 +221,7 @@
* @param neighborId neighbors id
* @return ospfNbr neighbor instance
*/
+ @Override
public OspfNbr neighbouringRouter(String neighborId) {
return listOfNeighbors.get(neighborId);
}
@@ -224,6 +229,7 @@
/**
* Removes all the neighbors.
*/
+ @Override
public void removeNeighbors() {
Set<String> neighbors = listOfNeighbors.keySet();
for (String neighborId : neighbors) {
@@ -245,7 +251,7 @@
ospfNeighbor.stopRxMtDdTimer();
ospfNeighbor.stopRxMtLsrTimer();
- listOfNeighbors.remove(ospfNeighbor.neighborId());
+ listOfNeighbors.remove(ospfNeighbor.neighborId().toString());
}
@@ -274,6 +280,7 @@
*
* @param lsaKey key used to store LSA in map
*/
+ @Override
public void removeLsaFromNeighborMap(String lsaKey) {
listOfNeighborMap.remove(lsaKey);
}
@@ -284,6 +291,7 @@
* @param neighborId neighbors id
* @return true if neighbor in list else false
*/
+ @Override
public boolean isNeighborInList(String neighborId) {
return listOfNeighbors.containsKey(neighborId);
}
@@ -293,6 +301,7 @@
*
* @return listOfNeighbors as key value pair
*/
+ @Override
public Map<String, OspfNbr> listOfNeighbors() {
return listOfNeighbors;
}
@@ -311,6 +320,7 @@
*
* @return interface index
*/
+ @Override
public int interfaceIndex() {
return interfaceIndex;
}
@@ -320,6 +330,7 @@
*
* @param interfaceIndex interface index
*/
+ @Override
public void setInterfaceIndex(int interfaceIndex) {
this.interfaceIndex = interfaceIndex;
}
@@ -329,6 +340,7 @@
*
* @return IP address
*/
+ @Override
public Ip4Address ipAddress() {
return ipAddress;
}
@@ -338,6 +350,7 @@
*
* @param ipAddress interface IP address
*/
+ @Override
public void setIpAddress(Ip4Address ipAddress) {
this.ipAddress = ipAddress;
}
@@ -347,6 +360,7 @@
*
* @return routerPriority value
*/
+ @Override
public int routerPriority() {
return routerPriority;
}
@@ -356,6 +370,7 @@
*
* @param routerPriority value
*/
+ @Override
public void setRouterPriority(int routerPriority) {
this.routerPriority = routerPriority;
}
@@ -365,6 +380,7 @@
*
* @return hello interval time
*/
+ @Override
public int helloIntervalTime() {
return helloIntervalTime;
}
@@ -374,6 +390,7 @@
*
* @param helloIntervalTime an integer interval time
*/
+ @Override
public void setHelloIntervalTime(int helloIntervalTime) {
this.helloIntervalTime = helloIntervalTime;
}
@@ -383,6 +400,7 @@
*
* @return router dead interval time
*/
+ @Override
public int routerDeadIntervalTime() {
return routerDeadIntervalTime;
}
@@ -392,6 +410,7 @@
*
* @param routerDeadIntervalTime router dead interval time
*/
+ @Override
public void setRouterDeadIntervalTime(int routerDeadIntervalTime) {
this.routerDeadIntervalTime = routerDeadIntervalTime;
}
@@ -401,6 +420,7 @@
*
* @return interfaceType an integer represents interface type
*/
+ @Override
public int interfaceType() {
return interfaceType;
}
@@ -410,6 +430,7 @@
*
* @param interfaceType interface type
*/
+ @Override
public void setInterfaceType(int interfaceType) {
this.interfaceType = interfaceType;
}
@@ -419,6 +440,7 @@
*
* @return mtu an integer represents max transfer unit
*/
+ @Override
public int mtu() {
return mtu;
}
@@ -428,6 +450,7 @@
*
* @param mtu max transfer unit
*/
+ @Override
public void setMtu(int mtu) {
this.mtu = mtu;
}
@@ -437,6 +460,7 @@
*
* @return retransmit interval
*/
+ @Override
public int reTransmitInterval() {
return reTransmitInterval;
}
@@ -446,6 +470,7 @@
*
* @param reTransmitInterval retransmit interval
*/
+ @Override
public void setReTransmitInterval(int reTransmitInterval) {
this.reTransmitInterval = reTransmitInterval;
}
@@ -455,6 +480,7 @@
*
* @return dr designated routers IP address
*/
+ @Override
public Ip4Address dr() {
return dr;
}
@@ -464,6 +490,7 @@
*
* @param dr designated routers IP address
*/
+ @Override
public void setDr(Ip4Address dr) {
this.dr = dr;
}
@@ -473,6 +500,7 @@
*
* @return bdr backup designated routers IP address
*/
+ @Override
public Ip4Address bdr() {
return bdr;
}
@@ -482,6 +510,7 @@
*
* @param bdr backup designated routers IP address
*/
+ @Override
public void setBdr(Ip4Address bdr) {
this.bdr = bdr;
}
@@ -491,6 +520,7 @@
*
* @throws Exception might throws exception
*/
+ @Override
public void interfaceUp() throws Exception {
log.debug("OSPFInterfaceChannelHandler::interfaceUp...!!!");
if (interfaceType() == OspfInterfaceType.POINT_TO_POINT.value()) {
@@ -578,6 +608,7 @@
* All interface variables are reset, and interface timers disabled.
* Also all neighbor connections associated with the interface are destroyed.
*/
+ @Override
public void interfaceDown() {
log.debug("OSPFInterfaceChannelHandler::interfaceDown ");
stopHelloTimer();
@@ -594,6 +625,7 @@
* @param ctx channel handler context instance.
* @throws Exception might throws exception
*/
+ @Override
public void processOspfMessage(OspfMessage ospfMessage, ChannelHandlerContext ctx) throws Exception {
log.debug("OspfChannelHandler::processOspfMessage...!!!");
@@ -1078,7 +1110,7 @@
OspfUtil.LSA_HEADER_LENGTH; // subtract a normal IP header.
int noLsa = 0;
while (listItr.hasNext()) {
- LsRequestPacket lsRequest = (LsRequestPacket) listItr.next();
+ LsRequestPacket lsRequest = listItr.next();
// to verify length of the LSA
LsaWrapper wrapper = ospfArea.getLsa(lsRequest.lsType(), lsRequest.linkStateId(),
lsRequest.ownRouterId());
@@ -1168,7 +1200,7 @@
LsaHeader lsRequest = (LsaHeader) itr.next();
OspfLsa ospfLsa =
- (OspfLsa) nbr.getPendingReTxList().get(((OspfAreaImpl) ospfArea).getLsaKey(lsRequest));
+ nbr.getPendingReTxList().get(((OspfAreaImpl) ospfArea).getLsaKey(lsRequest));
if (ospfLsa != null) {
String isSame = ((OspfLsdbImpl) ospfArea.database()).isNewerOrSameLsa(
lsRequest, (LsaHeader) ospfLsa);
@@ -1206,6 +1238,7 @@
/**
* Starts the hello timer which sends hello packet every configured seconds.
*/
+ @Override
public void startHelloTimer() {
log.debug("OSPFInterfaceChannelHandler::startHelloTimer");
exServiceHello = Executors.newSingleThreadScheduledExecutor();
@@ -1217,6 +1250,7 @@
/**
* Stops the hello timer.
*/
+ @Override
public void stopHelloTimer() {
log.debug("OSPFInterfaceChannelHandler::stopHelloTimer ");
exServiceHello.shutdown();
@@ -1244,6 +1278,7 @@
/**
* Starts the timer which waits for configured seconds and sends Delayed Ack Packet.
*/
+ @Override
public void startDelayedAckTimer() {
if (!isDelayedAckTimerScheduled) {
log.debug("Started DelayedAckTimer...!!!");
@@ -1259,6 +1294,7 @@
/**
* Stops the delayed acknowledge timer.
*/
+ @Override
public void stopDelayedAckTimer() {
if (isDelayedAckTimerScheduled) {
log.debug("Stopped DelayedAckTimer...!!!");
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/lsdb/LsdbAgeImpl.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/lsdb/LsdbAgeImpl.java
index 636e75c..794d623 100644
--- a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/lsdb/LsdbAgeImpl.java
+++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/lsdb/LsdbAgeImpl.java
@@ -80,7 +80,7 @@
return Objects.equal(ageBins, that.ageBins) &&
Objects.equal(ageCounter, that.ageCounter) &&
Objects.equal(ageCounterRollOver, that.ageCounterRollOver) &&
- Objects.equal(lsaQueue, lsaQueue);
+ Objects.equal(lsaQueue, that.lsaQueue);
}
@Override
@@ -94,6 +94,7 @@
* @param binKey key to store in bin
* @param lsaBin LSA bin instance
*/
+ @Override
public void addLsaBin(Integer binKey, LsaBin lsaBin) {
if (!ageBins.containsKey(binKey)) {
ageBins.put(binKey, lsaBin);
@@ -106,6 +107,7 @@
* @param binKey key
* @return bin instance
*/
+ @Override
public LsaBin getLsaBin(Integer binKey) {
return ageBins.get(binKey);
@@ -117,6 +119,7 @@
* @param key key
* @param wrapper wrapper instance
*/
+ @Override
public void addLsaToMaxAgeBin(String key, LsaWrapper wrapper) {
maxAgeBin.addOspfLsa(key, wrapper);
}
@@ -126,6 +129,7 @@
*
* @param lsaWrapper wrapper instance
*/
+ @Override
public void removeLsaFromBin(LsaWrapper lsaWrapper) {
if (ageBins.containsKey(lsaWrapper.binNumber())) {
LsaBin lsaBin = ageBins.get(lsaWrapper.binNumber());
@@ -137,6 +141,7 @@
/**
* Starts the aging timer and queue consumer.
*/
+ @Override
public void startDbAging() {
startDbAgeTimer();
queueConsumer = new LsaQueueConsumer(lsaQueue, channel, ospfArea);
@@ -147,6 +152,7 @@
/**
* Gets called every 1 second as part of the timer.
*/
+ @Override
public void ageLsaAndFlood() {
//every 5 mins checksum validation
checkAges();
@@ -167,6 +173,7 @@
/**
* If the LSA have completed the MaxAge - they are moved called stop aging and flooded.
*/
+ @Override
public void maxAgeLsa() {
if (ageCounter == 0) {
return;
@@ -178,7 +185,7 @@
}
Map lsaBinMap = lsaBin.listOfLsa();
for (Object key : lsaBinMap.keySet()) {
- LsaWrapper lsa = (LsaWrapper) lsaBinMap.get((String) key);
+ LsaWrapper lsa = (LsaWrapper) lsaBinMap.get(key);
if (lsa.currentAge() == OspfParameters.MAXAGE) {
lsa.setLsaProcessing(OspfParameters.MAXAGELSA);
log.debug("Lsa picked for maxage flooding. Age Counter: {}, AgeCounterRollover: {}, " +
@@ -198,7 +205,7 @@
//Get from maxAgeBin
Map lsaMaxAgeBinMap = maxAgeBin.listOfLsa();
for (Object key : lsaMaxAgeBinMap.keySet()) {
- LsaWrapper lsa = (LsaWrapper) lsaMaxAgeBinMap.get((String) key);
+ LsaWrapper lsa = (LsaWrapper) lsaMaxAgeBinMap.get(key);
lsa.setLsaProcessing(OspfParameters.MAXAGELSA);
log.debug("Lsa picked for maxage flooding. Age Counter: {}, LSA Type: {}, LSA Key: {}",
ageCounter, lsa.lsaType(), key);
@@ -217,6 +224,7 @@
/*
* If the LSA is in age bin of 1800 - it's pushed into refresh list.
*/
+ @Override
public void refreshLsa() {
int binNumber;
if (ageCounter < OspfParameters.LSREFRESHTIME) {
@@ -230,7 +238,7 @@
}
Map lsaBinMap = lsaBin.listOfLsa();
for (Object key : lsaBinMap.keySet()) {
- LsaWrapper lsa = (LsaWrapper) lsaBinMap.get((String) key);
+ LsaWrapper lsa = (LsaWrapper) lsaBinMap.get(key);
try {
if (lsa.isSelfOriginated()) {
log.debug("Lsa picked for refreshLsa. binNumber: {}, LSA Type: {}, LSA Key: {}",
@@ -259,7 +267,7 @@
}
Map lsaBinMap = lsaBin.listOfLsa();
for (Object key : lsaBinMap.keySet()) {
- LsaWrapper lsa = (LsaWrapper) lsaBinMap.get((String) key);
+ LsaWrapper lsa = (LsaWrapper) lsaBinMap.get(key);
lsa.setLsaProcessing(OspfParameters.VERIFYCHECKSUM);
try {
lsaQueue.put(lsa);
@@ -319,6 +327,7 @@
*
* @return ageCounter
*/
+ @Override
public int getAgeCounter() {
return ageCounter;
}
@@ -328,6 +337,7 @@
*
* @return the age counter roll over value
*/
+ @Override
public int getAgeCounterRollOver() {
return ageCounterRollOver;
}
@@ -337,6 +347,7 @@
*
* @return lsa bin instance
*/
+ @Override
public LsaBin getMaxAgeBin() {
return maxAgeBin;
}
@@ -347,6 +358,7 @@
* @param x Can be either age or ageCounter
* @return bin number.
*/
+ @Override
public int age2Bin(int x) {
if (x <= ageCounter) {
return (ageCounter - x);