blob: d057324053c5be88dbbf92d0655780ba9f97b573 [file] [log] [blame]
Andreas Papazoisb85190b2016-02-05 09:44:31 -08001/*
Andreas Papazoise6aebaa2016-05-26 15:25:51 +03002 * Copyright 2016-present Open Networking Laboratory
Andreas Papazoisb85190b2016-02-05 09:44:31 -08003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.sdxl3;
18
19import com.google.common.collect.Sets;
20import org.junit.Before;
21import org.junit.Test;
22import org.onlab.packet.Ethernet;
23import org.onlab.packet.Ip4Address;
24import org.onlab.packet.Ip4Prefix;
25import org.onlab.packet.IpAddress;
26import org.onlab.packet.IpPrefix;
27import org.onlab.packet.MacAddress;
28import org.onlab.packet.VlanId;
29import org.onosproject.TestApplicationId;
30import org.onosproject.core.ApplicationId;
31import org.onosproject.core.CoreServiceAdapter;
32import org.onosproject.incubator.net.intf.Interface;
Andreas Papazoiseb518932016-06-21 13:46:20 +030033import org.onosproject.incubator.net.intf.InterfaceListener;
Andreas Papazoisb85190b2016-02-05 09:44:31 -080034import org.onosproject.incubator.net.intf.InterfaceService;
Andreas Papazoiseb518932016-06-21 13:46:20 +030035import org.onosproject.incubator.net.intf.InterfaceServiceAdapter;
36import org.onosproject.incubator.net.routing.ResolvedRoute;
37import org.onosproject.incubator.net.routing.RouteEvent;
38import org.onosproject.incubator.net.routing.RouteListener;
39import org.onosproject.incubator.net.routing.RouteServiceAdapter;
Andreas Papazoisb85190b2016-02-05 09:44:31 -080040import org.onosproject.net.ConnectPoint;
41import org.onosproject.net.DeviceId;
42import org.onosproject.net.PortNumber;
43import org.onosproject.net.flow.DefaultTrafficSelector;
44import org.onosproject.net.flow.DefaultTrafficTreatment;
45import org.onosproject.net.flow.TrafficSelector;
46import org.onosproject.net.flow.TrafficTreatment;
47import org.onosproject.net.host.InterfaceIpAddress;
48import org.onosproject.net.intent.AbstractIntentTest;
49import org.onosproject.net.intent.Key;
50import org.onosproject.net.intent.MultiPointToSinglePointIntent;
Andreas Papazoisb85190b2016-02-05 09:44:31 -080051import org.onosproject.routing.IntentSynchronizationService;
Andreas Papazoisb85190b2016-02-05 09:44:31 -080052
Yuta HIGUCHI9d64cb22016-06-17 20:37:59 -070053import java.util.ArrayList;
Andreas Papazoisb85190b2016-02-05 09:44:31 -080054import java.util.Collections;
Andreas Papazoisb85190b2016-02-05 09:44:31 -080055import java.util.HashSet;
Yuta HIGUCHI9d64cb22016-06-17 20:37:59 -070056import java.util.List;
Andreas Papazoisb85190b2016-02-05 09:44:31 -080057import java.util.Set;
58
Andreas Papazoiseb518932016-06-21 13:46:20 +030059import static org.easymock.EasyMock.anyObject;
Andreas Papazoisb85190b2016-02-05 09:44:31 -080060import static org.easymock.EasyMock.createMock;
61import static org.easymock.EasyMock.expect;
Andreas Papazoiseb518932016-06-21 13:46:20 +030062import static org.easymock.EasyMock.expectLastCall;
Andreas Papazoisb85190b2016-02-05 09:44:31 -080063import static org.easymock.EasyMock.replay;
64import static org.easymock.EasyMock.reset;
65import static org.easymock.EasyMock.verify;
66import static org.onosproject.routing.TestIntentServiceHelper.eqExceptId;
67
68/**
69 * Unit tests for SdxL3Fib.
70 */
71public class SdxL3FibTest extends AbstractIntentTest {
72
Andreas Papazoisb85190b2016-02-05 09:44:31 -080073 private InterfaceService interfaceService;
74 private SdxL3PeerService peerService;
75
76 private static final String DEVICE1_ID = "of:0000000000000001";
77 private static final String DEVICE2_ID = "of:0000000000000002";
78 private static final String DEVICE3_ID = "of:0000000000000003";
79 private static final String DEVICE4_ID = "of:0000000000000004";
80
81 private static final String PEER1_IP = "192.168.10.1";
82 private static final String PEER2_IP = "192.168.10.2";
83 private static final String PEER3_IP = "192.168.10.3";
84 private static final String PEER4_IP = "192.168.20.4";
85
86 private static final String SPEAKER1_IP = "192.168.10.101";
87 private static final String SPEAKER2_IP = "192.168.20.101";
88
89 private static final String MAC1 = "00:00:00:00:00:01";
90 private static final String MAC2 = "00:00:00:00:00:02";
91
92 private Interface interface1;
93 private Interface interface2;
94 private Interface interface3;
95 private Interface interface4;
96
97 private static final ConnectPoint CONN_POINT1 = new ConnectPoint(
98 DeviceId.deviceId(DEVICE1_ID),
99 PortNumber.portNumber(1));
100
101 private static final ConnectPoint CONN_POINT2 = new ConnectPoint(
102 DeviceId.deviceId(DEVICE2_ID),
103 PortNumber.portNumber(1));
104
105 private static final ConnectPoint CONN_POINT3 = new ConnectPoint(
106 DeviceId.deviceId(DEVICE3_ID),
107 PortNumber.portNumber(1));
108
109 private static final ConnectPoint CONN_POINT4 = new ConnectPoint(
110 DeviceId.deviceId(DEVICE4_ID),
111 PortNumber.portNumber(1));
112
113 private SdxL3Fib sdxL3Fib;
114 private IntentSynchronizationService intentSynchronizer;
115 private final Set<Interface> interfaces = Sets.newHashSet();
116
117 private static final ApplicationId APPID = TestApplicationId.create("sdxl3");
118
Andreas Papazoiseb518932016-06-21 13:46:20 +0300119 private RouteListener routeListener;
120 private InterfaceListener interfaceListener;
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800121
Yuta HIGUCHI9d64cb22016-06-17 20:37:59 -0700122 @Override
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800123 @Before
124 public void setUp() throws Exception {
125 super.setUp();
126
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800127 interfaceService = createMock(InterfaceService.class);
Andreas Papazoiseb518932016-06-21 13:46:20 +0300128 interfaceService.addListener(anyObject(InterfaceListener.class));
129 expectLastCall().andDelegateTo(new InterfaceServiceDelegate());
130
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800131 peerService = createMock(SdxL3PeerService.class);
132
133 // These will set expectations on routingConfig and interfaceService
134 setUpInterfaceService();
135 setUpBgpPeers();
136
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800137 replay(interfaceService);
138 replay(peerService);
139
140 intentSynchronizer = createMock(IntentSynchronizationService.class);
141
142 sdxL3Fib = new SdxL3Fib();
Andreas Papazoiseb518932016-06-21 13:46:20 +0300143 sdxL3Fib.routeService = new TestRouteService();
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800144 sdxL3Fib.coreService = new TestCoreService();
145 sdxL3Fib.interfaceService = interfaceService;
146 sdxL3Fib.intentSynchronizer = intentSynchronizer;
147 sdxL3Fib.peerService = peerService;
148
149 sdxL3Fib.activate();
150 }
151
152 /**
153 * Sets up InterfaceService.
154 */
155 private void setUpInterfaceService() {
Yuta HIGUCHI9d64cb22016-06-17 20:37:59 -0700156 List<InterfaceIpAddress> interfaceIpAddresses1 = new ArrayList<>();
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800157 interfaceIpAddresses1.add(new InterfaceIpAddress(
158 IpAddress.valueOf(SPEAKER1_IP),
159 IpPrefix.valueOf("192.168.10.0/24")));
Yuta HIGUCHI9d64cb22016-06-17 20:37:59 -0700160 interface1 = new Interface("test1",
161 CONN_POINT1,
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800162 interfaceIpAddresses1, MacAddress.valueOf(MAC1),
163 VlanId.NONE);
164 interfaces.add(interface1);
165
Yuta HIGUCHI9d64cb22016-06-17 20:37:59 -0700166 List<InterfaceIpAddress> interfaceIpAddresses2 = new ArrayList<>();
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800167 interfaceIpAddresses2.add(
168 new InterfaceIpAddress(IpAddress.valueOf(SPEAKER1_IP),
169 IpPrefix.valueOf("192.168.10.0/24")));
Yuta HIGUCHI9d64cb22016-06-17 20:37:59 -0700170 interface2 = new Interface("test2",
171 CONN_POINT2,
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800172 interfaceIpAddresses2, MacAddress.valueOf(MAC1),
173 VlanId.NONE);
174 interfaces.add(interface2);
175
Yuta HIGUCHI9d64cb22016-06-17 20:37:59 -0700176 List<InterfaceIpAddress> interfaceIpAddresses3 = new ArrayList<>();
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800177 interfaceIpAddresses3.add(
178 new InterfaceIpAddress(IpAddress.valueOf(SPEAKER1_IP),
179 IpPrefix.valueOf("192.168.10.0/24")));
Yuta HIGUCHI9d64cb22016-06-17 20:37:59 -0700180 interface3 = new Interface("test3",
181 CONN_POINT3,
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800182 interfaceIpAddresses3, MacAddress.valueOf(MAC1),
183 VlanId.vlanId((short) 1));
184 interfaces.add(interface3);
185
Yuta HIGUCHI9d64cb22016-06-17 20:37:59 -0700186 List<InterfaceIpAddress> interfaceIpAddresses4 = new ArrayList<>();
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800187 interfaceIpAddresses4.add(
188 new InterfaceIpAddress(IpAddress.valueOf(SPEAKER2_IP),
189 IpPrefix.valueOf("192.168.20.0/24")));
Yuta HIGUCHI9d64cb22016-06-17 20:37:59 -0700190 interface4 = new Interface("test4",
191 CONN_POINT4,
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800192 interfaceIpAddresses4, MacAddress.valueOf(MAC2),
Andreas Papazoiseb518932016-06-21 13:46:20 +0300193 VlanId.vlanId((short) 2));
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800194 interfaces.add(interface4);
195
196 expect(interfaceService.getInterfacesByPort(CONN_POINT1)).andReturn(
197 Collections.singleton(interface1)).anyTimes();
198 expect(interfaceService.getMatchingInterface(Ip4Address.valueOf(PEER1_IP)))
199 .andReturn(interface1).anyTimes();
200 expect(interfaceService.getInterfacesByPort(CONN_POINT2)).andReturn(
201 Collections.singleton(interface2)).anyTimes();
202 expect(interfaceService.getMatchingInterface(Ip4Address.valueOf(PEER4_IP)))
203 .andReturn(interface1).anyTimes();
204 expect(interfaceService.getInterfacesByPort(CONN_POINT4)).andReturn(
205 Collections.singleton(interface4)).anyTimes();
206
207 expect(interfaceService.getInterfaces()).andReturn(interfaces).anyTimes();
208 }
209
210 /**
211 * Sets up BGP peers in external networks.
212 */
213 private void setUpBgpPeers() {
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800214 expect(peerService.getInterfaceForPeer(IpAddress.valueOf(PEER1_IP)))
215 .andReturn(interface1).anyTimes();
216
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800217 expect(peerService.getInterfaceForPeer(IpAddress.valueOf(PEER2_IP)))
218 .andReturn(interface2).anyTimes();
219
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800220 expect(peerService.getInterfaceForPeer(IpAddress.valueOf(PEER3_IP)))
221 .andReturn(interface3).anyTimes();
222
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800223 expect(peerService.getInterfaceForPeer(IpAddress.valueOf(PEER4_IP)))
224 .andReturn(null).anyTimes();
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800225 }
226
227 /**
Andreas Papazoiseb518932016-06-21 13:46:20 +0300228 * Tests adding a route to the IntentSynchronizer. Peers within the same
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800229 * subnet exist.
230 *
231 * We verify that the synchronizer records the correct state and that the
232 * correct intent is submitted to the IntentService.
233 */
234 @Test
Andreas Papazoiseb518932016-06-21 13:46:20 +0300235 public void testRouteAdd() {
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800236 IpPrefix prefix = Ip4Prefix.valueOf("1.1.1.0/24");
Andreas Papazoiseb518932016-06-21 13:46:20 +0300237 ResolvedRoute route = new ResolvedRoute(prefix,
238 Ip4Address.valueOf(PEER1_IP),
239 MacAddress.valueOf(MAC1));
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800240
241 // Construct a MultiPointToSinglePointIntent intent
242 TrafficSelector.Builder selectorBuilder =
243 DefaultTrafficSelector.builder();
Andreas Papazoiseb518932016-06-21 13:46:20 +0300244 selectorBuilder.matchEthType(Ethernet.TYPE_IPV4).matchIPDst(prefix).matchVlanId(VlanId.ANY);
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800245
246 TrafficTreatment.Builder treatmentBuilder =
247 DefaultTrafficTreatment.builder();
Andreas Papazoiseb518932016-06-21 13:46:20 +0300248 treatmentBuilder.setEthDst(MacAddress.valueOf(MAC1)).popVlan();
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800249
250 Set<ConnectPoint> ingressPoints = new HashSet<>();
251 ingressPoints.add(CONN_POINT2);
252 ingressPoints.add(CONN_POINT3);
253 ingressPoints.add(CONN_POINT4);
254
255 MultiPointToSinglePointIntent intent =
256 MultiPointToSinglePointIntent.builder()
257 .appId(APPID)
258 .key(Key.of(prefix.toString(), APPID))
259 .selector(selectorBuilder.build())
260 .treatment(treatmentBuilder.build())
261 .ingressPoints(ingressPoints)
262 .egressPoint(CONN_POINT1)
263 .constraints(SdxL3Fib.CONSTRAINTS)
264 .build();
265
266 // Setup the expected intents
267 intentSynchronizer.submit(eqExceptId(intent));
268 replay(intentSynchronizer);
269
Andreas Papazoiseb518932016-06-21 13:46:20 +0300270 // Send in the added event
271 routeListener.event(new RouteEvent(RouteEvent.Type.ROUTE_ADDED, route));
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800272
273 verify(intentSynchronizer);
274 }
275
276 /**
Andreas Papazoiseb518932016-06-21 13:46:20 +0300277 * Tests adding a route entry with a next hop in a VLAN.
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800278 *
279 * We verify that the synchronizer records the correct state and that the
280 * correct intent is submitted to the IntentService.
281 */
282 @Test
Andreas Papazoiseb518932016-06-21 13:46:20 +0300283 public void testRouteAddWithVlan() {
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800284 IpPrefix prefix = Ip4Prefix.valueOf("1.1.1.0/24");
Andreas Papazoiseb518932016-06-21 13:46:20 +0300285 ResolvedRoute route = new ResolvedRoute(prefix,
286 Ip4Address.valueOf(PEER3_IP),
287 MacAddress.valueOf(MAC1));
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800288
289 // Construct a MultiPointToSinglePointIntent intent
290 TrafficSelector.Builder selectorBuilder =
291 DefaultTrafficSelector.builder();
292 selectorBuilder.matchEthType(Ethernet.TYPE_IPV4)
Andreas Papazoiseb518932016-06-21 13:46:20 +0300293 .matchIPDst(prefix)
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800294 .matchVlanId(VlanId.ANY);
295
296 TrafficTreatment.Builder treatmentBuilder =
297 DefaultTrafficTreatment.builder();
298 treatmentBuilder.setEthDst(MacAddress.valueOf(MAC1))
299 .setVlanId(VlanId.vlanId((short) 1));
300
301 Set<ConnectPoint> ingressPoints = new HashSet<>();
302 ingressPoints.add(CONN_POINT1);
303 ingressPoints.add(CONN_POINT2);
304 ingressPoints.add(CONN_POINT4);
305
306 MultiPointToSinglePointIntent intent =
307 MultiPointToSinglePointIntent.builder()
308 .appId(APPID)
309 .key(Key.of(prefix.toString(), APPID))
310 .selector(selectorBuilder.build())
311 .treatment(treatmentBuilder.build())
312 .ingressPoints(ingressPoints)
313 .egressPoint(CONN_POINT3)
314 .constraints(SdxL3Fib.CONSTRAINTS)
315 .build();
316
317 // Setup the expected intents
318 intentSynchronizer.submit(eqExceptId(intent));
319
320 replay(intentSynchronizer);
321
Andreas Papazoiseb518932016-06-21 13:46:20 +0300322 // Send in the added event
323 routeListener.event(new RouteEvent(RouteEvent.Type.ROUTE_ADDED, route));
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800324
325 verify(intentSynchronizer);
326 }
327
328 /**
Andreas Papazoiseb518932016-06-21 13:46:20 +0300329 * Tests updating a route entry.
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800330 *
331 * We verify that the synchronizer records the correct state and that the
332 * correct intent is submitted to the IntentService.
333 */
334 @Test
Andreas Papazoiseb518932016-06-21 13:46:20 +0300335 public void testRouteUpdate() {
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800336 // Firstly add a route
Andreas Papazoiseb518932016-06-21 13:46:20 +0300337 testRouteAdd();
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800338
339 IpPrefix prefix = Ip4Prefix.valueOf("1.1.1.0/24");
340
341 // Start to construct a new route entry and new intent
Andreas Papazoiseb518932016-06-21 13:46:20 +0300342 ResolvedRoute route = new ResolvedRoute(prefix,
343 Ip4Address.valueOf(PEER2_IP),
344 MacAddress.valueOf(MAC1));
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800345
346 // Construct a new MultiPointToSinglePointIntent intent
347 TrafficSelector.Builder selectorBuilderNew =
348 DefaultTrafficSelector.builder();
Andreas Papazoiseb518932016-06-21 13:46:20 +0300349 selectorBuilderNew.matchEthType(Ethernet.TYPE_IPV4)
350 .matchIPDst(prefix)
351 .matchVlanId(VlanId.ANY);
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800352
353 TrafficTreatment.Builder treatmentBuilderNew =
354 DefaultTrafficTreatment.builder();
Andreas Papazoiseb518932016-06-21 13:46:20 +0300355 treatmentBuilderNew.setEthDst(MacAddress.valueOf(MAC1)).popVlan();
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800356
357 Set<ConnectPoint> ingressPointsNew = new HashSet<>();
358 ingressPointsNew.add(CONN_POINT1);
359 ingressPointsNew.add(CONN_POINT3);
360 ingressPointsNew.add(CONN_POINT4);
361
362 MultiPointToSinglePointIntent intentNew =
363 MultiPointToSinglePointIntent.builder()
364 .appId(APPID)
365 .key(Key.of(prefix.toString(), APPID))
366 .selector(selectorBuilderNew.build())
367 .treatment(treatmentBuilderNew.build())
368 .ingressPoints(ingressPointsNew)
369 .egressPoint(CONN_POINT2)
370 .constraints(SdxL3Fib.CONSTRAINTS)
371 .build();
372
373 // Set up test expectation
374 reset(intentSynchronizer);
375
376 // Setup the expected intents
377 intentSynchronizer.submit(eqExceptId(intentNew));
378 replay(intentSynchronizer);
379
Andreas Papazoiseb518932016-06-21 13:46:20 +0300380 // Send in the update event
381 routeListener.event(new RouteEvent(RouteEvent.Type.ROUTE_UPDATED, route));
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800382
383 verify(intentSynchronizer);
384 }
385
386 /**
Andreas Papazoiseb518932016-06-21 13:46:20 +0300387 * Tests deleting a route entry.
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800388 *
389 * We verify that the synchronizer records the correct state and that the
390 * correct intent is withdrawn from the IntentService.
391 */
392 @Test
Andreas Papazoiseb518932016-06-21 13:46:20 +0300393 public void testRouteDelete() {
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800394 // Firstly add a route
Andreas Papazoiseb518932016-06-21 13:46:20 +0300395 testRouteAdd();
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800396
397 IpPrefix prefix = Ip4Prefix.valueOf("1.1.1.0/24");
398
399 // Construct the existing route entry
Andreas Papazoiseb518932016-06-21 13:46:20 +0300400 ResolvedRoute route = new ResolvedRoute(prefix, null, null);
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800401
402 // Construct the existing MultiPointToSinglePoint intent
403 TrafficSelector.Builder selectorBuilder =
404 DefaultTrafficSelector.builder();
Andreas Papazoiseb518932016-06-21 13:46:20 +0300405 selectorBuilder.matchEthType(Ethernet.TYPE_IPV4)
406 .matchIPDst(prefix)
407 .matchVlanId(VlanId.ANY);
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800408
409 TrafficTreatment.Builder treatmentBuilder =
410 DefaultTrafficTreatment.builder();
Andreas Papazoiseb518932016-06-21 13:46:20 +0300411 treatmentBuilder.setEthDst(MacAddress.valueOf(MAC1)).popVlan();
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800412
413 Set<ConnectPoint> ingressPoints = new HashSet<>();
414 ingressPoints.add(CONN_POINT2);
415 ingressPoints.add(CONN_POINT3);
416 ingressPoints.add(CONN_POINT4);
417
418 MultiPointToSinglePointIntent addedIntent =
419 MultiPointToSinglePointIntent.builder()
420 .appId(APPID)
421 .key(Key.of(prefix.toString(), APPID))
422 .selector(selectorBuilder.build())
423 .treatment(treatmentBuilder.build())
424 .ingressPoints(ingressPoints)
425 .egressPoint(CONN_POINT1)
426 .constraints(SdxL3Fib.CONSTRAINTS)
427 .build();
428
429 // Set up expectation
430 reset(intentSynchronizer);
431 // Setup the expected intents
432 intentSynchronizer.withdraw(eqExceptId(addedIntent));
433 replay(intentSynchronizer);
434
Andreas Papazoiseb518932016-06-21 13:46:20 +0300435 // Send in the removed event
436 routeListener.event(new RouteEvent(RouteEvent.Type.ROUTE_REMOVED, route));
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800437
438 verify(intentSynchronizer);
439 }
440
441 private class TestCoreService extends CoreServiceAdapter {
442 @Override
443 public ApplicationId getAppId(String name) {
444 return APPID;
445 }
446 }
447
Andreas Papazoiseb518932016-06-21 13:46:20 +0300448 private class TestRouteService extends RouteServiceAdapter {
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800449 @Override
Andreas Papazoiseb518932016-06-21 13:46:20 +0300450 public void addListener(RouteListener routeListener) {
451 SdxL3FibTest.this.routeListener = routeListener;
452 }
453 }
454
455 private class InterfaceServiceDelegate extends InterfaceServiceAdapter {
456 @Override
457 public void addListener(InterfaceListener listener) {
458 SdxL3FibTest.this.interfaceListener = listener;
Andreas Papazoisb85190b2016-02-05 09:44:31 -0800459 }
460 }
461}