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