diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.cc b/src/bin/dhcp4/ctrl_dhcp4_srv.cc index 0f78b777fa..10cf95b7f6 100644 --- a/src/bin/dhcp4/ctrl_dhcp4_srv.cc +++ b/src/bin/dhcp4/ctrl_dhcp4_srv.cc @@ -149,7 +149,7 @@ ControlledDhcpv4Srv::processConfig(isc::data::ConstElementPtr config) { // safe and we really don't want to emit exceptions to whoever called this // method. Instead, catch an exception and create appropriate answer. try { - CfgMgr::instance().getCurrent()->getCfgIface() + CfgMgr::instance().getCurrentCfg()->getCfgIface() .openSockets(CfgIface::V4, srv->getPort(), getInstance()->useBroadcast()); diff --git a/src/bin/dhcp4/json_config_parser.cc b/src/bin/dhcp4/json_config_parser.cc index e99b8590e2..7dc972490c 100644 --- a/src/bin/dhcp4/json_config_parser.cc +++ b/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().getCurrent()-> + .arg(CfgMgr::instance().getCurrentCfg()-> getConfigSummary(Configuration::CFGSEL_ALL4)); // Everything was fine. Configuration is successful. diff --git a/src/bin/dhcp4/kea_controller.cc b/src/bin/dhcp4/kea_controller.cc index 4f6f851d67..2098eb1f36 100644 --- a/src/bin/dhcp4/kea_controller.cc +++ b/src/bin/dhcp4/kea_controller.cc @@ -71,7 +71,7 @@ void configure(const std::string& file_name) { // If there's no logging element, we'll just pass NULL pointer, // which will be handled by configureLogger(). Daemon::configureLogger(json->get("Logging"), - CfgMgr::instance().getStaging(), + CfgMgr::instance().getStagingCfg(), ControlledDhcpv4Srv::getInstance()->getVerbose()); // Get Dhcp4 component from the config diff --git a/src/bin/dhcp4/tests/config_parser_unittest.cc b/src/bin/dhcp4/tests/config_parser_unittest.cc index 886017a98f..1a3bf84e0d 100644 --- a/src/bin/dhcp4/tests/config_parser_unittest.cc +++ b/src/bin/dhcp4/tests/config_parser_unittest.cc @@ -2917,7 +2917,7 @@ TEST_F(Dhcp4ParserTest, selectedInterfaces) { ASSERT_TRUE(status); checkResult(status, 0); - CfgMgr::instance().getStaging()-> + CfgMgr::instance().getStagingCfg()-> getCfgIface().openSockets(CfgIface::V4, 10000); // eth0 and eth1 were explicitly selected. eth2 was not. @@ -2953,7 +2953,7 @@ TEST_F(Dhcp4ParserTest, allInterfaces) { ASSERT_TRUE(status); checkResult(status, 0); - CfgMgr::instance().getStaging()-> + CfgMgr::instance().getStagingCfg()-> getCfgIface().openSockets(CfgIface::V4, 10000); // All interfaces should be now active. diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.cc b/src/bin/dhcp6/ctrl_dhcp6_srv.cc index ac0eda02d9..1ba9ba8934 100644 --- a/src/bin/dhcp6/ctrl_dhcp6_srv.cc +++ b/src/bin/dhcp6/ctrl_dhcp6_srv.cc @@ -144,7 +144,7 @@ ControlledDhcpv6Srv::processConfig(isc::data::ConstElementPtr config) { // safe and we really don't want to emit exceptions to the callback caller. // Instead, catch an exception and create appropriate answer. try { - CfgMgr::instance().getCurrent()->getCfgIface() + CfgMgr::instance().getCurrentCfg()->getCfgIface() .openSockets(CfgIface::V6, srv->getPort()); } catch (const std::exception& ex) { diff --git a/src/bin/dhcp6/json_config_parser.cc b/src/bin/dhcp6/json_config_parser.cc index 4277e16caf..c45724f5ba 100644 --- a/src/bin/dhcp6/json_config_parser.cc +++ b/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().getCurrent()-> + .arg(CfgMgr::instance().getCurrentCfg()-> getConfigSummary(Configuration::CFGSEL_ALL6)); // Everything was fine. Configuration is successful. diff --git a/src/bin/dhcp6/kea_controller.cc b/src/bin/dhcp6/kea_controller.cc index 1b8f39352c..58ca5ad022 100644 --- a/src/bin/dhcp6/kea_controller.cc +++ b/src/bin/dhcp6/kea_controller.cc @@ -74,7 +74,7 @@ void configure(const std::string& file_name) { // If there's no logging element, we'll just pass NULL pointer, // which will be handled by configureLogger(). Daemon::configureLogger(json->get("Logging"), - CfgMgr::instance().getStaging(), + CfgMgr::instance().getStagingCfg(), ControlledDhcpv6Srv::getInstance()->getVerbose()); // Get Dhcp6 component from the config diff --git a/src/bin/dhcp6/tests/config_parser_unittest.cc b/src/bin/dhcp6/tests/config_parser_unittest.cc index eba6f9b3e1..51d4e18f5d 100644 --- a/src/bin/dhcp6/tests/config_parser_unittest.cc +++ b/src/bin/dhcp6/tests/config_parser_unittest.cc @@ -3055,7 +3055,7 @@ TEST_F(Dhcp6ParserTest, selectedInterfaces) { // as the pool does not belong to that subnet checkResult(status, 0); - CfgMgr::instance().getStaging()-> + CfgMgr::instance().getStagingCfg()-> getCfgIface().openSockets(CfgIface::V6, 10000); // eth0 and eth1 were explicitly selected. eth2 was not. @@ -3089,7 +3089,7 @@ TEST_F(Dhcp6ParserTest, allInterfaces) { EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json)); checkResult(status, 0); - CfgMgr::instance().getStaging()-> + CfgMgr::instance().getStagingCfg()-> getCfgIface().openSockets(CfgIface::V6, 10000); // All interfaces should be now active. diff --git a/src/lib/dhcpsrv/cfgmgr.cc b/src/lib/dhcpsrv/cfgmgr.cc index fbba636f66..26aa9af5ef 100644 --- a/src/lib/dhcpsrv/cfgmgr.cc +++ b/src/lib/dhcpsrv/cfgmgr.cc @@ -388,13 +388,13 @@ CfgMgr::rollback() { } ConstConfigurationPtr -CfgMgr::getCurrent() { +CfgMgr::getCurrentCfg() { ensureCurrentAllocated(); return (configuration_); } ConfigurationPtr -CfgMgr::getStaging() { +CfgMgr::getStagingCfg() { ensureCurrentAllocated(); if (configuration_->sequenceEquals(*configs_.back())) { uint32_t sequence = configuration_->getSequence(); diff --git a/src/lib/dhcpsrv/cfgmgr.h b/src/lib/dhcpsrv/cfgmgr.h index ef65c912a9..83140f2cb1 100644 --- a/src/lib/dhcpsrv/cfgmgr.h +++ b/src/lib/dhcpsrv/cfgmgr.h @@ -409,7 +409,7 @@ public: /// This function should be called when there is a staging configuration /// (likely created in the previous configuration attempt) but the entirely /// new configuration should be created. It removes the existing staging - /// configuration and the next call to @c CfgMgr::getStaging will return a + /// configuration and the next call to @c CfgMgr::getStagingCfg will return a /// fresh (default) configuration. /// /// This function is exception safe. @@ -422,7 +422,7 @@ public: /// and return it. Current configuration returned is read-only. /// /// @return Non-null const pointer to the current configuration. - ConstConfigurationPtr getCurrent(); + ConstConfigurationPtr getCurrentCfg(); /// @brief Returns a pointer to the staging configuration. /// @@ -436,7 +436,7 @@ public: /// configuration parsers). /// /// @return non-null pointer to the staging configuration. - ConfigurationPtr getStaging(); + ConfigurationPtr getStagingCfg(); //@} diff --git a/src/lib/dhcpsrv/dhcp_parsers.cc b/src/lib/dhcpsrv/dhcp_parsers.cc index d03e38644d..ad01070f5f 100644 --- a/src/lib/dhcpsrv/dhcp_parsers.cc +++ b/src/lib/dhcpsrv/dhcp_parsers.cc @@ -202,7 +202,7 @@ InterfaceListConfigParser::build(ConstElementPtr value) { << ex.what() << " (" << value->getPosition() << ")"); } } - CfgMgr::instance().getStaging()->setCfgIface(cfg_iface); + CfgMgr::instance().getStagingCfg()->setCfgIface(cfg_iface); } void diff --git a/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc b/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc index 9d1c11502c..8be72d935f 100644 --- a/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc @@ -295,11 +295,11 @@ public: // it is empty by default. TEST_F(CfgMgrTest, configuration) { - ConstConfigurationPtr configuration = CfgMgr::instance().getCurrent(); + ConstConfigurationPtr configuration = CfgMgr::instance().getCurrentCfg(); ASSERT_TRUE(configuration); EXPECT_TRUE(configuration->getLoggingInfo().empty()); - configuration = CfgMgr::instance().getStaging(); + configuration = CfgMgr::instance().getStagingCfg(); ASSERT_TRUE(configuration); EXPECT_TRUE(configuration->getLoggingInfo().empty()); } @@ -1134,7 +1134,7 @@ TEST_F(CfgMgrTest, staging) { // that always the same instance is returned. ConstConfigurationPtr const_config; for (int i = 0; i < 5; ++i) { - const_config = cfg_mgr.getCurrent(); + const_config = cfg_mgr.getCurrentCfg(); ASSERT_TRUE(const_config) << "Returned NULL current configuration" " for iteration " << i; EXPECT_EQ(0, const_config->getSequence()) @@ -1142,13 +1142,13 @@ TEST_F(CfgMgrTest, staging) { << const_config->getSequence() << " for iteration " << i; } - // Try to get the new staging configuration. When getStaging() is called + // Try to get the new staging configuration. When getStagingCfg() is called // for the first time the new instance of the staging configuration is - // returned. This instance is returned for every call to getStaging() + // returned. This instance is returned for every call to getStagingCfg() // until commit is called. ConfigurationPtr config; for (int i = 0; i < 5; ++i) { - config = cfg_mgr.getStaging(); + config = cfg_mgr.getStagingCfg(); ASSERT_TRUE(config) << "Returned NULL staging configuration for" " iteration " << i; // The sequence id is 1 for staging because it is ahead of current @@ -1160,7 +1160,7 @@ TEST_F(CfgMgrTest, staging) { // This should change the staging configuration so as it becomes a current // one. CfgMgr::instance().commit(); - const_config = cfg_mgr.getCurrent(); + const_config = cfg_mgr.getCurrentCfg(); ASSERT_TRUE(const_config); // Sequence id equal to 1 indicates that the current configuration points // to the configuration that used to be a staging configuration previously. @@ -1168,7 +1168,7 @@ TEST_F(CfgMgrTest, staging) { // Create a new staging configuration. It should be assigned a new // sequence id. - config = cfg_mgr.getStaging(); + config = cfg_mgr.getStagingCfg(); ASSERT_TRUE(config); EXPECT_EQ(2, config->getSequence()); @@ -1180,7 +1180,7 @@ TEST_F(CfgMgrTest, staging) { } // The current configuration now have sequence number 2. - const_config = cfg_mgr.getCurrent(); + const_config = cfg_mgr.getCurrentCfg(); ASSERT_TRUE(const_config); EXPECT_EQ(2, const_config->getSequence()); @@ -1189,7 +1189,7 @@ TEST_F(CfgMgrTest, staging) { // After clearing configuration we should successfully get the // new staging configuration. - const_config = cfg_mgr.getStaging(); + const_config = cfg_mgr.getStagingCfg(); ASSERT_TRUE(const_config); EXPECT_EQ(1, const_config->getSequence()); } diff --git a/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc b/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc index da8a244a35..66dc811898 100644 --- a/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc +++ b/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().getStaging(); + ConfigurationPtr cfg = CfgMgr::instance().getStagingCfg(); ASSERT_TRUE(cfg); ASSERT_NO_THROW(cfg->getCfgIface().openSockets(CfgIface::V4, 10000)); @@ -262,7 +262,7 @@ TEST_F(DhcpParserTest, interfaceListParserTest) { parser->build(list_element); parser->commit(); - cfg = CfgMgr::instance().getStaging(); + cfg = CfgMgr::instance().getStagingCfg(); ASSERT_NO_THROW(cfg->getCfgIface().openSockets(CfgIface::V4, 10000)); EXPECT_TRUE(test_config.socketOpen("eth0", AF_INET));