Browse Source

[3534] Refactored Configuration to SrvConfig.

This change affects many files using the Configuration object and types
derived from it.
Marcin Siodelski 10 years ago
parent
commit
1bab6f8b6b

+ 1 - 1
src/bin/d2/d_controller.cc

@@ -251,7 +251,7 @@ DControllerBase::configFromFile() {
         // so we can log things during configuration process.
 
         // Temporary storage for logging configuration
-        isc::dhcp::ConfigurationPtr storage =
+        isc::dhcp::SrvConfigPtr storage =
             isc::dhcp::CfgMgr::instance().getStagingCfg();
 
         // Get 'Logging' element from the config and use it to set up

+ 1 - 1
src/bin/dhcp4/bundy_controller.cc

@@ -177,7 +177,7 @@ void ControlledDhcpv4Srv::init(const std::string& config_file) {
 
         // Configuration may disable or enable interfaces so we have to
         // reopen sockets according to new configuration.
-        CfgMgr::instance().getConfiguration()->cfg_iface_
+        CfgMgr::instance().getCurrentCfg()->cfg_iface_
             .openSockets(getPort(), useBroadcast());
 
     } catch (const std::exception& ex) {

+ 1 - 1
src/bin/dhcp4/json_config_parser.cc

@@ -653,7 +653,7 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) {
 
     LOG_INFO(dhcp4_logger, DHCP4_CONFIG_COMPLETE)
         .arg(CfgMgr::instance().getCurrentCfg()->
-             getConfigSummary(Configuration::CFGSEL_ALL4));
+             getConfigSummary(SrvConfig::CFGSEL_ALL4));
 
     // Everything was fine. Configuration is successful.
     answer = isc::config::createAnswer(0, "Configuration successful.");

+ 1 - 1
src/bin/dhcp6/json_config_parser.cc

@@ -854,7 +854,7 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set) {
 
     LOG_INFO(dhcp6_logger, DHCP6_CONFIG_COMPLETE)
         .arg(CfgMgr::instance().getCurrentCfg()->
-             getConfigSummary(Configuration::CFGSEL_ALL6));
+             getConfigSummary(SrvConfig::CFGSEL_ALL6));
 
     // Everything was fine. Configuration is successful.
     answer = isc::config::createAnswer(0, "Configuration successful.");

+ 1 - 1
src/lib/dhcpsrv/Makefile.am

@@ -47,7 +47,6 @@ libkea_dhcpsrv_la_SOURCES += alloc_engine.cc alloc_engine.h
 libkea_dhcpsrv_la_SOURCES += callout_handle_store.h
 libkea_dhcpsrv_la_SOURCES += cfg_iface.cc cfg_iface.h
 libkea_dhcpsrv_la_SOURCES += cfgmgr.cc cfgmgr.h
-libkea_dhcpsrv_la_SOURCES += configuration.h configuration.cc
 libkea_dhcpsrv_la_SOURCES += csv_lease_file4.cc csv_lease_file4.h
 libkea_dhcpsrv_la_SOURCES += csv_lease_file6.cc csv_lease_file6.h
 libkea_dhcpsrv_la_SOURCES += d2_client_cfg.cc d2_client_cfg.h
@@ -73,6 +72,7 @@ libkea_dhcpsrv_la_SOURCES += pgsql_lease_mgr.cc pgsql_lease_mgr.h
 endif
 libkea_dhcpsrv_la_SOURCES += option_space_container.h
 libkea_dhcpsrv_la_SOURCES += pool.cc pool.h
+libkea_dhcpsrv_la_SOURCES += srv_config.cc srv_config.h
 libkea_dhcpsrv_la_SOURCES += subnet.cc subnet.h
 libkea_dhcpsrv_la_SOURCES += triplet.h
 libkea_dhcpsrv_la_SOURCES += utils.h

+ 6 - 6
src/lib/dhcpsrv/cfgmgr.cc

