blob: 87356a151aa726801c764da8b376b4c7165ec9bb [file] [log] [blame]
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Eric Newberry84d3adc2017-08-09 23:31:40 -04002/*
Davide Pesaventob7bfcb92022-05-22 23:55:23 -04003 * Copyright (c) 2014-2022, Regents of the University of California,
Junxiao Shi38f4ce92016-08-04 10:01:52 +00004 * 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
Junxiao Shi331ade72016-08-19 14:07:19 +000026#include "nfdc/face-module.hpp"
Junxiao Shi38f4ce92016-08-04 10:01:52 +000027
Junxiao Shi1f481fa2017-01-26 15:14:43 +000028#include "execute-command-fixture.hpp"
29#include "status-fixture.hpp"
Junxiao Shi38f4ce92016-08-04 10:01:52 +000030
Davide Pesaventoe422f9e2022-06-03 01:30:23 -040031namespace nfd::tools::nfdc::tests {
Junxiao Shi38f4ce92016-08-04 10:01:52 +000032
Junxiao Shi1d7fef52017-02-02 05:33:14 +000033using ndn::nfd::FaceQueryFilter;
34
Junxiao Shi331ade72016-08-19 14:07:19 +000035BOOST_AUTO_TEST_SUITE(Nfdc)
Junxiao Shi1f481fa2017-01-26 15:14:43 +000036BOOST_AUTO_TEST_SUITE(TestFaceModule)
37
Junxiao Shi36e54292017-02-17 18:43:16 +000038BOOST_FIXTURE_TEST_SUITE(ListCommand, ExecuteCommandFixture)
39
40const std::string NONQUERY_OUTPUT =
41 "faceid=134 remote=udp4://233.252.0.4:6363 local=udp4://192.0.2.1:6363"
Eric Newberry4f8dd962018-06-17 21:32:07 -070042 " congestion={base-marking-interval=12345ms default-threshold=54321B} mtu=1024"
Junxiao Shi36e54292017-02-17 18:43:16 +000043 " counters={in={22562i 22031d 63n 2522915B} out={30121i 20940d 1218n 1353592B}}"
44 " flags={non-local permanent multi-access}\n"
45 "faceid=745 remote=fd://75 local=unix:///var/run/nfd.sock"
Eric Newberry4f8dd962018-06-17 21:32:07 -070046 " congestion={base-marking-interval=100ms default-threshold=65536B} mtu=8800"
Junxiao Shi36e54292017-02-17 18:43:16 +000047 " counters={in={18998i 26701d 147n 4672308B} out={34779i 17028d 1176n 8957187B}}"
Eric Newberryde332452018-01-30 11:45:32 -070048 " flags={local on-demand point-to-point local-fields lp-reliability congestion-marking}\n";
Junxiao Shi36e54292017-02-17 18:43:16 +000049
50BOOST_AUTO_TEST_CASE(NormalNonQuery)
51{
52 this->processInterest = [this] (const Interest& interest) {
53 FaceStatus payload1;
54 payload1.setFaceId(134)
55 .setRemoteUri("udp4://233.252.0.4:6363")
56 .setLocalUri("udp4://192.0.2.1:6363")
57 .setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL)
58 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERMANENT)
59 .setLinkType(ndn::nfd::LINK_TYPE_MULTI_ACCESS)
Eric Newberryde332452018-01-30 11:45:32 -070060 .setBaseCongestionMarkingInterval(12345_ms)
61 .setDefaultCongestionThreshold(54321)
Eric Newberry4f8dd962018-06-17 21:32:07 -070062 .setMtu(1024)
Junxiao Shi36e54292017-02-17 18:43:16 +000063 .setNInInterests(22562)
Junxiao Shif03d4792017-04-06 16:41:22 +000064 .setNInData(22031)
Junxiao Shi36e54292017-02-17 18:43:16 +000065 .setNInNacks(63)
66 .setNOutInterests(30121)
Junxiao Shif03d4792017-04-06 16:41:22 +000067 .setNOutData(20940)
Junxiao Shi36e54292017-02-17 18:43:16 +000068 .setNOutNacks(1218)
69 .setNInBytes(2522915)
70 .setNOutBytes(1353592);
71 FaceStatus payload2;
72 payload2.setFaceId(745)
73 .setRemoteUri("fd://75")
74 .setLocalUri("unix:///var/run/nfd.sock")
75 .setFaceScope(ndn::nfd::FACE_SCOPE_LOCAL)
76 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND)
77 .setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT)
Eric Newberryde332452018-01-30 11:45:32 -070078 .setBaseCongestionMarkingInterval(100_ms)
79 .setDefaultCongestionThreshold(65536)
Eric Newberry4f8dd962018-06-17 21:32:07 -070080 .setMtu(8800)
Junxiao Shi36e54292017-02-17 18:43:16 +000081 .setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, true)
Eric Newberry84d3adc2017-08-09 23:31:40 -040082 .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, true)
Eric Newberryde332452018-01-30 11:45:32 -070083 .setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, true)
Junxiao Shi36e54292017-02-17 18:43:16 +000084 .setNInInterests(18998)
Junxiao Shif03d4792017-04-06 16:41:22 +000085 .setNInData(26701)
Junxiao Shi36e54292017-02-17 18:43:16 +000086 .setNInNacks(147)
87 .setNOutInterests(34779)
Junxiao Shif03d4792017-04-06 16:41:22 +000088 .setNOutData(17028)
Junxiao Shi36e54292017-02-17 18:43:16 +000089 .setNOutNacks(1176)
90 .setNInBytes(4672308)
91 .setNOutBytes(8957187);
92 this->sendDataset("/localhost/nfd/faces/list", payload1, payload2);
93 };
94
95 this->execute("face list");
96 BOOST_CHECK_EQUAL(exitCode, 0);
97 BOOST_CHECK(out.is_equal(NONQUERY_OUTPUT));
98 BOOST_CHECK(err.is_empty());
99}
100
101const std::string QUERY_OUTPUT =
102 "faceid=177 remote=tcp4://53.239.9.114:6363 local=tcp4://164.0.31.106:20396"
Eric Newberry4f8dd962018-06-17 21:32:07 -0700103 " congestion={base-marking-interval=555ms default-threshold=10000B} mtu=2000"
Junxiao Shi36e54292017-02-17 18:43:16 +0000104 " counters={in={2325i 1110d 79n 4716834B} out={2278i 485d 841n 308108B}}"
105 " flags={non-local persistent point-to-point}\n";
106
107BOOST_AUTO_TEST_CASE(NormalQuery)
108{
109 this->processInterest = [this] (const Interest& interest) {
110 BOOST_CHECK(Name("/localhost/nfd/faces/query").isPrefixOf(interest.getName()));
111 BOOST_CHECK_EQUAL(interest.getName().size(), 5);
112 FaceQueryFilter filter(interest.getName().at(4).blockFromValue());
113 FaceQueryFilter expectedFilter;
114 expectedFilter.setRemoteUri("tcp4://53.239.9.114:6363")
115 .setLocalUri("tcp4://164.0.31.106:20396")
116 .setUriScheme("tcp4");
117 BOOST_CHECK_EQUAL(filter, expectedFilter);
118
119 FaceStatus payload;
120 payload.setFaceId(177)
121 .setRemoteUri("tcp4://53.239.9.114:6363")
122 .setLocalUri("tcp4://164.0.31.106:20396")
123 .setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL)
124 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
125 .setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT)
Eric Newberryde332452018-01-30 11:45:32 -0700126 .setBaseCongestionMarkingInterval(555_ms)
127 .setDefaultCongestionThreshold(10000)
Eric Newberry4f8dd962018-06-17 21:32:07 -0700128 .setMtu(2000)
Junxiao Shi36e54292017-02-17 18:43:16 +0000129 .setNInInterests(2325)
Junxiao Shif03d4792017-04-06 16:41:22 +0000130 .setNInData(1110)
Junxiao Shi36e54292017-02-17 18:43:16 +0000131 .setNInNacks(79)
132 .setNOutInterests(2278)
Junxiao Shif03d4792017-04-06 16:41:22 +0000133 .setNOutData(485)
Junxiao Shi36e54292017-02-17 18:43:16 +0000134 .setNOutNacks(841)
135 .setNInBytes(4716834)
136 .setNOutBytes(308108);
137 this->sendDataset(interest.getName(), payload);
138 };
139
140 this->execute("face list tcp://53.239.9.114 scheme tcp4 local tcp://164.0.31.106:20396");
141 BOOST_CHECK_EQUAL(exitCode, 0);
142 BOOST_CHECK(out.is_equal(QUERY_OUTPUT));
143 BOOST_CHECK(err.is_empty());
144}
145
146BOOST_AUTO_TEST_CASE(NotFound)
147{
148 this->processInterest = [this] (const Interest& interest) {
149 this->sendEmptyDataset(interest.getName());
150 };
151
152 this->execute("face list scheme udp6");
153 BOOST_CHECK_EQUAL(exitCode, 3);
154 BOOST_CHECK(out.is_empty());
155 BOOST_CHECK(err.is_equal("Face not found\n"));
156}
157
158BOOST_AUTO_TEST_CASE(Error)
159{
160 this->processInterest = nullptr; // no response
161
162 this->execute("face list local udp4://31.67.17.2:6363");
163 BOOST_CHECK_EQUAL(exitCode, 1);
164 BOOST_CHECK(out.is_empty());
Eric Newberry359135c2018-06-26 21:02:12 -0700165 BOOST_CHECK(err.is_equal("Error 10060 when querying face: Timeout exceeded\n"));
Junxiao Shi36e54292017-02-17 18:43:16 +0000166}
167
168BOOST_AUTO_TEST_SUITE_END() // ListCommand
169
Junxiao Shi1f481fa2017-01-26 15:14:43 +0000170BOOST_FIXTURE_TEST_SUITE(ShowCommand, ExecuteCommandFixture)
171
Eric Newberryde332452018-01-30 11:45:32 -0700172const std::string NORMAL_ALL_CONGESTION_OUTPUT = std::string(R"TEXT(
173 faceid=256
174 remote=udp4://84.67.35.111:6363
175 local=udp4://79.91.49.215:6363
176congestion={base-marking-interval=123ms default-threshold=10000B}
Eric Newberry4f8dd962018-06-17 21:32:07 -0700177 mtu=4000
Eric Newberryde332452018-01-30 11:45:32 -0700178 counters={in={28975i 28232d 212n 13307258B} out={19525i 30993d 1038n 6231946B}}
179 flags={non-local on-demand point-to-point}
Junxiao Shi1f481fa2017-01-26 15:14:43 +0000180)TEXT").substr(1);
181
Eric Newberryde332452018-01-30 11:45:32 -0700182BOOST_AUTO_TEST_CASE(NormalAllCongestionParams)
183{
184 this->processInterest = [this] (const Interest& interest) {
185 BOOST_CHECK(Name("/localhost/nfd/faces/query").isPrefixOf(interest.getName()));
186 BOOST_CHECK_EQUAL(interest.getName().size(), 5);
187 FaceQueryFilter filter(interest.getName().at(4).blockFromValue());
188 BOOST_CHECK_EQUAL(filter, FaceQueryFilter().setFaceId(256));
189
190 FaceStatus payload;
191 payload.setFaceId(256)
192 .setRemoteUri("udp4://84.67.35.111:6363")
193 .setLocalUri("udp4://79.91.49.215:6363")
194 .setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL)
195 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND)
Eric Newberry4f8dd962018-06-17 21:32:07 -0700196 .setMtu(4000)
Eric Newberryde332452018-01-30 11:45:32 -0700197 .setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT)
198 .setBaseCongestionMarkingInterval(123_ms)
199 .setDefaultCongestionThreshold(10000)
200 .setNInInterests(28975)
201 .setNInData(28232)
202 .setNInNacks(212)
203 .setNOutInterests(19525)
204 .setNOutData(30993)
205 .setNOutNacks(1038)
206 .setNInBytes(13307258)
207 .setNOutBytes(6231946);
208
209 this->sendDataset(interest.getName(), payload);
210 };
211
212 this->execute("face show 256");
213 BOOST_CHECK_EQUAL(exitCode, 0);
214 BOOST_CHECK(out.is_equal(NORMAL_ALL_CONGESTION_OUTPUT));
215 BOOST_CHECK(err.is_empty());
216}
217
218const std::string NORMAL_INTERVAL_CONGESTION_OUTPUT = std::string(R"TEXT(
219 faceid=256
220 remote=udp4://84.67.35.111:6363
221 local=udp4://79.91.49.215:6363
222congestion={base-marking-interval=123ms}
Eric Newberry4f8dd962018-06-17 21:32:07 -0700223 mtu=3000
Eric Newberryde332452018-01-30 11:45:32 -0700224 counters={in={28975i 28232d 212n 13307258B} out={19525i 30993d 1038n 6231946B}}
225 flags={non-local on-demand point-to-point}
226)TEXT").substr(1);
227
228BOOST_AUTO_TEST_CASE(NormalIntervalCongestionParams)
229{
230 this->processInterest = [this] (const Interest& interest) {
231 BOOST_CHECK(Name("/localhost/nfd/faces/query").isPrefixOf(interest.getName()));
232 BOOST_CHECK_EQUAL(interest.getName().size(), 5);
233 FaceQueryFilter filter(interest.getName().at(4).blockFromValue());
234 BOOST_CHECK_EQUAL(filter, FaceQueryFilter().setFaceId(256));
235
236 FaceStatus payload;
237 payload.setFaceId(256)
238 .setRemoteUri("udp4://84.67.35.111:6363")
239 .setLocalUri("udp4://79.91.49.215:6363")
240 .setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL)
241 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND)
242 .setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT)
243 .setBaseCongestionMarkingInterval(123_ms)
Eric Newberry4f8dd962018-06-17 21:32:07 -0700244 .setMtu(3000)
Eric Newberryde332452018-01-30 11:45:32 -0700245 .setNInInterests(28975)
246 .setNInData(28232)
247 .setNInNacks(212)
248 .setNOutInterests(19525)
249 .setNOutData(30993)
250 .setNOutNacks(1038)
251 .setNInBytes(13307258)
252 .setNOutBytes(6231946);
253
254 this->sendDataset(interest.getName(), payload);
255 };
256
257 this->execute("face show 256");
258 BOOST_CHECK_EQUAL(exitCode, 0);
259 BOOST_CHECK(out.is_equal(NORMAL_INTERVAL_CONGESTION_OUTPUT));
260 BOOST_CHECK(err.is_empty());
261}
262
263const std::string NORMAL_THRESHOLD_CONGESTION_OUTPUT = std::string(R"TEXT(
264 faceid=256
265 remote=udp4://84.67.35.111:6363
266 local=udp4://79.91.49.215:6363
267congestion={default-threshold=10000B}
Eric Newberry4f8dd962018-06-17 21:32:07 -0700268 mtu=5000
Eric Newberryde332452018-01-30 11:45:32 -0700269 counters={in={28975i 28232d 212n 13307258B} out={19525i 30993d 1038n 6231946B}}
270 flags={non-local on-demand point-to-point}
271)TEXT").substr(1);
272
273BOOST_AUTO_TEST_CASE(NormalThresholdCongestionParams)
274{
275 this->processInterest = [this] (const Interest& interest) {
276 BOOST_CHECK(Name("/localhost/nfd/faces/query").isPrefixOf(interest.getName()));
277 BOOST_CHECK_EQUAL(interest.getName().size(), 5);
278 FaceQueryFilter filter(interest.getName().at(4).blockFromValue());
279 BOOST_CHECK_EQUAL(filter, FaceQueryFilter().setFaceId(256));
280
281 FaceStatus payload;
282 payload.setFaceId(256)
283 .setRemoteUri("udp4://84.67.35.111:6363")
284 .setLocalUri("udp4://79.91.49.215:6363")
285 .setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL)
286 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND)
Eric Newberry4f8dd962018-06-17 21:32:07 -0700287 .setMtu(5000)
Eric Newberryde332452018-01-30 11:45:32 -0700288 .setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT)
289 .setDefaultCongestionThreshold(10000)
290 .setNInInterests(28975)
291 .setNInData(28232)
292 .setNInNacks(212)
293 .setNOutInterests(19525)
294 .setNOutData(30993)
295 .setNOutNacks(1038)
296 .setNInBytes(13307258)
297 .setNOutBytes(6231946);
298
299 this->sendDataset(interest.getName(), payload);
300 };
301
302 this->execute("face show 256");
303 BOOST_CHECK_EQUAL(exitCode, 0);
304 BOOST_CHECK(out.is_equal(NORMAL_THRESHOLD_CONGESTION_OUTPUT));
305 BOOST_CHECK(err.is_empty());
306}
307
308const std::string NORMAL_NO_CONGESTION_OUTPUT = std::string(R"TEXT(
309 faceid=256
310 remote=udp4://84.67.35.111:6363
311 local=udp4://79.91.49.215:6363
Eric Newberry4f8dd962018-06-17 21:32:07 -0700312 mtu=6000
Eric Newberryde332452018-01-30 11:45:32 -0700313 counters={in={28975i 28232d 212n 13307258B} out={19525i 30993d 1038n 6231946B}}
314 flags={non-local on-demand point-to-point}
315)TEXT").substr(1);
316
317BOOST_AUTO_TEST_CASE(NormalNoCongestionParams)
Junxiao Shi1f481fa2017-01-26 15:14:43 +0000318{
319 this->processInterest = [this] (const Interest& interest) {
Junxiao Shi36e54292017-02-17 18:43:16 +0000320 BOOST_CHECK(Name("/localhost/nfd/faces/query").isPrefixOf(interest.getName()));
Junxiao Shi8f803f22017-02-10 03:04:28 +0000321 BOOST_CHECK_EQUAL(interest.getName().size(), 5);
322 FaceQueryFilter filter(interest.getName().at(4).blockFromValue());
323 BOOST_CHECK_EQUAL(filter, FaceQueryFilter().setFaceId(256));
Junxiao Shi1f481fa2017-01-26 15:14:43 +0000324
325 FaceStatus payload;
326 payload.setFaceId(256)
327 .setRemoteUri("udp4://84.67.35.111:6363")
328 .setLocalUri("udp4://79.91.49.215:6363")
329 .setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL)
330 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND)
Eric Newberry4f8dd962018-06-17 21:32:07 -0700331 .setMtu(6000)
Junxiao Shi1f481fa2017-01-26 15:14:43 +0000332 .setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT)
333 .setNInInterests(28975)
Junxiao Shif03d4792017-04-06 16:41:22 +0000334 .setNInData(28232)
Junxiao Shi1f481fa2017-01-26 15:14:43 +0000335 .setNInNacks(212)
336 .setNOutInterests(19525)
Junxiao Shif03d4792017-04-06 16:41:22 +0000337 .setNOutData(30993)
Junxiao Shi1f481fa2017-01-26 15:14:43 +0000338 .setNOutNacks(1038)
339 .setNInBytes(13307258)
340 .setNOutBytes(6231946);
341
Junxiao Shi8f803f22017-02-10 03:04:28 +0000342 this->sendDataset(interest.getName(), payload);
Junxiao Shi1f481fa2017-01-26 15:14:43 +0000343 };
344
345 this->execute("face show 256");
346 BOOST_CHECK_EQUAL(exitCode, 0);
Eric Newberryde332452018-01-30 11:45:32 -0700347 BOOST_CHECK(out.is_equal(NORMAL_NO_CONGESTION_OUTPUT));
Junxiao Shi1f481fa2017-01-26 15:14:43 +0000348 BOOST_CHECK(err.is_empty());
349}
350
351BOOST_AUTO_TEST_CASE(NotFound)
352{
353 this->processInterest = [this] (const Interest& interest) {
354 this->sendEmptyDataset(interest.getName());
355 };
356
357 this->execute("face show 256");
358 BOOST_CHECK_EQUAL(exitCode, 3);
359 BOOST_CHECK(out.is_empty());
Junxiao Shi8f803f22017-02-10 03:04:28 +0000360 BOOST_CHECK(err.is_equal("Face not found\n"));
Junxiao Shi1f481fa2017-01-26 15:14:43 +0000361}
362
363BOOST_AUTO_TEST_CASE(Error)
364{
365 this->processInterest = nullptr; // no response
366
367 this->execute("face show 256");
368 BOOST_CHECK_EQUAL(exitCode, 1);
369 BOOST_CHECK(out.is_empty());
Eric Newberry359135c2018-06-26 21:02:12 -0700370 BOOST_CHECK(err.is_equal("Error 10060 when querying face: Timeout exceeded\n"));
Junxiao Shi1f481fa2017-01-26 15:14:43 +0000371}
372
373BOOST_AUTO_TEST_SUITE_END() // ShowCommand
Junxiao Shi38f4ce92016-08-04 10:01:52 +0000374
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000375class ExecuteFaceCreateCommandFixture : public ExecuteCommandFixture
376{
377protected:
378 void
Davide Pesaventob7bfcb92022-05-22 23:55:23 -0400379 respond409(const Interest& interest, FacePersistency persistency,
380 std::optional<uint64_t> mtu = std::nullopt,
Eric Newberryde332452018-01-30 11:45:32 -0700381 bool enableLpReliability = false,
382 bool enableCongestionMarking = false)
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000383 {
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000384 MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/create");
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000385 ControlParameters body;
386 body.setFaceId(1172)
387 .setUri("udp4://100.77.30.65:6363")
Junxiao Shi1cce2a32017-05-02 02:39:55 +0000388 .setLocalUri("udp4://68.62.26.57:24087")
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000389 .setFacePersistency(persistency)
390 .setFlags(0);
Eric Newberry4f8dd962018-06-17 21:32:07 -0700391 if (mtu) {
392 body.setMtu(*mtu);
393 }
Eric Newberry84d3adc2017-08-09 23:31:40 -0400394 if (enableLpReliability) {
395 body.setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, true, false);
396 }
Eric Newberryde332452018-01-30 11:45:32 -0700397 if (enableCongestionMarking) {
398 body.setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, true, false);
399 }
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000400 this->failCommand(interest, 409, "conflict-409", body);
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000401 }
402};
Junxiao Shi1d7fef52017-02-02 05:33:14 +0000403
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000404BOOST_FIXTURE_TEST_SUITE(CreateCommand, ExecuteFaceCreateCommandFixture)
405
406BOOST_AUTO_TEST_CASE(Creating)
Junxiao Shi1d7fef52017-02-02 05:33:14 +0000407{
408 this->processInterest = [this] (const Interest& interest) {
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000409 ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/create");
Junxiao Shi1d7fef52017-02-02 05:33:14 +0000410 BOOST_REQUIRE(req.hasUri());
411 BOOST_CHECK_EQUAL(req.getUri(), "udp4://159.242.33.78:6363");
Junxiao Shi0d976922017-04-01 14:35:21 +0000412 BOOST_CHECK(!req.hasLocalUri());
Junxiao Shi1d7fef52017-02-02 05:33:14 +0000413 BOOST_REQUIRE(req.hasFacePersistency());
414 BOOST_CHECK_EQUAL(req.getFacePersistency(), FacePersistency::FACE_PERSISTENCY_PERSISTENT);
415
416 ControlParameters resp;
417 resp.setFaceId(2130)
Junxiao Shi1cce2a32017-05-02 02:39:55 +0000418 .setUri("udp4://159.242.33.78:6363")
419 .setLocalUri("udp4://179.63.153.45:28835")
Junxiao Shi5c1bb362017-05-11 16:03:38 +0000420 .setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERSISTENT)
421 .setFlags(0);
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000422 this->succeedCommand(interest, resp);
Junxiao Shi1d7fef52017-02-02 05:33:14 +0000423 };
424
425 this->execute("face create udp://159.242.33.78");
426 BOOST_CHECK_EQUAL(exitCode, 0);
Junxiao Shi1cce2a32017-05-02 02:39:55 +0000427 BOOST_CHECK(out.is_equal("face-created id=2130 local=udp4://179.63.153.45:28835 "
Eric Newberry84d3adc2017-08-09 23:31:40 -0400428 "remote=udp4://159.242.33.78:6363 persistency=persistent "
Eric Newberryde332452018-01-30 11:45:32 -0700429 "reliability=off congestion-marking=off\n"));
Junxiao Shi1d7fef52017-02-02 05:33:14 +0000430 BOOST_CHECK(err.is_empty());
431}
432
Eric Newberry84d3adc2017-08-09 23:31:40 -0400433BOOST_AUTO_TEST_CASE(CreatingWithParams)
Junxiao Shi0d976922017-04-01 14:35:21 +0000434{
435 this->processInterest = [this] (const Interest& interest) {
436 ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/create");
437 BOOST_REQUIRE(req.hasUri());
438 BOOST_CHECK_EQUAL(req.getUri(), "udp4://22.91.89.51:19903");
439 BOOST_REQUIRE(req.hasLocalUri());
440 BOOST_CHECK_EQUAL(req.getLocalUri(), "udp4://98.68.23.71:6363");
441 BOOST_REQUIRE(req.hasFacePersistency());
442 BOOST_CHECK_EQUAL(req.getFacePersistency(), FacePersistency::FACE_PERSISTENCY_PERMANENT);
Eric Newberry4f8dd962018-06-17 21:32:07 -0700443 BOOST_REQUIRE(req.hasBaseCongestionMarkingInterval());
444 BOOST_CHECK_EQUAL(req.getBaseCongestionMarkingInterval(), 100_ms);
445 BOOST_REQUIRE(req.hasDefaultCongestionThreshold());
446 BOOST_CHECK_EQUAL(req.getDefaultCongestionThreshold(), 65536);
447 BOOST_REQUIRE(req.hasMtu());
448 BOOST_CHECK_EQUAL(req.getMtu(), 10000);
Eric Newberry84d3adc2017-08-09 23:31:40 -0400449 BOOST_CHECK(req.hasFlags());
450 BOOST_CHECK(req.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED));
Junxiao Shi0d976922017-04-01 14:35:21 +0000451
452 ControlParameters resp;
453 resp.setFaceId(301)
Junxiao Shi1cce2a32017-05-02 02:39:55 +0000454 .setUri("udp4://22.91.89.51:19903")
455 .setLocalUri("udp4://98.68.23.71:6363")
Junxiao Shi5c1bb362017-05-11 16:03:38 +0000456 .setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERMANENT)
Eric Newberryde332452018-01-30 11:45:32 -0700457 .setBaseCongestionMarkingInterval(100_ms)
458 .setDefaultCongestionThreshold(65536)
Eric Newberry4f8dd962018-06-17 21:32:07 -0700459 .setMtu(8800)
Eric Newberryde332452018-01-30 11:45:32 -0700460 .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, true, false)
461 .setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, true, false);
Junxiao Shi0d976922017-04-01 14:35:21 +0000462 this->succeedCommand(interest, resp);
463 };
464
Eric Newberryde332452018-01-30 11:45:32 -0700465 this->execute("face create udp://22.91.89.51:19903 permanent local udp://98.68.23.71 reliability on "
466 "congestion-marking on congestion-marking-interval 100 "
Eric Newberry4f8dd962018-06-17 21:32:07 -0700467 "default-congestion-threshold 65536 mtu 10000");
Junxiao Shi0d976922017-04-01 14:35:21 +0000468 BOOST_CHECK_EQUAL(exitCode, 0);
Junxiao Shi1cce2a32017-05-02 02:39:55 +0000469 BOOST_CHECK(out.is_equal("face-created id=301 local=udp4://98.68.23.71:6363 "
Eric Newberry84d3adc2017-08-09 23:31:40 -0400470 "remote=udp4://22.91.89.51:19903 persistency=permanent "
Eric Newberryde332452018-01-30 11:45:32 -0700471 "reliability=on congestion-marking=on "
Eric Newberry4f8dd962018-06-17 21:32:07 -0700472 "congestion-marking-interval=100ms default-congestion-threshold=65536B "
473 "mtu=8800\n"));
Junxiao Shi0d976922017-04-01 14:35:21 +0000474 BOOST_CHECK(err.is_empty());
475}
476
Eric Newberry13ff2592020-03-06 17:32:29 -0800477BOOST_AUTO_TEST_CASE(ChangingMtu)
Eric Newberry4f8dd962018-06-17 21:32:07 -0700478{
Eric Newberry13ff2592020-03-06 17:32:29 -0800479 bool hasUpdateCommand = false;
480 this->processInterest = [this, &hasUpdateCommand] (const Interest& interest) {
481 if (parseCommand(interest, "/localhost/nfd/faces/create")) {
482 this->respond409(interest, FacePersistency::FACE_PERSISTENCY_PERSISTENT, 5000);
483 return;
484 }
485
486 ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/update");
487 hasUpdateCommand = true;
488 BOOST_REQUIRE(req.hasFaceId());
489 BOOST_CHECK_EQUAL(req.getFaceId(), 1172);
490 BOOST_CHECK(!req.hasFacePersistency());
491 BOOST_REQUIRE(req.hasMtu());
492 BOOST_CHECK_EQUAL(req.getMtu(), 4000);
493 BOOST_CHECK(!req.hasFlags());
494
495 ControlParameters resp;
496 resp.setFaceId(1172)
497 .setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERSISTENT)
498 .setMtu(4000)
499 .setFlags(0);
500 this->succeedCommand(interest, resp);
Eric Newberry4f8dd962018-06-17 21:32:07 -0700501 };
502
Eric Newberry13ff2592020-03-06 17:32:29 -0800503 this->execute("face create udp://100.77.30.65 mtu 4000");
504 BOOST_CHECK(hasUpdateCommand);
505 BOOST_CHECK_EQUAL(exitCode, 0);
506 BOOST_CHECK(out.is_equal("face-updated id=1172 local=udp4://68.62.26.57:24087 "
507 "remote=udp4://100.77.30.65:6363 persistency=persistent "
508 "reliability=off congestion-marking=off mtu=4000\n"));
509 BOOST_CHECK(err.is_empty());
510}
511
512BOOST_AUTO_TEST_CASE(AutoMtu)
513{
514 bool hasUpdateCommand = false;
515 this->processInterest = [this, &hasUpdateCommand] (const Interest& interest) {
516 if (parseCommand(interest, "/localhost/nfd/faces/create")) {
517 this->respond409(interest, FacePersistency::FACE_PERSISTENCY_PERSISTENT, 5000);
518 return;
519 }
520
521 ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/update");
522 hasUpdateCommand = true;
523 BOOST_REQUIRE(req.hasFaceId());
524 BOOST_CHECK_EQUAL(req.getFaceId(), 1172);
525 BOOST_CHECK(!req.hasFacePersistency());
526 BOOST_REQUIRE(req.hasMtu());
527 BOOST_CHECK_EQUAL(req.getMtu(), std::numeric_limits<uint64_t>::max());
528 BOOST_CHECK(!req.hasFlags());
529
530 ControlParameters resp;
531 resp.setFaceId(1172)
532 .setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERSISTENT)
533 .setMtu(ndn::MAX_NDN_PACKET_SIZE)
534 .setFlags(0);
535 this->succeedCommand(interest, resp);
536 };
537
538 this->execute("face create udp://100.77.30.65 mtu auto");
539 BOOST_CHECK(hasUpdateCommand);
540 BOOST_CHECK_EQUAL(exitCode, 0);
541 BOOST_CHECK(out.is_equal("face-updated id=1172 local=udp4://68.62.26.57:24087 "
542 "remote=udp4://100.77.30.65:6363 persistency=persistent "
543 "reliability=off congestion-marking=off mtu=8800\n"));
544 BOOST_CHECK(err.is_empty());
Eric Newberry4f8dd962018-06-17 21:32:07 -0700545}
546
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000547BOOST_AUTO_TEST_CASE(UpgradingPersistency)
548{
549 bool hasUpdateCommand = false;
550 this->processInterest = [this, &hasUpdateCommand] (const Interest& interest) {
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000551 if (parseCommand(interest, "/localhost/nfd/faces/create")) {
552 this->respond409(interest, FacePersistency::FACE_PERSISTENCY_ON_DEMAND);
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000553 return;
554 }
555
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000556 ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/update");
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000557 hasUpdateCommand = true;
558 BOOST_REQUIRE(req.hasFaceId());
559 BOOST_CHECK_EQUAL(req.getFaceId(), 1172);
560 BOOST_REQUIRE(req.hasFacePersistency());
561 BOOST_CHECK_EQUAL(req.getFacePersistency(), FacePersistency::FACE_PERSISTENCY_PERSISTENT);
562 BOOST_CHECK(!req.hasFlags());
563
564 ControlParameters resp;
565 resp.setFaceId(1172)
566 .setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERSISTENT)
Eric Newberry13ff2592020-03-06 17:32:29 -0800567 .setMtu(1024)
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000568 .setFlags(0);
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000569 this->succeedCommand(interest, resp);
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000570 };
571
572 this->execute("face create udp://100.77.30.65");
573 BOOST_CHECK(hasUpdateCommand);
574 BOOST_CHECK_EQUAL(exitCode, 0);
Junxiao Shi1cce2a32017-05-02 02:39:55 +0000575 BOOST_CHECK(out.is_equal("face-updated id=1172 local=udp4://68.62.26.57:24087 "
Eric Newberry84d3adc2017-08-09 23:31:40 -0400576 "remote=udp4://100.77.30.65:6363 persistency=persistent "
Eric Newberry13ff2592020-03-06 17:32:29 -0800577 "reliability=off congestion-marking=off mtu=1024\n"));
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000578 BOOST_CHECK(err.is_empty());
579}
580
Eric Newberry4f8dd962018-06-17 21:32:07 -0700581BOOST_AUTO_TEST_CASE(UpgradingPersistencySameMtu)
582{
583 bool hasUpdateCommand = false;
584 this->processInterest = [this, &hasUpdateCommand] (const Interest& interest) {
585 if (parseCommand(interest, "/localhost/nfd/faces/create")) {
586 this->respond409(interest, FacePersistency::FACE_PERSISTENCY_ON_DEMAND, 8800);
587 return;
588 }
589
590 ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/update");
591 hasUpdateCommand = true;
592 BOOST_REQUIRE(req.hasFaceId());
593 BOOST_CHECK_EQUAL(req.getFaceId(), 1172);
594 BOOST_REQUIRE(req.hasFacePersistency());
595 BOOST_CHECK_EQUAL(req.getFacePersistency(), FacePersistency::FACE_PERSISTENCY_PERSISTENT);
Eric Newberry13ff2592020-03-06 17:32:29 -0800596 BOOST_CHECK(!req.hasMtu());
Eric Newberry4f8dd962018-06-17 21:32:07 -0700597 BOOST_CHECK(!req.hasFlags());
598
599 ControlParameters resp;
600 resp.setFaceId(1172)
601 .setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERSISTENT)
Eric Newberry13ff2592020-03-06 17:32:29 -0800602 .setMtu(8800)
Eric Newberry4f8dd962018-06-17 21:32:07 -0700603 .setFlags(0);
604 this->succeedCommand(interest, resp);
605 };
606
607 this->execute("face create udp://100.77.30.65 mtu 8800");
608 BOOST_CHECK(hasUpdateCommand);
609 BOOST_CHECK_EQUAL(exitCode, 0);
610 BOOST_CHECK(out.is_equal("face-updated id=1172 local=udp4://68.62.26.57:24087 "
611 "remote=udp4://100.77.30.65:6363 persistency=persistent "
Eric Newberry13ff2592020-03-06 17:32:29 -0800612 "reliability=off congestion-marking=off mtu=8800\n"));
Eric Newberry4f8dd962018-06-17 21:32:07 -0700613 BOOST_CHECK(err.is_empty());
614}
615
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000616BOOST_AUTO_TEST_CASE(NotDowngradingPersistency)
617{
618 this->processInterest = [this] (const Interest& interest) {
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000619 this->respond409(interest, FacePersistency::FACE_PERSISTENCY_PERMANENT);
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000620 // no command other than faces/create is expected
621 };
622
623 this->execute("face create udp://100.77.30.65");
624 BOOST_CHECK_EQUAL(exitCode, 0);
Junxiao Shi1cce2a32017-05-02 02:39:55 +0000625 BOOST_CHECK(out.is_equal("face-exists id=1172 local=udp4://68.62.26.57:24087 "
Eric Newberry84d3adc2017-08-09 23:31:40 -0400626 "remote=udp4://100.77.30.65:6363 persistency=permanent "
Eric Newberryde332452018-01-30 11:45:32 -0700627 "reliability=off congestion-marking=off\n"));
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000628 BOOST_CHECK(err.is_empty());
629}
630
631BOOST_AUTO_TEST_CASE(SamePersistency)
632{
633 this->processInterest = [this] (const Interest& interest) {
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000634 this->respond409(interest, FacePersistency::FACE_PERSISTENCY_PERSISTENT);
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000635 // no command other than faces/create is expected
636 };
637
638 this->execute("face create udp://100.77.30.65");
639 BOOST_CHECK_EQUAL(exitCode, 0);
Junxiao Shi1cce2a32017-05-02 02:39:55 +0000640 BOOST_CHECK(out.is_equal("face-exists id=1172 local=udp4://68.62.26.57:24087 "
Eric Newberry84d3adc2017-08-09 23:31:40 -0400641 "remote=udp4://100.77.30.65:6363 persistency=persistent "
Eric Newberryde332452018-01-30 11:45:32 -0700642 "reliability=off congestion-marking=off\n"));
Eric Newberry84d3adc2017-08-09 23:31:40 -0400643 BOOST_CHECK(err.is_empty());
644}
645
646BOOST_AUTO_TEST_CASE(EnablingReliability)
647{
648 bool hasUpdateCommand = false;
649 this->processInterest = [this, &hasUpdateCommand] (const Interest& interest) {
650 if (parseCommand(interest, "/localhost/nfd/faces/create")) {
651 this->respond409(interest, FacePersistency::FACE_PERSISTENCY_PERSISTENT);
652 return;
653 }
654
655 ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/update");
656 hasUpdateCommand = true;
657 BOOST_REQUIRE(req.hasFaceId());
658 BOOST_CHECK_EQUAL(req.getFaceId(), 1172);
659 BOOST_CHECK(req.hasFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED));
660 BOOST_CHECK(req.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED));
661
662 ControlParameters resp;
663 resp.setFaceId(1172)
664 .setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERSISTENT)
Eric Newberry13ff2592020-03-06 17:32:29 -0800665 .setMtu(4000)
Eric Newberry84d3adc2017-08-09 23:31:40 -0400666 .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, true, false);
667 this->succeedCommand(interest, resp);
668 };
669
670 this->execute("face create udp://100.77.30.65 reliability on");
671 BOOST_CHECK_EQUAL(exitCode, 0);
672 BOOST_CHECK(out.is_equal("face-updated id=1172 local=udp4://68.62.26.57:24087 "
673 "remote=udp4://100.77.30.65:6363 persistency=persistent "
Eric Newberry13ff2592020-03-06 17:32:29 -0800674 "reliability=on congestion-marking=off mtu=4000\n"));
Eric Newberry84d3adc2017-08-09 23:31:40 -0400675 BOOST_CHECK(err.is_empty());
676}
677
678BOOST_AUTO_TEST_CASE(DisablingReliability)
679{
680 bool hasUpdateCommand = false;
681 this->processInterest = [this, &hasUpdateCommand] (const Interest& interest) {
682 if (parseCommand(interest, "/localhost/nfd/faces/create")) {
Eric Newberry4f8dd962018-06-17 21:32:07 -0700683 this->respond409(interest, FacePersistency::FACE_PERSISTENCY_PERSISTENT, {}, true);
Eric Newberry84d3adc2017-08-09 23:31:40 -0400684 return;
685 }
686
687 ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/update");
688 hasUpdateCommand = true;
689 BOOST_REQUIRE(req.hasFaceId());
690 BOOST_CHECK_EQUAL(req.getFaceId(), 1172);
691 BOOST_CHECK(req.hasFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED));
692 BOOST_CHECK(!req.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED));
693
694 ControlParameters resp;
695 resp.setFaceId(1172)
696 .setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERSISTENT)
Eric Newberry13ff2592020-03-06 17:32:29 -0800697 .setMtu(4000)
Eric Newberry84d3adc2017-08-09 23:31:40 -0400698 .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, false, false);
699 this->succeedCommand(interest, resp);
700 };
701
702 this->execute("face create udp://100.77.30.65 reliability off");
703 BOOST_CHECK_EQUAL(exitCode, 0);
704 BOOST_CHECK(out.is_equal("face-updated id=1172 local=udp4://68.62.26.57:24087 "
705 "remote=udp4://100.77.30.65:6363 persistency=persistent "
Eric Newberry13ff2592020-03-06 17:32:29 -0800706 "reliability=off congestion-marking=off mtu=4000\n"));
Eric Newberryde332452018-01-30 11:45:32 -0700707 BOOST_CHECK(err.is_empty());
708}
709
710BOOST_AUTO_TEST_CASE(EnablingCongestionMarking)
711{
712 bool hasUpdateCommand = false;
713 this->processInterest = [this, &hasUpdateCommand] (const Interest& interest) {
714 if (parseCommand(interest, "/localhost/nfd/faces/create")) {
715 this->respond409(interest, FacePersistency::FACE_PERSISTENCY_PERSISTENT);
716 return;
717 }
718
719 ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/update");
720 hasUpdateCommand = true;
721 BOOST_REQUIRE(req.hasFaceId());
722 BOOST_CHECK_EQUAL(req.getFaceId(), 1172);
723 BOOST_CHECK(req.hasFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED));
724 BOOST_CHECK(req.getFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED));
725 BOOST_CHECK(!req.hasBaseCongestionMarkingInterval());
726 BOOST_CHECK(!req.hasDefaultCongestionThreshold());
727
728 ControlParameters resp;
729 resp.setFaceId(1172)
730 .setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERSISTENT)
731 .setBaseCongestionMarkingInterval(100_ms)
732 .setDefaultCongestionThreshold(65536)
Eric Newberry13ff2592020-03-06 17:32:29 -0800733 .setMtu(4000)
Eric Newberryde332452018-01-30 11:45:32 -0700734 .setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, true, false);
735 this->succeedCommand(interest, resp);
736 };
737
738 this->execute("face create udp://100.77.30.65 congestion-marking on");
739 BOOST_CHECK_EQUAL(exitCode, 0);
740 BOOST_CHECK(out.is_equal("face-updated id=1172 local=udp4://68.62.26.57:24087 "
741 "remote=udp4://100.77.30.65:6363 persistency=persistent "
742 "reliability=off congestion-marking=on "
Eric Newberry13ff2592020-03-06 17:32:29 -0800743 "congestion-marking-interval=100ms default-congestion-threshold=65536B "
744 "mtu=4000\n"));
Eric Newberryde332452018-01-30 11:45:32 -0700745 BOOST_CHECK(err.is_empty());
746}
747
748BOOST_AUTO_TEST_CASE(DisablingCongestionMarking)
749{
750 bool hasUpdateCommand = false;
751 this->processInterest = [this, &hasUpdateCommand] (const Interest& interest) {
752 if (parseCommand(interest, "/localhost/nfd/faces/create")) {
Eric Newberry4f8dd962018-06-17 21:32:07 -0700753 this->respond409(interest, FacePersistency::FACE_PERSISTENCY_PERSISTENT, {}, false, true);
Eric Newberryde332452018-01-30 11:45:32 -0700754 return;
755 }
756
757 ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/update");
758 hasUpdateCommand = true;
759 BOOST_REQUIRE(req.hasFaceId());
760 BOOST_CHECK_EQUAL(req.getFaceId(), 1172);
761 BOOST_CHECK(req.hasFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED));
762 BOOST_CHECK(!req.getFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED));
763 BOOST_CHECK(!req.hasBaseCongestionMarkingInterval());
764 BOOST_CHECK(!req.hasDefaultCongestionThreshold());
765
766 ControlParameters resp;
767 resp.setFaceId(1172)
768 .setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERSISTENT)
769 .setBaseCongestionMarkingInterval(100_ms)
770 .setDefaultCongestionThreshold(65536)
Eric Newberry13ff2592020-03-06 17:32:29 -0800771 .setMtu(4000)
Eric Newberryde332452018-01-30 11:45:32 -0700772 .setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, false, false);
773 this->succeedCommand(interest, resp);
774 };
775
776 this->execute("face create udp://100.77.30.65 congestion-marking off");
777 BOOST_CHECK_EQUAL(exitCode, 0);
778 BOOST_CHECK(out.is_equal("face-updated id=1172 local=udp4://68.62.26.57:24087 "
779 "remote=udp4://100.77.30.65:6363 persistency=persistent "
780 "reliability=off congestion-marking=off "
Eric Newberry13ff2592020-03-06 17:32:29 -0800781 "congestion-marking-interval=100ms default-congestion-threshold=65536B "
782 "mtu=4000\n"));
783 BOOST_CHECK(err.is_empty());
784}
785
786BOOST_AUTO_TEST_CASE(UpgradingPersistencyChangeMtu)
787{
788 bool hasUpdateCommand = false;
789 this->processInterest = [this, &hasUpdateCommand] (const Interest& interest) {
790 if (parseCommand(interest, "/localhost/nfd/faces/create")) {
791 this->respond409(interest, FacePersistency::FACE_PERSISTENCY_ON_DEMAND, 8800);
792 return;
793 }
794
795 ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/update");
796 hasUpdateCommand = true;
797 BOOST_REQUIRE(req.hasFaceId());
798 BOOST_CHECK_EQUAL(req.getFaceId(), 1172);
799 BOOST_REQUIRE(req.hasFacePersistency());
800 BOOST_CHECK_EQUAL(req.getFacePersistency(), FacePersistency::FACE_PERSISTENCY_PERSISTENT);
801 BOOST_REQUIRE(req.hasMtu());
802 BOOST_CHECK_EQUAL(req.getMtu(), 4000);
803 BOOST_CHECK(!req.hasFlags());
804
805 ControlParameters resp;
806 resp.setFaceId(1172)
807 .setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERSISTENT)
808 .setMtu(4000)
809 .setFlags(0);
810 this->succeedCommand(interest, resp);
811 };
812
813 this->execute("face create udp://100.77.30.65 mtu 4000");
814 BOOST_CHECK(hasUpdateCommand);
815 BOOST_CHECK_EQUAL(exitCode, 0);
816 BOOST_CHECK(out.is_equal("face-updated id=1172 local=udp4://68.62.26.57:24087 "
817 "remote=udp4://100.77.30.65:6363 persistency=persistent "
818 "reliability=off congestion-marking=off mtu=4000\n"));
819 BOOST_CHECK(err.is_empty());
820}
821
822BOOST_AUTO_TEST_CASE(UpgradingPersistencyChangeMtuAndFlags)
823{
824 bool hasUpdateCommand = false;
825 this->processInterest = [this, &hasUpdateCommand] (const Interest& interest) {
826 if (parseCommand(interest, "/localhost/nfd/faces/create")) {
827 this->respond409(interest, FacePersistency::FACE_PERSISTENCY_ON_DEMAND, 8800);
828 return;
829 }
830
831 ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/update");
832 hasUpdateCommand = true;
833 BOOST_REQUIRE(req.hasFaceId());
834 BOOST_CHECK_EQUAL(req.getFaceId(), 1172);
835 BOOST_REQUIRE(req.hasFacePersistency());
836 BOOST_CHECK_EQUAL(req.getFacePersistency(), FacePersistency::FACE_PERSISTENCY_PERSISTENT);
837 BOOST_REQUIRE(req.hasMtu());
838 BOOST_CHECK_EQUAL(req.getMtu(), 4000);
839 BOOST_CHECK(req.hasFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED));
840 BOOST_CHECK(req.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED));
841
842 ControlParameters resp;
843 resp.setFaceId(1172)
844 .setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERSISTENT)
845 .setMtu(4000)
846 .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, true, false);
847 this->succeedCommand(interest, resp);
848 };
849
850 this->execute("face create udp://100.77.30.65 mtu 4000 reliability on");
851 BOOST_CHECK(hasUpdateCommand);
852 BOOST_CHECK_EQUAL(exitCode, 0);
853 BOOST_CHECK(out.is_equal("face-updated id=1172 local=udp4://68.62.26.57:24087 "
854 "remote=udp4://100.77.30.65:6363 persistency=persistent "
855 "reliability=on congestion-marking=off mtu=4000\n"));
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000856 BOOST_CHECK(err.is_empty());
857}
858
Junxiao Shi0d976922017-04-01 14:35:21 +0000859BOOST_AUTO_TEST_CASE(ErrorCanonizeRemote)
860{
861 this->execute("face create invalid://");
862 BOOST_CHECK_EQUAL(exitCode, 4);
863 BOOST_CHECK(out.is_empty());
Eric Newberryd656aff2020-04-03 00:30:38 -0700864 BOOST_CHECK(err.is_equal("Error during canonization of remote FaceUri 'invalid://': "
865 "scheme not supported\n"));
Junxiao Shi0d976922017-04-01 14:35:21 +0000866}
867
868BOOST_AUTO_TEST_CASE(ErrorCanonizeLocal)
869{
870 this->execute("face create udp4://24.37.20.47:6363 local invalid://");
871 BOOST_CHECK_EQUAL(exitCode, 4);
872 BOOST_CHECK(out.is_empty());
Eric Newberryd656aff2020-04-03 00:30:38 -0700873 BOOST_CHECK(err.is_equal("Error during canonization of local FaceUri 'invalid://': "
874 "scheme not supported\n"));
Junxiao Shi0d976922017-04-01 14:35:21 +0000875}
876
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000877BOOST_AUTO_TEST_CASE(ErrorCreate)
Junxiao Shi1d7fef52017-02-02 05:33:14 +0000878{
879 this->processInterest = nullptr; // no response
880
881 this->execute("face create udp://159.242.33.78");
882 BOOST_CHECK_EQUAL(exitCode, 1);
883 BOOST_CHECK(out.is_empty());
884 BOOST_CHECK(err.is_equal("Error 10060 when creating face: request timed out\n"));
885}
886
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000887BOOST_AUTO_TEST_CASE(ErrorConflict)
888{
889 // Current NFD will not report a 409-conflict with a different remote FaceUri, but this is
890 // allowed by FaceMgmt protocol and nfdc should not attempt to upgrade persistency in this case.
891
892 this->processInterest = [this] (const Interest& interest) {
893 // conflict with udp4://100.77.30.65:6363
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000894 this->respond409(interest, FacePersistency::FACE_PERSISTENCY_ON_DEMAND);
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000895 };
896
897 this->execute("face create udp://20.53.73.45");
898 BOOST_CHECK_EQUAL(exitCode, 1);
899 BOOST_CHECK(out.is_empty());
900 BOOST_CHECK(err.is_equal("Error 409 when creating face: conflict-409\n"));
901}
902
903BOOST_AUTO_TEST_CASE(ErrorUpdate)
904{
905 this->processInterest = [this] (const Interest& interest) {
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000906 if (parseCommand(interest, "/localhost/nfd/faces/create")) {
907 this->respond409(interest, FacePersistency::FACE_PERSISTENCY_ON_DEMAND);
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000908 return;
909 }
910
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000911 MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/update");
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000912 // no response to faces/update
913 };
914
915 this->execute("face create udp://100.77.30.65");
916 BOOST_CHECK_EQUAL(exitCode, 1);
917 BOOST_CHECK(out.is_empty());
Eric Newberry13ff2592020-03-06 17:32:29 -0800918 BOOST_CHECK(err.is_equal("Error 10060 when updating face: request timed out\n"));
Yanbiao Li58ba3f92017-02-15 14:27:18 +0000919}
920
Junxiao Shi1d7fef52017-02-02 05:33:14 +0000921BOOST_AUTO_TEST_SUITE_END() // CreateCommand
922
Junxiao Shi05dd4442017-02-06 22:50:07 +0000923BOOST_FIXTURE_TEST_SUITE(DestroyCommand, ExecuteCommandFixture)
924
925BOOST_AUTO_TEST_CASE(NormalByFaceId)
926{
927 this->processInterest = [this] (const Interest& interest) {
Junxiao Shi918e5d42017-02-25 03:58:21 +0000928 if (this->respondFaceQuery(interest)) {
Junxiao Shi05dd4442017-02-06 22:50:07 +0000929 return;
930 }
931
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000932 ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/destroy");
Junxiao Shi05dd4442017-02-06 22:50:07 +0000933 BOOST_REQUIRE(req.hasFaceId());
934 BOOST_CHECK_EQUAL(req.getFaceId(), 10156);
935
936 ControlParameters resp;
937 resp.setFaceId(10156);
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000938 this->succeedCommand(interest, resp);
Junxiao Shi05dd4442017-02-06 22:50:07 +0000939 };
940
941 this->execute("face destroy 10156");
942 BOOST_CHECK_EQUAL(exitCode, 0);
943 BOOST_CHECK(out.is_equal("face-destroyed id=10156 local=tcp4://151.26.163.27:22967 "
Eric Newberry84d3adc2017-08-09 23:31:40 -0400944 "remote=tcp4://198.57.27.40:6363 persistency=persistent "
Eric Newberryde332452018-01-30 11:45:32 -0700945 "reliability=off congestion-marking=off\n"));
Junxiao Shi05dd4442017-02-06 22:50:07 +0000946 BOOST_CHECK(err.is_empty());
947}
948
949BOOST_AUTO_TEST_CASE(NormalByFaceUri)
950{
951 this->processInterest = [this] (const Interest& interest) {
Junxiao Shi918e5d42017-02-25 03:58:21 +0000952 if (this->respondFaceQuery(interest)) {
Junxiao Shi05dd4442017-02-06 22:50:07 +0000953 return;
954 }
955
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000956 ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/destroy");
Junxiao Shi05dd4442017-02-06 22:50:07 +0000957 BOOST_REQUIRE(req.hasFaceId());
958 BOOST_CHECK_EQUAL(req.getFaceId(), 2249);
959
960 ControlParameters resp;
961 resp.setFaceId(2249);
Junxiao Shi1a25a6e2017-03-06 03:09:47 +0000962 this->succeedCommand(interest, resp);
Junxiao Shi05dd4442017-02-06 22:50:07 +0000963 };
964
965 this->execute("face destroy tcp://32.121.182.82");
966 BOOST_CHECK_EQUAL(exitCode, 0);
967 BOOST_CHECK(out.is_equal("face-destroyed id=2249 local=tcp4://30.99.87.98:31414 "
Eric Newberry84d3adc2017-08-09 23:31:40 -0400968 "remote=tcp4://32.121.182.82:6363 persistency=persistent "
Eric Newberryde332452018-01-30 11:45:32 -0700969 "reliability=off congestion-marking=off\n"));
Junxiao Shi05dd4442017-02-06 22:50:07 +0000970 BOOST_CHECK(err.is_empty());
971}
972
973BOOST_AUTO_TEST_CASE(FaceNotExist)
974{
975 this->processInterest = [this] (const Interest& interest) {
Junxiao Shi918e5d42017-02-25 03:58:21 +0000976 BOOST_CHECK(this->respondFaceQuery(interest));
Junxiao Shi05dd4442017-02-06 22:50:07 +0000977 };
978
979 this->execute("face destroy 23728");
980 BOOST_CHECK_EQUAL(exitCode, 3);
981 BOOST_CHECK(out.is_empty());
982 BOOST_CHECK(err.is_equal("Face not found\n"));
983}
984
985BOOST_AUTO_TEST_CASE(Ambiguous)
986{
987 this->processInterest = [this] (const Interest& interest) {
Junxiao Shi918e5d42017-02-25 03:58:21 +0000988 BOOST_CHECK(this->respondFaceQuery(interest));
Junxiao Shi05dd4442017-02-06 22:50:07 +0000989 };
990
991 this->execute("face destroy udp4://225.131.75.231:56363");
992 BOOST_CHECK_EQUAL(exitCode, 5);
993 BOOST_CHECK(out.is_empty());
994 BOOST_CHECK(err.is_equal("Multiple faces match specified remote FaceUri. "
995 "Re-run the command with a FaceId: "
996 "6720 (local=udp4://202.83.168.28:56363), "
997 "31066 (local=udp4://25.90.26.32:56363)\n"));
998}
999
1000BOOST_AUTO_TEST_CASE(ErrorCanonization)
1001{
1002 this->execute("face destroy udp6://32.38.164.64:10445");
1003 BOOST_CHECK_EQUAL(exitCode, 4);
1004 BOOST_CHECK(out.is_empty());
Eric Newberryd656aff2020-04-03 00:30:38 -07001005 BOOST_CHECK(err.is_equal("Error during canonization of 'udp6://32.38.164.64:10445': "
Eric Newberry7d8695d2017-05-29 15:49:10 -07001006 "IPv4/v6 mismatch\n"));
Junxiao Shi05dd4442017-02-06 22:50:07 +00001007}
1008
1009BOOST_AUTO_TEST_CASE(ErrorDataset)
1010{
1011 this->processInterest = nullptr; // no response to dataset or command
1012
1013 this->execute("face destroy udp://159.242.33.78");
1014 BOOST_CHECK_EQUAL(exitCode, 1);
1015 BOOST_CHECK(out.is_empty());
Eric Newberry359135c2018-06-26 21:02:12 -07001016 BOOST_CHECK(err.is_equal("Error 10060 when querying face: Timeout exceeded\n"));
Junxiao Shi05dd4442017-02-06 22:50:07 +00001017}
1018
1019BOOST_AUTO_TEST_CASE(ErrorCommand)
1020{
1021 this->processInterest = [this] (const Interest& interest) {
Junxiao Shi918e5d42017-02-25 03:58:21 +00001022 if (this->respondFaceQuery(interest)) {
Junxiao Shi05dd4442017-02-06 22:50:07 +00001023 return;
1024 }
1025
Junxiao Shi1a25a6e2017-03-06 03:09:47 +00001026 MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/destroy");
Junxiao Shi05dd4442017-02-06 22:50:07 +00001027 // no response to command
1028 };
1029
Junxiao Shi918e5d42017-02-25 03:58:21 +00001030 this->execute("face destroy 10156");
Junxiao Shi05dd4442017-02-06 22:50:07 +00001031 BOOST_CHECK_EQUAL(exitCode, 1);
1032 BOOST_CHECK(out.is_empty());
1033 BOOST_CHECK(err.is_equal("Error 10060 when destroying face: request timed out\n"));
1034}
1035
1036BOOST_AUTO_TEST_SUITE_END() // DestroyCommand
1037
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001038const std::string STATUS_XML = stripXmlSpaces(R"XML(
1039 <faces>
1040 <face>
1041 <faceId>134</faceId>
1042 <remoteUri>udp4://233.252.0.4:6363</remoteUri>
1043 <localUri>udp4://192.0.2.1:6363</localUri>
1044 <faceScope>non-local</faceScope>
1045 <facePersistency>permanent</facePersistency>
1046 <linkType>multi-access</linkType>
Eric Newberryde332452018-01-30 11:45:32 -07001047 <congestion/>
Eric Newberry6d932e82016-11-24 05:05:43 +00001048 <flags/>
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001049 <packetCounters>
1050 <incomingPackets>
1051 <nInterests>22562</nInterests>
Junxiao Shif03d4792017-04-06 16:41:22 +00001052 <nData>22031</nData>
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001053 <nNacks>63</nNacks>
1054 </incomingPackets>
1055 <outgoingPackets>
1056 <nInterests>30121</nInterests>
Junxiao Shif03d4792017-04-06 16:41:22 +00001057 <nData>20940</nData>
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001058 <nNacks>1218</nNacks>
1059 </outgoingPackets>
1060 </packetCounters>
1061 <byteCounters>
1062 <incomingBytes>2522915</incomingBytes>
1063 <outgoingBytes>1353592</outgoingBytes>
1064 </byteCounters>
1065 </face>
1066 <face>
1067 <faceId>745</faceId>
1068 <remoteUri>fd://75</remoteUri>
1069 <localUri>unix:///var/run/nfd.sock</localUri>
1070 <faceScope>local</faceScope>
1071 <facePersistency>on-demand</facePersistency>
1072 <linkType>point-to-point</linkType>
Eric Newberryde332452018-01-30 11:45:32 -07001073 <congestion>
1074 <baseMarkingInterval>PT0.100S</baseMarkingInterval>
1075 <defaultThreshold>65536</defaultThreshold>
1076 </congestion>
Eric Newberry4f8dd962018-06-17 21:32:07 -07001077 <mtu>8800</mtu>
Eric Newberry6d932e82016-11-24 05:05:43 +00001078 <flags>
1079 <localFieldsEnabled/>
Eric Newberry84d3adc2017-08-09 23:31:40 -04001080 <lpReliabilityEnabled/>
Eric Newberryde332452018-01-30 11:45:32 -07001081 <congestionMarkingEnabled/>
Eric Newberry6d932e82016-11-24 05:05:43 +00001082 </flags>
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001083 <packetCounters>
1084 <incomingPackets>
1085 <nInterests>18998</nInterests>
Junxiao Shif03d4792017-04-06 16:41:22 +00001086 <nData>26701</nData>
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001087 <nNacks>147</nNacks>
1088 </incomingPackets>
1089 <outgoingPackets>
1090 <nInterests>34779</nInterests>
Junxiao Shif03d4792017-04-06 16:41:22 +00001091 <nData>17028</nData>
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001092 <nNacks>1176</nNacks>
1093 </outgoingPackets>
1094 </packetCounters>
1095 <byteCounters>
1096 <incomingBytes>4672308</incomingBytes>
1097 <outgoingBytes>8957187</outgoingBytes>
1098 </byteCounters>
1099 </face>
1100 </faces>
1101)XML");
1102
1103const std::string STATUS_TEXT =
1104 "Faces:\n"
1105 " faceid=134 remote=udp4://233.252.0.4:6363 local=udp4://192.0.2.1:6363"
1106 " counters={in={22562i 22031d 63n 2522915B} out={30121i 20940d 1218n 1353592B}}"
Junxiao Shi1f481fa2017-01-26 15:14:43 +00001107 " flags={non-local permanent multi-access}\n"
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001108 " faceid=745 remote=fd://75 local=unix:///var/run/nfd.sock"
Eric Newberry4f8dd962018-06-17 21:32:07 -07001109 " congestion={base-marking-interval=100ms default-threshold=65536B} mtu=8800"
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001110 " counters={in={18998i 26701d 147n 4672308B} out={34779i 17028d 1176n 8957187B}}"
Eric Newberryde332452018-01-30 11:45:32 -07001111 " flags={local on-demand point-to-point local-fields lp-reliability congestion-marking}\n";
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001112
Junxiao Shi1f481fa2017-01-26 15:14:43 +00001113BOOST_FIXTURE_TEST_CASE(Status, StatusFixture<FaceModule>)
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001114{
1115 this->fetchStatus();
1116 FaceStatus payload1;
1117 payload1.setFaceId(134)
1118 .setRemoteUri("udp4://233.252.0.4:6363")
1119 .setLocalUri("udp4://192.0.2.1:6363")
1120 .setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL)
1121 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERMANENT)
1122 .setLinkType(ndn::nfd::LINK_TYPE_MULTI_ACCESS)
1123 .setNInInterests(22562)
Junxiao Shif03d4792017-04-06 16:41:22 +00001124 .setNInData(22031)
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001125 .setNInNacks(63)
1126 .setNOutInterests(30121)
Junxiao Shif03d4792017-04-06 16:41:22 +00001127 .setNOutData(20940)
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001128 .setNOutNacks(1218)
1129 .setNInBytes(2522915)
1130 .setNOutBytes(1353592);
1131 FaceStatus payload2;
1132 payload2.setFaceId(745)
1133 .setRemoteUri("fd://75")
1134 .setLocalUri("unix:///var/run/nfd.sock")
1135 .setFaceScope(ndn::nfd::FACE_SCOPE_LOCAL)
1136 .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND)
1137 .setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT)
Eric Newberryde332452018-01-30 11:45:32 -07001138 .setBaseCongestionMarkingInterval(100_ms)
1139 .setDefaultCongestionThreshold(65536)
Eric Newberry4f8dd962018-06-17 21:32:07 -07001140 .setMtu(8800)
Eric Newberry6d932e82016-11-24 05:05:43 +00001141 .setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, true)
Eric Newberry84d3adc2017-08-09 23:31:40 -04001142 .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, true)
Eric Newberryde332452018-01-30 11:45:32 -07001143 .setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, true)
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001144 .setNInInterests(18998)
Junxiao Shif03d4792017-04-06 16:41:22 +00001145 .setNInData(26701)
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001146 .setNInNacks(147)
1147 .setNOutInterests(34779)
Junxiao Shif03d4792017-04-06 16:41:22 +00001148 .setNOutData(17028)
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001149 .setNOutNacks(1176)
1150 .setNInBytes(4672308)
1151 .setNOutBytes(8957187);
1152 this->sendDataset("/localhost/nfd/faces/list", payload1, payload2);
1153 this->prepareStatusOutput();
1154
1155 BOOST_CHECK(statusXml.is_equal(STATUS_XML));
1156 BOOST_CHECK(statusText.is_equal(STATUS_TEXT));
1157}
1158
1159BOOST_AUTO_TEST_SUITE_END() // TestFaceModule
Junxiao Shi331ade72016-08-19 14:07:19 +00001160BOOST_AUTO_TEST_SUITE_END() // Nfdc
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001161
Davide Pesaventoe422f9e2022-06-03 01:30:23 -04001162} // namespace nfd::tools::nfdc::tests