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 | /* |
Junxiao Shi | 43f37a0 | 2023-08-09 00:09:00 +0000 | [diff] [blame^] | 3 | * Copyright (c) 2014-2023, 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 | |
Davide Pesavento | 8de8a8b | 2022-05-12 01:26:43 -0400 | [diff] [blame] | 33 | class SyncLogicFixture : public IoKeyChainFixture |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 34 | { |
| 35 | public: |
| 36 | SyncLogicFixture() |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 37 | : testIsLsaNew([] (auto&&...) { return true; }) |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 38 | , updateNamePrefix(this->conf.getLsaPrefix().toUri() + |
| 39 | this->conf.getSiteName().toUri() + |
| 40 | "/%C1.Router/other-router/") |
| 41 | { |
Davide Pesavento | 8de8a8b | 2022-05-12 01:26:43 -0400 | [diff] [blame] | 42 | m_keyChain.createIdentity(conf.getRouterPrefix()); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | void |
| 46 | receiveUpdate(const std::string& prefix, uint64_t seqNo) |
| 47 | { |
| 48 | this->advanceClocks(ndn::time::milliseconds(1), 10); |
| 49 | face.sentInterests.clear(); |
| 50 | |
Ashlesh Gawande | 30d96e4 | 2021-03-21 19:15:33 -0700 | [diff] [blame] | 51 | std::vector<psync::MissingDataInfo> updates; |
Alexander Afanasyev | 135288c | 2022-04-23 23:06:56 -0400 | [diff] [blame] | 52 | updates.push_back({ndn::Name(prefix), 0, seqNo, 0}); |
Ashlesh Gawande | 30d96e4 | 2021-03-21 19:15:33 -0700 | [diff] [blame] | 53 | sync.m_syncLogic.onPSyncUpdate(updates); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 54 | |
| 55 | this->advanceClocks(ndn::time::milliseconds(1), 10); |
| 56 | } |
| 57 | |
| 58 | public: |
Junxiao Shi | 43f37a0 | 2023-08-09 00:09:00 +0000 | [diff] [blame^] | 59 | ndn::DummyClientFace face{m_io, m_keyChain}; |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 60 | ConfParameter conf{face, m_keyChain}; |
Davide Pesavento | 1954a0c | 2022-09-30 15:56:04 -0400 | [diff] [blame] | 61 | DummyConfFileProcessor confProcessor{conf, SyncProtocol::PSYNC}; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 62 | SyncLogicHandler::IsLsaNew testIsLsaNew; |
Davide Pesavento | 1954a0c | 2022-09-30 15:56:04 -0400 | [diff] [blame] | 63 | SyncLogicHandler sync{face, m_keyChain, testIsLsaNew, conf}; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 64 | |
| 65 | const std::string updateNamePrefix; |
Davide Pesavento | 8de8a8b | 2022-05-12 01:26:43 -0400 | [diff] [blame] | 66 | const std::vector<Lsa::Type> lsaTypes{Lsa::Type::NAME, |
| 67 | Lsa::Type::ADJACENCY, |
| 68 | Lsa::Type::COORDINATE}; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 69 | }; |
| 70 | |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 71 | BOOST_FIXTURE_TEST_SUITE(TestSyncLogicHandler, SyncLogicFixture) |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 72 | |
| 73 | /* Tests that when SyncLogicHandler receives an LSA of either Name or |
| 74 | Adjacency type that appears to be newer, it will emit to its signal |
| 75 | with those LSA details. |
| 76 | */ |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 77 | BOOST_AUTO_TEST_CASE(UpdateForOtherLS) |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 78 | { |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 79 | size_t nCallbacks = 0; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 80 | uint64_t syncSeqNo = 1; |
| 81 | |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 82 | for (auto lsaType : {Lsa::Type::NAME, Lsa::Type::ADJACENCY}) { |
Ashlesh Gawande | 0db4d4d | 2020-02-05 20:30:02 -0800 | [diff] [blame] | 83 | std::string updateName = this->updateNamePrefix + boost::lexical_cast<std::string>(lsaType); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 84 | |
Junxiao Shi | 43f37a0 | 2023-08-09 00:09:00 +0000 | [diff] [blame^] | 85 | ndn::signal::ScopedConnection connection = this->sync.onNewLsa.connect( |
Alexander Afanasyev | 135288c | 2022-04-23 23:06:56 -0400 | [diff] [blame] | 86 | [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 87 | BOOST_CHECK_EQUAL(ndn::Name{updateName}, routerName); |
| 88 | BOOST_CHECK_EQUAL(sequenceNumber, syncSeqNo); |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 89 | ++nCallbacks; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 90 | }); |
| 91 | |
| 92 | this->receiveUpdate(updateName, syncSeqNo); |
| 93 | } |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 94 | |
| 95 | BOOST_CHECK_EQUAL(nCallbacks, 2); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | /* Tests that when SyncLogicHandler in HR mode receives an LSA of |
| 99 | either Coordinate or Name type that appears to be newer, it will |
| 100 | emit to its signal with those LSA details. |
| 101 | */ |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 102 | BOOST_AUTO_TEST_CASE(UpdateForOtherHR) |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 103 | { |
| 104 | this->conf.setHyperbolicState(HYPERBOLIC_STATE_ON); |
| 105 | |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 106 | size_t nCallbacks = 0; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 107 | uint64_t syncSeqNo = 1; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 108 | |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 109 | for (auto lsaType : {Lsa::Type::NAME, Lsa::Type::COORDINATE}) { |
Ashlesh Gawande | 0db4d4d | 2020-02-05 20:30:02 -0800 | [diff] [blame] | 110 | std::string updateName = this->updateNamePrefix + boost::lexical_cast<std::string>(lsaType); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 111 | |
Junxiao Shi | 43f37a0 | 2023-08-09 00:09:00 +0000 | [diff] [blame^] | 112 | ndn::signal::ScopedConnection connection = this->sync.onNewLsa.connect( |
Alexander Afanasyev | 135288c | 2022-04-23 23:06:56 -0400 | [diff] [blame] | 113 | [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 114 | BOOST_CHECK_EQUAL(ndn::Name{updateName}, routerName); |
| 115 | BOOST_CHECK_EQUAL(sequenceNumber, syncSeqNo); |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 116 | ++nCallbacks; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 117 | }); |
| 118 | |
| 119 | this->receiveUpdate(updateName, syncSeqNo); |
| 120 | } |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 121 | |
| 122 | BOOST_CHECK_EQUAL(nCallbacks, 2); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | /* Tests that when SyncLogicHandler in HR-dry mode receives an LSA of |
| 126 | any type that appears to be newer, it will emit to its signal with |
| 127 | those LSA details. |
| 128 | */ |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 129 | BOOST_AUTO_TEST_CASE(UpdateForOtherHRDry) |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 130 | { |
| 131 | this->conf.setHyperbolicState(HYPERBOLIC_STATE_DRY_RUN); |
| 132 | |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 133 | size_t nCallbacks = 0; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 134 | uint64_t syncSeqNo = 1; |
| 135 | |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 136 | for (auto lsaType : this->lsaTypes) { |
Ashlesh Gawande | 0db4d4d | 2020-02-05 20:30:02 -0800 | [diff] [blame] | 137 | std::string updateName = this->updateNamePrefix + boost::lexical_cast<std::string>(lsaType); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 138 | |
Junxiao Shi | 43f37a0 | 2023-08-09 00:09:00 +0000 | [diff] [blame^] | 139 | ndn::signal::ScopedConnection connection = this->sync.onNewLsa.connect( |
Alexander Afanasyev | 135288c | 2022-04-23 23:06:56 -0400 | [diff] [blame] | 140 | [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 141 | BOOST_CHECK_EQUAL(ndn::Name{updateName}, routerName); |
| 142 | BOOST_CHECK_EQUAL(sequenceNumber, syncSeqNo); |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 143 | ++nCallbacks; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 144 | }); |
| 145 | |
| 146 | this->receiveUpdate(updateName, syncSeqNo); |
| 147 | } |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 148 | |
| 149 | BOOST_CHECK_EQUAL(nCallbacks, 3); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | /* Tests that when SyncLogicHandler receives an update for an LSA with |
| 153 | details matching this router's details, it will *not* emit to its |
| 154 | signal those LSA details. |
| 155 | */ |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 156 | BOOST_AUTO_TEST_CASE(NoUpdateForSelf) |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 157 | { |
| 158 | const uint64_t sequenceNumber = 1; |
| 159 | |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 160 | for (auto lsaType : this->lsaTypes) { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 161 | // To ensure that we get correctly-separated components, create |
| 162 | // and modify a Name to hand off. |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 163 | ndn::Name updateName{this->conf.getLsaPrefix()}; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 164 | updateName.append(this->conf.getSiteName()) |
| 165 | .append(this->conf.getRouterName()) |
Ashlesh Gawande | 0db4d4d | 2020-02-05 20:30:02 -0800 | [diff] [blame] | 166 | .append(boost::lexical_cast<std::string>(lsaType)); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 167 | |
Junxiao Shi | 43f37a0 | 2023-08-09 00:09:00 +0000 | [diff] [blame^] | 168 | ndn::signal::ScopedConnection connection = this->sync.onNewLsa.connect( |
Alexander Afanasyev | 135288c | 2022-04-23 23:06:56 -0400 | [diff] [blame] | 169 | [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 170 | BOOST_FAIL("Updates for self should not be emitted!"); |
| 171 | }); |
| 172 | |
| 173 | this->receiveUpdate(updateName.toUri(), sequenceNumber); |
| 174 | } |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 175 | |
| 176 | // avoid "test case [...] did not check any assertions" message from Boost.Test |
| 177 | BOOST_CHECK(true); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 178 | } |
| 179 | |
| 180 | /* Tests that when SyncLogicHandler receives an update for an LSA with |
| 181 | details that do not match the expected format, it will *not* emit |
| 182 | to its signal those LSA details. |
| 183 | */ |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 184 | BOOST_AUTO_TEST_CASE(MalformedUpdate) |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 185 | { |
| 186 | const uint64_t sequenceNumber = 1; |
| 187 | |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 188 | for (auto lsaType : this->lsaTypes) { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 189 | ndn::Name updateName{this->conf.getSiteName()}; |
Ashlesh Gawande | 0db4d4d | 2020-02-05 20:30:02 -0800 | [diff] [blame] | 190 | updateName.append(this->conf.getRouterName()).append(boost::lexical_cast<std::string>(lsaType)); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 191 | |
Junxiao Shi | 43f37a0 | 2023-08-09 00:09:00 +0000 | [diff] [blame^] | 192 | ndn::signal::ScopedConnection connection = this->sync.onNewLsa.connect( |
Alexander Afanasyev | 135288c | 2022-04-23 23:06:56 -0400 | [diff] [blame] | 193 | [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 194 | BOOST_FAIL("Malformed updates should not be emitted!"); |
| 195 | }); |
| 196 | |
| 197 | this->receiveUpdate(updateName.toUri(), sequenceNumber); |
| 198 | } |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 199 | |
| 200 | // avoid "test case [...] did not check any assertions" message from Boost.Test |
| 201 | BOOST_CHECK(true); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 202 | } |
| 203 | |
| 204 | /* Tests that when SyncLogicHandler receives an update for an LSA with |
| 205 | details that do not appear to be new, it will *not* emit to its |
| 206 | signal those LSA details. |
| 207 | */ |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 208 | BOOST_AUTO_TEST_CASE(LsaNotNew) |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 209 | { |
| 210 | auto testLsaAlwaysFalse = [] (const ndn::Name& routerName, const Lsa::Type& lsaType, |
Alexander Afanasyev | 135288c | 2022-04-23 23:06:56 -0400 | [diff] [blame] | 211 | const uint64_t& sequenceNumber, uint64_t incomingFaceId) { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 212 | return false; |
| 213 | }; |
| 214 | |
| 215 | const uint64_t sequenceNumber = 1; |
Davide Pesavento | 1954a0c | 2022-09-30 15:56:04 -0400 | [diff] [blame] | 216 | SyncLogicHandler sync{this->face, this->m_keyChain, testLsaAlwaysFalse, this->conf}; |
Junxiao Shi | 43f37a0 | 2023-08-09 00:09:00 +0000 | [diff] [blame^] | 217 | ndn::signal::ScopedConnection connection = sync.onNewLsa.connect( |
Davide Pesavento | 1954a0c | 2022-09-30 15:56:04 -0400 | [diff] [blame] | 218 | [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) { |
| 219 | BOOST_FAIL("An update for an LSA with non-new sequence number should not emit!"); |
| 220 | }); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 221 | |
Ashlesh Gawande | 0db4d4d | 2020-02-05 20:30:02 -0800 | [diff] [blame] | 222 | 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] | 223 | this->receiveUpdate(updateName, sequenceNumber); |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 224 | |
| 225 | // avoid "test case [...] did not check any assertions" message from Boost.Test |
| 226 | BOOST_CHECK(true); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | /* Tests that SyncLogicHandler successfully concatenates configured |
| 230 | variables together to form the necessary prefixes to advertise |
Ashlesh Gawande | 30d96e4 | 2021-03-21 19:15:33 -0700 | [diff] [blame] | 231 | through sync. |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 232 | */ |
Davide Pesavento | d1f1df8 | 2022-03-12 16:40:37 -0500 | [diff] [blame] | 233 | BOOST_AUTO_TEST_CASE(UpdatePrefix) |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 234 | { |
| 235 | ndn::Name expectedPrefix = this->conf.getLsaPrefix(); |
| 236 | expectedPrefix.append(this->conf.getSiteName()); |
| 237 | expectedPrefix.append(this->conf.getRouterName()); |
| 238 | |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 239 | BOOST_CHECK_EQUAL(this->sync.m_nameLsaUserPrefix, |
Ashlesh Gawande | 0db4d4d | 2020-02-05 20:30:02 -0800 | [diff] [blame] | 240 | ndn::Name(expectedPrefix).append(boost::lexical_cast<std::string>(Lsa::Type::NAME))); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 241 | BOOST_CHECK_EQUAL(this->sync.m_adjLsaUserPrefix, |
Ashlesh Gawande | 0db4d4d | 2020-02-05 20:30:02 -0800 | [diff] [blame] | 242 | ndn::Name(expectedPrefix).append(boost::lexical_cast<std::string>(Lsa::Type::ADJACENCY))); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 243 | BOOST_CHECK_EQUAL(this->sync.m_coorLsaUserPrefix, |
Ashlesh Gawande | 0db4d4d | 2020-02-05 20:30:02 -0800 | [diff] [blame] | 244 | ndn::Name(expectedPrefix).append(boost::lexical_cast<std::string>(Lsa::Type::COORDINATE))); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 245 | } |
| 246 | |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 247 | BOOST_AUTO_TEST_SUITE_END() |
| 248 | |
| 249 | } // namespace test |
| 250 | } // namespace nlsr |