Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Eric Newberry | 2642cd2 | 2017-07-13 21:34:53 -0400 | [diff] [blame] | 2 | /* |
Davide Pesavento | 78ddcab | 2019-02-28 22:00:03 -0500 | [diff] [blame] | 3 | * Copyright (c) 2014-2019, Regents of the University of California, |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 4 | * 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 | |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 26 | #include "mgmt/face-manager.hpp" |
| 27 | #include "face/generic-link-service.hpp" |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 28 | #include "face-manager-command-fixture.hpp" |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 29 | |
Junxiao Shi | cbc8e94 | 2016-09-06 03:17:45 +0000 | [diff] [blame] | 30 | #include <ndn-cxx/lp/tags.hpp> |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 31 | |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 32 | #include <thread> |
| 33 | |
Eric Newberry | 0c3e57b | 2018-01-25 20:54:46 -0700 | [diff] [blame] | 34 | #include <boost/logic/tribool.hpp> |
| 35 | |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 36 | namespace nfd { |
| 37 | namespace tests { |
| 38 | |
| 39 | BOOST_AUTO_TEST_SUITE(Mgmt) |
| 40 | BOOST_AUTO_TEST_SUITE(TestFaceManager) |
| 41 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 42 | namespace mpl = boost::mpl; |
| 43 | |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 44 | class FaceManagerUpdateFixture : public FaceManagerCommandFixture |
| 45 | { |
| 46 | public: |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 47 | ~FaceManagerUpdateFixture() |
| 48 | { |
| 49 | destroyFace(); |
| 50 | } |
| 51 | |
| 52 | void |
| 53 | createFace(const std::string& uri = "tcp4://127.0.0.1:26363", |
| 54 | ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT, |
Davide Pesavento | 87fc0f8 | 2018-04-11 23:43:51 -0400 | [diff] [blame] | 55 | optional<time::nanoseconds> baseCongestionMarkingInterval = {}, |
| 56 | optional<uint64_t> defaultCongestionThreshold = {}, |
Eric Newberry | 2642cd2 | 2017-07-13 21:34:53 -0400 | [diff] [blame] | 57 | bool enableLocalFields = false, |
Eric Newberry | 0c3e57b | 2018-01-25 20:54:46 -0700 | [diff] [blame] | 58 | bool enableReliability = false, |
| 59 | boost::logic::tribool enableCongestionMarking = boost::logic::indeterminate) |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 60 | { |
| 61 | ControlParameters params; |
| 62 | params.setUri(uri); |
| 63 | params.setFacePersistency(persistency); |
Eric Newberry | 0c3e57b | 2018-01-25 20:54:46 -0700 | [diff] [blame] | 64 | |
| 65 | if (baseCongestionMarkingInterval) { |
| 66 | params.setBaseCongestionMarkingInterval(*baseCongestionMarkingInterval); |
| 67 | } |
| 68 | |
| 69 | if (defaultCongestionThreshold) { |
| 70 | params.setDefaultCongestionThreshold(*defaultCongestionThreshold); |
| 71 | } |
| 72 | |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 73 | params.setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, enableLocalFields); |
Eric Newberry | 2642cd2 | 2017-07-13 21:34:53 -0400 | [diff] [blame] | 74 | params.setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, enableReliability); |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 75 | |
Eric Newberry | 0c3e57b | 2018-01-25 20:54:46 -0700 | [diff] [blame] | 76 | if (!boost::logic::indeterminate(enableCongestionMarking)) { |
Davide Pesavento | fa2aa50 | 2019-03-22 13:30:02 -0400 | [diff] [blame] | 77 | params.setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, bool(enableCongestionMarking)); |
Eric Newberry | 0c3e57b | 2018-01-25 20:54:46 -0700 | [diff] [blame] | 78 | } |
| 79 | |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 80 | createFace(params); |
| 81 | } |
| 82 | |
| 83 | void |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 84 | createFace(const ControlParameters& createParams, bool isForOnDemandFace = false) |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 85 | { |
Junxiao Shi | 8a1f170 | 2017-07-03 00:05:08 +0000 | [diff] [blame] | 86 | Interest req = makeControlCommandRequest("/localhost/nfd/faces/create", createParams); |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 87 | |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 88 | // if this creation if for on-demand face then create it on node2 |
| 89 | FaceManagerCommandNode& target = isForOnDemandFace ? this->node2 : this->node1; |
| 90 | |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 91 | bool hasCallbackFired = false; |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 92 | signal::ScopedConnection connection = target.face.onSendData.connect( |
Junxiao Shi | 8a1f170 | 2017-07-03 00:05:08 +0000 | [diff] [blame] | 93 | [&, req, isForOnDemandFace, this] (const Data& response) { |
| 94 | if (!req.getName().isPrefixOf(response.getName())) { |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 95 | return; |
| 96 | } |
| 97 | |
| 98 | ControlResponse create(response.getContent().blockFromValue()); |
| 99 | BOOST_REQUIRE_EQUAL(create.getCode(), 200); |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 100 | BOOST_REQUIRE(create.getBody().hasWire()); |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 101 | |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 102 | ControlParameters faceParams(create.getBody()); |
| 103 | BOOST_REQUIRE(faceParams.hasFaceId()); |
| 104 | this->faceId = faceParams.getFaceId(); |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 105 | |
| 106 | hasCallbackFired = true; |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 107 | |
| 108 | if (isForOnDemandFace) { |
| 109 | auto face = target.faceTable.get(static_cast<FaceId>(this->faceId)); |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 110 | // to force creation of on-demand face |
| 111 | face->sendInterest(*make_shared<Interest>("/hello/world")); |
| 112 | } |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 113 | }); |
| 114 | |
Junxiao Shi | 8a1f170 | 2017-07-03 00:05:08 +0000 | [diff] [blame] | 115 | target.face.receive(req); |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 116 | advanceClocks(1_ms, 5); |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 117 | |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 118 | if (isForOnDemandFace) { |
| 119 | std::this_thread::sleep_for(std::chrono::milliseconds(100)); // allow wallclock time for socket IO |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 120 | advanceClocks(1_ms, 5); // let node1 accept Interest and create on-demand face |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 121 | } |
| 122 | |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 123 | BOOST_REQUIRE(hasCallbackFired); |
| 124 | } |
| 125 | |
| 126 | void |
| 127 | updateFace(const ControlParameters& requestParams, |
| 128 | bool isSelfUpdating, |
Davide Pesavento | 87fc0f8 | 2018-04-11 23:43:51 -0400 | [diff] [blame] | 129 | const std::function<void(const ControlResponse& resp)>& checkResp) |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 130 | { |
Junxiao Shi | 8a1f170 | 2017-07-03 00:05:08 +0000 | [diff] [blame] | 131 | Interest req = makeControlCommandRequest("/localhost/nfd/faces/update", requestParams); |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 132 | if (isSelfUpdating) { |
| 133 | // Attach IncomingFaceIdTag to interest |
Junxiao Shi | 8a1f170 | 2017-07-03 00:05:08 +0000 | [diff] [blame] | 134 | req.setTag(make_shared<lp::IncomingFaceIdTag>(faceId)); |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 135 | } |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 136 | |
| 137 | bool hasCallbackFired = false; |
| 138 | signal::ScopedConnection connection = this->node1.face.onSendData.connect( |
Davide Pesavento | ac238f2 | 2017-09-12 15:19:40 -0400 | [diff] [blame] | 139 | [req, &hasCallbackFired, &checkResp] (const Data& response) { |
Junxiao Shi | 8a1f170 | 2017-07-03 00:05:08 +0000 | [diff] [blame] | 140 | if (!req.getName().isPrefixOf(response.getName())) { |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 141 | return; |
| 142 | } |
| 143 | |
| 144 | ControlResponse actual(response.getContent().blockFromValue()); |
| 145 | checkResp(actual); |
| 146 | |
| 147 | hasCallbackFired = true; |
| 148 | }); |
| 149 | |
Junxiao Shi | 8a1f170 | 2017-07-03 00:05:08 +0000 | [diff] [blame] | 150 | this->node1.face.receive(req); |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 151 | advanceClocks(1_ms, 5); |
| 152 | BOOST_REQUIRE(hasCallbackFired); |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 153 | } |
| 154 | |
| 155 | private: |
| 156 | void |
| 157 | destroyFace() |
| 158 | { |
| 159 | if (faceId == 0) { |
| 160 | return; |
| 161 | } |
| 162 | |
| 163 | ControlParameters params; |
| 164 | params.setFaceId(faceId); |
Junxiao Shi | 8a1f170 | 2017-07-03 00:05:08 +0000 | [diff] [blame] | 165 | Interest req = makeControlCommandRequest("/localhost/nfd/faces/destroy", params); |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 166 | |
| 167 | bool hasCallbackFired = false; |
| 168 | signal::ScopedConnection connection = this->node1.face.onSendData.connect( |
Junxiao Shi | 8a1f170 | 2017-07-03 00:05:08 +0000 | [diff] [blame] | 169 | [this, req, &hasCallbackFired] (const Data& response) { |
| 170 | if (!req.getName().isPrefixOf(response.getName())) { |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 171 | return; |
| 172 | } |
| 173 | |
| 174 | ControlResponse destroy(response.getContent().blockFromValue()); |
| 175 | BOOST_CHECK_EQUAL(destroy.getCode(), 200); |
| 176 | |
| 177 | faceId = 0; |
| 178 | hasCallbackFired = true; |
| 179 | }); |
| 180 | |
Junxiao Shi | 8a1f170 | 2017-07-03 00:05:08 +0000 | [diff] [blame] | 181 | this->node1.face.receive(req); |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 182 | advanceClocks(1_ms, 5); |
| 183 | BOOST_REQUIRE(hasCallbackFired); |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 184 | } |
| 185 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 186 | protected: |
| 187 | FaceId faceId = 0; |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 188 | }; |
| 189 | |
| 190 | BOOST_FIXTURE_TEST_SUITE(UpdateFace, FaceManagerUpdateFixture) |
| 191 | |
| 192 | BOOST_AUTO_TEST_CASE(FaceDoesNotExist) |
| 193 | { |
| 194 | ControlParameters requestParams; |
| 195 | requestParams.setFaceId(65535); |
| 196 | |
| 197 | updateFace(requestParams, false, [] (const ControlResponse& actual) { |
| 198 | ControlResponse expected(404, "Specified face does not exist"); |
| 199 | BOOST_CHECK_EQUAL(actual.getCode(), expected.getCode()); |
| 200 | BOOST_TEST_MESSAGE(actual.getText()); |
| 201 | }); |
| 202 | } |
| 203 | |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 204 | template<bool CAN_CHANGE_PERSISTENCY> |
| 205 | class UpdatePersistencyDummyTransport : public face::Transport |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 206 | { |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 207 | public: |
| 208 | UpdatePersistencyDummyTransport() |
| 209 | { |
| 210 | this->setPersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT); |
| 211 | } |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 212 | |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 213 | protected: |
| 214 | bool |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 215 | canChangePersistencyToImpl(ndn::nfd::FacePersistency) const final |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 216 | { |
| 217 | return CAN_CHANGE_PERSISTENCY; |
| 218 | } |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 219 | |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 220 | void |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 221 | doClose() final |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 222 | { |
| 223 | } |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 224 | |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 225 | private: |
| 226 | void |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 227 | doSend(face::Transport::Packet&&) final |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 228 | { |
| 229 | } |
| 230 | }; |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 231 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 232 | using UpdatePersistencyTests = mpl::vector< |
| 233 | mpl::pair<UpdatePersistencyDummyTransport<true>, CommandSuccess>, |
| 234 | mpl::pair<UpdatePersistencyDummyTransport<false>, CommandFailure<409>> |
| 235 | >; |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 236 | |
| 237 | BOOST_FIXTURE_TEST_CASE_TEMPLATE(UpdatePersistency, T, UpdatePersistencyTests, FaceManagerUpdateFixture) |
| 238 | { |
| 239 | using TransportType = typename T::first; |
| 240 | using ResultType = typename T::second; |
| 241 | |
| 242 | auto face = make_shared<face::Face>(make_unique<face::GenericLinkService>(), |
| 243 | make_unique<TransportType>()); |
| 244 | this->node1.faceTable.add(face); |
| 245 | |
| 246 | auto parameters = ControlParameters() |
| 247 | .setFaceId(face->getId()) |
| 248 | .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERMANENT); |
| 249 | |
| 250 | updateFace(parameters, false, [] (const ControlResponse& actual) { |
| 251 | BOOST_TEST_MESSAGE(actual.getText()); |
| 252 | BOOST_CHECK_EQUAL(actual.getCode(), ResultType::getExpected().getCode()); |
| 253 | |
| 254 | // the response for either 200 or 409 will have a content body |
| 255 | BOOST_REQUIRE(actual.getBody().hasWire()); |
| 256 | |
| 257 | ControlParameters resp; |
| 258 | resp.wireDecode(actual.getBody()); |
| 259 | BOOST_CHECK_EQUAL(resp.getFacePersistency(), ndn::nfd::FACE_PERSISTENCY_PERMANENT); |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 260 | }); |
| 261 | } |
| 262 | |
| 263 | class TcpLocalFieldsEnable |
| 264 | { |
| 265 | public: |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 266 | static std::string |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 267 | getUri() |
| 268 | { |
| 269 | return "tcp4://127.0.0.1:26363"; |
| 270 | } |
| 271 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 272 | static constexpr ndn::nfd::FacePersistency |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 273 | getPersistency() |
| 274 | { |
| 275 | return ndn::nfd::FACE_PERSISTENCY_PERSISTENT; |
| 276 | } |
| 277 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 278 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 279 | getInitLocalFieldsEnabled() |
| 280 | { |
| 281 | return false; |
| 282 | } |
| 283 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 284 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 285 | getLocalFieldsEnabled() |
| 286 | { |
| 287 | return true; |
| 288 | } |
| 289 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 290 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 291 | getLocalFieldsEnabledMask() |
| 292 | { |
| 293 | return true; |
| 294 | } |
| 295 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 296 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 297 | shouldHaveWire() |
| 298 | { |
| 299 | return false; |
| 300 | } |
| 301 | }; |
| 302 | |
| 303 | class TcpLocalFieldsDisable |
| 304 | { |
| 305 | public: |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 306 | static std::string |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 307 | getUri() |
| 308 | { |
| 309 | return "tcp4://127.0.0.1:26363"; |
| 310 | } |
| 311 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 312 | static constexpr ndn::nfd::FacePersistency |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 313 | getPersistency() |
| 314 | { |
| 315 | return ndn::nfd::FACE_PERSISTENCY_PERSISTENT; |
| 316 | } |
| 317 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 318 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 319 | getInitLocalFieldsEnabled() |
| 320 | { |
| 321 | return true; |
| 322 | } |
| 323 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 324 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 325 | getLocalFieldsEnabled() |
| 326 | { |
| 327 | return false; |
| 328 | } |
| 329 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 330 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 331 | getLocalFieldsEnabledMask() |
| 332 | { |
| 333 | return true; |
| 334 | } |
| 335 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 336 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 337 | shouldHaveWire() |
| 338 | { |
| 339 | return false; |
| 340 | } |
| 341 | }; |
| 342 | |
| 343 | // UDP faces are non-local by definition |
| 344 | class UdpLocalFieldsEnable |
| 345 | { |
| 346 | public: |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 347 | static std::string |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 348 | getUri() |
| 349 | { |
| 350 | return "udp4://127.0.0.1:26363"; |
| 351 | } |
| 352 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 353 | static constexpr ndn::nfd::FacePersistency |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 354 | getPersistency() |
| 355 | { |
| 356 | return ndn::nfd::FACE_PERSISTENCY_PERSISTENT; |
| 357 | } |
| 358 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 359 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 360 | getInitLocalFieldsEnabled() |
| 361 | { |
| 362 | return false; |
| 363 | } |
| 364 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 365 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 366 | getLocalFieldsEnabled() |
| 367 | { |
| 368 | return true; |
| 369 | } |
| 370 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 371 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 372 | getLocalFieldsEnabledMask() |
| 373 | { |
| 374 | return true; |
| 375 | } |
| 376 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 377 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 378 | shouldHaveWire() |
| 379 | { |
| 380 | return true; |
| 381 | } |
| 382 | }; |
| 383 | |
| 384 | // UDP faces are non-local by definition |
| 385 | // In this test case, attempt to disable local fields on face with local fields already disabled |
| 386 | class UdpLocalFieldsDisable |
| 387 | { |
| 388 | public: |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 389 | static std::string |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 390 | getUri() |
| 391 | { |
| 392 | return "udp4://127.0.0.1:26363"; |
| 393 | } |
| 394 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 395 | static constexpr ndn::nfd::FacePersistency |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 396 | getPersistency() |
| 397 | { |
| 398 | return ndn::nfd::FACE_PERSISTENCY_PERSISTENT; |
| 399 | } |
| 400 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 401 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 402 | getInitLocalFieldsEnabled() |
| 403 | { |
| 404 | return false; |
| 405 | } |
| 406 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 407 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 408 | getLocalFieldsEnabled() |
| 409 | { |
| 410 | return false; |
| 411 | } |
| 412 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 413 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 414 | getLocalFieldsEnabledMask() |
| 415 | { |
| 416 | return true; |
| 417 | } |
| 418 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 419 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 420 | shouldHaveWire() |
| 421 | { |
| 422 | return false; |
| 423 | } |
| 424 | }; |
| 425 | |
| 426 | // In this test case, set Flags to enable local fields on non-local face, but exclude local fields |
| 427 | // from Mask. This test case will pass as no action is taken due to the missing Mask bit. |
| 428 | class UdpLocalFieldsEnableNoMaskBit |
| 429 | { |
| 430 | public: |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 431 | static std::string |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 432 | getUri() |
| 433 | { |
| 434 | return "udp4://127.0.0.1:26363"; |
| 435 | } |
| 436 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 437 | static constexpr ndn::nfd::FacePersistency |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 438 | getPersistency() |
| 439 | { |
| 440 | return ndn::nfd::FACE_PERSISTENCY_PERSISTENT; |
| 441 | } |
| 442 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 443 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 444 | getInitLocalFieldsEnabled() |
| 445 | { |
| 446 | return false; |
| 447 | } |
| 448 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 449 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 450 | getLocalFieldsEnabled() |
| 451 | { |
| 452 | return true; |
| 453 | } |
| 454 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 455 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 456 | getLocalFieldsEnabledMask() |
| 457 | { |
| 458 | return false; |
| 459 | } |
| 460 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 461 | static constexpr bool |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 462 | shouldHaveWire() |
| 463 | { |
| 464 | return false; |
| 465 | } |
| 466 | }; |
| 467 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 468 | using LocalFieldFaces = mpl::vector< |
| 469 | mpl::pair<TcpLocalFieldsEnable, CommandSuccess>, |
| 470 | mpl::pair<TcpLocalFieldsDisable, CommandSuccess>, |
| 471 | mpl::pair<UdpLocalFieldsEnable, CommandFailure<409>>, |
| 472 | mpl::pair<UdpLocalFieldsDisable, CommandSuccess>, |
| 473 | mpl::pair<UdpLocalFieldsEnableNoMaskBit, CommandSuccess> |
| 474 | >; |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 475 | |
| 476 | BOOST_AUTO_TEST_CASE_TEMPLATE(UpdateLocalFields, T, LocalFieldFaces) |
| 477 | { |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 478 | using TestType = typename T::first; |
| 479 | using ResultType = typename T::second; |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 480 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 481 | createFace(TestType::getUri(), TestType::getPersistency(), {}, {}, |
| 482 | TestType::getInitLocalFieldsEnabled()); |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 483 | |
| 484 | ControlParameters requestParams; |
| 485 | requestParams.setFaceId(faceId); |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 486 | requestParams.setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, TestType::getLocalFieldsEnabled()); |
| 487 | if (!TestType::getLocalFieldsEnabledMask()) { |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 488 | requestParams.unsetFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED); |
| 489 | } |
| 490 | |
| 491 | updateFace(requestParams, false, [] (const ControlResponse& actual) { |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 492 | ControlResponse expected(ResultType::getExpected()); |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 493 | BOOST_TEST_MESSAGE(actual.getText()); |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 494 | BOOST_CHECK_EQUAL(actual.getCode(), expected.getCode()); |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 495 | |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 496 | if (TestType::shouldHaveWire() && actual.getBody().hasWire()) { |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 497 | ControlParameters actualParams(actual.getBody()); |
| 498 | |
| 499 | BOOST_CHECK(!actualParams.hasFacePersistency()); |
| 500 | BOOST_CHECK(actualParams.hasFlags()); |
| 501 | BOOST_CHECK(actualParams.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED)); |
| 502 | BOOST_CHECK(actualParams.hasFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED)); |
| 503 | } |
| 504 | }); |
| 505 | } |
| 506 | |
| 507 | BOOST_AUTO_TEST_CASE(UpdateLocalFieldsEnableDisable) |
| 508 | { |
| 509 | createFace(); |
| 510 | |
| 511 | ControlParameters enableParams; |
| 512 | enableParams.setFaceId(faceId); |
| 513 | enableParams.setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, true); |
| 514 | |
| 515 | ControlParameters disableParams; |
| 516 | disableParams.setFaceId(faceId); |
| 517 | disableParams.setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, false); |
| 518 | |
| 519 | updateFace(enableParams, false, [] (const ControlResponse& actual) { |
| 520 | ControlResponse expected(200, "OK"); |
| 521 | BOOST_CHECK_EQUAL(actual.getCode(), expected.getCode()); |
| 522 | BOOST_TEST_MESSAGE(actual.getText()); |
| 523 | |
| 524 | if (actual.getBody().hasWire()) { |
| 525 | ControlParameters actualParams(actual.getBody()); |
| 526 | |
| 527 | BOOST_CHECK(actualParams.hasFaceId()); |
| 528 | BOOST_CHECK(actualParams.hasFacePersistency()); |
| 529 | BOOST_REQUIRE(actualParams.hasFlags()); |
| 530 | // Check if flags indicate local fields enabled |
| 531 | BOOST_CHECK(actualParams.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED)); |
| 532 | } |
| 533 | else { |
| 534 | BOOST_ERROR("Enable: Response does not contain ControlParameters"); |
| 535 | } |
| 536 | }); |
| 537 | |
| 538 | updateFace(disableParams, false, [] (const ControlResponse& actual) { |
| 539 | ControlResponse expected(200, "OK"); |
| 540 | BOOST_CHECK_EQUAL(actual.getCode(), expected.getCode()); |
| 541 | BOOST_TEST_MESSAGE(actual.getText()); |
| 542 | |
| 543 | if (actual.getBody().hasWire()) { |
| 544 | ControlParameters actualParams(actual.getBody()); |
| 545 | |
| 546 | BOOST_CHECK(actualParams.hasFaceId()); |
| 547 | BOOST_CHECK(actualParams.hasFacePersistency()); |
| 548 | BOOST_REQUIRE(actualParams.hasFlags()); |
| 549 | // Check if flags indicate local fields disabled |
| 550 | BOOST_CHECK(!actualParams.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED)); |
| 551 | } |
| 552 | else { |
| 553 | BOOST_ERROR("Disable: Response does not contain ControlParameters"); |
| 554 | } |
| 555 | }); |
| 556 | } |
| 557 | |
Eric Newberry | 2642cd2 | 2017-07-13 21:34:53 -0400 | [diff] [blame] | 558 | BOOST_AUTO_TEST_CASE(UpdateReliabilityEnableDisable) |
| 559 | { |
| 560 | createFace("udp4://127.0.0.1:26363"); |
| 561 | |
| 562 | ControlParameters enableParams; |
| 563 | enableParams.setFaceId(faceId); |
| 564 | enableParams.setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, true); |
| 565 | |
| 566 | ControlParameters disableParams; |
| 567 | disableParams.setFaceId(faceId); |
| 568 | disableParams.setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, false); |
| 569 | |
| 570 | updateFace(enableParams, false, [] (const ControlResponse& actual) { |
| 571 | ControlResponse expected(200, "OK"); |
| 572 | BOOST_CHECK_EQUAL(actual.getCode(), expected.getCode()); |
| 573 | BOOST_TEST_MESSAGE(actual.getText()); |
| 574 | |
| 575 | if (actual.getBody().hasWire()) { |
| 576 | ControlParameters actualParams(actual.getBody()); |
| 577 | |
| 578 | BOOST_CHECK(actualParams.hasFaceId()); |
| 579 | BOOST_CHECK(actualParams.hasFacePersistency()); |
| 580 | BOOST_REQUIRE(actualParams.hasFlags()); |
| 581 | // Check if flags indicate reliability enabled |
| 582 | BOOST_CHECK(actualParams.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED)); |
| 583 | } |
| 584 | else { |
| 585 | BOOST_ERROR("Enable: Response does not contain ControlParameters"); |
| 586 | } |
| 587 | }); |
| 588 | |
| 589 | updateFace(disableParams, false, [] (const ControlResponse& actual) { |
| 590 | ControlResponse expected(200, "OK"); |
| 591 | BOOST_CHECK_EQUAL(actual.getCode(), expected.getCode()); |
| 592 | BOOST_TEST_MESSAGE(actual.getText()); |
| 593 | |
| 594 | if (actual.getBody().hasWire()) { |
| 595 | ControlParameters actualParams(actual.getBody()); |
| 596 | |
| 597 | BOOST_CHECK(actualParams.hasFaceId()); |
| 598 | BOOST_CHECK(actualParams.hasFacePersistency()); |
| 599 | BOOST_REQUIRE(actualParams.hasFlags()); |
| 600 | // Check if flags indicate reliability disabled |
| 601 | BOOST_CHECK(!actualParams.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED)); |
| 602 | } |
| 603 | else { |
| 604 | BOOST_ERROR("Disable: Response does not contain ControlParameters"); |
| 605 | } |
| 606 | }); |
| 607 | } |
| 608 | |
Eric Newberry | 0c3e57b | 2018-01-25 20:54:46 -0700 | [diff] [blame] | 609 | BOOST_AUTO_TEST_CASE(UpdateCongestionMarkingEnableDisable) |
| 610 | { |
| 611 | createFace("udp4://127.0.0.1:26363"); |
| 612 | |
| 613 | ControlParameters enableParams; |
| 614 | enableParams.setFaceId(faceId); |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 615 | enableParams.setBaseCongestionMarkingInterval(50_ms); |
Eric Newberry | 0c3e57b | 2018-01-25 20:54:46 -0700 | [diff] [blame] | 616 | enableParams.setDefaultCongestionThreshold(10000); |
| 617 | enableParams.setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, true); |
| 618 | |
| 619 | ControlParameters disableParams; |
| 620 | disableParams.setFaceId(faceId); |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 621 | disableParams.setBaseCongestionMarkingInterval(70_ms); |
Eric Newberry | 0c3e57b | 2018-01-25 20:54:46 -0700 | [diff] [blame] | 622 | disableParams.setDefaultCongestionThreshold(5000); |
| 623 | disableParams.setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, false); |
| 624 | |
| 625 | updateFace(enableParams, false, [] (const ControlResponse& actual) { |
| 626 | ControlResponse expected(200, "OK"); |
| 627 | BOOST_CHECK_EQUAL(actual.getCode(), expected.getCode()); |
| 628 | BOOST_TEST_MESSAGE(actual.getText()); |
| 629 | |
| 630 | if (actual.getBody().hasWire()) { |
| 631 | ControlParameters actualParams(actual.getBody()); |
| 632 | |
| 633 | BOOST_CHECK(actualParams.hasFaceId()); |
| 634 | BOOST_CHECK(actualParams.hasFacePersistency()); |
| 635 | // Check that congestion marking parameters changed |
| 636 | BOOST_REQUIRE(actualParams.hasBaseCongestionMarkingInterval()); |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 637 | BOOST_CHECK_EQUAL(actualParams.getBaseCongestionMarkingInterval(), 50_ms); |
Eric Newberry | 0c3e57b | 2018-01-25 20:54:46 -0700 | [diff] [blame] | 638 | BOOST_REQUIRE(actualParams.hasDefaultCongestionThreshold()); |
| 639 | BOOST_CHECK_EQUAL(actualParams.getDefaultCongestionThreshold(), 10000); |
| 640 | BOOST_REQUIRE(actualParams.hasFlags()); |
| 641 | // Check if flags indicate congestion marking enabled |
| 642 | BOOST_CHECK(actualParams.getFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED)); |
| 643 | } |
| 644 | else { |
| 645 | BOOST_ERROR("Enable: Response does not contain ControlParameters"); |
| 646 | } |
| 647 | }); |
| 648 | |
| 649 | updateFace(disableParams, false, [] (const ControlResponse& actual) { |
| 650 | ControlResponse expected(200, "OK"); |
| 651 | BOOST_CHECK_EQUAL(actual.getCode(), expected.getCode()); |
| 652 | BOOST_TEST_MESSAGE(actual.getText()); |
| 653 | |
| 654 | if (actual.getBody().hasWire()) { |
| 655 | ControlParameters actualParams(actual.getBody()); |
| 656 | |
| 657 | BOOST_CHECK(actualParams.hasFaceId()); |
| 658 | BOOST_CHECK(actualParams.hasFacePersistency()); |
| 659 | // Check that congestion marking parameters changed, even though feature disabled |
| 660 | BOOST_REQUIRE(actualParams.hasBaseCongestionMarkingInterval()); |
Davide Pesavento | 3cf75dc | 2018-03-17 00:38:03 -0400 | [diff] [blame] | 661 | BOOST_CHECK_EQUAL(actualParams.getBaseCongestionMarkingInterval(), 70_ms); |
Eric Newberry | 0c3e57b | 2018-01-25 20:54:46 -0700 | [diff] [blame] | 662 | BOOST_REQUIRE(actualParams.hasDefaultCongestionThreshold()); |
| 663 | BOOST_CHECK_EQUAL(actualParams.getDefaultCongestionThreshold(), 5000); |
| 664 | BOOST_REQUIRE(actualParams.hasFlags()); |
| 665 | // Check if flags indicate marking disabled |
| 666 | BOOST_CHECK(!actualParams.getFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED)); |
| 667 | } |
| 668 | else { |
| 669 | BOOST_ERROR("Disable: Response does not contain ControlParameters"); |
| 670 | } |
| 671 | }); |
| 672 | } |
| 673 | |
Eric Newberry | b5aa7f5 | 2016-09-03 20:36:12 -0700 | [diff] [blame] | 674 | BOOST_AUTO_TEST_CASE(SelfUpdating) |
| 675 | { |
| 676 | createFace(); |
| 677 | |
| 678 | // Send a command that does nothing (will return 200) and does not contain a FaceId |
| 679 | ControlParameters sentParams; |
| 680 | |
| 681 | updateFace(sentParams, true, [] (const ControlResponse& actual) { |
| 682 | ControlResponse expected(200, "OK"); |
| 683 | BOOST_REQUIRE_EQUAL(actual.getCode(), expected.getCode()); |
| 684 | BOOST_TEST_MESSAGE(actual.getText()); |
| 685 | }); |
| 686 | } |
| 687 | |
| 688 | BOOST_AUTO_TEST_SUITE_END() // UpdateFace |
| 689 | BOOST_AUTO_TEST_SUITE_END() // TestFaceManager |
| 690 | BOOST_AUTO_TEST_SUITE_END() // Mgmt |
| 691 | |
| 692 | } // namespace tests |
| 693 | } // namespace nfd |