Commit d80e28d3 authored by Thomas Markwalder's avatar Thomas Markwalder

[4259] Converted replace-client-name from boolean to enumeration

    The D2 client configuration parameter, replace-client-name, was
    changed from a boolean, to an enumerated list of modes:

        "NEVER" - do not alter or supply the client name
        "ALWAYS" - always replace the client name, or supply it if
         not sent by the client
        "WHEN_PRESENT" - replace the client name sent by the client,
         do not supply one otherwise
        "WHEN_NOT_PRESENT" - supply the client name only if one was
        not sent by the client

    src/lib/dhcpsrv/d2_client_cfg.cc
    src/lib/dhcpsrv/d2_client_cfg.h
        Added the D2ClientConfig::ReplaceClientNameMode enumeration.

    src/lib/dhcpsrv/parsers/dhcp_parsers.cc
        - Alter replace-client-name parsing to parse the mode labels.
        - Maps boolean literals true and false to RCM_WHEN_PRESENT and
        RCM_NEVER respectively

    src/bin/dhcp4/dhcp6_srv.cc
    src/bin/dhcp4/dhcp4_srv.cc
    src/lib/dhcpsrv/d2_client_mgr.h
        - Adapted to use the enumeration

    src/bin/dhcp4/tests/config_parser_unittest.cc
    src/bin/dhcp4/tests/fqdn_unittest.cc
    src/bin/dhcp6/tests/config_parser_unittest.cc
    src/bin/dhcp6/tests/fqdn_unittest.cc
    src/lib/dhcpsrv/tests/cfgmgr_unittest.cc
    src/lib/dhcpsrv/tests/d2_client_unittest.cc
    src/lib/dhcpsrv/tests/d2_udp_unittest.cc
    src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
        - Alter existing tests to use the enumeration. Note false was replaced
        with RCM_NEVER and true with RCM_WHEN_PRESENT
