Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
fe79959e
Commit
fe79959e
authored
Apr 12, 2018
by
Francis Dupont
Browse files
[master] Finishing merge of trac5495 (comment/user-context for d2 and ca)
parents
5bb69e0a
6240cdb6
Changes
6
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
fe79959e
1386. [func] fdupont
Extented comment / user-context support to DHCP-DDNS and
Control Agent configuration syntax.
(Trac #5495, git xxx)
1385. [func] tomek
lease4-wipe and lease6-wipe are now able to wipe all leases
from all configured subnets if subnet-id specified is 0
...
...
doc/examples/ddns/comments.json
View file @
fe79959e
//
This
is
an
example
configuration
file
for
D
2
,
Kea's
DHCP-DDNS
processor.
//
It
uses
embedded
(i.e.,
which
will
be
included
in
configuration
objects
//
and
not
stripped
by
at
lexical
analysis
)
comments
.
//
It
uses
embedded
comments
which
will
be
included
in
configuration
objects
//
within
user-contexts
rather
than
stripped
away
by
at
lexical
analysis.
{
"DhcpDdns"
:
...
...
src/bin/agent/tests/get_config_unittest.cc
View file @
fe79959e
...
...
@@ -257,16 +257,22 @@ TEST_F(CtrlAgentGetCfgTest, simple) {
prettyPrint
(
unparsed
,
std
::
cerr
,
0
,
4
);
std
::
cerr
<<
"
\n
"
;
}
else
{
// get the expected config using the agent syntax parser
ElementPtr
jsond
;
ASSERT_NO_THROW
(
jsond
=
parseAGENT
(
expected
,
true
));
// get the expected config using the generic JSON syntax parser
ElementPtr
jsonj
;
ASSERT_NO_THROW
(
jsonj
=
parseJSON
(
expected
));
// the generic JSON parser does not handle comments
EXPECT_TRUE
(
isEquivalent
(
jsond
,
moveComments
(
jsonj
)));
// replace the path by its actual value
ConstElementPtr
ca
;
ASSERT_NO_THROW
(
ca
=
jsonj
->
get
(
"Control-agent"
));
ASSERT_TRUE
(
ca
);
pathReplacer
(
ca
);
// check that unparsed and updated expected values match
EXPECT_TRUE
(
isEquivalent
(
unparsed
,
jsonj
));
// check on pretty prints too
std
::
string
current
=
prettyPrint
(
unparsed
,
0
,
4
);
std
::
string
expected2
=
prettyPrint
(
jsonj
,
0
,
4
);
EXPECT_EQ
(
expected2
,
current
);
...
...
src/bin/d2/tests/get_config_unittest.cc
View file @
fe79959e
...
...
@@ -240,12 +240,17 @@ TEST_F(D2GetConfigTest, sample1) {
prettyPrint
(
unparsed
,
std
::
cerr
,
0
,
4
);
std
::
cerr
<<
"
\n
"
;
}
else
{
// get the expected config using the d2 syntax parser
ElementPtr
jsond
;
ASSERT_NO_THROW
(
jsond
=
parseDHCPDDNS
(
expected
,
true
));
// get the expected config using the generic JSON syntax parser
ElementPtr
jsonj
;
ASSERT_NO_THROW
(
jsonj
=
parseJSON
(
expected
));
// the generic JSON parser does not handle comments
EXPECT_TRUE
(
isEquivalent
(
jsond
,
moveComments
(
jsonj
)));
// check that unparsed and expected values match
EXPECT_TRUE
(
isEquivalent
(
unparsed
,
jsonj
));
// check on pretty prints too
std
::
string
current
=
prettyPrint
(
unparsed
,
0
,
4
)
+
"
\n
"
;
EXPECT_EQ
(
expected
,
current
);
if
(
expected
!=
current
)
{
...
...
src/bin/dhcp4/tests/get_config_unittest.cc.skel
View file @
fe79959e
// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C)
2017-
2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
...
...
@@ -318,12 +318,17 @@ TEST_P(Dhcp4GetConfigTest, run) {
ASSERT_NO_THROW(outputFormatted(dhcp->str()));
} else {
expected = UNPARSED_CONFIGS[config_counter];
// get the expected config using the dhcpv4 syntax parser
ElementPtr jsond;
ASSERT_NO_THROW(jsond = parseDHCP4(expected, true));
ElementPtr jsonj;
// get the expected config using the generic JSON syntax parser
ASSERT_NO_THROW(jsonj = parseJSON(expected));
EXPECT_TRUE(isEquivalent(dhcp, jsonj));
// the generic JSON parser does not handle comments
EXPECT_TRUE(isEquivalent(jsond, moveComments(jsonj)));
// check that unparsed and expected values match
EXPECT_TRUE(isEquivalent(dhcp, jsonj));
// check on pretty prints too
std::string current = prettyPrint(dhcp, 4, 4) + "\n";
EXPECT_EQ(expected, current);
if (expected != current) {
...
...
src/bin/dhcp6/tests/get_config_unittest.cc.skel
View file @
fe79959e
...
...
@@ -322,12 +322,17 @@ TEST_P(Dhcp6GetConfigTest, run) {
ASSERT_NO_THROW(outputFormatted(dhcp->str()));
} else {
expected = UNPARSED_CONFIGS[config_counter];
// get the expected config using the dhcpv6 syntax parser
ElementPtr jsond;
ASSERT_NO_THROW(jsond = parseDHCP6(expected, true));
// get the expected config using the generic JSON syntax parser
ElementPtr jsonj;
ASSERT_NO_THROW(jsonj = parseJSON(expected));
EXPECT_TRUE(isEquivalent(dhcp, jsonj));
// the generic JSON parser does not handle comments
EXPECT_TRUE(isEquivalent(jsond, moveComments(jsonj)));
// check that unparsed and expected values match
EXPECT_TRUE(isEquivalent(dhcp, jsonj));
// check on pretty prints too
std::string current = prettyPrint(dhcp, 4, 4) + "\n";
EXPECT_EQ(expected, current);
if (expected != current) {
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment