}
private static boolean replayNbrConfig(List<Neighbors> neighbors, BgpRouter br) {
- if ((neighbors == null) || (neighbors.isEmpty())) {
+ if (neighbors == null || neighbors.isEmpty()) {
LOG.error("Replaying nbr configuration, received NULL list ");
return true;
}
LOG.debug("Replaying addNbr {}, exception: ", replayNbr.getNbr().getAddress().getValue(), eNbr);
}
boolean replaySuccess = true;
- replaySuccess = (replaySuccess && replayDone);
+ replaySuccess = replaySuccess && replayDone;
LOG.debug("Replay addNbr {} successful", replayNbr.getNbr().getAddress().getValue());
//Update Source handling
replayNbr.getNbr().getAddress().getValue(), eUs);
}
LOG.debug("Replay updatesource {} successful", us.getSourceIp().getValue());
- replaySuccess = (replaySuccess && replayDone);
+ replaySuccess = replaySuccess && replayDone;
}
//Ebgp Multihope
EbgpMultihop en = replayNbr.getNbr().getEbgpMultihop();
LOG.debug("Replaying EbgpMultihop for Nbr {}, exception: ",
replayNbr.getNbr().getAddress().getValue(), eEbgpMhop);
}
- replaySuccess = (replaySuccess && replayDone);
+ replaySuccess = replaySuccess && replayDone;
}
//afs
LOG.debug("Replaying AddressFamily for Nbr {}, exception:",
replayNbr.getNbr().getAddress().getValue(), eAFs);
}
- replaySuccess = (replaySuccess && replayDone);
+ replaySuccess = replaySuccess && replayDone;
}
}
//replay is success --> no need to replay this nbr in next iteration.
} while (nbrRetry.decrementAndRetry());
boolean replaySuccess = true;
for (ReplayNbr replayNbr : replayNbrList) {
- replaySuccess = (replaySuccess && (!replayNbr.isShouldRetry()));
+ replaySuccess = replaySuccess && !replayNbr.isShouldRetry();
}
return replaySuccess;
}
public static void createStaleFibMap() {
totalStaledCount = 0;
try {
- /*
- * at the time Stale FIB creation, Wait till all PENDING write transaction
- * to complete (or)wait for max timeout value of STALE_FIB_WAIT Seconds.
- */
- int retry = STALE_FIB_WAIT;
- while (BgpUtil.getGetPendingWrTransaction() != 0 && retry > 0) {
- Thread.sleep(1000);
- retry--;
- if (retry == 0) {
- LOG.error("TimeOut occured {} seconds, in waiting stale fibDSWriter create", STALE_FIB_WAIT);
- }
- }
staledFibEntriesMap.clear();
InstanceIdentifier<FibEntries> id = InstanceIdentifier.create(FibEntries.class);
DataBroker db = BgpUtil.getBroker();
} else {
LOG.error("createStaleFibMap:: FIBentries.class is not present");
}
- } catch (InterruptedException | ReadFailedException e) {
+ } catch (ReadFailedException e) {
LOG.error("createStaleFibMap:: error ", e);
}
LOG.error("created {} staled entries ", totalStaledCount);
totalExternalRoutes = 0;
totalExternalMacRoutes = 0;
try {
- /*
- * at the time FIB route deletion, Wait till all PENDING write transaction
- * to complete (or)wait for max timeout value of STALE_FIB_WAIT Seconds.
- */
- int retry = STALE_FIB_WAIT;
- String rd;
- while (BgpUtil.getGetPendingWrTransaction() != 0 && retry > 0) {
- Thread.sleep(1000);
- retry--;
- if (retry == 0) {
- LOG.error("TimeOut occured {} seconds, while deleting external routes", STALE_FIB_WAIT);
- }
- }
InstanceIdentifier<FibEntries> id = InstanceIdentifier.create(FibEntries.class);
DataBroker db = BgpUtil.getBroker();
if (db == null) {
}
List<VrfTables> staleVrfTables = fibEntries.get().getVrfTables();
for (VrfTables vrfTable : staleVrfTables) {
- rd = vrfTable.getRouteDistinguisher();
+ String rd = vrfTable.getRouteDistinguisher();
if (vrfTable.getVrfEntry() != null) {
for (VrfEntry vrfEntry : vrfTable.getVrfEntry()) {
if (RouteOrigin.value(vrfEntry.getOrigin()) != RouteOrigin.BGP) {
} else {
LOG.error("deleteExternalFibRoutes:: FIBentries.class is not present");
}
- } catch (InterruptedException | ReadFailedException e) {
+ } catch (ReadFailedException e) {
LOG.error("deleteExternalFibRoutes:: error ", e);
}
LOG.debug("deleted {} fib entries {} mac entries", totalExternalRoutes, totalExternalMacRoutes);
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicInteger;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.mdsalutil.MDSALUtil;
private static final Logger LOG = LoggerFactory.getLogger(BgpUtil.class);
private static DataBroker dataBroker;
public static final int PERIODICITY = 500;
- private static AtomicInteger pendingWrTransaction = new AtomicInteger(0);
public static final int BATCH_SIZE = 1000;
public static Integer batchSize;
public static Integer batchInterval;
return retValue;
}
- // return number of pending Write Transactions with BGP-Util (no read)
- public static int getGetPendingWrTransaction() {
- return pendingWrTransaction.get();
- }
-
static ThreadFactory namedThreadFactory = new ThreadFactoryBuilder()
.setNameFormat("bgp-util-mdsal-%d").build();