2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +00:00

[5033] - migrated D2ClientConfigParser to SimpleParser, kea-dhcp4 uses it

src/bin/dhcp4/json_config_parser.cc
    createGlobalDhcp4ConfigParser()
    - added clause to invoke new D2ClientConfigParser to
    set staging config
    - added clause to apply staged D2ClientConfig (formerly done
    by parser commit

src/bin/dhcp4/parser_context.h
src/bin/dhcp4/parser_context.cc
    aded PARSER_DHCP_DDNS context

src/bin/dhcp4/simple_parser4.h
src/bin/dhcp4/simple_parser4.cc
    defined SimpleParser4::D2_CLIENT_CONFIG_DEFAULTS
    SimpleParser4::setAllDefaults() - now sets defaults
    for D2ClientConfig

src/bin/dhcp4/tests/d2_unittest.cc
src/bin/dhcp4/tests/fqdn_unittest.cc
    Updated replace-name-mode values (true/false no longer supported)

src/lib/dhcpsrv/parsers/dhcp_parsers.h
src/lib/dhcpsrv/parsers/dhcp_parsers.cc
    D2ClientConfig now derives from SimpleParser

src/lib/dhcpsrv/srv_config.h
src/lib/dhcpsrv/srv_config.cc
    Added a D2ClientConfigPtr member to SrvConfig.

src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
    Updated tests to set D2 client config defaults

doc/guide/dhcp4-srv.xml
    Updated, replace-client-name no longer accepts booleans
This commit is contained in:
Thomas Markwalder
2017-01-11 13:47:39 -05:00
parent 6bb31a56bf
commit 85640c193b
17 changed files with 298 additions and 252 deletions

View File

@@ -436,8 +436,7 @@ DhcpConfigParser* createGlobalDhcp4ConfigParser(const std::string& config_id,
parser = new HooksLibrariesParser(config_id);
} else if (config_id.compare("echo-client-id") == 0) {
parser = new BooleanParser(config_id, globalContext()->boolean_values_);
} else if (config_id.compare("dhcp-ddns") == 0) {
parser = new D2ClientConfigParser(config_id);
// dhcp-ddns has been converted to SimpleParser.
} else if (config_id.compare("match-client-id") == 0) {
parser = new BooleanParser(config_id, globalContext()->boolean_values_);
} else if (config_id.compare("control-socket") == 0) {
@@ -637,6 +636,13 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) {
continue;
}
if (config_pair.first == "dhcp-ddns") {
D2ClientConfigParser parser;
D2ClientConfigPtr cfg = parser.parse(config_pair.second);
CfgMgr::instance().getStagingCfg()->setD2ClientConfig(cfg);
continue;
}
ParserPtr parser(createGlobalDhcp4ConfigParser(config_pair.first,
config_pair.second));
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL, DHCP4_PARSER_CREATED)
@@ -735,6 +741,13 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) {
if (hooks_parser) {
hooks_parser->commit();
}
{
// Used to be done by parser commit
D2ClientConfigPtr cfg;
cfg = CfgMgr::instance().getStagingCfg()->getD2ClientConfig();
CfgMgr::instance().setD2ClientConfig(cfg);
}
}
catch (const isc::Exception& ex) {
LOG_ERROR(dhcp4_logger, DHCP4_PARSER_COMMIT_FAIL).arg(ex.what());