Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Ashlesh Gawande | 30d96e4 | 2021-03-21 19:15:33 -0700 | [diff] [blame] | 2 | /* |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 3 | * Copyright (c) 2014-2022, The University of Memphis, |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 4 | * Regents of the University of California, |
| 5 | * Arizona Board of Regents. |
| 6 | * |
| 7 | * This file is part of NLSR (Named-data Link State Routing). |
| 8 | * See AUTHORS.md for complete list of NLSR authors and contributors. |
| 9 | * |
| 10 | * NLSR is free software: you can redistribute it and/or modify it under the terms |
| 11 | * of the GNU General Public License as published by the Free Software Foundation, |
| 12 | * either version 3 of the License, or (at your option) any later version. |
| 13 | * |
| 14 | * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 15 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 16 | * PURPOSE. See the GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License along with |
| 19 | * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
Ashlesh Gawande | 30d96e4 | 2021-03-21 19:15:33 -0700 | [diff] [blame] | 20 | */ |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 21 | |
| 22 | #include "communication/sync-logic-handler.hpp" |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 23 | #include "nlsr.hpp" |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 24 | |
Davide Pesavento | 8de8a8b | 2022-05-12 01:26:43 -0400 | [diff] [blame] | 25 | #include "tests/io-key-chain-fixture.hpp" |
| 26 | #include "tests/test-common.hpp" |
| 27 | |
Ashlesh Gawande | 30d96e4 | 2021-03-21 19:15:33 -0700 | [diff] [blame] | 28 | #include <boost/lexical_cast.hpp> |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 29 | |
| 30 | namespace nlsr { |
| 31 | namespace test { |
| 32 | |
| 33 | using std::shared_ptr; |
| 34 | |
Davide Pesavento | 8de8a8b | 2022-05-12 01:26:43 -0400 | [diff] [blame] | 35 | class SyncLogicFixture : public IoKeyChainFixture |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 36 | { |
| 37 | public: |
| 38 | SyncLogicFixture() |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 39 | : testIsLsaNew([] (auto&&...) { return true; }) |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 40 | , updateNamePrefix(this->conf.getLsaPrefix().toUri() + |
| 41 | this->conf.getSiteName().toUri() + |
| 42 | "/%C1.Router/other-router/") |
| 43 | { |
Davide Pesavento | 8de8a8b | 2022-05-12 01:26:43 -0400 | [diff] [blame] | 44 | m_keyChain.createIdentity(conf.getRouterPrefix()); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | void |
| 48 | receiveUpdate(const std::string& prefix, uint64_t seqNo) |
| 49 | { |
| 50 | this->advanceClocks(ndn::time::milliseconds(1), 10); |
| 51 | face.sentInterests.clear(); |
| 52 | |
Ashlesh Gawande | 30d96e4 | 2021-03-21 19:15:33 -0700 | [diff] [blame] | 53 | std::vector<psync::MissingDataInfo> updates; |
Alexander Afanasyev | 135288c | 2022-04-23 23:06:56 -0400 | [diff] [blame] | 54 | updates.push_back({ndn::Name(prefix), 0, seqNo, 0}); |
Ashlesh Gawande | 30d96e4 | 2021-03-21 19:15:33 -0700 | [diff] [blame] | 55 | sync.m_syncLogic.onPSyncUpdate(updates); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 56 | |
| 57 | this->advanceClocks(ndn::time::milliseconds(1), 10); |
| 58 | } |
| 59 | |
| 60 | public: |
Davide Pesavento | 8de8a8b | 2022-05-12 01:26:43 -0400 | [diff] [blame] | 61 | ndn::util::DummyClientFace face{m_io, m_keyChain}; |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 62 | ConfParameter conf{face, m_keyChain}; |
Davide Pesavento | 1954a0c | 2022-09-30 15:56:04 -0400 | [diff] [blame^] | 63 | DummyConfFileProcessor confProcessor{conf, SyncProtocol::PSYNC}; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 64 | SyncLogicHandler::IsLsaNew testIsLsaNew; |
Davide Pesavento | 1954a0c | 2022-09-30 15:56:04 -0400 | [diff] [blame^] | 65 | SyncLogicHandler sync{face, m_keyChain, testIsLsaNew, conf}; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 66 | |
| 67 | const std::string updateNamePrefix; |
Davide Pesavento | 8de8a8b | 2022-05-12 01:26:43 -0400 | [diff] [blame] | 68 | const std::vector<Lsa::Type> lsaTypes{Lsa::Type::NAME, |
| 69 | Lsa::Type::ADJACENCY, |
| 70 | Lsa::Type::COORDINATE}; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 71 | }; |
| 72 | |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 73 | BOOST_FIXTURE_TEST_SUITE(TestSyncLogicHandler, SyncLogicFixture) |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 74 | |
| 75 | /* Tests that when SyncLogicHandler receives an LSA of either Name or |
| 76 | Adjacency type that appears to be newer, it will emit to its signal |
| 77 | with those LSA details. |
| 78 | */ |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 79 | BOOST_AUTO_TEST_CASE(UpdateForOtherLS) |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 80 | { |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 81 | size_t nCallbacks = 0; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 82 | uint64_t syncSeqNo = 1; |
| 83 | |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 84 | for (auto lsaType : {Lsa::Type::NAME, Lsa::Type::ADJACENCY}) { |
Ashlesh Gawande | 0db4d4d | 2020-02-05 20:30:02 -0800 | [diff] [blame] | 85 | std::string updateName = this->updateNamePrefix + boost::lexical_cast<std::string>(lsaType); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 86 | |
Davide Pesavento | 1954a0c | 2022-09-30 15:56:04 -0400 | [diff] [blame^] | 87 | ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa.connect( |
Alexander Afanasyev | 135288c | 2022-04-23 23:06:56 -0400 | [diff] [blame] | 88 | [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 89 | BOOST_CHECK_EQUAL(ndn::Name{updateName}, routerName); |
| 90 | BOOST_CHECK_EQUAL(sequenceNumber, syncSeqNo); |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 91 | ++nCallbacks; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 92 | }); |
| 93 | |
| 94 | this->receiveUpdate(updateName, syncSeqNo); |
| 95 | } |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 96 | |
| 97 | BOOST_CHECK_EQUAL(nCallbacks, 2); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 98 | } |
| 99 | |
| 100 | /* Tests that when SyncLogicHandler in HR mode receives an LSA of |
| 101 | either Coordinate or Name type that appears to be newer, it will |
| 102 | emit to its signal with those LSA details. |
| 103 | */ |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 104 | BOOST_AUTO_TEST_CASE(UpdateForOtherHR) |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 105 | { |
| 106 | this->conf.setHyperbolicState(HYPERBOLIC_STATE_ON); |
| 107 | |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 108 | size_t nCallbacks = 0; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 109 | uint64_t syncSeqNo = 1; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 110 | |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 111 | for (auto lsaType : {Lsa::Type::NAME, Lsa::Type::COORDINATE}) { |
Ashlesh Gawande | 0db4d4d | 2020-02-05 20:30:02 -0800 | [diff] [blame] | 112 | std::string updateName = this->updateNamePrefix + boost::lexical_cast<std::string>(lsaType); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 113 | |
Davide Pesavento | 1954a0c | 2022-09-30 15:56:04 -0400 | [diff] [blame^] | 114 | ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa.connect( |
Alexander Afanasyev | 135288c | 2022-04-23 23:06:56 -0400 | [diff] [blame] | 115 | [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 116 | BOOST_CHECK_EQUAL(ndn::Name{updateName}, routerName); |
| 117 | BOOST_CHECK_EQUAL(sequenceNumber, syncSeqNo); |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 118 | ++nCallbacks; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 119 | }); |
| 120 | |
| 121 | this->receiveUpdate(updateName, syncSeqNo); |
| 122 | } |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 123 | |
| 124 | BOOST_CHECK_EQUAL(nCallbacks, 2); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 125 | } |
| 126 | |
| 127 | /* Tests that when SyncLogicHandler in HR-dry mode receives an LSA of |
| 128 | any type that appears to be newer, it will emit to its signal with |
| 129 | those LSA details. |
| 130 | */ |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 131 | BOOST_AUTO_TEST_CASE(UpdateForOtherHRDry) |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 132 | { |
| 133 | this->conf.setHyperbolicState(HYPERBOLIC_STATE_DRY_RUN); |
| 134 | |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 135 | size_t nCallbacks = 0; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 136 | uint64_t syncSeqNo = 1; |
| 137 | |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 138 | for (auto lsaType : this->lsaTypes) { |
Ashlesh Gawande | 0db4d4d | 2020-02-05 20:30:02 -0800 | [diff] [blame] | 139 | std::string updateName = this->updateNamePrefix + boost::lexical_cast<std::string>(lsaType); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 140 | |
Davide Pesavento | 1954a0c | 2022-09-30 15:56:04 -0400 | [diff] [blame^] | 141 | ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa.connect( |
Alexander Afanasyev | 135288c | 2022-04-23 23:06:56 -0400 | [diff] [blame] | 142 | [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 143 | BOOST_CHECK_EQUAL(ndn::Name{updateName}, routerName); |
| 144 | BOOST_CHECK_EQUAL(sequenceNumber, syncSeqNo); |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 145 | ++nCallbacks; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 146 | }); |
| 147 | |
| 148 | this->receiveUpdate(updateName, syncSeqNo); |
| 149 | } |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 150 | |
| 151 | BOOST_CHECK_EQUAL(nCallbacks, 3); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | /* Tests that when SyncLogicHandler receives an update for an LSA with |
| 155 | details matching this router's details, it will *not* emit to its |
| 156 | signal those LSA details. |
| 157 | */ |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 158 | BOOST_AUTO_TEST_CASE(NoUpdateForSelf) |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 159 | { |
| 160 | const uint64_t sequenceNumber = 1; |
| 161 | |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 162 | for (auto lsaType : this->lsaTypes) { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 163 | // To ensure that we get correctly-separated components, create |
| 164 | // and modify a Name to hand off. |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 165 | ndn::Name updateName{this->conf.getLsaPrefix()}; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 166 | updateName.append(this->conf.getSiteName()) |
| 167 | .append(this->conf.getRouterName()) |
Ashlesh Gawande | 0db4d4d | 2020-02-05 20:30:02 -0800 | [diff] [blame] | 168 | .append(boost::lexical_cast<std::string>(lsaType)); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 169 | |
Davide Pesavento | 1954a0c | 2022-09-30 15:56:04 -0400 | [diff] [blame^] | 170 | ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa.connect( |
Alexander Afanasyev | 135288c | 2022-04-23 23:06:56 -0400 | [diff] [blame] | 171 | [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 172 | BOOST_FAIL("Updates for self should not be emitted!"); |
| 173 | }); |
| 174 | |
| 175 | this->receiveUpdate(updateName.toUri(), sequenceNumber); |
| 176 | } |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 177 | |
| 178 | // avoid "test case [...] did not check any assertions" message from Boost.Test |
| 179 | BOOST_CHECK(true); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 180 | } |
| 181 | |
| 182 | /* Tests that when SyncLogicHandler receives an update for an LSA with |
| 183 | details that do not match the expected format, it will *not* emit |
| 184 | to its signal those LSA details. |
| 185 | */ |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 186 | BOOST_AUTO_TEST_CASE(MalformedUpdate) |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 187 | { |
| 188 | const uint64_t sequenceNumber = 1; |
| 189 | |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 190 | for (auto lsaType : this->lsaTypes) { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 191 | ndn::Name updateName{this->conf.getSiteName()}; |
Ashlesh Gawande | 0db4d4d | 2020-02-05 20:30:02 -0800 | [diff] [blame] | 192 | updateName.append(this->conf.getRouterName()).append(boost::lexical_cast<std::string>(lsaType)); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 193 | |
Davide Pesavento | 1954a0c | 2022-09-30 15:56:04 -0400 | [diff] [blame^] | 194 | ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa.connect( |
Alexander Afanasyev | 135288c | 2022-04-23 23:06:56 -0400 | [diff] [blame] | 195 | [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 196 | BOOST_FAIL("Malformed updates should not be emitted!"); |
| 197 | }); |
| 198 | |
| 199 | this->receiveUpdate(updateName.toUri(), sequenceNumber); |
| 200 | } |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 201 | |
| 202 | // avoid "test case [...] did not check any assertions" message from Boost.Test |
| 203 | BOOST_CHECK(true); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | /* Tests that when SyncLogicHandler receives an update for an LSA with |
| 207 | details that do not appear to be new, it will *not* emit to its |
| 208 | signal those LSA details. |
| 209 | */ |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 210 | BOOST_AUTO_TEST_CASE(LsaNotNew) |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 211 | { |
| 212 | auto testLsaAlwaysFalse = [] (const ndn::Name& routerName, const Lsa::Type& lsaType, |
Alexander Afanasyev | 135288c | 2022-04-23 23:06:56 -0400 | [diff] [blame] | 213 | const uint64_t& sequenceNumber, uint64_t incomingFaceId) { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 214 | return false; |
| 215 | }; |
| 216 | |
| 217 | const uint64_t sequenceNumber = 1; |
Davide Pesavento | 1954a0c | 2022-09-30 15:56:04 -0400 | [diff] [blame^] | 218 | SyncLogicHandler sync{this->face, this->m_keyChain, testLsaAlwaysFalse, this->conf}; |
| 219 | ndn::util::signal::ScopedConnection connection = sync.onNewLsa.connect( |
| 220 | [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) { |
| 221 | BOOST_FAIL("An update for an LSA with non-new sequence number should not emit!"); |
| 222 | }); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 223 | |
Ashlesh Gawande | 0db4d4d | 2020-02-05 20:30:02 -0800 | [diff] [blame] | 224 | std::string updateName = this->updateNamePrefix + boost::lexical_cast<std::string>(Lsa::Type::NAME); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 225 | this->receiveUpdate(updateName, sequenceNumber); |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 226 | |
| 227 | // avoid "test case [...] did not check any assertions" message from Boost.Test |
| 228 | BOOST_CHECK(true); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 229 | } |
| 230 | |
| 231 | /* Tests that SyncLogicHandler successfully concatenates configured |
| 232 | variables together to form the necessary prefixes to advertise |
Ashlesh Gawande | 30d96e4 | 2021-03-21 19:15:33 -0700 | [diff] [blame] | 233 | through sync. |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 234 | */ |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 235 | BOOST_AUTO_TEST_CASE(UpdatePrefix) |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 236 | { |
| 237 | ndn::Name expectedPrefix = this->conf.getLsaPrefix(); |
| 238 | expectedPrefix.append(this->conf.getSiteName()); |
| 239 | expectedPrefix.append(this->conf.getRouterName()); |
| 240 | |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 241 | BOOST_CHECK_EQUAL(this->sync.m_nameLsaUserPrefix, |
Ashlesh Gawande | 0db4d4d | 2020-02-05 20:30:02 -0800 | [diff] [blame] | 242 | ndn::Name(expectedPrefix).append(boost::lexical_cast<std::string>(Lsa::Type::NAME))); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 243 | BOOST_CHECK_EQUAL(this->sync.m_adjLsaUserPrefix, |
Ashlesh Gawande | 0db4d4d | 2020-02-05 20:30:02 -0800 | [diff] [blame] | 244 | ndn::Name(expectedPrefix).append(boost::lexical_cast<std::string>(Lsa::Type::ADJACENCY))); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 245 | BOOST_CHECK_EQUAL(this->sync.m_coorLsaUserPrefix, |
Ashlesh Gawande | 0db4d4d | 2020-02-05 20:30:02 -0800 | [diff] [blame] | 246 | ndn::Name(expectedPrefix).append(boost::lexical_cast<std::string>(Lsa::Type::COORDINATE))); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 247 | } |
| 248 | |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 249 | BOOST_AUTO_TEST_SUITE_END() |
| 250 | |
| 251 | } // namespace test |
| 252 | } // namespace nlsr |