blob: 12872846bb5ac4de1875d47c61f9ddd1b771d87f [file] [log] [blame]
Vince Lehman72446ec2014-07-09 10:50:02 -05001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Alexander Afanasyev7c10b3b2015-01-20 12:24:27 -08003 * Copyright (c) 2014-2015, Regents of the University of California,
4 * Arizona Board of Regents,
5 * Colorado State University,
6 * University Pierre & Marie Curie, Sorbonne University,
7 * Washington University in St. Louis,
8 * Beijing Institute of Technology,
9 * The University of Memphis.
Vince Lehman72446ec2014-07-09 10:50:02 -050010 *
11 * This file is part of NFD (Named Data Networking Forwarding Daemon).
12 * See AUTHORS.md for complete list of NFD authors and contributors.
13 *
14 * NFD is free software: you can redistribute it and/or modify it under the terms
15 * of the GNU General Public License as published by the Free Software Foundation,
16 * either version 3 of the License, or (at your option) any later version.
17 *
18 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20 * PURPOSE. See the GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License along with
23 * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24 */
25
26#include "rib/rib-manager.hpp"
Junxiao Shi376f7372014-11-17 18:03:31 -070027#include <ndn-cxx/management/nfd-face-status.hpp>
Vince Lehmancd16c832014-07-23 15:14:55 -070028#include "rib/rib-status-publisher-common.hpp"
Vince Lehman72446ec2014-07-09 10:50:02 -050029
Junxiao Shi376f7372014-11-17 18:03:31 -070030#include "tests/test-common.hpp"
Junxiao Shi376f7372014-11-17 18:03:31 -070031#include <ndn-cxx/util/dummy-client-face.hpp>
Vince Lehman26b215c2014-08-17 15:00:41 -050032
Vince Lehman72446ec2014-07-09 10:50:02 -050033namespace nfd {
34namespace rib {
35namespace tests {
36
Junxiao Shi0de23a22015-12-03 20:07:02 +000037using namespace nfd::tests;
38
39class RibManagerFixture : public UnitTestTimeFixture
Vince Lehman72446ec2014-07-09 10:50:02 -050040{
41public:
42 RibManagerFixture()
Vince Lehman72446ec2014-07-09 10:50:02 -050043 {
Junxiao Shi0de23a22015-12-03 20:07:02 +000044 face = ndn::util::makeDummyClientFace(g_io);
Vince Lehman72446ec2014-07-09 10:50:02 -050045
Vince Lehmanc1dfdb42015-07-16 12:17:36 -050046 manager = make_shared<RibManager>(*face, keyChain);
Vince Lehman72446ec2014-07-09 10:50:02 -050047 manager->registerWithNfd();
48
Junxiao Shi0de23a22015-12-03 20:07:02 +000049 advanceClocks(time::milliseconds(1));
Junxiao Shi376f7372014-11-17 18:03:31 -070050 face->sentInterests.clear();
Vince Lehman72446ec2014-07-09 10:50:02 -050051 }
52
53 ~RibManagerFixture()
54 {
55 manager.reset();
56 face.reset();
57 }
58
Vince Lehman76c751c2014-11-18 17:36:38 -060059 void
60 extractParameters(Interest& interest, Name::Component& verb,
61 ControlParameters& extractedParameters)
Vince Lehman72446ec2014-07-09 10:50:02 -050062 {
63 const Name& name = interest.getName();
64 verb = name[COMMAND_PREFIX.size()];
65 const Name::Component& parameterComponent = name[COMMAND_PREFIX.size() + 1];
66
67 Block rawParameters = parameterComponent.blockFromValue();
68 extractedParameters.wireDecode(rawParameters);
69 }
70
Vince Lehman76c751c2014-11-18 17:36:38 -060071 void
Junxiao Shi0de23a22015-12-03 20:07:02 +000072 receiveCommandInterest(const Name& name, ControlParameters& parameters,
73 uint64_t incomingFaceId = DEFAULT_INCOMING_FACE_ID)
Vince Lehman72446ec2014-07-09 10:50:02 -050074 {
Vince Lehman76c751c2014-11-18 17:36:38 -060075 Name commandName = name;
76 commandName.append(parameters.wireEncode());
Vince Lehman72446ec2014-07-09 10:50:02 -050077
Vince Lehman76c751c2014-11-18 17:36:38 -060078 Interest commandInterest(commandName);
Junxiao Shi0de23a22015-12-03 20:07:02 +000079 commandInterest.setTag(make_shared<lp::IncomingFaceIdTag>(incomingFaceId));
Vince Lehman72446ec2014-07-09 10:50:02 -050080
Vince Lehman76c751c2014-11-18 17:36:38 -060081 manager->m_managedRib.m_onSendBatchFromQueue = bind(&RibManagerFixture::onSendBatchFromQueue,
82 this, _1, parameters);
83
84 face->receive(commandInterest);
Junxiao Shi0de23a22015-12-03 20:07:02 +000085 advanceClocks(time::milliseconds(1));
Vince Lehman72446ec2014-07-09 10:50:02 -050086 }
87
Vince Lehman76c751c2014-11-18 17:36:38 -060088 void
89 onSendBatchFromQueue(const RibUpdateBatch& batch, const ControlParameters parameters)
90 {
91 BOOST_REQUIRE(batch.begin() != batch.end());
92 RibUpdate update = *(batch.begin());
93
94 Rib::UpdateSuccessCallback managerCallback =
95 bind(&RibManager::onRibUpdateSuccess, manager, update);
96
97 Rib& rib = manager->m_managedRib;
98
99 // Simulate a successful response from NFD
100 FibUpdater& updater = manager->m_fibUpdater;
101 rib.onFibUpdateSuccess(batch, updater.m_inheritedRoutes, managerCallback);
102 }
103
104
Vince Lehman72446ec2014-07-09 10:50:02 -0500105public:
106 shared_ptr<RibManager> manager;
Junxiao Shi376f7372014-11-17 18:03:31 -0700107 shared_ptr<ndn::util::DummyClientFace> face;
Vince Lehmanc1dfdb42015-07-16 12:17:36 -0500108 ndn::KeyChain keyChain;
Vince Lehman72446ec2014-07-09 10:50:02 -0500109
Junxiao Shi0de23a22015-12-03 20:07:02 +0000110 static const uint64_t DEFAULT_INCOMING_FACE_ID;
Vince Lehman76c751c2014-11-18 17:36:38 -0600111
Junxiao Shi0de23a22015-12-03 20:07:02 +0000112 static const Name COMMAND_PREFIX;
113 static const name::Component ADD_NEXTHOP_VERB;
114 static const name::Component REMOVE_NEXTHOP_VERB;
115
116 static const Name REGISTER_COMMAND;
117 static const Name UNREGISTER_COMMAND;
Vince Lehman72446ec2014-07-09 10:50:02 -0500118};
119
Junxiao Shi0de23a22015-12-03 20:07:02 +0000120const uint64_t RibManagerFixture::DEFAULT_INCOMING_FACE_ID = 25122;
121const Name RibManagerFixture::COMMAND_PREFIX("/localhost/nfd/rib");
122const name::Component RibManagerFixture::ADD_NEXTHOP_VERB("add-nexthop");
123const name::Component RibManagerFixture::REMOVE_NEXTHOP_VERB("remove-nexthop");
124const Name RibManagerFixture::REGISTER_COMMAND("/localhost/nfd/rib/register");
125const Name RibManagerFixture::UNREGISTER_COMMAND("/localhost/nfd/rib/unregister");
126
Vince Lehman72446ec2014-07-09 10:50:02 -0500127class AuthorizedRibManager : public RibManagerFixture
128{
129public:
130 AuthorizedRibManager()
131 {
132 ConfigFile config;
133 manager->setConfigFile(config);
134
135 const std::string CONFIG_STRING =
136 "rib\n"
137 "{\n"
138 " localhost_security\n"
139 " {\n"
140 " trust-anchor\n"
141 " {\n"
142 " type any\n"
143 " }\n"
144 " }"
145 "}";
146
147 config.parse(CONFIG_STRING, true, "test-rib");
148 }
149};
150
151typedef RibManagerFixture UnauthorizedRibManager;
152
Spyridon Mastorakisd0381c02015-02-19 10:29:41 -0800153BOOST_FIXTURE_TEST_SUITE(TestRibManager, RibManagerFixture)
Vince Lehman72446ec2014-07-09 10:50:02 -0500154
Steve DiBenedettocd4ee5f2014-12-08 16:09:11 -0700155BOOST_FIXTURE_TEST_CASE(ShortName, AuthorizedRibManager)
156{
157 Name commandName("/localhost/nfd/rib");
Vince Lehman76c751c2014-11-18 17:36:38 -0600158 ndn::nfd::ControlParameters parameters;
159
160 receiveCommandInterest(commandName, parameters);
Steve DiBenedettocd4ee5f2014-12-08 16:09:11 -0700161 // TODO verify error response
162}
163
Vince Lehman72446ec2014-07-09 10:50:02 -0500164BOOST_FIXTURE_TEST_CASE(Basic, AuthorizedRibManager)
165{
166 ControlParameters parameters;
167 parameters
168 .setName("/hello")
169 .setFaceId(1)
170 .setCost(10)
171 .setFlags(0)
172 .setOrigin(128)
173 .setExpirationPeriod(ndn::time::milliseconds::max());
174
Vince Lehman76c751c2014-11-18 17:36:38 -0600175 receiveCommandInterest(REGISTER_COMMAND, parameters);
Vince Lehman72446ec2014-07-09 10:50:02 -0500176
Junxiao Shi376f7372014-11-17 18:03:31 -0700177 BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
Vince Lehman72446ec2014-07-09 10:50:02 -0500178}
179
180BOOST_FIXTURE_TEST_CASE(Register, AuthorizedRibManager)
181{
182 ControlParameters parameters;
183 parameters
184 .setName("/hello")
185 .setFaceId(1)
186 .setCost(10)
187 .setFlags(0)
188 .setOrigin(128)
189 .setExpirationPeriod(ndn::time::milliseconds::max());
190
Vince Lehman76c751c2014-11-18 17:36:38 -0600191 receiveCommandInterest(REGISTER_COMMAND, parameters);
Vince Lehman72446ec2014-07-09 10:50:02 -0500192
Junxiao Shi376f7372014-11-17 18:03:31 -0700193 BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
Vince Lehman72446ec2014-07-09 10:50:02 -0500194
Junxiao Shi376f7372014-11-17 18:03:31 -0700195 Interest& request = face->sentInterests[0];
Vince Lehman72446ec2014-07-09 10:50:02 -0500196
197 ControlParameters extractedParameters;
198 Name::Component verb;
199 extractParameters(request, verb, extractedParameters);
200
201 BOOST_CHECK_EQUAL(verb, ADD_NEXTHOP_VERB);
202 BOOST_CHECK_EQUAL(extractedParameters.getName(), parameters.getName());
203 BOOST_CHECK_EQUAL(extractedParameters.getFaceId(), parameters.getFaceId());
204 BOOST_CHECK_EQUAL(extractedParameters.getCost(), parameters.getCost());
205}
206
207BOOST_FIXTURE_TEST_CASE(Unregister, AuthorizedRibManager)
208{
209 ControlParameters addParameters;
210 addParameters
211 .setName("/hello")
212 .setFaceId(1)
213 .setCost(10)
214 .setFlags(0)
215 .setOrigin(128)
216 .setExpirationPeriod(ndn::time::milliseconds::max());
217
Vince Lehman76c751c2014-11-18 17:36:38 -0600218 receiveCommandInterest(REGISTER_COMMAND, addParameters);
Junxiao Shi376f7372014-11-17 18:03:31 -0700219 face->sentInterests.clear();
Vince Lehman72446ec2014-07-09 10:50:02 -0500220
221 ControlParameters removeParameters;
222 removeParameters
223 .setName("/hello")
224 .setFaceId(1)
225 .setOrigin(128);
226
Vince Lehman76c751c2014-11-18 17:36:38 -0600227 receiveCommandInterest(UNREGISTER_COMMAND, removeParameters);
Vince Lehman72446ec2014-07-09 10:50:02 -0500228
Junxiao Shi376f7372014-11-17 18:03:31 -0700229 BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
Vince Lehman72446ec2014-07-09 10:50:02 -0500230
Junxiao Shi376f7372014-11-17 18:03:31 -0700231 Interest& request = face->sentInterests[0];
Vince Lehman72446ec2014-07-09 10:50:02 -0500232
233 ControlParameters extractedParameters;
234 Name::Component verb;
235 extractParameters(request, verb, extractedParameters);
236
237 BOOST_CHECK_EQUAL(verb, REMOVE_NEXTHOP_VERB);
238 BOOST_CHECK_EQUAL(extractedParameters.getName(), removeParameters.getName());
239 BOOST_CHECK_EQUAL(extractedParameters.getFaceId(), removeParameters.getFaceId());
240}
241
Junxiao Shi0de23a22015-12-03 20:07:02 +0000242BOOST_FIXTURE_TEST_CASE(SelfRegister, AuthorizedRibManager)
243{
244 ControlParameters parameters;
245 parameters
246 .setName("/hello");
247
248 receiveCommandInterest(REGISTER_COMMAND, parameters, 10129);
249
250 BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
251
252 Interest& request = face->sentInterests[0];
253
254 ControlParameters extractedParameters;
255 Name::Component verb;
256 extractParameters(request, verb, extractedParameters);
257
258 BOOST_CHECK_EQUAL(verb, ADD_NEXTHOP_VERB);
259 BOOST_CHECK_EQUAL(extractedParameters.getName(), parameters.getName());
260 BOOST_CHECK_EQUAL(extractedParameters.getFaceId(), 10129);
261}
262
263BOOST_FIXTURE_TEST_CASE(SelfUnregister, AuthorizedRibManager)
264{
265 ControlParameters addParameters;
266 addParameters
267 .setName("/hello")
268 .setFaceId(10129);
269
270 receiveCommandInterest(REGISTER_COMMAND, addParameters);
271 face->sentInterests.clear();
272
273 ControlParameters removeParameters;
274 removeParameters
275 .setName("/hello");
276
277 receiveCommandInterest(UNREGISTER_COMMAND, removeParameters, 10129);
278
279 BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
280
281 Interest& request = face->sentInterests[0];
282
283 ControlParameters extractedParameters;
284 Name::Component verb;
285 extractParameters(request, verb, extractedParameters);
286
287 BOOST_CHECK_EQUAL(verb, REMOVE_NEXTHOP_VERB);
288 BOOST_CHECK_EQUAL(extractedParameters.getName(), removeParameters.getName());
289 BOOST_CHECK_EQUAL(extractedParameters.getFaceId(), 10129);
290}
Vince Lehman76c751c2014-11-18 17:36:38 -0600291
Vince Lehman72446ec2014-07-09 10:50:02 -0500292BOOST_FIXTURE_TEST_CASE(UnauthorizedCommand, UnauthorizedRibManager)
293{
294 ControlParameters parameters;
295 parameters
296 .setName("/hello")
297 .setFaceId(1)
298 .setCost(10)
299 .setFlags(0)
300 .setOrigin(128)
301 .setExpirationPeriod(ndn::time::milliseconds::max());
302
Junxiao Shi376f7372014-11-17 18:03:31 -0700303 BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 0);
Vince Lehman72446ec2014-07-09 10:50:02 -0500304
Vince Lehman76c751c2014-11-18 17:36:38 -0600305 receiveCommandInterest(REGISTER_COMMAND, parameters);
Vince Lehman72446ec2014-07-09 10:50:02 -0500306
Junxiao Shi376f7372014-11-17 18:03:31 -0700307 BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 0);
Vince Lehman72446ec2014-07-09 10:50:02 -0500308}
309
Vince Lehmancd16c832014-07-23 15:14:55 -0700310BOOST_FIXTURE_TEST_CASE(RibStatusRequest, AuthorizedRibManager)
311{
Vince Lehman76c751c2014-11-18 17:36:38 -0600312 Name prefix("/");
313
Vince Lehman218be0a2015-01-15 17:25:20 -0600314 Route route;
Vince Lehman218be0a2015-01-15 17:25:20 -0600315 route.faceId = 1;
316 route.origin = 128;
317 route.cost = 32;
318 route.flags = ndn::nfd::ROUTE_FLAG_CAPTURE;
Vince Lehmancd16c832014-07-23 15:14:55 -0700319
Vince Lehman76c751c2014-11-18 17:36:38 -0600320 manager->m_managedRib.insert(prefix, route);
Vince Lehmancd16c832014-07-23 15:14:55 -0700321
322 face->receive(Interest("/localhost/nfd/rib/list"));
Junxiao Shi0de23a22015-12-03 20:07:02 +0000323 advanceClocks(time::milliseconds(1));
Vince Lehmancd16c832014-07-23 15:14:55 -0700324
Junxiao Shi376f7372014-11-17 18:03:31 -0700325 BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
Vince Lehman76c751c2014-11-18 17:36:38 -0600326 RibStatusPublisherFixture::decodeRibEntryBlock(face->sentDatas[0], prefix, route);
Vince Lehmancd16c832014-07-23 15:14:55 -0700327}
328
Vince Lehman281ded72014-08-21 12:17:08 -0500329BOOST_FIXTURE_TEST_CASE(CancelExpirationEvent, AuthorizedRibManager)
330{
Vince Lehman76c751c2014-11-18 17:36:38 -0600331 // Register route
Vince Lehman281ded72014-08-21 12:17:08 -0500332 ControlParameters addParameters;
333 addParameters
334 .setName("/expire")
335 .setFaceId(1)
336 .setCost(10)
337 .setFlags(0)
338 .setOrigin(128)
339 .setExpirationPeriod(ndn::time::milliseconds(500));
340
Vince Lehman76c751c2014-11-18 17:36:38 -0600341 receiveCommandInterest(REGISTER_COMMAND, addParameters);
Junxiao Shi376f7372014-11-17 18:03:31 -0700342 face->sentInterests.clear();
Vince Lehman281ded72014-08-21 12:17:08 -0500343
Vince Lehman76c751c2014-11-18 17:36:38 -0600344 // Unregister route
Vince Lehman281ded72014-08-21 12:17:08 -0500345 ControlParameters removeParameters;
346 removeParameters
347 .setName("/expire")
348 .setFaceId(1)
349 .setOrigin(128);
350
Vince Lehman76c751c2014-11-18 17:36:38 -0600351 receiveCommandInterest(UNREGISTER_COMMAND, removeParameters);
Vince Lehman281ded72014-08-21 12:17:08 -0500352
Vince Lehman76c751c2014-11-18 17:36:38 -0600353 // Reregister route
Vince Lehman281ded72014-08-21 12:17:08 -0500354 addParameters.setExpirationPeriod(ndn::time::milliseconds::max());
Vince Lehman76c751c2014-11-18 17:36:38 -0600355 receiveCommandInterest(REGISTER_COMMAND, addParameters);
Vince Lehman281ded72014-08-21 12:17:08 -0500356
Junxiao Shi0de23a22015-12-03 20:07:02 +0000357 advanceClocks(time::milliseconds(100), time::seconds(1));
Vince Lehman281ded72014-08-21 12:17:08 -0500358
359 BOOST_REQUIRE_EQUAL(manager->m_managedRib.size(), 1);
360}
361
Vince Lehman26b215c2014-08-17 15:00:41 -0500362BOOST_FIXTURE_TEST_CASE(RemoveInvalidFaces, AuthorizedRibManager)
363{
364 // Register valid face
365 ControlParameters validParameters;
366 validParameters
367 .setName("/test")
368 .setFaceId(1);
369
Vince Lehman76c751c2014-11-18 17:36:38 -0600370 receiveCommandInterest(REGISTER_COMMAND, validParameters);
Vince Lehman26b215c2014-08-17 15:00:41 -0500371
372 // Register invalid face
373 ControlParameters invalidParameters;
374 invalidParameters
375 .setName("/test")
376 .setFaceId(2);
377
Vince Lehman76c751c2014-11-18 17:36:38 -0600378 receiveCommandInterest(REGISTER_COMMAND, invalidParameters);
Vince Lehman26b215c2014-08-17 15:00:41 -0500379
380 BOOST_REQUIRE_EQUAL(manager->m_managedRib.size(), 2);
381
382 // Receive status with only faceId: 1
383 ndn::nfd::FaceStatus status;
384 status.setFaceId(1);
385
386 shared_ptr<Data> data = nfd::tests::makeData("/localhost/nfd/faces/list");
387 data->setContent(status.wireEncode());
388
389 shared_ptr<ndn::OBufferStream> buffer = make_shared<ndn::OBufferStream>();
390 buffer->write(reinterpret_cast<const char*>(data->getContent().value()),
391 data->getContent().value_size());
392
393 manager->removeInvalidFaces(buffer);
394
395 // Run scheduler
Junxiao Shi0de23a22015-12-03 20:07:02 +0000396 advanceClocks(time::milliseconds(100), time::seconds(1));
Vince Lehman26b215c2014-08-17 15:00:41 -0500397
398 BOOST_REQUIRE_EQUAL(manager->m_managedRib.size(), 1);
399
400 Rib::const_iterator it = manager->m_managedRib.find("/test");
401 BOOST_REQUIRE(it != manager->m_managedRib.end());
402
403 shared_ptr<RibEntry> entry = it->second;
404 BOOST_CHECK_EQUAL(entry->hasFaceId(1), true);
405 BOOST_CHECK_EQUAL(entry->hasFaceId(2), false);
406}
407
Vince Lehman7c7d33a2015-01-20 17:40:26 -0600408BOOST_FIXTURE_TEST_CASE(LocalHopInherit, AuthorizedRibManager)
409{
410 using nfd::rib::RibManager;
411
412 // Simulate NFD response
413 ControlParameters result;
414 result.setFaceId(261);
415
416 manager->onNrdCommandPrefixAddNextHopSuccess(RibManager::REMOTE_COMMAND_PREFIX, result);
417
418 // Register route that localhop prefix should inherit
419 ControlParameters parameters;
420 parameters
421 .setName("/localhop/nfd")
422 .setFaceId(262)
423 .setCost(25)
424 .setFlags(ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
425
426 Name commandName("/localhost/nfd/rib/register");
427
428 receiveCommandInterest(commandName, parameters);
429
430 // REMOTE_COMMAND_PREFIX should have its original route and the inherited route
431 auto it = manager->m_managedRib.find(RibManager::REMOTE_COMMAND_PREFIX);
432
433 BOOST_REQUIRE(it != manager->m_managedRib.end());
434 const RibEntry::RouteList& inheritedRoutes = (*(it->second)).getInheritedRoutes();
435
436 BOOST_CHECK_EQUAL(inheritedRoutes.size(), 1);
437 auto routeIt = inheritedRoutes.begin();
438
439 BOOST_CHECK_EQUAL(routeIt->faceId, 262);
440 BOOST_CHECK_EQUAL(routeIt->cost, 25);
441}
442
Vince Lehman76c751c2014-11-18 17:36:38 -0600443BOOST_FIXTURE_TEST_CASE(RouteExpiration, AuthorizedRibManager)
444{
445 // Register route
446 ControlParameters parameters;
447 parameters.setName("/expire")
448 .setExpirationPeriod(ndn::time::milliseconds(500));
449
450 receiveCommandInterest(REGISTER_COMMAND, parameters);
451 face->sentInterests.clear();
452
453 BOOST_REQUIRE_EQUAL(manager->m_managedRib.size(), 1);
454
455 // Route should expire
Junxiao Shi0de23a22015-12-03 20:07:02 +0000456 advanceClocks(time::milliseconds(100), time::seconds(1));
Vince Lehman76c751c2014-11-18 17:36:38 -0600457
458 BOOST_CHECK_EQUAL(manager->m_managedRib.size(), 0);
459}
460
461BOOST_FIXTURE_TEST_CASE(FaceDestroyEvent, AuthorizedRibManager)
462{
463 uint64_t faceToDestroy = 128;
464
465 // Register valid face
466 ControlParameters parameters;
467 parameters.setName("/test")
468 .setFaceId(faceToDestroy);
469
470 receiveCommandInterest(REGISTER_COMMAND, parameters);
471 BOOST_REQUIRE_EQUAL(manager->m_managedRib.size(), 1);
472
473 // Don't respond with a success message from the FIB
474 manager->m_managedRib.m_onSendBatchFromQueue = nullptr;
475
476 manager->onFaceDestroyedEvent(faceToDestroy);
477 BOOST_REQUIRE_EQUAL(manager->m_managedRib.size(), 0);
478}
479
Vince Lehman72446ec2014-07-09 10:50:02 -0500480BOOST_AUTO_TEST_SUITE_END()
481
482} // namespace tests
483} // namespace rib
484} // namespace nfd