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 { ...@@ -74,7 +74,7 @@ public class Router implements RouteListener {
74 74
75 // Store all route updates in a radix tree. 75 // Store all route updates in a radix tree.
76 // The key in this tree is the binary string of prefix of the route. 76 // The key in this tree is the binary string of prefix of the route.
77 - private InvertedRadixTree<RouteEntry> bgpRoutes; 77 + private InvertedRadixTree<RouteEntry> ribTable;
78 78
79 // Stores all incoming route updates in a queue. 79 // Stores all incoming route updates in a queue.
80 private final BlockingQueue<Collection<RouteUpdate>> routeUpdatesQueue; 80 private final BlockingQueue<Collection<RouteUpdate>> routeUpdatesQueue;
...@@ -114,7 +114,7 @@ public class Router implements RouteListener { ...@@ -114,7 +114,7 @@ public class Router implements RouteListener {
114 114
115 this.hostListener = new InternalHostListener(); 115 this.hostListener = new InternalHostListener();
116 116
117 - bgpRoutes = new ConcurrentInvertedRadixTree<>( 117 + ribTable = new ConcurrentInvertedRadixTree<>(
118 new DefaultByteArrayNodeFactory()); 118 new DefaultByteArrayNodeFactory());
119 routeUpdatesQueue = new LinkedBlockingQueue<>(); 119 routeUpdatesQueue = new LinkedBlockingQueue<>();
120 routesWaitingOnArp = Multimaps.synchronizedSetMultimap( 120 routesWaitingOnArp = Multimaps.synchronizedSetMultimap(
...@@ -151,7 +151,7 @@ public class Router implements RouteListener { ...@@ -151,7 +151,7 @@ public class Router implements RouteListener {
151 151
152 synchronized (this) { 152 synchronized (this) {
153 // Cleanup all local state 153 // Cleanup all local state
154 - bgpRoutes = new ConcurrentInvertedRadixTree<>( 154 + ribTable = new ConcurrentInvertedRadixTree<>(
155 new DefaultByteArrayNodeFactory()); 155 new DefaultByteArrayNodeFactory());
156 routeUpdatesQueue.clear(); 156 routeUpdatesQueue.clear();
157 routesWaitingOnArp.clear(); 157 routesWaitingOnArp.clear();
...@@ -255,8 +255,7 @@ public class Router implements RouteListener { ...@@ -255,8 +255,7 @@ public class Router implements RouteListener {
255 Ip4Prefix prefix = routeEntry.prefix(); 255 Ip4Prefix prefix = routeEntry.prefix();
256 Ip4Address nextHop = null; 256 Ip4Address nextHop = null;
257 RouteEntry foundRouteEntry = 257 RouteEntry foundRouteEntry =
258 - bgpRoutes.put(RouteEntry.createBinaryString(prefix), 258 + ribTable.put(RouteEntry.createBinaryString(prefix), routeEntry);
259 - routeEntry);
260 if (foundRouteEntry != null) { 259 if (foundRouteEntry != null) {
261 nextHop = foundRouteEntry.nextHop(); 260 nextHop = foundRouteEntry.nextHop();
262 } 261 }
...@@ -394,7 +393,7 @@ public class Router implements RouteListener { ...@@ -394,7 +393,7 @@ public class Router implements RouteListener {
394 log.debug("Processing route delete: {}", routeEntry); 393 log.debug("Processing route delete: {}", routeEntry);
395 Ip4Prefix prefix = routeEntry.prefix(); 394 Ip4Prefix prefix = routeEntry.prefix();
396 395
397 - if (bgpRoutes.remove(RouteEntry.createBinaryString(prefix))) { 396 + if (ribTable.remove(RouteEntry.createBinaryString(prefix))) {
398 // 397 //
399 // Only withdraw intents if an entry was actually removed from the 398 // Only withdraw intents if an entry was actually removed from the
400 // tree. If no entry was removed, the <prefix, nexthop> wasn't 399 // tree. If no entry was removed, the <prefix, nexthop> wasn't
...@@ -435,7 +434,7 @@ public class Router implements RouteListener { ...@@ -435,7 +434,7 @@ public class Router implements RouteListener {
435 Ip4Prefix prefix = routeEntry.prefix(); 434 Ip4Prefix prefix = routeEntry.prefix();
436 String binaryString = RouteEntry.createBinaryString(prefix); 435 String binaryString = RouteEntry.createBinaryString(prefix);
437 RouteEntry foundRouteEntry = 436 RouteEntry foundRouteEntry =
438 - bgpRoutes.getValueForExactKey(binaryString); 437 + ribTable.getValueForExactKey(binaryString);
439 if (foundRouteEntry != null && 438 if (foundRouteEntry != null &&
440 foundRouteEntry.nextHop().equals(routeEntry.nextHop())) { 439 foundRouteEntry.nextHop().equals(routeEntry.nextHop())) {
441 // We only push prefix flows if the prefix is still in the 440 // We only push prefix flows if the prefix is still in the
...@@ -471,7 +470,7 @@ public class Router implements RouteListener { ...@@ -471,7 +470,7 @@ public class Router implements RouteListener {
471 */ 470 */
472 public Collection<RouteEntry> getRoutes() { 471 public Collection<RouteEntry> getRoutes() {
473 Iterator<KeyValuePair<RouteEntry>> it = 472 Iterator<KeyValuePair<RouteEntry>> it =
474 - bgpRoutes.getKeyValuePairsForKeysStartingWith("").iterator(); 473 + ribTable.getKeyValuePairsForKeysStartingWith("").iterator();
475 474
476 List<RouteEntry> routes = new LinkedList<>(); 475 List<RouteEntry> routes = new LinkedList<>();
477 476
......
...@@ -291,24 +291,24 @@ public class IntentSyncTest extends AbstractIntentTest { ...@@ -291,24 +291,24 @@ public class IntentSyncTest extends AbstractIntentTest {
291 MultiPointToSinglePointIntent intent6 = intentBuilder( 291 MultiPointToSinglePointIntent intent6 = intentBuilder(
292 routeEntry6.prefix(), "00:00:00:00:00:01", SW1_ETH1); 292 routeEntry6.prefix(), "00:00:00:00:00:01", SW1_ETH1);
293 293
294 - // Set up the bgpRoutes field in Router class and routeIntents fields 294 + // Set up the ribTable field in Router class and routeIntents fields
295 // in IntentSynchronizer class 295 // in IntentSynchronizer class
296 - InvertedRadixTree<RouteEntry> bgpRoutes = 296 + InvertedRadixTree<RouteEntry> ribTable =
297 new ConcurrentInvertedRadixTree<>( 297 new ConcurrentInvertedRadixTree<>(
298 new DefaultByteArrayNodeFactory()); 298 new DefaultByteArrayNodeFactory());
299 - bgpRoutes.put(RouteEntry.createBinaryString(routeEntry1.prefix()), 299 + ribTable.put(RouteEntry.createBinaryString(routeEntry1.prefix()),
300 routeEntry1); 300 routeEntry1);
301 - bgpRoutes.put(RouteEntry.createBinaryString(routeEntry3.prefix()), 301 + ribTable.put(RouteEntry.createBinaryString(routeEntry3.prefix()),
302 routeEntry3); 302 routeEntry3);
303 - bgpRoutes.put(RouteEntry.createBinaryString(routeEntry4Update.prefix()), 303 + ribTable.put(RouteEntry.createBinaryString(routeEntry4Update.prefix()),
304 routeEntry4Update); 304 routeEntry4Update);
305 - bgpRoutes.put(RouteEntry.createBinaryString(routeEntry5.prefix()), 305 + ribTable.put(RouteEntry.createBinaryString(routeEntry5.prefix()),
306 routeEntry5); 306 routeEntry5);
307 - bgpRoutes.put(RouteEntry.createBinaryString(routeEntry6.prefix()), 307 + ribTable.put(RouteEntry.createBinaryString(routeEntry6.prefix()),
308 routeEntry6); 308 routeEntry6);
309 - bgpRoutes.put(RouteEntry.createBinaryString(routeEntry7.prefix()), 309 + ribTable.put(RouteEntry.createBinaryString(routeEntry7.prefix()),
310 routeEntry7); 310 routeEntry7);
311 - TestUtils.setField(router, "bgpRoutes", bgpRoutes); 311 + TestUtils.setField(router, "ribTable", ribTable);
312 312
313 ConcurrentHashMap<Ip4Prefix, MultiPointToSinglePointIntent> 313 ConcurrentHashMap<Ip4Prefix, MultiPointToSinglePointIntent>
314 routeIntents = new ConcurrentHashMap<>(); 314 routeIntents = new ConcurrentHashMap<>();
......
...@@ -268,9 +268,9 @@ public class RouterAsyncArpTest extends AbstractIntentTest { ...@@ -268,9 +268,9 @@ public class RouterAsyncArpTest extends AbstractIntentTest {
268 // Construct the existing MultiPointToSinglePointIntent intent 268 // Construct the existing MultiPointToSinglePointIntent intent
269 MultiPointToSinglePointIntent intent = staticIntentBuilder(); 269 MultiPointToSinglePointIntent intent = staticIntentBuilder();
270 270
271 - // Set up the bgpRoutes field of Router class with existing route, and 271 + // Set up the ribTable field of Router class with existing route, and
272 // routeIntents field with the corresponding existing intent 272 // routeIntents field with the corresponding existing intent
273 - setBgpRoutesField(routeEntry); 273 + setRibTableField(routeEntry);
274 setRouteIntentsField(routeEntry, intent); 274 setRouteIntentsField(routeEntry, intent);
275 275
276 // Start to construct a new route entry and new intent 276 // Start to construct a new route entry and new intent
...@@ -359,9 +359,9 @@ public class RouterAsyncArpTest extends AbstractIntentTest { ...@@ -359,9 +359,9 @@ public class RouterAsyncArpTest extends AbstractIntentTest {
359 // Construct the existing MultiPointToSinglePointIntent intent 359 // Construct the existing MultiPointToSinglePointIntent intent
360 MultiPointToSinglePointIntent intent = staticIntentBuilder(); 360 MultiPointToSinglePointIntent intent = staticIntentBuilder();
361 361
362 - // Set up the bgpRoutes field of Router class with existing route, and 362 + // Set up the ribTable field of Router class with existing route, and
363 // routeIntents field with the corresponding existing intent 363 // routeIntents field with the corresponding existing intent
364 - setBgpRoutesField(routeEntry); 364 + setRibTableField(routeEntry);
365 setRouteIntentsField(routeEntry, intent); 365 setRouteIntentsField(routeEntry, intent);
366 366
367 // Set up expectation 367 // Set up expectation
...@@ -412,19 +412,19 @@ public class RouterAsyncArpTest extends AbstractIntentTest { ...@@ -412,19 +412,19 @@ public class RouterAsyncArpTest extends AbstractIntentTest {
412 } 412 }
413 413
414 /** 414 /**
415 - * Sets bgpRoutesField in Router class. 415 + * Sets ribTable Field in Router class.
416 * 416 *
417 * @throws TestUtilsException 417 * @throws TestUtilsException
418 */ 418 */
419 - private void setBgpRoutesField(RouteEntry routeEntry) 419 + private void setRibTableField(RouteEntry routeEntry)
420 throws TestUtilsException { 420 throws TestUtilsException {
421 421
422 - InvertedRadixTree<RouteEntry> bgpRoutes = 422 + InvertedRadixTree<RouteEntry> ribTable =
423 new ConcurrentInvertedRadixTree<>( 423 new ConcurrentInvertedRadixTree<>(
424 new DefaultByteArrayNodeFactory()); 424 new DefaultByteArrayNodeFactory());
425 - bgpRoutes.put(RouteEntry.createBinaryString(routeEntry.prefix()), 425 + ribTable.put(RouteEntry.createBinaryString(routeEntry.prefix()),
426 routeEntry); 426 routeEntry);
427 - TestUtils.setField(router, "bgpRoutes", bgpRoutes); 427 + TestUtils.setField(router, "ribTable", ribTable);
428 } 428 }
429 429
430 /** 430 /**
......