Commit 55ad23aa authored by Francis Dupont's avatar Francis Dupont Committed by Tomek Mrugalski

[5014_phase2] Use parser in place of fromJSON

parent a97417d5
......@@ -107,6 +107,8 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
return isc::dhcp::Dhcp6Parser::make_TOPLEVEL_GENERIC_JSON(driver.loc_);
case Parser6Context::PARSER_DHCP6:
return isc::dhcp::Dhcp6Parser::make_TOPLEVEL_DHCP6(driver.loc_);
case Parser6Context::SUBPARSER_DHCP6:
return isc::dhcp::Dhcp6Parser::make_SUB_DHCP6(driver.loc_);
case Parser6Context::SUBPARSER_INTERFACES6:
return isc::dhcp::Dhcp6Parser::make_SUB_INTERFACES6(driver.loc_);
case Parser6Context::SUBPARSER_SUBNET6:
......@@ -220,6 +222,7 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::LEASE_DATABASE:
case isc::dhcp::Parser6Context::HOSTS_DATABASE:
case isc::dhcp::Parser6Context::OPTION_DEF:
case isc::dhcp::Parser6Context::SERVER_ID:
return isc::dhcp::Dhcp6Parser::make_TYPE(driver.loc_);
default:
......@@ -323,6 +326,15 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
}
}
\"option-def\" {
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::DHCP6:
return isc::dhcp::Dhcp6Parser::make_OPTION_DEF(driver.loc_);
default:
return isc::dhcp::Dhcp6Parser::make_STRING("option-def", driver.loc_);
}
}
\"option-data\" {
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::DHCP6:
......@@ -342,6 +354,7 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::LEASE_DATABASE:
case isc::dhcp::Parser6Context::HOSTS_DATABASE:
case isc::dhcp::Parser6Context::OPTION_DEF:
case isc::dhcp::Parser6Context::OPTION_DATA:
case isc::dhcp::Parser6Context::CLIENT_CLASSES:
case isc::dhcp::Parser6Context::CLIENT_CLASS:
......@@ -444,6 +457,7 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
\"code\" {
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::OPTION_DEF:
case isc::dhcp::Parser6Context::OPTION_DATA:
return isc::dhcp::Dhcp6Parser::make_CODE(driver.loc_);
default:
......@@ -621,6 +635,7 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
\"space\" {
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::OPTION_DEF:
case isc::dhcp::Parser6Context::OPTION_DATA:
return isc::dhcp::Dhcp6Parser::make_SPACE(driver.loc_);
default:
......@@ -630,6 +645,7 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
\"csv-format\" {
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::OPTION_DEF:
case isc::dhcp::Parser6Context::OPTION_DATA:
return isc::dhcp::Dhcp6Parser::make_CSV_FORMAT(driver.loc_);
default:
......
......@@ -67,6 +67,7 @@ using namespace std;
RENEW_TIMER "renew-timer"
REBIND_TIMER "rebind-timer"
SUBNET6 "subnet6"
OPTION_DEF "option-def"
OPTION_DATA "option-data"
NAME "name"
DATA "data"
......@@ -131,11 +132,13 @@ using namespace std;
// parse.
TOPLEVEL_GENERIC_JSON
TOPLEVEL_DHCP6
SUB_DHCP6
SUB_INTERFACES6
SUB_SUBNET6
SUB_POOL6
SUB_PD_POOL
SUB_RESERVATION
SUB_OPTION_DEF
SUB_OPTION_DATA
SUB_HOOKS_LIBRARY
SUB_JSON
......@@ -159,11 +162,13 @@ using namespace std;
start: TOPLEVEL_GENERIC_JSON { ctx.ctx_ = ctx.NO_KEYWORD; } map2
| TOPLEVEL_DHCP6 { ctx.ctx_ = ctx.CONFIG; } syntax_map
| SUB_DHCP6 { ctx.ctx_ = ctx.DHCP6; } sub_dhcp6
| SUB_INTERFACES6 { ctx.ctx_ = ctx.INTERFACES_CONFIG; } sub_interfaces6
| SUB_SUBNET6 { ctx.ctx_ = ctx.SUBNET6; } sub_subnet6
| SUB_POOL6 { ctx.ctx_ = ctx.POOLS; } sub_pool6
| SUB_PD_POOL { ctx.ctx_ = ctx.PD_POOLS; } sub_pd_pool
| SUB_RESERVATION { ctx.ctx_ = ctx.RESERVATIONS; } sub_reservation
| SUB_OPTION_DEF { ctx.ctx_ = ctx.OPTION_DEF; } sub_option_def
| SUB_OPTION_DATA { ctx.ctx_ = ctx.OPTION_DATA; } sub_option_data
| SUB_HOOKS_LIBRARY { ctx.ctx_ = ctx.HOOKS_LIBRARIES; } sub_hooks_library
| SUB_JSON { ctx.ctx_ = ctx.NO_KEYWORD; } sub_json
......@@ -299,6 +304,16 @@ dhcp6_object: DHCP6 {
ctx.leave();
};
// subparser: similar to the corresponding rule but without parent
// so the stack is empty at the rule entry.
sub_dhcp6: LCURLY_BRACKET {
// Parse the Dhcp6 map
ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.push_back(m);
} global_params RCURLY_BRACKET {
// parsing completed
};
global_params: global_param
| global_params COMMA global_param
;
......@@ -317,6 +332,7 @@ global_param: preferred_lifetime
| relay_supplied_options
| host_reservation_identifiers
| client_classes
| option_def_list
| option_data_list
| hooks_libraries
| expired_leases_processing
......@@ -356,8 +372,6 @@ interfaces_config: INTERFACES_CONFIG {
ctx.leave();
};
// subparser: similar to the corresponding rule but without parent
// so the stack is empty at the rule entry.
sub_interfaces6: LCURLY_BRACKET {
// Parse the interfaces-config map
ElementPtr m(new MapElement(ctx.loc2pos(@1)));
......@@ -695,6 +709,95 @@ id: ID COLON INTEGER {
ctx.stack_.back()->set("id", id);
};
// ---- option-def --------------------------
// This defines the "option-def": [ ... ] entry that may appear
// at a global option.
option_def_list: OPTION_DEF {
ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("option-def", l);
ctx.stack_.push_back(l);
ctx.enter(ctx.OPTION_DEF);
} COLON LSQUARE_BRACKET option_def_list_content RSQUARE_BRACKET {
ctx.stack_.pop_back();
ctx.leave();
};
// This defines the content of option-def. It may be empty,
// have one entry or multiple entries separated by comma.
option_def_list_content: %empty
| not_empty_option_def_list
;
not_empty_option_def_list: option_def_entry
| not_empty_option_def_list COMMA option_def_entry
;
// This defines the content of a single entry { ... } within
// option-def list.
option_def_entry: LCURLY_BRACKET {
ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->add(m);
ctx.stack_.push_back(m);
} option_def_params RCURLY_BRACKET {
ctx.stack_.pop_back();
};
sub_option_def: LCURLY_BRACKET {
// Parse the option-def list entry map
ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.push_back(m);
} option_def_params RCURLY_BRACKET {
// parsing completed
};
// This defines parameters specified inside the map that itself
// is an entry in option-def list.
option_def_params: %empty
| not_empty_option_def_params
;
not_empty_option_def_params: option_def_param
| not_empty_option_def_params COMMA option_def_param
;
option_def_param: option_def_name
| option_def_code
| option_def_type
| option_def_space
| option_def_csv_format
| unknown_map_entry
;
option_def_name: name;
code: CODE COLON INTEGER {
ElementPtr code(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("code", code);
};
option_def_code: code;
option_def_type: type;
space: SPACE {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
ElementPtr space(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("space", space);
ctx.leave();
};
option_def_space: space;
csv_format: CSV_FORMAT COLON BOOLEAN {
ElementPtr space(new BoolElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("csv-format", space);
};
option_def_csv_format: csv_format;
// ---- option-data --------------------------
// This defines the "option-data": [ ... ] entry that may appear
......@@ -766,23 +869,11 @@ option_data_data: DATA {
ctx.leave();
};
option_data_code: CODE COLON INTEGER {
ElementPtr code(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("code", code);
};
option_data_code: code;
option_data_space: SPACE {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
ElementPtr space(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("space", space);
ctx.leave();
};
option_data_space: space;
option_data_csv_format: CSV_FORMAT COLON BOOLEAN {
ElementPtr space(new BoolElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("csv-format", space);
};
option_data_csv_format: csv_format;
// ---- pools ------------------------------------
......
......@@ -139,6 +139,8 @@ Parser6Context::context_name()
return ("hooks-librairies");
case SUBNET6:
return ("subnet6");
case OPTION_DEF:
return ("option-def");
case OPTION_DATA:
return ("option-data");
case CLIENT_CLASSES:
......
......@@ -40,13 +40,14 @@ public:
PARSER_GENERIC_JSON, // This will parse the content as generic JSON
PARSER_DHCP6, // This will parse the content as DHCP6 config
// DHCP6 config subparsers
SUBPARSER_DHCP6,
SUBPARSER_INTERFACES6,
SUBPARSER_SUBNET6,
SUBPARSER_POOL6,
SUBPARSER_PD_POOL,
SUBPARSER_HOST_RESERVATION6,
// Common DHCP subparsers
// SUBPARSER_OPTION_DEF,
SUBPARSER_OPTION_DEF,
SUBPARSER_OPTION_DATA,
SUBPARSER_HOOKS_LIBRARY,
// SUBPARSER_CONTROL_SOCKET,
......@@ -131,6 +132,7 @@ public:
HOST_RESERVATION_IDENTIFIERS,
HOOKS_LIBRARIES,
SUBNET6,
OPTION_DEF,
OPTION_DATA,
CLIENT_CLASSES,
SERVER_ID,
......
......@@ -30,6 +30,7 @@
#include "test_data_files_config.h"
#include "test_libraries.h"
#include "marker_file.h"
#include "dhcp6_test_utils.h"
#include <boost/foreach.hpp>
#include <gtest/gtest.h>
......@@ -278,25 +279,25 @@ public:
params["space"] = DHCP6_OPTION_SPACE;
params["code"] = "38";
params["data"] = "ABCDEF0105";
params["csv-format"] = "False";
params["csv-format"] = "false";
} else if (parameter == "space") {
params["name"] = "subscriber-id";
params["space"] = param_value;
params["code"] = "38";
params["data"] = "ABCDEF0105";
params["csv-format"] = "False";
params["csv-format"] = "false";
} else if (parameter == "code") {
params["name"] = "subscriber-id";
params["space"] = DHCP6_OPTION_SPACE;
params["code"] = param_value;
params["data"] = "ABCDEF0105";
params["csv-format"] = "False";
params["csv-format"] = "false";
} else if (parameter == "data") {
params["name"] = "subscriber-id";
params["space"] = DHCP6_OPTION_SPACE;
params["code"] = "38";
params["data"] = param_value;
params["csv-format"] = "False";
params["csv-format"] = "false";
} else if (parameter == "csv-format") {
params["name"] = "subscriber-id";
params["space"] = DHCP6_OPTION_SPACE;
......@@ -431,9 +432,10 @@ public:
/// latter case, a failure will have been added to the current test.
bool
executeConfiguration(const std::string& config, const char* operation) {
ConstElementPtr json;
ConstElementPtr status;
try {
ElementPtr json = Element::fromJSON(config);
json = parseJSON(config);
status = configureDhcp6Server(srv_, json);
} catch (const std::exception& ex) {
......@@ -553,7 +555,7 @@ public:
const std::string& parameter) {
ConstElementPtr x;
std::string config = createConfigWithOption(param_value, parameter);
ElementPtr json = Element::fromJSON(config);
ConstElementPtr json = parseJSON(config);
EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
checkResult(x, 1);
EXPECT_TRUE(errorContainsPosition(x, "<string>"));
......@@ -571,7 +573,7 @@ public:
testInvalidOptionParam(const std::map<std::string, std::string>& params) {
ConstElementPtr x;
std::string config = createConfigWithOption(params);
ElementPtr json = Element::fromJSON(config);
ConstElementPtr json = parseJSON(config);
EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
checkResult(x, 1);
EXPECT_TRUE(errorContainsPosition(x, "<string>"));
......@@ -672,7 +674,7 @@ public:
CfgMgr::instance().clear();
// Configure the server.
ElementPtr json = Element::fromJSON(config);
ConstElementPtr json = parseJSON(config);
// Make sure that the configuration was successful.
ConstElementPtr status;
......@@ -738,7 +740,7 @@ TEST_F(Dhcp6ParserTest, version) {
ConstElementPtr x;
EXPECT_NO_THROW(x = configureDhcp6Server(srv_,
Element::fromJSON("{\"version\": 0}")));
parseJSON("{\"version\": 0}")));
// returned value must be 0 (configuration accepted)
checkResult(x, 0);
......@@ -751,7 +753,7 @@ TEST_F(Dhcp6ParserTest, bogusCommand) {
ConstElementPtr x;
EXPECT_NO_THROW(x = configureDhcp6Server(srv_,
Element::fromJSON("{\"bogus\": 5}")));
parseJSON("{\"bogus\": 5}")));
// returned value must be 1 (configuration parse error)
checkResult(x, 1);
......@@ -761,16 +763,17 @@ TEST_F(Dhcp6ParserTest, bogusCommand) {
/// subnets defined can be accepted.
TEST_F(Dhcp6ParserTest, emptySubnet) {
ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp6Server(srv_,
Element::fromJSON("{ " + genIfaceConfig() + ","
ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP6("{ " + genIfaceConfig() + ","
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet6\": [ ], "
"\"valid-lifetime\": 4000 }")));
"\"valid-lifetime\": 4000 }"));
ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json));
// returned value should be 0 (success)
checkResult(status, 0);
}
......@@ -779,8 +782,6 @@ TEST_F(Dhcp6ParserTest, emptySubnet) {
/// parameter timer definitions.
TEST_F(Dhcp6ParserTest, subnetGlobalDefaults) {
ConstElementPtr status;
string config = "{ " + genIfaceConfig() + ","
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
......@@ -790,8 +791,10 @@ TEST_F(Dhcp6ParserTest, subnetGlobalDefaults) {
" \"subnet\": \"2001:db8:1::/64\" } ],"
"\"valid-lifetime\": 4000 }";
ElementPtr json = Element::fromJSON(config);
ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP6(config));
ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json));
// check if returned status is OK
......@@ -841,7 +844,8 @@ TEST_F(Dhcp6ParserTest, multipleSubnets) {
int cnt = 0; // Number of reconfigurations
ElementPtr json = Element::fromJSON(config);
ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP6(config));
do {
EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
......@@ -899,7 +903,8 @@ TEST_F(Dhcp6ParserTest, multipleSubnetsExplicitIDs) {
int cnt = 0; // Number of reconfigurations
ElementPtr json = Element::fromJSON(config);
ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP6(config));
do {
EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
......@@ -953,7 +958,8 @@ TEST_F(Dhcp6ParserTest, multipleSubnetsOverlapingIDs) {
" } ],"
"\"valid-lifetime\": 4000 }";
ElementPtr json = Element::fromJSON(config);
ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP6(config));
EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
checkResult(x, 1);
......@@ -1040,7 +1046,8 @@ TEST_F(Dhcp6ParserTest, reconfigureRemoveSubnet) {
// CASE 1: Configure 4 subnets, then reconfigure and remove the
// last one.
ElementPtr json = Element::fromJSON(config4);
ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP6(config4));
EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
checkResult(x, 0);
......@@ -1052,7 +1059,7 @@ TEST_F(Dhcp6ParserTest, reconfigureRemoveSubnet) {
ASSERT_EQ(4, subnets->size()); // We expect 4 subnets
// Do the reconfiguration (the last subnet is removed)
json = Element::fromJSON(config_first3);
ASSERT_NO_THROW(json = parseDHCP6(config_first3));
EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
checkResult(x, 0);
......@@ -1069,14 +1076,14 @@ TEST_F(Dhcp6ParserTest, reconfigureRemoveSubnet) {
/// CASE 2: Configure 4 subnets, then reconfigure and remove one
/// from in between (not first, not last)
json = Element::fromJSON(config4);
ASSERT_NO_THROW(json = parseDHCP6(config4));
EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
checkResult(x, 0);
CfgMgr::instance().commit();
// Do reconfiguration
json = Element::fromJSON(config_second_removed);
ASSERT_NO_THROW(json = parseDHCP6(config_second_removed));
EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
checkResult(x, 0);
......@@ -1098,8 +1105,6 @@ TEST_F(Dhcp6ParserTest, reconfigureRemoveSubnet) {
// on a per subnet basis.
TEST_F(Dhcp6ParserTest, subnetLocal) {
ConstElementPtr status;
string config = "{ " + genIfaceConfig() + ","
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
......@@ -1113,8 +1118,10 @@ TEST_F(Dhcp6ParserTest, subnetLocal) {
" \"subnet\": \"2001:db8:1::/64\" } ],"
"\"valid-lifetime\": 4000 }";
ElementPtr json = Element::fromJSON(config);
ConstElementPtr json;
ASSERT_NO_THROW(json = parseJSON(config));
ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json));
// returned value should be 0 (configuration success)
......@@ -1133,8 +1140,6 @@ TEST_F(Dhcp6ParserTest, subnetLocal) {
// interface defined.
TEST_F(Dhcp6ParserTest, subnetInterface) {
ConstElementPtr status;
// There should be at least one interface
string config = "{ " + genIfaceConfig() + ","
......@@ -1148,8 +1153,10 @@ TEST_F(Dhcp6ParserTest, subnetInterface) {
"\"valid-lifetime\": 4000 }";
cout << config << endl;
ElementPtr json = Element::fromJSON(config);
ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP6(config));
ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json));
// returned value should be 0 (configuration success)
......@@ -1165,8 +1172,6 @@ TEST_F(Dhcp6ParserTest, subnetInterface) {
// Subnet6 definition.
TEST_F(Dhcp6ParserTest, subnetInterfaceBogus) {
ConstElementPtr status;
// There should be at least one interface
string config = "{ " + genIfaceConfig() + ","
......@@ -1180,8 +1185,10 @@ TEST_F(Dhcp6ParserTest, subnetInterfaceBogus) {
"\"valid-lifetime\": 4000 }";
cout << config << endl;
ElementPtr json = Element::fromJSON(config);
ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP6(config));
ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json));
// returned value should be 1 (configuration error)
......@@ -1198,8 +1205,6 @@ TEST_F(Dhcp6ParserTest, subnetInterfaceBogus) {
// parameter.
TEST_F(Dhcp6ParserTest, interfaceGlobal) {
ConstElementPtr status;
string config = "{ " + genIfaceConfig() + ","
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
......@@ -1211,8 +1216,10 @@ TEST_F(Dhcp6ParserTest, interfaceGlobal) {
"\"valid-lifetime\": 4000 }";
cout << config << endl;
ElementPtr json = Element::fromJSON(config);
ConstElementPtr json;
ASSERT_NO_THROW(json = parseJSON(config));
ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json));
// returned value should be 1 (parse error)
......@@ -1240,7 +1247,8 @@ TEST_F(Dhcp6ParserTest, subnetInterfaceId) {
" \"subnet\": \"2001:db8:1::/64\" } ],"
"\"valid-lifetime\": 4000 }";
ElementPtr json = Element::fromJSON(config);
ConstElementPtr json;
ASSERT_NO_THROW(json = parseJSON(config));
ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json));
......@@ -1281,7 +1289,8 @@ TEST_F(Dhcp6ParserTest, interfaceIdGlobal) {
" \"subnet\": \"2001:db8:1::/64\" } ],"
"\"valid-lifetime\": 4000 }";
ElementPtr json = Element::fromJSON(config);
ConstElementPtr json;
ASSERT_NO_THROW(json = parseJSON(config));
ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json));
......@@ -1305,7 +1314,8 @@ TEST_F(Dhcp6ParserTest, subnetInterfaceAndInterfaceId) {
" \"subnet\": \"2001:db8:1::/64\" } ],"
"\"valid-lifetime\": 4000 }";
ElementPtr json = Element::fromJSON(config);
ConstElementPtr json;
ASSERT_NO_THROW(json = parseJSON(config));
ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json));
......@@ -1341,7 +1351,7 @@ TEST_F(Dhcp6ParserTest, subnetRapidCommit) {
"\"subnet6\": [ { "
" \"pools\": [ { \"pool\": \"2001:db8:1::1 - "
"2001:db8:1::ffff\" } ],"
" \"rapid-commit\": True,"
" \"rapid-commit\": true,"
" \"subnet\": \"2001:db8:1::/64\" } ],"
"\"valid-lifetime\": 4000 }",
true);
......@@ -1356,7 +1366,7 @@ TEST_F(Dhcp6ParserTest, subnetRapidCommit) {
"\"subnet6\": [ { "
" \"pools\": [ { \"pool\": \"2001:db8:1::1 - "
"2001:db8:1::ffff\" } ],"
" \"rapid-commit\": False,"
" \"rapid-commit\": false,"
" \"subnet\": \"2001:db8:1::/64\" } ],"
"\"valid-lifetime\": 4000 }",
false);
......@@ -1386,8 +1396,8 @@ TEST_F(Dhcp6ParserTest, multiplePools) {
" \"subnet\": \"2001:db8:2::/64\""
" } ],"
"\"valid-lifetime\": 4000 }";
ElementPtr json;
ASSERT_NO_THROW(json = Element::fromJSON(config));
ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP6(config));
ConstElementPtr status;
ASSERT_NO_THROW(status = configureDhcp6Server(srv_, json));
......@@ -1426,8 +1436,6 @@ TEST_F(Dhcp6ParserTest, multiplePools) {
// pool are rejected.
TEST_F(Dhcp6ParserTest, poolOutOfSubnet) {
ConstElementPtr status;
string config = "{ " + genIfaceConfig() + ","
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
......@@ -1438,8 +1446,10 @@ TEST_F(Dhcp6ParserTest, poolOutOfSubnet) {
"\"valid-lifetime\": 4000 }";
ElementPtr json = Element::fromJSON(config);
ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP6(config));
ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json));
// returned value must be 1 (values error)
......@@ -1466,7 +1476,8 @@ TEST_F(Dhcp6ParserTest, poolPrefixLen) {
" \"subnet\": \"2001:db8:1::/64\" } ],"
"\"valid-lifetime\": 4000 }";
ElementPtr json = Element::fromJSON(config);
ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP6(config));
EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
......@@ -1505,8 +1516,8 @@ TEST_F(Dhcp6ParserTest, pdPoolBasics) {
"] }";
// Convert the JSON string into Elements.
ElementPtr json;
ASSERT_NO_THROW(json = Element::fromJSON(config));
ConstElementPtr json;