isc::data::Element::fromJSON(valid_d2_config);
// Verify that given a valid config we get a successful update result.
- answer = updateConfig(config_set, false);
+ answer = updateConfig(config_set);
isc::config::parseAnswer(rcode, answer);
EXPECT_EQ(0, rcode);
// Verify that given a valid config we get a successful check result.
- answer = updateConfig(config_set, true);
+ answer = checkConfig(config_set);
isc::config::parseAnswer(rcode, answer);
EXPECT_EQ(0, rcode);
// Use an invalid configuration to verify parsing error return.
std::string config = "{ \"bogus\": 1000 } ";
config_set = isc::data::Element::fromJSON(config);
- answer = updateConfig(config_set, false);
+ answer = updateConfig(config_set);
isc::config::parseAnswer(rcode, answer);
EXPECT_EQ(1, rcode);
// Use an invalid configuration to verify checking error return.
- answer = updateConfig(config_set, true);
+ answer = checkConfig(config_set);
isc::config::parseAnswer(rcode, answer);
EXPECT_EQ(1, rcode);
}
initProcess();
isc::data::ConstElementPtr answer;
- answer = updateConfig(module_config, true);
+ answer = checkConfig(module_config);
int rcode = 0;
answer = isc::config::parseAnswer(rcode, answer);
if (rcode != 0) {
getAppName() << "' entry.");
}
- answer = updateConfig(module_config, false);
+ answer = updateConfig(module_config);
int rcode = 0;
isc::config::parseAnswer(rcode, answer);
if (!rcode) {
// Instance method for handling new config
isc::data::ConstElementPtr
-DControllerBase::updateConfig(isc::data::ConstElementPtr new_config,
- bool check_only) {
- return (process_->configure(new_config, check_only));
+DControllerBase::updateConfig(isc::data::ConstElementPtr new_config) {
+ return (process_->configure(new_config, false));
+}
+
+// Instance method for checking new config
+isc::data::ConstElementPtr
+DControllerBase::checkConfig(isc::data::ConstElementPtr new_config) {
+ return (process_->configure(new_config, true));
}
/// configuration and then invoke the application process' configure method.
///
/// @param new_config is the new configuration
- /// @param check_only false for normal configuration, true when verifying only
///
/// @return returns an Element that contains the results of configuration
/// update composed of an integer status value (0 means successful,
/// non-zero means failure), and a string explanation of the outcome.
- virtual isc::data::ConstElementPtr
- updateConfig(isc::data::ConstElementPtr new_config,
- bool check_only = false);
+ virtual isc::data::ConstElementPtr updateConfig(isc::data::ConstElementPtr
+ new_config);
+
+ /// @brief Instance method invoked by the configuration event handler and
+ /// which processes the actual configuration check. Provides behavioral
+ /// path for both integrated and stand-alone modes. The current
+ /// implementation will merge the configuration update into the existing
+ /// configuration and then invoke the application process' configure method
+ /// with a final rollback.
+ ///
+ /// @param new_config is the new configuration
+ ///
+ /// @return returns an Element that contains the results of configuration
+ /// update composed of an integer status value (0 means successful,
+ /// non-zero means failure), and a string explanation of the outcome.
+ virtual isc::data::ConstElementPtr checkConfig(isc::data::ConstElementPtr
+ new_config);
/// @brief Reconfigures the process from a configuration file
///
///
/// It then extracts the set of configuration elements for the
/// module-name that matches the controller's app_name_ and passes that
- /// set into @c updateConfig().
+ /// set into @c updateConfig() (or @c checkConfig()).
///
/// The file may contain an arbitrary number of other modules.
///
isc::data::ElementPtr config_set = isc::data::Element::fromJSON(config);
// Verify that a valid config gets a successful update result.
- answer = updateConfig(config_set, false);
+ answer = updateConfig(config_set);
isc::config::parseAnswer(rcode, answer);
EXPECT_EQ(0, rcode);
// Verify that a valid config gets a successful check result.
- answer = updateConfig(config_set, true);
+ answer = checkConfig(config_set);
isc::config::parseAnswer(rcode, answer);
EXPECT_EQ(0, rcode);
// Verify that an error in process configure method is handled.
SimFailure::set(SimFailure::ftProcessConfigure);
- answer = updateConfig(config_set, false);
+ answer = updateConfig(config_set);
isc::config::parseAnswer(rcode, answer);
EXPECT_EQ(1, rcode);
// Verify that an error is handled too when the config is checked for.
SimFailure::set(SimFailure::ftProcessConfigure);
- answer = updateConfig(config_set, true);
+ answer = checkConfig(config_set);
isc::config::parseAnswer(rcode, answer);
EXPECT_EQ(1, rcode);
}
/// @Wrapper to invoke the Controller's updateConfig method. Please
/// refer to DControllerBase::updateConfig for details.
- isc::data::ConstElementPtr
- updateConfig(isc::data::ConstElementPtr new_config,
- bool check_only) {
- return (getController()->updateConfig(new_config, check_only));
+ isc::data::ConstElementPtr updateConfig(isc::data::ConstElementPtr
+ new_config) {
+ return (getController()->updateConfig(new_config));
+ }
+
+ /// @Wrapper to invoke the Controller's checkConfig method. Please
+ /// refer to DControllerBase::checkConfig for details.
+ isc::data::ConstElementPtr checkConfig(isc::data::ConstElementPtr
+ new_config) {
+ return (getController()->checkConfig(new_config));
}
/// @Wrapper to invoke the Controller's executeCommand method. Please