|
@@ -20,43 +20,46 @@ void
|
|
ExpirationConfigParser::parse(ConstElementPtr expiration_config) {
|
|
ExpirationConfigParser::parse(ConstElementPtr expiration_config) {
|
|
CfgExpirationPtr cfg = CfgMgr::instance().getStagingCfg()->getCfgExpiration();
|
|
CfgExpirationPtr cfg = CfgMgr::instance().getStagingCfg()->getCfgExpiration();
|
|
|
|
|
|
- BOOST_FOREACH(ConfigPair config_element, expiration_config->mapValue()) {
|
|
|
|
|
|
+ std::string param;
|
|
|
|
|
|
- // Get parameter name and value.
|
|
|
|
- std::string param_name = config_element.first;
|
|
|
|
- ConstElementPtr param_value = config_element.second;
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- // Set configuration parameters.
|
|
|
|
- if (param_name == "reclaim-timer-wait-time") {
|
|
|
|
- cfg->setReclaimTimerWaitTime(param_value->intValue());
|
|
|
|
-
|
|
|
|
- } else if (param_name == "flush-reclaimed-timer-wait-time") {
|
|
|
|
- cfg->setFlushReclaimedTimerWaitTime(param_value->intValue());
|
|
|
|
-
|
|
|
|
- } else if (param_name == "hold-reclaimed-time") {
|
|
|
|
- cfg->setHoldReclaimedTime(param_value->intValue());
|
|
|
|
|
|
+ try {
|
|
|
|
+ param = "reclaim-timer-wait-time";
|
|
|
|
+ if (expiration_config->contains(param)) {
|
|
|
|
+ cfg->setReclaimTimerWaitTime(getInteger(expiration_config, param));
|
|
|
|
+ }
|
|
|
|
|
|
- } else if (param_name == "max-reclaim-leases") {
|
|
|
|
- cfg->setMaxReclaimLeases(param_value->intValue());
|
|
|
|
|
|
+ param = "flush-reclaimed-timer-wait-time";
|
|
|
|
+ if (expiration_config->contains(param)) {
|
|
|
|
+ cfg->setFlushReclaimedTimerWaitTime(getInteger(expiration_config,
|
|
|
|
+ param));
|
|
|
|
+ }
|
|
|
|
|
|
- } else if (param_name == "max-reclaim-time") {
|
|
|
|
- cfg->setMaxReclaimTime(param_value->intValue());
|
|
|
|
|
|
+ param = "hold-reclaimed-time";
|
|
|
|
+ if (expiration_config->contains(param)) {
|
|
|
|
+ cfg->setHoldReclaimedTime(getInteger(expiration_config, param));
|
|
|
|
+ }
|
|
|
|
|
|
- } else if (param_name == "unwarned-reclaim-cycles") {
|
|
|
|
- cfg->setUnwarnedReclaimCycles(param_value->intValue());
|
|
|
|
|
|
+ param = "max-reclaim-leases";
|
|
|
|
+ if (expiration_config->contains(param)) {
|
|
|
|
+ cfg->setMaxReclaimLeases(getInteger(expiration_config, param));
|
|
|
|
+ }
|
|
|
|
|
|
- } else {
|
|
|
|
- isc_throw(DhcpConfigError, "unsupported parameter '"
|
|
|
|
- << param_name << "'");
|
|
|
|
- }
|
|
|
|
|
|
+ param = "max-reclaim-time";
|
|
|
|
+ if (expiration_config->contains(param)) {
|
|
|
|
+ cfg->setMaxReclaimTime(getInteger(expiration_config, param));
|
|
|
|
+ }
|
|
|
|
|
|
- } catch (const std::exception& ex) {
|
|
|
|
- // Append position of the configuration parameter to the error
|
|
|
|
- // message.
|
|
|
|
- isc_throw(DhcpConfigError, ex.what() << " ("
|
|
|
|
- << param_value->getPosition() << ")");
|
|
|
|
|
|
+ param = "unwarned-reclaim-cycles";
|
|
|
|
+ if (expiration_config->contains(param)) {
|
|
|
|
+ cfg->setUnwarnedReclaimCycles(
|
|
|
|
+ getInteger(expiration_config, param));
|
|
}
|
|
}
|
|
|
|
+ } catch (const DhcpConfigError&) {
|
|
|
|
+ throw;
|
|
|
|
+ } catch (const std::exception& ex) {
|
|
|
|
+ // Append position of the configuration parameter to the error message.
|
|
|
|
+ isc_throw(DhcpConfigError, ex.what() << " ("
|
|
|
|
+ << getPosition(param, expiration_config) << ")");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|