statistic-remove-all
statistic-reset
statistic-reset-all
-statistic-set-max-sample-age
-statistic-set-max-sample-age-all
-statistic-set-max-sample-count
-statistic-set-max-sample-count-all
+statistic-sample-age-set
+statistic-sample-age-set-all
+statistic-sample-count-set
+statistic-sample-count-set-all
subnet4-add
subnet4-del
subnet4-get
{
- "name": "statistic-set-max-sample-age-all",
- "brief": "The statistic-set-max-sample-age-all command sets time based limit for all statistics. It takes a single integer parameter called duration.",
- "description": "See <xref linkend=\"command-statistic-set-max-sample-age-all\"/>",
+ "name": "statistic-sample-age-set-all",
+ "brief": "The statistic-sample-age-set-all command sets time based limit for all statistics. It takes a single integer parameter called duration.",
+ "description": "See <xref linkend=\"command-statistic-sample-age-set-all\"/>",
"support": [ "kea-dhcp4", "kea-dhcp6" ],
"avail": "1.6.0",
"cmd-syntax": "{
- \"command\": \"statistic-set-max-sample-age-all\",
+ \"command\": \"statistic-sample-age-set-all\",
\"arguments\": {
\"duration\": 1245
}
{
- "name": "statistic-set-max-sample-age",
- "brief": "The statistic-set-max-sample-age command sets time based limit for single statistic. It takes two parameters: a string called name and an integer value called duration.",
- "description": "See <xref linkend=\"command-statistic-set-max-sample-age\"/>",
+ "name": "statistic-sample-age-set",
+ "brief": "The statistic-sample-age-set command sets time based limit for single statistic. It takes two parameters: a string called name and an integer value called duration.",
+ "description": "See <xref linkend=\"command-statistic-sample-age-set\"/>",
"support": [ "kea-dhcp4", "kea-dhcp6" ],
"avail": "1.6.0",
"cmd-syntax": "{
- \"command\": \"statistic-set-max-sample-age\",
+ \"command\": \"statistic-sample-age-set\",
\"arguments\": {
\"name\": \"pkt4-received\",
\"duration\": 1245
{
- "name": "statistic-set-max-sample-count-all",
- "brief": "The statistic-set-max-sample-count-all command sets size based limit for all statistics. It takes a single integer parameter called max-samples.",
- "description": "See <xref linkend=\"command-statistic-set-max-sample-count-all\"/>",
+ "name": "statistic-sample-count-set-all",
+ "brief": "The statistic-sample-count-set-all command sets size based limit for all statistics. It takes a single integer parameter called max-samples.",
+ "description": "See <xref linkend=\"command-statistic-sample-count-set-all\"/>",
"support": [ "kea-dhcp4", "kea-dhcp6" ],
"avail": "1.6.0",
"cmd-syntax": "{
- \"command\": \"statistic-set-max-sample-count-all\",
+ \"command\": \"statistic-sample-count-set-all\",
\"arguments\": {
\"max-samples\": 100
}
{
- "name": "statistic-set-max-sample-count",
- "brief": "The statistic-set-max-sample-count command sets size based limit for single statistic. It takes two parameters: a string called name and an integer value called max-samples.",
- "description": "See <xref linkend=\"command-statistic-set-max-sample-count\"/>",
+ "name": "statistic-sample-count-set",
+ "brief": "The statistic-sample-count-set command sets size based limit for single statistic. It takes two parameters: a string called name and an integer value called max-samples.",
+ "description": "See <xref linkend=\"command-statistic-sample-count-set\"/>",
"support": [ "kea-dhcp4", "kea-dhcp6" ],
"avail": "1.6.0",
"cmd-syntax": "{
- \"command\": \"statistic-set-max-sample-count\",
+ \"command\": \"statistic-sample-count-set\",
\"arguments\": {
\"name\": \"pkt4-received\",
\"max-samples\": 100
error is encountered, the server returns a status code of 1 (error) and
the text field contains the error description.
-.. _command-statistic-set-max-sample-age:
+.. _command-statistic-sample-age-set:
-The statistic-set-max-sample-age Command
+The statistic-sample-age-set Command
----------------------------------------
-The ``statistic-set-max-sample-age`` command sets time based limit
+The ``statistic-sample-age-set`` command sets time based limit
for collecting samples for given statistic. An example command may look
like this:
::
{
- "command": "statistic-set-max-sample-age",
+ "command": "statistic-sample-age-set",
"arguments": {
"name": "pkt4-received",
"duration": 1245
requested statistic was not found), the server returns a status code
of 1 (error) and the text field contains the error description.
-.. _command-statistic-set-max-sample-age-all:
+.. _command-statistic-sample-age-set-all:
-The statistic-set-max-sample-age-all Command
+The statistic-sample-age-set-all Command
--------------------------------------------
-The ``statistic-set-max-sample-age-all`` command sets time based limits
+The ``statistic-sample-age-set-all`` command sets time based limits
for collecting samples for all statistics. An example command may look
like this:
::
{
- "command": "statistic-set-max-sample-age-all",
+ "command": "statistic-sample-age-set-all",
"arguments": {
"duration": 1245
}
and an empty parameters field. If an error is encountered, the server returns
a status code of 1 (error) and the text field contains the error description.
-.. _command-statistic-set-max-sample-count:
+.. _command-statistic-sample-count-set:
-The statistic-set-max-sample-count Command
+The statistic-sample-count-set Command
------------------------------------------
-The ``statistic-set-max-sample-count`` command sets size based limit
+The ``statistic-sample-count-set`` command sets size based limit
for collecting samples for given statistic. An example command may look
like this:
::
{
- "command": "statistic-set-max-sample-count",
+ "command": "statistic-sample-count-set",
"arguments": {
"name": "pkt4-received",
"max-samples": 100
requested statistic was not found), the server returns a status code
of 1 (error) and the text field contains the error description.
-.. _command-statistic-set-max-sample-count-all:
+.. _command-statistic-sample-count-set-all:
-The statistic-set-max-sample-count-all Command
+The statistic-sample-count-set-all Command
----------------------------------------------
-The ``statistic-set-max-sample-count-all`` command sets size based limits
+The ``statistic-sample-count-set-all`` command sets size based limits
for collecting samples for all statistics. An example command may look
like this:
::
{
- "command": "statistic-set-max-sample-count-all",
+ "command": "statistic-sample-count-set-all",
"arguments": {
"max-samples": 100
}
limit prevent unlimited memory consumption growth.
There are two ways to define the limts: time based (e.g. keep samples from
the last 5 minutes) and size based. It's possible to change the size based
-limit by using one of two commands: ``statistic-set-max-sample-count``,
-to set size limit for single statistic and ``statistic-set-max-sample-count-all``
+limit by using one of two commands: ``statistic-sample-count-set``,
+to set size limit for single statistic and ``statistic-sample-count-set-all``
for setting size based limits for all statistics. To set time based
-limit for single statistic use ``statistic-set-max-sample-age``,
-and ``statistic-set-max-sample-age-all`` to set time based limits for all statistics.
-For given statistic only one type of limit can be active. It means that
-storage is limited only by time based limit or size based, never by both of them.
+limit for single statistic use ``statistic-sample-age-set``, and
+``statistic-sample-age-set-all`` to set time based limits for all statistics.
+For given statistic only one type of limit can be active. It means that storage
+is limited only by time based limit or size based, never by both of them.
CommandMgr::instance().registerCommand("statistic-remove-all",
boost::bind(&StatsMgr::statisticRemoveAllHandler, _1, _2));
- CommandMgr::instance().registerCommand("statistic-set-max-sample-age",
+ CommandMgr::instance().registerCommand("statistic-sample-age-set",
boost::bind(&StatsMgr::statisticSetMaxSampleAgeHandler, _1, _2));
- CommandMgr::instance().registerCommand("statistic-set-max-sample-count",
- boost::bind(&StatsMgr::statisticSetMaxSampleCountHandler, _1, _2));
-
- CommandMgr::instance().registerCommand("statistic-set-max-sample-age-all",
+ CommandMgr::instance().registerCommand("statistic-sample-age-set-all",
boost::bind(&StatsMgr::statisticSetMaxSampleAgeAllHandler, _1, _2));
- CommandMgr::instance().registerCommand("statistic-set-max-sample-count-all",
+ CommandMgr::instance().registerCommand("statistic-sample-count-set",
+ boost::bind(&StatsMgr::statisticSetMaxSampleCountHandler, _1, _2));
+
+ CommandMgr::instance().registerCommand("statistic-sample-count-set-all",
boost::bind(&StatsMgr::statisticSetMaxSampleCountAllHandler, _1, _2));
}
CommandMgr::instance().deregisterCommand("statistic-remove-all");
CommandMgr::instance().deregisterCommand("statistic-reset");
CommandMgr::instance().deregisterCommand("statistic-reset-all");
- CommandMgr::instance().deregisterCommand("statistic-set-max-sample-age");
- CommandMgr::instance().deregisterCommand("statistic-set-max-sample-count");
- CommandMgr::instance().deregisterCommand("statistic-set-max-sample-age-all");
- CommandMgr::instance().deregisterCommand("statistic-set-max-sample-count-all");
+ CommandMgr::instance().deregisterCommand("statistic-sample-age-set");
+ CommandMgr::instance().deregisterCommand("statistic-sample-age-set-all");
+ CommandMgr::instance().deregisterCommand("statistic-sample-count-set");
+ CommandMgr::instance().deregisterCommand("statistic-sample-count-set-all");
CommandMgr::instance().deregisterCommand("version-get");
} catch (...) {
EXPECT_TRUE(command_list.find("\"statistic-remove-all\"") != string::npos);
EXPECT_TRUE(command_list.find("\"statistic-reset\"") != string::npos);
EXPECT_TRUE(command_list.find("\"statistic-reset-all\"") != string::npos);
- EXPECT_TRUE(command_list.find("\"statistic-set-max-sample-age\"") != string::npos);
- EXPECT_TRUE(command_list.find("\"statistic-set-max-sample-age-all\"") != string::npos);
- EXPECT_TRUE(command_list.find("\"statistic-set-max-sample-count\"") != string::npos);
- EXPECT_TRUE(command_list.find("\"statistic-set-max-sample-count-all\"") != string::npos);
+ EXPECT_TRUE(command_list.find("\"statistic-sample-age-set\"") != string::npos);
+ EXPECT_TRUE(command_list.find("\"statistic-sample-age-set-all\"") != string::npos);
+ EXPECT_TRUE(command_list.find("\"statistic-sample-count-set\"") != string::npos);
+ EXPECT_TRUE(command_list.find("\"statistic-sample-count-set-all\"") != string::npos);
EXPECT_TRUE(command_list.find("\"version-get\"") != string::npos);
// Ok, and now delete the server. It should deregister its commands.
EXPECT_EQ("{ \"result\": 0, \"text\": \"All statistics removed.\" }",
response);
- // Check statistic-set-max-sample-age
- sendUnixCommand("{ \"command\" : \"statistic-set-max-sample-age\", "
+ // Check statistic-sample-age-set
+ sendUnixCommand("{ \"command\" : \"statistic-sample-age-set\", "
" \"arguments\": {"
" \"name\":\"bogus\", \"duration\": 1245 }}", response);
EXPECT_EQ("{ \"result\": 1, \"text\": \"No 'bogus' statistic found\" }",
response);
- // Check statistic-set-max-sample-age-all
- sendUnixCommand("{ \"command\" : \"statistic-set-max-sample-age-all\", "
+ // Check statistic-sample-age-set-all
+ sendUnixCommand("{ \"command\" : \"statistic-sample-age-set-all\", "
" \"arguments\": {"
" \"duration\": 1245 }}", response);
EXPECT_EQ("{ \"result\": 0, \"text\": \"All statistics duration limit are set.\" }",
response);
- // Check statistic-set-max-sample-count
- sendUnixCommand("{ \"command\" : \"statistic-set-max-sample-count\", "
+ // Check statistic-sample-count-set
+ sendUnixCommand("{ \"command\" : \"statistic-sample-count-set\", "
" \"arguments\": {"
" \"name\":\"bogus\", \"max-samples\": 100 }}", response);
EXPECT_EQ("{ \"result\": 1, \"text\": \"No 'bogus' statistic found\" }",
response);
- // Check statistic-set-max-sample-count-all
- sendUnixCommand("{ \"command\" : \"statistic-set-max-sample-count-all\", "
+ // Check statistic-sample-count-set-all
+ sendUnixCommand("{ \"command\" : \"statistic-sample-count-set-all\", "
" \"arguments\": {"
" \"max-samples\": 100 }}", response);
EXPECT_EQ("{ \"result\": 0, \"text\": \"All statistics count limit are set.\" }",
checkListCommands(rsp, "statistic-remove-all");
checkListCommands(rsp, "statistic-reset");
checkListCommands(rsp, "statistic-reset-all");
- checkListCommands(rsp, "statistic-set-max-sample-age");
- checkListCommands(rsp, "statistic-set-max-sample-age-all");
- checkListCommands(rsp, "statistic-set-max-sample-count");
- checkListCommands(rsp, "statistic-set-max-sample-count-all");
+ checkListCommands(rsp, "statistic-sample-age-set");
+ checkListCommands(rsp, "statistic-sample-age-set-all");
+ checkListCommands(rsp, "statistic-sample-count-set");
+ checkListCommands(rsp, "statistic-sample-count-set-all");
checkListCommands(rsp, "version-get");
}
CommandMgr::instance().registerCommand("statistic-remove-all",
boost::bind(&StatsMgr::statisticRemoveAllHandler, _1, _2));
- CommandMgr::instance().registerCommand("statistic-set-max-sample-age",
+ CommandMgr::instance().registerCommand("statistic-sample-age-set",
boost::bind(&StatsMgr::statisticSetMaxSampleAgeHandler, _1, _2));
- CommandMgr::instance().registerCommand("statistic-set-max-sample-count",
- boost::bind(&StatsMgr::statisticSetMaxSampleCountHandler, _1, _2));
-
- CommandMgr::instance().registerCommand("statistic-set-max-sample-age-all",
+ CommandMgr::instance().registerCommand("statistic-sample-age-set-all",
boost::bind(&StatsMgr::statisticSetMaxSampleAgeAllHandler, _1, _2));
- CommandMgr::instance().registerCommand("statistic-set-max-sample-count-all",
+ CommandMgr::instance().registerCommand("statistic-sample-count-set",
+ boost::bind(&StatsMgr::statisticSetMaxSampleCountHandler, _1, _2));
+
+ CommandMgr::instance().registerCommand("statistic-sample-count-set-all",
boost::bind(&StatsMgr::statisticSetMaxSampleCountAllHandler, _1, _2));
}
CommandMgr::instance().deregisterCommand("statistic-remove-all");
CommandMgr::instance().deregisterCommand("statistic-reset");
CommandMgr::instance().deregisterCommand("statistic-reset-all");
- CommandMgr::instance().deregisterCommand("statistic-set-max-sample-age");
- CommandMgr::instance().deregisterCommand("statistic-set-max-sample-count");
- CommandMgr::instance().deregisterCommand("statistic-set-max-sample-age-all");
- CommandMgr::instance().deregisterCommand("statistic-set-max-sample-count-all");
+ CommandMgr::instance().deregisterCommand("statistic-sample-age-set");
+ CommandMgr::instance().deregisterCommand("statistic-sample-age-set-all");
+ CommandMgr::instance().deregisterCommand("statistic-sample-count-set");
+ CommandMgr::instance().deregisterCommand("statistic-sample-count-set-all");
CommandMgr::instance().deregisterCommand("version-get");
} catch (...) {
EXPECT_TRUE(command_list.find("\"statistic-remove-all\"") != string::npos);
EXPECT_TRUE(command_list.find("\"statistic-reset\"") != string::npos);
EXPECT_TRUE(command_list.find("\"statistic-reset-all\"") != string::npos);
- EXPECT_TRUE(command_list.find("\"statistic-set-max-sample-age\"") != string::npos);
- EXPECT_TRUE(command_list.find("\"statistic-set-max-sample-age-all\"") != string::npos);
- EXPECT_TRUE(command_list.find("\"statistic-set-max-sample-count\"") != string::npos);
- EXPECT_TRUE(command_list.find("\"statistic-set-max-sample-count-all\"") != string::npos);
+ EXPECT_TRUE(command_list.find("\"statistic-sample-age-set\"") != string::npos);
+ EXPECT_TRUE(command_list.find("\"statistic-sample-age-set-all\"") != string::npos);
+ EXPECT_TRUE(command_list.find("\"statistic-sample-count-set\"") != string::npos);
+ EXPECT_TRUE(command_list.find("\"statistic-sample-count-set-all\"") != string::npos);
EXPECT_TRUE(command_list.find("\"version-get\"") != string::npos);
// Ok, and now delete the server. It should deregister its commands.
EXPECT_EQ("{ \"result\": 0, \"text\": \"All statistics removed.\" }",
response);
- // Check statistic-set-max-sample-age
- sendUnixCommand("{ \"command\" : \"statistic-set-max-sample-age\", "
+ // Check statistic-sample-age-set
+ sendUnixCommand("{ \"command\" : \"statistic-sample-age-set\", "
" \"arguments\": {"
" \"name\":\"bogus\", \"duration\": 1245 }}", response);
EXPECT_EQ("{ \"result\": 1, \"text\": \"No 'bogus' statistic found\" }",
response);
- // Check statistic-set-max-sample-age-all
- sendUnixCommand("{ \"command\" : \"statistic-set-max-sample-age-all\", "
+ // Check statistic-sample-age-set-all
+ sendUnixCommand("{ \"command\" : \"statistic-sample-age-set-all\", "
" \"arguments\": {"
" \"duration\": 1245 }}", response);
EXPECT_EQ("{ \"result\": 0, \"text\": \"All statistics duration limit are set.\" }",
response);
- // Check statistic-set-max-sample-count
- sendUnixCommand("{ \"command\" : \"statistic-set-max-sample-count\", "
+ // Check statistic-sample-count-set
+ sendUnixCommand("{ \"command\" : \"statistic-sample-count-set\", "
" \"arguments\": {"
" \"name\":\"bogus\", \"max-samples\": 100 }}", response);
EXPECT_EQ("{ \"result\": 1, \"text\": \"No 'bogus' statistic found\" }",
response);
- // Check statistic-set-max-sample-count-all
- sendUnixCommand("{ \"command\" : \"statistic-set-max-sample-count-all\", "
+ // Check statistic-sample-count-set-all
+ sendUnixCommand("{ \"command\" : \"statistic-sample-count-set-all\", "
" \"arguments\": {"
" \"max-samples\": 100 }}", response);
EXPECT_EQ("{ \"result\": 0, \"text\": \"All statistics count limit are set.\" }",
checkListCommands(rsp, "statistic-remove-all");
checkListCommands(rsp, "statistic-reset");
checkListCommands(rsp, "statistic-reset-all");
- checkListCommands(rsp, "statistic-set-max-sample-age");
- checkListCommands(rsp, "statistic-set-max-sample-age-all");
- checkListCommands(rsp, "statistic-set-max-sample-count");
- checkListCommands(rsp, "statistic-set-max-sample-count-all");
+ checkListCommands(rsp, "statistic-sample-age-set");
+ checkListCommands(rsp, "statistic-sample-age-set-all");
+ checkListCommands(rsp, "statistic-sample-count-set");
+ checkListCommands(rsp, "statistic-sample-count-set-all");
}
// Tests if the server returns its configuration using config-get.
statisticRemoveHandler(const std::string& name,
const isc::data::ConstElementPtr& params);
- /// @brief Handles statistic-set-max-sample-age command
+ /// @brief Handles statistic-sample-age-set command
///
- /// This method handles statistic-set-max-sample-age command,
+ /// This method handles statistic-sample-age-set command,
/// which set max_sample_age_ limit of a given statistic
/// and leaves max_sample_count_ disabled.
/// It expects two parameters stored in params map:
/// "duration": 1245
/// }
///
- /// @param name name of the command (ignored, should be "statistic-set-max-sample-age")
+ /// @param name name of the command (ignored, should be "statistic-sample-age-set")
/// @param params structure containing a map that contains "name" and "duration"
/// @return answer containing information about successfully setup limit of statistic
static isc::data::ConstElementPtr
statisticSetMaxSampleAgeHandler(const std::string& name,
const isc::data::ConstElementPtr& params);
- /// @brief Handles statistic-set-max-sample-count command
+ /// @brief Handles statistic-sample-count-set command
///
- /// This method handles statistic-set-max-sample-count command,
+ /// This method handles statistic-sample-count-set command,
/// which set max_sample_count_ limit of a given statistic
/// and leaves max_sample_age_ disabled.
/// It expects two parameters stored in params map:
/// "max-samples": 15
/// }
///
- /// @param name name of the command (ignored, should be "statistic-set-max-sample-count")
+ /// @param name name of the command (ignored, should be "statistic-sample-count-set")
/// @param params structure containing a map that contains "name" and "max-samples"
/// @return answer containing information about successfully setup limit of statistic
static isc::data::ConstElementPtr
statisticRemoveAllHandler(const std::string& name,
const isc::data::ConstElementPtr& params);
- /// @brief Handles statistic-set-max-sample-age-all command
+ /// @brief Handles statistic-sample-age-set-all command
///
- /// This method handles statistic-set-max-sample-age-all command,
+ /// This method handles statistic-sample-age-set-all command,
/// which set max_sample_age_ limit to all statistics.
/// It expects one parameter stored in params map:
/// duration: limit expressed as a number of seconds
/// "duration": 1245
/// }
///
- /// @param name name of the command (ignored, should be "statistic-set-max-sample-age-all")
+ /// @param name name of the command (ignored, should be "statistic-sample-age-set-all")
/// @param params structure containing a map that contains "duration"
/// @return answer confirming success of this operation
static isc::data::ConstElementPtr
statisticSetMaxSampleAgeAllHandler(const std::string& name,
const isc::data::ConstElementPtr& params);
- /// @brief Handles statistic-set-max-sample-count-all command
+ /// @brief Handles statistic-sample-count-set-all command
///
- /// This method handles statistic-set-max-sample-count-all command,
+ /// This method handles statistic-sample-count-set-all command,
/// which set max_sample_count_ limit of a given statistic
/// and leaves max_sample_age_ disabled.
/// It expects one parameter stored in params map:
/// "max-samples": 15
/// }
///
- /// @param name name of the command (ignored, should be "statistic-set-max-sample-count-all")
+ /// @param name name of the command (ignored, should be "statistic-sample-count-set-all")
/// @param params structure containing a map that contains "max-samples"
/// @return answer confirming success of this operation
static isc::data::ConstElementPtr
EXPECT_EQ(0, StatsMgr::instance().count());
}
-// This test checks whether statistic-set-max-sample-age command really set
+// This test checks whether statistic-sample-age-set command really set
// max_sample_age_ limit correctly.
TEST_F(StatsMgrTest, commandSetMaxSampleAge) {
StatsMgr::instance().setValue("alpha", static_cast<int64_t>(1234));
params->set("duration", Element::create(1245)); // time_duration(0, 20, 45, 0)
ConstElementPtr rsp =
- StatsMgr::instance().statisticSetMaxSampleAgeHandler("statistic-set-max-sample-age", params);
+ StatsMgr::instance().statisticSetMaxSampleAgeHandler("statistic-sample-age-set", params);
int status_code;
ASSERT_NO_THROW(parseAnswer(status_code, rsp));
EXPECT_EQ(CONTROL_RESULT_SUCCESS, status_code);
EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleCount().first, false);
}
-// Test checks if statistic-set-max-sample-age is able to handle:
+// Test checks if statistic-sample-age-set is able to handle:
// - a request without parameters
// - a request without duration parameter
// - a request with missing statistic name
TEST_F(StatsMgrTest, commandSetMaxSampleAgeNegative) {
// Case 1: a request without parameters
ConstElementPtr rsp =
- StatsMgr::instance().statisticSetMaxSampleAgeHandler("statistic-set-max-sample-age", ElementPtr());
+ StatsMgr::instance().statisticSetMaxSampleAgeHandler("statistic-sample-age-set", ElementPtr());
int status_code;
ASSERT_NO_THROW(parseAnswer(status_code, rsp));
EXPECT_EQ(status_code, CONTROL_RESULT_ERROR);
// Case 2: a request without duration parameter
ElementPtr params = Element::createMap();
params->set("name", Element::create("alpha"));
- rsp = StatsMgr::instance().statisticSetMaxSampleAgeHandler("statistic-set-max-sample-age", params);
+ rsp = StatsMgr::instance().statisticSetMaxSampleAgeHandler("statistic-sample-age-set", params);
ASSERT_NO_THROW(parseAnswer(status_code, rsp));
EXPECT_EQ(status_code, CONTROL_RESULT_ERROR);
// Case 3: a request with missing statistic name
params = Element::createMap();
params->set("duration", Element::create(100));
- rsp = StatsMgr::instance().statisticSetMaxSampleAgeHandler("statistic-set-max-sample-age", params);
+ rsp = StatsMgr::instance().statisticSetMaxSampleAgeHandler("statistic-sample-age-set", params);
ASSERT_NO_THROW(parseAnswer(status_code, rsp));
EXPECT_EQ(status_code, CONTROL_RESULT_ERROR);
// Case 4: a request for non-existing statistic
params->set("name", Element::create("alpha"));
- rsp = StatsMgr::instance().statisticSetMaxSampleAgeHandler("statistic-set-max-sample-age", params);
+ rsp = StatsMgr::instance().statisticSetMaxSampleAgeHandler("statistic-sample-age-set", params);
EXPECT_EQ("{ \"result\": 1, \"text\": \"No 'alpha' statistic found\" }",
rsp->str());
}
params->set("duration", Element::create(3765)); // time_duration(1, 2, 45, 0)
ConstElementPtr rsp =
- StatsMgr::instance().statisticSetMaxSampleAgeAllHandler("statistic-set-max-sample-age-all", params);
+ StatsMgr::instance().statisticSetMaxSampleAgeAllHandler("statistic-sample-age-set-all", params);
int status_code;
ASSERT_NO_THROW(parseAnswer(status_code, rsp));
EXPECT_EQ(CONTROL_RESULT_SUCCESS, status_code);
EXPECT_EQ(StatsMgr::instance().getObservation("delta")->getMaxSampleCount().first, false);
}
-// This test checks whether statistic-set-max-sample-count command really set
+// This test checks whether statistic-sample-count-set command really set
// max_sample_count_ limit correctly.
TEST_F(StatsMgrTest, commandSetMaxSampleCount) {
StatsMgr::instance().setValue("alpha", static_cast<int64_t>(1234));
params->set("max-samples", Element::create(15));
ConstElementPtr rsp =
- StatsMgr::instance().statisticSetMaxSampleCountHandler("statistic-set-max-sample-count", params);
+ StatsMgr::instance().statisticSetMaxSampleCountHandler("statistic-sample-count-set", params);
int status_code;
ASSERT_NO_THROW(parseAnswer(status_code, rsp));
EXPECT_EQ(CONTROL_RESULT_SUCCESS, status_code);
EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleAge().first, false);
}
-// Test checks if statistic-set-max-sample-count is able to handle:
+// Test checks if statistic-sample-count-set is able to handle:
// - a request without parameters
// - a request without max-samples parameter
// - a request with missing statistic name
TEST_F(StatsMgrTest, commandSetMaxSampleCountNegative) {
// Case 1: a request without parameters
ConstElementPtr rsp =
- StatsMgr::instance().statisticSetMaxSampleCountHandler("statistic-set-max-sample-count", ElementPtr());
+ StatsMgr::instance().statisticSetMaxSampleCountHandler("statistic-sample-count-set", ElementPtr());
int status_code;
ASSERT_NO_THROW(parseAnswer(status_code, rsp));
EXPECT_EQ(status_code, CONTROL_RESULT_ERROR);
// Case 2: a request without max-samples parameter
ElementPtr params = Element::createMap();
params->set("name", Element::create("alpha"));
- rsp = StatsMgr::instance().statisticSetMaxSampleCountHandler("statistic-set-max-sample-count", params);
+ rsp = StatsMgr::instance().statisticSetMaxSampleCountHandler("statistic-sample-count-set", params);
ASSERT_NO_THROW(parseAnswer(status_code, rsp));
EXPECT_EQ(status_code, CONTROL_RESULT_ERROR);
// Case 3: a request with missing statistic name
params = Element::createMap();
params->set("max-samples", Element::create(10));
- rsp = StatsMgr::instance().statisticSetMaxSampleCountHandler("statistic-set-max-sample-count", params);
+ rsp = StatsMgr::instance().statisticSetMaxSampleCountHandler("statistic-sample-count-set", params);
ASSERT_NO_THROW(parseAnswer(status_code, rsp));
EXPECT_EQ(status_code, CONTROL_RESULT_ERROR);
// Case 4: a request for non-existing statistic
params->set("name", Element::create("alpha"));
- rsp = StatsMgr::instance().statisticSetMaxSampleCountHandler("statistic-set-max-sample-count", params);
+ rsp = StatsMgr::instance().statisticSetMaxSampleCountHandler("statistic-sample-count-set", params);
EXPECT_EQ("{ \"result\": 1, \"text\": \"No 'alpha' statistic found\" }",
rsp->str());
}
params->set("max-samples", Element::create(200));
ConstElementPtr rsp =
- StatsMgr::instance().statisticSetMaxSampleCountAllHandler("statistic-set-max-sample-count-all", params);
+ StatsMgr::instance().statisticSetMaxSampleCountAllHandler("statistic-sample-count-set-all", params);
int status_code;
ASSERT_NO_THROW(parseAnswer(status_code, rsp));
EXPECT_EQ(CONTROL_RESULT_SUCCESS, status_code);