@@ -362,7 +362,7 @@ CfgMgr::getD2ClientMgr() {
 void
 CfgMgr::ensureCurrentAllocated() {
     if (!configuration_ || configs_.empty()) {
-        configuration_.reset(new Configuration());
+        configuration_.reset(new SrvConfig());
         configs_.push_back(configuration_);
     }
 }
@@ -381,7 +381,7 @@ CfgMgr::commit() {
         // Keep track of the maximum size of the configs history. Before adding
         // new element, we have to remove the oldest one.
         if (configs_.size() > CONFIG_LIST_SIZE) {
-            ConfigurationList::iterator it = configs_.begin();
+            SrvConfigList::iterator it = configs_.begin();
             std::advance(it, configs_.size() - CONFIG_LIST_SIZE);
             configs_.erase(configs_.begin(), it);
         }
@@ -417,7 +417,7 @@ CfgMgr::revert(const size_t index) {
 
     // Get the iterator to the current configuration and then advance to the
     // desired one.
-    ConfigurationList::const_reverse_iterator it = configs_.rbegin();
+    SrvConfigList::const_reverse_iterator it = configs_.rbegin();
     std::advance(it, index);
 
     // Copy the desired configuration to the new staging configuration. The
@@ -429,18 +429,18 @@ CfgMgr::revert(const size_t index) {
     commit();
 }
 
-ConstConfigurationPtr
+ConstSrvConfigPtr
 CfgMgr::getCurrentCfg() {
     ensureCurrentAllocated();
     return (configuration_);
 }
 
-ConfigurationPtr
+SrvConfigPtr
 CfgMgr::getStagingCfg() {
     ensureCurrentAllocated();
     if (configuration_->sequenceEquals(*configs_.back())) {
         uint32_t sequence = configuration_->getSequence();
-        configs_.push_back(ConfigurationPtr(new Configuration(++sequence)));
+        configs_.push_back(SrvConfigPtr(new SrvConfig(++sequence)));
     }
     return (configs_.back());
 }

+ 9 - 9
src/lib/dhcpsrv/cfgmgr.h

@@ -24,7 +24,7 @@
 #include <dhcpsrv/option_space_container.h>
 #include <dhcpsrv/pool.h>
 #include <dhcpsrv/subnet.h>
-#include <dhcpsrv/configuration.h>
+#include <dhcpsrv/srv_config.h>
 #include <util/buffer.h>
 
 #include <boost/shared_ptr.hpp>
@@ -427,7 +427,7 @@ public:
     /// @brief Reverts to one of the previous configurations.
     ///
     /// This function reverts to selected previous configuration. The previous
-    /// configuration is entirely copied to a new @c Configuration instance. This
+    /// configuration is entirely copied to a new @c SrvConfig instance. This
     /// new instance has a unique sequence id (sequence id is not copied). The
     /// previous configuration (being copied) is not modified by this operation.
     ///
@@ -452,7 +452,7 @@ public:
     /// and return it. Current configuration returned is read-only.
     ///
     /// @return Non-null const pointer to the current configuration.
-    ConstConfigurationPtr getCurrentCfg();
+    ConstSrvConfigPtr getCurrentCfg();
 
     /// @brief Returns a pointer to the staging configuration.
     ///
@@ -466,7 +466,7 @@ public:
     /// configuration parsers).
     ///
     /// @return non-null pointer to the staging configuration.
-    ConfigurationPtr getStagingCfg();
+    SrvConfigPtr getStagingCfg();
 
     //@}
 
@@ -577,22 +577,22 @@ private:
     /// @brief Manages the DHCP-DDNS client and its configuration.
     D2ClientMgr d2_client_mgr_;
 
-    /// @brief Configuration
+    /// @brief Server configuration
     ///
     /// This is a structure that will hold all configuration.
     /// @todo: migrate all other parameters to that structure.
     /// @todo: maybe this should be a vector<Configuration>, so we could keep
     ///        previous configurations and do a rollback if needed?
-    ConfigurationPtr configuration_;
+    SrvConfigPtr configuration_;
 
     /// @name Configuration List.
     ///
     //@{
-    /// @brief Configuration list type.
-    typedef std::list<ConfigurationPtr> ConfigurationList;
+    /// @brief Server configuration list type.
+    typedef std::list<SrvConfigPtr> SrvConfigList;
 
     /// @brief Container holding all previous and current configurations.
-    ConfigurationList configs_;
+    SrvConfigList configs_;
     //@}
 
     /// @brief Indicates if a process has been ran in the verbose mode.

+ 1 - 1
src/lib/dhcpsrv/daemon.cc

@@ -57,7 +57,7 @@ void Daemon::handleSignal() {
 }
 
 void Daemon::configureLogger(const isc::data::ConstElementPtr& log_config,
-                             const ConfigurationPtr& storage) {
+                             const SrvConfigPtr& storage) {
 
     if (log_config) {
         isc::data::ConstElementPtr loggers = log_config->get("loggers");

+ 2 - 2
src/lib/dhcpsrv/daemon.h

@@ -17,7 +17,7 @@
 
 #include <config.h>
 #include <cc/data.h>
-#include <dhcpsrv/configuration.h>
+#include <dhcpsrv/srv_config.h>
 #include <util/signal_set.h>
 #include <boost/noncopyable.hpp>
 #include <string>
@@ -129,7 +129,7 @@ public:
     /// @param log_config JSON structures that describe logging
     /// @param storage configuration will be stored here
     static void configureLogger(const isc::data::ConstElementPtr& log_config,
-                                const isc::dhcp::ConfigurationPtr& storage);
+                                const isc::dhcp::SrvConfigPtr& storage);
 
     /// @brief Sets or clears verbose mode
     ///

+ 6 - 6
src/lib/dhcpsrv/libdhcpsrv.dox

@@ -42,12 +42,12 @@ only available backend is MySQL (see \ref isc::dhcp::MySqlLeaseMgr).
 Configuration Manager (\ref isc::dhcp::CfgMgr) is a singleton object which
 holds configuration information necessary for the operation of Kea daemons.
 A complete collection of information for the daemon is stored in the
-\ref isc::dhcp::Configuration object. Internally, the Configuration Manager
-holds a list of \ref isc::dhcp::Configuration objects, from which one
+\ref isc::dhcp::SrvConfig object. Internally, the Configuration Manager
+holds a list of \ref isc::dhcp::SrvConfig objects, from which one
 is marked as "current configuration".
 
 When the server starts up or is being reconfigured a new
-\ref isc::dhcp::Configuration object, referred to as "staging configuration",
+\ref isc::dhcp::SrvConfig object, referred to as "staging configuration",
 is created. The staging configuration is held at the tip of the list of
 configurations. The object can be accessed by calling the
 \ref isc::dhcp::CfgMgr::getStagingCfg. This object can be accessed
@@ -61,9 +61,9 @@ current configuration can be accessed by calling a
 
 The staging configuration can be discarded at any time before it is committed
 by calling the \ref isc::dhcp::CfgMgr::rollback. This removes the
-\ref isc::dhcp::Configuration object from the Configuration Manager. When
+\ref isc::dhcp::SrvConfig object from the Configuration Manager. When
 the \ref isc::dhcp::CfgMgr::getStagingCfg is called again a fresh/default
-\ref isc::dhcp::Configuration object is returned.
+\ref isc::dhcp::SrvConfig object is returned.
 
 The Configuration Manager stores previous configurations, i.e. configurations
 which occurred prior to the most current configuration. This is currently
@@ -78,7 +78,7 @@ predecessor of the current configuration, the value of 2 identifies the
 one that occurred before it etc.
 
 @todo Currently, only a subset of configuration information is stored in
-the \ref isc::dhcp::Configuration object. Kea developers are actively working
+the \ref isc::dhcp::SrvConfig object. Kea developers are actively working
 on migrating the other configuration parameters to it.
 
 @section allocengine Allocation Engine

+ 1 - 1
src/lib/dhcpsrv/logging.cc

@@ -26,7 +26,7 @@ using namespace isc::log;
 namespace isc {
 namespace dhcp {
 
-LogConfigParser::LogConfigParser(const ConfigurationPtr& storage)
+LogConfigParser::LogConfigParser(const SrvConfigPtr& storage)
     :config_(storage), verbose_(false) {
     if (!storage) {
         isc_throw(BadValue, "LogConfigParser needs a pointer to the "

+ 3 - 3
src/lib/dhcpsrv/logging.h

@@ -16,7 +16,7 @@
 #define DHCPSRV_LOGGING_H
 
 #include <cc/data.h>
-#include <dhcpsrv/configuration.h>
+#include <dhcpsrv/srv_config.h>
 #include <vector>
 
 namespace isc {
@@ -52,7 +52,7 @@ public:
     /// @brief Constructor
     ///
     /// @param storage parsed logging configuration will be stored here
-    LogConfigParser(const ConfigurationPtr& storage);
+    LogConfigParser(const SrvConfigPtr& storage);
 
     /// @brief Parses specified configuration
     ///
@@ -101,7 +101,7 @@ private:
     /// @brief Configuration is stored here
     ///
     /// LogConfigParser class uses only config_->logging_info_ field.
-    ConfigurationPtr config_;
+    SrvConfigPtr config_;
 
     /// @brief Verbose mode
     ///

+ 8 - 8
src/lib/dhcpsrv/configuration.cc

@@ -13,7 +13,7 @@
 // PERFORMANCE OF THIS SOFTWARE.
 
 #include <dhcpsrv/cfgmgr.h>
-#include <dhcpsrv/configuration.h>
+#include <dhcpsrv/srv_config.h>
 #include <log/logger_manager.h>
 #include <log/logger_specification.h>
 #include <list>
@@ -24,16 +24,16 @@ using namespace isc::log;
 namespace isc {
 namespace dhcp {
 
-Configuration::Configuration()
+SrvConfig::SrvConfig()
     : sequence_(0) {
 }
 
-Configuration::Configuration(uint32_t sequence)
+SrvConfig::SrvConfig(uint32_t sequence)
     : sequence_(sequence) {
 }
 
 std::string
-Configuration::getConfigSummary(const uint32_t selection) const {
+SrvConfig::getConfigSummary(const uint32_t selection) const {
     std::ostringstream s;
     size_t subnets_num;
     if ((selection & CFGSEL_SUBNET4) == CFGSEL_SUBNET4) {
@@ -74,12 +74,12 @@ Configuration::getConfigSummary(const uint32_t selection) const {
 }
 
 bool
-Configuration::sequenceEquals(const Configuration& other) {
+SrvConfig::sequenceEquals(const SrvConfig& other) {
     return (getSequence() == other.getSequence());
 }
 
 void
-Configuration::copy(Configuration& new_config) const {
+SrvConfig::copy(SrvConfig& new_config) const {
     // We will entirely replace loggers in the new configuration.
     new_config.logging_info_.clear();
     for (LoggingInfoStorage::const_iterator it = logging_info_.begin();
@@ -91,7 +91,7 @@ Configuration::copy(Configuration& new_config) const {
 }
 
 void
-Configuration::applyLoggingCfg() const {
+SrvConfig::applyLoggingCfg() const {
     /// @todo Remove the hardcoded location.
     setenv("KEA_LOCKFILE_DIR_FROM_BUILD", "/tmp", 1);
 
@@ -105,7 +105,7 @@ Configuration::applyLoggingCfg() const {
 }
 
 bool
-Configuration::equals(const Configuration& other) const {
+SrvConfig::equals(const SrvConfig& other) const {
     // If number of loggers is different, then configurations aren't equal.
     if (logging_info_.size() != other.logging_info_.size()) {
         return (false);

+ 17 - 17
src/lib/dhcpsrv/configuration.h

@@ -12,8 +12,8 @@
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // PERFORMANCE OF THIS SOFTWARE.
 
-#ifndef DHCPSRV_CONFIGURATION_H
-#define DHCPSRV_CONFIGURATION_H
+#ifndef DHCPSRV_CONFIG_H
+#define DHCPSRV_CONFIG_H
 
 #include <dhcpsrv/cfg_iface.h>
 #include <dhcpsrv/logging_info.h>
@@ -30,7 +30,7 @@ class CfgMgr;
 /// @brief Specifies current DHCP configuration
 ///
 /// @todo Migrate all other configuration parameters from cfgmgr.h here
-class Configuration {
+class SrvConfig {
 public:
     /// @name Constants for selection of parameters returned by @c getConfigSummary
     ///
@@ -60,12 +60,12 @@ public:
     /// @brief Default constructor.
     ///
     /// This constructor sets configuration sequence number to 0.
-    Configuration();
+    SrvConfig();
 
     /// @brief Constructor.
     ///
     /// Sets arbitrary configuration sequence number.
-    Configuration(uint32_t sequence);
+    SrvConfig(uint32_t sequence);
 
     /// @brief Returns summary of the configuration in the textual format.
     ///
@@ -102,7 +102,7 @@ public:
     /// compared with the sequence number of this configuration.
     ///
     /// @return true if sequence numbers are equal.
-    bool sequenceEquals(const Configuration& other);
+    bool sequenceEquals(const SrvConfig& other);
 
     /// @brief Returns logging specific configuration.
     const LoggingInfoStorage& getLoggingInfo() const {
@@ -141,7 +141,7 @@ public:
     ///
     /// @param [out] new_config An object to which the configuration will
     /// be copied.
-    void copy(Configuration& new_config) const;
+    void copy(SrvConfig& new_config) const;
 
     /// @brief Apply logging configuration to log4cplus.
     void applyLoggingCfg() const;
@@ -158,7 +158,7 @@ public:
     /// @param other An object to be compared with this object.
     ///
     /// @return true if two objects are equal, false otherwise.
-    bool equals(const Configuration& other) const;
+    bool equals(const SrvConfig& other) const;
 
     /// @brief Compares two objects for inequality.
     ///
@@ -168,7 +168,7 @@ public:
     /// @param other An object to be compared with this object.
     ///
     /// @return true if two objects are not equal, false otherwise.
-    bool nequals(const Configuration& other) const {
+    bool nequals(const SrvConfig& other) const {
         return (!equals(other));
     }
 
@@ -180,7 +180,7 @@ public:
     /// @param other An object to be compared with this object.
     ///
     /// @return true if two objects are equal, false otherwise.
-    bool operator==(const Configuration& other) const {
+    bool operator==(const SrvConfig& other) const {
         return (equals(other));
     }
 
@@ -192,7 +192,7 @@ public:
     /// @param other An object to be compared with this object.
     ///
     /// @return true if two objects are not equal, false otherwise.
-    bool operator!=(const Configuration& other) const {
+    bool operator!=(const SrvConfig& other) const {
         return (nequals(other));
     }
 
@@ -214,17 +214,17 @@ private:
 
 };
 
-/// @name Pointers to the @c Configuration object.
+/// @name Pointers to the @c SrvConfig object.
 ///
 //@{
-/// @brief Non-const pointer to the @ Configuration.
-typedef boost::shared_ptr<Configuration> ConfigurationPtr;
+/// @brief Non-const pointer to the @c SrvConfig.
+typedef boost::shared_ptr<SrvConfig> SrvConfigPtr;
 
-/// @brief Const pointer to the @c Configuration.
-typedef boost::shared_ptr<const Configuration> ConstConfigurationPtr;
+/// @brief Const pointer to the @c SrvConfig.
+typedef boost::shared_ptr<const SrvConfig> ConstSrvConfigPtr;
 //@}
 
 } // namespace isc::dhcp
 } // namespace isc
 
-#endif // DHCPSRV_CONFIGURATION_H
+#endif // DHCPSRV_CONFIG_H

+ 1 - 1
src/lib/dhcpsrv/tests/Makefile.am

@@ -55,7 +55,6 @@ libdhcpsrv_unittests_SOURCES  = run_unittests.cc
 libdhcpsrv_unittests_SOURCES += addr_utilities_unittest.cc
 libdhcpsrv_unittests_SOURCES += alloc_engine_unittest.cc
 libdhcpsrv_unittests_SOURCES += callout_handle_store_unittest.cc
-libdhcpsrv_unittests_SOURCES += configuration_unittest.cc
 libdhcpsrv_unittests_SOURCES += cfgmgr_unittest.cc
 libdhcpsrv_unittests_SOURCES += csv_lease_file4_unittest.cc
 libdhcpsrv_unittests_SOURCES += csv_lease_file6_unittest.cc
@@ -82,6 +81,7 @@ endif
 libdhcpsrv_unittests_SOURCES += pool_unittest.cc
 libdhcpsrv_unittests_SOURCES += schema_mysql_copy.h
 libdhcpsrv_unittests_SOURCES += schema_pgsql_copy.h
+libdhcpsrv_unittests_SOURCES += srv_config_unittest.cc
 libdhcpsrv_unittests_SOURCES += subnet_unittest.cc
 libdhcpsrv_unittests_SOURCES += test_get_callout_handle.cc test_get_callout_handle.h
 libdhcpsrv_unittests_SOURCES += triplet_unittest.cc

+ 4 - 4
src/lib/dhcpsrv/tests/cfgmgr_unittest.cc

@@ -296,7 +296,7 @@ public:
 // it is empty by default.
 TEST_F(CfgMgrTest, configuration) {
 
-    ConstConfigurationPtr configuration = CfgMgr::instance().getCurrentCfg();
+    ConstSrvConfigPtr configuration = CfgMgr::instance().getCurrentCfg();
     ASSERT_TRUE(configuration);
     EXPECT_TRUE(configuration->getLoggingInfo().empty());
 
@@ -1133,7 +1133,7 @@ TEST_F(CfgMgrTest, staging) {
     // Initially, the current configuration is a default one. We are going
     // to get the current configuration a couple of times and make sure
     // that always the same instance is returned.
-    ConstConfigurationPtr const_config;
+    ConstSrvConfigPtr const_config;
     for (int i = 0; i < 5; ++i) {
         const_config = cfg_mgr.getCurrentCfg();
         ASSERT_TRUE(const_config) << "Returned NULL current configuration"
@@ -1147,7 +1147,7 @@ TEST_F(CfgMgrTest, staging) {
     // for the first time the new instance of the staging configuration is
     // returned. This instance is returned for every call to getStagingCfg()
     // until commit is called.
-    ConfigurationPtr config;
+    SrvConfigPtr config;
     for (int i = 0; i < 5; ++i) {
         config = cfg_mgr.getStagingCfg();
         ASSERT_TRUE(config) << "Returned NULL staging configuration for"
@@ -1216,7 +1216,7 @@ TEST_F(CfgMgrTest, revert) {
     // Let's create 5 unique configurations: differing by a debug level in the
     // range of 10 to 14.
     for (int i = 0; i < 5; ++i) {
-        ConfigurationPtr config = cfg_mgr.getStagingCfg();
+        SrvConfigPtr config = cfg_mgr.getStagingCfg();
         LoggingInfo logging_info;
         logging_info.debuglevel_ = i + 10;
         config->addLoggingInfo(logging_info);

+ 1 - 1
src/lib/dhcpsrv/tests/daemon_unittest.cc

@@ -53,7 +53,7 @@ TEST(DaemonTest, parsingConsoleOutput) {
     CfgMgr::instance().setVerbose(false);
 
     // Storage - parsed configuration will be stored here
-    ConfigurationPtr storage(new Configuration());
+    SrvConfigPtr storage(new SrvConfig());
 
     const char* config_txt =
     "{ \"loggers\": ["

+ 1 - 1
src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc

@@ -242,7 +242,7 @@ TEST_F(DhcpParserTest, interfaceListParserTest) {
 
     // Use CfgMgr instance to check if eth0 and eth1 was added, and that
     // eth2 was not added.
-    ConfigurationPtr cfg = CfgMgr::instance().getStagingCfg();
+    SrvConfigPtr cfg = CfgMgr::instance().getStagingCfg();
     ASSERT_TRUE(cfg);
     ASSERT_NO_THROW(cfg->getCfgIface().openSockets(AF_INET, 10000));
 

+ 6 - 6
src/lib/dhcpsrv/tests/logging_unittest.cc

@@ -27,10 +27,10 @@ namespace {
 // Checks that contructor is able to process specified storage properly
 TEST(LoggingTest, constructor) {
 
-    ConfigurationPtr null_ptr;
+    SrvConfigPtr null_ptr;
     EXPECT_THROW(LogConfigParser parser(null_ptr), BadValue);
 
-    ConfigurationPtr nonnull(new Configuration());
+    SrvConfigPtr nonnull(new SrvConfig());
 
     EXPECT_NO_THROW(LogConfigParser parser(nonnull));
 }
@@ -54,7 +54,7 @@ TEST(LoggingTest, parsingConsoleOutput) {
     "    }"
     "]}";
 
-    ConfigurationPtr storage(new Configuration());
+    SrvConfigPtr storage(new SrvConfig());
 
     LogConfigParser parser(storage);
 
@@ -94,7 +94,7 @@ TEST(LoggingTest, parsingFile) {
     "    }"
     "]}";
 
-    ConfigurationPtr storage(new Configuration());
+    SrvConfigPtr storage(new SrvConfig());
 
     LogConfigParser parser(storage);
 
@@ -144,7 +144,7 @@ TEST(LoggingTest, multipleLoggers) {
     "    }"
     "]}";
 
-    ConfigurationPtr storage(new Configuration());
+    SrvConfigPtr storage(new SrvConfig());
 
     LogConfigParser parser(storage);
 
@@ -192,7 +192,7 @@ TEST(LoggingTest, multipleLoggingDestinations) {
     "    }"
     "]}";
 
-    ConfigurationPtr storage(new Configuration());
+    SrvConfigPtr storage(new SrvConfig());
 
     LogConfigParser parser(storage);
 

+ 42 - 42
src/lib/dhcpsrv/tests/configuration_unittest.cc

@@ -16,16 +16,16 @@
 
 #include <dhcp/tests/iface_mgr_test_config.h>
 #include <dhcpsrv/cfgmgr.h>
-#include <dhcpsrv/configuration.h>
+#include <dhcpsrv/srv_config.h>
 #include <dhcpsrv/subnet.h>
 #include <gtest/gtest.h>
 
 using namespace isc::asiolink;
 using namespace isc::dhcp;
 
-// Those are the tests for Configuration storage. Right now they are minimal,
+// Those are the tests for SrvConfig storage. Right now they are minimal,
 // but the number is expected to grow significantly once we migrate more
-// parameters from CfgMgr storage to Configuration storage.
+// parameters from CfgMgr storage to SrvConfig storage.
 
 namespace {
 
@@ -33,13 +33,13 @@ namespace {
 const int TEST_SUBNETS_NUM = 3;
 
 /// @brief Test fixture class for testing configuration data storage.
-class ConfigurationTest : public ::testing::Test {
+class SrvConfigTest : public ::testing::Test {
 public:
     /// @brief Constructor.
     ///
     /// Creates IPv4 and IPv6 subnets for unit test. The number of subnets
     /// is @c TEST_SUBNETS_NUM for IPv4 and IPv6 each.
-    ConfigurationTest()
+    SrvConfigTest()
         : iface_mgr_test_config_(true) {
         // Remove any subnets dangling from previous unit tests.
         clearSubnets();
@@ -76,7 +76,7 @@ public:
     /// @brief Destructor.
     ///
     /// Removes any dangling configuration.
-    virtual ~ConfigurationTest() {
+    virtual ~SrvConfigTest() {
         clearSubnets();
     }
 
@@ -88,9 +88,9 @@ public:
     /// @c TEST_SUBNETS_NUM.
     ///
     /// @todo Until the subnets configuration is migrated from the @c CfgMgr to
-    /// the @c Configuration object, this function adds the subnet to the
+    /// the @c SrvConfig object, this function adds the subnet to the
     /// @c CfgMgr. Once, the subnet configuration is held in the
-    /// @c Configuration this function must be modified to store the subnets in
+    /// @c SrvConfig this function must be modified to store the subnets in
     /// the @c conf_ object.
     void addSubnet4(const unsigned int index);
 
@@ -102,16 +102,16 @@ public:
     /// @c TEST_SUBNETS_NUM.
     ///
     /// @todo Until the subnets configuration is migrated from the @c CfgMgr to
-    /// the @c Configuration object, this function adds the subnet to the
+    /// the @c SrvConfig object, this function adds the subnet to the
     /// @c CfgMgr. Once, the subnet configuration is held in the
-    /// @c Configuration this function must be modified to store the subnets in
+    /// @c SrvConfig this function must be modified to store the subnets in
     /// @c conf_ object.
     void addSubnet6(const unsigned int index);
 
     /// @brief Removes all subnets from the configuration.
     ///
     /// @todo Modify this function once the subnet configuration is migrated
-    /// from @c CfgMgr to @c Configuration.
+    /// from @c CfgMgr to @c SrvConfig.
     void clearSubnets();
 
     /// @brief Enable/disable DDNS.
@@ -121,7 +121,7 @@ public:
     void enableDDNS(const bool enable);
 
     /// @brief Stores configuration.
-    Configuration conf_;
+    SrvConfig conf_;
     /// @brief A collection of IPv4 subnets used by unit tests.
     Subnet4Collection test_subnets4_;
     /// @brief A collection of IPv6 subnets used by unit tests.
@@ -132,7 +132,7 @@ public:
 };
 
 void
-ConfigurationTest::addSubnet4(const unsigned int index) {
+SrvConfigTest::addSubnet4(const unsigned int index) {
     if (index >= TEST_SUBNETS_NUM) {
         FAIL() << "Subnet index " << index << "out of range (0.."
                << TEST_SUBNETS_NUM << "): " << "unable to add IPv4 subnet";
@@ -141,7 +141,7 @@ ConfigurationTest::addSubnet4(const unsigned int index) {
 }
 
 void
-ConfigurationTest::addSubnet6(const unsigned int index) {
+SrvConfigTest::addSubnet6(const unsigned int index) {
     if (index >= TEST_SUBNETS_NUM) {
         FAIL() << "Subnet index " << index << "out of range (0.."
                << TEST_SUBNETS_NUM << "): " << "unable to add IPv6 subnet";
@@ -150,24 +150,24 @@ ConfigurationTest::addSubnet6(const unsigned int index) {
 }
 
 void
-ConfigurationTest::clearSubnets() {
+SrvConfigTest::clearSubnets() {
     CfgMgr::instance().deleteSubnets4();
     CfgMgr::instance().deleteSubnets6();
 }
 
 void
-ConfigurationTest::enableDDNS(const bool enable) {
+SrvConfigTest::enableDDNS(const bool enable) {
     // D2 configuration should always be non-NULL.
     CfgMgr::instance().getD2ClientConfig()->enableUpdates(enable);
 }
 
 // Check that by default there are no logging entries
-TEST_F(ConfigurationTest, basic) {
+TEST_F(SrvConfigTest, basic) {
     EXPECT_TRUE(conf_.getLoggingInfo().empty());
 }
 
-// Check that Configuration can store logging information.
-TEST_F(ConfigurationTest, loggingInfo) {
+// Check that SrvConfig can store logging information.
+TEST_F(SrvConfigTest, loggingInfo) {
     LoggingInfo log1;
     log1.clearDestinations();
     log1.name_ = "foo";
@@ -194,79 +194,79 @@ TEST_F(ConfigurationTest, loggingInfo) {
 
 // Check that the configuration summary including information about the status
 // of DDNS is returned.
-TEST_F(ConfigurationTest, summaryDDNS) {
+TEST_F(SrvConfigTest, summaryDDNS) {
     EXPECT_EQ("DDNS: disabled",
-              conf_.getConfigSummary(Configuration::CFGSEL_DDNS));
+              conf_.getConfigSummary(SrvConfig::CFGSEL_DDNS));
 
     enableDDNS(true);
     EXPECT_EQ("DDNS: enabled",
-              conf_.getConfigSummary(Configuration::CFGSEL_DDNS));
+              conf_.getConfigSummary(SrvConfig::CFGSEL_DDNS));
 
     enableDDNS(false);
     EXPECT_EQ("no IPv4 subnets!; no IPv6 subnets!; DDNS: disabled",
-              conf_.getConfigSummary(Configuration::CFGSEL_ALL));
+              conf_.getConfigSummary(SrvConfig::CFGSEL_ALL));
 }
 
 // Check that the configuration summary including information about added
 // subnets is returned.
-TEST_F(ConfigurationTest, summarySubnets) {
+TEST_F(SrvConfigTest, summarySubnets) {
     EXPECT_EQ("no config details available",
-              conf_.getConfigSummary(Configuration::CFGSEL_NONE));
+              conf_.getConfigSummary(SrvConfig::CFGSEL_NONE));
 
     // Initially, there are no subnets added but it should be explicitly
     // reported when we query for information about the subnets.
     EXPECT_EQ("no IPv4 subnets!; no IPv6 subnets!",
-              conf_.getConfigSummary(Configuration::CFGSEL_SUBNET));
+              conf_.getConfigSummary(SrvConfig::CFGSEL_SUBNET));
 
     // If we just want information about IPv4 subnets, there should be no
     // mention of IPv6 subnets, even though there are none added.
     EXPECT_EQ("no IPv4 subnets!",
-              conf_.getConfigSummary(Configuration::CFGSEL_SUBNET4));
+              conf_.getConfigSummary(SrvConfig::CFGSEL_SUBNET4));
 
     // If we just want information about IPv6 subnets, there should be no
     // mention of IPv4 subnets, even though there are none added.
     EXPECT_EQ("no IPv6 subnets!",
-              conf_.getConfigSummary(Configuration::CFGSEL_SUBNET6));
+              conf_.getConfigSummary(SrvConfig::CFGSEL_SUBNET6));
 
     // Add IPv4 subnet and make sure it is reported.
     addSubnet4(0);
     EXPECT_EQ("added IPv4 subnets: 1",
-              conf_.getConfigSummary(Configuration::CFGSEL_SUBNET4));
+              conf_.getConfigSummary(SrvConfig::CFGSEL_SUBNET4));
     EXPECT_EQ("added IPv4 subnets: 1; no IPv6 subnets!",
-              conf_.getConfigSummary(Configuration::CFGSEL_SUBNET));
+              conf_.getConfigSummary(SrvConfig::CFGSEL_SUBNET));
 
     // Add IPv6 subnet and make sure it is reported.
     addSubnet6(0);
     EXPECT_EQ("added IPv6 subnets: 1",
-              conf_.getConfigSummary(Configuration::CFGSEL_SUBNET6));
+              conf_.getConfigSummary(SrvConfig::CFGSEL_SUBNET6));
     EXPECT_EQ("added IPv4 subnets: 1; added IPv6 subnets: 1",
-              conf_.getConfigSummary(Configuration::CFGSEL_SUBNET));
+              conf_.getConfigSummary(SrvConfig::CFGSEL_SUBNET));
 
     // Add one more subnet and make sure the bumped value is only
     // for IPv4, but not for IPv6.
     addSubnet4(1);
     EXPECT_EQ("added IPv4 subnets: 2; added IPv6 subnets: 1",
-              conf_.getConfigSummary(Configuration::CFGSEL_SUBNET));
+              conf_.getConfigSummary(SrvConfig::CFGSEL_SUBNET));
     EXPECT_EQ("added IPv4 subnets: 2",
-              conf_.getConfigSummary(Configuration::CFGSEL_SUBNET4));
+              conf_.getConfigSummary(SrvConfig::CFGSEL_SUBNET4));
 
     addSubnet6(1);
     EXPECT_EQ("added IPv4 subnets: 2; added IPv6 subnets: 2",
-              conf_.getConfigSummary(Configuration::CFGSEL_SUBNET));
+              conf_.getConfigSummary(SrvConfig::CFGSEL_SUBNET));
 
     // Remove all subnets and make sure that there are no reported subnets
     // back again.
     clearSubnets();
     EXPECT_EQ("no IPv4 subnets!; no IPv6 subnets!",
-              conf_.getConfigSummary(Configuration::CFGSEL_SUBNET));
+              conf_.getConfigSummary(SrvConfig::CFGSEL_SUBNET));
 }
 
 // This test checks if entire configuration can be copied and that the sequence
 // number is not affected.
-TEST_F(ConfigurationTest, copy) {
+TEST_F(SrvConfigTest, copy) {
     // Create two configurations with different sequence numbers.
-    Configuration conf1(32);
-    Configuration conf2(64);
+    SrvConfig conf1(32);
+    SrvConfig conf2(64);
 
     // Set logging information for conf1.
     LoggingInfo info;
@@ -296,9 +296,9 @@ TEST_F(ConfigurationTest, copy) {
 }
 
 // This test checks that two configurations can be compared for (in)equality.
-TEST_F(ConfigurationTest, equality) {
-    Configuration conf1(32);
-    Configuration conf2(64);
+TEST_F(SrvConfigTest, equality) {
+    SrvConfig conf1(32);
+    SrvConfig conf2(64);
 
     // Initially, both objects should be equal, even though the configuration
     // sequences are not matching.