mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-22 09:57:41 +00:00
[#916] Checkpoint: updated agents/servers
This commit is contained in:
parent
4605c2c160
commit
d7a926a72f
@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2016-2019 Internet Systems Consortium, Inc. ("ISC")
|
# Copyright (C) 2016-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||||
#
|
#
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
# 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
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
@ -16,10 +16,7 @@ EXPECTED_VERSION="@PACKAGE_VERSION@"
|
|||||||
CONFIG="{
|
CONFIG="{
|
||||||
\"Control-agent\":
|
\"Control-agent\":
|
||||||
{
|
{
|
||||||
\"http-host\": \"127.0.0.1\"
|
\"http-host\": \"127.0.0.1\",
|
||||||
},
|
|
||||||
\"Logging\":
|
|
||||||
{
|
|
||||||
\"loggers\": [
|
\"loggers\": [
|
||||||
{
|
{
|
||||||
\"name\": \"kea-ctrl-agent\",
|
\"name\": \"kea-ctrl-agent\",
|
||||||
|
@ -120,54 +120,6 @@ TEST(ParserTest, keywordJSON) {
|
|||||||
testParser(txt, ParserContext::PARSER_JSON);
|
testParser(txt, ParserContext::PARSER_JSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This test checks that the DhcpDdns configuration is accepted
|
|
||||||
// by the parser.
|
|
||||||
TEST(ParserTest, keywordDhcpDdns) {
|
|
||||||
string txt =
|
|
||||||
"{ \"DhcpDdns\" : \n"
|
|
||||||
"{ \n"
|
|
||||||
" \"ip-address\": \"192.168.77.1\", \n"
|
|
||||||
" \"port\": 777 , \n "
|
|
||||||
" \"ncr-protocol\": \"UDP\", \n"
|
|
||||||
"\"tsig-keys\": [], \n"
|
|
||||||
"\"forward-ddns\" : {}, \n"
|
|
||||||
"\"reverse-ddns\" : {} \n"
|
|
||||||
"} \n"
|
|
||||||
"} \n";
|
|
||||||
testParser(txt, ParserContext::PARSER_AGENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This test checks that the Dhcp6 configuration is accepted
|
|
||||||
// by the parser.
|
|
||||||
TEST(ParserTest, keywordDhcp6) {
|
|
||||||
string txt = "{ \"Dhcp6\": { \"interfaces-config\": {"
|
|
||||||
" \"interfaces\": [ \"type\", \"htype\" ] },\n"
|
|
||||||
"\"preferred-lifetime\": 3000,\n"
|
|
||||||
"\"rebind-timer\": 2000, \n"
|
|
||||||
"\"renew-timer\": 1000, \n"
|
|
||||||
"\"subnet6\": [ { "
|
|
||||||
" \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ],"
|
|
||||||
" \"subnet\": \"2001:db8:1::/48\", "
|
|
||||||
" \"interface\": \"test\" } ],\n"
|
|
||||||
"\"valid-lifetime\": 4000 } }";
|
|
||||||
testParser(txt, ParserContext::PARSER_AGENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This test checks that the Dhcp4 configuration is accepted
|
|
||||||
// by the parser.
|
|
||||||
TEST(ParserTest, keywordDhcp4) {
|
|
||||||
string txt = "{ \"Dhcp4\": { \"interfaces-config\": {"
|
|
||||||
" \"interfaces\": [ \"type\", \"htype\" ] },\n"
|
|
||||||
"\"rebind-timer\": 2000, \n"
|
|
||||||
"\"renew-timer\": 1000, \n"
|
|
||||||
"\"subnet4\": [ { "
|
|
||||||
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
|
|
||||||
" \"subnet\": \"192.0.2.0/24\", "
|
|
||||||
" \"interface\": \"test\" } ],\n"
|
|
||||||
"\"valid-lifetime\": 4000 } }";
|
|
||||||
testParser(txt, ParserContext::PARSER_AGENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This test checks if full config (with top level and Control-agent objects) can
|
// This test checks if full config (with top level and Control-agent objects) can
|
||||||
// be parsed with syntactic checking (and as pure JSON).
|
// be parsed with syntactic checking (and as pure JSON).
|
||||||
TEST(ParserTest, keywordAgent) {
|
TEST(ParserTest, keywordAgent) {
|
||||||
@ -562,18 +514,24 @@ TEST(ParserTest, errors) {
|
|||||||
"expecting }");
|
"expecting }");
|
||||||
testError("{ 123 }\n",
|
testError("{ 123 }\n",
|
||||||
ParserContext::PARSER_AGENT,
|
ParserContext::PARSER_AGENT,
|
||||||
"<string>:1.3-5: syntax error, unexpected integer");
|
"<string>:1.3-5: syntax error, unexpected integer, "
|
||||||
|
"expecting Control-agent");
|
||||||
testError("{ \"foo\" }\n",
|
testError("{ \"foo\" }\n",
|
||||||
ParserContext::PARSER_JSON,
|
ParserContext::PARSER_JSON,
|
||||||
"<string>:1.9: syntax error, unexpected }, "
|
"<string>:1.9: syntax error, unexpected }, "
|
||||||
"expecting :");
|
"expecting :");
|
||||||
testError("{ \"foo\" }\n",
|
testError("{ \"foo\" }\n",
|
||||||
ParserContext::PARSER_AGENT,
|
ParserContext::PARSER_AGENT,
|
||||||
"<string>:1.9: syntax error, unexpected }, expecting :");
|
"<string>:1.3-7: syntax error, unexpected constant string, "
|
||||||
|
"expecting Control-agent");
|
||||||
testError("{ \"foo\":null }\n",
|
testError("{ \"foo\":null }\n",
|
||||||
ParserContext::PARSER_AGENT,
|
ParserContext::PARSER_AGENT,
|
||||||
"<string>:1.3-7: got unexpected keyword "
|
"<string>:1.3-7: syntax error, unexpected constant string, "
|
||||||
"\"foo\" in toplevel map.");
|
"expecting Control-agent");
|
||||||
|
testError("{ \"Logging\":null }\n",
|
||||||
|
ParserContext::PARSER_AGENT,
|
||||||
|
"<string>:1.3-11: syntax error, unexpected constant string, "
|
||||||
|
"expecting Control-agent");
|
||||||
testError("{ \"Control-agent\" }\n",
|
testError("{ \"Control-agent\" }\n",
|
||||||
ParserContext::PARSER_AGENT,
|
ParserContext::PARSER_AGENT,
|
||||||
"<string>:1.19: syntax error, unexpected }, "
|
"<string>:1.19: syntax error, unexpected }, "
|
||||||
@ -696,6 +654,6 @@ TEST(ParserTest, unicodeSlash) {
|
|||||||
EXPECT_EQ("////", result->stringValue());
|
EXPECT_EQ("////", result->stringValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
# Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||||
#
|
#
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
# 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
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
@ -18,10 +18,7 @@ CONFIG="{
|
|||||||
\"port\": 53001,
|
\"port\": 53001,
|
||||||
\"tsig-keys\": [],
|
\"tsig-keys\": [],
|
||||||
\"forward-ddns\" : {},
|
\"forward-ddns\" : {},
|
||||||
\"reverse-ddns\" : {}
|
\"reverse-ddns\" : {},
|
||||||
},
|
|
||||||
\"Logging\":
|
|
||||||
{
|
|
||||||
\"loggers\": [
|
\"loggers\": [
|
||||||
{
|
{
|
||||||
\"name\": \"kea-dhcp-ddns\",
|
\"name\": \"kea-dhcp-ddns\",
|
||||||
@ -44,10 +41,7 @@ CONFIG_BAD_SYNTAX="{
|
|||||||
\"port\": BOGUS,
|
\"port\": BOGUS,
|
||||||
\"tsig-keys\": [],
|
\"tsig-keys\": [],
|
||||||
\"forward-ddns\" : {},
|
\"forward-ddns\" : {},
|
||||||
\"reverse-ddns\" : {}
|
\"reverse-ddns\" : {},
|
||||||
},
|
|
||||||
\"Logging\":
|
|
||||||
{
|
|
||||||
\"loggers\": [
|
\"loggers\": [
|
||||||
{
|
{
|
||||||
\"name\": \"kea-dhcp-ddns\",
|
\"name\": \"kea-dhcp-ddns\",
|
||||||
@ -70,10 +64,7 @@ CONFIG_BAD_VALUE="{
|
|||||||
\"port\": 80000,
|
\"port\": 80000,
|
||||||
\"tsig-keys\": [],
|
\"tsig-keys\": [],
|
||||||
\"forward-ddns\" : {},
|
\"forward-ddns\" : {},
|
||||||
\"reverse-ddns\" : {}
|
\"reverse-ddns\" : {},
|
||||||
},
|
|
||||||
\"Logging\":
|
|
||||||
{
|
|
||||||
\"loggers\": [
|
\"loggers\": [
|
||||||
{
|
{
|
||||||
\"name\": \"kea-dhcp-ddns\",
|
\"name\": \"kea-dhcp-ddns\",
|
||||||
@ -97,10 +88,7 @@ CONFIG_INVALID="{
|
|||||||
\"port\": BOGUS,
|
\"port\": BOGUS,
|
||||||
\"tsig-keys\": [],
|
\"tsig-keys\": [],
|
||||||
\"forward-ddns\" : {},
|
\"forward-ddns\" : {},
|
||||||
\"reverse-ddns\" : {}
|
\"reverse-ddns\" : {},
|
||||||
},
|
|
||||||
\"Logging\":
|
|
||||||
{
|
|
||||||
\"loggers\": [
|
\"loggers\": [
|
||||||
{
|
{
|
||||||
\"name\": \"kea-dhcp-ddns\",
|
\"name\": \"kea-dhcp-ddns\",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
|
// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||||
//
|
//
|
||||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
// 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
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
@ -136,57 +136,6 @@ TEST(ParserTest, keywordDhcpDdns) {
|
|||||||
testParser(txt, D2ParserContext::PARSER_DHCPDDNS);
|
testParser(txt, D2ParserContext::PARSER_DHCPDDNS);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ParserTest, keywordDhcp6) {
|
|
||||||
string txt = "{ \"Dhcp6\": { \"interfaces-config\": {"
|
|
||||||
" \"interfaces\": [ \"type\", \"htype\" ] },\n"
|
|
||||||
"\"preferred-lifetime\": 3000,\n"
|
|
||||||
"\"rebind-timer\": 2000, \n"
|
|
||||||
"\"renew-timer\": 1000, \n"
|
|
||||||
"\"subnet6\": [ { "
|
|
||||||
" \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ],"
|
|
||||||
" \"subnet\": \"2001:db8:1::/48\", "
|
|
||||||
" \"interface\": \"test\" } ],\n"
|
|
||||||
"\"valid-lifetime\": 4000 } }";
|
|
||||||
testParser(txt, D2ParserContext::PARSER_DHCPDDNS);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(ParserTest, keywordDhcp4) {
|
|
||||||
string txt = "{ \"Dhcp4\": { \"interfaces-config\": {"
|
|
||||||
" \"interfaces\": [ \"type\", \"htype\" ] },\n"
|
|
||||||
"\"rebind-timer\": 2000, \n"
|
|
||||||
"\"renew-timer\": 1000, \n"
|
|
||||||
"\"subnet4\": [ { "
|
|
||||||
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
|
|
||||||
" \"subnet\": \"192.0.2.0/24\", "
|
|
||||||
" \"interface\": \"test\" } ],\n"
|
|
||||||
"\"valid-lifetime\": 4000 } }";
|
|
||||||
testParser(txt, D2ParserContext::PARSER_DHCPDDNS);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(ParserTest, keywordControlAgent) {
|
|
||||||
string txt = "{ \"Control-agent\": { } }";
|
|
||||||
testParser(txt, D2ParserContext::PARSER_DHCPDDNS);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(ParserTest, Logging) {
|
|
||||||
string txt = "{ \"Logging\": { \n"
|
|
||||||
" \"loggers\": [ \n"
|
|
||||||
" { \n"
|
|
||||||
" \"name\": \"kea-dhcp6\", \n"
|
|
||||||
" \"output_options\": [ \n"
|
|
||||||
" { \n"
|
|
||||||
" \"output\": \"stdout\" \n"
|
|
||||||
" } \n"
|
|
||||||
" ], \n"
|
|
||||||
" \"debuglevel\": 0, \n"
|
|
||||||
" \"severity\": \"INFO\" \n"
|
|
||||||
" } \n"
|
|
||||||
" ] }\n"
|
|
||||||
"} \n";
|
|
||||||
testParser(txt, D2ParserContext::PARSER_DHCPDDNS);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Tests if bash (#) comments are supported. That's the only comment type that
|
// Tests if bash (#) comments are supported. That's the only comment type that
|
||||||
// was supported by the old parser.
|
// was supported by the old parser.
|
||||||
TEST(ParserTest, bashComments) {
|
TEST(ParserTest, bashComments) {
|
||||||
@ -517,26 +466,24 @@ TEST(ParserTest, errors) {
|
|||||||
"expecting }");
|
"expecting }");
|
||||||
testError("{ 123 }\n",
|
testError("{ 123 }\n",
|
||||||
D2ParserContext::PARSER_DHCPDDNS,
|
D2ParserContext::PARSER_DHCPDDNS,
|
||||||
"<string>:1.3-5: syntax error, unexpected integer");
|
"<string>:1.3-5: syntax error, unexpected integer, "
|
||||||
|
"expecting DhcpDdns");
|
||||||
testError("{ \"foo\" }\n",
|
testError("{ \"foo\" }\n",
|
||||||
D2ParserContext::PARSER_JSON,
|
D2ParserContext::PARSER_JSON,
|
||||||
"<string>:1.9: syntax error, unexpected }, "
|
"<string>:1.9: syntax error, unexpected }, "
|
||||||
"expecting :");
|
"expecting :");
|
||||||
testError("{ \"foo\" }\n",
|
testError("{ \"foo\" }\n",
|
||||||
D2ParserContext::PARSER_DHCPDDNS,
|
D2ParserContext::PARSER_DHCPDDNS,
|
||||||
"<string>:1.9: syntax error, unexpected }, expecting :");
|
"<string>:1.3-7: syntax error, unexpected constant string, "
|
||||||
|
"expecting DhcpDdns");
|
||||||
testError("{ \"foo\":null }\n",
|
testError("{ \"foo\":null }\n",
|
||||||
D2ParserContext::PARSER_DHCPDDNS,
|
D2ParserContext::PARSER_DHCPDDNS,
|
||||||
"<string>:1.3-7: got unexpected keyword "
|
"<string>:1.3-7: syntax error, unexpected constant string, "
|
||||||
"\"foo\" in toplevel map.");
|
"expecting DhcpDdns");
|
||||||
testError("{ \"Dhcp6\" }\n",
|
testError("{ \"Logging\":null }\n",
|
||||||
D2ParserContext::PARSER_DHCPDDNS,
|
D2ParserContext::PARSER_DHCPDDNS,
|
||||||
"<string>:1.11: syntax error, unexpected }, "
|
"<string>:1.3-11: syntax error, unexpected constant string, "
|
||||||
"expecting :");
|
"expecting DhcpDdns");
|
||||||
testError("{ \"Dhcp4\":[]\n",
|
|
||||||
D2ParserContext::PARSER_DHCPDDNS,
|
|
||||||
"<string>:2.1: syntax error, unexpected end of file, "
|
|
||||||
"expecting \",\" or }");
|
|
||||||
testError("{}{}\n",
|
testError("{}{}\n",
|
||||||
D2ParserContext::PARSER_JSON,
|
D2ParserContext::PARSER_JSON,
|
||||||
"<string>:1.3: syntax error, unexpected {, "
|
"<string>:1.3: syntax error, unexpected {, "
|
||||||
@ -651,6 +598,6 @@ TEST(ParserTest, unicodeSlash) {
|
|||||||
EXPECT_EQ("////", result->stringValue());
|
EXPECT_EQ("////", result->stringValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
|
// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||||
//
|
//
|
||||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
// 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
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
@ -574,7 +574,7 @@ TEST(ParserTest, errors) {
|
|||||||
testError("{ 123 }\n",
|
testError("{ 123 }\n",
|
||||||
ParserContext::PARSER_NETCONF,
|
ParserContext::PARSER_NETCONF,
|
||||||
"<string>:1.3-5: syntax error, unexpected integer, "
|
"<string>:1.3-5: syntax error, unexpected integer, "
|
||||||
"expecting Netconf or Logging");
|
"expecting Netconf");
|
||||||
testError("{ \"foo\" }\n",
|
testError("{ \"foo\" }\n",
|
||||||
ParserContext::PARSER_JSON,
|
ParserContext::PARSER_JSON,
|
||||||
"<string>:1.9: syntax error, unexpected }, "
|
"<string>:1.9: syntax error, unexpected }, "
|
||||||
@ -582,11 +582,15 @@ TEST(ParserTest, errors) {
|
|||||||
testError("{ \"foo\" }\n",
|
testError("{ \"foo\" }\n",
|
||||||
ParserContext::PARSER_NETCONF,
|
ParserContext::PARSER_NETCONF,
|
||||||
"<string>:1.3-7: syntax error, unexpected constant string, "
|
"<string>:1.3-7: syntax error, unexpected constant string, "
|
||||||
"expecting Netconf or Logging");
|
"expecting Netconf");
|
||||||
testError("{ \"foo\":null }\n",
|
testError("{ \"foo\":null }\n",
|
||||||
ParserContext::PARSER_NETCONF,
|
ParserContext::PARSER_NETCONF,
|
||||||
"<string>:1.3-7: syntax error, unexpected constant string, "
|
"<string>:1.3-7: syntax error, unexpected constant string, "
|
||||||
"expecting Netconf or Logging");
|
"expecting Netconf");
|
||||||
|
testError("{ \"Logging\":null }\n",
|
||||||
|
ParserContext::PARSER_NETCONF,
|
||||||
|
"<string>:1.3-11: syntax error, unexpected constant string, "
|
||||||
|
"expecting Netconf");
|
||||||
testError("{ \"Netconf\" }\n",
|
testError("{ \"Netconf\" }\n",
|
||||||
ParserContext::PARSER_NETCONF,
|
ParserContext::PARSER_NETCONF,
|
||||||
"<string>:1.13: syntax error, unexpected }, "
|
"<string>:1.13: syntax error, unexpected }, "
|
||||||
@ -661,6 +665,15 @@ TEST(ParserTest, errors) {
|
|||||||
ParserContext::PARSER_NETCONF,
|
ParserContext::PARSER_NETCONF,
|
||||||
"<string>:3.3-11: duplicate user-context/comment entries "
|
"<string>:3.3-11: duplicate user-context/comment entries "
|
||||||
"(previous at <string>:2:19)");
|
"(previous at <string>:2:19)");
|
||||||
|
|
||||||
|
// duplicate Netconf entries
|
||||||
|
testError("{ \"Netconf\":{\n"
|
||||||
|
" \"comment\": \"first\" },\n"
|
||||||
|
" \"Netconf\":{\n"
|
||||||
|
" \"comment\": \"second\" }}\n",
|
||||||
|
ParserContext::PARSER_NETCONF,
|
||||||
|
"<string>:3:3: duplicate Netconf entries in toplevel map "
|
||||||
|
"(previous at <string>:1:3)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check unicode escapes
|
// Check unicode escapes
|
||||||
@ -704,6 +717,6 @@ TEST(ParserTest, unicodeSlash) {
|
|||||||
EXPECT_EQ("////", result->stringValue());
|
EXPECT_EQ("////", result->stringValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
|
# Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||||
#
|
#
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
# 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
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
@ -21,11 +21,7 @@ CONFIG="{
|
|||||||
{
|
{
|
||||||
\"comment\": \"simply use defaults...\"
|
\"comment\": \"simply use defaults...\"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
|
||||||
|
|
||||||
\"Logging\":
|
|
||||||
{
|
|
||||||
\"loggers\": [
|
\"loggers\": [
|
||||||
{
|
{
|
||||||
\"name\": \"kea-netconf\",
|
\"name\": \"kea-netconf\",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user