blob: 0c5bc3143ea2a9eeaec9fc41367a28aac9b22b85 [file] [log] [blame]
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Junxiao Shi1f481fa2017-01-26 15:14:43 +00003 * Copyright (c) 2014-2017, Regents of the University of California,
Junxiao Shi38f4ce92016-08-04 10:01:52 +00004 * 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.
10 *
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
Junxiao Shi331ade72016-08-19 14:07:19 +000026#include "nfdc/rib-module.hpp"
Junxiao Shi38f4ce92016-08-04 10:01:52 +000027
Junxiao Shi918e5d42017-02-25 03:58:21 +000028#include "execute-command-fixture.hpp"
Junxiao Shi1f481fa2017-01-26 15:14:43 +000029#include "status-fixture.hpp"
Junxiao Shi38f4ce92016-08-04 10:01:52 +000030
31namespace nfd {
32namespace tools {
Junxiao Shi331ade72016-08-19 14:07:19 +000033namespace nfdc {
Junxiao Shi38f4ce92016-08-04 10:01:52 +000034namespace tests {
35
Junxiao Shi331ade72016-08-19 14:07:19 +000036BOOST_AUTO_TEST_SUITE(Nfdc)
Junxiao Shi1f481fa2017-01-26 15:14:43 +000037BOOST_FIXTURE_TEST_SUITE(TestRibModule, StatusFixture<RibModule>)
Junxiao Shi38f4ce92016-08-04 10:01:52 +000038
Junxiao Shi1d62e622017-03-08 22:39:28 +000039class RouteListFixture : public ExecuteCommandFixture
40{
41protected:
42 bool
43 respondRibDataset(const Interest& interest)
44 {
45 if (!Name("/localhost/nfd/rib/list").isPrefixOf(interest.getName())) {
46 return false;
47 }
48
49 RibEntry entry1;
50 entry1.setName("/5BBmTevRJ");
51 entry1.addRoute(Route()
52 .setFaceId(6720)
53 .setOrigin(ndn::nfd::ROUTE_ORIGIN_CLIENT)
54 .setCost(2956)
55 .setFlags(ndn::nfd::ROUTE_FLAG_CHILD_INHERIT | ndn::nfd::ROUTE_FLAG_CAPTURE)
56 .setExpirationPeriod(time::milliseconds(29950035)));
57 entry1.addRoute(Route()
58 .setFaceId(6720)
59 .setOrigin(ndn::nfd::ROUTE_ORIGIN_STATIC)
60 .setCost(425)
61 .setFlags(ndn::nfd::ROUTE_FLAGS_NONE));
62 entry1.addRoute(Route()
63 .setFaceId(8599)
64 .setOrigin(ndn::nfd::ROUTE_ORIGIN_STATIC)
65 .setCost(9140)
66 .setFlags(ndn::nfd::ROUTE_FLAG_CHILD_INHERIT));
67
68 RibEntry entry2;
69 entry2.setName("/aDPTKCio");
70 entry2.addRoute(Route()
71 .setFaceId(31066)
72 .setOrigin(ndn::nfd::ROUTE_ORIGIN_CLIENT)
73 .setCost(4617)
74 .setFlags(ndn::nfd::ROUTE_FLAG_CAPTURE));
75
76 this->sendDataset(interest.getName(), entry1, entry2);
77 return true;
78 }
79};
80
81BOOST_FIXTURE_TEST_SUITE(ListShowCommand, RouteListFixture)
82
83const std::string NOFILTER_OUTPUT = std::string(R"TEXT(
84prefix=/5BBmTevRJ nexthop=6720 origin=65 cost=2956 flags=child-inherit|capture expires=29950s
85prefix=/5BBmTevRJ nexthop=6720 origin=255 cost=425 flags=none expires=never
86prefix=/5BBmTevRJ nexthop=8599 origin=255 cost=9140 flags=child-inherit expires=never
87prefix=/aDPTKCio nexthop=31066 origin=65 cost=4617 flags=capture expires=never
88)TEXT").substr(1);
89
90BOOST_AUTO_TEST_CASE(ListNoFilter)
91{
92 this->processInterest = [this] (const Interest& interest) {
93 BOOST_CHECK(this->respondRibDataset(interest));
94 };
95
96 this->execute("route");
97 BOOST_CHECK_EQUAL(exitCode, 0);
98 BOOST_CHECK(out.is_equal(NOFILTER_OUTPUT));
99 BOOST_CHECK(err.is_empty());
100}
101
102const std::string NEXTHOP_OUTPUT = std::string(R"TEXT(
103prefix=/5BBmTevRJ nexthop=6720 origin=65 cost=2956 flags=child-inherit|capture expires=29950s
104prefix=/5BBmTevRJ nexthop=6720 origin=255 cost=425 flags=none expires=never
105prefix=/aDPTKCio nexthop=31066 origin=65 cost=4617 flags=capture expires=never
106)TEXT").substr(1);
107
108BOOST_AUTO_TEST_CASE(ListByNexthop)
109{
110 this->processInterest = [this] (const Interest& interest) {
111 BOOST_CHECK(this->respondFaceQuery(interest) || this->respondRibDataset(interest));
112 };
113
114 this->execute("route list udp4://225.131.75.231:56363");
115 BOOST_CHECK_EQUAL(exitCode, 0);
116 BOOST_CHECK(out.is_equal(NEXTHOP_OUTPUT));
117 BOOST_CHECK(err.is_empty());
118}
119
120const std::string ORIGIN_OUTPUT = std::string(R"TEXT(
121prefix=/5BBmTevRJ nexthop=6720 origin=255 cost=425 flags=none expires=never
122prefix=/5BBmTevRJ nexthop=8599 origin=255 cost=9140 flags=child-inherit expires=never
123)TEXT").substr(1);
124
125BOOST_AUTO_TEST_CASE(ListByOrigin)
126{
127 this->processInterest = [this] (const Interest& interest) {
128 BOOST_CHECK(this->respondRibDataset(interest));
129 };
130
131 this->execute("route list origin 255");
132 BOOST_CHECK_EQUAL(exitCode, 0);
133 BOOST_CHECK(out.is_equal(ORIGIN_OUTPUT));
134 BOOST_CHECK(err.is_empty());
135}
136
137const std::string PREFIX_OUTPUT = std::string(R"TEXT(
138prefix=/5BBmTevRJ nexthop=6720 origin=65 cost=2956 flags=child-inherit|capture expires=29950s
139prefix=/5BBmTevRJ nexthop=6720 origin=255 cost=425 flags=none expires=never
140prefix=/5BBmTevRJ nexthop=8599 origin=255 cost=9140 flags=child-inherit expires=never
141)TEXT").substr(1);
142
143BOOST_AUTO_TEST_CASE(ShowByPrefix)
144{
145 this->processInterest = [this] (const Interest& interest) {
146 BOOST_CHECK(this->respondRibDataset(interest));
147 };
148
149 this->execute("route show 5BBmTevRJ");
150 BOOST_CHECK_EQUAL(exitCode, 0);
151 BOOST_CHECK(out.is_equal(PREFIX_OUTPUT));
152 BOOST_CHECK(err.is_empty());
153}
154
155BOOST_AUTO_TEST_CASE(FaceNotExist)
156{
157 this->processInterest = [this] (const Interest& interest) {
158 BOOST_CHECK(this->respondFaceQuery(interest));
159 };
160
161 this->execute("route list 23728");
162 BOOST_CHECK_EQUAL(exitCode, 3);
163 BOOST_CHECK(out.is_empty());
164 BOOST_CHECK(err.is_equal("Face not found\n"));
165}
166
167BOOST_AUTO_TEST_CASE(RouteNotExist)
168{
169 this->processInterest = [this] (const Interest& interest) {
170 BOOST_CHECK(this->respondFaceQuery(interest) || this->respondRibDataset(interest));
171 };
172
173 this->execute("route list 10156");
174 BOOST_CHECK_EQUAL(exitCode, 6);
175 BOOST_CHECK(out.is_empty());
176 BOOST_CHECK(err.is_equal("Route not found\n"));
177}
178
179BOOST_AUTO_TEST_CASE(ErrorDataset)
180{
181 this->processInterest = nullptr; // no response to dataset
182
183 this->execute("route list");
184 BOOST_CHECK_EQUAL(exitCode, 1);
185 BOOST_CHECK(out.is_empty());
186 BOOST_CHECK(err.is_equal("Error 10060 when fetching RIB dataset: Timeout\n"));
187}
188
189BOOST_AUTO_TEST_SUITE_END() // ListShowCommand
190
Junxiao Shi918e5d42017-02-25 03:58:21 +0000191BOOST_FIXTURE_TEST_SUITE(AddCommand, ExecuteCommandFixture)
192
193BOOST_AUTO_TEST_CASE(NormalByFaceId)
194{
195 this->processInterest = [this] (const Interest& interest) {
196 if (this->respondFaceQuery(interest)) {
197 return;
198 }
199
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000200 ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/rib/register");
Junxiao Shi918e5d42017-02-25 03:58:21 +0000201 ndn::nfd::RibRegisterCommand cmd;
202 cmd.validateRequest(req);
203 cmd.applyDefaultsToRequest(req);
204 BOOST_CHECK_EQUAL(req.getName(), "/vxXoEaWeDB");
205 BOOST_CHECK_EQUAL(req.getFaceId(), 10156);
206 BOOST_CHECK_EQUAL(req.getOrigin(), ndn::nfd::ROUTE_ORIGIN_STATIC);
207 BOOST_CHECK_EQUAL(req.getCost(), 0);
208 BOOST_CHECK_EQUAL(req.getFlags(), ndn::nfd::ROUTE_FLAGS_NONE);
209 BOOST_CHECK_EQUAL(req.hasExpirationPeriod(), false);
210
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000211 this->succeedCommand(interest, req);
Junxiao Shi918e5d42017-02-25 03:58:21 +0000212 };
213
214 this->execute("route add /vxXoEaWeDB 10156 no-inherit");
215 BOOST_CHECK_EQUAL(exitCode, 0);
216 BOOST_CHECK(out.is_equal("route-add-accepted prefix=/vxXoEaWeDB nexthop=10156 origin=255 "
217 "cost=0 flags=none expires=never\n"));
218 BOOST_CHECK(err.is_empty());
219}
220
221BOOST_AUTO_TEST_CASE(NormalByFaceUri)
222{
223 this->processInterest = [this] (const Interest& interest) {
224 if (this->respondFaceQuery(interest)) {
225 return;
226 }
227
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000228 ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/rib/register");
Junxiao Shi918e5d42017-02-25 03:58:21 +0000229 ndn::nfd::RibRegisterCommand cmd;
230 cmd.validateRequest(req);
231 cmd.applyDefaultsToRequest(req);
232 BOOST_CHECK_EQUAL(req.getName(), "/FLQAsaYnYf");
233 BOOST_CHECK_EQUAL(req.getFaceId(), 2249);
234 BOOST_CHECK_EQUAL(req.getOrigin(), 17591);
235 BOOST_CHECK_EQUAL(req.getCost(), 702);
236 BOOST_CHECK_EQUAL(req.getFlags(), ndn::nfd::ROUTE_FLAG_CHILD_INHERIT |
237 ndn::nfd::ROUTE_FLAG_CAPTURE);
238 BOOST_REQUIRE_EQUAL(req.hasExpirationPeriod(), true);
239 BOOST_REQUIRE_EQUAL(req.getExpirationPeriod(), time::milliseconds(727411987));
240
241 ControlParameters resp = req;
242 resp.setExpirationPeriod(time::milliseconds(727411154)); // server side may change expiration
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000243 this->succeedCommand(interest, resp);
Junxiao Shi918e5d42017-02-25 03:58:21 +0000244 };
245
246 this->execute("route add /FLQAsaYnYf tcp4://32.121.182.82:6363 "
247 "origin 17591 cost 702 capture expires 727411987");
248 BOOST_CHECK_EQUAL(exitCode, 0);
249 BOOST_CHECK(out.is_equal("route-add-accepted prefix=/FLQAsaYnYf nexthop=2249 origin=17591 "
250 "cost=702 flags=child-inherit|capture expires=727411154ms\n"));
251 BOOST_CHECK(err.is_empty());
252}
253
254BOOST_AUTO_TEST_CASE(FaceNotExist)
255{
256 this->processInterest = [this] (const Interest& interest) {
257 BOOST_CHECK(this->respondFaceQuery(interest));
258 };
259
260 this->execute("route add /GJiKDus5i 23728");
261 BOOST_CHECK_EQUAL(exitCode, 3);
262 BOOST_CHECK(out.is_empty());
263 BOOST_CHECK(err.is_equal("Face not found\n"));
264}
265
266BOOST_AUTO_TEST_CASE(Ambiguous)
267{
268 this->processInterest = [this] (const Interest& interest) {
269 BOOST_CHECK(this->respondFaceQuery(interest));
270 };
271
272 this->execute("route add /BQqjjnVsz udp4://225.131.75.231:56363");
273 BOOST_CHECK_EQUAL(exitCode, 5);
274 BOOST_CHECK(out.is_empty());
275 BOOST_CHECK(err.is_equal("Multiple faces match specified remote FaceUri. "
276 "Re-run the command with a FaceId: "
277 "6720 (local=udp4://202.83.168.28:56363), "
278 "31066 (local=udp4://25.90.26.32:56363)\n"));
279}
280
281BOOST_AUTO_TEST_CASE(ErrorCanonization)
282{
283 this->execute("route add /bxJfGsVtDt udp6://32.38.164.64:10445");
284 BOOST_CHECK_EQUAL(exitCode, 4);
285 BOOST_CHECK(out.is_empty());
286 BOOST_CHECK(err.is_equal("Error during remote FaceUri canonization: "
287 "No endpoints match the specified address selector\n"));
288}
289
290BOOST_AUTO_TEST_CASE(ErrorDataset)
291{
292 this->processInterest = nullptr; // no response to dataset or command
293
294 this->execute("route add /q1Qf7go7 udp://159.242.33.78");
295 BOOST_CHECK_EQUAL(exitCode, 1);
296 BOOST_CHECK(out.is_empty());
297 BOOST_CHECK(err.is_equal("Error 10060 when querying face: Timeout\n"));
298}
299
300BOOST_AUTO_TEST_CASE(ErrorCommand)
301{
302 this->processInterest = [this] (const Interest& interest) {
303 if (this->respondFaceQuery(interest)) {
304 return;
305 }
306
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000307 MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/rib/register");
Junxiao Shi918e5d42017-02-25 03:58:21 +0000308 // no response to command
309 };
310
311 this->execute("route add /bYiMbEuE 10156");
312 BOOST_CHECK_EQUAL(exitCode, 1);
313 BOOST_CHECK(out.is_empty());
314 BOOST_CHECK(err.is_equal("Error 10060 when adding route: request timed out\n"));
315}
316
317BOOST_AUTO_TEST_SUITE_END() // AddCommand
318
Junxiao Shi084b7952017-02-26 22:00:53 +0000319BOOST_FIXTURE_TEST_SUITE(RemoveCommand, ExecuteCommandFixture)
320
321BOOST_AUTO_TEST_CASE(NormalByFaceId)
322{
323 this->processInterest = [this] (const Interest& interest) {
324 if (this->respondFaceQuery(interest)) {
325 return;
326 }
327
328 ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/rib/unregister");
329 ndn::nfd::RibUnregisterCommand cmd;
330 cmd.validateRequest(req);
331 cmd.applyDefaultsToRequest(req);
332 BOOST_CHECK_EQUAL(req.getName(), "/2B5NUGjpt");
333 BOOST_CHECK_EQUAL(req.getFaceId(), 10156);
334 BOOST_CHECK_EQUAL(req.getOrigin(), ndn::nfd::ROUTE_ORIGIN_STATIC);
335
336 this->succeedCommand(interest, req);
337 };
338
339 this->execute("route remove /2B5NUGjpt 10156");
340 BOOST_CHECK_EQUAL(exitCode, 0);
341 BOOST_CHECK(out.is_equal("route-removed prefix=/2B5NUGjpt nexthop=10156 origin=255\n"));
342 BOOST_CHECK(err.is_empty());
343}
344
345BOOST_AUTO_TEST_CASE(NormalByFaceUri)
346{
347 this->processInterest = [this] (const Interest& interest) {
348 if (this->respondFaceQuery(interest)) {
349 return;
350 }
351
352 ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/rib/unregister");
353 ndn::nfd::RibUnregisterCommand cmd;
354 cmd.validateRequest(req);
355 cmd.applyDefaultsToRequest(req);
356 BOOST_CHECK_EQUAL(req.getName(), "/wHdNn0BtUF");
357 BOOST_CHECK_EQUAL(req.getFaceId(), 2249);
358 BOOST_CHECK_EQUAL(req.getOrigin(), 15246);
359
360 this->succeedCommand(interest, req);
361 };
362
363 this->execute("route remove /wHdNn0BtUF tcp4://32.121.182.82:6363 origin 15246");
364 BOOST_CHECK_EQUAL(exitCode, 0);
365 BOOST_CHECK(out.is_equal("route-removed prefix=/wHdNn0BtUF nexthop=2249 origin=15246\n"));
366 BOOST_CHECK(err.is_empty());
367}
368
369BOOST_AUTO_TEST_CASE(MultipleFaces)
370{
371 std::set<uint64_t> faceIds{6720, 31066};
372 this->processInterest = [this, &faceIds] (const Interest& interest) {
373 if (this->respondFaceQuery(interest)) {
374 return;
375 }
376
377 ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/rib/unregister");
378 ndn::nfd::RibUnregisterCommand cmd;
379 cmd.validateRequest(req);
380 cmd.applyDefaultsToRequest(req);
381 BOOST_CHECK_EQUAL(req.getName(), "/nm5y8X8b2");
382 BOOST_CHECK_MESSAGE(faceIds.erase(req.getFaceId()), "expected face " + std::to_string(req.getFaceId()));
383 BOOST_CHECK_EQUAL(req.getOrigin(), ndn::nfd::ROUTE_ORIGIN_STATIC);
384
385 this->succeedCommand(interest, req);
386 };
387
388 this->execute("route remove /nm5y8X8b2 udp4://225.131.75.231:56363");
389 BOOST_CHECK(faceIds.empty());
390 BOOST_CHECK_EQUAL(exitCode, 0);
391 BOOST_CHECK(out.is_equal("route-removed prefix=/nm5y8X8b2 nexthop=6720 origin=255\n"
392 "route-removed prefix=/nm5y8X8b2 nexthop=31066 origin=255\n"));
393 BOOST_CHECK(err.is_empty());
394}
395
396BOOST_AUTO_TEST_CASE(FaceNotExist)
397{
398 this->processInterest = [this] (const Interest& interest) {
399 BOOST_CHECK(this->respondFaceQuery(interest));
400 };
401
402 this->execute("route remove /HeGRjzwFM 23728");
403 BOOST_CHECK_EQUAL(exitCode, 3);
404 BOOST_CHECK(out.is_empty());
405 BOOST_CHECK(err.is_equal("Face not found\n"));
406}
407
408BOOST_AUTO_TEST_CASE(ErrorDataset)
409{
410 this->processInterest = nullptr; // no response to dataset or command
411
412 this->execute("route remove /YX4xQQN3v5 udp://26.97.248.3");
413 BOOST_CHECK_EQUAL(exitCode, 1);
414 BOOST_CHECK(out.is_empty());
415 BOOST_CHECK(err.is_equal("Error 10060 when querying face: Timeout\n"));
416}
417
418BOOST_AUTO_TEST_CASE(ErrorCommand)
419{
420 this->processInterest = [this] (const Interest& interest) {
421 if (this->respondFaceQuery(interest)) {
422 return;
423 }
424
425 MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/rib/unregister");
426 // no response to command
427 };
428
429 this->execute("route remove /mvGRoxD2 10156");
430 BOOST_CHECK_EQUAL(exitCode, 1);
431 BOOST_CHECK(out.is_empty());
432 BOOST_CHECK(err.is_equal("Error 10060 when removing route: request timed out\n"));
433}
434
435BOOST_AUTO_TEST_SUITE_END() // RemoveCommand
436
Junxiao Shi38f4ce92016-08-04 10:01:52 +0000437const std::string STATUS_XML = stripXmlSpaces(R"XML(
438 <rib>
439 <ribEntry>
440 <prefix>/</prefix>
441 <routes>
442 <route>
443 <faceId>262</faceId>
444 <origin>255</origin>
445 <cost>9</cost>
446 <flags>
447 <ribCapture/>
448 </flags>
449 </route>
450 <route>
451 <faceId>272</faceId>
452 <origin>255</origin>
453 <cost>50</cost>
454 <flags/>
455 </route>
456 <route>
457 <faceId>274</faceId>
458 <origin>255</origin>
459 <cost>78</cost>
460 <flags>
461 <childInherit/>
462 <ribCapture/>
463 </flags>
464 </route>
465 <route>
466 <faceId>276</faceId>
467 <origin>255</origin>
468 <cost>79</cost>
469 <flags>
470 <childInherit/>
471 </flags>
472 <expirationPeriod>PT47S</expirationPeriod>
473 </route>
474 </routes>
475 </ribEntry>
476 <ribEntry>
477 <prefix>/localhost/nfd</prefix>
478 <routes>
479 <route>
480 <faceId>258</faceId>
481 <origin>0</origin>
482 <cost>0</cost>
483 <flags>
484 <childInherit/>
485 </flags>
486 </route>
487 </routes>
488 </ribEntry>
489 </rib>
490)XML");
491
492const std::string STATUS_TEXT =
493 "RIB:\n"
Junxiao Shi1d62e622017-03-08 22:39:28 +0000494 " / routes={nexthop=262 origin=255 cost=9 flags=capture expires=never, "
495 "nexthop=272 origin=255 cost=50 flags=none expires=never, "
496 "nexthop=274 origin=255 cost=78 flags=child-inherit|capture expires=never, "
497 "nexthop=276 origin=255 cost=79 flags=child-inherit expires=47s}\n"
498 " /localhost/nfd routes={nexthop=258 origin=0 cost=0 flags=child-inherit expires=never}\n";
Junxiao Shi38f4ce92016-08-04 10:01:52 +0000499
500BOOST_AUTO_TEST_CASE(Status)
501{
502 this->fetchStatus();
503 RibEntry payload1;
504 payload1.setName("/")
505 .addRoute(Route().setFaceId(262)
506 .setOrigin(ndn::nfd::ROUTE_ORIGIN_STATIC)
507 .setCost(9)
508 .setFlags(ndn::nfd::ROUTE_FLAG_CAPTURE))
509 .addRoute(Route().setFaceId(272)
510 .setOrigin(ndn::nfd::ROUTE_ORIGIN_STATIC)
511 .setCost(50)
512 .setFlags(ndn::nfd::ROUTE_FLAGS_NONE))
513 .addRoute(Route().setFaceId(274)
514 .setOrigin(ndn::nfd::ROUTE_ORIGIN_STATIC)
515 .setCost(78)
516 .setFlags(ndn::nfd::ROUTE_FLAG_CHILD_INHERIT | ndn::nfd::ROUTE_FLAG_CAPTURE))
517 .addRoute(Route().setFaceId(276)
518 .setOrigin(ndn::nfd::ROUTE_ORIGIN_STATIC)
519 .setCost(79)
520 .setFlags(ndn::nfd::ROUTE_FLAG_CHILD_INHERIT)
521 .setExpirationPeriod(time::milliseconds(47292)));
522 RibEntry payload2;
523 payload2.setName("/localhost/nfd")
524 .addRoute(Route().setFaceId(258)
525 .setOrigin(ndn::nfd::ROUTE_ORIGIN_APP)
526 .setCost(0)
527 .setFlags(ndn::nfd::ROUTE_FLAG_CHILD_INHERIT));
528 this->sendDataset("/localhost/nfd/rib/list", payload1, payload2);
529 this->prepareStatusOutput();
530
531 BOOST_CHECK(statusXml.is_equal(STATUS_XML));
532 BOOST_CHECK(statusText.is_equal(STATUS_TEXT));
533}
534
535BOOST_AUTO_TEST_SUITE_END() // TestRibModule
Junxiao Shi331ade72016-08-19 14:07:19 +0000536BOOST_AUTO_TEST_SUITE_END() // Nfdc
Junxiao Shi38f4ce92016-08-04 10:01:52 +0000537
538} // namespace tests
Junxiao Shi331ade72016-08-19 14:07:19 +0000539} // namespace nfdc
Junxiao Shi38f4ce92016-08-04 10:01:52 +0000540} // namespace tools
541} // namespace nfd