blob: 537e9ee8bd4795c14838f5077c2a4893c04f1394 [file] [log] [blame]
Alexander Afanasyevc169a812014-05-20 20:37:29 -04001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Junxiao Shi22f85682018-01-22 19:23:22 +00002/*
3 * Copyright (c) 2013-2018 Regents of the University of California.
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07004 *
5 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07006 *
Alexander Afanasyevc169a812014-05-20 20:37:29 -04007 * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU Lesser General Public License as published by the Free Software
9 * Foundation, either version 3 of the License, or (at your option) any later version.
10 *
11 * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14 *
15 * You should have received copies of the GNU General Public License and GNU Lesser
16 * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
Junxiao Shi5ec80222014-03-25 20:08:05 -070020 */
21
Junxiao Shi7357ef22016-09-07 02:39:37 +000022#include "mgmt/nfd/control-command.hpp"
Junxiao Shi5ec80222014-03-25 20:08:05 -070023
Alexander Afanasyevb1db7c62014-04-03 14:57:25 -070024#include "boost-test.hpp"
Junxiao Shi5ec80222014-03-25 20:08:05 -070025
26namespace ndn {
27namespace nfd {
Spyridon Mastorakis429634f2015-02-19 17:35:33 -080028namespace tests {
Junxiao Shi5ec80222014-03-25 20:08:05 -070029
Junxiao Shi7357ef22016-09-07 02:39:37 +000030BOOST_AUTO_TEST_SUITE(Mgmt)
31BOOST_AUTO_TEST_SUITE(Nfd)
32BOOST_AUTO_TEST_SUITE(TestControlCommand)
Junxiao Shi5ec80222014-03-25 20:08:05 -070033
Junxiao Shi8c2ab2e2017-05-05 20:26:34 +000034BOOST_AUTO_TEST_CASE(FaceCreateRequest)
Junxiao Shi5ec80222014-03-25 20:08:05 -070035{
36 FaceCreateCommand command;
Junxiao Shi5ec80222014-03-25 20:08:05 -070037
Junxiao Shi8c2ab2e2017-05-05 20:26:34 +000038 // good with required fields only
Junxiao Shi5ec80222014-03-25 20:08:05 -070039 ControlParameters p1;
Junxiao Shi8c2ab2e2017-05-05 20:26:34 +000040 p1.setUri("tcp4://192.0.2.1:6363");
41 BOOST_CHECK_NO_THROW(command.validateRequest(p1));
42 BOOST_CHECK(Name("/PREFIX/faces/create").isPrefixOf(command.getRequestName("/PREFIX", p1)));
Junxiao Shi5ec80222014-03-25 20:08:05 -070043
Junxiao Shi8c2ab2e2017-05-05 20:26:34 +000044 // good with optional fields
45 ControlParameters p2(p1);
46 p2.setLocalUri("tcp4://192.0.2.2:32114")
47 .setFacePersistency(FACE_PERSISTENCY_PERMANENT)
Eric Newberryda916d62016-08-11 23:04:34 -070048 .setFlags(0x3)
49 .setMask(0x1);
Junxiao Shi8c2ab2e2017-05-05 20:26:34 +000050 BOOST_CHECK_NO_THROW(command.validateRequest(p1));
Yukai Tud93c5fc2015-08-25 11:37:16 +080051
Junxiao Shi8c2ab2e2017-05-05 20:26:34 +000052 // Uri is required
53 ControlParameters p3;
54 BOOST_CHECK_THROW(command.validateRequest(p3), ControlCommand::ArgumentError);
55
56 // Name is forbidden
57 ControlParameters p4(p1);
58 p4.setName("/example");
59 BOOST_CHECK_THROW(command.validateRequest(p4), ControlCommand::ArgumentError);
60
61 // Flags and Mask must be specified together
62 ControlParameters p5(p1);
63 p5.setFlags(0x3);
64 BOOST_CHECK_THROW(command.validateRequest(p5), ControlCommand::ArgumentError);
65
66 ControlParameters p6(p1);
67 p6.setMask(0x1);
68 BOOST_CHECK_THROW(command.validateRequest(p6), ControlCommand::ArgumentError);
69}
70
71BOOST_AUTO_TEST_CASE(FaceCreateResponse)
72{
73 FaceCreateCommand command;
74
75 // good
76 ControlParameters p1;
77 p1.setFaceId(3208)
Junxiao Shi144c7e32017-04-20 01:04:06 +000078 .setUri("tcp4://192.0.2.1:6363")
79 .setLocalUri("tcp4://192.0.2.2:32114")
80 .setFacePersistency(FACE_PERSISTENCY_PERMANENT)
Junxiao Shi8c2ab2e2017-05-05 20:26:34 +000081 .setFlags(0x3);
82 BOOST_CHECK_NO_THROW(command.validateResponse(p1));
Eric Newberryda916d62016-08-11 23:04:34 -070083
Junxiao Shi8c2ab2e2017-05-05 20:26:34 +000084 // Name is forbidden
85 ControlParameters p2(p1);
86 p2.setName("/example");
87 BOOST_CHECK_THROW(command.validateResponse(p2), ControlCommand::ArgumentError);
Yukai Tud93c5fc2015-08-25 11:37:16 +080088
Junxiao Shi8c2ab2e2017-05-05 20:26:34 +000089 // Mask is forbidden
90 ControlParameters p3(p1);
91 p3.setMask(0x1);
92 BOOST_CHECK_THROW(command.validateResponse(p3), ControlCommand::ArgumentError);
Eric Newberryda916d62016-08-11 23:04:34 -070093
Junxiao Shi8c2ab2e2017-05-05 20:26:34 +000094 // FaceId must be valid
95 ControlParameters p4(p1);
96 p4.setFaceId(INVALID_FACE_ID);
97 BOOST_CHECK_THROW(command.validateResponse(p4), ControlCommand::ArgumentError);
Eric Newberryda916d62016-08-11 23:04:34 -070098
Junxiao Shi8c2ab2e2017-05-05 20:26:34 +000099 // LocalUri is required
100 ControlParameters p5(p1);
101 p5.unsetLocalUri();
102 BOOST_CHECK_THROW(command.validateResponse(p5), ControlCommand::ArgumentError);
Junxiao Shi5ec80222014-03-25 20:08:05 -0700103}
104
Yanbiao Licbdacb22016-08-02 16:02:35 +0800105BOOST_AUTO_TEST_CASE(FaceUpdate)
106{
107 FaceUpdateCommand command;
108
109 ControlParameters p1;
110 p1.setFaceId(0);
Eric Newberryda916d62016-08-11 23:04:34 -0700111 BOOST_CHECK_NO_THROW(command.validateRequest(p1));
Davide Pesaventof8503d22017-02-17 01:19:10 -0500112 p1.setFaceId(INVALID_FACE_ID);
Eric Newberry138ef2c2016-08-15 20:29:03 -0700113 BOOST_CHECK_THROW(command.validateResponse(p1), ControlCommand::ArgumentError);
Yanbiao Licbdacb22016-08-02 16:02:35 +0800114
115 p1.setFaceId(1);
116 BOOST_CHECK_NO_THROW(command.validateRequest(p1));
Eric Newberry138ef2c2016-08-15 20:29:03 -0700117 BOOST_CHECK_THROW(command.validateResponse(p1), ControlCommand::ArgumentError);
118 command.applyDefaultsToRequest(p1);
119 BOOST_CHECK_EQUAL(p1.getFaceId(), 1);
Yanbiao Licbdacb22016-08-02 16:02:35 +0800120
121 ControlParameters p2;
122 p2.setFaceId(1)
Eric Newberry138ef2c2016-08-15 20:29:03 -0700123 .setFacePersistency(FACE_PERSISTENCY_PERSISTENT)
124 .setFlagBit(BIT_LOCAL_FIELDS_ENABLED, false);
Yanbiao Licbdacb22016-08-02 16:02:35 +0800125 BOOST_CHECK_NO_THROW(command.validateRequest(p2));
Eric Newberry138ef2c2016-08-15 20:29:03 -0700126 BOOST_CHECK_THROW(command.validateResponse(p2), ControlCommand::ArgumentError); // Mask forbidden but present
Yanbiao Licbdacb22016-08-02 16:02:35 +0800127
Eric Newberry138ef2c2016-08-15 20:29:03 -0700128 // Flags without Mask
Eric Newberryda916d62016-08-11 23:04:34 -0700129 p2.unsetMask();
130 BOOST_CHECK_THROW(command.validateRequest(p2), ControlCommand::ArgumentError);
Eric Newberry138ef2c2016-08-15 20:29:03 -0700131 BOOST_CHECK_NO_THROW(command.validateResponse(p2));
132
133 p2.setFlagBit(BIT_LOCAL_FIELDS_ENABLED, false);
134 p2.unsetFaceId();
135 BOOST_CHECK_NO_THROW(command.validateRequest(p2));
Eric Newberryda916d62016-08-11 23:04:34 -0700136
Yanbiao Licbdacb22016-08-02 16:02:35 +0800137 ControlParameters p3;
Eric Newberryda916d62016-08-11 23:04:34 -0700138 p3.setFaceId(1)
139 .setName("/ndn/name");
Yanbiao Licbdacb22016-08-02 16:02:35 +0800140 BOOST_CHECK_THROW(command.validateRequest(p3), ControlCommand::ArgumentError);
141 BOOST_CHECK_THROW(command.validateResponse(p3), ControlCommand::ArgumentError);
142
143 ControlParameters p4;
144 p4.setFaceId(1)
Eric Newberryda916d62016-08-11 23:04:34 -0700145 .setUri("tcp4://192.0.2.1");
Yanbiao Licbdacb22016-08-02 16:02:35 +0800146 BOOST_CHECK_THROW(command.validateRequest(p4), ControlCommand::ArgumentError);
147 BOOST_CHECK_THROW(command.validateResponse(p4), ControlCommand::ArgumentError);
148
149 ControlParameters p5;
Eric Newberry138ef2c2016-08-15 20:29:03 -0700150 BOOST_CHECK_NO_THROW(command.validateRequest(p5));
151 BOOST_CHECK_THROW(command.validateResponse(p5), ControlCommand::ArgumentError);
152 BOOST_CHECK(!p5.hasFaceId());
153 command.applyDefaultsToRequest(p5);
154 BOOST_REQUIRE(p5.hasFaceId());
155 BOOST_CHECK_NO_THROW(command.validateRequest(p5));
156 BOOST_CHECK_THROW(command.validateResponse(p5), ControlCommand::ArgumentError);
157 BOOST_CHECK_EQUAL(p5.getFaceId(), 0);
Yanbiao Licbdacb22016-08-02 16:02:35 +0800158}
159
Junxiao Shi5ec80222014-03-25 20:08:05 -0700160BOOST_AUTO_TEST_CASE(FaceDestroy)
161{
162 FaceDestroyCommand command;
Junxiao Shi5ec80222014-03-25 20:08:05 -0700163
164 ControlParameters p1;
165 p1.setUri("tcp4://192.0.2.1")
166 .setFaceId(4);
167 BOOST_CHECK_THROW(command.validateRequest(p1), ControlCommand::ArgumentError);
168 BOOST_CHECK_THROW(command.validateResponse(p1), ControlCommand::ArgumentError);
169
170 ControlParameters p2;
Davide Pesaventof8503d22017-02-17 01:19:10 -0500171 p2.setFaceId(INVALID_FACE_ID);
Junxiao Shi5ec80222014-03-25 20:08:05 -0700172 BOOST_CHECK_THROW(command.validateRequest(p2), ControlCommand::ArgumentError);
173 BOOST_CHECK_THROW(command.validateResponse(p2), ControlCommand::ArgumentError);
174
175 ControlParameters p3;
176 p3.setFaceId(6);
177 BOOST_CHECK_NO_THROW(command.validateRequest(p3));
178 BOOST_CHECK_NO_THROW(command.validateResponse(p3));
Junxiao Shi5de006b2014-10-26 20:20:52 -0700179 Name n3;
180 BOOST_CHECK_NO_THROW(n3 = command.getRequestName("/PREFIX", p3));
181 BOOST_CHECK(Name("ndn:/PREFIX/faces/destroy").isPrefixOf(n3));
Junxiao Shi5ec80222014-03-25 20:08:05 -0700182}
183
Junxiao Shi5ec80222014-03-25 20:08:05 -0700184BOOST_AUTO_TEST_CASE(FibAddNextHop)
185{
186 FibAddNextHopCommand command;
Junxiao Shi5ec80222014-03-25 20:08:05 -0700187
188 ControlParameters p1;
189 p1.setName("ndn:/")
190 .setFaceId(22);
191 BOOST_CHECK_NO_THROW(command.validateRequest(p1));
192 BOOST_CHECK_THROW(command.validateResponse(p1), ControlCommand::ArgumentError);
Junxiao Shi5de006b2014-10-26 20:20:52 -0700193 Name n1;
194 BOOST_CHECK_NO_THROW(n1 = command.getRequestName("/PREFIX", p1));
195 BOOST_CHECK(Name("ndn:/PREFIX/fib/add-nexthop").isPrefixOf(n1));
Junxiao Shi5ec80222014-03-25 20:08:05 -0700196
197 ControlParameters p2;
198 p2.setName("ndn:/example")
199 .setFaceId(0)
200 .setCost(6);
201 BOOST_CHECK_NO_THROW(command.validateRequest(p2));
Davide Pesaventof8503d22017-02-17 01:19:10 -0500202 p2.setFaceId(INVALID_FACE_ID);
Junxiao Shi5ec80222014-03-25 20:08:05 -0700203 BOOST_CHECK_THROW(command.validateResponse(p2), ControlCommand::ArgumentError);
204
205 command.applyDefaultsToRequest(p1);
206 BOOST_REQUIRE(p1.hasCost());
207 BOOST_CHECK_EQUAL(p1.getCost(), 0);
Junxiao Shicaac54e2014-05-20 15:27:01 -0700208
209 p1.unsetFaceId();
210 BOOST_CHECK_NO_THROW(command.validateRequest(p1));
211 command.applyDefaultsToRequest(p1);
212 BOOST_REQUIRE(p1.hasFaceId());
213 BOOST_CHECK_EQUAL(p1.getFaceId(), 0);
Junxiao Shi5ec80222014-03-25 20:08:05 -0700214}
215
216BOOST_AUTO_TEST_CASE(FibRemoveNextHop)
217{
218 FibRemoveNextHopCommand command;
Junxiao Shi5ec80222014-03-25 20:08:05 -0700219
220 ControlParameters p1;
221 p1.setName("ndn:/")
222 .setFaceId(22);
223 BOOST_CHECK_NO_THROW(command.validateRequest(p1));
224 BOOST_CHECK_NO_THROW(command.validateResponse(p1));
Junxiao Shi5de006b2014-10-26 20:20:52 -0700225 Name n1;
226 BOOST_CHECK_NO_THROW(n1 = command.getRequestName("/PREFIX", p1));
227 BOOST_CHECK(Name("ndn:/PREFIX/fib/remove-nexthop").isPrefixOf(n1));
Junxiao Shi5ec80222014-03-25 20:08:05 -0700228
229 ControlParameters p2;
230 p2.setName("ndn:/example")
231 .setFaceId(0);
232 BOOST_CHECK_NO_THROW(command.validateRequest(p2));
Davide Pesaventof8503d22017-02-17 01:19:10 -0500233 p2.setFaceId(INVALID_FACE_ID);
Junxiao Shi5ec80222014-03-25 20:08:05 -0700234 BOOST_CHECK_THROW(command.validateResponse(p2), ControlCommand::ArgumentError);
Junxiao Shicaac54e2014-05-20 15:27:01 -0700235
236 p1.unsetFaceId();
237 BOOST_CHECK_NO_THROW(command.validateRequest(p1));
238 command.applyDefaultsToRequest(p1);
239 BOOST_REQUIRE(p1.hasFaceId());
240 BOOST_CHECK_EQUAL(p1.getFaceId(), 0);
Junxiao Shi5ec80222014-03-25 20:08:05 -0700241}
242
Junxiao Shi22f85682018-01-22 19:23:22 +0000243BOOST_AUTO_TEST_CASE(CsConfigRequest)
244{
245 CsConfigCommand command;
246
247 // good empty request
248 ControlParameters p1;
249 command.validateRequest(p1);
250 BOOST_CHECK(Name("/PREFIX/cs/config").isPrefixOf(command.getRequestName("/PREFIX", p1)));
251
252 // good full request
253 ControlParameters p2;
254 p2.setCapacity(1574);
255 p2.setFlagBit(BIT_CS_ENABLE_ADMIT, true);
256 p2.setFlagBit(BIT_CS_ENABLE_SERVE, true);
257 command.validateRequest(p2);
258
259 // bad request: Flags but no Mask
260 ControlParameters p3(p2);
261 p3.unsetMask();
262 BOOST_CHECK_THROW(command.validateRequest(p3), ControlCommand::ArgumentError);
263
264 // bad request: Mask but no Flags
265 ControlParameters p4(p2);
266 p4.unsetFlags();
267 BOOST_CHECK_THROW(command.validateRequest(p4), ControlCommand::ArgumentError);
268
269 // bad request: forbidden field
270 ControlParameters p5(p2);
271 p5.setName("/example");
272 BOOST_CHECK_THROW(command.validateRequest(p5), ControlCommand::ArgumentError);
273}
274
275BOOST_AUTO_TEST_CASE(CsConfigResponse)
276{
277 CsConfigCommand command;
278
279 // bad empty response
280 ControlParameters p1;
281 BOOST_CHECK_THROW(command.validateResponse(p1), ControlCommand::ArgumentError);
282
283 // bad response: Mask not allowed
284 ControlParameters p2;
285 p2.setCapacity(1574);
286 p2.setFlagBit(BIT_CS_ENABLE_ADMIT, true);
287 p2.setFlagBit(BIT_CS_ENABLE_SERVE, true);
288 BOOST_CHECK_THROW(command.validateResponse(p2), ControlCommand::ArgumentError);
289
290 // good response
291 ControlParameters p3(p2);
292 p3.unsetMask();
293 command.validateResponse(p3);
294}
295
Junxiao Shi5ec80222014-03-25 20:08:05 -0700296BOOST_AUTO_TEST_CASE(StrategyChoiceSet)
297{
298 StrategyChoiceSetCommand command;
Junxiao Shi5ec80222014-03-25 20:08:05 -0700299
300 ControlParameters p1;
301 p1.setName("ndn:/")
302 .setStrategy("ndn:/strategy/P");
303 BOOST_CHECK_NO_THROW(command.validateRequest(p1));
304 BOOST_CHECK_NO_THROW(command.validateResponse(p1));
Junxiao Shi5de006b2014-10-26 20:20:52 -0700305 Name n1;
306 BOOST_CHECK_NO_THROW(n1 = command.getRequestName("/PREFIX", p1));
307 BOOST_CHECK(Name("ndn:/PREFIX/strategy-choice/set").isPrefixOf(n1));
Junxiao Shi5ec80222014-03-25 20:08:05 -0700308
309 ControlParameters p2;
310 p2.setName("ndn:/example");
311 BOOST_CHECK_THROW(command.validateRequest(p2), ControlCommand::ArgumentError);
312 BOOST_CHECK_THROW(command.validateResponse(p2), ControlCommand::ArgumentError);
313}
314
315BOOST_AUTO_TEST_CASE(StrategyChoiceUnset)
316{
317 StrategyChoiceUnsetCommand command;
Junxiao Shi5ec80222014-03-25 20:08:05 -0700318
319 ControlParameters p1;
320 p1.setName("ndn:/example");
321 BOOST_CHECK_NO_THROW(command.validateRequest(p1));
322 BOOST_CHECK_NO_THROW(command.validateResponse(p1));
Junxiao Shi5de006b2014-10-26 20:20:52 -0700323 Name n1;
324 BOOST_CHECK_NO_THROW(n1 = command.getRequestName("/PREFIX", p1));
325 BOOST_CHECK(Name("ndn:/PREFIX/strategy-choice/unset").isPrefixOf(n1));
Junxiao Shi5ec80222014-03-25 20:08:05 -0700326
327 ControlParameters p2;
328 p2.setName("ndn:/example")
329 .setStrategy("ndn:/strategy/P");
330 BOOST_CHECK_THROW(command.validateRequest(p2), ControlCommand::ArgumentError);
331 BOOST_CHECK_THROW(command.validateResponse(p2), ControlCommand::ArgumentError);
332
333 ControlParameters p3;
334 p3.setName("ndn:/");
335 BOOST_CHECK_THROW(command.validateRequest(p3), ControlCommand::ArgumentError);
336 BOOST_CHECK_THROW(command.validateResponse(p3), ControlCommand::ArgumentError);
337}
338
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700339BOOST_AUTO_TEST_CASE(RibRegister)
340{
341 RibRegisterCommand command;
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700342
343 ControlParameters p1;
344 p1.setName("ndn:/");
345 BOOST_CHECK_NO_THROW(command.validateRequest(p1));
346 BOOST_CHECK_THROW(command.validateResponse(p1), ControlCommand::ArgumentError);
Junxiao Shi5de006b2014-10-26 20:20:52 -0700347 Name n1;
348 BOOST_CHECK_NO_THROW(n1 = command.getRequestName("/PREFIX", p1));
349 BOOST_CHECK(Name("ndn:/PREFIX/rib/register").isPrefixOf(n1));
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700350
351 command.applyDefaultsToRequest(p1);
352 BOOST_REQUIRE(p1.hasOrigin());
Davide Pesaventoe8e48c22017-04-13 00:35:33 -0400353 BOOST_CHECK_EQUAL(p1.getOrigin(), ROUTE_ORIGIN_APP);
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700354 BOOST_REQUIRE(p1.hasCost());
355 BOOST_CHECK_EQUAL(p1.getCost(), 0);
356 BOOST_REQUIRE(p1.hasFlags());
357 BOOST_CHECK_EQUAL(p1.getFlags(), static_cast<uint64_t>(ROUTE_FLAG_CHILD_INHERIT));
Alexander Afanasyev21f13b02014-07-17 16:17:34 -0700358 BOOST_CHECK_EQUAL(p1.hasExpirationPeriod(), false);
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700359
360 ControlParameters p2;
361 p2.setName("ndn:/example")
362 .setFaceId(2)
363 .setCost(6);
364 BOOST_CHECK_NO_THROW(command.validateRequest(p2));
365 command.applyDefaultsToRequest(p2);
Alexander Afanasyev21f13b02014-07-17 16:17:34 -0700366 BOOST_CHECK_EQUAL(p2.hasExpirationPeriod(), false);
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700367 BOOST_CHECK_NO_THROW(command.validateResponse(p2));
368}
369
370BOOST_AUTO_TEST_CASE(RibUnregister)
371{
372 RibUnregisterCommand command;
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700373
374 ControlParameters p1;
375 p1.setName("ndn:/")
376 .setFaceId(22)
377 .setOrigin(ROUTE_ORIGIN_STATIC);
378 BOOST_CHECK_NO_THROW(command.validateRequest(p1));
379 BOOST_CHECK_NO_THROW(command.validateResponse(p1));
Junxiao Shi5de006b2014-10-26 20:20:52 -0700380 Name n1;
381 BOOST_CHECK_NO_THROW(n1 = command.getRequestName("/PREFIX", p1));
382 BOOST_CHECK(Name("ndn:/PREFIX/rib/unregister").isPrefixOf(n1));
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700383
384 ControlParameters p2;
385 p2.setName("ndn:/example")
386 .setFaceId(0)
387 .setOrigin(ROUTE_ORIGIN_APP);
388 BOOST_CHECK_NO_THROW(command.validateRequest(p2));
Davide Pesaventof8503d22017-02-17 01:19:10 -0500389 p2.setFaceId(INVALID_FACE_ID);
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700390 BOOST_CHECK_THROW(command.validateResponse(p2), ControlCommand::ArgumentError);
391
392 p2.unsetFaceId();
393 BOOST_CHECK_NO_THROW(command.validateRequest(p2));
394 BOOST_CHECK_THROW(command.validateResponse(p2), ControlCommand::ArgumentError);
395}
396
Junxiao Shi7357ef22016-09-07 02:39:37 +0000397BOOST_AUTO_TEST_SUITE_END() // TestControlCommand
398BOOST_AUTO_TEST_SUITE_END() // Nfd
399BOOST_AUTO_TEST_SUITE_END() // Mgmt
Junxiao Shi5ec80222014-03-25 20:08:05 -0700400
Spyridon Mastorakis429634f2015-02-19 17:35:33 -0800401} // namespace tests
Junxiao Shi5ec80222014-03-25 20:08:05 -0700402} // namespace nfd
403} // namespace ndn