diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/Router.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/Router.java index 0d8236698c..44cc3bf024 100644 --- a/apps/sdnip/src/main/java/org/onosproject/sdnip/Router.java +++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/Router.java @@ -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 bgpRoutes; + private InvertedRadixTree ribTable; // Stores all incoming route updates in a queue. private final BlockingQueue> 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 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 getRoutes() { Iterator> it = - bgpRoutes.getKeyValuePairsForKeysStartingWith("").iterator(); + ribTable.getKeyValuePairsForKeysStartingWith("").iterator(); List routes = new LinkedList<>(); diff --git a/apps/sdnip/src/test/java/org/onosproject/sdnip/IntentSyncTest.java b/apps/sdnip/src/test/java/org/onosproject/sdnip/IntentSyncTest.java index 0e6f5a6e1b..5edab7c353 100644 --- a/apps/sdnip/src/test/java/org/onosproject/sdnip/IntentSyncTest.java +++ b/apps/sdnip/src/test/java/org/onosproject/sdnip/IntentSyncTest.java @@ -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 bgpRoutes = + InvertedRadixTree 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 routeIntents = new ConcurrentHashMap<>(); diff --git a/apps/sdnip/src/test/java/org/onosproject/sdnip/RouterAsyncArpTest.java b/apps/sdnip/src/test/java/org/onosproject/sdnip/RouterAsyncArpTest.java index c220d62132..4d3ad90018 100644 --- a/apps/sdnip/src/test/java/org/onosproject/sdnip/RouterAsyncArpTest.java +++ b/apps/sdnip/src/test/java/org/onosproject/sdnip/RouterAsyncArpTest.java @@ -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 bgpRoutes = + InvertedRadixTree 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); } /**