summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2019-07-16 16:03:23 +0200
committerFrancis Dupont <fdupont@isc.org>2019-07-25 15:08:04 +0200
commit8e34460182515b8637f252cd1cabc131e52479ae (patch)
treea1ec3a81c397aec64edfc3e3c470cdd00788a0dc /src
parent[470-server-tag-get-command] Added server-tag-get and prepared server-tag-set (diff)
downloadkea-8e34460182515b8637f252cd1cabc131e52479ae.tar.xz
kea-8e34460182515b8637f252cd1cabc131e52479ae.zip
[470-server-tag-get-command] Removed the -set stuff and updated doc
Diffstat (limited to 'src')
-rw-r--r--src/bin/dhcp4/ctrl_dhcp4_srv.cc31
-rw-r--r--src/bin/dhcp4/ctrl_dhcp4_srv.h13
-rw-r--r--src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc14
-rw-r--r--src/bin/dhcp6/ctrl_dhcp6_srv.cc31
-rw-r--r--src/bin/dhcp6/ctrl_dhcp6_srv.h13
-rw-r--r--src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc14
-rw-r--r--src/lib/process/d_controller.cc25
-rw-r--r--src/lib/process/d_controller.h12
-rw-r--r--src/lib/process/d_process.h3
9 files changed, 0 insertions, 156 deletions
diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.cc b/src/bin/dhcp4/ctrl_dhcp4_srv.cc
index 7eb7a8377a..b74f149f7d 100644
--- a/src/bin/dhcp4/ctrl_dhcp4_srv.cc
+++ b/src/bin/dhcp4/ctrl_dhcp4_srv.cc
@@ -550,33 +550,6 @@ ControlledDhcpv4Srv::commandServerTagGetHandler(const std::string&,
}
ConstElementPtr
-ControlledDhcpv4Srv::commandServerTagSetHandler(const std::string&,
- ConstElementPtr args) {
- std::string message;
- ConstElementPtr tag;
- if (!args) {
- message = "Missing mandatory 'arguments' parameter.";
- } else {
- tag = args->get("server-tag");
- if (!tag) {
- message = "Missing mandatory 'server-tag' parameter.";
- } else if (tag->getType() != Element::string) {
- message = "'server-tag' parameter expected to be a string.";
- }
- }
-
- if (!message.empty()) {
- // Something is amiss with arguments, return a failure response.
- return (createAnswer(CONTROL_RESULT_ERROR, message));
- }
-
- CfgMgr::instance().getCurrentCfg()->setServerTag(tag->stringValue());
- CfgMgr::instance().getCurrentCfg()->addConfiguredGlobal("server-tag", tag);
- message = "'server-tag' successfully updated.";
- return (createAnswer(CONTROL_RESULT_SUCCESS, message));
-}
-
-ConstElementPtr
ControlledDhcpv4Srv::processCommand(const string& command,
ConstElementPtr args) {
string txt = args ? args->str() : "(none)";
@@ -634,7 +607,6 @@ ControlledDhcpv4Srv::processCommand(const string& command,
return (srv->commandServerTagGetHandler(command, args));
}
- // not yet server-tag-set
ConstElementPtr answer = isc::config::createAnswer(1,
"Unrecognized command:" + command);
return (answer);
@@ -867,8 +839,6 @@ ControlledDhcpv4Srv::ControlledDhcpv4Srv(uint16_t server_port /*= DHCP4_SERVER_P
CommandMgr::instance().registerCommand("server-tag-get",
boost::bind(&ControlledDhcpv4Srv::commandServerTagGetHandler, this, _1, _2));
- // not yet server-tag-set
-
CommandMgr::instance().registerCommand("shutdown",
boost::bind(&ControlledDhcpv4Srv::commandShutdownHandler, this, _1, _2));
@@ -926,7 +896,6 @@ ControlledDhcpv4Srv::~ControlledDhcpv4Srv() {
CommandMgr::instance().deregisterCommand("dhcp-disable");
CommandMgr::instance().deregisterCommand("dhcp-enable");
CommandMgr::instance().deregisterCommand("server-tag-get");
- // not yet server-tag-set
CommandMgr::instance().deregisterCommand("shutdown");
CommandMgr::instance().deregisterCommand("statistic-get");
CommandMgr::instance().deregisterCommand("statistic-get-all");
diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.h b/src/bin/dhcp4/ctrl_dhcp4_srv.h
index 6913a21e9d..e16aefa223 100644
--- a/src/bin/dhcp4/ctrl_dhcp4_srv.h
+++ b/src/bin/dhcp4/ctrl_dhcp4_srv.h
@@ -305,19 +305,6 @@ private:
commandServerTagGetHandler(const std::string& command,
isc::data::ConstElementPtr args);
- /// @brief Handler for processing 'server-tag-set' command
- ///
- /// This handler processes server-tag-set command, which sets
- /// the server tag to the specified value.
- ///
- /// @param command (parameter ignored)
- /// @param args { "server-tag": "<new-value>" } argument map.
- ///
- /// @return status of the command
- isc::data::ConstElementPtr
- commandServerTagSetHandler(const std::string& command,
- isc::data::ConstElementPtr args);
-
/// @brief Reclaims expired IPv4 leases and reschedules timer.
///
/// This is a wrapper method for @c AllocEngine::reclaimExpiredLeases4.
diff --git a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc
index d56f40e35d..9a0cc3ee63 100644
--- a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc
+++ b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc
@@ -484,7 +484,6 @@ TEST_F(CtrlChannelDhcpv4SrvTest, commandsRegistration) {
EXPECT_TRUE(command_list.find("\"leases-reclaim\"") != string::npos);
EXPECT_TRUE(command_list.find("\"libreload\"") != string::npos);
EXPECT_TRUE(command_list.find("\"server-tag-get\"") != string::npos);
- EXPECT_FALSE(command_list.find("\"server-tag-set\"") != string::npos);
EXPECT_TRUE(command_list.find("\"shutdown\"") != string::npos);
EXPECT_TRUE(command_list.find("\"statistic-get\"") != string::npos);
EXPECT_TRUE(command_list.find("\"statistic-get-all\"") != string::npos);
@@ -626,19 +625,6 @@ TEST_F(CtrlChannelDhcpv4SrvTest, serverTagGet) {
expected = "{ \"arguments\": { \"server-tag\": \"foobar\" }, \"result\": 0 }";
}
-// This test verifies that the DHCP server does not handles server-tag-set command
-TEST_F(CtrlChannelDhcpv4SrvTest, serverTagSet) {
- createUnixChannelServer();
-
- std::string response;
-
- // Send the server-tag-set command
- sendUnixCommand("{ \"command\": \"server-tag-set\" }", response);
- std::string expected = "{ \"result\": 2, "
- "\"text\": \"'server-tag-set' command not supported.\" }";
- EXPECT_EQ(expected, response);
-}
-
// This test verifies that the DHCP server immediately removed expired
// This test verifies that the DHCP server immediately removed expired
// leases on leases-reclaim command with remove = true
diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.cc b/src/bin/dhcp6/ctrl_dhcp6_srv.cc
index c9cd6873bc..aba2e9b091 100644
--- a/src/bin/dhcp6/ctrl_dhcp6_srv.cc
+++ b/src/bin/dhcp6/ctrl_dhcp6_srv.cc
@@ -550,33 +550,6 @@ ControlledDhcpv6Srv::commandServerTagGetHandler(const std::string&,
return (createAnswer(CONTROL_RESULT_SUCCESS, response));
}
-ConstElementPtr
-ControlledDhcpv6Srv::commandServerTagSetHandler(const std::string&,
- ConstElementPtr args) {
- std::string message;
- ConstElementPtr tag;
- if (!args) {
- message = "Missing mandatory 'arguments' parameter.";
- } else {
- tag = args->get("server-tag");
- if (!tag) {
- message = "Missing mandatory 'server-tag' parameter.";
- } else if (tag->getType() != Element::string) {
- message = "'server-tag' parameter expected to be a string.";
- }
- }
-
- if (!message.empty()) {
- // Something is amiss with arguments, return a failure response.
- return (createAnswer(CONTROL_RESULT_ERROR, message));
- }
-
- CfgMgr::instance().getCurrentCfg()->setServerTag(tag->stringValue());
- CfgMgr::instance().getCurrentCfg()->addConfiguredGlobal("server-tag", tag);
- message = "'server-tag' successfully updated.";
- return (createAnswer(CONTROL_RESULT_SUCCESS, message));
-}
-
isc::data::ConstElementPtr
ControlledDhcpv6Srv::processCommand(const std::string& command,
isc::data::ConstElementPtr args) {
@@ -635,7 +608,6 @@ ControlledDhcpv6Srv::processCommand(const std::string& command,
return (srv->commandServerTagGetHandler(command, args));
}
- // not yet server-tag-set
return (isc::config::createAnswer(1, "Unrecognized command:"
+ command));
@@ -885,8 +857,6 @@ ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t server_port,
CommandMgr::instance().registerCommand("server-tag-get",
boost::bind(&ControlledDhcpv6Srv::commandServerTagGetHandler, this, _1, _2));
- // not yet server-tag-set
-
CommandMgr::instance().registerCommand("libreload",
boost::bind(&ControlledDhcpv6Srv::commandLibReloadHandler, this, _1, _2));
@@ -949,7 +919,6 @@ ControlledDhcpv6Srv::~ControlledDhcpv6Srv() {
CommandMgr::instance().deregisterCommand("leases-reclaim");
CommandMgr::instance().deregisterCommand("libreload");
CommandMgr::instance().deregisterCommand("server-tag-get");
- // not yet server-tag-set
CommandMgr::instance().deregisterCommand("shutdown");
CommandMgr::instance().deregisterCommand("statistic-get");
CommandMgr::instance().deregisterCommand("statistic-get-all");
diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.h b/src/bin/dhcp6/ctrl_dhcp6_srv.h
index 2ef57278a5..839a8ad33c 100644
--- a/src/bin/dhcp6/ctrl_dhcp6_srv.h
+++ b/src/bin/dhcp6/ctrl_dhcp6_srv.h
@@ -304,19 +304,6 @@ private:
commandServerTagGetHandler(const std::string& command,
isc::data::ConstElementPtr args);
- /// @brief Handler for processing 'server-tag-set' command
- ///
- /// This handler processes server-tag-set command, which sets
- /// the server tag to the specified value.
- ///
- /// @param command (parameter ignored)
- /// @param args { "server-tag": "<new-value>" } argument map.
- ///
- /// @return status of the command
- isc::data::ConstElementPtr
- commandServerTagSetHandler(const std::string& command,
- isc::data::ConstElementPtr args);
-
/// @brief Reclaims expired IPv6 leases and reschedules timer.
///
/// This is a wrapper method for @c AllocEngine::reclaimExpiredLeases6.
diff --git a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc
index 2169ef6477..d0dfb536e8 100644
--- a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc
+++ b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc
@@ -791,7 +791,6 @@ TEST_F(CtrlDhcpv6SrvTest, commandsRegistration) {
EXPECT_TRUE(command_list.find("\"libreload\"") != string::npos);
EXPECT_TRUE(command_list.find("\"config-set\"") != string::npos);
EXPECT_TRUE(command_list.find("\"server-tag-get\"") != string::npos);
- EXPECT_FALSE(command_list.find("\"server-tag-set\"") != string::npos);
EXPECT_TRUE(command_list.find("\"shutdown\"") != string::npos);
EXPECT_TRUE(command_list.find("\"statistic-get\"") != string::npos);
EXPECT_TRUE(command_list.find("\"statistic-get-all\"") != string::npos);
@@ -875,19 +874,6 @@ TEST_F(CtrlChannelDhcpv6SrvTest, serverTagGet) {
expected = "{ \"arguments\": { \"server-tag\": \"foobar\" }, \"result\": 0 }";
}
-// This test verifies that the DHCP server does not handles server-tag-set command
-TEST_F(CtrlChannelDhcpv6SrvTest, serverTagSet) {
- createUnixChannelServer();
-
- std::string response;
-
- // Send the server-tag-set command
- sendUnixCommand("{ \"command\": \"server-tag-set\" }", response);
- std::string expected = "{ \"result\": 2, "
- "\"text\": \"'server-tag-set' command not supported.\" }";
- EXPECT_EQ(expected, response);
-}
-
// This test verifies that the DHCP server immediately reclaims expired
// leases on leases-reclaim command
TEST_F(CtrlChannelDhcpv6SrvTest, controlLeasesReclaim) {
diff --git a/src/lib/process/d_controller.cc b/src/lib/process/d_controller.cc
index 23340f48ab..18e8de242c 100644
--- a/src/lib/process/d_controller.cc
+++ b/src/lib/process/d_controller.cc
@@ -637,31 +637,6 @@ DControllerBase::serverTagGetHandler(const std::string&, ConstElementPtr) {
}
ConstElementPtr
-DControllerBase::serverTagSetHandler(const std::string&, ConstElementPtr args) {
- std::string message;
- ConstElementPtr tag;
- if (!args) {
- message = "Missing mandatory 'arguments' parameter.";
- } else {
- tag = args->get("server-tag");
- if (!tag) {
- message = "Missing mandatory 'server-tag' parameter.";
- } else if (tag->getType() != Element::string) {
- message = "'server-tag' parameter expected to be a string.";
- }
- }
-
- if (!message.empty()) {
- // Failure cases.
- return (createAnswer(COMMAND_ERROR, message));
- }
-
- process_->getCfgMgr()->getContext()->setServerTag(tag->stringValue());
- message = "'server-tag' successfully updated.";
- return (createAnswer(COMMAND_SUCCESS, message));
-}
-
-ConstElementPtr
DControllerBase::versionGetHandler(const std::string&, ConstElementPtr) {
ConstElementPtr answer;
diff --git a/src/lib/process/d_controller.h b/src/lib/process/d_controller.h
index 54e4303e34..6fbbb7c6ac 100644
--- a/src/lib/process/d_controller.h
+++ b/src/lib/process/d_controller.h
@@ -340,18 +340,6 @@ public:
serverTagGetHandler(const std::string& command,
isc::data::ConstElementPtr args);
- /// @brief handler for server-tag-set command
- ///
- /// This method handles the server-tag-set command, which sets
- /// the server tag specified in args parameter.
- ///
- /// @param command (ignored)
- /// @param args (ignored)
- /// @return current configuration wrapped in a response
- isc::data::ConstElementPtr
- serverTagSetHandler(const std::string& command,
- isc::data::ConstElementPtr args);
-
protected:
/// @brief Virtual method that provides derivations the opportunity to
/// support additional command line options. It is invoked during command
diff --git a/src/lib/process/d_process.h b/src/lib/process/d_process.h
index 45b38b9d37..f5de80c46a 100644
--- a/src/lib/process/d_process.h
+++ b/src/lib/process/d_process.h
@@ -49,9 +49,6 @@ static const std::string CONFIG_SET_COMMAND("config-set");
/// @brief String value for the server-tag-get command.
static const std::string SERVER_TAG_GET_COMMAND("server-tag-get");
-/// @brief String value for the server-tag-set command.
-static const std::string SERVER_TAG_SET_COMMAND("server-tag-set");
-
/// @brief String value for the shutdown command.
static const std::string SHUT_DOWN_COMMAND("shutdown");