From: Tomek Mrugalski Date: Thu, 23 Feb 2017 17:31:55 +0000 (+0100) Subject: [3590] Obsolete code removed. X-Git-Tag: trac5137_base~13^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2f45d13a26b02a1add8994406971c3f043076e87;p=thirdparty%2Fkea.git [3590] Obsolete code removed. --- diff --git a/src/lib/dhcpsrv/cfgmgr.cc b/src/lib/dhcpsrv/cfgmgr.cc index 0aaf14da14..bf37710b26 100644 --- a/src/lib/dhcpsrv/cfgmgr.cc +++ b/src/lib/dhcpsrv/cfgmgr.cc @@ -10,13 +10,11 @@ #include #include #include -#include #include #include using namespace isc::asiolink; using namespace isc::util; -using namespace isc::stats; namespace isc { namespace dhcp { @@ -29,35 +27,6 @@ CfgMgr::instance() { return (cfg_mgr); } -void -CfgMgr::addOptionSpace4(const OptionSpacePtr& space) { - if (!space) { - isc_throw(InvalidOptionSpace, - "provided option space object is NULL."); - } - OptionSpaceCollection::iterator it = spaces4_.find(space->getName()); - if (it != spaces4_.end()) { - isc_throw(InvalidOptionSpace, "option space " << space->getName() - << " already added."); - } - spaces4_.insert(make_pair(space->getName(), space)); -} - -void -CfgMgr::addOptionSpace6(const OptionSpacePtr& space) { - if (!space) { - isc_throw(InvalidOptionSpace, - "provided option space object is NULL."); - } - OptionSpaceCollection::iterator it = spaces6_.find(space->getName()); - if (it != spaces6_.end()) { - isc_throw(InvalidOptionSpace, "option space " << space->getName() - << " already added."); - } - spaces6_.insert(make_pair(space->getName(), space)); -} - - std::string CfgMgr::getDataDir() const { return (datadir_); } diff --git a/src/lib/dhcpsrv/cfgmgr.h b/src/lib/dhcpsrv/cfgmgr.h index d76015b0b1..3f1a87aad1 100644 --- a/src/lib/dhcpsrv/cfgmgr.h +++ b/src/lib/dhcpsrv/cfgmgr.h @@ -63,10 +63,9 @@ public: /// and a valid lifetime of 1000s. The second subnet has preferred lifetime /// of 500s, but valid lifetime of 2000s. /// -/// Parameter inheritance is likely to be implemented in configuration handling -/// routines, so there is no storage capability in a global scope for -/// subnet-specific parameters. -/// +/// Parameter inheritance is implemented in dedicated classes. See +/// @ref isc::dhcp::SimpleParser4::deriveParameters and +/// @ref isc::dhcp::SimpleParser6::deriveParameters. class CfgMgr : public boost::noncopyable { public: @@ -81,36 +80,6 @@ public: /// accessing it. static CfgMgr& instance(); - /// @brief Adds new DHCPv4 option space to the collection. - /// - /// @param space option space to be added. - /// - /// @throw isc::dhcp::InvalidOptionSpace invalid option space - /// has been specified. - void addOptionSpace4(const OptionSpacePtr& space); - - /// @brief Adds new DHCPv6 option space to the collection. - /// - /// @param space option space to be added. - /// - /// @throw isc::dhcp::InvalidOptionSpace invalid option space - /// has been specified. - void addOptionSpace6(const OptionSpacePtr& space); - - /// @brief Return option spaces for DHCPv4. - /// - /// @return A collection of option spaces. - const OptionSpaceCollection& getOptionSpaces4() const { - return (spaces4_); - } - - /// @brief Return option spaces for DHCPv6. - /// - /// @return A collection of option spaces. - const OptionSpaceCollection& getOptionSpaces6() const { - return (spaces6_); - } - /// @brief returns path do the data directory /// /// This method returns a path to writable directory that DHCP servers @@ -303,12 +272,6 @@ private: /// default current configuration. void ensureCurrentAllocated(); - /// @brief Container for defined DHCPv6 option spaces. - OptionSpaceCollection spaces6_; - - /// @brief Container for defined DHCPv4 option spaces. - OptionSpaceCollection spaces4_; - /// @brief directory where data files (e.g. server-id) are stored std::string datadir_; diff --git a/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc b/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc index 59082dc2cb..34e5d266a8 100644 --- a/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc @@ -317,72 +317,6 @@ TEST_F(CfgMgrTest, configuration) { EXPECT_TRUE(configuration->getLoggingInfo().empty()); } -// This test verifies that new DHCPv4 option spaces can be added to -// the configuration manager and that duplicated option space is -// rejected. -TEST_F(CfgMgrTest, optionSpace4) { - CfgMgr& cfg_mgr = CfgMgr::instance(); - - // Create some option spaces. - OptionSpacePtr space1(new OptionSpace("isc", false)); - OptionSpacePtr space2(new OptionSpace("xyz", true)); - - // Add option spaces with different names and expect they - // are accepted. - ASSERT_NO_THROW(cfg_mgr.addOptionSpace4(space1)); - ASSERT_NO_THROW(cfg_mgr.addOptionSpace4(space2)); - - // Validate that the option spaces have been added correctly. - const OptionSpaceCollection& spaces = cfg_mgr.getOptionSpaces4(); - - ASSERT_EQ(2, spaces.size()); - EXPECT_FALSE(spaces.find("isc") == spaces.end()); - EXPECT_FALSE(spaces.find("xyz") == spaces.end()); - - // Create another option space with the name that duplicates - // the existing option space. - OptionSpacePtr space3(new OptionSpace("isc", true)); - // Expect that the duplicate option space is rejected. - ASSERT_THROW( - cfg_mgr.addOptionSpace4(space3), isc::dhcp::InvalidOptionSpace - ); - - /// @todo decode if a duplicate vendor space is allowed. -} - -// This test verifies that new DHCPv6 option spaces can be added to -// the configuration manager and that duplicated option space is -// rejected. -TEST_F(CfgMgrTest, optionSpace6) { - CfgMgr& cfg_mgr = CfgMgr::instance(); - - // Create some option spaces. - OptionSpacePtr space1(new OptionSpace("isc", false)); - OptionSpacePtr space2(new OptionSpace("xyz", true)); - - // Add option spaces with different names and expect they - // are accepted. - ASSERT_NO_THROW(cfg_mgr.addOptionSpace6(space1)); - ASSERT_NO_THROW(cfg_mgr.addOptionSpace6(space2)); - - // Validate that the option spaces have been added correctly. - const OptionSpaceCollection& spaces = cfg_mgr.getOptionSpaces6(); - - ASSERT_EQ(2, spaces.size()); - EXPECT_FALSE(spaces.find("isc") == spaces.end()); - EXPECT_FALSE(spaces.find("xyz") == spaces.end()); - - // Create another option space with the name that duplicates - // the existing option space. - OptionSpacePtr space3(new OptionSpace("isc", true)); - // Expect that the duplicate option space is rejected. - ASSERT_THROW( - cfg_mgr.addOptionSpace6(space3), isc::dhcp::InvalidOptionSpace - ); - - /// @todo decide if a duplicate vendor space is allowed. -} - // This test checks the D2ClientMgr wrapper methods. TEST_F(CfgMgrTest, d2ClientConfig) { // After CfgMgr construction, D2ClientMgr member should be initialized