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