Pavlin Radoslavov

Renamed bgpRoutes field in Router class to ribTable.

No functional changes.

Change-Id: I1b5de1b93dc1264adfcd7c4cad9c2a315c1b8992
......@@ -74,7 +74,7 @@ public class Router implements RouteListener {
// Store all route updates in a radix tree.
// The key in this tree is the binary string of prefix of the route.
private InvertedRadixTree<RouteEntry> bgpRoutes;
private InvertedRadixTree<RouteEntry> ribTable;
// Stores all incoming route updates in a queue.
private final BlockingQueue<Collection<RouteUpdate>> routeUpdatesQueue;
......@@ -114,7 +114,7 @@ public class Router implements RouteListener {
this.hostListener = new InternalHostListener();
bgpRoutes = new ConcurrentInvertedRadixTree<>(
ribTable = new ConcurrentInvertedRadixTree<>(
new DefaultByteArrayNodeFactory());
routeUpdatesQueue = new LinkedBlockingQueue<>();
routesWaitingOnArp = Multimaps.synchronizedSetMultimap(
......@@ -151,7 +151,7 @@ public class Router implements RouteListener {
synchronized (this) {
// Cleanup all local state
bgpRoutes = new ConcurrentInvertedRadixTree<>(
ribTable = new ConcurrentInvertedRadixTree<>(
new DefaultByteArrayNodeFactory());
routeUpdatesQueue.clear();
routesWaitingOnArp.clear();
......@@ -255,8 +255,7 @@ public class Router implements RouteListener {
Ip4Prefix prefix = routeEntry.prefix();
Ip4Address nextHop = null;
RouteEntry foundRouteEntry =
bgpRoutes.put(RouteEntry.createBinaryString(prefix),
routeEntry);
ribTable.put(RouteEntry.createBinaryString(prefix), routeEntry);
if (foundRouteEntry != null) {
nextHop = foundRouteEntry.nextHop();
}
......@@ -394,7 +393,7 @@ public class Router implements RouteListener {
log.debug("Processing route delete: {}", routeEntry);
Ip4Prefix prefix = routeEntry.prefix();
if (bgpRoutes.remove(RouteEntry.createBinaryString(prefix))) {
if (ribTable.remove(RouteEntry.createBinaryString(prefix))) {
//
// Only withdraw intents if an entry was actually removed from the
// tree. If no entry was removed, the <prefix, nexthop> wasn't
......@@ -435,7 +434,7 @@ public class Router implements RouteListener {
Ip4Prefix prefix = routeEntry.prefix();
String binaryString = RouteEntry.createBinaryString(prefix);
RouteEntry foundRouteEntry =
bgpRoutes.getValueForExactKey(binaryString);
ribTable.getValueForExactKey(binaryString);
if (foundRouteEntry != null &&
foundRouteEntry.nextHop().equals(routeEntry.nextHop())) {
// We only push prefix flows if the prefix is still in the
......@@ -471,7 +470,7 @@ public class Router implements RouteListener {
*/
public Collection<RouteEntry> getRoutes() {
Iterator<KeyValuePair<RouteEntry>> it =
bgpRoutes.getKeyValuePairsForKeysStartingWith("").iterator();
ribTable.getKeyValuePairsForKeysStartingWith("").iterator();
List<RouteEntry> routes = new LinkedList<>();
......
......@@ -291,24 +291,24 @@ public class IntentSyncTest extends AbstractIntentTest {
MultiPointToSinglePointIntent intent6 = intentBuilder(
routeEntry6.prefix(), "00:00:00:00:00:01", SW1_ETH1);
// Set up the bgpRoutes field in Router class and routeIntents fields
// Set up the ribTable field in Router class and routeIntents fields
// in IntentSynchronizer class
InvertedRadixTree<RouteEntry> bgpRoutes =
InvertedRadixTree<RouteEntry> ribTable =
new ConcurrentInvertedRadixTree<>(
new DefaultByteArrayNodeFactory());
bgpRoutes.put(RouteEntry.createBinaryString(routeEntry1.prefix()),
routeEntry1);
bgpRoutes.put(RouteEntry.createBinaryString(routeEntry3.prefix()),
routeEntry3);
bgpRoutes.put(RouteEntry.createBinaryString(routeEntry4Update.prefix()),
routeEntry4Update);
bgpRoutes.put(RouteEntry.createBinaryString(routeEntry5.prefix()),
routeEntry5);
bgpRoutes.put(RouteEntry.createBinaryString(routeEntry6.prefix()),
routeEntry6);
bgpRoutes.put(RouteEntry.createBinaryString(routeEntry7.prefix()),
routeEntry7);
TestUtils.setField(router, "bgpRoutes", bgpRoutes);
ribTable.put(RouteEntry.createBinaryString(routeEntry1.prefix()),
routeEntry1);
ribTable.put(RouteEntry.createBinaryString(routeEntry3.prefix()),
routeEntry3);
ribTable.put(RouteEntry.createBinaryString(routeEntry4Update.prefix()),
routeEntry4Update);
ribTable.put(RouteEntry.createBinaryString(routeEntry5.prefix()),
routeEntry5);
ribTable.put(RouteEntry.createBinaryString(routeEntry6.prefix()),
routeEntry6);
ribTable.put(RouteEntry.createBinaryString(routeEntry7.prefix()),
routeEntry7);
TestUtils.setField(router, "ribTable", ribTable);
ConcurrentHashMap<Ip4Prefix, MultiPointToSinglePointIntent>
routeIntents = new ConcurrentHashMap<>();
......
......@@ -268,9 +268,9 @@ public class RouterAsyncArpTest extends AbstractIntentTest {
// Construct the existing MultiPointToSinglePointIntent intent
MultiPointToSinglePointIntent intent = staticIntentBuilder();
// Set up the bgpRoutes field of Router class with existing route, and
// Set up the ribTable field of Router class with existing route, and
// routeIntents field with the corresponding existing intent
setBgpRoutesField(routeEntry);
setRibTableField(routeEntry);
setRouteIntentsField(routeEntry, intent);
// Start to construct a new route entry and new intent
......@@ -359,9 +359,9 @@ public class RouterAsyncArpTest extends AbstractIntentTest {
// Construct the existing MultiPointToSinglePointIntent intent
MultiPointToSinglePointIntent intent = staticIntentBuilder();
// Set up the bgpRoutes field of Router class with existing route, and
// Set up the ribTable field of Router class with existing route, and
// routeIntents field with the corresponding existing intent
setBgpRoutesField(routeEntry);
setRibTableField(routeEntry);
setRouteIntentsField(routeEntry, intent);
// Set up expectation
......@@ -412,19 +412,19 @@ public class RouterAsyncArpTest extends AbstractIntentTest {
}
/**
* Sets bgpRoutesField in Router class.
* Sets ribTable Field in Router class.
*
* @throws TestUtilsException
*/
private void setBgpRoutesField(RouteEntry routeEntry)
private void setRibTableField(RouteEntry routeEntry)
throws TestUtilsException {
InvertedRadixTree<RouteEntry> bgpRoutes =
InvertedRadixTree<RouteEntry> ribTable =
new ConcurrentInvertedRadixTree<>(
new DefaultByteArrayNodeFactory());
bgpRoutes.put(RouteEntry.createBinaryString(routeEntry.prefix()),
routeEntry);
TestUtils.setField(router, "bgpRoutes", bgpRoutes);
ribTable.put(RouteEntry.createBinaryString(routeEntry.prefix()),
routeEntry);
TestUtils.setField(router, "ribTable", ribTable);
}
/**
......