EXPECT_EQ("{ \"result\": 0, \"text\": \"Shutting down.\" }",response);
}
-// Tests that the server properly responds to statistics commands. Note this
-// is really only intended to verify that the appropriate Statistics handler
-// is called based on the command. It is not intended to be an exhaustive
-// test of Dhcpv6 statistics.
-TEST_F(CtrlChannelDhcpv6SrvTest, controlChannelStats) {
- createUnixChannelServer();
- std::string response;
-
- // Check statistic-get
- sendUnixCommand("{ \"command\" : \"statistic-get\", "
- " \"arguments\": {"
- " \"name\":\"bogus\" }}", response);
- EXPECT_EQ("{ \"arguments\": { }, \"result\": 0 }", response);
-
- // Check statistic-get-all
- sendUnixCommand("{ \"command\" : \"statistic-get-all\", "
- " \"arguments\": {}}", response);
- EXPECT_EQ("{ \"arguments\": { }, \"result\": 0 }", response);
-
- // Check statistic-reset
- sendUnixCommand("{ \"command\" : \"statistic-reset\", "
- " \"arguments\": {"
- " \"name\":\"bogus\" }}", response);
- EXPECT_EQ("{ \"result\": 1, \"text\": \"No 'bogus' statistic found\" }",
- response);
-
- // Check statistic-reset-all
- sendUnixCommand("{ \"command\" : \"statistic-reset-all\", "
- " \"arguments\": {}}", response);
- EXPECT_EQ("{ \"result\": 0, \"text\": "
- "\"All statistics reset to neutral values.\" }", response);
-
- // Check statistic-remove
- sendUnixCommand("{ \"command\" : \"statistic-remove\", "
- " \"arguments\": {"
- " \"name\":\"bogus\" }}", response);
- EXPECT_EQ("{ \"result\": 1, \"text\": \"No 'bogus' statistic found\" }",
- response);
-
- // Check statistic-remove-all
- sendUnixCommand("{ \"command\" : \"statistic-remove-all\", "
- " \"arguments\": {}}", response);
- EXPECT_EQ("{ \"result\": 0, \"text\": \"All statistics removed.\" }",
- response);
-
- // 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-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-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-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.\" }",
- response);
-}
-
// Check that the "config-set" command will replace current configuration
TEST_F(CtrlChannelDhcpv6SrvTest, configSet) {
createUnixChannelServer();