blob: 41c68c21c3afe59ad3544e45308c5653c572797e [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/*
Eric Newberry0c3e57b2018-01-25 20:54:46 -07003 * Copyright (c) 2014-2018, 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"
32#include "nfd-manager-common-fixture.hpp"
Junxiao Shib84e6742016-07-19 13:16:22 +000033
Yanbiao Li73860e32015-08-19 16:30:16 -070034namespace nfd {
35namespace tests {
36
Yanbiao Li73860e32015-08-19 16:30:16 -070037BOOST_AUTO_TEST_SUITE(Mgmt)
38BOOST_AUTO_TEST_SUITE(TestFaceManager)
39
40BOOST_FIXTURE_TEST_SUITE(CreateFace, BaseFixture)
41
Yanbiao Li73860e32015-08-19 16:30:16 -070042class TcpFaceOnDemand
43{
44public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -040045 static ControlParameters
Yanbiao Li73860e32015-08-19 16:30:16 -070046 getParameters()
47 {
48 return ControlParameters()
49 .setUri("tcp4://127.0.0.1:26363")
50 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
51 }
52};
53
54class TcpFacePersistent
55{
56public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -040057 static ControlParameters
Yanbiao Li73860e32015-08-19 16:30:16 -070058 getParameters()
59 {
60 return ControlParameters()
61 .setUri("tcp4://127.0.0.1:26363")
62 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
63 }
64};
65
66class TcpFacePermanent
67{
68public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -040069 static ControlParameters
Yanbiao Li73860e32015-08-19 16:30:16 -070070 getParameters()
71 {
72 return ControlParameters()
73 .setUri("tcp4://127.0.0.1:26363")
74 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERMANENT);
75 }
76};
77
78class UdpFaceOnDemand
79{
80public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -040081 static ControlParameters
Yanbiao Li73860e32015-08-19 16:30:16 -070082 getParameters()
83 {
84 return ControlParameters()
85 .setUri("udp4://127.0.0.1:26363")
86 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
87 }
88};
89
Yanbiao Li73860e32015-08-19 16:30:16 -070090class UdpFacePersistent
91{
92public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -040093 static ControlParameters
Yanbiao Li73860e32015-08-19 16:30:16 -070094 getParameters()
95 {
96 return ControlParameters()
97 .setUri("udp4://127.0.0.1:26363")
98 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
99 }
100};
101
102class UdpFacePermanent
103{
104public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400105 static ControlParameters
Yanbiao Li73860e32015-08-19 16:30:16 -0700106 getParameters()
107 {
108 return ControlParameters()
109 .setUri("udp4://127.0.0.1:26363")
110 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERMANENT);
111 }
112};
113
Eric Newberryf40551a2016-09-05 15:41:16 -0700114class LocalTcpFaceLocalFieldsEnabled
115{
116public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400117 static ControlParameters
Eric Newberryf40551a2016-09-05 15:41:16 -0700118 getParameters()
119 {
120 return ControlParameters()
121 .setUri("tcp4://127.0.0.1:26363")
122 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
123 .setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, true);
124 }
125};
126
127class LocalTcpFaceLocalFieldsDisabled
128{
129public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400130 static ControlParameters
Eric Newberryf40551a2016-09-05 15:41:16 -0700131 getParameters()
132 {
133 return ControlParameters()
134 .setUri("tcp4://127.0.0.1:26363")
135 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
136 .setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, false);
137 }
138};
139
140class NonLocalUdpFaceLocalFieldsEnabled // won't work because non-local scope
141{
142public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400143 static ControlParameters
Eric Newberryf40551a2016-09-05 15:41:16 -0700144 getParameters()
145 {
146 return ControlParameters()
147 .setUri("udp4://127.0.0.1:26363")
148 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
149 .setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, true);
150 }
151};
152
153class NonLocalUdpFaceLocalFieldsDisabled
154{
155public:
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400156 static ControlParameters
Eric Newberryf40551a2016-09-05 15:41:16 -0700157 getParameters()
158 {
159 return ControlParameters()
160 .setUri("udp4://127.0.0.1:26363")
161 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
162 .setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, false);
163 }
164};
165
Eric Newberry2642cd22017-07-13 21:34:53 -0400166class TcpFaceLpReliabilityEnabled
167{
168public:
169 static ControlParameters
170 getParameters()
171 {
172 return ControlParameters()
173 .setUri("tcp4://127.0.0.1:26363")
174 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
175 .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, true);
176 }
177};
178
179class TcpFaceLpReliabilityDisabled
180{
181public:
182 static ControlParameters
183 getParameters()
184 {
185 return ControlParameters()
186 .setUri("tcp4://127.0.0.1:26363")
187 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
188 .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, false);
189 }
190};
191
192class UdpFaceLpReliabilityEnabled
193{
194public:
195 static ControlParameters
196 getParameters()
197 {
198 return ControlParameters()
Eric Newberry0c3e57b2018-01-25 20:54:46 -0700199 .setUri("udp4://127.0.0.1:26363")
Eric Newberry2642cd22017-07-13 21:34:53 -0400200 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
201 .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, true);
202 }
203};
204
205class UdpFaceLpReliabilityDisabled
206{
207public:
208 static ControlParameters
209 getParameters()
210 {
211 return ControlParameters()
Eric Newberry0c3e57b2018-01-25 20:54:46 -0700212 .setUri("udp4://127.0.0.1:26363")
Eric Newberry2642cd22017-07-13 21:34:53 -0400213 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
214 .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, false);
215 }
216};
217
Eric Newberry0c3e57b2018-01-25 20:54:46 -0700218class TcpFaceCongestionMarkingEnabled
219{
220public:
221 static ControlParameters
222 getParameters()
223 {
224 return ControlParameters()
225 .setUri("tcp4://127.0.0.1:26363")
226 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
227 .setBaseCongestionMarkingInterval(50_ms)
228 .setDefaultCongestionThreshold(1000)
229 .setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, true);
230 }
231};
232
233class TcpFaceCongestionMarkingDisabled
234{
235public:
236 static ControlParameters
237 getParameters()
238 {
239 return ControlParameters()
240 .setUri("tcp4://127.0.0.1:26363")
241 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
242 .setBaseCongestionMarkingInterval(50_ms)
243 .setDefaultCongestionThreshold(1000)
244 .setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, false);
245 }
246};
247
Eric Newberry812d6152018-06-06 15:06:01 -0700248class TcpFaceMtuOverride
249{
250public:
251 static ControlParameters
252 getParameters()
253 {
254 return ControlParameters()
255 .setUri("tcp4://127.0.0.1:26363")
256 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
257 .setMtu(1000);
258 }
259};
260
261class UdpFaceMtuOverride
262{
263public:
264 static ControlParameters
265 getParameters()
266 {
267 return ControlParameters()
268 .setUri("udp4://127.0.0.1:26363")
269 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
270 .setMtu(1000);
271 }
272};
273
Junxiao Shi38c7d9e2017-04-13 14:22:50 +0000274class FaceUriMalformed
275{
276public:
277 static ControlParameters
278 getParameters()
279 {
280 return ControlParameters()
281 .setUri("tcp4://127.0.0.1:not-a-port");
282 }
283};
284
285class FaceUriNonCanonical
286{
287public:
288 static ControlParameters
289 getParameters()
290 {
291 return ControlParameters()
292 .setUri("udp://localhost");
293 }
294};
295
296class FaceUriUnsupportedScheme
297{
298public:
299 static ControlParameters
300 getParameters()
301 {
302 return ControlParameters()
303 .setUri("dev://eth0");
304 }
305};
306
Yanbiao Li73860e32015-08-19 16:30:16 -0700307namespace mpl = boost::mpl;
308
Eric Newberry42602412016-08-27 09:33:18 -0700309// pairs of CreateCommand and Success/Failure status
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400310using TestCases = mpl::vector<
311 mpl::pair<TcpFaceOnDemand, CommandFailure<406>>,
Eric Newberryb5aa7f52016-09-03 20:36:12 -0700312 mpl::pair<TcpFacePersistent, CommandSuccess>,
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400313 mpl::pair<TcpFacePermanent, CommandSuccess>,
Eric Newberryb5aa7f52016-09-03 20:36:12 -0700314 mpl::pair<UdpFaceOnDemand, CommandFailure<406>>,
315 mpl::pair<UdpFacePersistent, CommandSuccess>,
316 mpl::pair<UdpFacePermanent, CommandSuccess>,
Eric Newberryf40551a2016-09-05 15:41:16 -0700317 mpl::pair<LocalTcpFaceLocalFieldsEnabled, CommandSuccess>,
318 mpl::pair<LocalTcpFaceLocalFieldsDisabled, CommandSuccess>,
319 mpl::pair<NonLocalUdpFaceLocalFieldsEnabled, CommandFailure<406>>,
Junxiao Shi38c7d9e2017-04-13 14:22:50 +0000320 mpl::pair<NonLocalUdpFaceLocalFieldsDisabled, CommandSuccess>,
Eric Newberry2642cd22017-07-13 21:34:53 -0400321 mpl::pair<TcpFaceLpReliabilityEnabled, CommandSuccess>,
322 mpl::pair<TcpFaceLpReliabilityDisabled, CommandSuccess>,
323 mpl::pair<UdpFaceLpReliabilityEnabled, CommandSuccess>,
324 mpl::pair<UdpFaceLpReliabilityDisabled, CommandSuccess>,
Eric Newberry0c3e57b2018-01-25 20:54:46 -0700325 mpl::pair<TcpFaceCongestionMarkingEnabled, CommandSuccess>,
326 mpl::pair<TcpFaceCongestionMarkingDisabled, CommandSuccess>,
Eric Newberry812d6152018-06-06 15:06:01 -0700327 mpl::pair<TcpFaceMtuOverride, CommandFailure<406>>,
328 mpl::pair<UdpFaceMtuOverride, CommandSuccess>,
Junxiao Shi38c7d9e2017-04-13 14:22:50 +0000329 mpl::pair<FaceUriMalformed, CommandFailure<400>>,
330 mpl::pair<FaceUriNonCanonical, CommandFailure<400>>,
331 mpl::pair<FaceUriUnsupportedScheme, CommandFailure<406>>>;
Yanbiao Li73860e32015-08-19 16:30:16 -0700332
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400333BOOST_FIXTURE_TEST_CASE_TEMPLATE(NewFace, T, TestCases, FaceManagerCommandFixture)
Yanbiao Li73860e32015-08-19 16:30:16 -0700334{
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400335 using FaceType = typename T::first;
336 using CreateResult = typename T::second;
Yanbiao Li73860e32015-08-19 16:30:16 -0700337
Junxiao Shi8a1f1702017-07-03 00:05:08 +0000338 Interest req = makeControlCommandRequest("/localhost/nfd/faces/create", FaceType::getParameters());
Yanbiao Li73860e32015-08-19 16:30:16 -0700339
340 bool hasCallbackFired = false;
Junxiao Shi8a1f1702017-07-03 00:05:08 +0000341 this->node1.face.onSendData.connect([this, req, &hasCallbackFired] (const Data& response) {
342 if (!req.getName().isPrefixOf(response.getName())) {
Eric Newberry42602412016-08-27 09:33:18 -0700343 return;
344 }
Yanbiao Li73860e32015-08-19 16:30:16 -0700345
Eric Newberry42602412016-08-27 09:33:18 -0700346 ControlResponse actual(response.getContent().blockFromValue());
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400347 ControlResponse expected(CreateResult::getExpected());
Eric Newberry42602412016-08-27 09:33:18 -0700348 BOOST_TEST_MESSAGE(actual.getText());
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000349 BOOST_CHECK_EQUAL(expected.getCode(), actual.getCode());
Yanbiao Li73860e32015-08-19 16:30:16 -0700350
Eric Newberry42602412016-08-27 09:33:18 -0700351 if (actual.getBody().hasWire()) {
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400352 ControlParameters expectedParams(FaceType::getParameters());
Eric Newberry42602412016-08-27 09:33:18 -0700353 ControlParameters actualParams(actual.getBody());
Yanbiao Li73860e32015-08-19 16:30:16 -0700354
Eric Newberry42602412016-08-27 09:33:18 -0700355 BOOST_CHECK(actualParams.hasFaceId());
356 BOOST_CHECK_EQUAL(expectedParams.getFacePersistency(), actualParams.getFacePersistency());
357
Eric Newberryb5aa7f52016-09-03 20:36:12 -0700358 if (actual.getCode() == 200) {
359 if (expectedParams.hasFlags()) {
Eric Newberryf40551a2016-09-05 15:41:16 -0700360 BOOST_CHECK_EQUAL(expectedParams.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED),
361 actualParams.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED));
Eric Newberry2642cd22017-07-13 21:34:53 -0400362 BOOST_CHECK_EQUAL(expectedParams.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED),
363 actualParams.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED));
Eric Newberry17d18492018-02-10 22:50:06 -0700364 if (expectedParams.hasFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED)) {
365 BOOST_CHECK_EQUAL(expectedParams.getFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED),
366 actualParams.getFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED));
367 }
368 else {
369 BOOST_CHECK(actualParams.getFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED));
370 }
Eric Newberryb5aa7f52016-09-03 20:36:12 -0700371 }
372 else {
Eric Newberry17d18492018-02-10 22:50:06 -0700373 // local fields and LpReliability are disabled by default, congestion marking is enabled
374 // by default on TCP, UDP, and Unix stream
375 BOOST_CHECK(!actualParams.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED));
376 BOOST_CHECK(!actualParams.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED));
377 BOOST_CHECK(actualParams.getFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED));
Eric Newberry0c3e57b2018-01-25 20:54:46 -0700378 }
379
380 if (expectedParams.hasBaseCongestionMarkingInterval()) {
381 BOOST_CHECK_EQUAL(expectedParams.getBaseCongestionMarkingInterval(),
382 actualParams.getBaseCongestionMarkingInterval());
383 }
384 else {
385 BOOST_CHECK_EQUAL(actualParams.getBaseCongestionMarkingInterval(), 100_ms);
386 }
387
388 if (expectedParams.hasDefaultCongestionThreshold()) {
389 BOOST_CHECK_EQUAL(expectedParams.getDefaultCongestionThreshold(),
390 actualParams.getDefaultCongestionThreshold());
391 }
392 else {
393 BOOST_CHECK_EQUAL(actualParams.getDefaultCongestionThreshold(), 65536);
Eric Newberryb5aa7f52016-09-03 20:36:12 -0700394 }
Eric Newberry812d6152018-06-06 15:06:01 -0700395
396 if (expectedParams.hasMtu()) {
397 BOOST_CHECK_EQUAL(expectedParams.getMtu(), actualParams.getMtu());
398 }
Eric Newberryb5aa7f52016-09-03 20:36:12 -0700399 }
400 else {
Yanbiao Li73860e32015-08-19 16:30:16 -0700401 BOOST_CHECK_EQUAL(expectedParams.getUri(), actualParams.getUri());
Yanbiao Li73860e32015-08-19 16:30:16 -0700402 }
Eric Newberry42602412016-08-27 09:33:18 -0700403 }
Eric Newberryb5aa7f52016-09-03 20:36:12 -0700404
405 if (actual.getCode() != 200) {
Junxiao Shi38c7d9e2017-04-13 14:22:50 +0000406 FaceUri uri;
407 if (uri.parse(FaceType::getParameters().getUri())) {
408 // ensure face not created
Davide Pesaventob5eee202017-09-21 23:59:22 -0400409 const auto& faceTable = this->node1.faceTable;
Junxiao Shi38c7d9e2017-04-13 14:22:50 +0000410 BOOST_CHECK(std::none_of(faceTable.begin(), faceTable.end(), [uri] (Face& face) {
411 return face.getRemoteUri() == uri;
412 }));
413 }
414 else {
415 // do not check malformed FaceUri
416 }
Eric Newberryb5aa7f52016-09-03 20:36:12 -0700417 }
418
Eric Newberry42602412016-08-27 09:33:18 -0700419 hasCallbackFired = true;
420 });
Yanbiao Li73860e32015-08-19 16:30:16 -0700421
Junxiao Shi8a1f1702017-07-03 00:05:08 +0000422 this->node1.face.receive(req);
Eric Newberry0c3e57b2018-01-25 20:54:46 -0700423 this->advanceClocks(1_ms, 5);
Yanbiao Li73860e32015-08-19 16:30:16 -0700424
425 BOOST_CHECK(hasCallbackFired);
426}
427
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000428BOOST_FIXTURE_TEST_CASE(ExistingFace, FaceManagerCommandFixture)
Yanbiao Li73860e32015-08-19 16:30:16 -0700429{
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000430 using FaceType = UdpFacePersistent;
Yanbiao Li73860e32015-08-19 16:30:16 -0700431
432 {
433 // create face
Junxiao Shi8a1f1702017-07-03 00:05:08 +0000434 Interest req = makeControlCommandRequest("/localhost/nfd/faces/create", FaceType::getParameters());
435 this->node1.face.receive(req);
Eric Newberry0c3e57b2018-01-25 20:54:46 -0700436 this->advanceClocks(1_ms, 5);
Yanbiao Li73860e32015-08-19 16:30:16 -0700437 }
438
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000439 // find the created face
Davide Pesaventoa3c9ddb2017-04-10 22:15:24 -0400440 auto foundFace = this->node1.findFaceByUri(FaceType::getParameters().getUri());
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000441 BOOST_REQUIRE(foundFace != nullptr);
Yanbiao Li73860e32015-08-19 16:30:16 -0700442
443 {
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000444 // re-create face
Junxiao Shi8a1f1702017-07-03 00:05:08 +0000445 Interest req = makeControlCommandRequest("/localhost/nfd/faces/create", FaceType::getParameters());
Yanbiao Li73860e32015-08-19 16:30:16 -0700446
447 bool hasCallbackFired = false;
Junxiao Shib84e6742016-07-19 13:16:22 +0000448 this->node1.face.onSendData.connect(
Davide Pesaventoac238f22017-09-12 15:19:40 -0400449 [req, foundFace, &hasCallbackFired] (const Data& response) {
Junxiao Shi8a1f1702017-07-03 00:05:08 +0000450 if (!req.getName().isPrefixOf(response.getName())) {
Yanbiao Li73860e32015-08-19 16:30:16 -0700451 return;
452 }
453
454 ControlResponse actual(response.getContent().blockFromValue());
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000455 BOOST_REQUIRE_EQUAL(actual.getCode(), 409);
Yanbiao Li73860e32015-08-19 16:30:16 -0700456
Yanbiao Li73860e32015-08-19 16:30:16 -0700457 ControlParameters actualParams(actual.getBody());
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000458 BOOST_CHECK_EQUAL(foundFace->getId(), actualParams.getFaceId());
459 BOOST_CHECK_EQUAL(foundFace->getRemoteUri().toString(), actualParams.getUri());
460 BOOST_CHECK_EQUAL(foundFace->getPersistency(), actualParams.getFacePersistency());
Eric Newberry0c3e57b2018-01-25 20:54:46 -0700461 auto linkService = dynamic_cast<face::GenericLinkService*>(foundFace->getLinkService());
462 BOOST_CHECK_EQUAL(linkService->getOptions().baseCongestionMarkingInterval,
463 actualParams.getBaseCongestionMarkingInterval());
464 BOOST_CHECK_EQUAL(linkService->getOptions().defaultCongestionThreshold,
465 actualParams.getDefaultCongestionThreshold());
Yanbiao Li73860e32015-08-19 16:30:16 -0700466
467 hasCallbackFired = true;
468 });
469
Junxiao Shi8a1f1702017-07-03 00:05:08 +0000470 this->node1.face.receive(req);
Eric Newberry0c3e57b2018-01-25 20:54:46 -0700471 this->advanceClocks(1_ms, 5);
Yanbiao Li73860e32015-08-19 16:30:16 -0700472
473 BOOST_CHECK(hasCallbackFired);
474 }
475}
476
477BOOST_AUTO_TEST_SUITE_END() // CreateFace
478BOOST_AUTO_TEST_SUITE_END() // TestFaceManager
479BOOST_AUTO_TEST_SUITE_END() // Mgmt
480
Weiwei Liuf5aee942016-03-19 07:00:42 +0000481} // namespace tests
482} // namespace nfd