// 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());
}
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.
// 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
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.
ASSERT_TRUE(status);
checkResult(status, 0);
- CfgMgr::instance().getStaging()->
+ CfgMgr::instance().getStagingCfg()->
getCfgIface().openSockets(CfgIface::V4, 10000);
// All interfaces should be now active.
// 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) {
}
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.
// 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
// 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.
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.
}
ConstConfigurationPtr
-CfgMgr::getCurrent() {
+CfgMgr::getCurrentCfg() {
ensureCurrentAllocated();
return (configuration_);
}
ConfigurationPtr
-CfgMgr::getStaging() {
+CfgMgr::getStagingCfg() {
ensureCurrentAllocated();
if (configuration_->sequenceEquals(*configs_.back())) {
uint32_t sequence = configuration_->getSequence();
/// 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.
/// 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.
///
/// configuration parsers).
///
/// @return non-null pointer to the staging configuration.
- ConfigurationPtr getStaging();
+ ConfigurationPtr getStagingCfg();
//@}
<< ex.what() << " (" << value->getPosition() << ")");
}
}
- CfgMgr::instance().getStaging()->setCfgIface(cfg_iface);
+ CfgMgr::instance().getStagingCfg()->setCfgIface(cfg_iface);
}
void
// 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());
}
// 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())
<< 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
// 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.
// 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());
}
// 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());
// 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());
}
// 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));
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));