Commit 8e344601 authored by Francis Dupont's avatar Francis Dupont

[470-server-tag-get-command] Removed the -set stuff and updated doc

parent d4a8accc
......@@ -155,7 +155,8 @@ EXTRA_DIST += api/remote-subnet6-list.json
EXTRA_DIST += api/remote-subnet6-set.json
EXTRA_DIST += api/reservation-add.json api/reservation-del.json
EXTRA_DIST += api/reservation-get.json api/reservation-get-all.json
EXTRA_DIST += api/reservation-get-page.json api/shutdown.json
EXTRA_DIST += api/reservation-get-page.json
EXTRA_DIST += api/server-tag-get.json api/shutdown.json
EXTRA_DIST += api/remote-server4-del.json
EXTRA_DIST += api/remote-server4-get.json
EXTRA_DIST += api/remote-server4-get-all.json
......
{
"name": "server-tag-get",
"brief": "The server-tag-get command returns the server tag.",
"description": "See <xref linkend=\"command-server-tag-get\"/>",
"support": [ "kea-dhcp4", "kea-dhcp6", "kea-dhcp-ddns", "kea-ctrl-agent" ],
"avail": "1.6.0",
"cmd-syntax": "{
\"command\": \"server-tag-get\"
}"
}
......@@ -4,7 +4,7 @@
Kea version. The returned string is the same as if Kea would
be run with -V command line option.",
"description": "See <xref linkend=\"command-version-get\"/>",
"support": [ "kea-dhcp4", "kea-dhcp6", "kea-dhcp-ddns", "kea-ctrl-agent" ],
"support": [ "kea-dhcp4", "kea-dhcp6" ],
"avail": "1.2.0",
"cmd-syntax": "{
\"command\": \"version-get\"
......
......@@ -120,6 +120,7 @@
, <command><link linkend="ref-reservation-get">reservation-get</link></command>
, <command><link linkend="ref-reservation-get-all">reservation-get-all</link></command>
, <command><link linkend="ref-reservation-get-page">reservation-get-page</link></command>
, <command><link linkend="ref-server-tag-get">server-tag-get</link></command>
, <command><link linkend="ref-shutdown">shutdown</link></command>
, <command><link linkend="ref-stat-lease4-get">stat-lease4-get</link></command>
, <command><link linkend="ref-stat-lease6-get">stat-lease6-get</link></command>
......@@ -148,8 +149,8 @@
, <command><link linkend="ref-config-test">config-test</link></command>
, <command><link linkend="ref-config-write">config-write</link></command>
, <command><link linkend="ref-list-commands">list-commands</link></command>
, <command><link linkend="ref-server-tag-get">server-tag-get</link></command>
, <command><link linkend="ref-shutdown">shutdown</link></command>
, <command><link linkend="ref-version-get">version-get</link></command>
.</para>
<para xml:id="commands-kea-dhcp-ddns">Commands supported by kea-dhcp-ddns daemon: <command><link linkend="ref-build-report">build-report</link></command>
, <command><link linkend="ref-config-get">config-get</link></command>
......@@ -158,8 +159,8 @@
, <command><link linkend="ref-config-test">config-test</link></command>
, <command><link linkend="ref-config-write">config-write</link></command>
, <command><link linkend="ref-list-commands">list-commands</link></command>
, <command><link linkend="ref-server-tag-get">server-tag-get</link></command>
, <command><link linkend="ref-shutdown">shutdown</link></command>
, <command><link linkend="ref-version-get">version-get</link></command>
.</para>
<para xml:id="commands-kea-dhcp4">Commands supported by kea-dhcp4 daemon: <command><link linkend="ref-build-report">build-report</link></command>
, <command><link linkend="ref-cache-clear">cache-clear</link></command>
......@@ -232,6 +233,7 @@
, <command><link linkend="ref-reservation-get">reservation-get</link></command>
, <command><link linkend="ref-reservation-get-all">reservation-get-all</link></command>
, <command><link linkend="ref-reservation-get-page">reservation-get-page</link></command>
, <command><link linkend="ref-server-tag-get">server-tag-get</link></command>
, <command><link linkend="ref-shutdown">shutdown</link></command>
, <command><link linkend="ref-stat-lease4-get">stat-lease4-get</link></command>
, <command><link linkend="ref-statistic-get">statistic-get</link></command>
......@@ -319,6 +321,7 @@
, <command><link linkend="ref-reservation-get">reservation-get</link></command>
, <command><link linkend="ref-reservation-get-all">reservation-get-all</link></command>
, <command><link linkend="ref-reservation-get-page">reservation-get-page</link></command>
, <command><link linkend="ref-server-tag-get">server-tag-get</link></command>
, <command><link linkend="ref-shutdown">shutdown</link></command>
, <command><link linkend="ref-stat-lease6-get">stat-lease6-get</link></command>
, <command><link linkend="ref-statistic-get">statistic-get</link></command>
......@@ -5427,6 +5430,41 @@ Result is an integer representation of the status. Currently supported statuses
</section>
<!-- end of reservation-get-page -->
<!-- start of server-tag-get -->
<section xml:id="reference-server-tag-get">
<title>server-tag-get reference</title>
<para xml:id="ref-server-tag-get"><command>server-tag-get</command> - The server-tag-get command returns the server tag.</para>
<para>Supported by: <command><link linkend="commands-kea-dhcp4">kea-dhcp4</link></command>, <command><link linkend="commands-kea-dhcp6">kea-dhcp6</link></command>, <command><link linkend="commands-kea-dhcp-ddns">kea-dhcp-ddns</link></command>, <command><link linkend="commands-kea-ctrl-agent">kea-ctrl-agent</link></command></para>
<para>Availability: 1.6.0 (built-in)</para>
<para>Description and examples: See <xref linkend="command-server-tag-get"/></para>
<para>Command syntax:
<screen>{
"command": "server-tag-get"
}</screen>
</para>
<para>Response syntax:
<screen>{
"result": &lt;integer&gt;,
"text": &lt;string&gt;
}
</screen>
Result is an integer representation of the status. Currently supported statuses are:
<itemizedlist>
<listitem><para>0 - success</para></listitem>
<listitem><para>1 - error</para></listitem>
<listitem><para>2 - unsupported</para></listitem>
<listitem><para>3 - empty (command was completed successfully, but no data was affected or returned)</para></listitem>
</itemizedlist>
</para>
</section>
<!-- end of server-tag-get -->
<!-- start of shutdown -->
<section xml:id="reference-shutdown">
<title>shutdown reference</title>
......@@ -6247,7 +6285,7 @@ Result is an integer representation of the status. Currently supported statuses
Kea version. The returned string is the same as if Kea would
be run with -V command line option.</para>
<para>Supported by: <command><link linkend="commands-kea-dhcp4">kea-dhcp4</link></command>, <command><link linkend="commands-kea-dhcp6">kea-dhcp6</link></command>, <command><link linkend="commands-kea-dhcp-ddns">kea-dhcp-ddns</link></command>, <command><link linkend="commands-kea-ctrl-agent">kea-ctrl-agent</link></command></para>
<para>Supported by: <command><link linkend="commands-kea-dhcp4">kea-dhcp4</link></command>, <command><link linkend="commands-kea-dhcp6">kea-dhcp6</link></command></para>
<para>Availability: 1.2.0 (built-in)</para>
......
......@@ -588,7 +588,20 @@ $ curl -X POST -H "Content-Type: application/json" -d '{ "command": "config-get"
"command": "version-get"
}
</screen>
</section> <!-- end of command-version-get -->
</section> <!-- end of command-server-tag-get -->
<section xml:id="command-server-tag-get">
<title>server-tag-get</title>
<para>
The <emphasis>server-tag-get</emphasis> command returns
the server tag. This command does not take any parameters.
</para>
<screen>
{
"command": "server-tag-get"
}
</screen>
</section> <!-- end of command-server-tag-get -->
</section> <!-- end of commands supported by both servers -->
......
......@@ -5445,6 +5445,7 @@ autogenerated IDs are not stable across configuration changes.</para>
<listitem>dhcp-enable</listitem>
<listitem>leases-reclaim</listitem>
<listitem>list-commands</listitem>
<listitem>server-tag-get</listitem>
<listitem>shutdown</listitem>
<listitem>version-get</listitem>
</itemizedlist>
......
......@@ -5480,6 +5480,7 @@ autogenerated IDs are not stable across configuration changes.
<listitem>dhcp-enable</listitem>
<listitem>leases-reclaim</listitem>
<listitem>list-commands</listitem>
<listitem>server-tag-get</listitem>
<listitem>shutdown</listitem>
<listitem>version-get</listitem>
</itemizedlist>
......
......@@ -549,33 +549,6 @@ ControlledDhcpv4Srv::commandServerTagGetHandler(const std::string&,
return (createAnswer(CONTROL_RESULT_SUCCESS, response));
}
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) {
......@@ -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");
......
......@@ -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.
......
......@@ -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
......
......@@ -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");
......
......@@ -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.
......
......@@ -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) {
......
......@@ -636,31 +636,6 @@ DControllerBase::serverTagGetHandler(const std::string&, ConstElementPtr) {
return (createAnswer(COMMAND_SUCCESS, response));
}
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;
......
......@@ -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
......
......@@ -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");
......
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