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");
56 if (!config->get(CfgGlobals::RESERVATION_MODE)) {
59 if (config->get(CfgGlobals::RESERVATIONS_GLOBAL) ||
60 config->get(CfgGlobals::RESERVATIONS_IN_SUBNET) ||
61 config->get(CfgGlobals::RESERVATIONS_OUT_OF_POOL)) {
63 " and one of 'reservations-global', 'reservations-in-subnet'" 64 " or 'reservations-out-of-pool' parameters");
66 std::string hr_mode = config->get(CfgGlobals::RESERVATION_MODE)->stringValue();
67 if ((hr_mode ==
"disabled") || (hr_mode ==
"off")) {
69 config->set(CfgGlobals::RESERVATIONS_IN_SUBNET,
Element::create(
false));
70 }
else if (hr_mode ==
"out-of-pool") {
73 config->set(CfgGlobals::RESERVATIONS_OUT_OF_POOL,
Element::create(
true));
74 }
else if (hr_mode ==
"global") {
76 config->set(CfgGlobals::RESERVATIONS_IN_SUBNET,
Element::create(
false));
77 }
else if (hr_mode ==
"all") {
84 << config->get(CfgGlobals::RESERVATION_MODE)->getPosition()
93 bool has_renew = network_data->contains(
"renew-timer");
94 bool has_rebind = network_data->contains(
"rebind-timer");
99 renew = getInteger(network_data,
"renew-timer");
102 << renew <<
") must be a positive number");
104 network->setT1(renew);
108 rebind = getInteger(network_data,
"rebind-timer");
111 << rebind <<
") must be a positive number");
113 network->setT2(rebind);
116 if (has_renew && has_rebind && (renew > rebind)) {
118 <<
") is greater than the value of rebind-timer (" 122 network->setValid(parseIntTriplet(network_data,
"valid-lifetime"));
124 if (network_data->contains(
"store-extended-info")) {
125 network->setStoreExtendedInfo(getBoolean(network_data,
126 "store-extended-info"));
129 if (network_data->contains(
"reservations-global")) {
130 network->setReservationsGlobal(getBoolean(network_data,
131 "reservations-global"));
134 if (network_data->contains(
"reservations-in-subnet")) {
135 network->setReservationsInSubnet(getBoolean(network_data,
136 "reservations-in-subnet"));
139 if (network_data->contains(
"reservations-out-of-pool")) {
140 network->setReservationsOutOfPool(getBoolean(network_data,
141 "reservations-out-of-pool"));
148 bool calculate_tee_times = network->getCalculateTeeTimes();
149 if (network_data->contains(
"calculate-tee-times")) {
150 calculate_tee_times = getBoolean(network_data,
"calculate-tee-times");
151 network->setCalculateTeeTimes(calculate_tee_times);
155 if (network_data->contains(
"t2-percent")) {
156 t2_percent = getDouble(network_data,
"t2-percent");
160 if (network_data->contains(
"t1-percent")) {
161 t1_percent = getDouble(network_data,
"t1-percent");
163 if (calculate_tee_times) {
165 (t2_percent.
get() >= 1.0))) {
167 <<
" is invalid, it must be greater than 0.0 and less than 1.0");
171 (t1_percent.
get() >= 1.0))) {
173 <<
" is invalid it must be greater than 0.0 and less than 1.0");
177 (t1_percent.
get() >= t2_percent.
get())) {
179 <<
" is invalid, it must be less than t2-percent: " 180 << t2_percent.
get());
184 network->setT2Percent(t2_percent);
185 network->setT1Percent(t1_percent);
191 if (network_data->contains(
"cache-threshold")) {
192 double cache_threshold = getDouble(network_data,
"cache-threshold");
193 if ((cache_threshold <= 0.0) || (cache_threshold >= 1.0)) {
195 <<
" is invalid, it must be greater than 0.0 and less than 1.0");
197 network->setCacheThreshold(cache_threshold);
200 if (network_data->contains(
"cache-max-age")) {
201 network->setCacheMaxAge(getInteger(network_data,
"cache-max-age"));
209 if (network_data->contains(
"ddns-send-updates")) {
210 network->setDdnsSendUpdates(getBoolean(network_data,
"ddns-send-updates"));
213 if (network_data->contains(
"ddns-override-no-update")) {
214 network->setDdnsOverrideNoUpdate(getBoolean(network_data,
"ddns-override-no-update"));
217 if (network_data->contains(
"ddns-override-client-update")) {
218 network->setDdnsOverrideClientUpdate(getBoolean(network_data,
"ddns-override-client-update"));
221 if (network_data->contains(
"ddns-replace-client-name")) {
223 D2ClientConfig::stringToReplaceClientNameMode>
224 (network_data,
"ddns-replace-client-name",
225 "ReplaceClientName mode"));
228 if (network_data->contains(
"ddns-generated-prefix")) {
229 network->setDdnsGeneratedPrefix(getString(network_data,
"ddns-generated-prefix"));
232 if (network_data->contains(
"ddns-qualifying-suffix")) {
233 network->setDdnsQualifyingSuffix(getString(network_data,
"ddns-qualifying-suffix"));
236 std::string hostname_char_set;
237 if (network_data->contains(
"hostname-char-set")) {
238 hostname_char_set = getString(network_data,
"hostname-char-set");
239 network->setHostnameCharSet(hostname_char_set);
242 std::string hostname_char_replacement;
243 if (network_data->contains(
"hostname-char-replacement")) {
244 hostname_char_replacement = getString(network_data,
"hostname-char-replacement");
245 network->setHostnameCharReplacement(hostname_char_replacement);
251 if (!hostname_char_set.empty()) {
254 hostname_char_replacement));
255 }
catch (
const std::exception& ex) {
257 <<
"' is not a valid regular expression");
261 if (network_data->contains(
"ddns-update-on-renew")) {
262 network->setDdnsUpdateOnRenew(getBoolean(network_data,
"ddns-update-on-renew"));
265 if (network_data->contains(
"ddns-use-conflict-resolution")) {
266 network->setDdnsUseConflictResolution(getBoolean(network_data,
"ddns-use-conflict-resolution"));
273 if (network_data->contains(
"allocator")) {
274 auto allocator_type = getString(network_data,
"allocator");
275 if ((allocator_type !=
"iterative") && (allocator_type !=
"random")) {
279 network->setAllocatorType(allocator_type);
286 if (network_data->contains(
"pd-allocator")) {
287 auto allocator_type = getString(network_data,
"pd-allocator");
288 if ((allocator_type !=
"iterative") && (allocator_type !=
"random")) {
292 network->setPdAllocatorType(allocator_type);
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< CfgGlobals > CfgGlobalsPtr
Non-const shared pointer to a CfgGlobals instance.
T get() const
Retrieves the encapsulated value.
boost::shared_ptr< Element > ElementPtr
boost::shared_ptr< Network6 > Network6Ptr
Pointer to the Network6 object.
#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-lfc.
ReplaceClientNameMode
Defines the client name replacement modes.
static ElementPtr create(const Position &pos=ZERO_POSITION())
boost::shared_ptr< StringSanitizer > StringSanitizerPtr
Type representing the pointer to the StringSanitizer.