Commit 892a60a7 authored by Marcin Siodelski's avatar Marcin Siodelski

[3534] Renamed CfgMgr::getCurrent to CfgMgr::getCurrentCfg.

parent 3b2c3ac0
......@@ -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());
......
......@@ -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.
......
......@@ -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
......
......@@ -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.
......
......@@ -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) {
......
......@@ -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.
......
......@@ -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
......
......@@ -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.
......
......@@ -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();
......
......@@ -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();
//@}
......
......@@ -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
......
......@@ -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());
}
......
......@@ -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));
......
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