blob: 2d5958d3a8098152dc6171ec740d0444c8664bde [file] [log] [blame]
akmhoque3d06e792014-05-27 16:23:20 -05001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -05002/**
Ashlesh Gawande7e3f6d72019-01-25 13:13:43 -06003 * Copyright (c) 2014-2019, The University of Memphis,
Vince Lehmanc2e51f62015-01-20 15:03:11 -06004 * Regents of the University of California,
5 * Arizona Board of Regents.
akmhoque3d06e792014-05-27 16:23:20 -05006 *
7 * This file is part of NLSR (Named-data Link State Routing).
8 * See AUTHORS.md for complete list of NLSR authors and contributors.
9 *
10 * NLSR is free software: you can redistribute it and/or modify it under the terms
11 * of the GNU General Public License as published by the Free Software Foundation,
12 * either version 3 of the License, or (at your option) any later version.
13 *
14 * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 * PURPOSE. See the GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along with
19 * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
akmhoque3d06e792014-05-27 16:23:20 -050020 **/
Vince Lehman7c603292014-09-11 17:48:16 -050021
Nick Gordonff9a6272017-10-12 13:38:29 -050022#include "conf-file-processor.hpp"
Vince Lehman7c603292014-09-11 17:48:16 -050023#include "test-common.hpp"
Muktadir R Chowdhurybfa27602014-10-31 10:57:41 -050024
Nick Gordonff9a6272017-10-12 13:38:29 -050025#include <fstream>
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050026
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -050027#include <boost/test/unit_test.hpp>
Muktadir R Chowdhurybfa27602014-10-31 10:57:41 -050028#include <boost/filesystem.hpp>
29#include <boost/algorithm/string.hpp>
Muktadir R Chowdhuryc69da0a2015-12-18 13:24:38 -060030#include <ndn-cxx/util/dummy-client-face.hpp>
31
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -050032namespace nlsr {
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -050033namespace test {
34
dmcoomes9f936662017-03-02 10:33:09 -060035using std::shared_ptr;
Vince Lehman904c2412014-09-23 19:36:11 -050036
Vince Lehman7b616582014-10-17 16:25:39 -050037const std::string SECTION_GENERAL =
38 "general\n"
39 "{\n"
40 " network /ndn/\n"
41 " site /memphis.edu/\n"
42 " router /cs/pollux/\n"
43 " lsa-refresh-time 1800\n"
44 " lsa-interest-lifetime 3\n"
Alexander Afanasyev1cf1e102014-08-17 19:47:57 -070045 " router-dead-interval 86400\n"
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -050046 " sync-protocol psync\n"
Ashlesh Gawandef7da9c52018-02-06 17:36:46 -060047 " sync-interest-lifetime 10000\n"
dulalsaurab82a34c22019-02-04 17:31:21 +000048 " state-dir /tmp\n"
Vince Lehman7b616582014-10-17 16:25:39 -050049 "}\n\n";
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -050050
Vince Lehman7b616582014-10-17 16:25:39 -050051const std::string SECTION_NEIGHBORS =
52 "neighbors\n"
53 "{\n"
54 " hello-retries 3\n"
55 " hello-timeout 1\n"
56 " hello-interval 60\n\n"
57 " adj-lsa-build-interval 3\n"
58 " first-hello-interval 6\n"
59 " neighbor\n"
60 " {\n"
61 " name /ndn/memphis.edu/cs/castor\n"
Ashlesh Gawande7e3f6d72019-01-25 13:13:43 -060062 " face-uri udp://10.0.0.1\n"
Vince Lehman7b616582014-10-17 16:25:39 -050063 " link-cost 20\n"
64 " }\n\n"
65 " neighbor\n"
66 " {\n"
67 " name /ndn/memphis.edu/cs/mira\n"
Ashlesh Gawande7e3f6d72019-01-25 13:13:43 -060068 " face-uri udp://10.0.0.2\n"
Vince Lehman7b616582014-10-17 16:25:39 -050069 " link-cost 30\n"
70 " }\n"
71 "}\n\n";
72
73const std::string SECTION_HYPERBOLIC_ON =
74 "hyperbolic\n"
75 "{\n"
76 " state on\n"
77 " radius 123.456\n"
78 " angle 1.45\n"
79 "}\n\n";
80
Muktadir R Chowdhuryb00dc2a2016-11-05 10:48:58 -060081const std::string SECTION_HYPERBOLIC_ANGLES_ON =
82 "hyperbolic\n"
83 "{\n"
84 " state on\n"
85 " radius 123.456\n"
86 " angle 1.45,2.25\n"
87 "}\n\n";
88
Vince Lehman7b616582014-10-17 16:25:39 -050089const std::string SECTION_HYPERBOLIC_OFF =
90 "hyperbolic\n"
91 "{\n"
92 " state off\n"
93 " radius 123.456\n"
94 " angle 1.45\n"
95 "}\n\n";
96
97const std::string SECTION_FIB =
98 "fib\n"
99 "{\n"
100 " max-faces-per-prefix 3\n"
101 " routing-calc-interval 9\n"
102 "}\n\n";
103
104const std::string SECTION_ADVERTISING =
105 "advertising\n"
106 "{\n"
107 " prefix /ndn/edu/memphis/cs/netlab\n"
108 " prefix /ndn/edu/memphis/sports/basketball\n"
109 "}\n";
110
Ashlesh Gawande85998a12017-12-07 22:22:13 -0600111// NEED TO TEST SECURITY SECTION SUCH AS LOADING CERTIFICATE
112
Vince Lehman7b616582014-10-17 16:25:39 -0500113const std::string CONFIG_LINK_STATE = SECTION_GENERAL + SECTION_NEIGHBORS +
114 SECTION_HYPERBOLIC_OFF + SECTION_FIB + SECTION_ADVERTISING;
115
116const std::string CONFIG_HYPERBOLIC = SECTION_GENERAL + SECTION_NEIGHBORS +
117 SECTION_HYPERBOLIC_ON + SECTION_FIB + SECTION_ADVERTISING;
118
Muktadir R Chowdhuryb00dc2a2016-11-05 10:48:58 -0600119const std::string CONFIG_HYPERBOLIC_ANGLES = SECTION_GENERAL + SECTION_NEIGHBORS +
120 SECTION_HYPERBOLIC_ANGLES_ON + SECTION_FIB +
121 SECTION_ADVERTISING;
122
Vince Lehman7b616582014-10-17 16:25:39 -0500123class ConfFileProcessorFixture : public BaseFixture
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -0500124{
Vince Lehman7b616582014-10-17 16:25:39 -0500125public:
126 ConfFileProcessorFixture()
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -0500127 : face(m_ioService, m_keyChain)
Ashlesh Gawande85998a12017-12-07 22:22:13 -0600128 , conf(face, "unit-test-nlsr.conf")
Vince Lehman7b616582014-10-17 16:25:39 -0500129 {
130 }
Vince Lehman904c2412014-09-23 19:36:11 -0500131
Vince Lehman7b616582014-10-17 16:25:39 -0500132 ~ConfFileProcessorFixture()
133 {
134 remove("unit-test-nlsr.conf");
135 }
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -0500136
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -0500137 bool
138 processConfigurationString(std::string confString)
Vince Lehman7b616582014-10-17 16:25:39 -0500139 {
140 std::ofstream config;
141 config.open("unit-test-nlsr.conf");
142 config << confString;
143 config.close();
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -0500144
Ashlesh Gawande85998a12017-12-07 22:22:13 -0600145 ConfFileProcessor processor(conf);
Vince Lehman7b616582014-10-17 16:25:39 -0500146 return processor.processConfFile();
147 }
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -0500148
Muktadir R Chowdhurybfa27602014-10-31 10:57:41 -0500149 void
alvya2228c62014-12-09 10:25:11 -0600150 commentOut(const std::string& key, std::string& config)
151 {
152 boost::replace_all(config, key, ";" + key);
153 }
154
Vince Lehman7b616582014-10-17 16:25:39 -0500155public:
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -0500156 ndn::util::DummyClientFace face;
Ashlesh Gawande85998a12017-12-07 22:22:13 -0600157 ConfParameter conf;
Vince Lehman7b616582014-10-17 16:25:39 -0500158};
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -0500159
Vince Lehman7b616582014-10-17 16:25:39 -0500160BOOST_FIXTURE_TEST_SUITE(TestConfFileProcessor, ConfFileProcessorFixture)
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -0500161
Vince Lehman7b616582014-10-17 16:25:39 -0500162BOOST_AUTO_TEST_CASE(LinkState)
163{
164 processConfigurationString(CONFIG_LINK_STATE);
Vince Lehman7b616582014-10-17 16:25:39 -0500165 conf.buildRouterPrefix();
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -0500166
Vince Lehman7b616582014-10-17 16:25:39 -0500167 // General
168 BOOST_CHECK_EQUAL(conf.getNetwork(), "/ndn/");
169 BOOST_CHECK_EQUAL(conf.getSiteName(), "/memphis.edu/");
170 BOOST_CHECK_EQUAL(conf.getRouterName(), "/cs/pollux/");
171 BOOST_CHECK_EQUAL(conf.getRouterPrefix(), "/ndn/memphis.edu/cs/pollux/");
Ashlesh Gawande85998a12017-12-07 22:22:13 -0600172 BOOST_CHECK_EQUAL(conf.getSyncPrefix(), ndn::Name("/localhop/ndn/nlsr/sync").appendVersion(ConfParameter::SYNC_VERSION));
Ashlesh Gawandecba0ae22018-03-27 17:57:56 -0500173 BOOST_CHECK_EQUAL(conf.getLsaPrefix(), "/localhop/ndn/nlsr/LSA");
Vince Lehman7b616582014-10-17 16:25:39 -0500174 BOOST_CHECK_EQUAL(conf.getLsaRefreshTime(), 1800);
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -0500175 BOOST_CHECK_EQUAL(conf.getSyncProtocol(), SYNC_PROTOCOL_PSYNC);
Vince Lehman7b616582014-10-17 16:25:39 -0500176 BOOST_CHECK_EQUAL(conf.getLsaInterestLifetime(), ndn::time::seconds(3));
Alexander Afanasyev1cf1e102014-08-17 19:47:57 -0700177 BOOST_CHECK_EQUAL(conf.getRouterDeadInterval(), 86400);
Ashlesh Gawandef7da9c52018-02-06 17:36:46 -0600178 BOOST_CHECK_EQUAL(conf.getSyncInterestLifetime(), ndn::time::milliseconds(10000));
dulalsaurab82a34c22019-02-04 17:31:21 +0000179 BOOST_CHECK_EQUAL(conf.getStateFileDir(), "/tmp");
Alexander Afanasyev411ee4b2014-08-16 23:17:03 -0700180
Vince Lehman7b616582014-10-17 16:25:39 -0500181 // Neighbors
182 BOOST_CHECK_EQUAL(conf.getInterestRetryNumber(), 3);
183 BOOST_CHECK_EQUAL(conf.getInterestResendTime(), 1);
184 BOOST_CHECK_EQUAL(conf.getInfoInterestInterval(), 60);
185
186 BOOST_CHECK_EQUAL(conf.getAdjLsaBuildInterval(), 3);
187 BOOST_CHECK_EQUAL(conf.getFirstHelloInterval(), 6);
188
Ashlesh Gawande85998a12017-12-07 22:22:13 -0600189 BOOST_CHECK(conf.getAdjacencyList().isNeighbor("/ndn/memphis.edu/cs/mira"));
190 BOOST_CHECK(conf.getAdjacencyList().isNeighbor("/ndn/memphis.edu/cs/castor"));
191 BOOST_CHECK(!conf.getAdjacencyList().isNeighbor("/ndn/memphis.edu/cs/fail"));
Vince Lehman7b616582014-10-17 16:25:39 -0500192
Ashlesh Gawande85998a12017-12-07 22:22:13 -0600193 Adjacent mira = conf.getAdjacencyList().getAdjacent("/ndn/memphis.edu/cs/mira");
Vince Lehman7b616582014-10-17 16:25:39 -0500194 BOOST_CHECK_EQUAL(mira.getName(), "/ndn/memphis.edu/cs/mira");
195 BOOST_CHECK_EQUAL(mira.getLinkCost(), 30);
Ashlesh Gawande7e3f6d72019-01-25 13:13:43 -0600196 BOOST_CHECK_EQUAL(mira.getFaceUri().toString(), "udp4://10.0.0.2:6363");
Vince Lehman7b616582014-10-17 16:25:39 -0500197
Ashlesh Gawande85998a12017-12-07 22:22:13 -0600198 Adjacent castor = conf.getAdjacencyList().getAdjacent("/ndn/memphis.edu/cs/castor");
Vince Lehman7b616582014-10-17 16:25:39 -0500199 BOOST_CHECK_EQUAL(castor.getName(), "/ndn/memphis.edu/cs/castor");
200 BOOST_CHECK_EQUAL(castor.getLinkCost(), 20);
Ashlesh Gawande7e3f6d72019-01-25 13:13:43 -0600201 BOOST_CHECK_EQUAL(castor.getFaceUri().toString(), "udp4://10.0.0.1:6363");
Vince Lehman7b616582014-10-17 16:25:39 -0500202
203 // Hyperbolic
204 BOOST_CHECK_EQUAL(conf.getHyperbolicState(), 0);
205
206 // FIB
207 BOOST_CHECK_EQUAL(conf.getMaxFacesPerPrefix(), 3);
208 BOOST_CHECK_EQUAL(conf.getRoutingCalcInterval(), 9);
209
210 // Advertising
Ashlesh Gawande85998a12017-12-07 22:22:13 -0600211 BOOST_CHECK_EQUAL(conf.getNamePrefixList().size(), 2);
Vince Lehman7b616582014-10-17 16:25:39 -0500212}
213
alvy2fe12872014-11-25 10:32:23 -0600214BOOST_AUTO_TEST_CASE(MalformedUri)
215{
216 const std::string MALFORMED_URI =
217 "neighbors\n"
218 "{\n"
219 " hello-retries 3\n"
220 " hello-timeout 1\n"
221 " hello-interval 60\n\n"
222 " adj-lsa-build-interval 3\n"
223 " first-hello-interval 6\n"
224 " neighbor\n"
225 " {\n"
226 " name /ndn/memphis.edu/cs/castor\n"
227 " face-uri udp4:malformed-uri\n"
228 " link-cost 20\n"
229 " }\n"
230 "}\n\n";
231
232 BOOST_CHECK_EQUAL(processConfigurationString(MALFORMED_URI), false);
233}
234
Vince Lehman7b616582014-10-17 16:25:39 -0500235BOOST_AUTO_TEST_CASE(Hyperbolic)
236{
237 processConfigurationString(CONFIG_HYPERBOLIC);
238
Vince Lehman7b616582014-10-17 16:25:39 -0500239 BOOST_CHECK_EQUAL(conf.getHyperbolicState(), 1);
240 BOOST_CHECK_EQUAL(conf.getCorR(), 123.456);
Muktadir R Chowdhuryb00dc2a2016-11-05 10:48:58 -0600241 std::vector<double> angles;
242 angles.push_back(1.45);
243 BOOST_CHECK(conf.getCorTheta() == angles);
244}
245
246BOOST_AUTO_TEST_CASE(Hyperbolic2)
247{
248 processConfigurationString(CONFIG_HYPERBOLIC_ANGLES);
249
Muktadir R Chowdhuryb00dc2a2016-11-05 10:48:58 -0600250 BOOST_CHECK_EQUAL(conf.getHyperbolicState(), 1);
251 BOOST_CHECK_EQUAL(conf.getCorR(), 123.456);
252 std::vector<double> angles;
253 angles.push_back(1.45);
254 angles.push_back(2.25);
255 BOOST_CHECK(conf.getCorTheta() == angles);
Vince Lehman7b616582014-10-17 16:25:39 -0500256}
257
alvya2228c62014-12-09 10:25:11 -0600258BOOST_AUTO_TEST_CASE(DefaultValuesGeneral)
Vince Lehman7b616582014-10-17 16:25:39 -0500259{
alvya2228c62014-12-09 10:25:11 -0600260 std::string config = SECTION_GENERAL;
Vince Lehman7b616582014-10-17 16:25:39 -0500261
alvya2228c62014-12-09 10:25:11 -0600262 commentOut("lsa-refresh-time", config);
263 commentOut("lsa-interest-lifetime", config);
264 commentOut("router-dead-interval", config);
265
266 BOOST_CHECK_EQUAL(processConfigurationString(config), true);
Vince Lehman7b616582014-10-17 16:25:39 -0500267
alvy5a454952014-12-15 12:49:54 -0600268 BOOST_CHECK_EQUAL(conf.getLsaRefreshTime(), static_cast<uint32_t>(LSA_REFRESH_TIME_DEFAULT));
alvya2228c62014-12-09 10:25:11 -0600269 BOOST_CHECK_EQUAL(conf.getLsaInterestLifetime(),
270 static_cast<ndn::time::seconds>(LSA_INTEREST_LIFETIME_DEFAULT));
271 BOOST_CHECK_EQUAL(conf.getRouterDeadInterval(), (2*conf.getLsaRefreshTime()));
272}
273
274BOOST_AUTO_TEST_CASE(DefaultValuesNeighbors)
275{
276 std::string config = SECTION_NEIGHBORS;
277
278 commentOut("hello-retries", config);
279 commentOut("hello-timeout", config);
280 commentOut("hello-interval", config);
281 commentOut("first-hello-interval", config);
282 commentOut("adj-lsa-build-interval", config);
283
284 BOOST_CHECK_EQUAL(processConfigurationString(config), true);
285
alvya2228c62014-12-09 10:25:11 -0600286 BOOST_CHECK_EQUAL(conf.getInterestRetryNumber(), static_cast<uint32_t>(HELLO_RETRIES_DEFAULT));
alvy5a454952014-12-15 12:49:54 -0600287 BOOST_CHECK_EQUAL(conf.getInterestResendTime(), static_cast<uint32_t>(HELLO_TIMEOUT_DEFAULT));
288 BOOST_CHECK_EQUAL(conf.getInfoInterestInterval(), static_cast<uint32_t>(HELLO_INTERVAL_DEFAULT));
alvya2228c62014-12-09 10:25:11 -0600289 BOOST_CHECK_EQUAL(conf.getFirstHelloInterval(),
290 static_cast<uint32_t>(FIRST_HELLO_INTERVAL_DEFAULT));
Vince Lehman7b616582014-10-17 16:25:39 -0500291 BOOST_CHECK_EQUAL(conf.getAdjLsaBuildInterval(),
292 static_cast<uint32_t>(ADJ_LSA_BUILD_INTERVAL_DEFAULT));
alvya2228c62014-12-09 10:25:11 -0600293}
Vince Lehman7b616582014-10-17 16:25:39 -0500294
Ashlesh Gawande9ecbdc92019-03-11 13:18:45 -0700295BOOST_AUTO_TEST_CASE(CanonizeNeighbors)
296{
297 std::string config = std::string(R"INFO(neighbors
298 {
299 neighbor
300 {
301 name /ndn/edu/arizona/%C1.Router/hobo
302 face-uri udp4://hobo.cs.arizona.edu
303 link-cost 20
304 }
305 neighbor
306 {
307 name /ndn/edu/umich/%C1.Router/ndn0
308 face-uri udp4://michigan.testbed.named-data.net
309 link-cost 30
310 }
311 })INFO");
312
313 BOOST_CHECK_EQUAL(processConfigurationString(config), true);
314
315 BOOST_CHECK_EQUAL(conf.m_adjl.getAdjacent("/ndn/edu/arizona/%C1.Router/hobo").getFaceUri().toString(),
316 "udp4://128.196.203.36:6363");
317 BOOST_CHECK_EQUAL(conf.m_adjl.getAdjacent("/ndn/edu/umich/%C1.Router/ndn0").getFaceUri().toString(),
318 "udp4://198.111.224.197:6363");
319}
320
alvya2228c62014-12-09 10:25:11 -0600321BOOST_AUTO_TEST_CASE(DefaultValuesFib)
322{
323 std::string config = SECTION_FIB;
324
325 commentOut("max-faces-per-prefix", config);
326 commentOut("routing-calc-interval", config);
327
328 BOOST_CHECK_EQUAL(processConfigurationString(config), true);
329
alvya2228c62014-12-09 10:25:11 -0600330 BOOST_CHECK_EQUAL(conf.getMaxFacesPerPrefix(),
331 static_cast<uint32_t>(MAX_FACES_PER_PREFIX_DEFAULT));
332 BOOST_CHECK_EQUAL(conf.getRoutingCalcInterval(),
333 static_cast<uint32_t>(ROUTING_CALC_INTERVAL_DEFAULT));
334}
335
336BOOST_AUTO_TEST_CASE(DefaultValuesHyperbolic)
337{
338 std::string config = SECTION_HYPERBOLIC_ON;
339
340 commentOut("state", config);
341
342 BOOST_CHECK_EQUAL(processConfigurationString(config), true);
343
alvya2228c62014-12-09 10:25:11 -0600344 BOOST_CHECK_EQUAL(conf.getHyperbolicState(), static_cast<int32_t>(HYPERBOLIC_STATE_DEFAULT));
Vince Lehman7b616582014-10-17 16:25:39 -0500345}
346
347BOOST_AUTO_TEST_CASE(OutOfRangeValue)
348{
349 const std::string SECTION_FIB_OUT_OF_RANGE =
350 "fib\n"
351 "{\n"
352 " max-faces-per-prefix 3\n"
353 " routing-calc-interval 999\n" // Larger than max value
354 "}\n\n";
355
356 // Processing should fail due to out of range value
357 BOOST_CHECK_EQUAL(processConfigurationString(SECTION_FIB_OUT_OF_RANGE), false);
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -0500358}
359
alvy5a454952014-12-15 12:49:54 -0600360BOOST_AUTO_TEST_CASE(NegativeValue)
361{
362 const std::string SECTION_GENERAL_NEGATIVE_VALUE =
363 "general\n"
364 "{\n"
365 " network /ndn/\n"
366 " site /memphis.edu/\n"
367 " router /cs/pollux/\n"
368 " lsa-refresh-time -1800\n"
369 " lsa-interest-lifetime -3\n"
370 " router-dead-interval -86400\n"
371 "}\n\n";
372
373 // Processing should fail due to negative value
374 BOOST_CHECK_EQUAL(processConfigurationString(SECTION_GENERAL_NEGATIVE_VALUE), false);
375}
376
Vince Lehmanc2acdcb2015-04-29 11:14:35 -0500377BOOST_AUTO_TEST_CASE(LoadCertToPublish)
378{
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -0500379 auto identity = addIdentity("/TestNLSR/identity");
380 saveCertificate(identity, "cert-to-publish.cert");
Vince Lehmanc2acdcb2015-04-29 11:14:35 -0500381
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -0500382 const std::string SECTION_SECURITY = R"CONF(
383 security
384 {
385 validator
386 {
387 trust-anchor
388 {
389 type any
390 }
391 }
392 prefix-update-validator
393 {
394 trust-anchor
395 {
396 type any
397 }
398 }
399 cert-to-publish "cert-to-publish.cert"
400 }
401 )CONF";
Vince Lehmanc2acdcb2015-04-29 11:14:35 -0500402
403 BOOST_CHECK(processConfigurationString(SECTION_SECURITY));
404
405 // Certificate should now be in the CertificateStore
Ashlesh Gawande85998a12017-12-07 22:22:13 -0600406 BOOST_CHECK(conf.getCertStore().find(identity.getDefaultKey().getName()) != nullptr);
Vince Lehmanc2acdcb2015-04-29 11:14:35 -0500407}
408
Vince Lehmand33e5bc2015-06-22 15:27:50 -0500409BOOST_AUTO_TEST_CASE(PrefixUpdateValidatorOptional) // Bug #2814
410{
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -0500411 const std::string SECTION_SECURITY = R"CONF(
412 security
413 {
414 validator
415 {
416 trust-anchor
417 {
418 type any
419 }
420 }
421 }
422 )CONF";
Vince Lehmand33e5bc2015-06-22 15:27:50 -0500423
424 BOOST_CHECK(processConfigurationString(SECTION_SECURITY));
425}
426
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -0500427BOOST_AUTO_TEST_SUITE_END()
428
Nick Gordonfad8e252016-08-11 14:21:38 -0500429} // namespace test
430} // namespace nlsr