blob: 80fb578390efddc300c7fff356f541cacb1a49cc [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
18import static org.easymock.EasyMock.anyObject;
19import static org.easymock.EasyMock.createMock;
20import static org.easymock.EasyMock.expect;
21import static org.easymock.EasyMock.replay;
22import static org.easymock.EasyMock.reset;
23import static org.easymock.EasyMock.verify;
24import static org.junit.Assert.assertEquals;
25import static org.junit.Assert.assertTrue;
26
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -080027import java.util.Collections;
Pingpingfc584672014-10-23 10:51:19 -070028import java.util.HashMap;
29import java.util.HashSet;
30import java.util.Map;
31import java.util.Set;
32import java.util.concurrent.ConcurrentHashMap;
33
34import org.junit.Before;
35import org.junit.Test;
36import org.onlab.junit.TestUtils;
37import org.onlab.junit.TestUtils.TestUtilsException;
Jonathan Hart6cd2f352015-01-13 17:44:45 -080038import org.onlab.packet.Ethernet;
39import org.onlab.packet.Ip4Address;
40import org.onlab.packet.Ip4Prefix;
41import org.onlab.packet.IpAddress;
42import org.onlab.packet.IpPrefix;
43import org.onlab.packet.MacAddress;
44import org.onlab.packet.VlanId;
Brian O'Connorabafb502014-12-02 22:26:20 -080045import org.onosproject.core.ApplicationId;
46import org.onosproject.net.ConnectPoint;
47import org.onosproject.net.DefaultHost;
48import org.onosproject.net.DeviceId;
49import org.onosproject.net.Host;
50import org.onosproject.net.HostId;
51import org.onosproject.net.HostLocation;
52import org.onosproject.net.PortNumber;
53import org.onosproject.net.flow.DefaultTrafficSelector;
54import org.onosproject.net.flow.DefaultTrafficTreatment;
55import org.onosproject.net.flow.TrafficSelector;
56import org.onosproject.net.flow.TrafficTreatment;
57import org.onosproject.net.host.HostEvent;
58import org.onosproject.net.host.HostService;
59import org.onosproject.net.host.InterfaceIpAddress;
Jonathan Hart6cd2f352015-01-13 17:44:45 -080060import org.onosproject.net.intent.AbstractIntentTest;
Brian O'Connorabafb502014-12-02 22:26:20 -080061import org.onosproject.net.intent.Intent;
62import org.onosproject.net.intent.IntentOperations;
63import org.onosproject.net.intent.IntentService;
64import org.onosproject.net.intent.MultiPointToSinglePointIntent;
Brian O'Connorabafb502014-12-02 22:26:20 -080065import org.onosproject.net.provider.ProviderId;
66import org.onosproject.sdnip.IntentSynchronizer.IntentKey;
67import org.onosproject.sdnip.Router.InternalHostListener;
68import org.onosproject.sdnip.config.BgpPeer;
69import org.onosproject.sdnip.config.Interface;
70import org.onosproject.sdnip.config.SdnIpConfigurationService;
Pingpingfc584672014-10-23 10:51:19 -070071
72import com.google.common.collect.Sets;
73import com.googlecode.concurrenttrees.radix.node.concrete.DefaultByteArrayNodeFactory;
74import com.googlecode.concurrenttrees.radixinverted.ConcurrentInvertedRadixTree;
75import com.googlecode.concurrenttrees.radixinverted.InvertedRadixTree;
76
77/**
78 * This class tests adding a route, updating a route, deleting a route, and
79 * the ARP module answers the MAC address asynchronously.
80 */
Jonathan Hartb8349202014-12-10 11:23:59 -080081public class RouterAsyncArpTest extends AbstractIntentTest {
Pingpingfc584672014-10-23 10:51:19 -070082
Jonathan Hart9965d772014-12-02 10:28:34 -080083 private SdnIpConfigurationService sdnIpConfigService;
Pingpingfc584672014-10-23 10:51:19 -070084 private InterfaceService interfaceService;
85 private IntentService intentService;
86 private HostService hostService;
87
88 private static final ConnectPoint SW1_ETH1 = new ConnectPoint(
89 DeviceId.deviceId("of:0000000000000001"),
90 PortNumber.portNumber(1));
91
92 private static final ConnectPoint SW2_ETH1 = new ConnectPoint(
93 DeviceId.deviceId("of:0000000000000002"),
94 PortNumber.portNumber(1));
95
96 private static final ConnectPoint SW3_ETH1 = new ConnectPoint(
97 DeviceId.deviceId("of:0000000000000003"),
98 PortNumber.portNumber(1));
99
Pavlin Radoslavova071b1e2014-11-17 13:37:57 -0800100 private IntentSynchronizer intentSynchronizer;
Pingpingfc584672014-10-23 10:51:19 -0700101 private Router router;
102 private InternalHostListener internalHostListener;
103
104 private static final ApplicationId APPID = new ApplicationId() {
105 @Override
106 public short id() {
107 return 1;
108 }
109
110 @Override
111 public String name() {
112 return "SDNIP";
113 }
114 };
115
116 @Before
117 public void setUp() throws Exception {
Brian O'Connor520c0522014-11-23 23:50:47 -0800118 super.setUp();
119
Pingpingfc584672014-10-23 10:51:19 -0700120 setUpSdnIpConfigService();
121 setUpInterfaceService();
122 hostService = createMock(HostService.class);
123 intentService = createMock(IntentService.class);
124
Pavlin Radoslavova071b1e2014-11-17 13:37:57 -0800125 intentSynchronizer = new IntentSynchronizer(APPID, intentService);
126 router = new Router(APPID, intentSynchronizer,
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800127 sdnIpConfigService, interfaceService, hostService);
Pingpingfc584672014-10-23 10:51:19 -0700128 internalHostListener = router.new InternalHostListener();
129 }
130
131 /**
132 * Sets up SdnIpConfigService.
133 */
134 private void setUpSdnIpConfigService() {
135
Jonathan Hart9965d772014-12-02 10:28:34 -0800136 sdnIpConfigService = createMock(SdnIpConfigurationService.class);
Pingpingfc584672014-10-23 10:51:19 -0700137
138 Map<IpAddress, BgpPeer> peers = new HashMap<>();
139
140 String peerSw1Eth1 = "192.168.10.1";
141 peers.put(IpAddress.valueOf(peerSw1Eth1),
142 new BgpPeer("00:00:00:00:00:00:00:01", 1, peerSw1Eth1));
143
144 // Two BGP peers are connected to switch 2 port 1.
145 String peer1Sw2Eth1 = "192.168.20.1";
146 peers.put(IpAddress.valueOf(peer1Sw2Eth1),
147 new BgpPeer("00:00:00:00:00:00:00:02", 1, peer1Sw2Eth1));
148
149 String peer2Sw2Eth1 = "192.168.20.2";
150 peers.put(IpAddress.valueOf(peer2Sw2Eth1),
151 new BgpPeer("00:00:00:00:00:00:00:02", 1, peer2Sw2Eth1));
152
153 expect(sdnIpConfigService.getBgpPeers()).andReturn(peers).anyTimes();
154 replay(sdnIpConfigService);
155 }
156
157 /**
158 * Sets up InterfaceService.
159 */
160 private void setUpInterfaceService() {
161
162 interfaceService = createMock(InterfaceService.class);
163
164 Set<Interface> interfaces = Sets.newHashSet();
165
166 Set<InterfaceIpAddress> interfaceIpAddresses1 = Sets.newHashSet();
167 interfaceIpAddresses1.add(new InterfaceIpAddress(
168 IpAddress.valueOf("192.168.10.101"),
169 IpPrefix.valueOf("192.168.10.0/24")));
170 Interface sw1Eth1 = new Interface(SW1_ETH1,
Jonathan Hart6cd2f352015-01-13 17:44:45 -0800171 interfaceIpAddresses1, MacAddress.valueOf("00:00:00:00:00:01"),
172 VlanId.NONE);
Pingpingfc584672014-10-23 10:51:19 -0700173 interfaces.add(sw1Eth1);
174
175 Set<InterfaceIpAddress> interfaceIpAddresses2 = Sets.newHashSet();
176 interfaceIpAddresses2.add(new InterfaceIpAddress(
177 IpAddress.valueOf("192.168.20.101"),
178 IpPrefix.valueOf("192.168.20.0/24")));
179 Interface sw2Eth1 = new Interface(SW2_ETH1,
Jonathan Hart6cd2f352015-01-13 17:44:45 -0800180 interfaceIpAddresses2, MacAddress.valueOf("00:00:00:00:00:02"),
181 VlanId.NONE);
Pingpingfc584672014-10-23 10:51:19 -0700182 interfaces.add(sw2Eth1);
183
184 Set<InterfaceIpAddress> interfaceIpAddresses3 = Sets.newHashSet();
185 interfaceIpAddresses3.add(new InterfaceIpAddress(
186 IpAddress.valueOf("192.168.30.101"),
187 IpPrefix.valueOf("192.168.30.0/24")));
188 Interface sw3Eth1 = new Interface(SW3_ETH1,
Jonathan Hart6cd2f352015-01-13 17:44:45 -0800189 interfaceIpAddresses3, MacAddress.valueOf("00:00:00:00:00:03"),
190 VlanId.NONE);
Pingpingfc584672014-10-23 10:51:19 -0700191 interfaces.add(sw3Eth1);
192
193 expect(interfaceService.getInterface(SW1_ETH1)).andReturn(sw1Eth1).anyTimes();
194 expect(interfaceService.getInterface(SW2_ETH1)).andReturn(sw2Eth1).anyTimes();
195 expect(interfaceService.getInterface(SW3_ETH1)).andReturn(sw3Eth1).anyTimes();
196 expect(interfaceService.getInterfaces()).andReturn(interfaces).anyTimes();
197 replay(interfaceService);
198 }
199
200 /**
201 * This method tests adding a route entry.
202 */
Pavlin Radoslavov97e8a8b2014-11-24 17:51:28 -0800203 @Test
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800204 public void testRouteAdd() throws TestUtilsException {
Pingpingfc584672014-10-23 10:51:19 -0700205
206 // Construct a route entry
207 RouteEntry routeEntry = new RouteEntry(
Pavlin Radoslavov6b570732014-11-06 13:16:45 -0800208 Ip4Prefix.valueOf("1.1.1.0/24"),
209 Ip4Address.valueOf("192.168.10.1"));
Pingpingfc584672014-10-23 10:51:19 -0700210
211 // Construct a route intent
212 MultiPointToSinglePointIntent intent = staticIntentBuilder();
213
214 // Set up test expectation
215 reset(hostService);
Pavlin Radoslavov33f228a2014-10-27 19:33:16 -0700216 expect(hostService.getHostsByIp(anyObject(IpAddress.class))).andReturn(
Pingpingfc584672014-10-23 10:51:19 -0700217 new HashSet<Host>()).anyTimes();
218 hostService.startMonitoringIp(IpAddress.valueOf("192.168.10.1"));
219 replay(hostService);
220
221 reset(intentService);
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800222 IntentOperations.Builder builder = IntentOperations.builder(APPID);
223 builder.addSubmitOperation(intent);
224 intentService.execute(TestIntentServiceHelper.eqExceptId(
225 builder.build()));
Pingpingfc584672014-10-23 10:51:19 -0700226 replay(intentService);
227
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800228 // Call the processRouteUpdates() method in Router class
Pavlin Radoslavova071b1e2014-11-17 13:37:57 -0800229 intentSynchronizer.leaderChanged(true);
230 TestUtils.setField(intentSynchronizer, "isActivatedLeader", true);
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800231 RouteUpdate routeUpdate = new RouteUpdate(RouteUpdate.Type.UPDATE,
232 routeEntry);
233 router.processRouteUpdates(Collections.<RouteUpdate>singletonList(routeUpdate));
Pingpingfc584672014-10-23 10:51:19 -0700234
235 Host host = new DefaultHost(ProviderId.NONE, HostId.NONE,
236 MacAddress.valueOf("00:00:00:00:00:01"), VlanId.NONE,
237 new HostLocation(
238 SW1_ETH1.deviceId(),
239 SW1_ETH1.port(), 1),
Pavlin Radoslavov33f228a2014-10-27 19:33:16 -0700240 Sets.newHashSet(IpAddress.valueOf("192.168.10.1")));
Pingpingfc584672014-10-23 10:51:19 -0700241 internalHostListener.event(
242 new HostEvent(HostEvent.Type.HOST_ADDED, host));
243
244 // Verify
Pavlin Radoslavov3a0a52e2015-01-06 17:41:37 -0800245 assertEquals(router.getRoutes4().size(), 1);
246 assertTrue(router.getRoutes4().contains(routeEntry));
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800247 assertEquals(intentSynchronizer.getRouteIntents().size(), 1);
Pavlin Radoslavov97e8a8b2014-11-24 17:51:28 -0800248 Intent firstIntent =
249 intentSynchronizer.getRouteIntents().iterator().next();
250 IntentKey firstIntentKey = new IntentKey(firstIntent);
251 IntentKey intentKey = new IntentKey(intent);
252 assertTrue(firstIntentKey.equals(intentKey));
Pingpingfc584672014-10-23 10:51:19 -0700253 verify(intentService);
254 verify(hostService);
255
256 }
257
258 /**
259 * This method tests updating a route entry.
260 *
261 * @throws TestUtilsException
262 */
Pavlin Radoslavov97e8a8b2014-11-24 17:51:28 -0800263 @Test
Pingpingfc584672014-10-23 10:51:19 -0700264 public void testRouteUpdate() throws TestUtilsException {
265
266 // Construct the existing route entry
267 RouteEntry routeEntry = new RouteEntry(
Pavlin Radoslavov6b570732014-11-06 13:16:45 -0800268 Ip4Prefix.valueOf("1.1.1.0/24"),
269 Ip4Address.valueOf("192.168.10.1"));
Pingpingfc584672014-10-23 10:51:19 -0700270
271 // Construct the existing MultiPointToSinglePointIntent intent
272 MultiPointToSinglePointIntent intent = staticIntentBuilder();
273
Pavlin Radoslavov64c1ed12014-12-10 18:10:55 -0800274 // Set up the ribTable field of Router class with existing route, and
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800275 // routeIntents field with the corresponding existing intent
Pavlin Radoslavov64c1ed12014-12-10 18:10:55 -0800276 setRibTableField(routeEntry);
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800277 setRouteIntentsField(routeEntry, intent);
Pingpingfc584672014-10-23 10:51:19 -0700278
279 // Start to construct a new route entry and new intent
280 RouteEntry routeEntryUpdate = new RouteEntry(
Pavlin Radoslavov6b570732014-11-06 13:16:45 -0800281 Ip4Prefix.valueOf("1.1.1.0/24"),
282 Ip4Address.valueOf("192.168.20.1"));
Pingpingfc584672014-10-23 10:51:19 -0700283
284 // Construct a new MultiPointToSinglePointIntent intent
285 TrafficSelector.Builder selectorBuilderNew =
286 DefaultTrafficSelector.builder();
287 selectorBuilderNew.matchEthType(Ethernet.TYPE_IPV4).matchIPDst(
288 routeEntryUpdate.prefix());
289
290 TrafficTreatment.Builder treatmentBuilderNew =
291 DefaultTrafficTreatment.builder();
292 treatmentBuilderNew.setEthDst(MacAddress.valueOf("00:00:00:00:00:02"));
293
294 Set<ConnectPoint> ingressPointsNew = new HashSet<ConnectPoint>();
295 ingressPointsNew.add(SW1_ETH1);
296 ingressPointsNew.add(SW3_ETH1);
297
298 MultiPointToSinglePointIntent intentNew =
299 new MultiPointToSinglePointIntent(APPID,
300 selectorBuilderNew.build(),
301 treatmentBuilderNew.build(),
302 ingressPointsNew, SW2_ETH1);
303
304 // Set up test expectation
305 reset(hostService);
Pavlin Radoslavov33f228a2014-10-27 19:33:16 -0700306 expect(hostService.getHostsByIp(anyObject(IpAddress.class))).andReturn(
Pingpingfc584672014-10-23 10:51:19 -0700307 new HashSet<Host>()).anyTimes();
308 hostService.startMonitoringIp(IpAddress.valueOf("192.168.20.1"));
309 replay(hostService);
310
311 reset(intentService);
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800312 IntentOperations.Builder builder = IntentOperations.builder(APPID);
313 builder.addWithdrawOperation(intent.id());
314 intentService.execute(TestIntentServiceHelper.eqExceptId(
315 builder.build()));
316 builder = IntentOperations.builder(APPID);
317 builder.addSubmitOperation(intentNew);
318 intentService.execute(TestIntentServiceHelper.eqExceptId(
319 builder.build()));
Pingpingfc584672014-10-23 10:51:19 -0700320 replay(intentService);
321
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800322 // Call the processRouteUpdates() method in Router class
Pavlin Radoslavova071b1e2014-11-17 13:37:57 -0800323 intentSynchronizer.leaderChanged(true);
324 TestUtils.setField(intentSynchronizer, "isActivatedLeader", true);
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800325 RouteUpdate routeUpdate = new RouteUpdate(RouteUpdate.Type.UPDATE,
326 routeEntryUpdate);
327 router.processRouteUpdates(Collections.<RouteUpdate>singletonList(routeUpdate));
Pingpingfc584672014-10-23 10:51:19 -0700328
329 Host host = new DefaultHost(ProviderId.NONE, HostId.NONE,
330 MacAddress.valueOf("00:00:00:00:00:02"), VlanId.NONE,
331 new HostLocation(
332 SW2_ETH1.deviceId(),
333 SW2_ETH1.port(), 1),
Pavlin Radoslavov33f228a2014-10-27 19:33:16 -0700334 Sets.newHashSet(IpAddress.valueOf("192.168.20.1")));
Pingpingfc584672014-10-23 10:51:19 -0700335 internalHostListener.event(
336 new HostEvent(HostEvent.Type.HOST_ADDED, host));
337
338 // Verify
Pavlin Radoslavov3a0a52e2015-01-06 17:41:37 -0800339 assertEquals(router.getRoutes4().size(), 1);
340 assertTrue(router.getRoutes4().contains(routeEntryUpdate));
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800341 assertEquals(intentSynchronizer.getRouteIntents().size(), 1);
Pavlin Radoslavov97e8a8b2014-11-24 17:51:28 -0800342 Intent firstIntent =
343 intentSynchronizer.getRouteIntents().iterator().next();
344 IntentKey firstIntentKey = new IntentKey(firstIntent);
345 IntentKey intentNewKey = new IntentKey(intentNew);
346 assertTrue(firstIntentKey.equals(intentNewKey));
Pingpingfc584672014-10-23 10:51:19 -0700347 verify(intentService);
348 verify(hostService);
349 }
350
351 /**
352 * This method tests deleting a route entry.
353 */
354 @Test
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800355 public void testRouteDelete() throws TestUtilsException {
Pingpingfc584672014-10-23 10:51:19 -0700356
357 // Construct the existing route entry
358 RouteEntry routeEntry = new RouteEntry(
Pavlin Radoslavov6b570732014-11-06 13:16:45 -0800359 Ip4Prefix.valueOf("1.1.1.0/24"),
360 Ip4Address.valueOf("192.168.10.1"));
Pingpingfc584672014-10-23 10:51:19 -0700361
362 // Construct the existing MultiPointToSinglePointIntent intent
363 MultiPointToSinglePointIntent intent = staticIntentBuilder();
364
Pavlin Radoslavov64c1ed12014-12-10 18:10:55 -0800365 // Set up the ribTable field of Router class with existing route, and
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800366 // routeIntents field with the corresponding existing intent
Pavlin Radoslavov64c1ed12014-12-10 18:10:55 -0800367 setRibTableField(routeEntry);
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800368 setRouteIntentsField(routeEntry, intent);
Pingpingfc584672014-10-23 10:51:19 -0700369
370 // Set up expectation
371 reset(intentService);
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800372 IntentOperations.Builder builder = IntentOperations.builder(APPID);
373 builder.addWithdrawOperation(intent.id());
374 intentService.execute(TestIntentServiceHelper.eqExceptId(
375 builder.build()));
Pingpingfc584672014-10-23 10:51:19 -0700376 replay(intentService);
377
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800378 // Call the processRouteUpdates() method in Router class
Pavlin Radoslavova071b1e2014-11-17 13:37:57 -0800379 intentSynchronizer.leaderChanged(true);
380 TestUtils.setField(intentSynchronizer, "isActivatedLeader", true);
Pavlin Radoslavov248c2ae2014-12-02 09:51:25 -0800381 RouteUpdate routeUpdate = new RouteUpdate(RouteUpdate.Type.DELETE,
382 routeEntry);
383 router.processRouteUpdates(Collections.<RouteUpdate>singletonList(routeUpdate));
Pingpingfc584672014-10-23 10:51:19 -0700384
385 // Verify
Pavlin Radoslavov3a0a52e2015-01-06 17:41:37 -0800386 assertEquals(router.getRoutes4().size(), 0);
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800387 assertEquals(intentSynchronizer.getRouteIntents().size(), 0);
Pingpingfc584672014-10-23 10:51:19 -0700388 verify(intentService);
389 }
390
391 /**
392 * Constructs a static MultiPointToSinglePointIntent.
393 */
394 private MultiPointToSinglePointIntent staticIntentBuilder() {
395
396 TrafficSelector.Builder selectorBuilder =
397 DefaultTrafficSelector.builder();
398 selectorBuilder.matchEthType(Ethernet.TYPE_IPV4).matchIPDst(
399 IpPrefix.valueOf("1.1.1.0/24"));
400
401 TrafficTreatment.Builder treatmentBuilder =
402 DefaultTrafficTreatment.builder();
403 treatmentBuilder.setEthDst(MacAddress.valueOf("00:00:00:00:00:01"));
404
405 Set<ConnectPoint> ingressPoints = new HashSet<ConnectPoint>();
406 ingressPoints.add(SW2_ETH1);
407 ingressPoints.add(SW3_ETH1);
408
409 MultiPointToSinglePointIntent intent =
410 new MultiPointToSinglePointIntent(APPID,
411 selectorBuilder.build(), treatmentBuilder.build(),
412 ingressPoints, SW1_ETH1);
413
414 return intent;
415 }
416
417 /**
Pavlin Radoslavov64c1ed12014-12-10 18:10:55 -0800418 * Sets ribTable Field in Router class.
Pingpingfc584672014-10-23 10:51:19 -0700419 *
420 * @throws TestUtilsException
421 */
Pavlin Radoslavov64c1ed12014-12-10 18:10:55 -0800422 private void setRibTableField(RouteEntry routeEntry)
Pingpingfc584672014-10-23 10:51:19 -0700423 throws TestUtilsException {
424
Pavlin Radoslavov64c1ed12014-12-10 18:10:55 -0800425 InvertedRadixTree<RouteEntry> ribTable =
Pingpingfc584672014-10-23 10:51:19 -0700426 new ConcurrentInvertedRadixTree<>(
427 new DefaultByteArrayNodeFactory());
Pavlin Radoslavov64c1ed12014-12-10 18:10:55 -0800428 ribTable.put(RouteEntry.createBinaryString(routeEntry.prefix()),
429 routeEntry);
Pavlin Radoslavov3a0a52e2015-01-06 17:41:37 -0800430 TestUtils.setField(router, "ribTable4", ribTable);
Pingpingfc584672014-10-23 10:51:19 -0700431 }
432
433 /**
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800434 * Sets routeIntentsField in IntentSynchronizer class.
Pingpingfc584672014-10-23 10:51:19 -0700435 *
436 * @throws TestUtilsException
437 */
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800438 private void setRouteIntentsField(RouteEntry routeEntry,
Pingpingfc584672014-10-23 10:51:19 -0700439 MultiPointToSinglePointIntent intent)
440 throws TestUtilsException {
441
Pavlin Radoslavov3a0a52e2015-01-06 17:41:37 -0800442 ConcurrentHashMap<IpPrefix, MultiPointToSinglePointIntent>
Pavlin Radoslavova7243cc2014-11-22 21:38:02 -0800443 routeIntents = new ConcurrentHashMap<>();
444 routeIntents.put(routeEntry.prefix(), intent);
445 TestUtils.setField(intentSynchronizer, "routeIntents", routeIntents);
Pingpingfc584672014-10-23 10:51:19 -0700446 }
Brian O'Connorabafb502014-12-02 22:26:20 -0800447}