Pavlin Radoslavov

Moved the BGP Route Intent synchronization mechanism from the Router class

to the new class IntentSynchronizer.

Also, minor cleanup in some of the method names and access scope.

Change-Id: I38257cd1d9516ef3b3dd50f23c28015054c73d70
...@@ -96,6 +96,13 @@ public class PeerConnectivityManager { ...@@ -96,6 +96,13 @@ public class PeerConnectivityManager {
96 } 96 }
97 97
98 /** 98 /**
99 + * Stops the peer connectivity manager.
100 + */
101 + public void stop() {
102 + // TODO: Implement it
103 + }
104 +
105 + /**
99 * Sets up paths to establish connectivity between all internal 106 * Sets up paths to establish connectivity between all internal
100 * {@link BgpSpeaker}s and all external {@link BgpPeer}s. 107 * {@link BgpSpeaker}s and all external {@link BgpPeer}s.
101 */ 108 */
......
...@@ -55,6 +55,7 @@ public class SdnIp implements SdnIpService { ...@@ -55,6 +55,7 @@ public class SdnIp implements SdnIpService {
55 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) 55 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
56 protected HostService hostService; 56 protected HostService hostService;
57 57
58 + private IntentSynchronizer intentSynchronizer;
58 private SdnIpConfigReader config; 59 private SdnIpConfigReader config;
59 private PeerConnectivityManager peerConnectivity; 60 private PeerConnectivityManager peerConnectivity;
60 private Router router; 61 private Router router;
...@@ -64,35 +65,41 @@ public class SdnIp implements SdnIpService { ...@@ -64,35 +65,41 @@ public class SdnIp implements SdnIpService {
64 protected void activate() { 65 protected void activate() {
65 log.debug("SDN-IP started"); 66 log.debug("SDN-IP started");
66 67
68 + ApplicationId appId = coreService.registerApplication(SDN_IP_APP);
67 config = new SdnIpConfigReader(); 69 config = new SdnIpConfigReader();
68 config.init(); 70 config.init();
69 71
70 - InterfaceService interfaceService = new HostToInterfaceAdaptor(hostService); 72 + InterfaceService interfaceService =
73 + new HostToInterfaceAdaptor(hostService);
71 74
72 - ApplicationId appId = coreService.registerApplication(SDN_IP_APP); 75 + intentSynchronizer = new IntentSynchronizer(appId, intentService);
76 + intentSynchronizer.start();
73 77
74 peerConnectivity = new PeerConnectivityManager(appId, config, 78 peerConnectivity = new PeerConnectivityManager(appId, config,
75 interfaceService, intentService); 79 interfaceService, intentService);
76 peerConnectivity.start(); 80 peerConnectivity.start();
77 81
78 - router = new Router(appId, intentService, hostService, config, interfaceService); 82 + router = new Router(appId, intentSynchronizer, hostService, config,
83 + interfaceService);
79 router.start(); 84 router.start();
80 85
81 - // Manually set the router as the leader to allow testing 86 + // Manually set the instance as the leader to allow testing
82 // TODO change this when we get a leader election 87 // TODO change this when we get a leader election
83 - router.leaderChanged(true); 88 + intentSynchronizer.leaderChanged(true);
84 89
85 bgpSessionManager = new BgpSessionManager(router); 90 bgpSessionManager = new BgpSessionManager(router);
86 - bgpSessionManager.startUp(2000); // TODO 91 + // TODO: the local BGP listen port number should be configurable
92 + bgpSessionManager.start(2000);
87 93
88 // TODO need to disable link discovery on external ports 94 // TODO need to disable link discovery on external ports
89 -
90 } 95 }
91 96
92 @Deactivate 97 @Deactivate
93 protected void deactivate() { 98 protected void deactivate() {
94 - bgpSessionManager.shutDown(); 99 + bgpSessionManager.stop();
95 - router.shutdown(); 100 + router.stop();
101 + peerConnectivity.stop();
102 + intentSynchronizer.stop();
96 103
97 log.info("Stopped"); 104 log.info("Stopped");
98 } 105 }
...@@ -114,7 +121,7 @@ public class SdnIp implements SdnIpService { ...@@ -114,7 +121,7 @@ public class SdnIp implements SdnIpService {
114 121
115 @Override 122 @Override
116 public void modifyPrimary(boolean isPrimary) { 123 public void modifyPrimary(boolean isPrimary) {
117 - router.leaderChanged(isPrimary); 124 + intentSynchronizer.leaderChanged(isPrimary);
118 } 125 }
119 126
120 static String dpidToUri(String dpid) { 127 static String dpidToUri(String dpid) {
......
...@@ -181,8 +181,8 @@ public class BgpSessionManager { ...@@ -181,8 +181,8 @@ public class BgpSessionManager {
181 * @param listenPortNumber the port number to listen on. By default 181 * @param listenPortNumber the port number to listen on. By default
182 * it should be BgpConstants.BGP_PORT (179) 182 * it should be BgpConstants.BGP_PORT (179)
183 */ 183 */
184 - public void startUp(int listenPortNumber) { 184 + public void start(int listenPortNumber) {
185 - log.debug("BGP Session Manager startUp()"); 185 + log.debug("BGP Session Manager start.");
186 isShutdown = false; 186 isShutdown = false;
187 187
188 ChannelFactory channelFactory = 188 ChannelFactory channelFactory =
...@@ -222,9 +222,9 @@ public class BgpSessionManager { ...@@ -222,9 +222,9 @@ public class BgpSessionManager {
222 } 222 }
223 223
224 /** 224 /**
225 - * Shuts down the BGP Session Manager operation. 225 + * Stops the BGP Session Manager operation.
226 */ 226 */
227 - public void shutDown() { 227 + public void stop() {
228 isShutdown = true; 228 isShutdown = true;
229 allChannels.close().awaitUninterruptibly(); 229 allChannels.close().awaitUninterruptibly();
230 serverBootstrap.releaseExternalResources(); 230 serverBootstrap.releaseExternalResources();
......
...@@ -54,7 +54,8 @@ import com.googlecode.concurrenttrees.radixinverted.ConcurrentInvertedRadixTree; ...@@ -54,7 +54,8 @@ import com.googlecode.concurrenttrees.radixinverted.ConcurrentInvertedRadixTree;
54 import com.googlecode.concurrenttrees.radixinverted.InvertedRadixTree; 54 import com.googlecode.concurrenttrees.radixinverted.InvertedRadixTree;
55 55
56 /** 56 /**
57 - * This class tests the intent synchronization function in Router class. 57 + * This class tests the intent synchronization function in the
58 + * IntentSynchronizer class.
58 */ 59 */
59 public class IntentSyncTest { 60 public class IntentSyncTest {
60 61
...@@ -74,6 +75,7 @@ public class IntentSyncTest { ...@@ -74,6 +75,7 @@ public class IntentSyncTest {
74 DeviceId.deviceId("of:0000000000000003"), 75 DeviceId.deviceId("of:0000000000000003"),
75 PortNumber.portNumber(1)); 76 PortNumber.portNumber(1));
76 77
78 + private IntentSynchronizer intentSynchronizer;
77 private Router router; 79 private Router router;
78 80
79 private static final ApplicationId APPID = new ApplicationId() { 81 private static final ApplicationId APPID = new ApplicationId() {
...@@ -94,7 +96,8 @@ public class IntentSyncTest { ...@@ -94,7 +96,8 @@ public class IntentSyncTest {
94 setUpHostService(); 96 setUpHostService();
95 intentService = createMock(IntentService.class); 97 intentService = createMock(IntentService.class);
96 98
97 - router = new Router(APPID, intentService, 99 + intentSynchronizer = new IntentSynchronizer(APPID, intentService);
100 + router = new Router(APPID, intentSynchronizer,
98 hostService, null, interfaceService); 101 hostService, null, interfaceService);
99 } 102 }
100 103
...@@ -260,7 +263,7 @@ public class IntentSyncTest { ...@@ -260,7 +263,7 @@ public class IntentSyncTest {
260 // Compose a intent, which is equal to intent5 but the id is different. 263 // Compose a intent, which is equal to intent5 but the id is different.
261 MultiPointToSinglePointIntent intent5New = 264 MultiPointToSinglePointIntent intent5New =
262 staticIntentBuilder(intent5, routeEntry5, "00:00:00:00:00:01"); 265 staticIntentBuilder(intent5, routeEntry5, "00:00:00:00:00:01");
263 - assertTrue(TestUtils.callMethod(router, 266 + assertTrue(TestUtils.callMethod(intentSynchronizer,
264 "compareMultiPointToSinglePointIntents", 267 "compareMultiPointToSinglePointIntents",
265 new Class<?>[] {MultiPointToSinglePointIntent.class, 268 new Class<?>[] {MultiPointToSinglePointIntent.class,
266 MultiPointToSinglePointIntent.class}, 269 MultiPointToSinglePointIntent.class},
...@@ -296,7 +299,8 @@ public class IntentSyncTest { ...@@ -296,7 +299,8 @@ public class IntentSyncTest {
296 pushedRouteIntents.put(routeEntry5.prefix(), intent5New); 299 pushedRouteIntents.put(routeEntry5.prefix(), intent5New);
297 pushedRouteIntents.put(routeEntry6.prefix(), intent6); 300 pushedRouteIntents.put(routeEntry6.prefix(), intent6);
298 pushedRouteIntents.put(routeEntry7.prefix(), intent7); 301 pushedRouteIntents.put(routeEntry7.prefix(), intent7);
299 - TestUtils.setField(router, "pushedRouteIntents", pushedRouteIntents); 302 + TestUtils.setField(intentSynchronizer, "pushedRouteIntents",
303 + pushedRouteIntents);
300 304
301 // Set up expectation 305 // Set up expectation
302 reset(intentService); 306 reset(intentService);
...@@ -327,8 +331,9 @@ public class IntentSyncTest { ...@@ -327,8 +331,9 @@ public class IntentSyncTest {
327 replay(intentService); 331 replay(intentService);
328 332
329 // Start the test 333 // Start the test
330 - router.leaderChanged(true); 334 + intentSynchronizer.leaderChanged(true);
331 - TestUtils.callMethod(router, "syncIntents", new Class<?>[] {}); 335 + TestUtils.callMethod(intentSynchronizer, "syncIntents",
336 + new Class<?>[] {});
332 337
333 // Verify 338 // Verify
334 assertEquals(router.getRoutes().size(), 6); 339 assertEquals(router.getRoutes().size(), 6);
...@@ -338,12 +343,12 @@ public class IntentSyncTest { ...@@ -338,12 +343,12 @@ public class IntentSyncTest {
338 assertTrue(router.getRoutes().contains(routeEntry5)); 343 assertTrue(router.getRoutes().contains(routeEntry5));
339 assertTrue(router.getRoutes().contains(routeEntry6)); 344 assertTrue(router.getRoutes().contains(routeEntry6));
340 345
341 - assertEquals(router.getPushedRouteIntents().size(), 6); 346 + assertEquals(intentSynchronizer.getPushedRouteIntents().size(), 6);
342 - assertTrue(router.getPushedRouteIntents().contains(intent1)); 347 + assertTrue(intentSynchronizer.getPushedRouteIntents().contains(intent1));
343 - assertTrue(router.getPushedRouteIntents().contains(intent3)); 348 + assertTrue(intentSynchronizer.getPushedRouteIntents().contains(intent3));
344 - assertTrue(router.getPushedRouteIntents().contains(intent4Update)); 349 + assertTrue(intentSynchronizer.getPushedRouteIntents().contains(intent4Update));
345 - assertTrue(router.getPushedRouteIntents().contains(intent5)); 350 + assertTrue(intentSynchronizer.getPushedRouteIntents().contains(intent5));
346 - assertTrue(router.getPushedRouteIntents().contains(intent6)); 351 + assertTrue(intentSynchronizer.getPushedRouteIntents().contains(intent6));
347 352
348 verify(intentService); 353 verify(intentService);
349 } 354 }
......
...@@ -102,6 +102,7 @@ public class RouterTest { ...@@ -102,6 +102,7 @@ public class RouterTest {
102 } 102 }
103 }; 103 };
104 104
105 + private IntentSynchronizer intentSynchronizer;
105 private Router router; 106 private Router router;
106 107
107 @Before 108 @Before
...@@ -113,7 +114,8 @@ public class RouterTest { ...@@ -113,7 +114,8 @@ public class RouterTest {
113 114
114 intentService = createMock(IntentService.class); 115 intentService = createMock(IntentService.class);
115 116
116 - router = new Router(APPID, intentService, 117 + intentSynchronizer = new IntentSynchronizer(APPID, intentService);
118 + router = new Router(APPID, intentSynchronizer,
117 hostService, sdnIpConfigService, interfaceService); 119 hostService, sdnIpConfigService, interfaceService);
118 } 120 }
119 121
...@@ -258,15 +260,15 @@ public class RouterTest { ...@@ -258,15 +260,15 @@ public class RouterTest {
258 replay(intentService); 260 replay(intentService);
259 261
260 // Call the processRouteAdd() method in Router class 262 // Call the processRouteAdd() method in Router class
261 - router.leaderChanged(true); 263 + intentSynchronizer.leaderChanged(true);
262 - TestUtils.setField(router, "isActivatedLeader", true); 264 + TestUtils.setField(intentSynchronizer, "isActivatedLeader", true);
263 router.processRouteAdd(routeEntry); 265 router.processRouteAdd(routeEntry);
264 266
265 // Verify 267 // Verify
266 assertEquals(router.getRoutes().size(), 1); 268 assertEquals(router.getRoutes().size(), 1);
267 assertTrue(router.getRoutes().contains(routeEntry)); 269 assertTrue(router.getRoutes().contains(routeEntry));
268 - assertEquals(router.getPushedRouteIntents().size(), 1); 270 + assertEquals(intentSynchronizer.getPushedRouteIntents().size(), 1);
269 - assertEquals(router.getPushedRouteIntents().iterator().next(), 271 + assertEquals(intentSynchronizer.getPushedRouteIntents().iterator().next(),
270 intent); 272 intent);
271 verify(intentService); 273 verify(intentService);
272 } 274 }
...@@ -338,15 +340,15 @@ public class RouterTest { ...@@ -338,15 +340,15 @@ public class RouterTest {
338 replay(intentService); 340 replay(intentService);
339 341
340 // Call the processRouteAdd() method in Router class 342 // Call the processRouteAdd() method in Router class
341 - router.leaderChanged(true); 343 + intentSynchronizer.leaderChanged(true);
342 - TestUtils.setField(router, "isActivatedLeader", true); 344 + TestUtils.setField(intentSynchronizer, "isActivatedLeader", true);
343 router.processRouteAdd(routeEntryUpdate); 345 router.processRouteAdd(routeEntryUpdate);
344 346
345 // Verify 347 // Verify
346 assertEquals(router.getRoutes().size(), 1); 348 assertEquals(router.getRoutes().size(), 1);
347 assertTrue(router.getRoutes().contains(routeEntryUpdate)); 349 assertTrue(router.getRoutes().contains(routeEntryUpdate));
348 - assertEquals(router.getPushedRouteIntents().size(), 1); 350 + assertEquals(intentSynchronizer.getPushedRouteIntents().size(), 1);
349 - assertEquals(router.getPushedRouteIntents().iterator().next(), 351 + assertEquals(intentSynchronizer.getPushedRouteIntents().iterator().next(),
350 intentNew); 352 intentNew);
351 verify(intentService); 353 verify(intentService);
352 } 354 }
...@@ -389,13 +391,13 @@ public class RouterTest { ...@@ -389,13 +391,13 @@ public class RouterTest {
389 replay(intentService); 391 replay(intentService);
390 392
391 // Call route deleting method in Router class 393 // Call route deleting method in Router class
392 - router.leaderChanged(true); 394 + intentSynchronizer.leaderChanged(true);
393 - TestUtils.setField(router, "isActivatedLeader", true); 395 + TestUtils.setField(intentSynchronizer, "isActivatedLeader", true);
394 router.processRouteDelete(routeEntry); 396 router.processRouteDelete(routeEntry);
395 397
396 // Verify 398 // Verify
397 assertEquals(router.getRoutes().size(), 0); 399 assertEquals(router.getRoutes().size(), 0);
398 - assertEquals(router.getPushedRouteIntents().size(), 0); 400 + assertEquals(intentSynchronizer.getPushedRouteIntents().size(), 0);
399 verify(intentService); 401 verify(intentService);
400 } 402 }
401 403
...@@ -416,14 +418,14 @@ public class RouterTest { ...@@ -416,14 +418,14 @@ public class RouterTest {
416 replay(intentService); 418 replay(intentService);
417 419
418 // Call the processRouteAdd() method in Router class 420 // Call the processRouteAdd() method in Router class
419 - router.leaderChanged(true); 421 + intentSynchronizer.leaderChanged(true);
420 - TestUtils.setField(router, "isActivatedLeader", true); 422 + TestUtils.setField(intentSynchronizer, "isActivatedLeader", true);
421 router.processRouteAdd(routeEntry); 423 router.processRouteAdd(routeEntry);
422 424
423 // Verify 425 // Verify
424 assertEquals(router.getRoutes().size(), 1); 426 assertEquals(router.getRoutes().size(), 1);
425 assertTrue(router.getRoutes().contains(routeEntry)); 427 assertTrue(router.getRoutes().contains(routeEntry));
426 - assertEquals(router.getPushedRouteIntents().size(), 0); 428 + assertEquals(intentSynchronizer.getPushedRouteIntents().size(), 0);
427 verify(intentService); 429 verify(intentService);
428 } 430 }
429 } 431 }
......
...@@ -92,6 +92,7 @@ public class RouterTestWithAsyncArp { ...@@ -92,6 +92,7 @@ public class RouterTestWithAsyncArp {
92 DeviceId.deviceId("of:0000000000000003"), 92 DeviceId.deviceId("of:0000000000000003"),
93 PortNumber.portNumber(1)); 93 PortNumber.portNumber(1));
94 94
95 + private IntentSynchronizer intentSynchronizer;
95 private Router router; 96 private Router router;
96 private InternalHostListener internalHostListener; 97 private InternalHostListener internalHostListener;
97 98
...@@ -114,7 +115,8 @@ public class RouterTestWithAsyncArp { ...@@ -114,7 +115,8 @@ public class RouterTestWithAsyncArp {
114 hostService = createMock(HostService.class); 115 hostService = createMock(HostService.class);
115 intentService = createMock(IntentService.class); 116 intentService = createMock(IntentService.class);
116 117
117 - router = new Router(APPID, intentService, 118 + intentSynchronizer = new IntentSynchronizer(APPID, intentService);
119 + router = new Router(APPID, intentSynchronizer,
118 hostService, sdnIpConfigService, interfaceService); 120 hostService, sdnIpConfigService, interfaceService);
119 internalHostListener = router.new InternalHostListener(); 121 internalHostListener = router.new InternalHostListener();
120 } 122 }
...@@ -211,8 +213,8 @@ public class RouterTestWithAsyncArp { ...@@ -211,8 +213,8 @@ public class RouterTestWithAsyncArp {
211 replay(intentService); 213 replay(intentService);
212 214
213 // Call the processRouteAdd() method in Router class 215 // Call the processRouteAdd() method in Router class
214 - router.leaderChanged(true); 216 + intentSynchronizer.leaderChanged(true);
215 - TestUtils.setField(router, "isActivatedLeader", true); 217 + TestUtils.setField(intentSynchronizer, "isActivatedLeader", true);
216 router.processRouteAdd(routeEntry); 218 router.processRouteAdd(routeEntry);
217 219
218 Host host = new DefaultHost(ProviderId.NONE, HostId.NONE, 220 Host host = new DefaultHost(ProviderId.NONE, HostId.NONE,
...@@ -227,9 +229,9 @@ public class RouterTestWithAsyncArp { ...@@ -227,9 +229,9 @@ public class RouterTestWithAsyncArp {
227 // Verify 229 // Verify
228 assertEquals(router.getRoutes().size(), 1); 230 assertEquals(router.getRoutes().size(), 1);
229 assertTrue(router.getRoutes().contains(routeEntry)); 231 assertTrue(router.getRoutes().contains(routeEntry));
230 - assertEquals(router.getPushedRouteIntents().size(), 1); 232 + assertEquals(intentSynchronizer.getPushedRouteIntents().size(), 1);
231 - assertEquals(router.getPushedRouteIntents().iterator().next(), 233 + assertEquals(intentSynchronizer.getPushedRouteIntents().iterator().next(),
232 - intent); 234 + intent);
233 verify(intentService); 235 verify(intentService);
234 verify(hostService); 236 verify(hostService);
235 237
...@@ -294,8 +296,8 @@ public class RouterTestWithAsyncArp { ...@@ -294,8 +296,8 @@ public class RouterTestWithAsyncArp {
294 replay(intentService); 296 replay(intentService);
295 297
296 // Call the processRouteAdd() method in Router class 298 // Call the processRouteAdd() method in Router class
297 - router.leaderChanged(true); 299 + intentSynchronizer.leaderChanged(true);
298 - TestUtils.setField(router, "isActivatedLeader", true); 300 + TestUtils.setField(intentSynchronizer, "isActivatedLeader", true);
299 router.processRouteAdd(routeEntryUpdate); 301 router.processRouteAdd(routeEntryUpdate);
300 302
301 Host host = new DefaultHost(ProviderId.NONE, HostId.NONE, 303 Host host = new DefaultHost(ProviderId.NONE, HostId.NONE,
...@@ -310,8 +312,8 @@ public class RouterTestWithAsyncArp { ...@@ -310,8 +312,8 @@ public class RouterTestWithAsyncArp {
310 // Verify 312 // Verify
311 assertEquals(router.getRoutes().size(), 1); 313 assertEquals(router.getRoutes().size(), 1);
312 assertTrue(router.getRoutes().contains(routeEntryUpdate)); 314 assertTrue(router.getRoutes().contains(routeEntryUpdate));
313 - assertEquals(router.getPushedRouteIntents().size(), 1); 315 + assertEquals(intentSynchronizer.getPushedRouteIntents().size(), 1);
314 - assertEquals(router.getPushedRouteIntents().iterator().next(), 316 + assertEquals(intentSynchronizer.getPushedRouteIntents().iterator().next(),
315 intentNew); 317 intentNew);
316 verify(intentService); 318 verify(intentService);
317 verify(hostService); 319 verify(hostService);
...@@ -342,13 +344,13 @@ public class RouterTestWithAsyncArp { ...@@ -342,13 +344,13 @@ public class RouterTestWithAsyncArp {
342 replay(intentService); 344 replay(intentService);
343 345
344 // Call route deleting method in Router class 346 // Call route deleting method in Router class
345 - router.leaderChanged(true); 347 + intentSynchronizer.leaderChanged(true);
346 - TestUtils.setField(router, "isActivatedLeader", true); 348 + TestUtils.setField(intentSynchronizer, "isActivatedLeader", true);
347 router.processRouteDelete(routeEntry); 349 router.processRouteDelete(routeEntry);
348 350
349 // Verify 351 // Verify
350 assertEquals(router.getRoutes().size(), 0); 352 assertEquals(router.getRoutes().size(), 0);
351 - assertEquals(router.getPushedRouteIntents().size(), 0); 353 + assertEquals(intentSynchronizer.getPushedRouteIntents().size(), 0);
352 verify(intentService); 354 verify(intentService);
353 } 355 }
354 356
......
...@@ -66,6 +66,7 @@ public class SdnIpTest { ...@@ -66,6 +66,7 @@ public class SdnIpTest {
66 private static final int MIN_PREFIX_LENGTH = 1; 66 private static final int MIN_PREFIX_LENGTH = 1;
67 private static final int MAX_PREFIX_LENGTH = 32; 67 private static final int MAX_PREFIX_LENGTH = 32;
68 68
69 + private IntentSynchronizer intentSynchronizer;
69 static Router router; 70 static Router router;
70 71
71 private SdnIpConfigService sdnIpConfigService; 72 private SdnIpConfigService sdnIpConfigService;
...@@ -111,7 +112,8 @@ public class SdnIpTest { ...@@ -111,7 +112,8 @@ public class SdnIpTest {
111 intentService = createMock(IntentService.class); 112 intentService = createMock(IntentService.class);
112 random = new Random(); 113 random = new Random();
113 114
114 - router = new Router(APPID, intentService, hostService, 115 + intentSynchronizer = new IntentSynchronizer(APPID, intentService);
116 + router = new Router(APPID, intentSynchronizer, hostService,
115 sdnIpConfigService, interfaceService); 117 sdnIpConfigService, interfaceService);
116 } 118 }
117 119
...@@ -228,8 +230,8 @@ public class SdnIpTest { ...@@ -228,8 +230,8 @@ public class SdnIpTest {
228 230
229 replay(intentService); 231 replay(intentService);
230 232
231 - router.leaderChanged(true); 233 + intentSynchronizer.leaderChanged(true);
232 - TestUtils.setField(router, "isActivatedLeader", true); 234 + TestUtils.setField(intentSynchronizer, "isActivatedLeader", true);
233 235
234 // Add route updates 236 // Add route updates
235 for (RouteUpdate update : routeUpdates) { 237 for (RouteUpdate update : routeUpdates) {
...@@ -239,7 +241,8 @@ public class SdnIpTest { ...@@ -239,7 +241,8 @@ public class SdnIpTest {
239 latch.await(5000, TimeUnit.MILLISECONDS); 241 latch.await(5000, TimeUnit.MILLISECONDS);
240 242
241 assertEquals(router.getRoutes().size(), numRoutes); 243 assertEquals(router.getRoutes().size(), numRoutes);
242 - assertEquals(router.getPushedRouteIntents().size(), numRoutes); 244 + assertEquals(intentSynchronizer.getPushedRouteIntents().size(),
245 + numRoutes);
243 246
244 verify(intentService); 247 verify(intentService);
245 } 248 }
...@@ -295,8 +298,8 @@ public class SdnIpTest { ...@@ -295,8 +298,8 @@ public class SdnIpTest {
295 298
296 replay(intentService); 299 replay(intentService);
297 300
298 - router.leaderChanged(true); 301 + intentSynchronizer.leaderChanged(true);
299 - TestUtils.setField(router, "isActivatedLeader", true); 302 + TestUtils.setField(intentSynchronizer, "isActivatedLeader", true);
300 303
301 // Send the add updates first 304 // Send the add updates first
302 for (RouteUpdate update : routeUpdates) { 305 for (RouteUpdate update : routeUpdates) {
...@@ -314,7 +317,7 @@ public class SdnIpTest { ...@@ -314,7 +317,7 @@ public class SdnIpTest {
314 deleteCount.await(5000, TimeUnit.MILLISECONDS); 317 deleteCount.await(5000, TimeUnit.MILLISECONDS);
315 318
316 assertEquals(0, router.getRoutes().size()); 319 assertEquals(0, router.getRoutes().size());
317 - assertEquals(0, router.getPushedRouteIntents().size()); 320 + assertEquals(0, intentSynchronizer.getPushedRouteIntents().size());
318 verify(intentService); 321 verify(intentService);
319 } 322 }
320 323
......
...@@ -95,7 +95,7 @@ public class BgpSessionManagerTest { ...@@ -95,7 +95,7 @@ public class BgpSessionManagerTest {
95 // 95 //
96 bgpSessionManager = new BgpSessionManager(dummyRouteListener); 96 bgpSessionManager = new BgpSessionManager(dummyRouteListener);
97 // NOTE: We use port 0 to bind on any available port 97 // NOTE: We use port 0 to bind on any available port
98 - bgpSessionManager.startUp(0); 98 + bgpSessionManager.start(0);
99 99
100 // Get the port number the BGP Session Manager is listening on 100 // Get the port number the BGP Session Manager is listening on
101 Channel serverChannel = TestUtils.getField(bgpSessionManager, 101 Channel serverChannel = TestUtils.getField(bgpSessionManager,
...@@ -136,7 +136,7 @@ public class BgpSessionManagerTest { ...@@ -136,7 +136,7 @@ public class BgpSessionManagerTest {
136 136
137 @After 137 @After
138 public void tearDown() throws Exception { 138 public void tearDown() throws Exception {
139 - bgpSessionManager.shutDown(); 139 + bgpSessionManager.stop();
140 bgpSessionManager = null; 140 bgpSessionManager = null;
141 } 141 }
142 142
......