From: Razvan Becheriu Date: Mon, 5 Aug 2019 15:17:48 +0000 (+0300) Subject: renamed commands X-Git-Tag: Kea-1.6.1~10^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=46fd89e83604bab05a84699820d4d6a3e1c51a64;p=thirdparty%2Fkea.git renamed commands --- diff --git a/doc/sphinx/api/cmds-list b/doc/sphinx/api/cmds-list index b781e6c91b..bcfaf87c37 100644 --- a/doc/sphinx/api/cmds-list +++ b/doc/sphinx/api/cmds-list @@ -117,10 +117,10 @@ statistic-remove 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 diff --git a/doc/sphinx/api/statistic-set-max-sample-age-all.json b/doc/sphinx/api/statistic-sample-age-set-all.json similarity index 57% rename from doc/sphinx/api/statistic-set-max-sample-age-all.json rename to doc/sphinx/api/statistic-sample-age-set-all.json index 5394aba218..09f172b074 100644 --- a/doc/sphinx/api/statistic-set-max-sample-age-all.json +++ b/doc/sphinx/api/statistic-sample-age-set-all.json @@ -1,11 +1,11 @@ { - "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 ", + "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 ", "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 } diff --git a/doc/sphinx/api/statistic-set-max-sample-age.json b/doc/sphinx/api/statistic-sample-age-set.json similarity index 60% rename from doc/sphinx/api/statistic-set-max-sample-age.json rename to doc/sphinx/api/statistic-sample-age-set.json index 20b53ffb81..42d22bdd3c 100644 --- a/doc/sphinx/api/statistic-set-max-sample-age.json +++ b/doc/sphinx/api/statistic-sample-age-set.json @@ -1,11 +1,11 @@ { - "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 ", + "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 ", "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 diff --git a/doc/sphinx/api/statistic-set-max-sample-count-all.json b/doc/sphinx/api/statistic-sample-count-set-all.json similarity index 56% rename from doc/sphinx/api/statistic-set-max-sample-count-all.json rename to doc/sphinx/api/statistic-sample-count-set-all.json index 0c8df9e130..ef7ba34809 100644 --- a/doc/sphinx/api/statistic-set-max-sample-count-all.json +++ b/doc/sphinx/api/statistic-sample-count-set-all.json @@ -1,11 +1,11 @@ { - "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 ", + "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 ", "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 } diff --git a/doc/sphinx/api/statistic-set-max-sample-count.json b/doc/sphinx/api/statistic-sample-count-set.json similarity index 59% rename from doc/sphinx/api/statistic-set-max-sample-count.json rename to doc/sphinx/api/statistic-sample-count-set.json index 3bffccacab..7f9ad07103 100644 --- a/doc/sphinx/api/statistic-set-max-sample-count.json +++ b/doc/sphinx/api/statistic-sample-count-set.json @@ -1,11 +1,11 @@ { - "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 ", + "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 ", "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 diff --git a/doc/sphinx/arm/stats.rst b/doc/sphinx/arm/stats.rst index ac53fd15cb..88e5d2d81c 100644 --- a/doc/sphinx/arm/stats.rst +++ b/doc/sphinx/arm/stats.rst @@ -234,19 +234,19 @@ a status of 0, indicating success, 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-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 @@ -260,19 +260,19 @@ and an empty parameters field. If an error is encountered (e.g. the 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 } @@ -284,19 +284,19 @@ for all statistics, with a result set to 0 indicating success 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 @@ -310,19 +310,19 @@ and an empty parameters field. If an error is encountered (e.g. the 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 } @@ -353,10 +353,10 @@ Since Kea 1.6, by default, each statistic holds 20 data points. Setting such 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. diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.cc b/src/bin/dhcp4/ctrl_dhcp4_srv.cc index 8c2589b108..4987613534 100644 --- a/src/bin/dhcp4/ctrl_dhcp4_srv.cc +++ b/src/bin/dhcp4/ctrl_dhcp4_srv.cc @@ -864,16 +864,16 @@ ControlledDhcpv4Srv::ControlledDhcpv4Srv(uint16_t server_port /*= DHCP4_SERVER_P 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)); } @@ -914,10 +914,10 @@ ControlledDhcpv4Srv::~ControlledDhcpv4Srv() { 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 (...) { diff --git a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc index 9aed6c6147..14439e52a2 100644 --- a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc @@ -491,10 +491,10 @@ TEST_F(CtrlChannelDhcpv4SrvTest, commandsRegistration) { 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. @@ -714,29 +714,29 @@ TEST_F(CtrlChannelDhcpv4SrvTest, controlChannelStats) { 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.\" }", @@ -915,10 +915,10 @@ TEST_F(CtrlChannelDhcpv4SrvTest, listCommands) { 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"); } diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.cc b/src/bin/dhcp6/ctrl_dhcp6_srv.cc index 3552f7eedf..9e5947606c 100644 --- a/src/bin/dhcp6/ctrl_dhcp6_srv.cc +++ b/src/bin/dhcp6/ctrl_dhcp6_srv.cc @@ -888,16 +888,16 @@ ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t server_port, 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)); } @@ -938,10 +938,10 @@ ControlledDhcpv6Srv::~ControlledDhcpv6Srv() { 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 (...) { diff --git a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc index 77f2640bfa..ee821e37a4 100644 --- a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc +++ b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc @@ -798,10 +798,10 @@ TEST_F(CtrlDhcpv6SrvTest, commandsRegistration) { 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. @@ -1028,29 +1028,29 @@ TEST_F(CtrlChannelDhcpv6SrvTest, controlChannelStats) { 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.\" }", @@ -1086,10 +1086,10 @@ TEST_F(CtrlChannelDhcpv6SrvTest, commandsList) { 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. diff --git a/src/lib/stats/stats_mgr.h b/src/lib/stats/stats_mgr.h index 11dc2d5abf..b4a9664e55 100644 --- a/src/lib/stats/stats_mgr.h +++ b/src/lib/stats/stats_mgr.h @@ -306,9 +306,9 @@ class StatsMgr : public boost::noncopyable { 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: @@ -321,16 +321,16 @@ class StatsMgr : public boost::noncopyable { /// "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: @@ -343,7 +343,7 @@ class StatsMgr : public boost::noncopyable { /// "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 @@ -386,9 +386,9 @@ class StatsMgr : public boost::noncopyable { 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 @@ -398,16 +398,16 @@ class StatsMgr : public boost::noncopyable { /// "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: @@ -418,7 +418,7 @@ class StatsMgr : public boost::noncopyable { /// "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 diff --git a/src/lib/stats/tests/stats_mgr_unittest.cc b/src/lib/stats/tests/stats_mgr_unittest.cc index b662e5fb4f..bf2114f543 100644 --- a/src/lib/stats/tests/stats_mgr_unittest.cc +++ b/src/lib/stats/tests/stats_mgr_unittest.cc @@ -772,7 +772,7 @@ TEST_F(StatsMgrTest, commandRemoveAll) { 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(1234)); @@ -782,7 +782,7 @@ TEST_F(StatsMgrTest, commandSetMaxSampleAge) { 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); @@ -794,7 +794,7 @@ TEST_F(StatsMgrTest, commandSetMaxSampleAge) { 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 @@ -802,7 +802,7 @@ TEST_F(StatsMgrTest, commandSetMaxSampleAge) { 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); @@ -810,20 +810,20 @@ TEST_F(StatsMgrTest, commandSetMaxSampleAgeNegative) { // 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()); } @@ -839,7 +839,7 @@ TEST_F(StatsMgrTest, commandSetMaxSampleAgeAll) { 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); @@ -866,7 +866,7 @@ TEST_F(StatsMgrTest, commandSetMaxSampleAgeAll) { 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(1234)); @@ -876,7 +876,7 @@ TEST_F(StatsMgrTest, commandSetMaxSampleCount) { 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); @@ -887,7 +887,7 @@ TEST_F(StatsMgrTest, commandSetMaxSampleCount) { 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 @@ -895,7 +895,7 @@ TEST_F(StatsMgrTest, commandSetMaxSampleCount) { 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); @@ -903,20 +903,20 @@ TEST_F(StatsMgrTest, commandSetMaxSampleCountNegative) { // 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()); } @@ -932,7 +932,7 @@ TEST_F(StatsMgrTest, commandSetMaxSampleCountAll) { 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);