Commit 8a12b4d0 authored by Thomas Markwalder's avatar Thomas Markwalder

[3329] Added setter for enable-updates to dhcp::D2ClientConfig

Added enableUpdates() method to D2ClientConfig to allow DDNS updates to be
enabled or disabled independent of reconfiguration.
parent ff31f7b6
......@@ -67,6 +67,11 @@ D2ClientConfig::D2ClientConfig()
D2ClientConfig::~D2ClientConfig(){};
void
D2ClientConfig::enableUpdates(bool enable) {
enable_updates_ = enable;
}
void
D2ClientConfig::validateContents() {
if (ncr_format_ != dhcp_ddns::FMT_JSON) {
......
......@@ -159,6 +159,15 @@ public:
/// @brief Generates a string representation of the class contents.
std::string toText() const;
/// @brief Sets enable-updates flag to the given value.
///
/// This is the only value that may be altered outside the constructor
/// as it may be desirable to toggle it off and on when dealing with
/// D2 IO errors.
///
/// @param enable boolean value to assign to the enable-updates flag
void enableUpdates(bool enable);
protected:
/// @brief Validates member values.
///
......
......@@ -36,6 +36,12 @@ TEST(D2ClientConfigTest, constructorsAndAccessors) {
ASSERT_NO_THROW(d2_client_config.reset(new D2ClientConfig()));
EXPECT_FALSE(d2_client_config->getEnableUpdates());
// Verify the enable-updates can be toggled.
d2_client_config->enableUpdates(true);
EXPECT_TRUE(d2_client_config->getEnableUpdates());
d2_client_config->enableUpdates(false);
EXPECT_FALSE(d2_client_config->getEnableUpdates());
d2_client_config.reset();
bool enable_updates = true;
......
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