blob: 9600d1093685e9bcbea5a1d6844d5d7fc56cb6bd [file] [log] [blame]
Vince Lehmancd16c832014-07-23 15:14:55 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Junxiao Shi221b6fe2016-07-14 18:21:56 +00003 * Copyright (c) 2014-2016, Regents of the University of California,
Alexander Afanasyev7c10b3b2015-01-20 12:24:27 -08004 * 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 Lehmancd16c832014-07-23 15:14:55 -070010 *
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-status-publisher.hpp"
Vince Lehmancd16c832014-07-23 15:14:55 -070027#include "rib-status-publisher-common.hpp"
Junxiao Shi376f7372014-11-17 18:03:31 -070028
29#include "tests/test-common.hpp"
30#include <ndn-cxx/util/dummy-client-face.hpp>
Vince Lehmancd16c832014-07-23 15:14:55 -070031
32namespace nfd {
33namespace rib {
34namespace tests {
35
Spyridon Mastorakisd0381c02015-02-19 10:29:41 -080036BOOST_FIXTURE_TEST_SUITE(TestRibStatusPublisher, RibStatusPublisherFixture)
Vince Lehmancd16c832014-07-23 15:14:55 -070037
38BOOST_AUTO_TEST_CASE(Basic)
39{
40 Rib rib;
41
Vince Lehman218be0a2015-01-15 17:25:20 -060042 Route route;
Vince Lehmancd16c832014-07-23 15:14:55 -070043 Name name("/");
Vince Lehman218be0a2015-01-15 17:25:20 -060044 route.faceId = 1;
45 route.origin = 128;
46 route.cost = 32;
47 route.flags = ndn::nfd::ROUTE_FLAG_CAPTURE;
48 rib.insert(name, route);
Vince Lehmancd16c832014-07-23 15:14:55 -070049
Junxiao Shi221b6fe2016-07-14 18:21:56 +000050 ndn::util::DummyClientFace face(getGlobalIoService(), m_keyChain);
51 RibStatusPublisher publisher(rib, face, "/localhost/nfd/rib/list", m_keyChain);
Vince Lehmancd16c832014-07-23 15:14:55 -070052
53 publisher.publish();
Junxiao Shi221b6fe2016-07-14 18:21:56 +000054 face.processEvents(time::milliseconds(1));
Vince Lehmancd16c832014-07-23 15:14:55 -070055
Junxiao Shi221b6fe2016-07-14 18:21:56 +000056 BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
57 decodeRibEntryBlock(face.sentData[0], name, route);
Vince Lehmancd16c832014-07-23 15:14:55 -070058}
59
60
61BOOST_AUTO_TEST_SUITE_END()
62
63} // namespace tests
64} // namespace rib
65} // namespace nfd