blob: bacae9f503eb22f85742977b8f7cb3139fd7e917 [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/**
Saurab Dulal427e0122019-11-28 11:58:02 -06003 * Copyright (c) 2014-2020, 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
Muktadir R Chowdhurybfa27602014-10-31 10:57:41 -050027#include <boost/filesystem.hpp>
28#include <boost/algorithm/string.hpp>
Muktadir R Chowdhuryc69da0a2015-12-18 13:24:38 -060029#include <ndn-cxx/util/dummy-client-face.hpp>
30
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -050031namespace nlsr {
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -050032namespace test {
33
dmcoomes9f936662017-03-02 10:33:09 -060034using std::shared_ptr;
Vince Lehman904c2412014-09-23 19:36:11 -050035
Vince Lehman7b616582014-10-17 16:25:39 -050036const std::string SECTION_GENERAL =
37 "general\n"
38 "{\n"
39 " network /ndn/\n"
40 " site /memphis.edu/\n"
41 " router /cs/pollux/\n"
42 " lsa-refresh-time 1800\n"
43 " lsa-interest-lifetime 3\n"
Alexander Afanasyev1cf1e102014-08-17 19:47:57 -070044 " router-dead-interval 86400\n"
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -050045 " sync-protocol psync\n"
Ashlesh Gawandef7da9c52018-02-06 17:36:46 -060046 " sync-interest-lifetime 10000\n"
dulalsaurab82a34c22019-02-04 17:31:21 +000047 " state-dir /tmp\n"
Vince Lehman7b616582014-10-17 16:25:39 -050048 "}\n\n";
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -050049
Vince Lehman7b616582014-10-17 16:25:39 -050050const std::string SECTION_NEIGHBORS =
51 "neighbors\n"
52 "{\n"
53 " hello-retries 3\n"
54 " hello-timeout 1\n"
55 " hello-interval 60\n\n"
Ashlesh Gawande6b388fc2019-09-30 10:14:41 -050056 " adj-lsa-build-interval 10\n"
Vince Lehman7b616582014-10-17 16:25:39 -050057 " neighbor\n"
58 " {\n"
59 " name /ndn/memphis.edu/cs/castor\n"
Ashlesh Gawande7e3f6d72019-01-25 13:13:43 -060060 " face-uri udp://10.0.0.1\n"
Vince Lehman7b616582014-10-17 16:25:39 -050061 " link-cost 20\n"
62 " }\n\n"
63 " neighbor\n"
64 " {\n"
65 " name /ndn/memphis.edu/cs/mira\n"
Ashlesh Gawande7e3f6d72019-01-25 13:13:43 -060066 " face-uri udp://10.0.0.2\n"
Vince Lehman7b616582014-10-17 16:25:39 -050067 " link-cost 30\n"
68 " }\n"
69 "}\n\n";
70
71const std::string SECTION_HYPERBOLIC_ON =
72 "hyperbolic\n"
73 "{\n"
74 " state on\n"
75 " radius 123.456\n"
76 " angle 1.45\n"
77 "}\n\n";
78
Muktadir R Chowdhuryb00dc2a2016-11-05 10:48:58 -060079const std::string SECTION_HYPERBOLIC_ANGLES_ON =
80 "hyperbolic\n"
81 "{\n"
82 " state on\n"
83 " radius 123.456\n"
84 " angle 1.45,2.25\n"
85 "}\n\n";
86
Vince Lehman7b616582014-10-17 16:25:39 -050087const std::string SECTION_HYPERBOLIC_OFF =
88 "hyperbolic\n"
89 "{\n"
90 " state off\n"
91 " radius 123.456\n"
92 " angle 1.45\n"
93 "}\n\n";
94
95const std::string SECTION_FIB =
96 "fib\n"
97 "{\n"
98 " max-faces-per-prefix 3\n"
99 " routing-calc-interval 9\n"
100 "}\n\n";
101
102const std::string SECTION_ADVERTISING =
103 "advertising\n"
104 "{\n"
105 " prefix /ndn/edu/memphis/cs/netlab\n"
106 " prefix /ndn/edu/memphis/sports/basketball\n"
107 "}\n";
108
Ashlesh Gawande85998a12017-12-07 22:22:13 -0600109// NEED TO TEST SECURITY SECTION SUCH AS LOADING CERTIFICATE
110
Vince Lehman7b616582014-10-17 16:25:39 -0500111const std::string CONFIG_LINK_STATE = SECTION_GENERAL + SECTION_NEIGHBORS +
112 SECTION_HYPERBOLIC_OFF + SECTION_FIB + SECTION_ADVERTISING;
113
114const std::string CONFIG_HYPERBOLIC = SECTION_GENERAL + SECTION_NEIGHBORS +
115 SECTION_HYPERBOLIC_ON + SECTION_FIB + SECTION_ADVERTISING;
116
Muktadir R Chowdhuryb00dc2a2016-11-05 10:48:58 -0600117const std::string CONFIG_HYPERBOLIC_ANGLES = SECTION_GENERAL + SECTION_NEIGHBORS +
118 SECTION_HYPERBOLIC_ANGLES_ON + SECTION_FIB +
119 SECTION_ADVERTISING;
120
Vince Lehman7b616582014-10-17 16:25:39 -0500121class ConfFileProcessorFixture : public BaseFixture
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -0500122{
Vince Lehman7b616582014-10-17 16:25:39 -0500123public:
124 ConfFileProcessorFixture()
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -0500125 : face(m_ioService, m_keyChain)
Saurab Dulal427e0122019-11-28 11:58:02 -0600126 , conf(face, m_keyChain, "unit-test-nlsr.conf")
Vince Lehman7b616582014-10-17 16:25:39 -0500127 {
128 }
Vince Lehman904c2412014-09-23 19:36:11 -0500129
Vince Lehman7b616582014-10-17 16:25:39 -0500130 ~ConfFileProcessorFixture()
131 {
132 remove("unit-test-nlsr.conf");
133 }
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -0500134
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -0500135 bool
136 processConfigurationString(std::string confString)
Vince Lehman7b616582014-10-17 16:25:39 -0500137 {
138 std::ofstream config;
139 config.open("unit-test-nlsr.conf");
140 config << confString;
141 config.close();
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -0500142
Ashlesh Gawande85998a12017-12-07 22:22:13 -0600143 ConfFileProcessor processor(conf);
Vince Lehman7b616582014-10-17 16:25:39 -0500144 return processor.processConfFile();
145 }
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -0500146
Muktadir R Chowdhurybfa27602014-10-31 10:57:41 -0500147 void
alvya2228c62014-12-09 10:25:11 -0600148 commentOut(const std::string& key, std::string& config)
149 {
150 boost::replace_all(config, key, ";" + key);
151 }
152
Vince Lehman7b616582014-10-17 16:25:39 -0500153public:
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -0500154 ndn::util::DummyClientFace face;
Ashlesh Gawande85998a12017-12-07 22:22:13 -0600155 ConfParameter conf;
Vince Lehman7b616582014-10-17 16:25:39 -0500156};
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -0500157
Vince Lehman7b616582014-10-17 16:25:39 -0500158BOOST_FIXTURE_TEST_SUITE(TestConfFileProcessor, ConfFileProcessorFixture)
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -0500159
Vince Lehman7b616582014-10-17 16:25:39 -0500160BOOST_AUTO_TEST_CASE(LinkState)
161{
162 processConfigurationString(CONFIG_LINK_STATE);
Ashlesh Gawande6b388fc2019-09-30 10:14:41 -0500163 conf.buildRouterAndSyncUserPrefix();
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -0500164
Vince Lehman7b616582014-10-17 16:25:39 -0500165 // General
166 BOOST_CHECK_EQUAL(conf.getNetwork(), "/ndn/");
167 BOOST_CHECK_EQUAL(conf.getSiteName(), "/memphis.edu/");
168 BOOST_CHECK_EQUAL(conf.getRouterName(), "/cs/pollux/");
169 BOOST_CHECK_EQUAL(conf.getRouterPrefix(), "/ndn/memphis.edu/cs/pollux/");
Ashlesh Gawande85998a12017-12-07 22:22:13 -0600170 BOOST_CHECK_EQUAL(conf.getSyncPrefix(), ndn::Name("/localhop/ndn/nlsr/sync").appendVersion(ConfParameter::SYNC_VERSION));
Ashlesh Gawandecba0ae22018-03-27 17:57:56 -0500171 BOOST_CHECK_EQUAL(conf.getLsaPrefix(), "/localhop/ndn/nlsr/LSA");
Vince Lehman7b616582014-10-17 16:25:39 -0500172 BOOST_CHECK_EQUAL(conf.getLsaRefreshTime(), 1800);
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -0500173 BOOST_CHECK_EQUAL(conf.getSyncProtocol(), SYNC_PROTOCOL_PSYNC);
Vince Lehman7b616582014-10-17 16:25:39 -0500174 BOOST_CHECK_EQUAL(conf.getLsaInterestLifetime(), ndn::time::seconds(3));
Alexander Afanasyev1cf1e102014-08-17 19:47:57 -0700175 BOOST_CHECK_EQUAL(conf.getRouterDeadInterval(), 86400);
Ashlesh Gawandef7da9c52018-02-06 17:36:46 -0600176 BOOST_CHECK_EQUAL(conf.getSyncInterestLifetime(), ndn::time::milliseconds(10000));
dulalsaurab82a34c22019-02-04 17:31:21 +0000177 BOOST_CHECK_EQUAL(conf.getStateFileDir(), "/tmp");
Alexander Afanasyev411ee4b2014-08-16 23:17:03 -0700178
Vince Lehman7b616582014-10-17 16:25:39 -0500179 // Neighbors
180 BOOST_CHECK_EQUAL(conf.getInterestRetryNumber(), 3);
181 BOOST_CHECK_EQUAL(conf.getInterestResendTime(), 1);
182 BOOST_CHECK_EQUAL(conf.getInfoInterestInterval(), 60);
183
Ashlesh Gawande6b388fc2019-09-30 10:14:41 -0500184 BOOST_CHECK_EQUAL(conf.getAdjLsaBuildInterval(), 10);
Vince Lehman7b616582014-10-17 16:25:39 -0500185
Ashlesh Gawande85998a12017-12-07 22:22:13 -0600186 BOOST_CHECK(conf.getAdjacencyList().isNeighbor("/ndn/memphis.edu/cs/mira"));
187 BOOST_CHECK(conf.getAdjacencyList().isNeighbor("/ndn/memphis.edu/cs/castor"));
188 BOOST_CHECK(!conf.getAdjacencyList().isNeighbor("/ndn/memphis.edu/cs/fail"));
Vince Lehman7b616582014-10-17 16:25:39 -0500189
Ashlesh Gawande85998a12017-12-07 22:22:13 -0600190 Adjacent mira = conf.getAdjacencyList().getAdjacent("/ndn/memphis.edu/cs/mira");
Vince Lehman7b616582014-10-17 16:25:39 -0500191 BOOST_CHECK_EQUAL(mira.getName(), "/ndn/memphis.edu/cs/mira");
192 BOOST_CHECK_EQUAL(mira.getLinkCost(), 30);
Ashlesh Gawande7e3f6d72019-01-25 13:13:43 -0600193 BOOST_CHECK_EQUAL(mira.getFaceUri().toString(), "udp4://10.0.0.2:6363");
Vince Lehman7b616582014-10-17 16:25:39 -0500194
Ashlesh Gawande85998a12017-12-07 22:22:13 -0600195 Adjacent castor = conf.getAdjacencyList().getAdjacent("/ndn/memphis.edu/cs/castor");
Vince Lehman7b616582014-10-17 16:25:39 -0500196 BOOST_CHECK_EQUAL(castor.getName(), "/ndn/memphis.edu/cs/castor");
197 BOOST_CHECK_EQUAL(castor.getLinkCost(), 20);
Ashlesh Gawande7e3f6d72019-01-25 13:13:43 -0600198 BOOST_CHECK_EQUAL(castor.getFaceUri().toString(), "udp4://10.0.0.1:6363");
Vince Lehman7b616582014-10-17 16:25:39 -0500199
200 // Hyperbolic
201 BOOST_CHECK_EQUAL(conf.getHyperbolicState(), 0);
202
203 // FIB
204 BOOST_CHECK_EQUAL(conf.getMaxFacesPerPrefix(), 3);
205 BOOST_CHECK_EQUAL(conf.getRoutingCalcInterval(), 9);
206
207 // Advertising
Ashlesh Gawande85998a12017-12-07 22:22:13 -0600208 BOOST_CHECK_EQUAL(conf.getNamePrefixList().size(), 2);
Vince Lehman7b616582014-10-17 16:25:39 -0500209}
210
alvy2fe12872014-11-25 10:32:23 -0600211BOOST_AUTO_TEST_CASE(MalformedUri)
212{
213 const std::string MALFORMED_URI =
214 "neighbors\n"
215 "{\n"
216 " hello-retries 3\n"
217 " hello-timeout 1\n"
218 " hello-interval 60\n\n"
Ashlesh Gawande6b388fc2019-09-30 10:14:41 -0500219 " adj-lsa-build-interval 10\n"
alvy2fe12872014-11-25 10:32:23 -0600220 " neighbor\n"
221 " {\n"
222 " name /ndn/memphis.edu/cs/castor\n"
223 " face-uri udp4:malformed-uri\n"
224 " link-cost 20\n"
225 " }\n"
226 "}\n\n";
227
228 BOOST_CHECK_EQUAL(processConfigurationString(MALFORMED_URI), false);
229}
230
Vince Lehman7b616582014-10-17 16:25:39 -0500231BOOST_AUTO_TEST_CASE(Hyperbolic)
232{
233 processConfigurationString(CONFIG_HYPERBOLIC);
234
Vince Lehman7b616582014-10-17 16:25:39 -0500235 BOOST_CHECK_EQUAL(conf.getHyperbolicState(), 1);
236 BOOST_CHECK_EQUAL(conf.getCorR(), 123.456);
Muktadir R Chowdhuryb00dc2a2016-11-05 10:48:58 -0600237 std::vector<double> angles;
238 angles.push_back(1.45);
239 BOOST_CHECK(conf.getCorTheta() == angles);
240}
241
242BOOST_AUTO_TEST_CASE(Hyperbolic2)
243{
244 processConfigurationString(CONFIG_HYPERBOLIC_ANGLES);
245
Muktadir R Chowdhuryb00dc2a2016-11-05 10:48:58 -0600246 BOOST_CHECK_EQUAL(conf.getHyperbolicState(), 1);
247 BOOST_CHECK_EQUAL(conf.getCorR(), 123.456);
248 std::vector<double> angles;
249 angles.push_back(1.45);
250 angles.push_back(2.25);
251 BOOST_CHECK(conf.getCorTheta() == angles);
Vince Lehman7b616582014-10-17 16:25:39 -0500252}
253
alvya2228c62014-12-09 10:25:11 -0600254BOOST_AUTO_TEST_CASE(DefaultValuesGeneral)
Vince Lehman7b616582014-10-17 16:25:39 -0500255{
alvya2228c62014-12-09 10:25:11 -0600256 std::string config = SECTION_GENERAL;
Vince Lehman7b616582014-10-17 16:25:39 -0500257
alvya2228c62014-12-09 10:25:11 -0600258 commentOut("lsa-refresh-time", config);
259 commentOut("lsa-interest-lifetime", config);
260 commentOut("router-dead-interval", config);
261
Ashlesh Gawande328fc112019-12-12 17:06:44 -0600262 BOOST_CHECK(processConfigurationString(config));
Vince Lehman7b616582014-10-17 16:25:39 -0500263
alvy5a454952014-12-15 12:49:54 -0600264 BOOST_CHECK_EQUAL(conf.getLsaRefreshTime(), static_cast<uint32_t>(LSA_REFRESH_TIME_DEFAULT));
alvya2228c62014-12-09 10:25:11 -0600265 BOOST_CHECK_EQUAL(conf.getLsaInterestLifetime(),
266 static_cast<ndn::time::seconds>(LSA_INTEREST_LIFETIME_DEFAULT));
Ashlesh Gawande328fc112019-12-12 17:06:44 -0600267 BOOST_CHECK_EQUAL(conf.getRouterDeadInterval(), (2 * conf.getLsaRefreshTime()));
268
269 BOOST_CHECK(conf.m_confFileName != conf.getConfFileNameDynamic());
270 conf.m_confFileName = "/tmp/nlsr.conf";
271 BOOST_CHECK(conf.m_confFileName == conf.getConfFileNameDynamic());
272 BOOST_CHECK(!processConfigurationString(config));
alvya2228c62014-12-09 10:25:11 -0600273}
274
275BOOST_AUTO_TEST_CASE(DefaultValuesNeighbors)
276{
277 std::string config = SECTION_NEIGHBORS;
278
279 commentOut("hello-retries", config);
280 commentOut("hello-timeout", config);
281 commentOut("hello-interval", config);
282 commentOut("first-hello-interval", config);
283 commentOut("adj-lsa-build-interval", config);
284
285 BOOST_CHECK_EQUAL(processConfigurationString(config), true);
286
alvya2228c62014-12-09 10:25:11 -0600287 BOOST_CHECK_EQUAL(conf.getInterestRetryNumber(), static_cast<uint32_t>(HELLO_RETRIES_DEFAULT));
alvy5a454952014-12-15 12:49:54 -0600288 BOOST_CHECK_EQUAL(conf.getInterestResendTime(), static_cast<uint32_t>(HELLO_TIMEOUT_DEFAULT));
289 BOOST_CHECK_EQUAL(conf.getInfoInterestInterval(), static_cast<uint32_t>(HELLO_INTERVAL_DEFAULT));
Vince Lehman7b616582014-10-17 16:25:39 -0500290 BOOST_CHECK_EQUAL(conf.getAdjLsaBuildInterval(),
291 static_cast<uint32_t>(ADJ_LSA_BUILD_INTERVAL_DEFAULT));
alvya2228c62014-12-09 10:25:11 -0600292}
Vince Lehman7b616582014-10-17 16:25:39 -0500293
Ashlesh Gawande9ecbdc92019-03-11 13:18:45 -0700294BOOST_AUTO_TEST_CASE(CanonizeNeighbors)
295{
296 std::string config = std::string(R"INFO(neighbors
297 {
298 neighbor
299 {
300 name /ndn/edu/arizona/%C1.Router/hobo
301 face-uri udp4://hobo.cs.arizona.edu
302 link-cost 20
303 }
304 neighbor
305 {
306 name /ndn/edu/umich/%C1.Router/ndn0
307 face-uri udp4://michigan.testbed.named-data.net
308 link-cost 30
309 }
310 })INFO");
311
312 BOOST_CHECK_EQUAL(processConfigurationString(config), true);
313
314 BOOST_CHECK_EQUAL(conf.m_adjl.getAdjacent("/ndn/edu/arizona/%C1.Router/hobo").getFaceUri().toString(),
315 "udp4://128.196.203.36:6363");
316 BOOST_CHECK_EQUAL(conf.m_adjl.getAdjacent("/ndn/edu/umich/%C1.Router/ndn0").getFaceUri().toString(),
317 "udp4://198.111.224.197:6363");
318}
319
alvya2228c62014-12-09 10:25:11 -0600320BOOST_AUTO_TEST_CASE(DefaultValuesFib)
321{
322 std::string config = SECTION_FIB;
323
324 commentOut("max-faces-per-prefix", config);
325 commentOut("routing-calc-interval", config);
326
327 BOOST_CHECK_EQUAL(processConfigurationString(config), true);
328
alvya2228c62014-12-09 10:25:11 -0600329 BOOST_CHECK_EQUAL(conf.getMaxFacesPerPrefix(),
330 static_cast<uint32_t>(MAX_FACES_PER_PREFIX_DEFAULT));
331 BOOST_CHECK_EQUAL(conf.getRoutingCalcInterval(),
332 static_cast<uint32_t>(ROUTING_CALC_INTERVAL_DEFAULT));
333}
334
335BOOST_AUTO_TEST_CASE(DefaultValuesHyperbolic)
336{
337 std::string config = SECTION_HYPERBOLIC_ON;
338
339 commentOut("state", config);
340
341 BOOST_CHECK_EQUAL(processConfigurationString(config), true);
342
alvya2228c62014-12-09 10:25:11 -0600343 BOOST_CHECK_EQUAL(conf.getHyperbolicState(), static_cast<int32_t>(HYPERBOLIC_STATE_DEFAULT));
Vince Lehman7b616582014-10-17 16:25:39 -0500344}
345
346BOOST_AUTO_TEST_CASE(OutOfRangeValue)
347{
348 const std::string SECTION_FIB_OUT_OF_RANGE =
349 "fib\n"
350 "{\n"
351 " max-faces-per-prefix 3\n"
352 " routing-calc-interval 999\n" // Larger than max value
353 "}\n\n";
354
355 // Processing should fail due to out of range value
356 BOOST_CHECK_EQUAL(processConfigurationString(SECTION_FIB_OUT_OF_RANGE), false);
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -0500357}
358
alvy5a454952014-12-15 12:49:54 -0600359BOOST_AUTO_TEST_CASE(NegativeValue)
360{
361 const std::string SECTION_GENERAL_NEGATIVE_VALUE =
362 "general\n"
363 "{\n"
364 " network /ndn/\n"
365 " site /memphis.edu/\n"
366 " router /cs/pollux/\n"
367 " lsa-refresh-time -1800\n"
368 " lsa-interest-lifetime -3\n"
369 " router-dead-interval -86400\n"
370 "}\n\n";
371
372 // Processing should fail due to negative value
373 BOOST_CHECK_EQUAL(processConfigurationString(SECTION_GENERAL_NEGATIVE_VALUE), false);
374}
375
Vince Lehmanc2acdcb2015-04-29 11:14:35 -0500376BOOST_AUTO_TEST_CASE(LoadCertToPublish)
377{
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -0500378 auto identity = addIdentity("/TestNLSR/identity");
379 saveCertificate(identity, "cert-to-publish.cert");
Vince Lehmanc2acdcb2015-04-29 11:14:35 -0500380
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -0500381 const std::string SECTION_SECURITY = R"CONF(
382 security
383 {
384 validator
385 {
386 trust-anchor
387 {
388 type any
389 }
390 }
391 prefix-update-validator
392 {
393 trust-anchor
394 {
395 type any
396 }
397 }
398 cert-to-publish "cert-to-publish.cert"
399 }
400 )CONF";
Vince Lehmanc2acdcb2015-04-29 11:14:35 -0500401
402 BOOST_CHECK(processConfigurationString(SECTION_SECURITY));
403
Vince Lehmanc2acdcb2015-04-29 11:14:35 -0500404}
405
Vince Lehmand33e5bc2015-06-22 15:27:50 -0500406BOOST_AUTO_TEST_CASE(PrefixUpdateValidatorOptional) // Bug #2814
407{
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -0500408 const std::string SECTION_SECURITY = R"CONF(
409 security
410 {
411 validator
412 {
413 trust-anchor
414 {
415 type any
416 }
417 }
418 }
419 )CONF";
Vince Lehmand33e5bc2015-06-22 15:27:50 -0500420
421 BOOST_CHECK(processConfigurationString(SECTION_SECURITY));
422}
423
Ashlesh Gawandeeb582eb2014-05-01 14:25:20 -0500424BOOST_AUTO_TEST_SUITE_END()
425
Nick Gordonfad8e252016-08-11 14:21:38 -0500426} // namespace test
427} // namespace nlsr