blob: 4d14228982a860875d3714d8d4476eaef3b876f7 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
2 * Copyright 2014 Open Networking Laboratory
3 *
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 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.sdnip;
Pingpingfc584672014-10-23 10:51:19 -070017
Jonathan Hart552e31f2015-02-06 11:11:59 -080018import com.google.common.collect.Sets;
19import com.googlecode.concurrenttrees.radix.node.concrete.DefaultByteArrayNodeFactory;
20import com.googlecode.concurrenttrees.radixinverted.ConcurrentInvertedRadixTree;
21import com.googlecode.concurrenttrees.radixinverted.InvertedRadixTree;
Pingpingfc584672014-10-23 10:51:19 -070022import org.junit.Before;
23import org.junit.Test;
24import org.onlab.junit.TestUtils;
25import org.onlab.junit.TestUtils.TestUtilsException;
Jonathan Hart6cd2f352015-01-13 17:44:45 -080026import org.onlab.packet.Ethernet;
27import org.onlab.packet.Ip4Address;
28import org.onlab.packet.Ip4Prefix;
29import org.onlab.packet.IpAddress;
30import org.onlab.packet.IpPrefix;
31import org.onlab.packet.MacAddress;
32import org.onlab.packet.VlanId;
Brian O'Connorabafb502014-12-02 22:26:20 -080033import org.onosproject.core.ApplicationId;
34import org.onosproject.net.ConnectPoint;
35import org.onosproject.net.DefaultHost;
36import org.onosproject.net.DeviceId;
37import org.onosproject.net.Host;
38import org.onosproject.net.HostId;
39import org.onosproject.net.HostLocation;
40import org.onosproject.net.PortNumber;
41import org.onosproject.net.flow.DefaultTrafficSelector;
42import org.onosproject.net.flow.DefaultTrafficTreatment;
43import org.onosproject.net.flow.TrafficSelector;
44import org.onosproject.net.flow.TrafficTreatment;
45import org.onosproject.net.host.HostEvent;
46import org.onosproject.net.host.HostService;
47import org.onosproject.net.host.InterfaceIpAddress;
Jonathan Hart6cd2f352015-01-13 17:44:45 -080048import org.onosproject.net.intent.AbstractIntentTest;
Brian O'Connorabafb502014-12-02 22:26:20 -080049import org.onosproject.net.intent.Intent;
50import org.onosproject.net.intent.IntentOperations;
51import org.onosproject.net.intent.IntentService;
52import org.onosproject.net.intent.MultiPointToSinglePointIntent;
Brian O'Connorabafb502014-12-02 22:26:20 -080053import org.onosproject.net.provider.ProviderId;
54import org.onosproject.sdnip.IntentSynchronizer.IntentKey;
55import org.onosproject.sdnip.Router.InternalHostListener;
56import org.onosproject.sdnip.config.BgpPeer;
57import org.onosproject.sdnip.config.Interface;
58import org.onosproject.sdnip.config.SdnIpConfigurationService;
Pingpingfc584672014-10-23 10:51:19 -070059
Jonathan Hart552e31f2015-02-06 11:11:59 -080060import java.util.Collections;
61import java.util.HashMap;
62import java.util.HashSet;
63import java.util.Map;
64import java.util.Set;
65import java.util.concurrent.ConcurrentHashMap;
66
67import static org.easymock.EasyMock.*;
68import static org.junit.Assert.assertEquals;
69import static org.junit.Assert.assertTrue;
Pingpingfc584672014-10-23 10:51:19 -070070
71/**
72 * This class tests adding a route, updating a route, deleting a route, and
73 * the ARP module answers the MAC address asynchronously.
74 */
Jonathan Hartb8349202014-12-10 11:23:59 -080075public class RouterAsyncArpTest extends AbstractIntentTest {
Pingpingfc584672014-10-23 10:51:19 -070076
Jonathan Hart9965d772014-12-02 10:28:34 -080077 private SdnIpConfigurationService sdnIpConfigService;
Pingpingfc584672014-10-23 10:51:19 -070078 private InterfaceService interfaceService;
79 private IntentService intentService;
80 private HostService hostService;
81
82 private static final ConnectPoint SW1_ETH1 = new ConnectPoint(
83 DeviceId.deviceId("of:0000000000000001"),
84 PortNumber.portNumber(1));
85
86 private static final ConnectPoint SW2_ETH1 = new ConnectPoint(
87 DeviceId.deviceId("of:0000000000000002"),
88 PortNumber.portNumber(1));
89
90 private static final ConnectPoint SW3_ETH1 = new ConnectPoint(
91 DeviceId.deviceId("of:0000000000000003"),
92 PortNumber.portNumber(1));
93
Pavlin Radoslavova071b1e2014-11-17 13:37:57 -080094 private IntentSynchronizer intentSynchronizer;
Pingpingfc584672014-10-23 10:51:19 -070095 private Router router;
96 private InternalHostListener internalHostListener;
97
98 private static final ApplicationId APPID = new ApplicationId() {
99 @Override
100 public short id() {
101 return 1;
102 }
103
104 @Override
105 public String name() {
106 return "SDNIP";
107 }
108 };
109
110 @Before
111 public void setUp() throws Exception {
Brian O'Connor520c0522014-11-23 23:50:47 -0800112 super.setUp();
113
Pingpingfc584672014-10-23 10:51:19 -0700114 setUpSdnIpConfigService();
115 setUpInterfaceService();
116 hostService = createMock(HostService.class);
117 intentService = createMock(IntentService.class);
118
Jonathan Hart552e31f2015-02-06 11:11:59 -0800119 intentSynchronizer = new IntentSynchronizer(APPID, intentService,
120 sdnIpConfigService,
121 interfaceService);
122 router = new Router(intentSynchronizer, hostService);
Pingpingfc584672014-10-23 10:51:19 -0700123 internalHostListener = router.new InternalHostListener();
124 }
125
126 /**
127 * Sets up SdnIpConfigService.
128 */
129 private void setUpSdnIpConfigService() {
130
Jonathan Hart9965d772014-12-02 10:28:34 -0800131 sdnIpConfigService = createMock(SdnIpConfigurationService.class);
Pingpingfc584672014-10-23 10:51:19 -0700132
133 Map<IpAddress, BgpPeer> peers = new HashMap<>();
134
135 String peerSw1Eth1 = "192.168.10.1";
136 peers.put(IpAddress.valueOf(peerSw1Eth1),
137 new BgpPeer("00:00:00:00:00:00:00:01", 1, peerSw1Eth1));
138
139 // Two BGP peers are connected to switch 2 port 1.
140 String peer1Sw2Eth1 = "192.168.20.1";
141 peers.put(IpAddress.valueOf(peer1Sw2Eth1),
142 new BgpPeer("00:00:00:00:00:00:00:02", 1, peer1Sw2Eth1));
143
144 String peer2Sw2Eth1 = "192.168.20.2";
145 peers.put(IpAddress.valueOf(peer2Sw2Eth1),
146 new BgpPeer("00:00:00:00:00:00:00:02", 1, peer2Sw2Eth1));
147
148 expect(sdnIpConfigService.getBgpPeers()).andReturn(peers).anyTimes();
149 replay(sdnIpConfigService);
150 }
151
152 /**
153 * Sets up InterfaceService.
154 */
155 private void setUpInterfaceService() {
156
157 interfaceService = createMock(InterfaceService.class);
158
159 Set<Interface> interfaces = Sets.newHashSet();
160
161 Set<InterfaceIpAddress> interfaceIpAddresses1 = Sets.newHashSet();
162 interfaceIpAddresses1.add(new InterfaceIpAddress(
163 IpAddress.valueOf("192.168.10.101"),
164 IpPrefix.valueOf("192.168.10.0/24")));
165 Interface sw1Eth1 = new Interface(SW1_ETH1,
Jonathan Hart6cd2f352015-01-13 17:44:45 -0800166 interfaceIpAddresses1, MacAddress.valueOf("00:00:00:00:00:01"),
167 VlanId.NONE);
Pingpingfc584672014-10-23 10:51:19 -0700168 interfaces.add(sw1Eth1);
169
170 Set<InterfaceIpAddress> interfaceIpAddresses2 = Sets.newHashSet();
171 interfaceIpAddresses2.add(new InterfaceIpAddress(
172 IpAddress.valueOf("192.168.20.101"),
173 IpPrefix.valueOf("192.168.20.0/24")));
174 Interface sw2Eth1 = new Interface(SW2_ETH1,
Jonathan Hart6cd2f352015-01-13 17:44:45 -0800175 interfaceIpAddresses2, MacAddress.valueOf("00:00:00:00:00:02"),
176 VlanId.NONE);
Pingpingfc584672014-10-23 10:51:19 -0700177 interfaces.add(sw2Eth1);
178
179 Set<InterfaceIpAddress> interfaceIpAddresses3 = Sets.newHashSet();
180 interfaceIpAddresses3.add(new InterfaceIpAddress(
181 IpAddress.valueOf("192.168.30.101"),
182 IpPrefix.valueOf("192.168.30.0/24")));
183 Interface sw3Eth1 = new Interface(SW3_ETH1,
Jonathan Hart6cd2f352015-01-13 17:44:45 -0800184 interfaceIpAddresses3, MacAddress.valueOf("00:00:00:00:00:03"),
185 VlanId.NONE);
Pingpingfc584672014-10-23 10:51:19 -0700186 interfaces.add(sw3Eth1);
187
188 expect(interfaceService.getInterface(SW1_ETH1)).andReturn(sw1Eth1).anyTimes();
189 expect(interfaceService.getInterface(SW2_ETH1)).andReturn(sw2Eth1).anyTimes();
190 expect(interfaceService.getInterface(SW3_ETH1)).andReturn(sw3Eth1).anyTimes();
191 expect(interfaceService.getInterfaces()).andReturn(interfaces).anyTimes();
192 replay(interfaceService);
193 }
194
195 /**
196 * This method tests adding a route entry.
197 */
Pavlin Radoslavov97e8a8b2014-11-24 17:51:28 -0800198 @Test
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800199 public void testRouteAdd() throws TestUtilsException {
Pingpingfc584672014-10-23 10:51:19 -0700200
201 // Construct a route entry
202 RouteEntry routeEntry = new RouteEntry(
Pavlin Radoslavov6b570732014-11-06 13:16:45 -0800203 Ip4Prefix.valueOf("1.1.1.0/24"),
204 Ip4Address.valueOf("192.168.10.1"));
Pingpingfc584672014-10-23 10:51:19 -0700205
206 // Construct a route intent
207 MultiPointToSinglePointIntent intent = staticIntentBuilder();
208
209 // Set up test expectation
210 reset(hostService);
Pavlin Radoslavov33f228a2014-10-27 19:33:16 -0700211 expect(hostService.getHostsByIp(anyObject(IpAddress.class))).andReturn(
Pingpingfc584672014-10-23 10:51:19 -0700212 new HashSet<Host>()).anyTimes();
213 hostService.startMonitoringIp(IpAddress.valueOf("192.168.10.1"));
214 replay(hostService);
215
216 reset(intentService);
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800217 IntentOperations.Builder builder = IntentOperations.builder(APPID);
218 builder.addSubmitOperation(intent);
219 intentService.execute(TestIntentServiceHelper.eqExceptId(
220 builder.build()));
Pingpingfc584672014-10-23 10:51:19 -0700221 replay(intentService);
222
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800223 // Call the processRouteUpdates() method in Router class
Pavlin Radoslavova071b1e2014-11-17 13:37:57 -0800224 intentSynchronizer.leaderChanged(true);
225 TestUtils.setField(intentSynchronizer, "isActivatedLeader", true);
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800226 RouteUpdate routeUpdate = new RouteUpdate(RouteUpdate.Type.UPDATE,
227 routeEntry);
228 router.processRouteUpdates(Collections.<RouteUpdate>singletonList(routeUpdate));
Pingpingfc584672014-10-23 10:51:19 -0700229
230 Host host = new DefaultHost(ProviderId.NONE, HostId.NONE,
231 MacAddress.valueOf("00:00:00:00:00:01"), VlanId.NONE,
232 new HostLocation(
233 SW1_ETH1.deviceId(),
234 SW1_ETH1.port(), 1),
Pavlin Radoslavov33f228a2014-10-27 19:33:16 -0700235 Sets.newHashSet(IpAddress.valueOf("192.168.10.1")));
Pingpingfc584672014-10-23 10:51:19 -0700236 internalHostListener.event(
237 new HostEvent(HostEvent.Type.HOST_ADDED, host));
238
239 // Verify
Pavlin Radoslavov3a0a52e2015-01-06 17:41:37 -0800240 assertEquals(router.getRoutes4().size(), 1);
241 assertTrue(router.getRoutes4().contains(routeEntry));
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800242 assertEquals(intentSynchronizer.getRouteIntents().size(), 1);
Pavlin Radoslavov97e8a8b2014-11-24 17:51:28 -0800243 Intent firstIntent =
244 intentSynchronizer.getRouteIntents().iterator().next();
245 IntentKey firstIntentKey = new IntentKey(firstIntent);
246 IntentKey intentKey = new IntentKey(intent);
247 assertTrue(firstIntentKey.equals(intentKey));
Pingpingfc584672014-10-23 10:51:19 -0700248 verify(intentService);
249 verify(hostService);
250
251 }
252
253 /**
254 * This method tests updating a route entry.
255 *
256 * @throws TestUtilsException
257 */
Pavlin Radoslavov97e8a8b2014-11-24 17:51:28 -0800258 @Test
Pingpingfc584672014-10-23 10:51:19 -0700259 public void testRouteUpdate() throws TestUtilsException {
260
261 // Construct the existing route entry
262 RouteEntry routeEntry = new RouteEntry(
Pavlin Radoslavov6b570732014-11-06 13:16:45 -0800263 Ip4Prefix.valueOf("1.1.1.0/24"),
264 Ip4Address.valueOf("192.168.10.1"));
Pingpingfc584672014-10-23 10:51:19 -0700265
266 // Construct the existing MultiPointToSinglePointIntent intent
267 MultiPointToSinglePointIntent intent = staticIntentBuilder();
268
Pavlin Radoslavov64c1ed12014-12-10 18:10:55 -0800269 // Set up the ribTable field of Router class with existing route, and
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800270 // routeIntents field with the corresponding existing intent
Pavlin Radoslavov64c1ed12014-12-10 18:10:55 -0800271 setRibTableField(routeEntry);
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800272 setRouteIntentsField(routeEntry, intent);
Pingpingfc584672014-10-23 10:51:19 -0700273
274 // Start to construct a new route entry and new intent
275 RouteEntry routeEntryUpdate = new RouteEntry(
Pavlin Radoslavov6b570732014-11-06 13:16:45 -0800276 Ip4Prefix.valueOf("1.1.1.0/24"),
277 Ip4Address.valueOf("192.168.20.1"));
Pingpingfc584672014-10-23 10:51:19 -0700278
279 // Construct a new MultiPointToSinglePointIntent intent
280 TrafficSelector.Builder selectorBuilderNew =
281 DefaultTrafficSelector.builder();
282 selectorBuilderNew.matchEthType(Ethernet.TYPE_IPV4).matchIPDst(
283 routeEntryUpdate.prefix());
284
285 TrafficTreatment.Builder treatmentBuilderNew =
286 DefaultTrafficTreatment.builder();
287 treatmentBuilderNew.setEthDst(MacAddress.valueOf("00:00:00:00:00:02"));
288
289 Set<ConnectPoint> ingressPointsNew = new HashSet<ConnectPoint>();
290 ingressPointsNew.add(SW1_ETH1);
291 ingressPointsNew.add(SW3_ETH1);
292
293 MultiPointToSinglePointIntent intentNew =
294 new MultiPointToSinglePointIntent(APPID,
295 selectorBuilderNew.build(),
296 treatmentBuilderNew.build(),
297 ingressPointsNew, SW2_ETH1);
298
299 // Set up test expectation
300 reset(hostService);
Pavlin Radoslavov33f228a2014-10-27 19:33:16 -0700301 expect(hostService.getHostsByIp(anyObject(IpAddress.class))).andReturn(
Pingpingfc584672014-10-23 10:51:19 -0700302 new HashSet<Host>()).anyTimes();
303 hostService.startMonitoringIp(IpAddress.valueOf("192.168.20.1"));
304 replay(hostService);
305
306 reset(intentService);
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800307 IntentOperations.Builder builder = IntentOperations.builder(APPID);
308 builder.addWithdrawOperation(intent.id());
309 intentService.execute(TestIntentServiceHelper.eqExceptId(
310 builder.build()));
311 builder = IntentOperations.builder(APPID);
312 builder.addSubmitOperation(intentNew);
313 intentService.execute(TestIntentServiceHelper.eqExceptId(
314 builder.build()));
Pingpingfc584672014-10-23 10:51:19 -0700315 replay(intentService);
316
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800317 // Call the processRouteUpdates() method in Router class
Pavlin Radoslavova071b1e2014-11-17 13:37:57 -0800318 intentSynchronizer.leaderChanged(true);
319 TestUtils.setField(intentSynchronizer, "isActivatedLeader", true);
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800320 RouteUpdate routeUpdate = new RouteUpdate(RouteUpdate.Type.UPDATE,
321 routeEntryUpdate);
322 router.processRouteUpdates(Collections.<RouteUpdate>singletonList(routeUpdate));
Pingpingfc584672014-10-23 10:51:19 -0700323
324 Host host = new DefaultHost(ProviderId.NONE, HostId.NONE,
325 MacAddress.valueOf("00:00:00:00:00:02"), VlanId.NONE,
326 new HostLocation(
327 SW2_ETH1.deviceId(),
328 SW2_ETH1.port(), 1),
Pavlin Radoslavov33f228a2014-10-27 19:33:16 -0700329 Sets.newHashSet(IpAddress.valueOf("192.168.20.1")));
Pingpingfc584672014-10-23 10:51:19 -0700330 internalHostListener.event(
331 new HostEvent(HostEvent.Type.HOST_ADDED, host));
332
333 // Verify
Pavlin Radoslavov3a0a52e2015-01-06 17:41:37 -0800334 assertEquals(router.getRoutes4().size(), 1);
335 assertTrue(router.getRoutes4().contains(routeEntryUpdate));
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800336 assertEquals(intentSynchronizer.getRouteIntents().size(), 1);
Pavlin Radoslavov97e8a8b2014-11-24 17:51:28 -0800337 Intent firstIntent =
338 intentSynchronizer.getRouteIntents().iterator().next();
339 IntentKey firstIntentKey = new IntentKey(firstIntent);
340 IntentKey intentNewKey = new IntentKey(intentNew);
341 assertTrue(firstIntentKey.equals(intentNewKey));
Pingpingfc584672014-10-23 10:51:19 -0700342 verify(intentService);
343 verify(hostService);
344 }
345
346 /**
347 * This method tests deleting a route entry.
348 */
349 @Test
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800350 public void testRouteDelete() throws TestUtilsException {
Pingpingfc584672014-10-23 10:51:19 -0700351
352 // Construct the existing route entry
353 RouteEntry routeEntry = new RouteEntry(
Pavlin Radoslavov6b570732014-11-06 13:16:45 -0800354 Ip4Prefix.valueOf("1.1.1.0/24"),
355 Ip4Address.valueOf("192.168.10.1"));
Pingpingfc584672014-10-23 10:51:19 -0700356
357 // Construct the existing MultiPointToSinglePointIntent intent
358 MultiPointToSinglePointIntent intent = staticIntentBuilder();
359
Pavlin Radoslavov64c1ed12014-12-10 18:10:55 -0800360 // Set up the ribTable field of Router class with existing route, and
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800361 // routeIntents field with the corresponding existing intent
Pavlin Radoslavov64c1ed12014-12-10 18:10:55 -0800362 setRibTableField(routeEntry);
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800363 setRouteIntentsField(routeEntry, intent);
Pingpingfc584672014-10-23 10:51:19 -0700364
365 // Set up expectation
366 reset(intentService);
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800367 IntentOperations.Builder builder = IntentOperations.builder(APPID);
368 builder.addWithdrawOperation(intent.id());
369 intentService.execute(TestIntentServiceHelper.eqExceptId(
370 builder.build()));
Pingpingfc584672014-10-23 10:51:19 -0700371 replay(intentService);
372
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800373 // Call the processRouteUpdates() method in Router class
Pavlin Radoslavova071b1e2014-11-17 13:37:57 -0800374 intentSynchronizer.leaderChanged(true);
375 TestUtils.setField(intentSynchronizer, "isActivatedLeader", true);
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800376 RouteUpdate routeUpdate = new RouteUpdate(RouteUpdate.Type.DELETE,
377 routeEntry);
378 router.processRouteUpdates(Collections.<RouteUpdate>singletonList(routeUpdate));
Pingpingfc584672014-10-23 10:51:19 -0700379
380 // Verify
Pavlin Radoslavov3a0a52e2015-01-06 17:41:37 -0800381 assertEquals(router.getRoutes4().size(), 0);
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800382 assertEquals(intentSynchronizer.getRouteIntents().size(), 0);
Pingpingfc584672014-10-23 10:51:19 -0700383 verify(intentService);
384 }
385
386 /**
387 * Constructs a static MultiPointToSinglePointIntent.
388 */
389 private MultiPointToSinglePointIntent staticIntentBuilder() {
390
391 TrafficSelector.Builder selectorBuilder =
392 DefaultTrafficSelector.builder();
393 selectorBuilder.matchEthType(Ethernet.TYPE_IPV4).matchIPDst(
394 IpPrefix.valueOf("1.1.1.0/24"));
395
396 TrafficTreatment.Builder treatmentBuilder =
397 DefaultTrafficTreatment.builder();
398 treatmentBuilder.setEthDst(MacAddress.valueOf("00:00:00:00:00:01"));
399
400 Set<ConnectPoint> ingressPoints = new HashSet<ConnectPoint>();
401 ingressPoints.add(SW2_ETH1);
402 ingressPoints.add(SW3_ETH1);
403
404 MultiPointToSinglePointIntent intent =
405 new MultiPointToSinglePointIntent(APPID,
406 selectorBuilder.build(), treatmentBuilder.build(),
407 ingressPoints, SW1_ETH1);
408
409 return intent;
410 }
411
412 /**
Pavlin Radoslavov64c1ed12014-12-10 18:10:55 -0800413 * Sets ribTable Field in Router class.
Pingpingfc584672014-10-23 10:51:19 -0700414 *
415 * @throws TestUtilsException
416 */
Pavlin Radoslavov64c1ed12014-12-10 18:10:55 -0800417 private void setRibTableField(RouteEntry routeEntry)
Pingpingfc584672014-10-23 10:51:19 -0700418 throws TestUtilsException {
419
Pavlin Radoslavov64c1ed12014-12-10 18:10:55 -0800420 InvertedRadixTree<RouteEntry> ribTable =
Pingpingfc584672014-10-23 10:51:19 -0700421 new ConcurrentInvertedRadixTree<>(
422 new DefaultByteArrayNodeFactory());
Pavlin Radoslavov64c1ed12014-12-10 18:10:55 -0800423 ribTable.put(RouteEntry.createBinaryString(routeEntry.prefix()),
424 routeEntry);
Pavlin Radoslavov3a0a52e2015-01-06 17:41:37 -0800425 TestUtils.setField(router, "ribTable4", ribTable);
Pingpingfc584672014-10-23 10:51:19 -0700426 }
427
428 /**
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800429 * Sets routeIntentsField in IntentSynchronizer class.
Pingpingfc584672014-10-23 10:51:19 -0700430 *
431 * @throws TestUtilsException
432 */
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800433 private void setRouteIntentsField(RouteEntry routeEntry,
Pingpingfc584672014-10-23 10:51:19 -0700434 MultiPointToSinglePointIntent intent)
435 throws TestUtilsException {
436
Pavlin Radoslavov3a0a52e2015-01-06 17:41:37 -0800437 ConcurrentHashMap<IpPrefix, MultiPointToSinglePointIntent>
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800438 routeIntents = new ConcurrentHashMap<>();
439 routeIntents.put(routeEntry.prefix(), intent);
440 TestUtils.setField(intentSynchronizer, "routeIntents", routeIntents);
Pingpingfc584672014-10-23 10:51:19 -0700441 }
Brian O'Connorabafb502014-12-02 22:26:20 -0800442}