Commit f6ea7fac authored by Marcin Siodelski's avatar Marcin Siodelski

[3588] Removed the setCfgOptionDef modifier.

The modifications to the staging configuration are performed on the pointer
returned by getCfgOptionDef.
parent a0164fae
......@@ -1315,11 +1315,11 @@ TEST_F(Dhcpv4SrvTest, unpackOptions) {
// Add option definitions to the Configuration Manager. Each goes under
// different option space.
CfgOptionDef cfg_option_def;
ASSERT_NO_THROW(cfg_option_def.add(opt_def, "space-foobar"));
ASSERT_NO_THROW(cfg_option_def.add(opt_def2, "space-foo"));
ASSERT_NO_THROW(cfg_option_def.add(opt_def3, "space-bar"));
CfgMgr::instance().getStagingCfg()->setCfgOptionDef(cfg_option_def);
CfgOptionDefPtr cfg_option_def =
CfgMgr::instance().getStagingCfg()->getCfgOptionDef();
ASSERT_NO_THROW(cfg_option_def->add(opt_def, "space-foobar"));
ASSERT_NO_THROW(cfg_option_def->add(opt_def2, "space-foo"));
ASSERT_NO_THROW(cfg_option_def->add(opt_def3, "space-bar"));
CfgMgr::instance().commit();
// Create the buffer holding the structure of options.
......
......@@ -1713,11 +1713,11 @@ TEST_F(Dhcpv6SrvTest, unpackOptions) {
// Add option definitions to the Configuration Manager. Each goes under
// different option space.
CfgOptionDef cfg_option_def;
ASSERT_NO_THROW(cfg_option_def.add(opt_def, "space-foobar"));
ASSERT_NO_THROW(cfg_option_def.add(opt_def2, "space-foo"));
ASSERT_NO_THROW(cfg_option_def.add(opt_def3, "space-bar"));
CfgMgr::instance().getStagingCfg()->setCfgOptionDef(cfg_option_def);
CfgOptionDefPtr cfg_option_def =
CfgMgr::instance().getStagingCfg()->getCfgOptionDef();
ASSERT_NO_THROW(cfg_option_def->add(opt_def, "space-foobar"));
ASSERT_NO_THROW(cfg_option_def->add(opt_def2, "space-foo"));
ASSERT_NO_THROW(cfg_option_def->add(opt_def3, "space-bar"));
CfgMgr::instance().commit();
// Create the buffer holding the structure of options.
......
......@@ -89,7 +89,7 @@ SrvConfig::copy(SrvConfig& new_config) const {
// Replace interface configuration.
new_config.setCfgIface(cfg_iface_);
// Replace option definitions.
new_config.setCfgOptionDef(*cfg_option_def_);
cfg_option_def_->copy(*new_config.cfg_option_def_);
}
void
......
......@@ -163,13 +163,6 @@ public:
return (cfg_option_def_);
}
/// @brief Sets the object representing user-defined option definitions.
///
/// @param cfg_option_def New object representing option definitions.
void setCfgOptionDef(const CfgOptionDef& cfg_option_def) {
*cfg_option_def_ = cfg_option_def;
}
//@}
/// @brief Copies the currnet configuration to a new configuration.
......
......@@ -279,14 +279,10 @@ TEST_F(SrvConfigTest, copy) {
CfgIface cfg_iface;
cfg_iface.use(AF_INET, "eth0");
CfgOptionDef cfg_option_def;
cfg_option_def.add(OptionDefinitionPtr(new OptionDefinition("option-foo", 5,
"string")),
"isc");
conf1.addLoggingInfo(info);
conf1.setCfgIface(cfg_iface);
conf1.setCfgOptionDef(cfg_option_def);
conf1.getCfgOptionDef()->add(OptionDefinitionPtr(new OptionDefinition("option-foo", 5,
"string")), "isc");
// Make sure both configurations are different.
ASSERT_TRUE(conf1 != conf2);
......@@ -346,24 +342,16 @@ TEST_F(SrvConfigTest, equality) {
EXPECT_FALSE(conf1 != conf2);
// Differ by option definitions.
CfgOptionDef cfg_option_def1;
CfgOptionDef cfg_option_def2;
cfg_option_def1.add(OptionDefinitionPtr(new OptionDefinition("option-foo",
123,
"uint16_t")),
"isc");
conf1.setCfgOptionDef(cfg_option_def1);
conf1.getCfgOptionDef()->
add(OptionDefinitionPtr(new OptionDefinition("option-foo", 123,
"uint16_t")), "isc");
EXPECT_FALSE(conf1 == conf2);
EXPECT_TRUE(conf1 != conf2);
cfg_option_def2.add(OptionDefinitionPtr(new OptionDefinition("option-foo",
123,
"uint16_t")),
"isc");
conf2.setCfgOptionDef(cfg_option_def2);
conf2.getCfgOptionDef()->
add(OptionDefinitionPtr(new OptionDefinition("option-foo", 123,
"uint16_t")), "isc");
EXPECT_TRUE(conf1 == conf2);
EXPECT_FALSE(conf1 != conf2);
}
......
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