Commit 4f57cfa2 authored by Thomas Markwalder's avatar Thomas Markwalder

[#35,!517] Removed DDNS params from D2ClientCfg and tests

src/lib/dhcpsrv/d2_client_cfg.*
    D2ClientConfig - removed DDNS params

src/lib/dhcpsrv/parsers/dhcp_parsers.cc
    D2ClientConfigParser::parse() - removed DDNS params

src/lib/dhcpsrv/parsers/simple_parser4.cc
    SimpleParser4::GLOBAL4_PARAMETERS
    SimpleDefaults SimpleParser4::GLOBAL4_DEFAULTS
    - added DDSN params

src/lib/dhcpsrv/tests/cfgmgr_unittest.cc
    Updated calls to D2ClientCfg ctor

src/lib/dhcpsrv/tests/d2_client_unittest.cc
    Removed DDNS and hostname params from tests

src/lib/dhcpsrv/tests/d2_udp_unittest.cc
    Updated calls to D2ClientCfg ctor

src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
    Removed DDNS and hostname params from tests
parent b767f944
......@@ -90,14 +90,7 @@ D2ClientConfig::D2ClientConfig(const bool enable_updates,
const dhcp_ddns::
NameChangeProtocol& ncr_protocol,
const dhcp_ddns::
NameChangeFormat& ncr_format,
const bool override_no_update,
const bool override_client_update,
const ReplaceClientNameMode replace_client_name_mode,
const std::string& generated_prefix,
const std::string& qualifying_suffix,
Optional<std::string> hostname_char_set,
Optional<std::string> hostname_char_replacement)
NameChangeFormat& ncr_format)
: enable_updates_(enable_updates),
server_ip_(server_ip),
server_port_(server_port),
......@@ -105,16 +98,7 @@ D2ClientConfig::D2ClientConfig(const bool enable_updates,
sender_port_(sender_port),
max_queue_size_(max_queue_size),
ncr_protocol_(ncr_protocol),
ncr_format_(ncr_format),
override_no_update_(override_no_update),
override_client_update_(override_client_update),
replace_client_name_mode_(replace_client_name_mode),
generated_prefix_(generated_prefix),
qualifying_suffix_(qualifying_suffix),
hostname_char_set_(hostname_char_set),
hostname_char_replacement_(hostname_char_replacement),
hostname_sanitizer_(0),
fetch_globals_fn_(0) {
ncr_format_(ncr_format) {
validateContents();
}
......@@ -126,16 +110,7 @@ D2ClientConfig::D2ClientConfig()
sender_port_(DFT_SENDER_PORT),
max_queue_size_(DFT_MAX_QUEUE_SIZE),
ncr_protocol_(dhcp_ddns::stringToNcrProtocol(DFT_NCR_PROTOCOL)),
ncr_format_(dhcp_ddns::stringToNcrFormat(DFT_NCR_FORMAT)),
override_no_update_(DFT_OVERRIDE_NO_UPDATE),
override_client_update_(DFT_OVERRIDE_CLIENT_UPDATE),
replace_client_name_mode_(stringToReplaceClientNameMode(DFT_REPLACE_CLIENT_NAME_MODE)),
generated_prefix_(DFT_GENERATED_PREFIX),
qualifying_suffix_(""),
hostname_char_set_(DFT_HOSTNAME_CHAR_SET, true),
hostname_char_replacement_(DFT_HOSTNAME_CHAR_SET, true),
hostname_sanitizer_(0),
fetch_globals_fn_(0) {
ncr_format_(dhcp_ddns::stringToNcrFormat(DFT_NCR_FORMAT)) {
validateContents();
}
......@@ -174,16 +149,6 @@ D2ClientConfig::validateContents() {
<< server_ip_.toText() << "/" << server_port_);
}
if (!getHostnameCharSet().unspecified() && !getHostnameCharSet().empty()) {
try {
hostname_sanitizer_.reset(new isc::util::str::StringSanitizer(getHostnameCharSet(),
getHostnameCharReplacement()));
} catch (const std::exception& ex) {
isc_throw(D2ClientError, "D2ClientConfig: hostname-char-set"
" is not a valid regular expression");
}
}
/// @todo perhaps more validation we should do yet?
/// Are there any invalid combinations of options we need to test against?
}
......@@ -197,14 +162,7 @@ D2ClientConfig::operator == (const D2ClientConfig& other) const {
(sender_port_ == other.sender_port_) &&
(max_queue_size_ == other.max_queue_size_) &&
(ncr_protocol_ == other.ncr_protocol_) &&
(ncr_format_ == other.ncr_format_) &&
(override_no_update_ == other.override_no_update_) &&
(override_client_update_ == other.override_client_update_) &&
(replace_client_name_mode_ == other.replace_client_name_mode_) &&
(generated_prefix_ == other.generated_prefix_) &&
(qualifying_suffix_ == other.qualifying_suffix_) &&
(hostname_char_set_ == other.hostname_char_set_) &&
(hostname_char_replacement_ == other.hostname_char_replacement_));
(ncr_format_ == other.ncr_format_));
}
bool
......@@ -224,19 +182,10 @@ D2ClientConfig::toText() const {
<< ", sender-port: " << sender_port_
<< ", max-queue-size: " << max_queue_size_
<< ", ncr-protocol: " << ncrProtocolToString(ncr_protocol_)
<< ", ncr-format: " << ncrFormatToString(ncr_format_)
<< ", override-no-update: " << (override_no_update_ ?
"yes" : "no")
<< ", override-client-update: " << (override_client_update_ ?
"yes" : "no")
<< ", replace-client-name: "
<< replaceClientNameModeToString(replace_client_name_mode_)
<< ", generated-prefix: [" << generated_prefix_ << "]"
<< ", qualifying-suffix: [" << qualifying_suffix_ << "]"
<< ", hostname-char-set: [" << getHostnameCharSet() << "]"
<< ", hostname-char-replacement: [" << getHostnameCharReplacement() << "]";
<< ", ncr-format: " << ncrFormatToString(ncr_format_);
}
return (stream.str());
}
......@@ -247,8 +196,6 @@ D2ClientConfig::toElement() const {
contextToElement(result);
// Set enable-updates
result->set("enable-updates", Element::create(enable_updates_));
// Set qualifying-suffix
result->set("qualifying-suffix", Element::create(qualifying_suffix_));
// Set server-ip
result->set("server-ip", Element::create(server_ip_.toText()));
// Set server-port
......@@ -264,22 +211,6 @@ D2ClientConfig::toElement() const {
// Set ncr-format
result->set("ncr-format", Element::create(dhcp_ddns::ncrFormatToString(ncr_format_)));
// Set override-no-update
result->set("override-no-update", Element::create(override_no_update_));
// Set override-client-update
result->set("override-client-update", Element::create(override_client_update_));
// Set replace-client-name
result->set("replace-client-name",
Element::create(replaceClientNameModeToString(replace_client_name_mode_)));
// Set generated-prefix
result->set("generated-prefix", Element::create(generated_prefix_));
// Set hostname-char-set
if (!hostname_char_set_.unspecified()) {
result->set("hostname-char-set", Element::create(hostname_char_set_));
}
// Set hostname-char-replacement
if (!hostname_char_replacement_.unspecified()) {
result->set("hostname-char-replacement", Element::create(hostname_char_replacement_));
}
return (result);
}
......
......@@ -92,21 +92,7 @@ public:
/// Currently only UDP is supported.
/// @param ncr_format Format of the kea-dhcp-ddns requests.
/// Currently only JSON format is supported.
/// @param override_no_update Enables updates, even if clients request no
/// updates.
/// @param override_client_update Perform updates, even if client requested
/// delegation.
/// @param replace_client_name_mode enables replacement of the domain-name
/// supplied by the client with a generated name.
/// @param generated_prefix Prefix to use when generating domain-names.
/// @param qualifying_suffix Suffix to use to qualify partial domain-names.
/// @param hostname_char_set regular expression string which describes invalid
/// characters to be scrubbed from client host names
/// @param hostname_char_replacement string of zero or more characters to
/// replace invalid chars when sanitizing client host names
///
/// @c enable_updates is mandatory, @c qualifying_suffix is mandatory
/// when updates are enabled, other parameters are optional.
/// @c enable_updates is mandatory, other parameters are optional.
///
/// @throw D2ClientError if given an invalid protocol or format.
D2ClientConfig(const bool enable_updates,
......@@ -116,15 +102,7 @@ public:
const size_t sender_port,
const size_t max_queue_size,
const dhcp_ddns::NameChangeProtocol& ncr_protocol,
const dhcp_ddns::NameChangeFormat& ncr_format,
const bool override_no_update,
const bool override_client_update,
const ReplaceClientNameMode replace_client_name_mode,
const std::string& generated_prefix,
const std::string& qualifying_suffix,
util::Optional<std::string> hostname_char_set,
util::Optional<std::string> hostname_char_replacement);
const dhcp_ddns::NameChangeFormat& ncr_format);
/// @brief Default constructor
/// The default constructor creates an instance that has updates disabled.
......@@ -173,85 +151,6 @@ public:
return(ncr_format_);
}
/// @brief Return if updates are done even if clients request no updates.
bool getOverrideNoUpdate() const {
return(override_no_update_);
}
/// @brief Return if updates are done even when clients request delegation.
bool getOverrideClientUpdate() const {
return(override_client_update_);
}
/// @brief Return mode of replacement to use regarding client's client's domain-name
ReplaceClientNameMode getReplaceClientNameMode() const {
return(replace_client_name_mode_);
}
/// @brief Return the prefix to use when generating domain-names.
const std::string& getGeneratedPrefix() const {
return(generated_prefix_);
}
/// @brief Return the suffix to use to qualify partial domain-names.
const std::string& getQualifyingSuffix() const {
return(qualifying_suffix_);
}
/// @brief Return the char set regexp used to sanitize client hostnames.
util::Optional<std::string> getHostnameCharSet() const {
if (hostname_char_set_.unspecified() && fetch_globals_fn_) {
data::ConstElementPtr globals = fetch_globals_fn_();
if (globals && (globals->getType() == data::Element::map)) {
data::ConstElementPtr global_param =
globals->get("hostname-char-set");
if (global_param) {
return (global_param->stringValue());
}
}
}
return (hostname_char_set_);
}
/// @brief Return the invalid char replacement used to sanitize client hostnames.
util::Optional<std::string> getHostnameCharReplacement() const {
if (hostname_char_replacement_.unspecified() && fetch_globals_fn_) {
data::ConstElementPtr globals = fetch_globals_fn_();
if (globals && (globals->getType() == data::Element::map)) {
data::ConstElementPtr global_param =
globals->get("hostname-char-replacement");
if (global_param) {
return (global_param->stringValue());
}
}
}
return (hostname_char_replacement_);
}
/// @brief Return pointer to compiled regular expression string sanitizer
/// Will be empty if hostname-char-set is empty.
util::str::StringSanitizerPtr getHostnameSanitizer() const {
return(hostname_sanitizer_);
}
/// @brief Sets the optional callback function used to fetch globally
/// configured parameters.
///
/// @param fetch_globals_fn Pointer to the function.
void setFetchGlobalsFn(FetchNetworkGlobalsFn fetch_globals_fn) {
fetch_globals_fn_ = fetch_globals_fn;
}
/// @brief Checks if the D2 client config is associated with a function
/// used to fetch globally configured parameters.
///
/// @return true if it is associated, false otherwise.
bool hasFetchGlobalsFn() const {
return (static_cast<bool>(fetch_globals_fn_));
}
/// @brief Compares two D2ClientConfigs for equality
bool operator == (const D2ClientConfig& other) const;
......@@ -330,37 +229,6 @@ private:
/// @brief Format of the kea-dhcp-ddns requests.
/// Currently only JSON format is supported.
dhcp_ddns::NameChangeFormat ncr_format_;
/// @brief Should Kea perform updates, even if client requested no updates.
/// Overrides the client request for no updates via the N flag.
bool override_no_update_;
/// @brief Should Kea perform updates, even if client requested delegation.
bool override_client_update_;
/// @brief How Kea should handle the domain-name supplied by the client.
ReplaceClientNameMode replace_client_name_mode_;
/// @brief Prefix Kea should use when generating domain-names.
std::string generated_prefix_;
/// @brief Suffix Kea should use when to qualify partial domain-names.
std::string qualifying_suffix_;
/// @brief Regular expression describing invalid characters for client hostnames.
/// If empty, host name scrubbing is not done.
util::Optional<std::string> hostname_char_set_;
/// @brief A string to replace invalid characters when scrubbing hostnames.
/// Meaningful only if hostname_char_set_ is not empty.
util::Optional<std::string> hostname_char_replacement_;
/// @brief Pointer to compiled regular expression string sanitizer
util::str::StringSanitizerPtr hostname_sanitizer_;
/// @brief Pointer to the optional callback used to fetch globally
/// configured parameters inherited to the @c D2ClientConfig object.
FetchNetworkGlobalsFn fetch_globals_fn_;
};
std::ostream&
......
......@@ -1415,39 +1415,6 @@ D2ClientConfigParser::parse(isc::data::ConstElementPtr client_config) {
dhcp_ddns::NameChangeFormat ncr_format =
getFormat(client_config, "ncr-format");
bool override_no_update =
getBoolean(client_config, "override-no-update");
bool override_client_update =
getBoolean(client_config, "override-client-update");
D2ClientConfig::ReplaceClientNameMode replace_client_name_mode =
getMode(client_config, "replace-client-name");
std::string generated_prefix =
getString(client_config, "generated-prefix");
Optional<std::string> hostname_char_set(D2ClientConfig::DFT_HOSTNAME_CHAR_SET, true);
if (client_config->contains("hostname-char-set")) {
hostname_char_set = getString(client_config, "hostname-char-set");
}
Optional<std::string> hostname_char_replacement(D2ClientConfig::DFT_HOSTNAME_CHAR_REPLACEMENT, true);
if (client_config->contains("hostname-char-replacement")) {
hostname_char_replacement =
getString(client_config, "hostname-char-replacement");
}
// qualifying-suffix is the only parameter which has no default
std::string qualifying_suffix = "";
#if 0
bool found_qualifying_suffix = false;
if (client_config->contains("qualifying-suffix")) {
qualifying_suffix = getString(client_config, "qualifying-suffix");
found_qualifying_suffix = true;
}
#endif
IOAddress sender_ip(0);
if (sender_ip_str.empty()) {
// The default sender IP depends on the server IP family
......@@ -1463,16 +1430,6 @@ D2ClientConfigParser::parse(isc::data::ConstElementPtr client_config) {
}
}
#if 0
// Qualifying-suffix is required when updates are enabled
if (enable_updates && !found_qualifying_suffix) {
isc_throw(DhcpConfigError,
"parameter 'qualifying-suffix' is required when "
"updates are enabled ("
<< client_config->getPosition() << ")");
}
#endif
// Now we check for logical errors. This repeats what is done in
// D2ClientConfig::validate(), but doing it here permits us to
// emit meaningful parameter position info in the error.
......@@ -1517,14 +1474,7 @@ D2ClientConfigParser::parse(isc::data::ConstElementPtr client_config) {
sender_port,
max_queue_size,
ncr_protocol,
ncr_format,
override_no_update,
override_client_update,
replace_client_name_mode,
generated_prefix,
qualifying_suffix,
hostname_char_set,
hostname_char_replacement));
ncr_format));
} catch (const std::exception& ex) {
isc_throw(DhcpConfigError, ex.what() << " ("
<< client_config->getPosition() << ")");
......@@ -1536,13 +1486,6 @@ D2ClientConfigParser::parse(isc::data::ConstElementPtr client_config) {
new_config->setContext(user_context);
}
// In order to take advantage of the dynamic inheritance of global
// parameters to a subnet we need to set a callback function for
// the d2 client config to allow for fetching global parameters.
new_config->setFetchGlobalsFn([]() -> ConstElementPtr {
return (CfgMgr::instance().getStagingCfg()->getConfiguredGlobals());
});
return(new_config);
}
......@@ -1557,13 +1500,7 @@ const SimpleDefaults D2ClientConfigParser::D2_CLIENT_CONFIG_DEFAULTS = {
{ "sender-port", Element::integer, "0" },
{ "max-queue-size", Element::integer, "1024" },
{ "ncr-protocol", Element::string, "UDP" },
{ "ncr-format", Element::string, "JSON" },
{ "override-no-update", Element::boolean, "false" },
{ "override-client-update", Element::boolean, "false" },
{ "replace-client-name", Element::string, "never" },
{ "generated-prefix", Element::string, "myhost" }
// hostname-char-set and hostname-char-replacement moved to global
// qualifying-suffix has no default
{ "ncr-format", Element::string, "JSON" }
};
size_t
......
......@@ -75,6 +75,12 @@ const SimpleKeywords SimpleParser4::GLOBAL4_PARAMETERS = {
{ "t1-percent", Element::real },
{ "t2-percent", Element::real },
{ "loggers", Element::list },
{ "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 }
};
......@@ -85,20 +91,27 @@ const SimpleKeywords SimpleParser4::GLOBAL4_PARAMETERS = {
/// in Dhcp4) are optional. If not defined, the following values will be
/// used.
const SimpleDefaults SimpleParser4::GLOBAL4_DEFAULTS = {
{ "valid-lifetime", Element::integer, "7200" },
{ "decline-probation-period", Element::integer, "86400" }, // 24h
{ "dhcp4o6-port", Element::integer, "0" },
{ "echo-client-id", Element::boolean, "true" },
{ "match-client-id", Element::boolean, "true" },
{ "authoritative", Element::boolean, "false" },
{ "next-server", Element::string, "0.0.0.0" },
{ "server-hostname", Element::string, "" },
{ "boot-file-name", Element::string, "" },
{ "server-tag", Element::string, "" },
{ "reservation-mode", Element::string, "all" },
{ "calculate-tee-times", Element::boolean, "false" },
{ "t1-percent", Element::real, ".50" },
{ "t2-percent", Element::real, ".875" }
{ "valid-lifetime", Element::integer, "7200" },
{ "decline-probation-period", Element::integer, "86400" }, // 24h
{ "dhcp4o6-port", Element::integer, "0" },
{ "echo-client-id", Element::boolean, "true" },
{ "match-client-id", Element::boolean, "true" },
{ "authoritative", Element::boolean, "false" },
{ "next-server", Element::string, "0.0.0.0" },
{ "server-hostname", Element::string, "" },
{ "boot-file-name", Element::string, "" },
{ "server-tag", Element::string, "" },
{ "reservation-mode", Element::string, "all" },
{ "calculate-tee-times", Element::boolean, "false" },
{ "t1-percent", Element::real, ".50" },
{ "t2-percent", Element::real, ".875" },
{ "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.
......
......@@ -405,9 +405,7 @@ TEST_F(CfgMgrTest, d2ClientConfig) {
isc::asiolink::IOAddress("127.0.0.1"), 477,
isc::asiolink::IOAddress("127.0.0.1"), 478,
1024,
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON,
true, true, D2ClientConfig::RCM_ALWAYS,
"pre-fix", "suf-fix", "[^A-z]", "*")));
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON)));
// Verify that we can assign a new, non-empty configuration.
ASSERT_NO_THROW(CfgMgr::instance().setD2ClientConfig(new_cfg));
......
......@@ -95,14 +95,7 @@ TEST(D2ClientConfigTest, constructorsAndAccessors) {
sender_port,
max_queue_size,
ncr_protocol,
ncr_format,
override_no_update,
override_client_update,
replace_client_name_mode,
generated_prefix,
qualifying_suffix,
hostname_char_set,
hostname_char_replacement)));
ncr_format)));
ASSERT_TRUE(d2_client_config);
// Add user context
......@@ -120,19 +113,6 @@ TEST(D2ClientConfigTest, constructorsAndAccessors) {
EXPECT_EQ(d2_client_config->getMaxQueueSize(), max_queue_size);
EXPECT_EQ(d2_client_config->getNcrProtocol(), ncr_protocol);
EXPECT_EQ(d2_client_config->getNcrFormat(), ncr_format);
EXPECT_EQ(d2_client_config->getOverrideNoUpdate(), override_no_update);
EXPECT_EQ(d2_client_config->getOverrideClientUpdate(),
override_client_update);
EXPECT_EQ(d2_client_config->getReplaceClientNameMode(), replace_client_name_mode);
EXPECT_EQ(d2_client_config->getGeneratedPrefix(), generated_prefix);
EXPECT_EQ(d2_client_config->getQualifyingSuffix(), qualifying_suffix);
EXPECT_FALSE(d2_client_config->getHostnameCharSet().unspecified());
EXPECT_EQ(d2_client_config->getHostnameCharSet(), hostname_char_set);
EXPECT_FALSE(d2_client_config->getHostnameCharReplacement().unspecified());
EXPECT_EQ(d2_client_config->getHostnameCharReplacement(), hostname_char_replacement);
EXPECT_TRUE(d2_client_config->getHostnameSanitizer());
ASSERT_TRUE(d2_client_config->getContext());
EXPECT_EQ(d2_client_config->getContext()->str(), user_context);
......@@ -151,13 +131,6 @@ TEST(D2ClientConfigTest, constructorsAndAccessors) {
"\"max-queue-size\": 2048,\n"
"\"ncr-protocol\": \"UDP\",\n"
"\"ncr-format\": \"JSON\",\n"
"\"override-no-update\": true,\n"
"\"override-client-update\": true,\n"
"\"replace-client-name\": \"when-present\",\n"
"\"generated-prefix\": \"the_prefix\",\n"
"\"qualifying-suffix\": \"the.suffix.\",\n"
"\"hostname-char-set\": \"[^A-Z]\",\n"
"\"hostname-char-replacement\": \"*\",\n"
"\"user-context\": { \"foo\": 1 }\n"
"}\n";
runToElementTest<D2ClientConfig>(expected, *d2_client_config);
......@@ -172,14 +145,7 @@ TEST(D2ClientConfigTest, constructorsAndAccessors) {
sender_port,
max_queue_size,
dhcp_ddns::NCR_TCP,
ncr_format,
override_no_update,
override_client_update,
replace_client_name_mode,
generated_prefix,
qualifying_suffix,
hostname_char_set,
hostname_char_replacement)),
ncr_format)),
D2ClientError);
Optional<std::string> opt_hostname_char_set("", true);
......@@ -194,23 +160,9 @@ TEST(D2ClientConfigTest, constructorsAndAccessors) {
sender_port,
max_queue_size,
ncr_protocol,
ncr_format,
override_no_update,
override_client_update,
replace_client_name_mode,
generated_prefix,
qualifying_suffix,
opt_hostname_char_set,
opt_hostname_char_replacement)));
ncr_format)));
ASSERT_TRUE(d2_client_config);
// Verify that the accessors return the expected values.
EXPECT_TRUE(d2_client_config->getHostnameCharSet().unspecified());
EXPECT_EQ(d2_client_config->getHostnameCharSet(), opt_hostname_char_set);
EXPECT_TRUE(d2_client_config->getHostnameCharReplacement().unspecified());
EXPECT_EQ(d2_client_config->getHostnameCharReplacement(), opt_hostname_char_replacement);
EXPECT_FALSE(d2_client_config->getHostnameSanitizer());
// Verify what toElement returns.
expected = "{\n"
"\"enable-updates\": true,\n"
......@@ -220,12 +172,7 @@ TEST(D2ClientConfigTest, constructorsAndAccessors) {
"\"sender-port\": 478,\n"
"\"max-queue-size\": 2048,\n"
"\"ncr-protocol\": \"UDP\",\n"
"\"ncr-format\": \"JSON\",\n"
"\"override-no-update\": true,\n"
"\"override-client-update\": true,\n"
"\"replace-client-name\": \"when-present\",\n"
"\"generated-prefix\": \"the_prefix\",\n"
"\"qualifying-suffix\": \"the.suffix.\"\n"
"\"ncr-format\": \"JSON\"\n"
"}\n";
runToElementTest<D2ClientConfig>(expected, *d2_client_config);
......@@ -244,17 +191,13 @@ TEST(D2ClientConfigTest, equalityOperator) {
// Create an instance to use as a reference.
ASSERT_NO_THROW(ref_config.reset(new D2ClientConfig(true,
ref_address, 477, ref_address, 478, 1024,
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON,
true, true, D2ClientConfig::RCM_WHEN_PRESENT,
"pre-fix", "suf-fix", "[^A-Z]", "*")));
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON)));
ASSERT_TRUE(ref_config);
// Check a configuration that is identical to reference configuration.
ASSERT_NO_THROW(test_config.reset(new D2ClientConfig(true,
ref_address, 477, ref_address, 478, 1024,
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON,
true, true, D2ClientConfig::RCM_WHEN_PRESENT,
"pre-fix", "suf-fix", "[^A-Z]", "*")));
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON)));
ASSERT_TRUE(test_config);
EXPECT_TRUE(*ref_config == *test_config);
EXPECT_FALSE(*ref_config != *test_config);
......@@ -262,9 +205,7 @@ TEST(D2ClientConfigTest, equalityOperator) {
// Check a configuration that differs only by enable flag.
ASSERT_NO_THROW(test_config.reset(new D2ClientConfig(false,
ref_address, 477, ref_address, 478, 1024,
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON,
true, true, D2ClientConfig::RCM_WHEN_PRESENT,
"pre-fix", "suf-fix", "[^A-Z]", "*")));
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON)));
ASSERT_TRUE(test_config);
EXPECT_FALSE(*ref_config == *test_config);
EXPECT_TRUE(*ref_config != *test_config);
......@@ -272,9 +213,7 @@ TEST(D2ClientConfigTest, equalityOperator) {
// Check a configuration that differs only by server ip.
ASSERT_NO_THROW(test_config.reset(new D2ClientConfig(true,
test_address, 477, ref_address, 478, 1024,
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON,
true, true, D2ClientConfig::RCM_WHEN_PRESENT,
"pre-fix", "suf-fix", "[^A-Z]", "*")));
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON)));
ASSERT_TRUE(test_config);
EXPECT_FALSE(*ref_config == *test_config);
EXPECT_TRUE(*ref_config != *test_config);
......@@ -282,9 +221,7 @@ TEST(D2ClientConfigTest, equalityOperator) {
// Check a configuration that differs only by server port.
ASSERT_NO_THROW(test_config.reset(new D2ClientConfig(true,
ref_address, 333, ref_address, 478, 1024,
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON,
true, true, D2ClientConfig::RCM_WHEN_PRESENT,
"pre-fix", "suf-fix", "[^A-Z]", "*")));
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON)));
ASSERT_TRUE(test_config);
EXPECT_FALSE(*ref_config == *test_config);
EXPECT_TRUE(*ref_config != *test_config);
......@@ -292,9 +229,7 @@ TEST(D2ClientConfigTest, equalityOperator) {
// Check a configuration that differs only by sender ip.
ASSERT_NO_THROW(test_config.reset(new D2ClientConfig(true,
ref_address, 477, test_address, 478, 1024,
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON,
true, true, D2ClientConfig::RCM_WHEN_PRESENT,
"pre-fix", "suf-fix", "[^A-Z]", "*")));
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON)));
ASSERT_TRUE(test_config);
EXPECT_FALSE(*ref_config == *test_config);
EXPECT_TRUE(*ref_config != *test_config);
......@@ -302,9 +237,7 @@ TEST(D2ClientConfigTest, equalityOperator) {
// Check a configuration that differs only by sender port.
ASSERT_NO_THROW(test_config.reset(new D2ClientConfig(true,
ref_address, 477, ref_address, 333, 1024,
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON,
true, true, D2ClientConfig::RCM_WHEN_PRESENT,
"pre-fix", "suf-fix", "[^A-Z]", "*")));
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON)));
ASSERT_TRUE(test_config);
EXPECT_FALSE(*ref_config == *test_config);
EXPECT_TRUE(*ref_config != *test_config);
......@@ -312,79 +245,7 @@ TEST(D2ClientConfigTest, equalityOperator) {
// Check a configuration that differs only by max queue size.
ASSERT_NO_THROW(test_config.reset(new D2ClientConfig(true,
ref_address, 477, ref_address, 478, 2048,
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON,
true, true, D2ClientConfig::RCM_WHEN_PRESENT,
"pre-fix", "suf-fix", "[^A-Z]", "*")));
ASSERT_TRUE(test_config);
EXPECT_FALSE(*ref_config == *test_config);
EXPECT_TRUE(*ref_config != *test_config);
// Check a configuration that differs only by override_no_update.
ASSERT_NO_THROW(test_config.reset(new D2ClientConfig(true,
ref_address, 477, ref_address, 478, 1024,
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON,
false, true, D2ClientConfig::RCM_WHEN_PRESENT,
"pre-fix", "suf-fix", "[^A-Z]", "*")));
ASSERT_TRUE(test_config);
EXPECT_FALSE(*ref_config == *test_config);
EXPECT_TRUE(*ref_config != *test_config);
// Check a configuration that differs only by override_client_update.
ASSERT_NO_THROW(test_config.reset(new D2ClientConfig(true,
ref_address, 477, ref_address, 478, 1024,
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON,
true, false, D2ClientConfig::RCM_WHEN_PRESENT,
"pre-fix", "suf-fix", "[^A-Z]", "*")));
ASSERT_TRUE(test_config);
EXPECT_FALSE(*ref_config == *test_config);
EXPECT_TRUE(*ref_config != *test_config);
// Check a configuration that differs only by replace_client_name.
ASSERT_NO_THROW(test_config.reset(new D2ClientConfig(true,
ref_address, 477, ref_address, 478, 1024,
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON,
true, true, D2ClientConfig::RCM_NEVER,
"pre-fix", "suf-fix", "[^A-Z]", "*")));
ASSERT_TRUE(test_config);
EXPECT_FALSE(*ref_config == *test_config);
EXPECT_TRUE(*ref_config != *test_config);
// Check a configuration that differs only by generated_prefix.
ASSERT_NO_THROW(test_config.reset(new D2ClientConfig(true,
ref_address, 477, ref_address, 478, 1024,
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON,
true, true, D2ClientConfig::RCM_WHEN_PRESENT,
"bogus", "suf-fix", "[^A-Z]", "*")));
ASSERT_TRUE(test_config);
EXPECT_FALSE(*ref_config == *test_config);
EXPECT_TRUE(*ref_config != *test_config);
// Check a configuration that differs only by qualifying_suffix.
ASSERT_NO_THROW(test_config.reset(new D2ClientConfig(true,
ref_address, 477, ref_address, 478, 1024,
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON,
true, true, D2ClientConfig::RCM_WHEN_PRESENT,
"pre-fix", "bogus", "[^A-Z]", "*")));
ASSERT_TRUE(test_config);
EXPECT_FALSE(*ref_config == *test_config);
EXPECT_TRUE(*ref_config != *test_config);
// Check a configuration that differs only by hostname_char_set
ASSERT_NO_THROW(test_config.reset(new D2ClientConfig(true,
ref_address, 477, ref_address, 478, 1024,
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON,
true, true, D2ClientConfig::RCM_WHEN_PRESENT,
"pre-fix", "suf-fix", "[abc]", "*")));
ASSERT_TRUE(test_config);