diff options
author | Thomas Markwalder <tmark@isc.org> | 2018-06-07 21:07:06 +0200 |
---|---|---|
committer | Thomas Markwalder <tmark@isc.org> | 2018-06-07 21:07:06 +0200 |
commit | ef1c0b746b8a11ce0ccebe0fb4bce9d6ed7e81c2 (patch) | |
tree | 59ceb8b99fd05eb7cdad7cb5e34b4b2455559b6c /src | |
parent | [master] Improves Ctrl Channel partial command handling (diff) | |
download | kea-ef1c0b746b8a11ce0ccebe0fb4bce9d6ed7e81c2.tar.xz kea-ef1c0b746b8a11ce0ccebe0fb4bce9d6ed7e81c2.zip |
[5378] kea-dhcp4/6 now keep track of their configured global params
src/bin/dhcp4/json_config_parser.cc
configureDhcp4Server() - added extract of configured globals
src/bin/dhcp4/tests/get_config_unittest.cc
src/bin/dhcp6/tests/get_config_unittest.cc
Updated extracted and unparsed configs.
src/bin/dhcp6/json_config_parser.cc
configureDhcp6Server() - added extract of configured globals
src/lib/dhcpsrv/srv_config.h
src/lib/dhcpsrv/srv_config.cc
Added storage and maintence of configured globals
SrvConfig::toElement() - added configured globals to result
src/lib/dhcpsrv/tests/srv_config_unittest.cc
TEST_F(SrvConfigTest, configuredGlobals) - new test
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/dhcp4/json_config_parser.cc | 3 | ||||
-rw-r--r-- | src/bin/dhcp4/tests/get_config_unittest.cc | 264 | ||||
-rw-r--r-- | src/bin/dhcp6/json_config_parser.cc | 3 | ||||
-rw-r--r-- | src/bin/dhcp6/tests/get_config_unittest.cc | 268 | ||||
-rw-r--r-- | src/lib/dhcpsrv/srv_config.cc | 27 | ||||
-rw-r--r-- | src/lib/dhcpsrv/srv_config.h | 25 | ||||
-rw-r--r-- | src/lib/dhcpsrv/tests/srv_config_unittest.cc | 77 |
7 files changed, 561 insertions, 106 deletions
diff --git a/src/bin/dhcp4/json_config_parser.cc b/src/bin/dhcp4/json_config_parser.cc index 6ee88509b0..646091cd09 100644 --- a/src/bin/dhcp4/json_config_parser.cc +++ b/src/bin/dhcp4/json_config_parser.cc @@ -316,6 +316,9 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set, SrvConfigPtr srv_cfg = CfgMgr::instance().getStagingCfg(); + // Preserve all scalar global parameters + srv_cfg->extractConfiguredGlobals(config_set); + // This is a way to convert ConstElementPtr to ElementPtr. // We need a config that can be edited, because we will insert // default values and will insert derived values as well. diff --git a/src/bin/dhcp4/tests/get_config_unittest.cc b/src/bin/dhcp4/tests/get_config_unittest.cc index 40006fe256..ca2affa5a4 100644 --- a/src/bin/dhcp4/tests/get_config_unittest.cc +++ b/src/bin/dhcp4/tests/get_config_unittest.cc @@ -1203,7 +1203,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"rebind-timer\": 2,\n" " \"relay\": {\n" -" \"ip-addresses\": [ \"192.0.2.123\", \"192.0.2.124\" ]\n" +" \"ip-addresses\": [ \"192.0.3.123\", \"192.0.3.124\" ]\n" " },\n" " \"renew-timer\": 1,\n" " \"subnet\": \"192.0.2.0/24\",\n" @@ -1896,8 +1896,11 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" -" \"subnet4\": [ ]\n" +" \"subnet4\": [ ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 1 "{\n" @@ -1939,6 +1942,7 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -1966,7 +1970,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 2 "{\n" @@ -2008,6 +2013,7 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -2035,7 +2041,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 3 "{\n" @@ -2077,6 +2084,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -2105,7 +2114,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 4 "{\n" @@ -2147,6 +2157,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -2253,7 +2265,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.5.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 5 "{\n" @@ -2295,6 +2308,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -2401,10 +2416,12 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.5.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 6 "{\n" +" \"boot-file-name\": \"bar\",\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" " \"always-include-fqdn\": false,\n" @@ -2441,8 +2458,12 @@ const char* UNPARSED_CONFIGS[] = { " \"lease-database\": {\n" " \"type\": \"memfile\"\n" " },\n" +" \"next-server\": \"1.2.3.4\",\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" +" \"server-hostname\": \"foo\",\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -2471,7 +2492,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 7 "{\n" @@ -2513,6 +2535,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -2541,10 +2565,12 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 8 "{\n" +" \"boot-file-name\": \"nofile\",\n" " \"decline-probation-period\": 86400,\n" " \"dhcp-ddns\": {\n" " \"always-include-fqdn\": false,\n" @@ -2581,8 +2607,12 @@ const char* UNPARSED_CONFIGS[] = { " \"lease-database\": {\n" " \"type\": \"memfile\"\n" " },\n" +" \"next-server\": \"192.0.0.1\",\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" +" \"server-hostname\": \"nohost\",\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -2611,7 +2641,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 9 "{\n" @@ -2653,6 +2684,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -2681,7 +2714,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 10 "{\n" @@ -2723,6 +2757,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -2751,7 +2787,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 11 "{\n" @@ -2793,6 +2830,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -2847,7 +2886,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.3.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 12 "{\n" @@ -2887,8 +2927,11 @@ const char* UNPARSED_CONFIGS[] = { " \"lease-database\": {\n" " \"type\": \"memfile\"\n" " },\n" +" \"match-client-id\": true,\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -2943,7 +2986,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.3.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 13 "{\n" @@ -2985,6 +3029,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -3013,7 +3059,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 14 "{\n" @@ -3055,6 +3102,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -3117,7 +3166,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.3.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 15 "{\n" @@ -3159,6 +3209,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -3187,7 +3239,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 16 "{\n" @@ -3626,6 +3679,8 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -3654,7 +3709,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 24 "{\n" @@ -3696,6 +3752,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -3741,7 +3799,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 25 "{\n" @@ -3810,6 +3869,8 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"uint32\"\n" " }\n" " ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -3838,7 +3899,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 26 "{\n" @@ -3916,8 +3978,11 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"ipv4-address\"\n" " }\n" " ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" -" \"subnet4\": [ ]\n" +" \"subnet4\": [ ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 27 "{\n" @@ -4012,6 +4077,8 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"ipv4-address\"\n" " }\n" " ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -4040,7 +4107,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 3000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 3000\n" " }\n", // CONFIGURATION 28 "{\n" @@ -4091,6 +4159,8 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -4136,7 +4206,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 29 "{\n" @@ -4178,6 +4249,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -4250,7 +4323,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.3.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 30 "{\n" @@ -4292,6 +4366,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -4337,7 +4413,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 31 "{\n" @@ -4379,6 +4456,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -4429,7 +4508,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 32 "{\n" @@ -4488,6 +4568,8 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -4516,7 +4598,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 33 "{\n" @@ -4594,8 +4677,11 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"ipv4-address\"\n" " }\n" " ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" -" \"subnet4\": [ ]\n" +" \"subnet4\": [ ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 34 "{\n" @@ -4681,6 +4767,8 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"ipv4-address\"\n" " }\n" " ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -4709,7 +4797,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 3000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 3000\n" " }\n", // CONFIGURATION 35 "{\n" @@ -4766,6 +4855,8 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -4794,7 +4885,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 36 "{\n" @@ -4855,6 +4947,8 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"string\"\n" " }\n" " ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -4883,7 +4977,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 37 "{\n" @@ -4925,8 +5020,11 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" -" \"subnet4\": [ ]\n" +" \"subnet4\": [ ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 38 "{\n" @@ -4968,8 +5066,11 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" -" \"subnet4\": [ ]\n" +" \"subnet4\": [ ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 39 "{\n" @@ -5011,6 +5112,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -5039,7 +5142,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 40 "{\n" @@ -5081,6 +5185,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -5109,7 +5215,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 41 "{\n" @@ -5151,6 +5258,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -5170,7 +5279,7 @@ const char* UNPARSED_CONFIGS[] = { " ],\n" " \"rebind-timer\": 2,\n" " \"relay\": {\n" -" \"ip-addresses\": [ \"192.0.2.123\", \"192.0.2.124\" ]\n" +" \"ip-addresses\": [ \"192.0.3.123\", \"192.0.3.124\" ]\n" " },\n" " \"renew-timer\": 1,\n" " \"reservation-mode\": \"all\",\n" @@ -5179,7 +5288,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 42 "{\n" @@ -5221,6 +5331,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -5330,7 +5442,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.5.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 43 "{\n" @@ -5372,6 +5485,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -5415,7 +5530,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.0.0/16\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 44 "{\n" @@ -5457,6 +5573,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -5640,7 +5758,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.4.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 45 "{\n" @@ -5692,6 +5811,8 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"uint32\"\n" " }\n" " ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -5740,7 +5861,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.3.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 46 "{\n" @@ -5782,6 +5904,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -5888,7 +6012,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.5.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 47 "{\n" @@ -6102,6 +6227,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -6130,7 +6257,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 52 "{\n" @@ -6172,6 +6300,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -6200,7 +6330,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 53 "{\n" @@ -6242,6 +6373,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -6270,7 +6403,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 54 "{\n" @@ -6312,6 +6446,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -6340,7 +6476,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 55 "{\n" @@ -6382,6 +6519,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -6410,7 +6549,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 56 "{\n" @@ -6478,6 +6618,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -6506,7 +6648,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 57 "{\n" @@ -6548,6 +6691,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -6576,7 +6721,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 58 "{\n" @@ -6618,6 +6764,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -6647,7 +6795,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 59 "{\n" @@ -6689,6 +6838,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -6722,7 +6873,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 60 "{\n" @@ -6764,6 +6916,8 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" " \"subnet4\": [\n" " {\n" @@ -6797,7 +6951,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"192.0.2.0/24\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 61 "{\n" @@ -6853,8 +7008,11 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"rebind-timer\": 2000,\n" +" \"renew-timer\": 1000,\n" " \"shared-networks\": [ ],\n" -" \"subnet4\": [ ]\n" +" \"subnet4\": [ ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 62 "{\n" diff --git a/src/bin/dhcp6/json_config_parser.cc b/src/bin/dhcp6/json_config_parser.cc index 4d28b3781d..70ce51c59a 100644 --- a/src/bin/dhcp6/json_config_parser.cc +++ b/src/bin/dhcp6/json_config_parser.cc @@ -419,6 +419,9 @@ configureDhcp6Server(Dhcpv6Srv& server, isc::data::ConstElementPtr config_set, SrvConfigPtr srv_config = CfgMgr::instance().getStagingCfg(); + // Preserve all scalar global parameters + srv_config->extractConfiguredGlobals(config_set); + // Set all default values if not specified by the user. SimpleParser6::setAllDefaults(mutable_cfg); diff --git a/src/bin/dhcp6/tests/get_config_unittest.cc b/src/bin/dhcp6/tests/get_config_unittest.cc index 55cfc62390..82f56b0564 100644 --- a/src/bin/dhcp6/tests/get_config_unittest.cc +++ b/src/bin/dhcp6/tests/get_config_unittest.cc @@ -984,7 +984,7 @@ const char* EXTRACTED_CONFIGS[] = { " }\n" " ],\n" " \"relay\": {\n" -" \"ip-addresses\": [ \"2001:db8:1::abcd\", \"2001:db8:1::abce\" ]\n" +" \"ip-addresses\": [ \"2001:db9::abcd\", \"2001:db9::abce\" ]\n" " },\n" " \"subnet\": \"2001:db8:1::/64\"\n" " }\n" @@ -1772,7 +1772,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -1782,7 +1785,8 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"LLT\"\n" " },\n" " \"shared-networks\": [ ],\n" -" \"subnet6\": [ ]\n" +" \"subnet6\": [ ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 1 "{\n" @@ -1824,7 +1828,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -1857,7 +1864,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:1::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 2 "{\n" @@ -1899,7 +1907,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -1998,7 +2009,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:4::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 3 "{\n" @@ -2040,7 +2052,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -2139,7 +2154,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:4::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 4 "{\n" @@ -2181,7 +2197,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -2280,7 +2299,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:4::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 5 "{\n" @@ -2322,7 +2342,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -2355,7 +2378,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:1::/64\",\n" " \"valid-lifetime\": 4\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 6 "{\n" @@ -2397,7 +2421,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -2431,7 +2458,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:1::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 7 "{\n" @@ -2473,7 +2501,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -2507,7 +2538,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:1::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 8 "{\n" @@ -2549,7 +2581,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -2612,7 +2647,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:2::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 9 "{\n" @@ -2654,7 +2690,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -2687,7 +2726,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:1::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 10 "{\n" @@ -2729,7 +2769,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -2806,7 +2849,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -2885,7 +2931,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -2979,7 +3028,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -3392,7 +3444,10 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -3425,7 +3480,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:1::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 20 "{\n" @@ -3467,7 +3523,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -3517,7 +3576,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:1::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 21 "{\n" @@ -3586,7 +3646,10 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"uint32\"\n" " }\n" " ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -3619,7 +3682,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:1::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 22 "{\n" @@ -3697,7 +3761,10 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"ipv4-address\"\n" " }\n" " ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -3707,7 +3774,8 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"LLT\"\n" " },\n" " \"shared-networks\": [ ],\n" -" \"subnet6\": [ ]\n" +" \"subnet6\": [ ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 23 "{\n" @@ -3802,7 +3870,10 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"ipv4-address\"\n" " }\n" " ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -3835,7 +3906,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:1::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 24 "{\n" @@ -3877,7 +3949,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -3950,7 +4025,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:2::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 25 "{\n" @@ -3992,7 +4068,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -4078,7 +4157,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:1::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 26 "{\n" @@ -4135,7 +4215,10 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -4168,7 +4251,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:1::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 27 "{\n" @@ -4229,7 +4313,10 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"string\"\n" " }\n" " ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -4262,7 +4349,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:1::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 28 "{\n" @@ -4304,7 +4392,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -4314,7 +4405,8 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"LLT\"\n" " },\n" " \"shared-networks\": [ ],\n" -" \"subnet6\": [ ]\n" +" \"subnet6\": [ ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 29 "{\n" @@ -4356,7 +4448,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -4366,7 +4461,8 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"LLT\"\n" " },\n" " \"shared-networks\": [ ],\n" -" \"subnet6\": [ ]\n" +" \"subnet6\": [ ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 30 "{\n" @@ -4408,7 +4504,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -4441,7 +4540,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:1::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 31 "{\n" @@ -4483,7 +4583,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -4508,7 +4611,7 @@ const char* UNPARSED_CONFIGS[] = { " \"rapid-commit\": false,\n" " \"rebind-timer\": 2000,\n" " \"relay\": {\n" -" \"ip-addresses\": [ \"2001:db8:1::abcd\", \"2001:db8:1::abce\" ]\n" +" \"ip-addresses\": [ \"2001:db9::abcd\", \"2001:db9::abce\" ]\n" " },\n" " \"renew-timer\": 1000,\n" " \"reservation-mode\": \"all\",\n" @@ -4516,7 +4619,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:1::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 32 "{\n" @@ -4558,7 +4662,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -4660,7 +4767,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:4::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 33 "{\n" @@ -4702,7 +4810,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -4750,7 +4861,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8::/40\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 34 "{\n" @@ -4792,7 +4904,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -4848,7 +4963,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 35 "{\n" @@ -4890,7 +5006,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -4923,7 +5042,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:1::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 36 "{\n" @@ -4965,7 +5085,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -5117,7 +5240,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:3::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 37 "{\n" @@ -5169,7 +5293,10 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"uint32\"\n" " }\n" " ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -5215,7 +5342,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:2::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 38 "{\n" @@ -5257,7 +5385,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"client-link-addr-option\", \"remote-id\", \"subscriber-id\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -5267,7 +5398,8 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"LLT\"\n" " },\n" " \"shared-networks\": [ ],\n" -" \"subnet6\": [ ]\n" +" \"subnet6\": [ ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 39 "{\n" @@ -5309,7 +5441,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"client-link-addr-option\", \"remote-id\", \"subscriber-id\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -5319,7 +5454,8 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"LLT\"\n" " },\n" " \"shared-networks\": [ ],\n" -" \"subnet6\": [ ]\n" +" \"subnet6\": [ ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 40 "{\n" @@ -5361,7 +5497,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -5460,7 +5599,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:4::/48\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 41 "{\n" @@ -5502,7 +5642,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"23\", \"37\", \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -5512,7 +5655,8 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"LLT\"\n" " },\n" " \"shared-networks\": [ ],\n" -" \"subnet6\": [ ]\n" +" \"subnet6\": [ ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 42 "{\n" @@ -5776,7 +5920,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -5809,7 +5956,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8:1::/64\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 47 "{\n" @@ -5851,7 +5999,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -5884,7 +6035,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8::/32\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 48 "{\n" @@ -5926,7 +6078,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -5960,7 +6115,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8::/32\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 49 "{\n" @@ -6002,7 +6158,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -6041,7 +6200,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8::/32\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 50 "{\n" @@ -6083,7 +6243,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -6122,7 +6285,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8::/32\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 51 "{\n" @@ -6164,7 +6328,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -6199,7 +6366,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8::/32\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 52 "{\n" @@ -6241,7 +6409,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -6277,7 +6448,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8::/32\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 53 "{\n" @@ -6319,7 +6491,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -6360,7 +6535,8 @@ const char* UNPARSED_CONFIGS[] = { " \"subnet\": \"2001:db8::/32\",\n" " \"valid-lifetime\": 4000\n" " }\n" -" ]\n" +" ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 54 "{\n" @@ -6416,7 +6592,10 @@ const char* UNPARSED_CONFIGS[] = { " \"mac-sources\": [ \"any\" ],\n" " \"option-data\": [ ],\n" " \"option-def\": [ ],\n" +" \"preferred-lifetime\": 3000,\n" +" \"rebind-timer\": 2000,\n" " \"relay-supplied-options\": [ \"65\" ],\n" +" \"renew-timer\": 1000,\n" " \"server-id\": {\n" " \"enterprise-id\": 0,\n" " \"htype\": 0,\n" @@ -6426,7 +6605,8 @@ const char* UNPARSED_CONFIGS[] = { " \"type\": \"LLT\"\n" " },\n" " \"shared-networks\": [ ],\n" -" \"subnet6\": [ ]\n" +" \"subnet6\": [ ],\n" +" \"valid-lifetime\": 4000\n" " }\n", // CONFIGURATION 55 "{\n" diff --git a/src/lib/dhcpsrv/srv_config.cc b/src/lib/dhcpsrv/srv_config.cc index 3e29985b3f..c2e53b073c 100644 --- a/src/lib/dhcpsrv/srv_config.cc +++ b/src/lib/dhcpsrv/srv_config.cc @@ -34,7 +34,8 @@ SrvConfig::SrvConfig() cfg_host_operations6_(CfgHostOperations::createConfig6()), class_dictionary_(new ClientClassDictionary()), decline_timer_(0), echo_v4_client_id_(true), dhcp4o6_port_(0), - d2_client_config_(new D2ClientConfig()) { + d2_client_config_(new D2ClientConfig()), + configured_globals_(Element::createMap()) { } SrvConfig::SrvConfig(const uint32_t sequence) @@ -50,7 +51,8 @@ SrvConfig::SrvConfig(const uint32_t sequence) cfg_host_operations6_(CfgHostOperations::createConfig6()), class_dictionary_(new ClientClassDictionary()), decline_timer_(0), echo_v4_client_id_(true), dhcp4o6_port_(0), - d2_client_config_(new D2ClientConfig()) { + d2_client_config_(new D2ClientConfig()), + configured_globals_(Element::createMap()) { } std::string @@ -206,6 +208,21 @@ SrvConfig::updateStatistics() { } } +void +SrvConfig::extractConfiguredGlobals(isc::data::ConstElementPtr config) { + if (config->getType() != Element::map) { + isc_throw(BadValue, "extractConfiguredGlobals must be given a map element"); + } + + const std::map<std::string, ConstElementPtr>& values = config->mapValue(); + for (auto value = values.begin(); value != values.end(); ++value) { + if (value->second->getType() != Element::list && + value->second->getType() != Element::map) { + addConfiguredGlobal(value->first, value->second); + } + } +} + ElementPtr SrvConfig::toElement() const { // Get family for the configuration manager @@ -214,8 +231,13 @@ SrvConfig::toElement() const { ElementPtr result = Element::createMap(); // DhcpX global map ElementPtr dhcp = Element::createMap(); + + // Add in explicitly configured globals. + dhcp->setValue(configured_globals_->mapValue()); + // Set user-context contextToElement(dhcp); + // Set decline-probation-period dhcp->set("decline-probation-period", Element::create(static_cast<long long>(decline_timer_))); @@ -226,6 +248,7 @@ SrvConfig::toElement() const { // Set dhcp4o6-port dhcp->set("dhcp4o6-port", Element::create(static_cast<int>(dhcp4o6_port_))); + // Set dhcp-ddns dhcp->set("dhcp-ddns", d2_client_config_->toElement()); // Set interfaces-config diff --git a/src/lib/dhcpsrv/srv_config.h b/src/lib/dhcpsrv/srv_config.h index 5ca75aefbc..5a73148c12 100644 --- a/src/lib/dhcpsrv/srv_config.h +++ b/src/lib/dhcpsrv/srv_config.h @@ -59,10 +59,12 @@ public: static const uint32_t CFGSEL_DDNS = 0x00000010; /// Number of all subnets static const uint32_t CFGSEL_SUBNET = 0x00000003; + /// Configured globals + static const uint32_t CFGSEL_GLOBALS = 0x00000020; /// IPv4 related config - static const uint32_t CFGSEL_ALL4 = 0x00000015; + static const uint32_t CFGSEL_ALL4 = 0x00000035; /// IPv6 related config - static const uint32_t CFGSEL_ALL6 = 0x0000001A; + static const uint32_t CFGSEL_ALL6 = 0x0000003A; /// Whole config static const uint32_t CFGSEL_ALL = 0xFFFFFFFF; //@} @@ -556,6 +558,21 @@ public: d2_client_config_ = d2_client_config; } + /// @brief Returns pointer to configured global parameters + isc::data::ConstElementPtr getConfiguredGlobals() const { + return (isc::data::ConstElementPtr(configured_globals_)); + } + + /// @brief Saves scalar elements from the global scope of a configuration + void extractConfiguredGlobals(isc::data::ConstElementPtr config); + + /// @brief Adds a parameter to the collection configured globals + /// @param name std::string name of the global to add + /// @param value ElementPtr containing the value of the global + void addConfiguredGlobal(const std::string& name, isc::data::ConstElementPtr value) { + configured_globals_->set(name, value); + } + /// @brief Unparse a configuration object /// /// @return a pointer to unparsed configuration @@ -657,7 +674,11 @@ private: /// this socket is bound and connected to this port and port + 1 uint16_t dhcp4o6_port_; + /// @brief Stores D2 client configuration D2ClientConfigPtr d2_client_config_; + + /// @brief Stores the global parameters specified via configuration + isc::data::ElementPtr configured_globals_; }; /// @name Pointers to the @c SrvConfig object. diff --git a/src/lib/dhcpsrv/tests/srv_config_unittest.cc b/src/lib/dhcpsrv/tests/srv_config_unittest.cc index 7f5a176fc5..86f3266515 100644 --- a/src/lib/dhcpsrv/tests/srv_config_unittest.cc +++ b/src/lib/dhcpsrv/tests/srv_config_unittest.cc @@ -431,6 +431,61 @@ TEST_F(SrvConfigTest, hooksLibraries) { EXPECT_TRUE(copied.getHooksConfig().equal(conf.getHooksConfig())); } +// Verifies basic functions of configured global handling. +TEST_F(SrvConfigTest, configuredGlobals) { + // Create an instance. + SrvConfig conf(32); + + // The map of configured globals should be empty. + ConstElementPtr srv_globals = conf.getConfiguredGlobals(); + ASSERT_TRUE(srv_globals); + ASSERT_EQ(Element::map, srv_globals->getType()); + ASSERT_TRUE(srv_globals->mapValue().empty()); + + // Attempting to extract globals from a non-map should throw. + ASSERT_THROW(conf.extractConfiguredGlobals(Element::create(777)), isc::BadValue); + + // Now let's create a configuration from which to extract global scalars. + // Extraction (currently) has no business logic, so the elements we use + // can be arbitrary. + ConstElementPtr global_cfg; + std::string global_cfg_str = + "{\n" + " \"astring\": \"okay\",\n" + " \"amap\": { \"not-this\":777, \"not-that\": \"poo\" },\n" + " \"anint\": 444,\n" + " \"alist\": [ 1, 2, 3 ],\n" + " \"abool\": true\n" + "}\n"; + ASSERT_NO_THROW(global_cfg = Element::fromJSON(global_cfg_str)); + + // Extract globals from the config. + ASSERT_NO_THROW(conf.extractConfiguredGlobals(global_cfg)); + + // Now see if the extract was correct. + srv_globals = conf.getConfiguredGlobals(); + ASSERT_TRUE(srv_globals); + ASSERT_EQ(Element::map, srv_globals->getType()); + ASSERT_FALSE(srv_globals->mapValue().empty()); + + // Maps and lists should be excluded. + auto globals = srv_globals->mapValue(); + for (auto global = globals.begin(); global != globals.end(); ++global) { + if (global->first == "astring") { + ASSERT_EQ(Element::string, global->second->getType()); + EXPECT_EQ("okay", global->second->stringValue()); + } else if (global->first == "anint") { + ASSERT_EQ(Element::integer, global->second->getType()); + EXPECT_EQ(444, global->second->intValue()); + } else if (global->first == "abool") { + ASSERT_EQ(Element::boolean, global->second->getType()); + EXPECT_TRUE(global->second->boolValue()); + } else { + ADD_FAILURE() << "unexpected element found:" << global->first; + } + } +} + // Verifies that the toElement method works well (tests limited to // direct parameters) TEST_F(SrvConfigTest, unparse) { @@ -448,8 +503,7 @@ TEST_F(SrvConfigTest, unparse) { defaults += conf.getCfgExpiration()->toElement()->str() + ",\n"; defaults += "\"lease-database\": { \"type\": \"memfile\" },\n"; defaults += "\"hooks-libraries\": [ ],\n"; - defaults += "\"dhcp-ddns\": \n"; - defaults += conf.getD2ClientConfig()->toElement()->str() + ",\n"; + defaults += "\"dhcp-ddns\": \n"; defaults += conf.getD2ClientConfig()->toElement()->str() + ",\n"; std::string defaults4 = "\"echo-client-id\": true,\n"; defaults4 += "\"shared-networks\": [ ],\n"; @@ -481,15 +535,28 @@ TEST_F(SrvConfigTest, unparse) { isc::test::runToElementTest<SrvConfig> (header6 + defaults + defaults6 + trailer, conf); - // Verify direct non-default parameters + // Verify direct non-default parameters and configured globals CfgMgr::instance().setFamily(AF_INET); conf.setEchoClientId(false); conf.setDhcp4o6Port(6767); + // Add "configured globals" + conf.addConfiguredGlobal("renew-timer", Element::create(777)); + conf.addConfiguredGlobal("foo", Element::create("bar")); params = "\"echo-client-id\": false,\n"; - params += "\"dhcp4o6-port\": 6767\n"; + params += "\"dhcp4o6-port\": 6767,\n"; + params += "\"renew-timer\": 777,\n"; + params += "\"foo\": \"bar\"\n"; isc::test::runToElementTest<SrvConfig> (header4 + defaults + defaults4 + params + trailer, conf); -} + + // Verify direct non-default parameters and configured globals + CfgMgr::instance().setFamily(AF_INET6); + params = ",\"dhcp4o6-port\": 6767,\n"; + params += "\"renew-timer\": 777,\n"; + params += "\"foo\": \"bar\"\n"; + isc::test::runToElementTest<SrvConfig> + (header6 + defaults + defaults6 + params + trailer, conf); +} // Verifies that the toElement method does not miss host reservations TEST_F(SrvConfigTest, unparseHR) { |