20 BaseNetworkParser::moveReservationMode(
ElementPtr config) {
21 if (!config->contains(
"reservation-mode")) {
24 if (config->contains(
"reservations-global") ||
25 config->contains(
"reservations-in-subnet") ||
26 config->contains(
"reservations-out-of-pool")) {
28 " and one of 'reservations-global', 'reservations-in-subnet'"
29 " or 'reservations-out-of-pool' parameters");
31 std::string hr_mode = getString(config,
"reservation-mode");
32 if ((hr_mode ==
"disabled") || (hr_mode ==
"off")) {
35 }
else if (hr_mode ==
"out-of-pool") {
39 }
else if (hr_mode ==
"global") {
42 }
else if (hr_mode ==
"all") {
49 << getPosition(
"reservation-mode", config) <<
")");
51 config->remove(
"reservation-mode");
57 bool has_renew = network_data->contains(
"renew-timer");
58 bool has_rebind = network_data->contains(
"rebind-timer");
63 renew = getInteger(network_data,
"renew-timer");
66 << renew <<
") must be a positive number");
68 network->setT1(renew);
72 rebind = getInteger(network_data,
"rebind-timer");
75 << rebind <<
") must be a positive number");
77 network->setT2(rebind);
80 if (has_renew && has_rebind && (renew > rebind)) {
82 <<
") is greater than the value of rebind-timer" <<
" ("
86 network->setValid(parseIntTriplet(network_data,
"valid-lifetime"));
88 if (network_data->contains(
"store-extended-info")) {
89 network->setStoreExtendedInfo(getBoolean(network_data,
90 "store-extended-info"));
93 if (network_data->contains(
"reservations-global")) {
94 network->setReservationsGlobal(getBoolean(network_data,
95 "reservations-global"));
98 if (network_data->contains(
"reservations-in-subnet")) {
99 network->setReservationsInSubnet(getBoolean(network_data,
100 "reservations-in-subnet"));
103 if (network_data->contains(
"reservations-out-of-pool")) {
104 network->setReservationsOutOfPool(getBoolean(network_data,
105 "reservations-out-of-pool"));
112 bool calculate_tee_times = network->getCalculateTeeTimes();
113 if (network_data->contains(
"calculate-tee-times")) {
114 calculate_tee_times = getBoolean(network_data,
"calculate-tee-times");
115 network->setCalculateTeeTimes(calculate_tee_times);
119 if (network_data->contains(
"t2-percent")) {
120 t2_percent = getDouble(network_data,
"t2-percent");
124 if (network_data->contains(
"t1-percent")) {
125 t1_percent = getDouble(network_data,
"t1-percent");
127 if (calculate_tee_times) {
129 (t2_percent.
get() >= 1.0))) {
131 <<
" is invalid, it must be greater than 0.0 and less than 1.0");
135 (t1_percent.
get() >= 1.0))) {
137 <<
" is invalid it must be greater than 0.0 and less than 1.0");
141 (t1_percent.
get() >= t2_percent.
get())) {
143 <<
" is invalid, it must be less than t2-percent: "
144 << t2_percent.
get());
148 network->setT2Percent(t2_percent);
149 network->setT1Percent(t1_percent);
155 if (network_data->contains(
"cache-threshold")) {
156 double cache_threshold = getDouble(network_data,
"cache-threshold");
157 if ((cache_threshold <= 0.0) || (cache_threshold >= 1.0)) {
159 <<
" is invalid, it must be greater than 0.0 and less than 1.0");
161 network->setCacheThreshold(cache_threshold);
164 if (network_data->contains(
"cache-max-age")) {
165 network->setCacheMaxAge(getInteger(network_data,
"cache-max-age"));
173 if (network_data->contains(
"ddns-send-updates")) {
174 network->setDdnsSendUpdates(getBoolean(network_data,
"ddns-send-updates"));
177 if (network_data->contains(
"ddns-override-no-update")) {
178 network->setDdnsOverrideNoUpdate(getBoolean(network_data,
"ddns-override-no-update"));
181 if (network_data->contains(
"ddns-override-client-update")) {
182 network->setDdnsOverrideClientUpdate(getBoolean(network_data,
"ddns-override-client-update"));
185 if (network_data->contains(
"ddns-replace-client-name")) {
187 D2ClientConfig::stringToReplaceClientNameMode>
188 (network_data,
"ddns-replace-client-name",
189 "ReplaceClientName mode"));
192 if (network_data->contains(
"ddns-generated-prefix")) {
193 network->setDdnsGeneratedPrefix(getString(network_data,
"ddns-generated-prefix"));
196 if (network_data->contains(
"ddns-qualifying-suffix")) {
197 network->setDdnsQualifyingSuffix(getString(network_data,
"ddns-qualifying-suffix"));
200 std::string hostname_char_set;
201 if (network_data->contains(
"hostname-char-set")) {
202 hostname_char_set = getString(network_data,
"hostname-char-set");
203 network->setHostnameCharSet(hostname_char_set);
206 std::string hostname_char_replacement;
207 if (network_data->contains(
"hostname-char-replacement")) {
208 hostname_char_replacement = getString(network_data,
"hostname-char-replacement");
209 network->setHostnameCharReplacement(hostname_char_replacement);
215 if (!hostname_char_set.empty()) {
218 hostname_char_replacement));
219 }
catch (
const std::exception& ex) {
221 <<
"' is not a valid regular expression");
225 if (network_data->contains(
"ddns-update-on-renew")) {
226 network->setDdnsUpdateOnRenew(getBoolean(network_data,
"ddns-update-on-renew"));
229 if (network_data->contains(
"ddns-use-conflict-resolution")) {
230 network->setDdnsUseConflictResolution(getBoolean(network_data,
"ddns-use-conflict-resolution"));
void unspecified(bool unspecified)
Modifies the flag that indicates whether the value is specified or unspecified.
boost::shared_ptr< Network > NetworkPtr
Pointer to the Network object.
boost::shared_ptr< Element > ElementPtr
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
To be removed. Please use ConfigError instead.
boost::shared_ptr< const Element > ConstElementPtr
Implements a regular expression based string scrubber.
Defines the logger used by the top-level component of kea-dhcp-ddns.
T get() const
Retrieves the encapsulated value.
ReplaceClientNameMode
Defines the client name replacement modes.
static ElementPtr create(const Position &pos=ZERO_POSITION())
boost::shared_ptr< StringSanitizer > StringSanitizerPtr