<< " is not an IPv6 address");
}
- // The 'count' is a desired page size. It must always be present.
- ConstElementPtr page_count = cmd_args_->get("count");
- if (!page_count) {
- isc_throw(BadValue, "'count' parameter not specified");
+ // The 'limit' is a desired page size. It must always be present.
+ ConstElementPtr page_limit = cmd_args_->get("limit");
+ if (!page_limit) {
+ isc_throw(BadValue, "'limit' parameter not specified");
}
- // The 'count' must be a number.
- if (page_count->getType() != Element::integer) {
- isc_throw(BadValue, "'count' parameter must be a number");
+ // The 'limit' must be a number.
+ if (page_limit->getType() != Element::integer) {
+ isc_throw(BadValue, "'limit' parameter must be a number");
}
// Retrieve the desired page size.
- size_t page_count_value = static_cast<size_t>(page_count->intValue());
+ size_t page_limit_value = static_cast<size_t>(page_limit->intValue());
ElementPtr leases_json = Element::createList();
- // Use lease stats function to retrieve the total number of leases.
- // Total number of leases is returned apart from the leases list
- // so as the controlling client can track the progress of leases
- // viewed vs all leases count.
- LeaseStatsQueryPtr query;
if (v4) {
// Get page of IPv4 leases.
Lease4Collection leases =
LeaseMgrFactory::instance().getLeases4(*from_address,
- LeasePageSize(page_count_value));
- // Get the total lease count.
- query = LeaseMgrFactory::instance().startLeaseStatsQuery4();
+ LeasePageSize(page_limit_value));
// Convert leases into JSON list.
for (auto lease : leases) {
// Get page of IPv6 leases.
Lease6Collection leases =
LeaseMgrFactory::instance().getLeases6(*from_address,
- LeasePageSize(page_count_value));
- // Get the total lease count.
- query = LeaseMgrFactory::instance().startLeaseStatsQuery6();
-
+ LeasePageSize(page_limit_value));
// Convert leases into JSON list.
for (auto lease : leases) {
ElementPtr lease_json = lease->toElement();
}
}
- // Sum up lease counters for various lease states.
- LeaseStatsRow row;
- int64_t total_leases = 0;
- while (query->getNextRow(row)) {
- total_leases += row.state_count_;
- }
-
// Prepare textual status.
std::ostringstream s;
s << leases_json->size()
" \"command\": \"lease4-get-page\",\n"
" \"arguments\": {"
" \"from\": \"" + last_address + "\","
- " \"count\": 2"
+ " \"limit\": 2"
" }"
"}";
" \"command\": \"lease4-get-page\",\n"
" \"arguments\": {"
" \"from\": \"0.0.0.0\","
- " \"count\": 2"
+ " \"limit\": 2"
" }"
"}";
" \"command\": \"lease4-get-page\",\n"
" \"arguments\": {"
" \"from\": \"2001:db8::1\","
- " \"count\": 2"
+ " \"limit\": 2"
" }"
"}";
" \"command\": \"lease6-get-page\",\n"
" \"arguments\": {"
" \"from\": \"" + last_address + "\","
- " \"count\": 2"
+ " \"limit\": 2"
" }"
"}";
" \"command\": \"lease6-get-page\",\n"
" \"arguments\": {"
" \"from\": \"::\","
- " \"count\": 2"
+ " \"limit\": 2"
" }"
"}";
" \"command\": \"lease6-get-page\",\n"
" \"arguments\": {"
" \"from\": \"192.0.2.3\","
- " \"count\": 2"
+ " \"limit\": 2"
" }"
"}";
" \"command\": \"lease6-get-page\",\n"
" \"arguments\": {"
" \"from\": \"foo\","
- " \"count\": 2"
+ " \"limit\": 2"
" }"
"}";
testCommand(cmd, CONTROL_RESULT_ERROR, exp_rsp);
}
-// Verifies that count is mandatory.
-TEST_F(LeaseCmdsTest, Lease6GetPagedNoCount) {
+// Verifies that limit is mandatory.
+TEST_F(LeaseCmdsTest, Lease6GetPagedNoLimit) {
// Initialize lease manager (true = v6, true = add a lease)
initLeaseMgr(true, true);
" }"
"}";
- string exp_rsp = "'count' parameter not specified";
+ string exp_rsp = "'limit' parameter not specified";
testCommand(cmd, CONTROL_RESULT_ERROR, exp_rsp);
}
-// Verifies that the count must be a number.
-TEST_F(LeaseCmdsTest, Lease6GetPagedCountNotNumber) {
+// Verifies that the limit must be a number.
+TEST_F(LeaseCmdsTest, Lease6GetPagedLimitNotNumber) {
// Initialize lease manager (true = v6, true = add a lease)
initLeaseMgr(true, true);
" \"command\": \"lease6-get-page\",\n"
" \"arguments\": {"
" \"from\": \"start\","
- " \"count\": false"
+ " \"limit\": false"
" }"
"}";
- string exp_rsp = "'count' parameter must be a number";
+ string exp_rsp = "'limit' parameter must be a number";
testCommand(cmd, CONTROL_RESULT_ERROR, exp_rsp);
}
-// Verifies that the count of 0 is rejected.
-TEST_F(LeaseCmdsTest, Lease6GetPagedCountIsZero) {
+// Verifies that the limit of 0 is rejected.
+TEST_F(LeaseCmdsTest, Lease6GetPagedLimitIsZero) {
// Initialize lease manager (true = v6, true = add a lease)
initLeaseMgr(true, true);
" \"command\": \"lease6-get-page\",\n"
" \"arguments\": {"
" \"from\": \"start\","
- " \"count\": 0"
+ " \"limit\": 0"
" }"
"}";