parent 849439da
......@@ -1196,8 +1196,8 @@ Dhcpv4Srv::processHostnameOption(Dhcpv4Exchange& ex) {
opt_hostname_resp->setValue(d2_mgr.qualifyName(ex.getContext()->host_->getHostname(),
false));
} else if ((d2_mgr.getD2ClientConfig()->getReplaceClientName()) ||
(label_count < 2)) {
} else if ((d2_mgr.getD2ClientConfig()->getReplaceClientNameMode()
!= D2ClientConfig::RCM_NEVER) || (label_count < 2)) {
// Set to root domain to signal later on that we should replace it.
// DHO_HOST_NAME is a string option which cannot be empty.
/// @todo We may want to reconsider whether it is appropriate for the
......
......@@ -3176,7 +3176,7 @@ TEST_F(Dhcp4ParserTest, d2ClientConfig) {
" \"allow-client-update\" : true, "
" \"override-no-update\" : true, "
" \"override-client-update\" : true, "
" \"replace-client-name\" : true, "
" \"replace-client-name\" : \"WHEN_PRESENT\", "
" \"generated-prefix\" : \"test.prefix\", "
" \"qualifying-suffix\" : \"test.suffix.\" },"
"\"valid-lifetime\": 4000 }";
......@@ -3210,7 +3210,7 @@ TEST_F(Dhcp4ParserTest, d2ClientConfig) {
EXPECT_TRUE(d2_client_config->getAlwaysIncludeFqdn());
EXPECT_TRUE(d2_client_config->getOverrideNoUpdate());
EXPECT_TRUE(d2_client_config->getOverrideClientUpdate());
EXPECT_TRUE(d2_client_config->getReplaceClientName());
EXPECT_EQ(D2ClientConfig::RCM_WHEN_PRESENT, d2_client_config->getReplaceClientNameMode());
EXPECT_EQ("test.prefix", d2_client_config->getGeneratedPrefix());
EXPECT_EQ("test.suffix.", d2_client_config->getQualifyingSuffix());
}
......@@ -3238,7 +3238,7 @@ TEST_F(Dhcp4ParserTest, invalidD2ClientConfig) {
" \"allow-client-update\" : true, "
" \"override-no-update\" : true, "
" \"override-client-update\" : true, "
" \"replace-client-name\" : true, "
" \"replace-client-name\" : \"WHEN_PRESENT\", "
" \"generated-prefix\" : \"test.prefix\", "
" \"qualifying-suffix\" : \"test.suffix.\" },"
"\"valid-lifetime\": 4000 }";
......
// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -172,7 +172,8 @@ public:
(mask & ALWAYS_INCLUDE_FQDN),
(mask & OVERRIDE_NO_UPDATE),
(mask & OVERRIDE_CLIENT_UPDATE),
(mask & REPLACE_CLIENT_NAME),
((mask & REPLACE_CLIENT_NAME) ?
D2ClientConfig::RCM_WHEN_PRESENT : D2ClientConfig::RCM_NEVER),
"myhost", "example.com")));
ASSERT_NO_THROW(CfgMgr::instance().setD2ClientConfig(cfg));
ASSERT_NO_THROW(srv_->startD2());
......
......@@ -3410,7 +3410,7 @@ TEST_F(Dhcp6ParserTest, d2ClientConfig) {
" \"allow-client-update\" : true, "
" \"override-no-update\" : true, "
" \"override-client-update\" : true, "
" \"replace-client-name\" : true, "
" \"replace-client-name\" : \"WHEN_PRESENT\", "
" \"generated-prefix\" : \"test.prefix\", "
" \"qualifying-suffix\" : \"test.suffix.\" },"
"\"valid-lifetime\": 4000 }";
......@@ -3444,7 +3444,7 @@ TEST_F(Dhcp6ParserTest, d2ClientConfig) {
EXPECT_TRUE(d2_client_config->getAlwaysIncludeFqdn());
EXPECT_TRUE(d2_client_config->getOverrideNoUpdate());
EXPECT_TRUE(d2_client_config->getOverrideClientUpdate());
EXPECT_TRUE(d2_client_config->getReplaceClientName());
EXPECT_EQ(D2ClientConfig::RCM_WHEN_PRESENT, d2_client_config->getReplaceClientNameMode());
EXPECT_EQ("test.prefix", d2_client_config->getGeneratedPrefix());
EXPECT_EQ("test.suffix.", d2_client_config->getQualifyingSuffix());
}
......@@ -3472,7 +3472,7 @@ TEST_F(Dhcp6ParserTest, invalidD2ClientConfig) {
" \"allow-client-update\" : true, "
" \"override-no-update\" : true, "
" \"override-client-update\" : true, "
" \"replace-client-name\" : true, "
" \"replace-client-name\" : \"WHEN_PRESENT\", "
" \"generated-prefix\" : \"test.prefix\", "
" \"qualifying-suffix\" : \"test.suffix.\" },"
"\"valid-lifetime\": 4000 }";
......
// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -112,7 +112,8 @@ public:
(mask & ALWAYS_INCLUDE_FQDN),
(mask & OVERRIDE_NO_UPDATE),
(mask & OVERRIDE_CLIENT_UPDATE),
(mask & REPLACE_CLIENT_NAME),
((mask & REPLACE_CLIENT_NAME) ? D2ClientConfig::RCM_WHEN_PRESENT
: D2ClientConfig::RCM_NEVER),
"myhost", "example.com")));
ASSERT_NO_THROW(CfgMgr::instance().setD2ClientConfig(cfg));
ASSERT_NO_THROW(srv_->startD2());
......@@ -731,7 +732,7 @@ TEST_F(FqdnDhcpv6SrvTest, createRemovalNameChangeRequestFwdRev) {
}
// Checks that calling queueNCR would not result in error if DDNS updates are
// disabled.
// disabled.
TEST_F(FqdnDhcpv6SrvTest, noRemovalsWhenDisabled) {
// Disable DDNS updates.
disableD2();
......
// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -10,6 +10,8 @@
#include <dhcpsrv/d2_client_cfg.h>
#include <dhcpsrv/dhcpsrv_log.h>
#include <boost/algorithm/string/predicate.hpp>
#include <string>
using namespace std;
......@@ -17,19 +19,60 @@ using namespace std;
namespace isc {
namespace dhcp {
const char *D2ClientConfig::DFT_SERVER_IP = "127.0.0.1";
const char* D2ClientConfig::DFT_SERVER_IP = "127.0.0.1";
const size_t D2ClientConfig::DFT_SERVER_PORT = 53001;
const char *D2ClientConfig::DFT_V4_SENDER_IP = "0.0.0.0";
const char *D2ClientConfig::DFT_V6_SENDER_IP = "::";
const char* D2ClientConfig::DFT_V4_SENDER_IP = "0.0.0.0";
const char* D2ClientConfig::DFT_V6_SENDER_IP = "::";
const size_t D2ClientConfig::DFT_SENDER_PORT = 0;
const size_t D2ClientConfig::DFT_MAX_QUEUE_SIZE = 1024;
const char *D2ClientConfig::DFT_NCR_PROTOCOL = "UDP";
const char *D2ClientConfig::DFT_NCR_FORMAT = "JSON";
const char* D2ClientConfig::DFT_NCR_PROTOCOL = "UDP";
const char* D2ClientConfig::DFT_NCR_FORMAT = "JSON";
const bool D2ClientConfig::DFT_ALWAYS_INCLUDE_FQDN = false;
const bool D2ClientConfig::DFT_OVERRIDE_NO_UPDATE = false;
const bool D2ClientConfig::DFT_OVERRIDE_CLIENT_UPDATE = false;
const bool D2ClientConfig::DFT_REPLACE_CLIENT_NAME = false;
const char *D2ClientConfig::DFT_GENERATED_PREFIX = "myhost";
const char* D2ClientConfig::DFT_REPLACE_CLIENT_NAME_MODE = "NEVER";
const char* D2ClientConfig::DFT_GENERATED_PREFIX = "myhost";
D2ClientConfig::ReplaceClientNameMode stringToReplaceClientNameMode(const std::string& mode_str) {
if (boost::iequals(mode_str, "NEVER")) {
return (D2ClientConfig::RCM_NEVER);
}
if (boost::iequals(mode_str, "ALWAYS")) {
return (D2ClientConfig::RCM_ALWAYS);
}
if (boost::iequals(mode_str, "WHEN_PRESENT")) {
return (D2ClientConfig::RCM_WHEN_PRESENT);
}
if (boost::iequals(mode_str, "WHEN_NOT_PRESENT")) {
return (D2ClientConfig::RCM_WHEN_NOT_PRESENT);
}
isc_throw(BadValue,
"Invalid ReplaceClientNameMode: " << mode_str);
}
std::string replaceClientNameModeToString(D2ClientConfig::ReplaceClientNameMode mode) {
switch (mode) {
case D2ClientConfig::RCM_NEVER:
return ("NEVER");
case D2ClientConfig::RCM_ALWAYS:
return ("ALWAYS");
case D2ClientConfig::RCM_WHEN_PRESENT:
return ("WHEN_PRESENT");
case D2ClientConfig::RCM_WHEN_NOT_PRESENT:
return ("WHEN_NOT_PRESENT");
default:
break;
}
std::ostringstream stream;
stream << "UNKNOWN(" << mode << ")";
return (stream.str());
}
D2ClientConfig::D2ClientConfig(const bool enable_updates,
const isc::asiolink::IOAddress& server_ip,
......@@ -44,7 +87,7 @@ D2ClientConfig::D2ClientConfig(const bool enable_updates,
const bool always_include_fqdn,
const bool override_no_update,
const bool override_client_update,
const bool replace_client_name,
const ReplaceClientNameMode replace_client_name_mode,
const std::string& generated_prefix,
const std::string& qualifying_suffix)
: enable_updates_(enable_updates),
......@@ -58,7 +101,7 @@ D2ClientConfig::D2ClientConfig(const bool enable_updates,
always_include_fqdn_(always_include_fqdn),
override_no_update_(override_no_update),
override_client_update_(override_client_update),
replace_client_name_(replace_client_name),
replace_client_name_mode_(replace_client_name_mode),
generated_prefix_(generated_prefix),
qualifying_suffix_(qualifying_suffix) {
validateContents();
......@@ -76,7 +119,7 @@ D2ClientConfig::D2ClientConfig()
always_include_fqdn_(DFT_ALWAYS_INCLUDE_FQDN),
override_no_update_(DFT_OVERRIDE_NO_UPDATE),
override_client_update_(DFT_OVERRIDE_CLIENT_UPDATE),
replace_client_name_(DFT_REPLACE_CLIENT_NAME),
replace_client_name_mode_(stringToReplaceClientNameMode(DFT_REPLACE_CLIENT_NAME_MODE)),
generated_prefix_(DFT_GENERATED_PREFIX),
qualifying_suffix_("") {
validateContents();
......@@ -134,7 +177,7 @@ D2ClientConfig::operator == (const D2ClientConfig& other) const {
(always_include_fqdn_ == other.always_include_fqdn_) &&
(override_no_update_ == other.override_no_update_) &&
(override_client_update_ == other.override_client_update_) &&
(replace_client_name_ == other.replace_client_name_) &&
(replace_client_name_mode_ == other.replace_client_name_mode_) &&
(generated_prefix_ == other.generated_prefix_) &&
(qualifying_suffix_ == other.qualifying_suffix_));
}
......@@ -155,16 +198,16 @@ D2ClientConfig::toText() const {
<< ", sender_ip: " << sender_ip_.toText()
<< ", sender_port: " << sender_port_
<< ", max_queue_size: " << max_queue_size_
<< ", ncr_protocol: " << ncr_protocol_
<< ", ncr_format: " << ncr_format_
<< ", ncr_protocol: " << ncrProtocolToString(ncr_protocol_)
<< ", ncr_format: " << ncrFormatToString(ncr_format_)
<< ", always_include_fqdn: " << (always_include_fqdn_ ?
"yes" : "no")
<< ", override_no_update: " << (override_no_update_ ?
"yes" : "no")
<< ", override_client_update: " << (override_client_update_ ?
"yes" : "no")
<< ", replace_client_name: " << (replace_client_name_ ?
"yes" : "no")
<< ", replace_client_name: "
<< replaceClientNameModeToString(replace_client_name_mode_)
<< ", generated_prefix: [" << generated_prefix_ << "]"
<< ", qualifying_suffix: [" << qualifying_suffix_ << "]";
}
......
// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -39,6 +39,7 @@ public:
: isc::Exception(file, line, what) {}
};
/// @brief Acts as a storage vault for D2 client configuration
///
/// A simple container class for storing and retrieving the configuration
......@@ -47,24 +48,30 @@ public:
///
class D2ClientConfig {
public:
/// @brief Default configuration constants.
/// @todo For now these are hard-coded as configuraiton layer cannot
/// readily provide them (see Trac #3358).
static const char *DFT_SERVER_IP;
static const char* DFT_SERVER_IP;
static const size_t DFT_SERVER_PORT;
static const char *DFT_V4_SENDER_IP;
static const char *DFT_V6_SENDER_IP;
static const char* DFT_V4_SENDER_IP;
static const char* DFT_V6_SENDER_IP;
static const size_t DFT_SENDER_PORT;
static const size_t DFT_MAX_QUEUE_SIZE;
static const char *DFT_NCR_PROTOCOL;
static const char *DFT_NCR_FORMAT;
static const char* DFT_NCR_PROTOCOL;
static const char* DFT_NCR_FORMAT;
static const bool DFT_ALWAYS_INCLUDE_FQDN;
static const bool DFT_OVERRIDE_NO_UPDATE;
static const bool DFT_OVERRIDE_CLIENT_UPDATE;
static const bool DFT_REPLACE_CLIENT_NAME;
static const char *DFT_GENERATED_PREFIX;
static const char* DFT_REPLACE_CLIENT_NAME_MODE;
static const char* DFT_GENERATED_PREFIX;
/// @brief Defines the client name replacement modes.
enum ReplaceClientNameMode {
RCM_NEVER,
RCM_ALWAYS,
RCM_WHEN_PRESENT,
RCM_WHEN_NOT_PRESENT
};
/// @brief Constructor
///
......@@ -84,7 +91,7 @@ public:
/// updates.
/// @param override_client_update Perform updates, even if client requested
/// delegation.
/// @param replace_client_name enables replacement of the domain-name
/// @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.
......@@ -104,7 +111,7 @@ public:
const bool always_include_fqdn,
const bool override_no_update,
const bool override_client_update,
const bool replace_client_name,
const ReplaceClientNameMode replace_client_name_mode,
const std::string& generated_prefix,
const std::string& qualifying_suffix);
......@@ -170,9 +177,9 @@ public:
return(override_client_update_);
}
/// @brief Return whether or not client's domain-name is always replaced.
bool getReplaceClientName() const {
return(replace_client_name_);
/// @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.
......@@ -248,8 +255,8 @@ private:
/// @brief Should Kea perform updates, even if client requested delegation.
bool override_client_update_;
/// @brief Should Kea replace the domain-name supplied by the client.
bool replace_client_name_;
/// @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_;
......@@ -261,6 +268,26 @@ private:
std::ostream&
operator<<(std::ostream& os, const D2ClientConfig& config);
/// @brief Function which converts labels to ReplaceClientNameMode enum values.
///
/// @param mode_str text to convert to an enum.
/// Valid string values: "NEVER", "ALWAYS", "WHEN_PRESENT", "WHEN_NOT_PRESENT"
///
/// @return NameChangeFormat value which maps to the given string.
///
/// @throw isc::BadValue if given a string value which does not map to an
/// enum value.
extern D2ClientConfig::ReplaceClientNameMode stringToReplaceClientNameMode(const std::string& mode_str);
/// @brief Function which converts NameChangeFormat enums to text labels.
///
/// @param mode enum value to convert to label
///
/// @return std:string containing the text label if the value is valid, or
/// "UNKNOWN" if not.
extern std::string replaceClientNameModeToString(D2ClientConfig::ReplaceClientNameMode mode);
/// @brief Defines a pointer for D2ClientConfig instances.
typedef boost::shared_ptr<D2ClientConfig> D2ClientConfigPtr;
......
// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -457,7 +457,7 @@ void
D2ClientMgr::adjustDomainName(const T& fqdn, T& fqdn_resp) {
// If we're configured to replace it or the supplied name is blank
// set the response name to blank.
if (d2_client_config_->getReplaceClientName() ||
if ((d2_client_config_->getReplaceClientNameMode() != D2ClientConfig::RCM_NEVER) ||
fqdn.getDomainName().empty()) {
fqdn_resp.setDomainName("", T::PARTIAL);
} else {
......
// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -1406,10 +1406,22 @@ D2ClientConfigParser::build(isc::data::ConstElementPtr client_config) {
D2ClientConfig::
DFT_OVERRIDE_CLIENT_UPDATE);
bool replace_client_name =
boolean_values_->getOptionalParam("replace-client-name",
D2ClientConfig::
DFT_REPLACE_CLIENT_NAME);
// Formerly, replace-client-name was boolean, so for now we'll support boolean
// values by mapping them to the appropriate mode
D2ClientConfig::ReplaceClientNameMode replace_client_name_mode;
std::string mode_str = string_values_->getOptionalParam("replace-client-name",
D2ClientConfig::
DFT_REPLACE_CLIENT_NAME_MODE);
if (boost::iequals(mode_str, "FALSE")) {
// @todo add a debug log
replace_client_name_mode = D2ClientConfig::RCM_NEVER;
}
else if (boost::iequals(mode_str, "TRUE")) {
// @todo add a debug log
replace_client_name_mode = D2ClientConfig::RCM_WHEN_PRESENT;
} else {
replace_client_name_mode = stringToReplaceClientNameMode(mode_str);
}
// Attempt to create the new client config.
local_client_config_.reset(new D2ClientConfig(enable_updates,
......@@ -1423,7 +1435,7 @@ D2ClientConfigParser::build(isc::data::ConstElementPtr client_config) {
always_include_fqdn,
override_no_update,
override_client_update,
replace_client_name,
replace_client_name_mode,
generated_prefix,
qualifying_suffix));
......@@ -1445,14 +1457,14 @@ D2ClientConfigParser::createConfigParser(const std::string& config_id) {
(config_id.compare("ncr-format") == 0) ||
(config_id.compare("generated-prefix") == 0) ||
(config_id.compare("sender-ip") == 0) ||
(config_id.compare("qualifying-suffix") == 0)) {
(config_id.compare("qualifying-suffix") == 0) ||
(config_id.compare("replace-client-name") == 0)) {
parser = new StringParser(config_id, string_values_);
} else if ((config_id.compare("enable-updates") == 0) ||
(config_id.compare("always-include-fqdn") == 0) ||
(config_id.compare("allow-client-update") == 0) ||
(config_id.compare("override-no-update") == 0) ||
(config_id.compare("override-client-update") == 0) ||
(config_id.compare("replace-client-name") == 0)) {
(config_id.compare("override-client-update") == 0)) {
parser = new BooleanParser(config_id, boolean_values_);
} else {
isc_throw(NotImplemented,
......
// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -405,7 +405,7 @@ TEST_F(CfgMgrTest, d2ClientConfig) {
isc::asiolink::IOAddress("127.0.0.1"), 478,
1024,
dhcp_ddns::NCR_UDP, dhcp_ddns::FMT_JSON,
true, true, true, true,
true, true, true, D2ClientConfig::RCM_ALWAYS,
"pre-fix", "suf-fix")));
// Verify that we can assign a new, non-empty configuration.
......
This diff is collapsed.
// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -76,7 +76,7 @@ public:
sender_ip, D2ClientConfig::DFT_SENDER_PORT,
D2ClientConfig::DFT_MAX_QUEUE_SIZE,
protocol, dhcp_ddns::FMT_JSON,
true, true, true, true,
true, true, true, D2ClientConfig::RCM_WHEN_PRESENT,
"myhost", ".example.com.")));
ASSERT_NO_THROW(setD2ClientConfig(new_cfg));
......
......@@ -1391,7 +1391,7 @@ TEST_F(ParseConfigTest, validD2Config) {
" \"always-include-fqdn\" : true, "
" \"override-no-update\" : true, "
" \"override-client-update\" : true, "
" \"replace-client-name\" : true, "
" \"replace-client-name\" : \"WHEN_PRESENT\", "
" \"generated-prefix\" : \"test.prefix\", "
" \"qualifying-suffix\" : \"test.suffix.\" "
" }"
......@@ -1416,7 +1416,7 @@ TEST_F(ParseConfigTest, validD2Config) {
EXPECT_TRUE(d2_client_config->getAlwaysIncludeFqdn());
EXPECT_TRUE(d2_client_config->getOverrideNoUpdate());
EXPECT_TRUE(d2_client_config->getOverrideClientUpdate());
EXPECT_TRUE(d2_client_config->getReplaceClientName());
EXPECT_EQ(D2ClientConfig::RCM_WHEN_PRESENT, d2_client_config->getReplaceClientNameMode());
EXPECT_EQ("test.prefix", d2_client_config->getGeneratedPrefix());
EXPECT_EQ("test.suffix.", d2_client_config->getQualifyingSuffix());
......@@ -1437,7 +1437,7 @@ TEST_F(ParseConfigTest, validD2Config) {
" \"always-include-fqdn\" : false, "
" \"override-no-update\" : false, "
" \"override-client-update\" : false, "
" \"replace-client-name\" : false, "
" \"replace-client-name\" : \"NEVER\", "
" \"generated-prefix\" : \"\", "
" \"qualifying-suffix\" : \"\" "
" }"
......@@ -1461,7 +1461,7 @@ TEST_F(ParseConfigTest, validD2Config) {
EXPECT_FALSE(d2_client_config->getAlwaysIncludeFqdn());
EXPECT_FALSE(d2_client_config->getOverrideNoUpdate());
EXPECT_FALSE(d2_client_config->getOverrideClientUpdate());
EXPECT_FALSE(d2_client_config->getReplaceClientName());
EXPECT_EQ(D2ClientConfig::RCM_NEVER, d2_client_config->getReplaceClientNameMode());
EXPECT_EQ("", d2_client_config->getGeneratedPrefix());
EXPECT_EQ("", d2_client_config->getQualifyingSuffix());
}
......@@ -1533,8 +1533,8 @@ TEST_F(ParseConfigTest, parserDefaultsD2Config) {
d2_client_config->getOverrideNoUpdate());
EXPECT_EQ(D2ClientConfig::DFT_OVERRIDE_CLIENT_UPDATE,
d2_client_config->getOverrideClientUpdate());
EXPECT_EQ(D2ClientConfig::DFT_REPLACE_CLIENT_NAME,
d2_client_config->getReplaceClientName());
EXPECT_EQ(stringToReplaceClientNameMode(D2ClientConfig::DFT_REPLACE_CLIENT_NAME_MODE),
d2_client_config->getReplaceClientNameMode());
EXPECT_EQ(D2ClientConfig::DFT_GENERATED_PREFIX,
d2_client_config->getGeneratedPrefix());
EXPECT_EQ("test.suffix.",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment