blob: 7c0fe6f1c57eb7d9892a79fb0fb4efd34834b34e [file] [log] [blame]
Yanbiao Li73860e32015-08-19 16:30:16 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Junxiao Shi60286192017-07-26 01:07:48 +00002/*
Davide Pesavento78ddcab2019-02-28 22:00:03 -05003 * Copyright (c) 2014-2019, Regents of the University of California,
Yanbiao Li73860e32015-08-19 16:30:16 -07004 * 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
Eric Newberry812d6152018-06-06 15:06:01 -070026#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
27#define BOOST_MPL_LIMIT_VECTOR_SIZE 40
28
Yanbiao Li58ba3f92017-02-15 14:27:18 +000029#include "mgmt/face-manager.hpp"
Eric Newberry0c3e57b2018-01-25 20:54:46 -070030#include "face/generic-link-service.hpp"
Eric Newberry42602412016-08-27 09:33:18 -070031#include "face-manager-command-fixture.hpp"
Junxiao Shib84e6742016-07-19 13:16:22 +000032
Yanbiao Li73860e32015-08-19 16:30:16 -070033namespace nfd {
34namespace tests {
35
Yanbiao Li73860e32015-08-19 16:30:16 -070036BOOST_AUTO_TEST_SUITE(Mgmt)
37BOOST_AUTO_TEST_SUITE(TestFaceManager)
38
Davide Pesaventocf7db2f2019-03-24 23:17:28 -040039BOOST_FIXTURE_TEST_SUITE(CreateFace, GlobalIoFixture)
Yanbiao Li73860e32015-08-19 16:30:16 -070040
Yanbiao Li73860e32015-08-19 16:30:16 -070041class TcpFaceOnDemand
42{
43public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -040044 static ControlParameters
Yanbiao Li73860e32015-08-19 16:30:16 -070045 getParameters()
46 {
47 return ControlParameters()
48 .setUri("tcp4://127.0.0.1:26363")
49 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
50 }
51};
52
53class TcpFacePersistent
54{
55public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -040056 static ControlParameters
Yanbiao Li73860e32015-08-19 16:30:16 -070057 getParameters()
58 {
59 return ControlParameters()
60 .setUri("tcp4://127.0.0.1:26363")
61 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
62 }
63};
64
65class TcpFacePermanent
66{
67public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -040068 static ControlParameters
Yanbiao Li73860e32015-08-19 16:30:16 -070069 getParameters()
70 {
71 return ControlParameters()
72 .setUri("tcp4://127.0.0.1:26363")
73 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERMANENT);
74 }
75};
76
77class UdpFaceOnDemand
78{
79public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -040080 static ControlParameters
Yanbiao Li73860e32015-08-19 16:30:16 -070081 getParameters()
82 {
83 return ControlParameters()
84 .setUri("udp4://127.0.0.1:26363")
85 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
86 }
87};
88
Yanbiao Li73860e32015-08-19 16:30:16 -070089class UdpFacePersistent
90{
91public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -040092 static ControlParameters
Yanbiao Li73860e32015-08-19 16:30:16 -070093 getParameters()
94 {
95 return ControlParameters()
96 .setUri("udp4://127.0.0.1:26363")
97 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
98 }
99};
100
101class UdpFacePermanent
102{
103public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400104 static ControlParameters
Yanbiao Li73860e32015-08-19 16:30:16 -0700105 getParameters()
106 {
107 return ControlParameters()
108 .setUri("udp4://127.0.0.1:26363")
109 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERMANENT);
110 }
111};
112
Eric Newberryf40551a2016-09-05 15:41:16 -0700113class LocalTcpFaceLocalFieldsEnabled
114{
115public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400116 static ControlParameters
Eric Newberryf40551a2016-09-05 15:41:16 -0700117 getParameters()
118 {
119 return ControlParameters()
120 .setUri("tcp4://127.0.0.1:26363")
121 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
122 .setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, true);
123 }
124};
125
126class LocalTcpFaceLocalFieldsDisabled
127{
128public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400129 static ControlParameters
Eric Newberryf40551a2016-09-05 15:41:16 -0700130 getParameters()
131 {
132 return ControlParameters()
133 .setUri("tcp4://127.0.0.1:26363")
134 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
135 .setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, false);
136 }
137};
138
139class NonLocalUdpFaceLocalFieldsEnabled // won't work because non-local scope
140{
141public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400142 static ControlParameters
Eric Newberryf40551a2016-09-05 15:41:16 -0700143 getParameters()
144 {
145 return ControlParameters()
146 .setUri("udp4://127.0.0.1:26363")
147 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
148 .setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, true);
149 }
150};
151
152class NonLocalUdpFaceLocalFieldsDisabled
153{
154public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400155 static ControlParameters
Eric Newberryf40551a2016-09-05 15:41:16 -0700156 getParameters()
157 {
158 return ControlParameters()
159 .setUri("udp4://127.0.0.1:26363")
160 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
161 .setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, false);
162 }
163};
164
Eric Newberry2642cd22017-07-13 21:34:53 -0400165class TcpFaceLpReliabilityEnabled
166{
167public:
168 static ControlParameters
169 getParameters()
170 {
171 return ControlParameters()
172 .setUri("tcp4://127.0.0.1:26363")
173 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
174 .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, true);
175 }
176};
177
178class TcpFaceLpReliabilityDisabled
179{
180public:
181 static ControlParameters
182 getParameters()
183 {
184 return ControlParameters()
185 .setUri("tcp4://127.0.0.1:26363")
186 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
187 .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, false);
188 }
189};
190
191class UdpFaceLpReliabilityEnabled
192{
193public:
194 static ControlParameters
195 getParameters()
196 {
197 return ControlParameters()
Eric Newberry0c3e57b2018-01-25 20:54:46 -0700198 .setUri("udp4://127.0.0.1:26363")
Eric Newberry2642cd22017-07-13 21:34:53 -0400199 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
200 .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, true);
201 }
202};
203
204class UdpFaceLpReliabilityDisabled
205{
206public:
207 static ControlParameters
208 getParameters()
209 {
210 return ControlParameters()
Eric Newberry0c3e57b2018-01-25 20:54:46 -0700211 .setUri("udp4://127.0.0.1:26363")
Eric Newberry2642cd22017-07-13 21:34:53 -0400212 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
213 .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, false);
214 }
215};
216
Eric Newberry0c3e57b2018-01-25 20:54:46 -0700217class TcpFaceCongestionMarkingEnabled
218{
219public:
220 static ControlParameters
221 getParameters()
222 {
223 return ControlParameters()
224 .setUri("tcp4://127.0.0.1:26363")
225 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
226 .setBaseCongestionMarkingInterval(50_ms)
227 .setDefaultCongestionThreshold(1000)
228 .setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, true);
229 }
230};
231
232class TcpFaceCongestionMarkingDisabled
233{
234public:
235 static ControlParameters
236 getParameters()
237 {
238 return ControlParameters()
239 .setUri("tcp4://127.0.0.1:26363")
240 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
241 .setBaseCongestionMarkingInterval(50_ms)
242 .setDefaultCongestionThreshold(1000)
243 .setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, false);
244 }
245};
246
Eric Newberry812d6152018-06-06 15:06:01 -0700247class TcpFaceMtuOverride
248{
249public:
250 static ControlParameters
251 getParameters()
252 {
253 return ControlParameters()
254 .setUri("tcp4://127.0.0.1:26363")
255 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
256 .setMtu(1000);
257 }
258};
259
260class UdpFaceMtuOverride
261{
262public:
263 static ControlParameters
264 getParameters()
265 {
266 return ControlParameters()
267 .setUri("udp4://127.0.0.1:26363")
268 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
269 .setMtu(1000);
270 }
271};
272
Junxiao Shi38c7d9e2017-04-13 14:22:50 +0000273class FaceUriMalformed
274{
275public:
276 static ControlParameters
277 getParameters()
278 {
279 return ControlParameters()
280 .setUri("tcp4://127.0.0.1:not-a-port");
281 }
282};
283
284class FaceUriNonCanonical
285{
286public:
287 static ControlParameters
288 getParameters()
289 {
290 return ControlParameters()
291 .setUri("udp://localhost");
292 }
293};
294
295class FaceUriUnsupportedScheme
296{
297public:
298 static ControlParameters
299 getParameters()
300 {
301 return ControlParameters()
302 .setUri("dev://eth0");
303 }
304};
305
Yanbiao Li73860e32015-08-19 16:30:16 -0700306namespace mpl = boost::mpl;
307
Eric Newberry42602412016-08-27 09:33:18 -0700308// pairs of CreateCommand and Success/Failure status
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400309using TestCases = mpl::vector<
310 mpl::pair<TcpFaceOnDemand, CommandFailure<406>>,
Eric Newberryb5aa7f52016-09-03 20:36:12 -0700311 mpl::pair<TcpFacePersistent, CommandSuccess>,
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400312 mpl::pair<TcpFacePermanent, CommandSuccess>,
Eric Newberryb5aa7f52016-09-03 20:36:12 -0700313 mpl::pair<UdpFaceOnDemand, CommandFailure<406>>,
314 mpl::pair<UdpFacePersistent, CommandSuccess>,
315 mpl::pair<UdpFacePermanent, CommandSuccess>,
Eric Newberryf40551a2016-09-05 15:41:16 -0700316 mpl::pair<LocalTcpFaceLocalFieldsEnabled, CommandSuccess>,
317 mpl::pair<LocalTcpFaceLocalFieldsDisabled, CommandSuccess>,
318 mpl::pair<NonLocalUdpFaceLocalFieldsEnabled, CommandFailure<406>>,
Junxiao Shi38c7d9e2017-04-13 14:22:50 +0000319 mpl::pair<NonLocalUdpFaceLocalFieldsDisabled, CommandSuccess>,
Eric Newberry2642cd22017-07-13 21:34:53 -0400320 mpl::pair<TcpFaceLpReliabilityEnabled, CommandSuccess>,
321 mpl::pair<TcpFaceLpReliabilityDisabled, CommandSuccess>,
322 mpl::pair<UdpFaceLpReliabilityEnabled, CommandSuccess>,
323 mpl::pair<UdpFaceLpReliabilityDisabled, CommandSuccess>,
Eric Newberry0c3e57b2018-01-25 20:54:46 -0700324 mpl::pair<TcpFaceCongestionMarkingEnabled, CommandSuccess>,
325 mpl::pair<TcpFaceCongestionMarkingDisabled, CommandSuccess>,
Eric Newberry812d6152018-06-06 15:06:01 -0700326 mpl::pair<TcpFaceMtuOverride, CommandFailure<406>>,
327 mpl::pair<UdpFaceMtuOverride, CommandSuccess>,
Junxiao Shi38c7d9e2017-04-13 14:22:50 +0000328 mpl::pair<FaceUriMalformed, CommandFailure<400>>,
329 mpl::pair<FaceUriNonCanonical, CommandFailure<400>>,
330 mpl::pair<FaceUriUnsupportedScheme, CommandFailure<406>>>;
Yanbiao Li73860e32015-08-19 16:30:16 -0700331
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400332BOOST_FIXTURE_TEST_CASE_TEMPLATE(NewFace, T, TestCases, FaceManagerCommandFixture)
Yanbiao Li73860e32015-08-19 16:30:16 -0700333{
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400334 using FaceType = typename T::first;
335 using CreateResult = typename T::second;
Yanbiao Li73860e32015-08-19 16:30:16 -0700336
Junxiao Shi8a1f1702017-07-03 00:05:08 +0000337 Interest req = makeControlCommandRequest("/localhost/nfd/faces/create", FaceType::getParameters());
Yanbiao Li73860e32015-08-19 16:30:16 -0700338
339 bool hasCallbackFired = false;
Junxiao Shi8a1f1702017-07-03 00:05:08 +0000340 this->node1.face.onSendData.connect([this, req, &hasCallbackFired] (const Data& response) {
341 if (!req.getName().isPrefixOf(response.getName())) {
Eric Newberry42602412016-08-27 09:33:18 -0700342 return;
343 }
Yanbiao Li73860e32015-08-19 16:30:16 -0700344
Eric Newberry42602412016-08-27 09:33:18 -0700345 ControlResponse actual(response.getContent().blockFromValue());
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400346 ControlResponse expected(CreateResult::getExpected());
Eric Newberry42602412016-08-27 09:33:18 -0700347 BOOST_TEST_MESSAGE(actual.getText());
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000348 BOOST_CHECK_EQUAL(expected.getCode(), actual.getCode());
Yanbiao Li73860e32015-08-19 16:30:16 -0700349
Eric Newberry42602412016-08-27 09:33:18 -0700350 if (actual.getBody().hasWire()) {
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400351 ControlParameters expectedParams(FaceType::getParameters());
Eric Newberry42602412016-08-27 09:33:18 -0700352 ControlParameters actualParams(actual.getBody());
Yanbiao Li73860e32015-08-19 16:30:16 -0700353
Eric Newberry42602412016-08-27 09:33:18 -0700354 BOOST_CHECK(actualParams.hasFaceId());
355 BOOST_CHECK_EQUAL(expectedParams.getFacePersistency(), actualParams.getFacePersistency());
356
Eric Newberryb5aa7f52016-09-03 20:36:12 -0700357 if (actual.getCode() == 200) {
358 if (expectedParams.hasFlags()) {
Eric Newberryf40551a2016-09-05 15:41:16 -0700359 BOOST_CHECK_EQUAL(expectedParams.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED),
360 actualParams.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED));
Eric Newberry2642cd22017-07-13 21:34:53 -0400361 BOOST_CHECK_EQUAL(expectedParams.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED),
362 actualParams.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED));
Eric Newberry17d18492018-02-10 22:50:06 -0700363 if (expectedParams.hasFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED)) {
364 BOOST_CHECK_EQUAL(expectedParams.getFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED),
365 actualParams.getFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED));
366 }
367 else {
368 BOOST_CHECK(actualParams.getFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED));
369 }
Eric Newberryb5aa7f52016-09-03 20:36:12 -0700370 }
371 else {
Eric Newberry17d18492018-02-10 22:50:06 -0700372 // local fields and LpReliability are disabled by default, congestion marking is enabled
373 // by default on TCP, UDP, and Unix stream
374 BOOST_CHECK(!actualParams.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED));
375 BOOST_CHECK(!actualParams.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED));
376 BOOST_CHECK(actualParams.getFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED));
Eric Newberry0c3e57b2018-01-25 20:54:46 -0700377 }
378
379 if (expectedParams.hasBaseCongestionMarkingInterval()) {
380 BOOST_CHECK_EQUAL(expectedParams.getBaseCongestionMarkingInterval(),
381 actualParams.getBaseCongestionMarkingInterval());
382 }
383 else {
384 BOOST_CHECK_EQUAL(actualParams.getBaseCongestionMarkingInterval(), 100_ms);
385 }
386
387 if (expectedParams.hasDefaultCongestionThreshold()) {
388 BOOST_CHECK_EQUAL(expectedParams.getDefaultCongestionThreshold(),
389 actualParams.getDefaultCongestionThreshold());
390 }
391 else {
392 BOOST_CHECK_EQUAL(actualParams.getDefaultCongestionThreshold(), 65536);
Eric Newberryb5aa7f52016-09-03 20:36:12 -0700393 }
Eric Newberry812d6152018-06-06 15:06:01 -0700394
395 if (expectedParams.hasMtu()) {
396 BOOST_CHECK_EQUAL(expectedParams.getMtu(), actualParams.getMtu());
397 }
Eric Newberryb5aa7f52016-09-03 20:36:12 -0700398 }
399 else {
Yanbiao Li73860e32015-08-19 16:30:16 -0700400 BOOST_CHECK_EQUAL(expectedParams.getUri(), actualParams.getUri());
Yanbiao Li73860e32015-08-19 16:30:16 -0700401 }
Eric Newberry42602412016-08-27 09:33:18 -0700402 }
Eric Newberryb5aa7f52016-09-03 20:36:12 -0700403
404 if (actual.getCode() != 200) {
Junxiao Shi38c7d9e2017-04-13 14:22:50 +0000405 FaceUri uri;
406 if (uri.parse(FaceType::getParameters().getUri())) {
407 // ensure face not created
Davide Pesaventob5eee202017-09-21 23:59:22 -0400408 const auto& faceTable = this->node1.faceTable;
Junxiao Shi38c7d9e2017-04-13 14:22:50 +0000409 BOOST_CHECK(std::none_of(faceTable.begin(), faceTable.end(), [uri] (Face& face) {
410 return face.getRemoteUri() == uri;
411 }));
412 }
413 else {
414 // do not check malformed FaceUri
415 }
Eric Newberryb5aa7f52016-09-03 20:36:12 -0700416 }
417
Eric Newberry42602412016-08-27 09:33:18 -0700418 hasCallbackFired = true;
419 });
Yanbiao Li73860e32015-08-19 16:30:16 -0700420
Junxiao Shi8a1f1702017-07-03 00:05:08 +0000421 this->node1.face.receive(req);
Eric Newberry0c3e57b2018-01-25 20:54:46 -0700422 this->advanceClocks(1_ms, 5);
Yanbiao Li73860e32015-08-19 16:30:16 -0700423
424 BOOST_CHECK(hasCallbackFired);
425}
426
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000427BOOST_FIXTURE_TEST_CASE(ExistingFace, FaceManagerCommandFixture)
Yanbiao Li73860e32015-08-19 16:30:16 -0700428{
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000429 using FaceType = UdpFacePersistent;
Yanbiao Li73860e32015-08-19 16:30:16 -0700430
431 {
432 // create face
Junxiao Shi8a1f1702017-07-03 00:05:08 +0000433 Interest req = makeControlCommandRequest("/localhost/nfd/faces/create", FaceType::getParameters());
434 this->node1.face.receive(req);
Eric Newberry0c3e57b2018-01-25 20:54:46 -0700435 this->advanceClocks(1_ms, 5);
Yanbiao Li73860e32015-08-19 16:30:16 -0700436 }
437
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000438 // find the created face
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400439 auto foundFace = this->node1.findFaceByUri(FaceType::getParameters().getUri());
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000440 BOOST_REQUIRE(foundFace != nullptr);
Yanbiao Li73860e32015-08-19 16:30:16 -0700441
442 {
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000443 // re-create face
Junxiao Shi8a1f1702017-07-03 00:05:08 +0000444 Interest req = makeControlCommandRequest("/localhost/nfd/faces/create", FaceType::getParameters());
Yanbiao Li73860e32015-08-19 16:30:16 -0700445
446 bool hasCallbackFired = false;
Junxiao Shib84e6742016-07-19 13:16:22 +0000447 this->node1.face.onSendData.connect(
Davide Pesaventoac238f22017-09-12 15:19:40 -0400448 [req, foundFace, &hasCallbackFired] (const Data& response) {
Junxiao Shi8a1f1702017-07-03 00:05:08 +0000449 if (!req.getName().isPrefixOf(response.getName())) {
Yanbiao Li73860e32015-08-19 16:30:16 -0700450 return;
451 }
452
453 ControlResponse actual(response.getContent().blockFromValue());
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000454 BOOST_REQUIRE_EQUAL(actual.getCode(), 409);
Yanbiao Li73860e32015-08-19 16:30:16 -0700455
Yanbiao Li73860e32015-08-19 16:30:16 -0700456 ControlParameters actualParams(actual.getBody());
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000457 BOOST_CHECK_EQUAL(foundFace->getId(), actualParams.getFaceId());
458 BOOST_CHECK_EQUAL(foundFace->getRemoteUri().toString(), actualParams.getUri());
459 BOOST_CHECK_EQUAL(foundFace->getPersistency(), actualParams.getFacePersistency());
Eric Newberry0c3e57b2018-01-25 20:54:46 -0700460 auto linkService = dynamic_cast<face::GenericLinkService*>(foundFace->getLinkService());
461 BOOST_CHECK_EQUAL(linkService->getOptions().baseCongestionMarkingInterval,
462 actualParams.getBaseCongestionMarkingInterval());
463 BOOST_CHECK_EQUAL(linkService->getOptions().defaultCongestionThreshold,
464 actualParams.getDefaultCongestionThreshold());
Yanbiao Li73860e32015-08-19 16:30:16 -0700465
466 hasCallbackFired = true;
467 });
468
Junxiao Shi8a1f1702017-07-03 00:05:08 +0000469 this->node1.face.receive(req);
Eric Newberry0c3e57b2018-01-25 20:54:46 -0700470 this->advanceClocks(1_ms, 5);
Yanbiao Li73860e32015-08-19 16:30:16 -0700471
472 BOOST_CHECK(hasCallbackFired);
473 }
474}
475
476BOOST_AUTO_TEST_SUITE_END() // CreateFace
477BOOST_AUTO_TEST_SUITE_END() // TestFaceManager
478BOOST_AUTO_TEST_SUITE_END() // Mgmt
479
Weiwei Liuf5aee942016-03-19 07:00:42 +0000480} // namespace tests
481} // namespace nfd