Commit e782a9d5 authored by Thomas Markwalder's avatar Thomas Markwalder

[#35,!517] Added DDDNS parameters to networks,subnets, and their parsers

src/lib/dhcpsrv/network.*
    Network - added DDNS parameters: Optional members, getters, setters
    Network::toElement() - added DDNS parameters

src/lib/dhcpsrv/parsers/base_network_parser.*
    BaseNetworkParser::parseDdnsParams() - new method to parse DDNS parameters

    BaseNetworkParser::parseLifetime() - fixed unitialized variables warning

src/lib/dhcpsrv/parsers/dhcp_parsers.cc
    Subnet4ConfigParser::initSubnet()
    Subnet6ConfigParser::initSubnet()  - added call to parseDdnsParms().

src/lib/dhcpsrv/parsers/shared_network_parser.cc
    SharedNetwork4Parser::parse()
    SharedNetwork6Parser::parse() - added call to parseDdnsParms().

src/lib/dhcpsrv/parsers/simple_parser4.cc
    SimpleParser4::GLOBAL4_PARAMETERS
    SimpleParser4::GLOBAL4_DEFAULTS
    SimpleParser4::SUBNET4_PARAMETERS
    SimpleParser4::INHERIT_TO_SUBNET4
    SimpleParser4::SHARED_NETWORK4_PARAMETERS - added DDNS parameters

src/lib/dhcpsrv/parsers/simple_parser6.cc
    SimpleParser6::GLOBAL6_PARAMETERS
    SimpleParser6::GLOBAL6_DEFAULTS
    SimpleParser6::SUBNET6_PARAMETERS
    SimpleParser6::INHERIT_TO_SUBNET6
    SimpleParser6::SHARED_NETWORK6_PARAMETERS - added DDNS parameters

src/lib/dhcpsrv/tests/cfg_shared_networks4_unittest.cc
src/lib/dhcpsrv/tests/cfg_shared_networks6_unittest.cc
src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
src/lib/dhcpsrv/tests/network_unittest.cc
src/lib/dhcpsrv/tests/shared_network_parser_unittest.cc
src/lib/dhcpsrv/tests/shared_network_unittest.cc
src/lib/dhcpsrv/tests/subnet_unittest.cc
    Updated tests.
parent 4f57cfa2
......@@ -242,6 +242,32 @@ Network::toElement() const {
map->set("t2-percent", Element::create(t2_percent_));
}
if (!ddns_send_updates_.unspecified()) {
map->set("ddns-send-updates", Element::create(ddns_send_updates_));
}
if (!ddns_override_no_update_.unspecified()) {
map->set("ddns-override-no-update", Element::create(ddns_override_no_update_));
}
if (!ddns_override_client_update_.unspecified()) {
map->set("ddns-override-client-update", Element::create(ddns_override_client_update_));
}
if (!ddns_replace_client_name_mode_.unspecified()) {
map->set("ddns-replace-client-name",
Element::create(D2ClientConfig::
replaceClientNameModeToString(ddns_replace_client_name_mode_)));
}
if (!ddns_generated_prefix_.unspecified()) {
map->set("ddns-generated-prefix", Element::create(ddns_generated_prefix_));
}
if (!ddns_qualifying_suffix_.unspecified()) {
map->set("ddns-qualifying-suffix", Element::create(ddns_qualifying_suffix_));
}
return (map);
}
......
......@@ -16,6 +16,7 @@
#include <dhcp/option.h>
#include <dhcpsrv/cfg_option.h>
#include <dhcpsrv/cfg_4o6.h>
#include <dhcpsrv/d2_client_cfg.h>
#include <dhcpsrv/triplet.h>
#include <util/optional.h>
#include <boost/shared_ptr.hpp>
......@@ -203,7 +204,9 @@ public:
Network()
: iface_name_(), client_class_(), t1_(), t2_(), valid_(),
host_reservation_mode_(HR_ALL, true), cfg_option_(new CfgOption()),
calculate_tee_times_(), t1_percent_(), t2_percent_() {
calculate_tee_times_(), t1_percent_(), t2_percent_(),
ddns_send_updates_(), ddns_override_no_update_(), ddns_override_client_update_(),
ddns_replace_client_name_mode_(), ddns_generated_prefix_(), ddns_qualifying_suffix_() {
}
/// @brief Virtual destructor.
......@@ -517,6 +520,132 @@ public:
t2_percent_ = t2_percent;
}
/// @brief Returns ddns-send-updates
///
/// @param inheritance inheritance mode to be used.
util::Optional<bool>
getDdnsSendUpdates(const Inheritance& inheritance = Inheritance::ALL) const {
return (getProperty<Network>(&Network::getDdnsSendUpdates, ddns_send_updates_,
inheritance, "ddns-send-updates"));
}
/// @brief Sets new ddns-send-updates
///
/// @param ddns_send_updates_ New value to use.
void setDdnsSendUpdates(const util::Optional<bool>& ddns_send_updates) {
ddns_send_updates_ = ddns_send_updates;
}
/// @brief Returns ddns-override-no-update
///
/// @param inheritance inheritance mode to be used.
util::Optional<bool>
getDdnsOverrideNoUpdate(const Inheritance& inheritance = Inheritance::ALL) const {
return (getProperty<Network>(&Network::getDdnsOverrideNoUpdate, ddns_override_no_update_,
inheritance, "ddns-override-no-update"));
}
/// @brief Sets new ddns-override-no-update
///
/// @param ddns_override_no_update New value to use.
void setDdnsOverrideNoUpdate(const util::Optional<bool>& ddns_override_no_update) {
ddns_override_no_update_ = ddns_override_no_update;
}
/// @brief Returns ddns-overridie-client-update
///
/// @param inheritance inheritance mode to be used.
util::Optional<bool>
getDdnsOverrideClientUpdate(const Inheritance& inheritance = Inheritance::ALL) const {
return (getProperty<Network>(&Network::getDdnsOverrideClientUpdate, ddns_override_client_update_,
inheritance, "ddns-override-client-update"));
}
/// @brief Sets new ddns-override-client-update
///
/// @param ddns-override-client-update New value to use.
void setDdnsOverrideClientUpdate(const util::Optional<bool>& ddns_override_client_update) {
ddns_override_client_update_ = ddns_override_client_update;
}
/// @brief Returns ddns-replace-client-name-mode
///
/// @param inheritance inheritance mode to be used.
util::Optional<D2ClientConfig::ReplaceClientNameMode>
getDdnsReplaceClientNameMode(const Inheritance& inheritance = Inheritance::ALL) const {
// Inheritance for ddns-replace-client-name is a little different than for other
// parameters. The value at the global level is given as a string.
// Thus we call getProperty here without a global name to check if it
// is specified on network level only.
const util::Optional<D2ClientConfig::ReplaceClientNameMode>& mode
= getProperty<Network>(&Network::getDdnsReplaceClientNameMode,
ddns_replace_client_name_mode_, inheritance);
// If it is not specified at network level we need this special
// case code to convert the global string value to an enum.
if (mode.unspecified() && (inheritance != Inheritance::NONE) &&
(inheritance != Inheritance::PARENT_NETWORK)) {
// Get global mode.
util::Optional<std::string> mode_label;
mode_label = getGlobalProperty(mode_label, "ddns-replace-client-name");
if (!mode_label.unspecified()) {
try {
// If the mode is globally configured, convert it to an enum.
return (D2ClientConfig::stringToReplaceClientNameMode(mode_label.get()));
} catch (...) {
// This should not really happen because the configuration
// parser should have already verified the globally configured
// reservation mode. However, we want to be 100% sure that this
// method doesn't throw. Let's just return unspecified.
return (mode);
}
}
}
return (mode);
}
/// @brief Sets new ddns-replace-client-name-mode
///
/// @param ddns_replace_client_name_mode New value to use.
void setDdnsReplaceClientNameMode(const util::Optional<D2ClientConfig::ReplaceClientNameMode>&
ddns_replace_client_name_mode) {
ddns_replace_client_name_mode_ = ddns_replace_client_name_mode;
}
/// @brief Returns ddns-generated-prefix
///
/// @param inheritance inheritance mode to be used.
util::Optional<std::string>
getDdnsGeneratedPrefix(const Inheritance& inheritance = Inheritance::ALL) const {
return (getProperty<Network>(&Network::getDdnsGeneratedPrefix, ddns_generated_prefix_,
inheritance, "ddns-generated-prefix"));
}
/// @brief Sets new ddns-generated-prefix
///
/// @param ddns_generated-prefix New value to use.
void setDdnsGeneratedPrefix(const util::Optional<std::string>& ddns_generated_prefix) {
ddns_generated_prefix_ = ddns_generated_prefix;
}
/// @brief Returns ddns-qualifying-suffix
///
/// @param inheritance inheritance mode to be used.
util::Optional<std::string>
getDdnsQualifyingSuffix(const Inheritance& inheritance = Inheritance::ALL) const {
return (getProperty<Network>(&Network::getDdnsQualifyingSuffix, ddns_qualifying_suffix_,
inheritance, "ddns-qualifying-suffix"));
}
/// @brief Sets new ddns-qualifying-suffix
///
/// @param ddns_qualifying_suffix New value to use.
void setDdnsQualifyingSuffix(const util::Optional<std::string>& ddns_qualifying_suffix) {
ddns_qualifying_suffix_ = ddns_qualifying_suffix;
}
/// @brief Unparses network object.
///
/// @return A pointer to unparsed network configuration.
......@@ -779,6 +908,26 @@ protected:
/// @brief Percentage of the lease lifetime to use when calculating T2 timer
util::Optional<double> t2_percent_;
/// @brief Should Kea perform DNS updates. Used to provide scoped enabling
/// and disabling of updates.
util::Optional<bool> ddns_send_updates_;
/// @brief Should Kea perform updates, even if client requested no updates.
/// Overrides the client request for no updates via the N flag.
util::Optional<bool> ddns_override_no_update_;
/// @brief Should Kea perform updates, even if client requested delegation.
util::Optional<bool> ddns_override_client_update_;
/// @brief How Kea should handle the domain-name supplied by the client.
util::Optional<D2ClientConfig::ReplaceClientNameMode> ddns_replace_client_name_mode_;
/// @brief Prefix Kea should use when generating domain-names.
util::Optional<std::string> ddns_generated_prefix_;
/// @brief Suffix Kea should use when to qualify partial domain-names.
util::Optional<std::string> ddns_qualifying_suffix_;
/// @brief Pointer to another network that this network belongs to.
///
/// The most common case is that this instance is a subnet which belongs
......
......@@ -18,11 +18,11 @@ namespace dhcp {
const Triplet<uint32_t>
BaseNetworkParser::parseLifetime(const ConstElementPtr& scope,
const std::string& name) {
uint32_t value;
uint32_t value = 0;
bool has_value = false;
uint32_t min_value;
uint32_t min_value = 0;
bool has_min = false;
uint32_t max_value;
uint32_t max_value = 0;
bool has_max = false;
if (scope->contains(name)) {
value = getInteger(scope, name);
......@@ -167,5 +167,37 @@ BaseNetworkParser::parseHostReservationMode(const data::ConstElementPtr& network
}
}
void
BaseNetworkParser::parseDdnsParams(const data::ConstElementPtr& network_data,
NetworkPtr& network) {
if (network_data->contains("ddns-send-updates")) {
network->setDdnsSendUpdates(getBoolean(network_data, "ddns-send-updates"));
}
if (network_data->contains("ddns-override-no-update")) {
network->setDdnsOverrideNoUpdate(getBoolean(network_data, "ddns-override-no-update"));
}
if (network_data->contains("ddns-override-client-update")) {
network->setDdnsOverrideClientUpdate(getBoolean(network_data, "ddns-override-client-update"));
}
if (network_data->contains("ddns-replace-client-name")) {
network->setDdnsReplaceClientNameMode(getAndConvert<D2ClientConfig::ReplaceClientNameMode,
D2ClientConfig::stringToReplaceClientNameMode>
(network_data, "ddns-replace-client-name",
"ReplaceClientName mode"));
}
if (network_data->contains("ddns-generated-prefix")) {
network->setDdnsGeneratedPrefix(getString(network_data, "ddns-generated-prefix"));
}
if (network_data->contains("ddns-qualifying-suffix")) {
network->setDdnsQualifyingSuffix(getString(network_data, "ddns-qualifying-suffix"));
}
}
} // end of namespace isc::dhcp
} // end of namespace isc
......@@ -62,13 +62,30 @@ protected:
NetworkPtr& network);
/// @brief Parses host reservation mode.
//
///
/// @param network_data Data element holding shared network
/// configuration to be parsed.
/// @param [out] network Pointer to a network in which parsed data is
/// to be stored.
void parseHostReservationMode(const data::ConstElementPtr& network_data,
NetworkPtr& network);
/// @brief Parses parameters pertaining to DDNS behavior.
///
/// The parsed parameters are:
/// - ddns-send-updates
/// - ddns-override-no-update
/// - ddns-override-client-update
/// - ddns-replace-client-name
/// - ddns-generated-prefix
/// - ddns-qualifying-suffix
///
/// @param network_data Data element holding shared network
/// configuration to be parsed.
/// @param [out] network Pointer to a network in which parsed data is
/// to be stored.
void parseDdnsParams(const data::ConstElementPtr& network_data,
NetworkPtr& network);
};
} // end of namespace isc::dhcp
......
......@@ -925,6 +925,9 @@ Subnet4ConfigParser::initSubnet(data::ConstElementPtr params,
// Parse t1-percent and t2-percent
parseTeePercents(params, network);
// Parse DDNS parameters
parseDdnsParams(params, network);
}
//**************************** Subnets4ListConfigParser **********************
......@@ -1314,6 +1317,9 @@ Subnet6ConfigParser::initSubnet(data::ConstElementPtr params,
// Parse t1-percent and t2-percent
parseTeePercents(params, network);
// Parse DDNS parameters
parseDdnsParams(params, network);
}
//**************************** Subnet6ListConfigParser ********************
......
......@@ -174,6 +174,8 @@ SharedNetwork4Parser::parse(const data::ConstElementPtr& shared_network_data) {
parseTeePercents(shared_network_data, network);
// Parse DDNS parameters
parseDdnsParams(shared_network_data, network);
} catch (const DhcpConfigError&) {
// Position was already added
throw;
......@@ -326,6 +328,8 @@ SharedNetwork6Parser::parse(const data::ConstElementPtr& shared_network_data) {
parseTeePercents(shared_network_data, network);
// Parse DDNS parameters
parseDdnsParams(shared_network_data, network);
} catch (const std::exception& ex) {
isc_throw(DhcpConfigError, ex.what() << " ("
<< shared_network_data->getPosition() << ")");
......
......@@ -75,14 +75,14 @@ const SimpleKeywords SimpleParser4::GLOBAL4_PARAMETERS = {
{ "t1-percent", Element::real },
{ "t2-percent", Element::real },
{ "loggers", Element::list },
{ "hostname-char-set", Element::string },
{ "hostname-char-replacement", Element::string },
{ "ddns-send-updates", Element::boolean },
{ "ddns-override-no-update", Element::boolean },
{ "ddns-override-client-update", Element::boolean },
{ "ddns-replace-client-name", Element::string },
{ "ddns-generated-prefix", Element::string },
{ "ddns-qualifying-suffix", Element::string }
{ "hostname-char-set", Element::string },
{ "hostname-char-replacement", Element::string }
};
/// @brief This table defines default global values for DHCPv4
......@@ -109,7 +109,7 @@ const SimpleDefaults SimpleParser4::GLOBAL4_DEFAULTS = {
{ "ddns-override-no-update", Element::boolean, "false" },
{ "ddns-override-client-update", Element::boolean, "false" },
{ "ddns-replace-client-name", Element::string, "never" },
{ "ddns-generated-prefix", Element::string, "myhost" }
{ "ddns-generated-prefix", Element::string, "myhost" },
// TKM should this still be true? qualifying-suffix has no default ??
{ "ddns-generated-suffix", Element::string, "" }
};
......@@ -177,35 +177,41 @@ const SimpleDefaults SimpleParser4::OPTION4_DEFAULTS = {
/// list and map types for entries.
/// Order follows subnet4_param rule in bison grammar.
const SimpleKeywords SimpleParser4::SUBNET4_PARAMETERS = {
{ "valid-lifetime", Element::integer },
{ "min-valid-lifetime", Element::integer },
{ "max-valid-lifetime", Element::integer },
{ "renew-timer", Element::integer },
{ "rebind-timer", Element::integer },
{ "option-data", Element::list },
{ "pools", Element::list },
{ "subnet", Element::string },
{ "interface", Element::string },
{ "id", Element::integer },
{ "client-class", Element::string },
{ "require-client-classes", Element::list },
{ "reservations", Element::list },
{ "reservation-mode", Element::string },
{ "relay", Element::map },
{ "match-client-id", Element::boolean },
{ "authoritative", Element::boolean },
{ "next-server", Element::string },
{ "server-hostname", Element::string },
{ "boot-file-name", Element::string },
{ "4o6-interface", Element::string },
{ "4o6-interface-id", Element::string },
{ "4o6-subnet", Element::string },
{ "user-context", Element::map },
{ "comment", Element::string },
{ "calculate-tee-times", Element::boolean },
{ "t1-percent", Element::real },
{ "t2-percent", Element::real },
{ "metadata", Element::map }
{ "valid-lifetime", Element::integer },
{ "min-valid-lifetime", Element::integer },
{ "max-valid-lifetime", Element::integer },
{ "renew-timer", Element::integer },
{ "rebind-timer", Element::integer },
{ "option-data", Element::list },
{ "pools", Element::list },
{ "subnet", Element::string },
{ "interface", Element::string },
{ "id", Element::integer },
{ "client-class", Element::string },
{ "require-client-classes", Element::list },
{ "reservations", Element::list },
{ "reservation-mode", Element::string },
{ "relay", Element::map },
{ "match-client-id", Element::boolean },
{ "authoritative", Element::boolean },
{ "next-server", Element::string },
{ "server-hostname", Element::string },
{ "boot-file-name", Element::string },
{ "4o6-interface", Element::string },
{ "4o6-interface-id", Element::string },
{ "4o6-subnet", Element::string },
{ "user-context", Element::map },
{ "comment", Element::string },
{ "calculate-tee-times", Element::boolean },
{ "t1-percent", Element::real },
{ "t2-percent", Element::real },
{ "ddns-send-updates", Element::boolean },
{ "ddns-override-no-update", Element::boolean },
{ "ddns-override-client-update", Element::boolean },
{ "ddns-replace-client-name", Element::string },
{ "ddns-generated-prefix", Element::string },
{ "ddns-qualifying-suffix", Element::string },
{ "metadata", Element::map },
};
/// @brief This table defines default values for each IPv4 subnet.
......@@ -263,7 +269,13 @@ const ParamsList SimpleParser4::INHERIT_TO_SUBNET4 = {
"max-valid-lifetime",
"calculate-tee-times",
"t1-percent",
"t2-percent"
"t2-percent",
"ddns-send-updates",
"ddns-override-no-update",
"ddns-override-client-update",
"ddns-replace-client-name",
"ddns-generated-prefix",
"ddns-qualifying-suffix"
};
/// @brief This table defines all pool parameters.
......@@ -287,30 +299,36 @@ const SimpleKeywords SimpleParser4::POOL4_PARAMETERS = {
/// list and map types for entries.
/// Order follows shared_network_param rule in bison grammar.
const SimpleKeywords SimpleParser4::SHARED_NETWORK4_PARAMETERS = {
{ "name", Element::string },
{ "subnet4", Element::list },
{ "interface", Element::string },
{ "renew-timer", Element::integer },
{ "rebind-timer", Element::integer },
{ "option-data", Element::list },
{ "match-client-id", Element::boolean },
{ "authoritative", Element::boolean },
{ "next-server", Element::string },
{ "server-hostname", Element::string },
{ "boot-file-name", Element::string },
{ "relay", Element::map },
{ "reservation-mode", Element::string },
{ "client-class", Element::string },
{ "require-client-classes", Element::list },
{ "valid-lifetime", Element::integer },
{ "min-valid-lifetime", Element::integer },
{ "max-valid-lifetime", Element::integer },
{ "user-context", Element::map },
{ "comment", Element::string },
{ "calculate-tee-times", Element::boolean },
{ "t1-percent", Element::real },
{ "t2-percent", Element::real },
{ "metadata", Element::map }
{ "name", Element::string },
{ "subnet4", Element::list },
{ "interface", Element::string },
{ "renew-timer", Element::integer },
{ "rebind-timer", Element::integer },
{ "option-data", Element::list },
{ "match-client-id", Element::boolean },
{ "authoritative", Element::boolean },
{ "next-server", Element::string },
{ "server-hostname", Element::string },
{ "boot-file-name", Element::string },
{ "relay", Element::map },
{ "reservation-mode", Element::string },
{ "client-class", Element::string },
{ "require-client-classes", Element::list },
{ "valid-lifetime", Element::integer },
{ "min-valid-lifetime", Element::integer },
{ "max-valid-lifetime", Element::integer },
{ "user-context", Element::map },
{ "comment", Element::string },
{ "calculate-tee-times", Element::boolean },
{ "t1-percent", Element::real },
{ "t2-percent", Element::real },
{ "ddns-send-updates", Element::boolean },
{ "ddns-override-no-update", Element::boolean },
{ "ddns-override-client-update", Element::boolean },
{ "ddns-replace-client-name", Element::string },
{ "ddns-generated-prefix", Element::string },
{ "ddns-qualifying-suffix", Element::string },
{ "metadata", Element::map },
};
/// @brief This table defines default values for each IPv4 shared network.
......
......@@ -76,7 +76,13 @@ const SimpleKeywords SimpleParser6::GLOBAL6_PARAMETERS = {
{ "t2-percent", Element::real },
{ "loggers", Element::list },
{ "hostname-char-set", Element::string },
{ "hostname-char-replacement", Element::string }
{ "hostname-char-replacement", Element::string },
{ "ddns-send-updates", Element::boolean },
{ "ddns-override-no-update", Element::boolean },
{ "ddns-override-client-update", Element::boolean },
{ "ddns-replace-client-name", Element::string },
{ "ddns-generated-prefix", Element::string },
{ "ddns-qualifying-suffix", Element::string }
};
/// @brief This table defines default global values for DHCPv6
......@@ -85,15 +91,22 @@ const SimpleKeywords SimpleParser6::GLOBAL6_PARAMETERS = {
/// in Dhcp6) are optional. If not defined, the following values will be
/// used.
const SimpleDefaults SimpleParser6::GLOBAL6_DEFAULTS = {
{ "preferred-lifetime", Element::integer, "3600" },
{ "valid-lifetime", Element::integer, "7200" },
{ "decline-probation-period", Element::integer, "86400" }, // 24h
{ "dhcp4o6-port", Element::integer, "0" },
{ "server-tag", Element::string, "" },
{ "reservation-mode", Element::string, "all" },
{ "calculate-tee-times", Element::boolean, "true" },
{ "t1-percent", Element::real, ".50" },
{ "t2-percent", Element::real, ".80" }
{ "preferred-lifetime", Element::integer, "3600" },
{ "valid-lifetime", Element::integer, "7200" },
{ "decline-probation-period", Element::integer, "86400" }, // 24h
{ "dhcp4o6-port", Element::integer, "0" },
{ "server-tag", Element::string, "" },
{ "reservation-mode", Element::string, "all" },
{ "calculate-tee-times", Element::boolean, "true" },
{ "t1-percent", Element::real, ".50" },
{ "t2-percent", Element::real, ".80" },
{ "ddns-send-updates", Element::boolean, "false" },
{ "ddns-override-no-update", Element::boolean, "false" },
{ "ddns-override-client-update", Element::boolean, "false" },
{ "ddns-replace-client-name", Element::string, "never" },
{ "ddns-generated-prefix", Element::string, "myhost" },
// TKM should this still be true? qualifying-suffix has no default ??
{ "ddns-generated-suffix", Element::string, "" }
};
/// @brief This table defines all option definition parameters.
......@@ -159,33 +172,39 @@ const SimpleDefaults SimpleParser6::OPTION6_DEFAULTS = {
/// list and map types for entries.
/// Order follows subnet6_param rule in bison grammar.
const SimpleKeywords SimpleParser6::SUBNET6_PARAMETERS = {
{ "preferred-lifetime", Element::integer },
{ "min-preferred-lifetime", Element::integer },
{ "max-preferred-lifetime", Element::integer },
{ "valid-lifetime", Element::integer },
{ "min-valid-lifetime", Element::integer },
{ "max-valid-lifetime", Element::integer },
{ "renew-timer", Element::integer },
{ "rebind-timer", Element::integer },
{ "option-data", Element::list },
{ "pools", Element::list },
{ "pd-pools", Element::list },
{ "subnet", Element::string },
{ "interface", Element::string },
{ "interface-id", Element::string },
{ "id", Element::integer },
{ "rapid-commit", Element::boolean },
{ "client-class", Element::string },
{ "require-client-classes", Element::list },
{ "reservations", Element::list },
{ "reservation-mode", Element::string },
{ "relay", Element::map },
{ "user-context", Element::map },
{ "comment", Element::string },
{ "calculate-tee-times", Element::boolean },
{ "t1-percent", Element::real },
{ "t2-percent", Element::real },
{ "metadata", Element::map }
{ "preferred-lifetime", Element::integer },
{ "min-preferred-lifetime", Element::integer },
{ "max-preferred-lifetime", Element::integer },
{ "valid-lifetime", Element::integer },
{ "min-valid-lifetime", Element::integer },
{ "max-valid-lifetime", Element::integer },
{ "renew-timer", Element::integer },
{ "rebind-timer", Element::integer },
{ "option-data", Element::list },
{ "pools", Element::list },
{ "pd-pools", Element::list },
{ "subnet", Element::string },
{ "interface", Element::string },
{ "interface-id", Element::string },
{ "id", Element::integer },
{ "rapid-commit", Element::boolean },
{ "client-class", Element::string },
{ "require-client-classes", Element::list },
{ "reservations", Element::list },
{ "reservation-mode", Element::string },
{ "relay", Element::map },
{ "user-context", Element::map },
{ "comment", Element::string },
{ "calculate-tee-times", Element::boolean },
{ "t1-percent", Element::real },
{ "t2-percent", Element::real },
{ "ddns-send-updates", Element::boolean },
{ "ddns-override-no-update", Element::boolean },
{ "ddns-override-client-update", Element::boolean },
{ "ddns-replace-client-name", Element::string },
{ "ddns-generated-prefix", Element::string },
{ "ddns-qualifying-suffix", Element::string },
{ "metadata", Element::map }
};
/// @brief This table defines default values for each IPv6 subnet.
......@@ -231,7 +250,13 @@ const ParamsList SimpleParser6::INHERIT_TO_SUBNET6 = {
"max-valid-lifetime",
"calculate-tee-times",
"t1-percent",
"t2-percent"
"t2-percent",
"ddns-send-updates",
"ddns-override-no-update",
"ddns-override-client-update",
"ddns-replace-client-name",
"ddns-generated-prefix",
"ddns-qualifying-suffix"
};
/// @brief This table defines all pool parameters.
......@@ -274,30 +299,36 @@ const SimpleKeywords SimpleParser6::PD_POOL6_PARAMETERS = {
/// list and map types for entries.
/// Order follows shared_network_param rule in bison grammar.
const SimpleKeywords SimpleParser6::SHARED_NETWORK6_PARAMETERS = {
{ "name", Element::string },
{ "subnet6", Element::list },
{ "interface", Element::string },
{ "interface-id", Element::string },
{ "renew-timer", Element::integer },
{ "rebind-timer", Element::integer },
{ "option-data", Element::list },
{ "relay", Element::map },
{ "reservation-mode", Element::string },
{ "client-class", Element::string },
{ "require-client-classes", Element::list },
{ "preferred-lifetime", Element::integer },
{ "min-preferred-lifetime", Element::integer },
{ "max-preferred-lifetime", Element::integer },
{ "rapid-commit", Element::boolean },
{ "valid-lifetime", Element::integer },
{ "min-valid-lifetime", Element::integer },
{ "max-valid-lifetime", Element::integer },
{ "user-context", Element::map },
{ "comment", Element::string },
{ "calculate-tee-times", Element::boolean },
{ "t1-percent", Element::real },
{ "t2-percent", Element::real },
{ "metadata", Element::map }
{ "name", Element::string },
{ "subnet6", Element::list },
{ "interface", Element::string },
{ "interface-id", Element::string },
{ "renew-timer", Element::integer },
{ "rebind-timer", Element::integer },
{ "option-data", Element::list },
{ "relay", Element::map },
{ "reservation-mode", Element::string },
{ "client-class", Element::string },
{ "require-client-classes", Element::list },
{ "preferred-lifetime", Element::integer },
{ "min-preferred-lifetime", Element::integer },
{ "max-preferred-lifetime", Element::integer },
{ "rapid-commit", Element::boolean },
{ "valid-lifetime", Element::integer },
{ "min-valid-lifetime", Element::integer },
{ "max-valid-lifetime", Element::integer },
{ "user-context", Element::map },
{ "comment", Element::string },
{ "calculate-tee-times", Element::boolean },
{ "t1-percent", Element::real },
{ "t2-percent", Element::real },
{ "ddns-send-updates", Element::boolean },
{ "ddns-override-no-update", Element::boolean },
{ "ddns-override-client-update", Element::boolean },
{ "ddns-replace-client-name", Element::string },
{ "ddns-generated-prefix", Element::string },
{ "ddns-qualifying-suffix", Element::string },
{ "metadata", Element::map }
};
/// @brief This table defines default values for each IPv6 subnet.
......
......@@ -192,17 +192,25 @@ TEST(CfgSharedNetworks4Test, unparse) {
SharedNetwork4Ptr network1(new SharedNetwork4("frog"));
SharedNetwork4Ptr network2(new SharedNetwork4("dog"));
SharedNetwork4Ptr network3(new SharedNetwork4("cat"));
network1->setIface("eth0");