Commit a8df76c4 authored by Francis Dupont's avatar Francis Dupont
Browse files

[5124a] Rebased

parent 53bfb954
...@@ -119,6 +119,10 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence} ...@@ -119,6 +119,10 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
return isc::dhcp::Dhcp4Parser::make_SUB_POOL4(driver.loc_); return isc::dhcp::Dhcp4Parser::make_SUB_POOL4(driver.loc_);
case Parser4Context::PARSER_HOST_RESERVATION: case Parser4Context::PARSER_HOST_RESERVATION:
return isc::dhcp::Dhcp4Parser::make_SUB_RESERVATION(driver.loc_); return isc::dhcp::Dhcp4Parser::make_SUB_RESERVATION(driver.loc_);
case Parser4Context::PARSER_OPTION_DEFS:
return isc::dhcp::Dhcp4Parser::make_SUB_OPTION_DEFS(driver.loc_);
case Parser4Context::PARSER_OPTION_DEF:
return isc::dhcp::Dhcp4Parser::make_SUB_OPTION_DEF(driver.loc_);
case Parser4Context::PARSER_OPTION_DATA: case Parser4Context::PARSER_OPTION_DATA:
return isc::dhcp::Dhcp4Parser::make_SUB_OPTION_DATA(driver.loc_); return isc::dhcp::Dhcp4Parser::make_SUB_OPTION_DATA(driver.loc_);
case Parser4Context::PARSER_HOOKS_LIBRARY: case Parser4Context::PARSER_HOOKS_LIBRARY:
......
...@@ -195,6 +195,7 @@ using namespace std; ...@@ -195,6 +195,7 @@ using namespace std;
SUB_SUBNET4 SUB_SUBNET4
SUB_POOL4 SUB_POOL4
SUB_RESERVATION SUB_RESERVATION
SUB_OPTION_DEFS
SUB_OPTION_DEF SUB_OPTION_DEF
SUB_OPTION_DATA SUB_OPTION_DATA
SUB_HOOKS_LIBRARY SUB_HOOKS_LIBRARY
...@@ -230,6 +231,7 @@ start: TOPLEVEL_JSON { ctx.ctx_ = ctx.NO_KEYWORD; } sub_json ...@@ -230,6 +231,7 @@ start: TOPLEVEL_JSON { ctx.ctx_ = ctx.NO_KEYWORD; } sub_json
| SUB_SUBNET4 { ctx.ctx_ = ctx.SUBNET4; } sub_subnet4 | SUB_SUBNET4 { ctx.ctx_ = ctx.SUBNET4; } sub_subnet4
| SUB_POOL4 { ctx.ctx_ = ctx.POOLS; } sub_pool4 | SUB_POOL4 { ctx.ctx_ = ctx.POOLS; } sub_pool4
| SUB_RESERVATION { ctx.ctx_ = ctx.RESERVATIONS; } sub_reservation | SUB_RESERVATION { ctx.ctx_ = ctx.RESERVATIONS; } sub_reservation
| SUB_OPTION_DEFS { ctx.ctx_ = ctx.DHCP4; } sub_option_def_list
| SUB_OPTION_DEF { ctx.ctx_ = ctx.OPTION_DEF; } sub_option_def | SUB_OPTION_DEF { ctx.ctx_ = ctx.OPTION_DEF; } sub_option_def
| SUB_OPTION_DATA { ctx.ctx_ = ctx.OPTION_DATA; } sub_option_data | SUB_OPTION_DATA { ctx.ctx_ = ctx.OPTION_DATA; } sub_option_data
| SUB_HOOKS_LIBRARY { ctx.ctx_ = ctx.HOOKS_LIBRARIES; } sub_hooks_library | SUB_HOOKS_LIBRARY { ctx.ctx_ = ctx.HOOKS_LIBRARIES; } sub_hooks_library
...@@ -351,6 +353,9 @@ syntax_map: LCURLY_BRACKET { ...@@ -351,6 +353,9 @@ syntax_map: LCURLY_BRACKET {
// map parsing completed. If we ever want to do any wrap up // map parsing completed. If we ever want to do any wrap up
// (maybe some sanity checking), this would be the best place // (maybe some sanity checking), this would be the best place
// for it. // for it.
// Dhcp4 is required
ctx.require("Dhcp4", ctx.loc2pos(@1), ctx.loc2pos(@4));
}; };
// This represents top-level entries: Control-agent, Dhcp6, Dhcp4, // This represents top-level entries: Control-agent, Dhcp6, Dhcp4,
...@@ -376,9 +381,7 @@ dhcp4_object: DHCP4 { ...@@ -376,9 +381,7 @@ dhcp4_object: DHCP4 {
ctx.stack_.push_back(m); ctx.stack_.push_back(m);
ctx.enter(ctx.DHCP4); ctx.enter(ctx.DHCP4);
} COLON LCURLY_BRACKET global_params RCURLY_BRACKET { } COLON LCURLY_BRACKET global_params RCURLY_BRACKET {
// map parsing completed. If we ever want to do any wrap up // No global parameter is required
// (maybe some sanity checking), this would be the best place
// for it.
ctx.stack_.pop_back(); ctx.stack_.pop_back();
ctx.leave(); ctx.leave();
}; };
...@@ -390,6 +393,7 @@ sub_dhcp4: LCURLY_BRACKET { ...@@ -390,6 +393,7 @@ sub_dhcp4: LCURLY_BRACKET {
ElementPtr m(new MapElement(ctx.loc2pos(@1))); ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.push_back(m); ctx.stack_.push_back(m);
} global_params RCURLY_BRACKET { } global_params RCURLY_BRACKET {
// No global parameter is required
// parsing completed // parsing completed
}; };
...@@ -459,6 +463,7 @@ interfaces_config: INTERFACES_CONFIG { ...@@ -459,6 +463,7 @@ interfaces_config: INTERFACES_CONFIG {
ctx.stack_.push_back(i); ctx.stack_.push_back(i);
ctx.enter(ctx.INTERFACES_CONFIG); ctx.enter(ctx.INTERFACES_CONFIG);
} COLON LCURLY_BRACKET interfaces_config_params RCURLY_BRACKET { } COLON LCURLY_BRACKET interfaces_config_params RCURLY_BRACKET {
// No interfaces config param is required
ctx.stack_.pop_back(); ctx.stack_.pop_back();
ctx.leave(); ctx.leave();
}; };
...@@ -477,6 +482,7 @@ sub_interfaces4: LCURLY_BRACKET { ...@@ -477,6 +482,7 @@ sub_interfaces4: LCURLY_BRACKET {
ElementPtr m(new MapElement(ctx.loc2pos(@1))); ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.push_back(m); ctx.stack_.push_back(m);
} interfaces_config_params RCURLY_BRACKET { } interfaces_config_params RCURLY_BRACKET {
// No interfaces config param is required
// parsing completed // parsing completed
}; };
...@@ -513,6 +519,8 @@ lease_database: LEASE_DATABASE { ...@@ -513,6 +519,8 @@ lease_database: LEASE_DATABASE {
ctx.stack_.push_back(i); ctx.stack_.push_back(i);
ctx.enter(ctx.LEASE_DATABASE); ctx.enter(ctx.LEASE_DATABASE);
} COLON LCURLY_BRACKET database_map_params RCURLY_BRACKET { } COLON LCURLY_BRACKET database_map_params RCURLY_BRACKET {
// The type parameter is required
ctx.require("type", ctx.loc2pos(@4), ctx.loc2pos(@6));
ctx.stack_.pop_back(); ctx.stack_.pop_back();
ctx.leave(); ctx.leave();
}; };
...@@ -523,6 +531,8 @@ hosts_database: HOSTS_DATABASE { ...@@ -523,6 +531,8 @@ hosts_database: HOSTS_DATABASE {
ctx.stack_.push_back(i); ctx.stack_.push_back(i);
ctx.enter(ctx.HOSTS_DATABASE); ctx.enter(ctx.HOSTS_DATABASE);
} COLON LCURLY_BRACKET database_map_params RCURLY_BRACKET { } COLON LCURLY_BRACKET database_map_params RCURLY_BRACKET {
// The type parameter is required
ctx.require("type", ctx.loc2pos(@4), ctx.loc2pos(@6));
ctx.stack_.pop_back(); ctx.stack_.pop_back();
ctx.leave(); ctx.leave();
}; };
...@@ -702,6 +712,8 @@ hooks_library: LCURLY_BRACKET { ...@@ -702,6 +712,8 @@ hooks_library: LCURLY_BRACKET {
ctx.stack_.back()->add(m); ctx.stack_.back()->add(m);
ctx.stack_.push_back(m); ctx.stack_.push_back(m);
} hooks_params RCURLY_BRACKET { } hooks_params RCURLY_BRACKET {
// The library hooks parameter is required
ctx.require("library", ctx.loc2pos(@1), ctx.loc2pos(@4));
ctx.stack_.pop_back(); ctx.stack_.pop_back();
}; };
...@@ -710,6 +722,8 @@ sub_hooks_library: LCURLY_BRACKET { ...@@ -710,6 +722,8 @@ sub_hooks_library: LCURLY_BRACKET {
ElementPtr m(new MapElement(ctx.loc2pos(@1))); ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.push_back(m); ctx.stack_.push_back(m);
} hooks_params RCURLY_BRACKET { } hooks_params RCURLY_BRACKET {
// The library hooks parameter is required
ctx.require("library", ctx.loc2pos(@1), ctx.loc2pos(@4));
// parsing completed // parsing completed
}; };
...@@ -744,6 +758,7 @@ expired_leases_processing: EXPIRED_LEASES_PROCESSING { ...@@ -744,6 +758,7 @@ expired_leases_processing: EXPIRED_LEASES_PROCESSING {
ctx.stack_.push_back(m); ctx.stack_.push_back(m);
ctx.enter(ctx.EXPIRED_LEASES_PROCESSING); ctx.enter(ctx.EXPIRED_LEASES_PROCESSING);
} COLON LCURLY_BRACKET expired_leases_params RCURLY_BRACKET { } COLON LCURLY_BRACKET expired_leases_params RCURLY_BRACKET {
// No expired lease parameter is required
ctx.stack_.pop_back(); ctx.stack_.pop_back();
ctx.leave(); ctx.leave();
}; };
...@@ -838,6 +853,9 @@ subnet4: LCURLY_BRACKET { ...@@ -838,6 +853,9 @@ subnet4: LCURLY_BRACKET {
// ctx.stack_.back()->set("renew-timer", renew); // ctx.stack_.back()->set("renew-timer", renew);
// } // }
// } // }
// The subnet subnet4 parameter is required
ctx.require("subnet", ctx.loc2pos(@1), ctx.loc2pos(@4));
ctx.stack_.pop_back(); ctx.stack_.pop_back();
}; };
...@@ -846,6 +864,8 @@ sub_subnet4: LCURLY_BRACKET { ...@@ -846,6 +864,8 @@ sub_subnet4: LCURLY_BRACKET {
ElementPtr m(new MapElement(ctx.loc2pos(@1))); ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.push_back(m); ctx.stack_.push_back(m);
} subnet4_params RCURLY_BRACKET { } subnet4_params RCURLY_BRACKET {
// The subnet subnet4 parameter is required
ctx.require("subnet", ctx.loc2pos(@1), ctx.loc2pos(@4));
// parsing completed // parsing completed
}; };
...@@ -969,6 +989,16 @@ option_def_list: OPTION_DEF { ...@@ -969,6 +989,16 @@ option_def_list: OPTION_DEF {
ctx.leave(); ctx.leave();
}; };
// This defines the top level scope when the parser is told to parse
// option definitions. It works as a subset limited to option
// definitions
sub_option_def_list: LCURLY_BRACKET {
ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.push_back(m);
} option_def_list RCURLY_BRACKET {
// parsing completed
};
// This defines the content of option-def. It may be empty, // This defines the content of option-def. It may be empty,
// have one entry or multiple entries separated by comma. // have one entry or multiple entries separated by comma.
option_def_list_content: %empty option_def_list_content: %empty
...@@ -986,6 +1016,10 @@ option_def_entry: LCURLY_BRACKET { ...@@ -986,6 +1016,10 @@ option_def_entry: LCURLY_BRACKET {
ctx.stack_.back()->add(m); ctx.stack_.back()->add(m);
ctx.stack_.push_back(m); ctx.stack_.push_back(m);
} option_def_params RCURLY_BRACKET { } option_def_params RCURLY_BRACKET {
// The name, code and type option def parameters are required.
ctx.require("name", ctx.loc2pos(@1), ctx.loc2pos(@4));
ctx.require("code", ctx.loc2pos(@1), ctx.loc2pos(@4));
ctx.require("type", ctx.loc2pos(@1), ctx.loc2pos(@4));
ctx.stack_.pop_back(); ctx.stack_.pop_back();
}; };
...@@ -997,6 +1031,10 @@ sub_option_def: LCURLY_BRACKET { ...@@ -997,6 +1031,10 @@ sub_option_def: LCURLY_BRACKET {
ElementPtr m(new MapElement(ctx.loc2pos(@1))); ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.push_back(m); ctx.stack_.push_back(m);
} option_def_params RCURLY_BRACKET { } option_def_params RCURLY_BRACKET {
// The name, code and type option def parameters are required.
ctx.require("name", ctx.loc2pos(@1), ctx.loc2pos(@4));
ctx.require("code", ctx.loc2pos(@1), ctx.loc2pos(@4));
ctx.require("type", ctx.loc2pos(@1), ctx.loc2pos(@4));
// parsing completed // parsing completed
}; };
...@@ -1101,6 +1139,7 @@ option_data_entry: LCURLY_BRACKET { ...@@ -1101,6 +1139,7 @@ option_data_entry: LCURLY_BRACKET {
ctx.stack_.back()->add(m); ctx.stack_.back()->add(m);
ctx.stack_.push_back(m); ctx.stack_.push_back(m);
} option_data_params RCURLY_BRACKET { } option_data_params RCURLY_BRACKET {
/// @todo: the code or name parameters are required.
ctx.stack_.pop_back(); ctx.stack_.pop_back();
}; };
...@@ -1112,6 +1151,7 @@ sub_option_data: LCURLY_BRACKET { ...@@ -1112,6 +1151,7 @@ sub_option_data: LCURLY_BRACKET {
ElementPtr m(new MapElement(ctx.loc2pos(@1))); ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.push_back(m); ctx.stack_.push_back(m);
} option_data_params RCURLY_BRACKET { } option_data_params RCURLY_BRACKET {
/// @todo: the code or name parameters are required.
// parsing completed // parsing completed
}; };
...@@ -1191,6 +1231,8 @@ pool_list_entry: LCURLY_BRACKET { ...@@ -1191,6 +1231,8 @@ pool_list_entry: LCURLY_BRACKET {
ctx.stack_.back()->add(m); ctx.stack_.back()->add(m);
ctx.stack_.push_back(m); ctx.stack_.push_back(m);
} pool_params RCURLY_BRACKET { } pool_params RCURLY_BRACKET {
// The pool parameter is required.
ctx.require("pool", ctx.loc2pos(@1), ctx.loc2pos(@4));
ctx.stack_.pop_back(); ctx.stack_.pop_back();
}; };
...@@ -1199,6 +1241,8 @@ sub_pool4: LCURLY_BRACKET { ...@@ -1199,6 +1241,8 @@ sub_pool4: LCURLY_BRACKET {
ElementPtr m(new MapElement(ctx.loc2pos(@1))); ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.push_back(m); ctx.stack_.push_back(m);
} pool_params RCURLY_BRACKET { } pool_params RCURLY_BRACKET {
// The pool parameter is required.
ctx.require("pool", ctx.loc2pos(@1), ctx.loc2pos(@4));
// parsing completed // parsing completed
}; };
...@@ -1253,6 +1297,7 @@ reservation: LCURLY_BRACKET { ...@@ -1253,6 +1297,7 @@ reservation: LCURLY_BRACKET {
ctx.stack_.back()->add(m); ctx.stack_.back()->add(m);
ctx.stack_.push_back(m); ctx.stack_.push_back(m);
} reservation_params RCURLY_BRACKET { } reservation_params RCURLY_BRACKET {
/// @todo: an identifier parameter is required.
ctx.stack_.pop_back(); ctx.stack_.pop_back();
}; };
...@@ -1261,6 +1306,7 @@ sub_reservation: LCURLY_BRACKET { ...@@ -1261,6 +1306,7 @@ sub_reservation: LCURLY_BRACKET {
ElementPtr m(new MapElement(ctx.loc2pos(@1))); ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.push_back(m); ctx.stack_.push_back(m);
} reservation_params RCURLY_BRACKET { } reservation_params RCURLY_BRACKET {
/// @todo: an identifier parameter is required.
// parsing completed // parsing completed
}; };
...@@ -1272,7 +1318,7 @@ not_empty_reservation_params: reservation_param ...@@ -1272,7 +1318,7 @@ not_empty_reservation_params: reservation_param
| not_empty_reservation_params COMMA reservation_param | not_empty_reservation_params COMMA reservation_param
; ;
// @todo probably need to add mac-address as well here /// @todo probably need to add mac-address as well here
reservation_param: duid reservation_param: duid
| reservation_client_classes | reservation_client_classes
| client_id_value | client_id_value
...@@ -1421,6 +1467,8 @@ client_class: LCURLY_BRACKET { ...@@ -1421,6 +1467,8 @@ client_class: LCURLY_BRACKET {
ctx.stack_.back()->add(m); ctx.stack_.back()->add(m);
ctx.stack_.push_back(m); ctx.stack_.push_back(m);
} client_class_params RCURLY_BRACKET { } client_class_params RCURLY_BRACKET {
// The name client class parameter is required.
ctx.require("name", ctx.loc2pos(@1), ctx.loc2pos(@4));
ctx.stack_.pop_back(); ctx.stack_.pop_back();
}; };
...@@ -1504,6 +1552,8 @@ dhcp_ddns: DHCP_DDNS { ...@@ -1504,6 +1552,8 @@ dhcp_ddns: DHCP_DDNS {
ctx.stack_.push_back(m); ctx.stack_.push_back(m);
ctx.enter(ctx.DHCP_DDNS); ctx.enter(ctx.DHCP_DDNS);
} COLON LCURLY_BRACKET dhcp_ddns_params RCURLY_BRACKET { } COLON LCURLY_BRACKET dhcp_ddns_params RCURLY_BRACKET {
// The enable updates DHCP DDNS parameter is required.
ctx.require("enable-updates", ctx.loc2pos(@4), ctx.loc2pos(@6));
ctx.stack_.pop_back(); ctx.stack_.pop_back();
ctx.leave(); ctx.leave();
}; };
...@@ -1513,6 +1563,8 @@ sub_dhcp_ddns: LCURLY_BRACKET { ...@@ -1513,6 +1563,8 @@ sub_dhcp_ddns: LCURLY_BRACKET {
ElementPtr m(new MapElement(ctx.loc2pos(@1))); ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.push_back(m); ctx.stack_.push_back(m);
} dhcp_ddns_params RCURLY_BRACKET { } dhcp_ddns_params RCURLY_BRACKET {
// The enable updates DHCP DDNS parameter is required.
ctx.require("enable-updates", ctx.loc2pos(@1), ctx.loc2pos(@4));
// parsing completed // parsing completed
}; };
......
...@@ -74,13 +74,13 @@ Parser4Context::error(const isc::dhcp::location& loc, const std::string& what) ...@@ -74,13 +74,13 @@ Parser4Context::error(const isc::dhcp::location& loc, const std::string& what)
} }
void void
Parser4Context::error (const std::string& what) Parser4Context::error(const std::string& what)
{ {
isc_throw(Dhcp4ParseError, what); isc_throw(Dhcp4ParseError, what);
} }
void void
Parser4Context::fatal (const std::string& what) Parser4Context::fatal(const std::string& what)
{ {
isc_throw(Dhcp4ParseError, what); isc_throw(Dhcp4ParseError, what);
} }
...@@ -94,6 +94,21 @@ Parser4Context::loc2pos(isc::dhcp::location& loc) ...@@ -94,6 +94,21 @@ Parser4Context::loc2pos(isc::dhcp::location& loc)
return (isc::data::Element::Position(file, line, pos)); return (isc::data::Element::Position(file, line, pos));
} }
void
Parser4Context::require(const std::string& name,
isc::data::Element::Position open_loc,
isc::data::Element::Position close_loc)
{
ConstElementPtr value = stack_.back()->get(name);
if (!value) {
isc_throw(Dhcp4ParseError,
"missing parameter '" << name << "' ("
<< stack_.back()->getPosition() << ") ["
<< contextName() << " map between "
<< open_loc << " and " << close_loc << "]");
}
}
void void
Parser4Context::enter(const ParserContext& ctx) Parser4Context::enter(const ParserContext& ctx)
{ {
......
...@@ -73,6 +73,9 @@ public: ...@@ -73,6 +73,9 @@ public:
/// This will parse the input as host-reservation. /// This will parse the input as host-reservation.
PARSER_HOST_RESERVATION, PARSER_HOST_RESERVATION,
/// This will parse the input option definitions (for tests).
PARSER_OPTION_DEFS,
/// This will parse the input as option definition. /// This will parse the input as option definition.
PARSER_OPTION_DEF, PARSER_OPTION_DEF,
...@@ -176,6 +179,19 @@ public: ...@@ -176,6 +179,19 @@ public:
/// @return Position in format accepted by Element /// @return Position in format accepted by Element
isc::data::Element::Position loc2pos(isc::dhcp::location& loc); isc::data::Element::Position loc2pos(isc::dhcp::location& loc);
/// @brief Check if a required parameter is present
///
/// Check if a required parameter is present in the map at the top
/// of the stack and raise an error when it is not.
///
/// @param name name of the parameter to check
/// @param open_loc location of the opening curly bracket
/// @param close_loc ocation of the closing curly bracket
/// @throw Dhcp4ParseError
void require(const std::string& name,
isc::data::Element::Position open_loc,
isc::data::Element::Position close_loc);
/// @brief Defines syntactic contexts for lexical tie-ins /// @brief Defines syntactic contexts for lexical tie-ins
typedef enum { typedef enum {
///< This one is used in pure JSON mode. ///< This one is used in pure JSON mode.
......
...@@ -1618,7 +1618,7 @@ TEST_F(Dhcp4ParserTest, optionDefIpv4Address) { ...@@ -1618,7 +1618,7 @@ TEST_F(Dhcp4ParserTest, optionDefIpv4Address) {
" } ]" " } ]"
"}"; "}";
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseOPTION_DEF(config, true)); ASSERT_NO_THROW(json = parseOPTION_DEFS(config, true));
extractConfig(config); extractConfig(config);
// Make sure that the particular option definition does not exist. // Make sure that the particular option definition does not exist.
...@@ -1659,10 +1659,8 @@ TEST_F(Dhcp4ParserTest, optionDefIpv4Address) { ...@@ -1659,10 +1659,8 @@ TEST_F(Dhcp4ParserTest, optionDefIpv4Address) {
// Let's apply empty configuration. This removes the option definitions // Let's apply empty configuration. This removes the option definitions
// configuration and should result in removal of the option 100 from the // configuration and should result in removal of the option 100 from the
// libdhcp++. // libdhcp++. Note DHCP4 or OPTION_DEFS parsers do not accept empty maps.
config = "{ }"; json.reset(new MapElement());
ASSERT_NO_THROW(json = parseOPTION_DEF(config, true));
ASSERT_NO_THROW(status = configureDhcp4Server(*srv_, json)); ASSERT_NO_THROW(status = configureDhcp4Server(*srv_, json));
checkResult(status, 0); checkResult(status, 0);
...@@ -1685,7 +1683,7 @@ TEST_F(Dhcp4ParserTest, optionDefRecord) { ...@@ -1685,7 +1683,7 @@ TEST_F(Dhcp4ParserTest, optionDefRecord) {
" } ]" " } ]"
"}"; "}";
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseOPTION_DEF(config)); ASSERT_NO_THROW(json = parseOPTION_DEFS(config));
extractConfig(config); extractConfig(config);
// Make sure that the particular option definition does not exist. // Make sure that the particular option definition does not exist.
...@@ -1740,7 +1738,7 @@ TEST_F(Dhcp4ParserTest, optionDefMultiple) { ...@@ -1740,7 +1738,7 @@ TEST_F(Dhcp4ParserTest, optionDefMultiple) {
" } ]" " } ]"
"}"; "}";
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseOPTION_DEF(config)); ASSERT_NO_THROW(json = parseOPTION_DEFS(config));
extractConfig(config); extractConfig(config);
// Make sure that the option definitions do not exist yet. // Make sure that the option definitions do not exist yet.
...@@ -1810,7 +1808,7 @@ TEST_F(Dhcp4ParserTest, optionDefDuplicate) { ...@@ -1810,7 +1808,7 @@ TEST_F(Dhcp4ParserTest, optionDefDuplicate) {
" } ]" " } ]"
"}"; "}";
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseOPTION_DEF(config)); ASSERT_NO_THROW(json = parseOPTION_DEFS(config));
// Make sure that the option definition does not exist yet. // Make sure that the option definition does not exist yet.
ASSERT_FALSE(CfgMgr::instance().getStagingCfg()-> ASSERT_FALSE(CfgMgr::instance().getStagingCfg()->
...@@ -1849,7 +1847,7 @@ TEST_F(Dhcp4ParserTest, optionDefArray) { ...@@ -1849,7 +1847,7 @@ TEST_F(Dhcp4ParserTest, optionDefArray) {
" } ]" " } ]"
"}"; "}";
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseOPTION_DEF(config)); ASSERT_NO_THROW(json = parseOPTION_DEFS(config));
extractConfig(config); extractConfig(config);
// Make sure that the particular option definition does not exist. // Make sure that the particular option definition does not exist.
...@@ -1892,7 +1890,7 @@ TEST_F(Dhcp4ParserTest, optionDefEncapsulate) { ...@@ -1892,7 +1890,7 @@ TEST_F(Dhcp4ParserTest, optionDefEncapsulate) {
" } ]" " } ]"
"}"; "}";
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseOPTION_DEF(config)); ASSERT_NO_THROW(json = parseOPTION_DEFS(config));
extractConfig(config); extractConfig(config);
// Make sure that the particular option definition does not exist. // Make sure that the particular option definition does not exist.
...@@ -1933,7 +1931,7 @@ TEST_F(Dhcp4ParserTest, optionDefInvalidName) { ...@@ -1933,7 +1931,7 @@ TEST_F(Dhcp4ParserTest, optionDefInvalidName) {
" } ]" " } ]"
"}"; "}";
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseOPTION_DEF(config)); ASSERT_NO_THROW(json = parseOPTION_DEFS(config));
// Use the configuration string to create new option definition. // Use the configuration string to create new option definition.
ConstElementPtr status; ConstElementPtr status;
...@@ -1958,7 +1956,7 @@ TEST_F(Dhcp4ParserTest, optionDefInvalidType) { ...@@ -1958,7 +1956,7 @@ TEST_F(Dhcp4ParserTest, optionDefInvalidType) {
" } ]" " } ]"
"}"; "}";
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseOPTION_DEF(config)); ASSERT_NO_THROW(json = parseOPTION_DEFS(config));
// Use the configuration string to create new option definition. // Use the configuration string to create new option definition.
ConstElementPtr status; ConstElementPtr status;
...@@ -1984,7 +1982,7 @@ TEST_F(Dhcp4ParserTest, optionDefInvalidRecordType) { ...@@ -1984,7 +1982,7 @@ TEST_F(Dhcp4ParserTest, optionDefInvalidRecordType) {
" } ]" " } ]"
"}"; "}";
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseOPTION_DEF(config)); ASSERT_NO_THROW(json = parseOPTION_DEFS(config));
// Use the configuration string to create new option definition. // Use the configuration string to create new option definition.
ConstElementPtr status; ConstElementPtr status;
...@@ -2010,7 +2008,7 @@ TEST_F(Dhcp4ParserTest, optionIntegerTypes) { ...@@ -2010,7 +2008,7 @@ TEST_F(Dhcp4ParserTest, optionIntegerTypes) {
" } ]" " } ]"
"}"; "}";
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseOPTION_DEF(config)); ASSERT_NO_THROW(json = parseOPTION_DEFS(config));
// Use the configuration string to create new option definition. // Use the configuration string to create new option definition.
ConstElementPtr status; ConstElementPtr status;
...@@ -2035,7 +2033,7 @@ TEST_F(Dhcp4ParserTest, optionDefInvalidEncapsulatedSpace) { ...@@ -2035,7 +2033,7 @@ TEST_F(Dhcp4ParserTest, optionDefInvalidEncapsulatedSpace) {
" } ]" " } ]"
"}"; "}";
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseOPTION_DEF(config)); ASSERT_NO_THROW(json = parseOPTION_DEFS(config));
// Use the configuration string to create new option definition. // Use the configuration string to create new option definition.
ConstElementPtr status; ConstElementPtr status;
...@@ -2064,7 +2062,7 @@ TEST_F(Dhcp4ParserTest, optionDefEncapsulatedSpaceAndArray) { ...@@ -2064,7 +2062,7 @@ TEST_F(Dhcp4ParserTest, optionDefEncapsulatedSpaceAndArray) {