diff --git a/doc/guide/dhcp4-srv.xml b/doc/guide/dhcp4-srv.xml
index 07b0123fdf..0f6cdd4560 100644
--- a/doc/guide/dhcp4-srv.xml
+++ b/doc/guide/dhcp4-srv.xml
@@ -1160,14 +1160,14 @@ It is merely echoed by the server
should be left blank. Note that the above set of comments define the
format of the new option and do not set its values.
-
-
- In the current release the default values are not propagated to the
- parser when the new configuration is being set. Therefore, all
- parameters must be specified at all times, even if their values are
- left blank.
-
-
+
+ The name, code and
+ type parameters are required, all others are
+ optional. The array default value is
+ false. The record-types
+ and encapsulate default values are blank
+ (i.e. ""). The default space is "dhcp4".
+
Once the new option format is defined, its value is set
in the same way as for a standard option. For example the following
diff --git a/doc/guide/dhcp6-srv.xml b/doc/guide/dhcp6-srv.xml
index cfcc6a55c3..11002006b0 100644
--- a/doc/guide/dhcp6-srv.xml
+++ b/doc/guide/dhcp6-srv.xml
@@ -1024,6 +1024,15 @@ temporarily override a list of interface names and listen on all interfaces.
set of comments define the format of the new option and do not set its
values.
+
+ The name, code and
+ type parameters are required, all others are
+ optional. The array default value is
+ false. The record-types
+ and encapsulate default values are blank
+ (i.e. ""). The default space is "dhcp6".
+
+
Once the new option format is defined, its value is set
in the same way as for a standard option. For example the following
commands set a global value that applies to all subnets.
@@ -1061,7 +1070,7 @@ temporarily override a list of interface names and listen on all interfaces.
"space": "dhcp6",
"type": "record",
"array": false,
- "record-types": "ipv4-address, uint16, boolean, string",
+ "record-types": "ipv6-address, uint16, boolean, string",
"encapsulate": ""
}, ...
],
diff --git a/src/bin/dhcp4/json_config_parser.cc b/src/bin/dhcp4/json_config_parser.cc
index 5f83f7064f..46182be90b 100644
--- a/src/bin/dhcp4/json_config_parser.cc
+++ b/src/bin/dhcp4/json_config_parser.cc
@@ -416,8 +416,8 @@ namespace dhcp {
/// @return parser for specified global DHCPv4 parameter
/// @throw NotImplemented if trying to create a parser for unknown
/// config element
- DhcpConfigParser* createGlobalDhcp4ConfigParser(const std::string& config_id,
- ConstElementPtr element) {
+DhcpConfigParser* createGlobalDhcp4ConfigParser(const std::string& config_id,
+ ConstElementPtr element) {
DhcpConfigParser* parser = NULL;
if ((config_id.compare("valid-lifetime") == 0) ||
(config_id.compare("renew-timer") == 0) ||
diff --git a/src/bin/dhcp4/tests/config_parser_unittest.cc b/src/bin/dhcp4/tests/config_parser_unittest.cc
index 18123e380f..c46d643a50 100644
--- a/src/bin/dhcp4/tests/config_parser_unittest.cc
+++ b/src/bin/dhcp4/tests/config_parser_unittest.cc
@@ -1330,10 +1330,7 @@ TEST_F(Dhcp4ParserTest, optionDefIpv4Address) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"ipv4-address\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
@@ -1372,10 +1369,8 @@ TEST_F(Dhcp4ParserTest, optionDefRecord) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"record\","
- " \"array\": False,"
" \"record-types\": \"uint16, ipv4-address, ipv6-address, string\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
@@ -1422,19 +1417,13 @@ TEST_F(Dhcp4ParserTest, optionDefMultiple) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" },"
" {"
" \"name\": \"foo-2\","
" \"code\": 101,"
" \"type\": \"ipv4-address\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
@@ -1488,19 +1477,13 @@ TEST_F(Dhcp4ParserTest, optionDefDuplicate) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" },"
" {"
" \"name\": \"foo-2\","
" \"code\": 100,"
" \"type\": \"ipv4-address\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
@@ -1529,9 +1512,7 @@ TEST_F(Dhcp4ParserTest, optionDefArray) {
" \"code\": 100,"
" \"type\": \"uint32\","
" \"array\": True,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
@@ -1571,8 +1552,6 @@ TEST_F(Dhcp4ParserTest, optionDefEncapsulate) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"sub-opts-space\""
" } ]"
@@ -1613,10 +1592,7 @@ TEST_F(Dhcp4ParserTest, optionDefInvalidName) {
" \"name\": \"invalid%name\","
" \"code\": 100,"
" \"type\": \"string\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
@@ -1640,10 +1616,7 @@ TEST_F(Dhcp4ParserTest, optionDefInvalidType) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"sting\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
@@ -1667,10 +1640,8 @@ TEST_F(Dhcp4ParserTest, optionDefInvalidRecordType) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"record\","
- " \"array\": False,"
" \"record-types\": \"uint32,uint8,sting\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
@@ -1694,8 +1665,6 @@ TEST_F(Dhcp4ParserTest, optionDefInvalidEncapsulatedSpace) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"invalid%space%name\""
" } ]"
@@ -1724,7 +1693,6 @@ TEST_F(Dhcp4ParserTest, optionDefEncapsulatedSpaceAndArray) {
" \"code\": 100,"
" \"type\": \"uint32\","
" \"array\": True,"
- " \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"valid-space-name\""
" } ]"
@@ -1750,8 +1718,6 @@ TEST_F(Dhcp4ParserTest, optionDefEncapsulateOwnSpace) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"isc\""
" } ]"
@@ -1781,10 +1747,7 @@ TEST_F(Dhcp4ParserTest, optionStandardDefOverride) {
" \"name\": \"foo\","
" \"code\": 109,"
" \"type\": \"string\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"dhcp4\","
- " \"encapsulate\": \"\""
+ " \"space\": \"dhcp4\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
@@ -1818,10 +1781,7 @@ TEST_F(Dhcp4ParserTest, optionStandardDefOverride) {
" \"name\": \"routers\","
" \"code\": 3,"
" \"type\": \"ipv4-address\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"dhcp4\","
- " \"encapsulate\": \"\""
+ " \"space\": \"dhcp4\""
" } ]"
"}";
json = Element::fromJSON(config);
@@ -1843,10 +1803,7 @@ TEST_F(Dhcp4ParserTest, optionStandardDefOverride) {
" \"name\": \"nis-server-addr\","
" \"code\": 65,"
" \"type\": \"ipv4-address\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"dhcp4\","
- " \"encapsulate\": \"\""
+ " \"space\": \"dhcp4\""
" } ]"
"}";
json = Element::fromJSON(config);
@@ -1879,15 +1836,11 @@ TEST_F(Dhcp4ParserTest, optionDataDefaults) {
"\"renew-timer\": 1000,"
"\"option-data\": [ {"
" \"name\": \"dhcp-message\","
- " \"space\": \"dhcp4\","
- " \"code\": 56,"
" \"data\": \"ABCDEF0105\","
" \"csv-format\": False"
" },"
" {"
" \"name\": \"default-ip-ttl\","
- " \"space\": \"dhcp4\","
- " \"code\": 23,"
" \"data\": \"01\","
" \"csv-format\": False"
" } ],"
@@ -1952,26 +1905,19 @@ TEST_F(Dhcp4ParserTest, optionDataTwoSpaces) {
"\"renew-timer\": 1000,"
"\"option-data\": [ {"
" \"name\": \"dhcp-message\","
- " \"space\": \"dhcp4\","
- " \"code\": 56,"
" \"data\": \"ABCDEF0105\","
" \"csv-format\": False"
" },"
" {"
" \"name\": \"foo\","
" \"space\": \"isc\","
- " \"code\": 56,"
- " \"data\": \"1234\","
- " \"csv-format\": True"
+ " \"data\": \"1234\""
" } ],"
"\"option-def\": [ {"
" \"name\": \"foo\","
" \"code\": 56,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ],"
"\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
@@ -2033,34 +1979,24 @@ TEST_F(Dhcp4ParserTest, optionDataEncapsulate) {
"\"option-data\": [ {"
" \"name\": \"foo\","
" \"space\": \"isc\","
- " \"code\": 1,"
- " \"data\": \"1234\","
- " \"csv-format\": True"
+ " \"data\": \"1234\""
" },"
" {"
" \"name\": \"foo2\","
" \"space\": \"isc\","
- " \"code\": 2,"
- " \"data\": \"192.168.2.1\","
- " \"csv-format\": True"
+ " \"data\": \"192.168.2.1\""
" } ],"
"\"option-def\": [ {"
" \"name\": \"foo\","
" \"code\": 1,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" },"
" {"
" \"name\": \"foo2\","
" \"code\": 2,"
" \"type\": \"ipv4-address\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ]"
"}";
@@ -2084,31 +2020,22 @@ TEST_F(Dhcp4ParserTest, optionDataEncapsulate) {
"\"renew-timer\": 1000,"
"\"option-data\": [ {"
" \"name\": \"base-option\","
- " \"space\": \"dhcp4\","
- " \"code\": 222,"
- " \"data\": \"11\","
- " \"csv-format\": True"
+ " \"data\": \"11\""
" },"
" {"
" \"name\": \"foo\","
" \"space\": \"isc\","
- " \"code\": 1,"
- " \"data\": \"1234\","
- " \"csv-format\": True"
+ " \"data\": \"1234\""
" },"
" {"
" \"name\": \"foo2\","
" \"space\": \"isc\","
- " \"code\": 2,"
- " \"data\": \"192.168.2.1\","
- " \"csv-format\": True"
+ " \"data\": \"192.168.2.1\""
" } ],"
"\"option-def\": [ {"
" \"name\": \"base-option\","
" \"code\": 222,"
" \"type\": \"uint8\","
- " \"array\": False,"
- " \"record-types\": \"\","
" \"space\": \"dhcp4\","
" \"encapsulate\": \"isc\""
"},"
@@ -2116,19 +2043,13 @@ TEST_F(Dhcp4ParserTest, optionDataEncapsulate) {
" \"name\": \"foo\","
" \"code\": 1,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" },"
" {"
" \"name\": \"foo2\","
" \"code\": 2,"
" \"type\": \"ipv4-address\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ],"
"\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
@@ -2180,8 +2101,6 @@ TEST_F(Dhcp4ParserTest, optionDataInSingleSubnet) {
"\"renew-timer\": 1000, "
"\"option-data\": [ {"
" \"name\": \"dhcp-message\","
- " \"space\": \"dhcp4\","
- " \"code\": 56,"
" \"data\": \"AB\","
" \"csv-format\": False"
" } ],"
@@ -2190,15 +2109,11 @@ TEST_F(Dhcp4ParserTest, optionDataInSingleSubnet) {
" \"subnet\": \"192.0.2.0/24\", "
" \"option-data\": [ {"
" \"name\": \"dhcp-message\","
- " \"space\": \"dhcp4\","
- " \"code\": 56,"
" \"data\": \"ABCDEF0105\","
" \"csv-format\": False"
" },"
" {"
" \"name\": \"default-ip-ttl\","
- " \"space\": \"dhcp4\","
- " \"code\": 23,"
" \"data\": \"01\","
" \"csv-format\": False"
" } ]"
@@ -2337,8 +2252,6 @@ TEST_F(Dhcp4ParserTest, optionDataInMultipleSubnets) {
" \"subnet\": \"192.0.2.0/24\", "
" \"option-data\": [ {"
" \"name\": \"dhcp-message\","
- " \"space\": \"dhcp4\","
- " \"code\": 56,"
" \"data\": \"0102030405060708090A\","
" \"csv-format\": False"
" } ]"
@@ -2348,8 +2261,6 @@ TEST_F(Dhcp4ParserTest, optionDataInMultipleSubnets) {
" \"subnet\": \"192.0.3.0/24\", "
" \"option-data\": [ {"
" \"name\": \"default-ip-ttl\","
- " \"space\": \"dhcp4\","
- " \"code\": 23,"
" \"data\": \"FF\","
" \"csv-format\": False"
" } ]"
@@ -2610,34 +2521,24 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) {
"\"option-data\": [ {"
" \"name\": \"foo\","
" \"space\": \"vendor-encapsulated-options-space\","
- " \"code\": 1,"
- " \"data\": \"1234\","
- " \"csv-format\": True"
+ " \"data\": \"1234\""
" },"
" {"
" \"name\": \"foo2\","
" \"space\": \"vendor-encapsulated-options-space\","
- " \"code\": 2,"
- " \"data\": \"192.168.2.1\","
- " \"csv-format\": True"
+ " \"data\": \"192.168.2.1\""
" } ],"
"\"option-def\": [ {"
" \"name\": \"foo\","
" \"code\": 1,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"vendor-encapsulated-options-space\","
- " \"encapsulate\": \"\""
+ " \"space\": \"vendor-encapsulated-options-space\""
" },"
" {"
" \"name\": \"foo2\","
" \"code\": 2,"
" \"type\": \"ipv4-address\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"vendor-encapsulated-options-space\","
- " \"encapsulate\": \"\""
+ " \"space\": \"vendor-encapsulated-options-space\""
" } ]"
"}";
@@ -2665,17 +2566,12 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) {
"\"renew-timer\": 1000,"
"\"option-data\": [ {"
" \"name\": \"vendor-encapsulated-options\","
- " \"space\": \"dhcp4\","
- " \"code\": 43,"
- " \"data\": \"\","
" \"csv-format\": False"
" },"
" {"
" \"name\": \"foo\","
" \"space\": \"vendor-encapsulated-options-space\","
- " \"code\": 1,"
- " \"data\": \"1234\","
- " \"csv-format\": True"
+ " \"data\": \"1234\""
" },"
" {"
" \"name\": \"foo2\","
@@ -2688,19 +2584,13 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) {
" \"name\": \"foo\","
" \"code\": 1,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"vendor-encapsulated-options-space\","
- " \"encapsulate\": \"\""
+ " \"space\": \"vendor-encapsulated-options-space\""
" },"
" {"
" \"name\": \"foo2\","
" \"code\": 2,"
" \"type\": \"ipv4-address\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"vendor-encapsulated-options-space\","
- " \"encapsulate\": \"\""
+ " \"space\": \"vendor-encapsulated-options-space\""
" } ],"
"\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
@@ -2834,17 +2724,13 @@ TEST_F(Dhcp4ParserTest, vendorOptionsCsv) {
" \"name\": \"foo\","
" \"space\": \"vendor-4491\","
" \"code\": 100,"
- " \"data\": \"this is a string vendor-opt\","
- " \"csv-format\": True"
+ " \"data\": \"this is a string vendor-opt\""
" } ],"
"\"option-def\": [ {"
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"string\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"vendor-4491\","
- " \"encapsulate\": \"\""
+ " \"space\": \"vendor-4491\""
" } ],"
"\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
@@ -2911,26 +2797,19 @@ buildHooksLibrariesConfig(const std::vector& libraries) {
"\"renew-timer\": 1000,"
"\"option-data\": [ {"
" \"name\": \"dhcp-message\","
- " \"space\": \"dhcp4\","
- " \"code\": 56,"
" \"data\": \"ABCDEF0105\","
" \"csv-format\": False"
" },"
" {"
" \"name\": \"foo\","
" \"space\": \"isc\","
- " \"code\": 56,"
- " \"data\": \"1234\","
- " \"csv-format\": True"
+ " \"data\": \"1234\""
" } ],"
"\"option-def\": [ {"
" \"name\": \"foo\","
" \"code\": 56,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ],"
"\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
diff --git a/src/bin/dhcp4/tests/decline_unittest.cc b/src/bin/dhcp4/tests/decline_unittest.cc
index d420749f20..f2faff9079 100644
--- a/src/bin/dhcp4/tests/decline_unittest.cc
+++ b/src/bin/dhcp4/tests/decline_unittest.cc
@@ -53,10 +53,7 @@ const char* DECLINE_CONFIGS[] = {
" \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.100\" } ],"
" \"option-data\": [ {"
" \"name\": \"routers\","
- " \"code\": 3,"
- " \"data\": \"10.0.0.200,10.0.0.201\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"10.0.0.200,10.0.0.201\""
" } ]"
" } ]"
"}"
diff --git a/src/bin/dhcp4/tests/dora_unittest.cc b/src/bin/dhcp4/tests/dora_unittest.cc
index 36f3090fc3..051bb43edf 100644
--- a/src/bin/dhcp4/tests/dora_unittest.cc
+++ b/src/bin/dhcp4/tests/dora_unittest.cc
@@ -77,31 +77,19 @@ const char* DORA_CONFIGS[] = {
" \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.100\" } ],"
" \"option-data\": [ {"
" \"name\": \"routers\","
- " \"code\": 3,"
- " \"data\": \"10.0.0.200,10.0.0.201\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"10.0.0.200,10.0.0.201\""
" },"
" {"
" \"name\": \"domain-name-servers\","
- " \"code\": 6,"
- " \"data\": \"10.0.0.202,10.0.0.203\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"10.0.0.202,10.0.0.203\""
" },"
" {"
" \"name\": \"log-servers\","
- " \"code\": 7,"
- " \"data\": \"10.0.0.200,10.0.0.201\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"10.0.0.200,10.0.0.201\""
" },"
" {"
" \"name\": \"cookie-servers\","
- " \"code\": 8,"
- " \"data\": \"10.0.0.202,10.0.0.203\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"10.0.0.202,10.0.0.203\""
" } ]"
" } ]"
"}",
@@ -116,31 +104,19 @@ const char* DORA_CONFIGS[] = {
" \"subnet\": \"192.0.2.0/24\", "
" \"option-data\": [ {"
" \"name\": \"routers\","
- " \"code\": 3,"
- " \"data\": \"192.0.2.200,192.0.2.201\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"192.0.2.200,192.0.2.201\""
" },"
" {"
" \"name\": \"domain-name-servers\","
- " \"code\": 6,"
- " \"data\": \"192.0.2.202,192.0.2.203\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"192.0.2.202,192.0.2.203\""
" },"
" {"
" \"name\": \"log-servers\","
- " \"code\": 7,"
- " \"data\": \"10.0.0.200,10.0.0.201\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"10.0.0.200,10.0.0.201\""
" },"
" {"
" \"name\": \"cookie-servers\","
- " \"code\": 8,"
- " \"data\": \"10.0.0.202,10.0.0.203\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"10.0.0.202,10.0.0.203\""
" } ]"
" } ]"
"}",
@@ -174,10 +150,7 @@ const char* DORA_CONFIGS[] = {
" \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.100\" } ],"
" \"option-data\": [ {"
" \"name\": \"routers\","
- " \"code\": 3,"
- " \"data\": \"10.0.0.200,10.0.0.201\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"10.0.0.200,10.0.0.201\""
" } ]"
" } ]"
"}",
diff --git a/src/bin/dhcp4/tests/fqdn_unittest.cc b/src/bin/dhcp4/tests/fqdn_unittest.cc
index 13610c299b..ca591c07ee 100644
--- a/src/bin/dhcp4/tests/fqdn_unittest.cc
+++ b/src/bin/dhcp4/tests/fqdn_unittest.cc
@@ -47,10 +47,7 @@ const char* CONFIGS[] = {
" \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.100\" } ],"
" \"option-data\": [ {"
" \"name\": \"routers\","
- " \"code\": 3,"
- " \"data\": \"10.0.0.200,10.0.0.201\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"10.0.0.200,10.0.0.201\""
" } ],"
" \"reservations\": ["
" {"
@@ -74,10 +71,7 @@ const char* CONFIGS[] = {
" \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.100\" } ],"
" \"option-data\": [ {"
" \"name\": \"routers\","
- " \"code\": 3,"
- " \"data\": \"10.0.0.200,10.0.0.201\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"10.0.0.200,10.0.0.201\""
" } ],"
" \"reservations\": ["
" {"
diff --git a/src/bin/dhcp4/tests/inform_unittest.cc b/src/bin/dhcp4/tests/inform_unittest.cc
index e1fd87215a..ce5f604381 100644
--- a/src/bin/dhcp4/tests/inform_unittest.cc
+++ b/src/bin/dhcp4/tests/inform_unittest.cc
@@ -58,31 +58,19 @@ const char* INFORM_CONFIGS[] = {
" \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.100\" } ],"
" \"option-data\": [ {"
" \"name\": \"routers\","
- " \"code\": 3,"
- " \"data\": \"10.0.0.200,10.0.0.201\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"10.0.0.200,10.0.0.201\""
" },"
" {"
" \"name\": \"domain-name-servers\","
- " \"code\": 6,"
- " \"data\": \"10.0.0.202,10.0.0.203\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"10.0.0.202,10.0.0.203\""
" },"
" {"
" \"name\": \"log-servers\","
- " \"code\": 7,"
- " \"data\": \"10.0.0.200,10.0.0.201\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"10.0.0.200,10.0.0.201\""
" },"
" {"
" \"name\": \"cookie-servers\","
- " \"code\": 8,"
- " \"data\": \"10.0.0.202,10.0.0.203\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"10.0.0.202,10.0.0.203\""
" } ]"
" } ]"
"}",
@@ -96,31 +84,19 @@ const char* INFORM_CONFIGS[] = {
" \"subnet\": \"192.0.2.0/24\", "
" \"option-data\": [ {"
" \"name\": \"routers\","
- " \"code\": 3,"
- " \"data\": \"192.0.2.200,192.0.2.201\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"192.0.2.200,192.0.2.201\""
" },"
" {"
" \"name\": \"domain-name-servers\","
- " \"code\": 6,"
- " \"data\": \"192.0.2.202,192.0.2.203\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"192.0.2.202,192.0.2.203\""
" },"
" {"
" \"name\": \"log-servers\","
- " \"code\": 7,"
- " \"data\": \"10.0.0.200,10.0.0.201\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"10.0.0.200,10.0.0.201\""
" },"
" {"
" \"name\": \"cookie-servers\","
- " \"code\": 8,"
- " \"data\": \"10.0.0.202,10.0.0.203\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"10.0.0.202,10.0.0.203\""
" } ]"
" } ]"
"}"
diff --git a/src/bin/dhcp4/tests/release_unittest.cc b/src/bin/dhcp4/tests/release_unittest.cc
index c1ac1fda9a..5b6985610f 100644
--- a/src/bin/dhcp4/tests/release_unittest.cc
+++ b/src/bin/dhcp4/tests/release_unittest.cc
@@ -53,10 +53,7 @@ const char* RELEASE_CONFIGS[] = {
" \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.100\" } ],"
" \"option-data\": [ {"
" \"name\": \"routers\","
- " \"code\": 3,"
- " \"data\": \"10.0.0.200,10.0.0.201\","
- " \"csv-format\": true,"
- " \"space\": \"dhcp4\""
+ " \"data\": \"10.0.0.200,10.0.0.201\""
" } ]"
" } ]"
"}"
diff --git a/src/bin/dhcp6/json_config_parser.cc b/src/bin/dhcp6/json_config_parser.cc
index cc269ae91c..c7bf0de63f 100644
--- a/src/bin/dhcp6/json_config_parser.cc
+++ b/src/bin/dhcp6/json_config_parser.cc
@@ -665,8 +665,8 @@ namespace dhcp {
/// @return parser for specified global DHCPv6 parameter
/// @throw NotImplemented if trying to create a parser for unknown config
/// element
- DhcpConfigParser* createGlobal6DhcpConfigParser(const std::string& config_id,
- ConstElementPtr element) {
+DhcpConfigParser* createGlobal6DhcpConfigParser(const std::string& config_id,
+ ConstElementPtr element) {
DhcpConfigParser* parser = NULL;
if ((config_id.compare("preferred-lifetime") == 0) ||
(config_id.compare("valid-lifetime") == 0) ||
diff --git a/src/bin/dhcp6/tests/config_parser_unittest.cc b/src/bin/dhcp6/tests/config_parser_unittest.cc
index 108902698e..983fcc0b5b 100644
--- a/src/bin/dhcp6/tests/config_parser_unittest.cc
+++ b/src/bin/dhcp6/tests/config_parser_unittest.cc
@@ -205,10 +205,7 @@ public:
" \"name\": \"bool-option\","
" \"code\": 1000,"
" \"type\": \"boolean\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"dhcp6\","
- " \"encapsulate\": \"\""
+ " \"space\": \"dhcp6\""
"} ],"
"\"subnet6\": [ { "
" \"pools\": [ { \"pool\": \"2001:db8:1::/80\" } ],"
@@ -1572,10 +1569,7 @@ TEST_F(Dhcp6ParserTest, optionDefIpv6Address) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"ipv6-address\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
@@ -1612,10 +1606,8 @@ TEST_F(Dhcp6ParserTest, optionDefRecord) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"record\","
- " \"array\": False,"
" \"record-types\": \"uint16, ipv4-address, ipv6-address, string\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
@@ -1661,19 +1653,13 @@ TEST_F(Dhcp6ParserTest, optionDefMultiple) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" },"
" {"
" \"name\": \"foo-2\","
" \"code\": 101,"
" \"type\": \"ipv4-address\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
@@ -1725,19 +1711,13 @@ TEST_F(Dhcp6ParserTest, optionDefDuplicate) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" },"
" {"
" \"name\": \"foo-2\","
" \"code\": 100,"
" \"type\": \"ipv4-address\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
@@ -1766,9 +1746,7 @@ TEST_F(Dhcp6ParserTest, optionDefArray) {
" \"code\": 100,"
" \"type\": \"uint32\","
" \"array\": True,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
@@ -1806,8 +1784,6 @@ TEST_F(Dhcp6ParserTest, optionDefEncapsulate) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"sub-opts-space\""
" } ]"
@@ -1847,10 +1823,7 @@ TEST_F(Dhcp6ParserTest, optionDefInvalidName) {
" \"name\": \"invalid%name\","
" \"code\": 100,"
" \"type\": \"string\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
@@ -1874,10 +1847,7 @@ TEST_F(Dhcp6ParserTest, optionDefInvalidType) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"sting\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
@@ -1901,10 +1871,8 @@ TEST_F(Dhcp6ParserTest, optionDefInvalidRecordType) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"record\","
- " \"array\": False,"
" \"record-types\": \"uint32,uint8,sting\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
@@ -1928,8 +1896,6 @@ TEST_F(Dhcp6ParserTest, optionDefInvalidEncapsulatedSpace) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"invalid%space%name\""
" } ]"
@@ -1958,7 +1924,6 @@ TEST_F(Dhcp6ParserTest, optionDefEncapsulatedSpaceAndArray) {
" \"code\": 100,"
" \"type\": \"uint32\","
" \"array\": True,"
- " \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"valid-space-name\""
" } ]"
@@ -1984,8 +1949,6 @@ TEST_F(Dhcp6ParserTest, optionDefEncapsulateOwnSpace) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"isc\""
" } ]"
@@ -2016,10 +1979,7 @@ TEST_F(Dhcp6ParserTest, optionStandardDefOverride) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"string\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"dhcp6\","
- " \"encapsulate\": \"\""
+ " \"space\": \"dhcp6\""
" } ]"
"}";
ElementPtr json = Element::fromJSON(config);
@@ -2053,10 +2013,7 @@ TEST_F(Dhcp6ParserTest, optionStandardDefOverride) {
" \"name\": \"foo\","
" \"code\": 3,"
" \"type\": \"string\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"dhcp6\","
- " \"encapsulate\": \"\""
+ " \"space\": \"dhcp6\""
" } ]"
"}";
json = Element::fromJSON(config);
@@ -2078,10 +2035,7 @@ TEST_F(Dhcp6ParserTest, optionStandardDefOverride) {
" \"name\": \"geolocation\","
" \"code\": 63,"
" \"type\": \"string\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"dhcp6\","
- " \"encapsulate\": \"\""
+ " \"space\": \"dhcp6\""
" } ]"
"}";
json = Element::fromJSON(config);
@@ -2114,17 +2068,12 @@ TEST_F(Dhcp6ParserTest, optionDataDefaults) {
"\"renew-timer\": 1000,"
"\"option-data\": [ {"
" \"name\": \"subscriber-id\","
- " \"space\": \"dhcp6\","
- " \"code\": 38,"
" \"data\": \"ABCDEF0105\","
" \"csv-format\": False"
" },"
" {"
" \"name\": \"preference\","
- " \"space\": \"dhcp6\","
- " \"code\": 7,"
- " \"data\": \"01\","
- " \"csv-format\": True"
+ " \"data\": \"01\""
" } ],"
"\"subnet6\": [ { "
" \"pools\": [ { \"pool\": \"2001:db8:1::/80\" } ],"
@@ -2196,26 +2145,19 @@ TEST_F(Dhcp6ParserTest, optionDataTwoSpaces) {
"\"renew-timer\": 1000,"
"\"option-data\": [ {"
" \"name\": \"subscriber-id\","
- " \"space\": \"dhcp6\","
- " \"code\": 38,"
" \"data\": \"ABCDEF0105\","
" \"csv-format\": False"
" },"
" {"
" \"name\": \"foo\","
" \"space\": \"isc\","
- " \"code\": 38,"
- " \"data\": \"1234\","
- " \"csv-format\": True"
+ " \"data\": \"1234\""
" } ],"
"\"option-def\": [ {"
" \"name\": \"foo\","
" \"code\": 38,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ],"
"\"subnet6\": [ { "
" \"pools\": [ { \"pool\": \"2001:db8:1::/80\" } ],"
@@ -2278,34 +2220,24 @@ TEST_F(Dhcp6ParserTest, optionDataEncapsulate) {
"\"option-data\": [ {"
" \"name\": \"foo\","
" \"space\": \"isc\","
- " \"code\": 110,"
- " \"data\": \"1234\","
- " \"csv-format\": True"
+ " \"data\": \"1234\""
" },"
" {"
" \"name\": \"foo2\","
" \"space\": \"isc\","
- " \"code\": 111,"
- " \"data\": \"192.168.2.1\","
- " \"csv-format\": True"
+ " \"data\": \"192.168.2.1\""
" } ],"
"\"option-def\": [ {"
" \"name\": \"foo\","
" \"code\": 110,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" },"
" {"
" \"name\": \"foo2\","
" \"code\": 111,"
" \"type\": \"ipv4-address\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ]"
"}";
@@ -2330,31 +2262,22 @@ TEST_F(Dhcp6ParserTest, optionDataEncapsulate) {
"\"renew-timer\": 1000,"
"\"option-data\": [ {"
" \"name\": \"base-option\","
- " \"space\": \"dhcp6\","
- " \"code\": 100,"
- " \"data\": \"11\","
- " \"csv-format\": True"
+ " \"data\": \"11\""
" },"
" {"
" \"name\": \"foo\","
" \"space\": \"isc\","
- " \"code\": 110,"
- " \"data\": \"1234\","
- " \"csv-format\": True"
+ " \"data\": \"1234\""
" },"
" {"
" \"name\": \"foo2\","
" \"space\": \"isc\","
- " \"code\": 111,"
- " \"data\": \"192.168.2.1\","
- " \"csv-format\": True"
+ " \"data\": \"192.168.2.1\""
" } ],"
"\"option-def\": [ {"
" \"name\": \"base-option\","
" \"code\": 100,"
" \"type\": \"uint8\","
- " \"array\": False,"
- " \"record-types\": \"\","
" \"space\": \"dhcp6\","
" \"encapsulate\": \"isc\""
"},"
@@ -2362,19 +2285,13 @@ TEST_F(Dhcp6ParserTest, optionDataEncapsulate) {
" \"name\": \"foo\","
" \"code\": 110,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" },"
" {"
" \"name\": \"foo2\","
" \"code\": 111,"
" \"type\": \"ipv4-address\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ],"
"\"subnet6\": [ { "
" \"pools\": [ { \"pool\": \"2001:db8:1::/80\" } ],"
@@ -2429,8 +2346,6 @@ TEST_F(Dhcp6ParserTest, optionDataInMultipleSubnets) {
" \"subnet\": \"2001:db8:1::/64\", "
" \"option-data\": [ {"
" \"name\": \"subscriber-id\","
- " \"space\": \"dhcp6\","
- " \"code\": 38,"
" \"data\": \"0102030405060708090A\","
" \"csv-format\": False"
" } ]"
@@ -2440,8 +2355,6 @@ TEST_F(Dhcp6ParserTest, optionDataInMultipleSubnets) {
" \"subnet\": \"2001:db8:2::/64\", "
" \"option-data\": [ {"
" \"name\": \"user-class\","
- " \"space\": \"dhcp6\","
- " \"code\": 15,"
" \"data\": \"FFFEFDFCFB\","
" \"csv-format\": False"
" } ]"
@@ -2804,17 +2717,13 @@ TEST_F(Dhcp6ParserTest, vendorOptionsCsv) {
" \"name\": \"foo\","
" \"space\": \"vendor-4491\","
" \"code\": 100,"
- " \"data\": \"this is a string vendor-opt\","
- " \"csv-format\": True"
+ " \"data\": \"this is a string vendor-opt\""
" } ],"
"\"option-def\": [ {"
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"string\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"vendor-4491\","
- " \"encapsulate\": \"\""
+ " \"space\": \"vendor-4491\""
" } ],"
"\"subnet6\": [ { "
" \"pools\": [ { \"pool\": \"2001:db8:1::/80\" } ],"
@@ -2869,34 +2778,24 @@ TEST_F(Dhcp6ParserTest, DISABLED_stdOptionDataEncapsulate) {
"\"option-data\": [ {"
" \"name\": \"foo\","
" \"space\": \"vendor-opts-space\","
- " \"code\": 110,"
- " \"data\": \"1234\","
- " \"csv-format\": True"
+ " \"data\": \"1234\""
" },"
" {"
" \"name\": \"foo2\","
" \"space\": \"vendor-opts-space\","
- " \"code\": 111,"
- " \"data\": \"192.168.2.1\","
- " \"csv-format\": True"
+ " \"data\": \"192.168.2.1\""
" } ],"
"\"option-def\": [ {"
" \"name\": \"foo\","
" \"code\": 110,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"vendor-opts-space\","
- " \"encapsulate\": \"\""
+ " \"space\": \"vendor-opts-space\""
" },"
" {"
" \"name\": \"foo2\","
" \"code\": 111,"
" \"type\": \"ipv4-address\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"vendor-opts-space\","
- " \"encapsulate\": \"\""
+ " \"space\": \"vendor-opts-space\""
" } ]"
"}";
@@ -2923,42 +2822,29 @@ TEST_F(Dhcp6ParserTest, DISABLED_stdOptionDataEncapsulate) {
"\"renew-timer\": 1000,"
"\"option-data\": [ {"
" \"name\": \"vendor-opts\","
- " \"space\": \"dhcp6\","
- " \"code\": 17,"
- " \"data\": \"1234\","
- " \"csv-format\": True"
+ " \"data\": \"1234\""
" },"
" {"
" \"name\": \"foo\","
" \"space\": \"vendor-opts-space\","
- " \"code\": 110,"
- " \"data\": \"1234\","
- " \"csv-format\": True"
+ " \"data\": \"1234\""
" },"
" {"
" \"name\": \"foo2\","
" \"space\": \"vendor-opts-space\","
- " \"code\": 111,"
- " \"data\": \"192.168.2.1\","
- " \"csv-format\": True"
+ " \"data\": \"192.168.2.1\""
" } ],"
"\"option-def\": [ {"
" \"name\": \"foo\","
" \"code\": 110,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"vendor-opts-space\","
- " \"encapsulate\": \"\""
+ " \"space\": \"vendor-opts-space\""
" },"
" {"
" \"name\": \"foo2\","
" \"code\": 111,"
" \"type\": \"ipv4-address\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"vendor-opts-space\","
- " \"encapsulate\": \"\""
+ " \"space\": \"vendor-opts-space\""
" } ],"
"\"subnet6\": [ { "
" \"pools\": [ { \"pool\": \"2001:db8:1::/80\" } ],"
@@ -3049,34 +2935,24 @@ buildHooksLibrariesConfig(const std::vector& libraries) {
"\"option-data\": [ {"
" \"name\": \"foo\","
" \"space\": \"vendor-opts-space\","
- " \"code\": 110,"
- " \"data\": \"1234\","
- " \"csv-format\": True"
+ " \"data\": \"1234\""
" },"
" {"
" \"name\": \"foo2\","
" \"space\": \"vendor-opts-space\","
- " \"code\": 111,"
- " \"data\": \"192.168.2.1\","
- " \"csv-format\": True"
+ " \"data\": \"192.168.2.1\""
" } ],"
"\"option-def\": [ {"
" \"name\": \"foo\","
" \"code\": 110,"
" \"type\": \"uint32\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"vendor-opts-space\","
- " \"encapsulate\": \"\""
+ " \"space\": \"vendor-opts-space\""
" },"
" {"
" \"name\": \"foo2\","
" \"code\": 111,"
" \"type\": \"ipv4-address\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"vendor-opts-space\","
- " \"encapsulate\": \"\""
+ " \"space\": \"vendor-opts-space\""
" } ]"
"}");
diff --git a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
index 9fd2a3a933..a5d1c1519c 100644
--- a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
+++ b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
@@ -300,15 +300,10 @@ TEST_F(Dhcpv6SrvTest, advertiseOptions) {
" \"interface\": \"eth0\", "
" \"option-data\": [ {"
" \"name\": \"dns-servers\","
- " \"space\": \"dhcp6\","
- " \"code\": 23,"
- " \"data\": \"2001:db8:1234:FFFF::1, 2001:db8:1234:FFFF::2\","
- " \"csv-format\": True"
+ " \"data\": \"2001:db8:1234:FFFF::1, 2001:db8:1234:FFFF::2\""
" },"
" {"
" \"name\": \"subscriber-id\","
- " \"space\": \"dhcp6\","
- " \"code\": 38,"
" \"data\": \"1234\","
" \"csv-format\": False"
" } ]"
@@ -1615,17 +1610,12 @@ TEST_F(Dhcpv6SrvTest, vendorOptionsORO) {
" \"name\": \"config-file\","
" \"code\": 33,"
" \"type\": \"string\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"vendor-4491\","
- " \"encapsulate\": \"\""
+ " \"space\": \"vendor-4491\""
" } ],"
" \"option-data\": [ {"
" \"name\": \"config-file\","
" \"space\": \"vendor-4491\","
- " \"code\": 33,"
- " \"data\": \"normal_erouter_v6.cm\","
- " \"csv-format\": True"
+ " \"data\": \"normal_erouter_v6.cm\""
" }],"
"\"subnet6\": [ { "
" \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ],"
@@ -2305,11 +2295,7 @@ TEST_F(Dhcpv6SrvTest, rsooOverride) {
" \"option-def\": [ {"
" \"name\": \"foo\","
" \"code\": 120,"
- " \"type\": \"binary\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"dhcp6\","
- " \"encapsulate\": \"\""
+ " \"type\": \"binary\""
" } ],"
" \"option-data\": [ {"
" \"code\": 120,"
diff --git a/src/lib/dhcpsrv/parsers/dhcp_parsers.h b/src/lib/dhcpsrv/parsers/dhcp_parsers.h
index 30d530aab3..5eb5aa863f 100644
--- a/src/lib/dhcpsrv/parsers/dhcp_parsers.h
+++ b/src/lib/dhcpsrv/parsers/dhcp_parsers.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
@@ -745,6 +745,7 @@ private:
/// Instance of option definition being created by this parser.
OptionDefinitionPtr option_definition_;
+
/// Name of the space the option definition belongs to.
std::string option_space_name_;
diff --git a/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc b/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
index e85bd3787f..4840e6d339 100644
--- a/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
+++ b/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
@@ -458,10 +458,10 @@ public:
std::string error_text_;
};
-/// @brief Check Basic parsing of option definitions.
+/// @brief Check basic parsing of option definitions.
///
/// Note that this tests basic operation of the OptionDefinitionListParser and
-/// OptionDefinitionParser. It uses a simple configuration consisting of one
+/// OptionDefinitionParser. It uses a simple configuration consisting of
/// one definition and verifies that it is parsed and committed to storage
/// correctly.
TEST_F(ParseConfigTest, basicOptionDefTest) {
@@ -481,7 +481,7 @@ TEST_F(ParseConfigTest, basicOptionDefTest) {
// Verify that the configuration string parses.
int rcode = parseConfiguration(config);
- ASSERT_TRUE(rcode == 0);
+ ASSERT_EQ(0, rcode);
// Verify that the option definition can be retrieved.
@@ -497,7 +497,73 @@ TEST_F(ParseConfigTest, basicOptionDefTest) {
EXPECT_TRUE(def->getEncapsulatedSpace().empty());
}
-/// @brief Check Basic parsing of options.
+/// @brief Check minimal parsing of option definitions.
+///
+/// Same than basic but without optional parameters set to their default.
+TEST_F(ParseConfigTest, minimalOptionDefTest) {
+
+ // Configuration string.
+ std::string config =
+ "{ \"option-def\": [ {"
+ " \"name\": \"foo\","
+ " \"code\": 100,"
+ " \"type\": \"ipv4-address\","
+ " \"space\": \"isc\""
+ " } ]"
+ "}";
+
+ // Verify that the configuration string parses.
+ int rcode = parseConfiguration(config);
+ ASSERT_EQ(0, rcode);
+
+
+ // Verify that the option definition can be retrieved.
+ OptionDefinitionPtr def =
+ CfgMgr::instance().getStagingCfg()->getCfgOptionDef()->get("isc", 100);
+ ASSERT_TRUE(def);
+
+ // Verify that the option definition is correct.
+ EXPECT_EQ("foo", def->getName());
+ EXPECT_EQ(100, def->getCode());
+ EXPECT_FALSE(def->getArrayType());
+ EXPECT_EQ(OPT_IPV4_ADDRESS_TYPE, def->getType());
+ EXPECT_TRUE(def->getEncapsulatedSpace().empty());
+}
+
+/// @brief Check parsing of option definitions using default dhcp6 space.
+///
+/// Same than minimal but using the fact the default universe is V6
+/// so the default space is dhcp6
+TEST_F(ParseConfigTest, defaultSpaceOptionDefTest) {
+
+ // Configuration string.
+ std::string config =
+ "{ \"option-def\": [ {"
+ " \"name\": \"foo\","
+ " \"code\": 10000,"
+ " \"type\": \"ipv6-address\""
+ " } ]"
+ "}";
+
+ // Verify that the configuration string parses.
+ int rcode = parseConfiguration(config);
+ ASSERT_EQ(0, rcode);
+
+
+ // Verify that the option definition can be retrieved.
+ OptionDefinitionPtr def =
+ CfgMgr::instance().getStagingCfg()->getCfgOptionDef()->get("dhcp6", 10000);
+ ASSERT_TRUE(def);
+
+ // Verify that the option definition is correct.
+ EXPECT_EQ("foo", def->getName());
+ EXPECT_EQ(10000, def->getCode());
+ EXPECT_FALSE(def->getArrayType());
+ EXPECT_EQ(OPT_IPV6_ADDRESS_TYPE, def->getType());
+ EXPECT_TRUE(def->getEncapsulatedSpace().empty());
+}
+
+/// @brief Check basic parsing of options.
///
/// Note that this tests basic operation of the OptionDataListParser and
/// OptionDataParser. It uses a simple configuration consisting of one
@@ -511,10 +577,7 @@ TEST_F(ParseConfigTest, basicOptionDataTest) {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"ipv4-address\","
- " \"array\": False,"
- " \"record-types\": \"\","
- " \"space\": \"isc\","
- " \"encapsulate\": \"\""
+ " \"space\": \"isc\""
" } ], "
" \"option-data\": [ {"
" \"name\": \"foo\","
@@ -527,13 +590,47 @@ TEST_F(ParseConfigTest, basicOptionDataTest) {
// Verify that the configuration string parses.
int rcode = parseConfiguration(config);
- ASSERT_TRUE(rcode == 0);
+ ASSERT_EQ(0, rcode);
// Verify that the option can be retrieved.
OptionPtr opt_ptr = getOptionPtr("isc", 100);
ASSERT_TRUE(opt_ptr);
- // Verify that the option definition is correct.
+ // Verify that the option data is correct.
+ std::string val = "type=00100, len=00004: 192.0.2.0 (ipv4-address)";
+
+ EXPECT_EQ(val, opt_ptr->toText());
+}
+
+/// @brief Check minimal parsing of options.
+///
+/// Same than basic but without optional parameters set to their default.
+TEST_F(ParseConfigTest, minimalOptionDataTest) {
+
+ // Configuration string.
+ std::string config =
+ "{ \"option-def\": [ {"
+ " \"name\": \"foo\","
+ " \"code\": 100,"
+ " \"type\": \"ipv4-address\","
+ " \"space\": \"isc\""
+ " } ], "
+ " \"option-data\": [ {"
+ " \"name\": \"foo\","
+ " \"space\": \"isc\","
+ " \"data\": \"192.0.2.0\""
+ " } ]"
+ "}";
+
+ // Verify that the configuration string parses.
+ int rcode = parseConfiguration(config);
+ ASSERT_EQ(0, rcode);
+
+ // Verify that the option can be retrieved.
+ OptionPtr opt_ptr = getOptionPtr("isc", 100);
+ ASSERT_TRUE(opt_ptr);
+
+ // Verify that the option data is correct.
std::string val = "type=00100, len=00004: 192.0.2.0 (ipv4-address)";
EXPECT_EQ(val, opt_ptr->toText());
@@ -690,7 +787,6 @@ TEST_F(ParseConfigTest, optionDataNoName) {
"{ \"option-data\": [ {"
" \"space\": \"dhcp6\","
" \"code\": 23,"
- " \"csv-format\": True,"
" \"data\": \"2001:db8:1::1\""
" } ]"
"}";
@@ -711,7 +807,6 @@ TEST_F(ParseConfigTest, optionDataNoCode) {
"{ \"option-data\": [ {"
" \"space\": \"dhcp6\","
" \"name\": \"dns-servers\","
- " \"csv-format\": True,"
" \"data\": \"2001:db8:1::1\""
" } ]"
"}";
@@ -772,9 +867,7 @@ TEST_F(ParseConfigTest, optionDataMinimalWithOptionDef) {
" \"code\": 2345,"
" \"type\": \"ipv6-address\","
" \"array\": True,"
- " \"record-types\": \"\","
- " \"space\": \"dhcp6\","
- " \"encapsulate\": \"\""
+ " \"space\": \"dhcp6\""
" } ],"
" \"option-data\": [ {"
" \"name\": \"foo-name\","
@@ -800,9 +893,7 @@ TEST_F(ParseConfigTest, optionDataMinimalWithOptionDef) {
" \"code\": 2345,"
" \"type\": \"ipv6-address\","
" \"array\": True,"
- " \"record-types\": \"\","
- " \"space\": \"dhcp6\","
- " \"encapsulate\": \"\""
+ " \"space\": \"dhcp6\""
" } ],"
" \"option-data\": [ {"
" \"code\": 2345,"