Commit 2f45d13a authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰
Browse files

[3590] Obsolete code removed.

parent 363690d6
......@@ -10,13 +10,11 @@
#include <dhcp/libdhcp++.h>
#include <dhcpsrv/cfgmgr.h>
#include <dhcpsrv/dhcpsrv_log.h>
#include <stats/stats_mgr.h>
#include <sstream>
#include <string>
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_);
}
......
......@@ -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_;
......
......@@ -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
......
Supports Markdown
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