Commit 4e5193fb authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[master] Corrected issues with assigned lease statistics and reclaimed leases

    Merge branch 'trac5247'
parents 075eb0a1 a7941a73
......@@ -3614,7 +3614,25 @@ src/lib/dhcpsrv/cfg_host_operations.cc -->
separately. This statistic is reset during reconfiguration event.
</entry>
</row>
<row>
<entry>reclaimed-leases</entry>
<entry>integer</entry>
<entry>This statistic is the number of expired leases that have
been reclaimed since server startup. It is incremented each time
an expired lease is reclaimed and is reset when the server is
reconfigured.
</entry>
</row>
<row>
<entry>subnet[id].reclaimed-leases</entry>
<entry>integer</entry>
<entry>This statistic is the number of expired leases associated
with a given subnet (<emphasis>id</emphasis> is the subnet-id)
that have been reclaimed since server startup. It is incremented
each time an expired lease is reclaimed and is reset when the
server is reconfigured.
</entry>
</row>
<row>
<entry>declined-addresses</entry>
<entry>integer</entry>
......
......@@ -3856,6 +3856,27 @@ If not specified, the default value is:
</entry>
</row>
<row>
<entry>reclaimed-leases</entry>
<entry>integer</entry>
<entry> This statistic is the number of expired leases that have been
reclaimed since server startup. It is incremented each time an expired
lease is reclaimed (it counts both NA and PD reclamations) and is reset
when the server is reconfigured.
</entry>
</row>
<row>
<entry>subnet[id].reclaimed-leases</entry>
<entry>integer</entry>
<entry>This statistic is the number of expired leases associated with
a given subnet (<emphasis>"id"</emphasis> is the subnet-id) that have
been reclaimed since server startup. It is incremented each time an expired
lease is reclaimed (it counts both NA and PD reclamations) and is reset
when the server is reconfigured.
</entry>
</row>
<row>
<entry>declined-addresses</entry>
<entry>integer</entry>
......
......@@ -1093,6 +1093,16 @@ AllocEngine::reuseExpiredLease(Lease6Ptr& expired, ClientContext6& ctx,
if (!ctx.fake_allocation_) {
// for REQUEST we do update the lease
LeaseMgrFactory::instance().updateLease6(expired);
// If the lease is in the current subnet we need to account
// for the re-assignment of The lease.
if (ctx.subnet_->inPool(ctx.currentIA().type_, expired->addr_)) {
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", ctx.subnet_->getID(),
ctx.currentIA().type_ == Lease::TYPE_NA ?
"assigned-nas" : "assigned-pds"),
static_cast<int64_t>(1));
}
}
// We do nothing for SOLICIT. We'll just update database when
......@@ -1387,6 +1397,15 @@ AllocEngine::extendLease6(ClientContext6& ctx, Lease6Ptr lease) {
if (old_data->expired()) {
reclaimExpiredLease(old_data, ctx.callout_handle_);
// If the lease is in the current subnet we need to account
// for the re-assignment of The lease.
if (ctx.subnet_->inPool(ctx.currentIA().type_, old_data->addr_)) {
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", ctx.subnet_->getID(),
ctx.currentIA().type_ == Lease::TYPE_NA ?
"assigned-nas" : "assigned-pds"),
static_cast<int64_t>(1));
}
} else {
if (!lease->hasIdenticalFqdn(*old_data)) {
// We're not reclaiming the lease but since the FQDN has changed
......@@ -2656,13 +2675,14 @@ AllocEngine::renewLease4(const Lease4Ptr& lease,
// involves execution of hooks and DNS update.
if (ctx.old_lease_->expired()) {
reclaimExpiredLease(ctx.old_lease_, ctx.callout_handle_);
lease->state_ = Lease::STATE_DEFAULT;
} else if (!lease->hasIdenticalFqdn(*ctx.old_lease_)) {
// The lease is not expired but the FQDN information has
// changed. So, we have to remove the previous DNS entry.
queueNCR(CHG_REMOVE, ctx.old_lease_);
}
lease->state_ = Lease::STATE_DEFAULT;
}
bool skip = false;
......@@ -2710,6 +2730,13 @@ AllocEngine::renewLease4(const Lease4Ptr& lease,
if (!ctx.fake_allocation_ && !skip) {
// for REQUEST we do update the lease
LeaseMgrFactory::instance().updateLease4(lease);
// We need to account for the re-assignment of The lease.
if (ctx.old_lease_->expired() || ctx.old_lease_->state_ == Lease::STATE_EXPIRED_RECLAIMED) {
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", ctx.subnet_->getID(), "assigned-addresses"),
static_cast<int64_t>(1));
}
}
if (skip) {
// Rollback changes (really useful only for memfile)
......@@ -2796,6 +2823,11 @@ AllocEngine::reuseExpiredLease4(Lease4Ptr& expired,
if (!ctx.fake_allocation_) {
// for REQUEST we do update the lease
LeaseMgrFactory::instance().updateLease4(expired);
// We need to account for the re-assignment of The lease.
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", ctx.subnet_->getID(), "assigned-addresses"),
static_cast<int64_t>(1));
}
// We do nothing for SOLICIT. We'll just update database when
......
......@@ -250,6 +250,9 @@ CfgSubnets4::removeStatistics() {
stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
"declined-reclaimed-addresses"));
stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
"reclaimed-leases"));
}
}
......
......@@ -201,6 +201,9 @@ CfgSubnets6::removeStatistics() {
stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
"declined-reclaimed-addresses"));
stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
"reclaimed-leases"));
}
}
......
......@@ -62,7 +62,8 @@ LeaseMgr::recountLeaseStats4() {
// Zero out the global stats.
int64_t zero = 0;
stats_mgr.setValue("declined-addresses", zero);
stats_mgr.setValue("declined-reclaimed-addresses", zero);
stats_mgr.setValue("reclaimed-declined-addresses", zero);
stats_mgr.setValue("reclaimed-leases", zero);
// Clear subnet level stats. This ensures we don't end up with corner
// cases that leave stale values in place.
......@@ -79,8 +80,13 @@ LeaseMgr::recountLeaseStats4() {
stats_mgr.setValue(StatsMgr::generateName("subnet", subnet_id,
"declined-addresses"),
zero);
stats_mgr.setValue(StatsMgr::generateName("subnet", subnet_id,
"reclaimed-declined-addresses"),
zero);
stats_mgr.setValue(StatsMgr::generateName("subnet", subnet_id,
"declined-reclaimed-addresses"),
"reclaimed-leases"),
zero);
}
......@@ -133,7 +139,8 @@ LeaseMgr::recountLeaseStats6() {
// clearing it when we clear the rest.
int64_t zero = 0;
stats_mgr.setValue("declined-addresses", zero);
stats_mgr.setValue("declined-reclaimed-addresses", zero);
stats_mgr.setValue("reclaimed-declined-addresses", zero);
stats_mgr.setValue("reclaimed-leases", zero);
// Clear subnet level stats. This ensures we don't end up with corner
// cases that leave stale values in place.
......@@ -153,12 +160,16 @@ LeaseMgr::recountLeaseStats6() {
stats_mgr.setValue(StatsMgr::
generateName("subnet", subnet_id,
"declined-reclaimed-addresses"),
"reclaimed-declined-addresses"),
zero);
stats_mgr.setValue(StatsMgr::generateName("subnet", subnet_id,
"assigned-pds"),
zero);
stats_mgr.setValue(StatsMgr::generateName("subnet", subnet_id,
"reclaimed-leases"),
zero);
}
// Get counts per state per subnet. Iterate over the result set
......
......@@ -44,7 +44,6 @@ TEST_F(AllocEngine4Test, constructor) {
EXPECT_THROW(x->getAllocator(Lease::TYPE_PD), BadValue);
}
// This test checks if the simple IPv4 allocation can succeed
TEST_F(AllocEngine4Test, simpleAlloc4) {
boost::scoped_ptr<AllocEngine> engine;
......@@ -52,6 +51,9 @@ TEST_F(AllocEngine4Test, simpleAlloc4) {
100, false)));
ASSERT_TRUE(engine);
// Assigned addresses should be zero.
EXPECT_TRUE(testStatistics("assigned-addresses", 0, subnet_->getID()));
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
false, true, "somehost.example.com.", false);
ctx.query_.reset(new Pkt4(DHCPREQUEST, 1234));
......@@ -72,6 +74,9 @@ TEST_F(AllocEngine4Test, simpleAlloc4) {
// Now check that the lease in LeaseMgr has the same parameters
detailCompareLease(lease, from_mgr);
// Assigned addresses should have incremented.
EXPECT_TRUE(testStatistics("assigned-addresses", 1, subnet_->getID()));
}
// This test checks if the fake allocation (for DHCPDISCOVER) can succeed
......@@ -81,6 +86,9 @@ TEST_F(AllocEngine4Test, fakeAlloc4) {
100, false)));
ASSERT_TRUE(engine);
// Assigned addresses should be zero.
EXPECT_TRUE(testStatistics("assigned-addresses", 0, subnet_->getID()));
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_,
IOAddress("0.0.0.0"), false, true,
"host.example.com.", true);
......@@ -100,6 +108,9 @@ TEST_F(AllocEngine4Test, fakeAlloc4) {
// Check that the lease is NOT in LeaseMgr
Lease4Ptr from_mgr = LeaseMgrFactory::instance().getLease4(lease->addr_);
ASSERT_FALSE(from_mgr);
// Assigned addresses should still be zero.
EXPECT_TRUE(testStatistics("assigned-addresses", 0, subnet_->getID()));
}
......@@ -267,7 +278,45 @@ TEST_F(AllocEngine4Test, allocateLease4Nulls) {
detailCompareLease(lease, from_mgr);
}
// This test checks if a returning client can renew an
// an existing lease and assigned-leases increments accordingly
TEST_F(AllocEngine4Test, simpleRenew4) {
boost::scoped_ptr<AllocEngine> engine;
ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
100, false)));
ASSERT_TRUE(engine);
EXPECT_TRUE(testStatistics("assigned-addresses", 0, subnet_->getID()));
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
false, true, "somehost.example.com.", false);
ctx.query_.reset(new Pkt4(DHCPREQUEST, 1234));
Lease4Ptr lease = engine->allocateLease4(ctx);
// Check that we got a lease and it's sane
ASSERT_TRUE(lease);
checkLease4(lease);
// The new lease has been allocated, so the old lease should not exist.
EXPECT_FALSE(ctx.old_lease_);
// We should have incremented assigned-addresses
EXPECT_TRUE(testStatistics("assigned-addresses", 1, subnet_->getID()));
// Do it again, this should amount to the renew of an existing lease
Lease4Ptr lease2 = engine->allocateLease4(ctx);
// Check that we got a lease and it's sane
ASSERT_TRUE(lease2);
checkLease4(lease2);
// Lease already existsed, so old_lease should be set.
EXPECT_TRUE(ctx.old_lease_);
// Should NOT have bumped assigned-addresses
EXPECT_TRUE(testStatistics("assigned-addresses", 1, subnet_->getID()));
}
// This test verifies that the allocator picks addresses that belong to the
// pool
......@@ -504,14 +553,18 @@ TEST_F(AllocEngine4Test, requestReuseExpiredLease4) {
IOAddress addr("192.0.2.105");
EXPECT_TRUE(testStatistics("assigned-addresses", 0, subnet_->getID()));
EXPECT_TRUE(testStatistics("reclaimed-leases", 0));
EXPECT_TRUE(testStatistics("reclaimed-leases", 0, subnet_->getID()));
// Just a different hw/client-id for the second client
uint8_t hwaddr2_data[] = { 0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe};
HWAddrPtr hwaddr2(new HWAddr(hwaddr2_data, sizeof(hwaddr2_data), HTYPE_ETHER));
uint8_t clientid2[] = { 8, 7, 6, 5, 4, 3, 2, 1 };
time_t now = time(NULL) - 500; // Allocated 500 seconds ago
Lease4Ptr lease(new Lease4(addr, hwaddr2, clientid2, sizeof(clientid2),
sizeof(hwaddr2), 495, 100, 200, now,
subnet_->getID()));
495, 100, 200, now, subnet_->getID()));
// Make a copy of the lease, so as we can compare that with the old lease
// instance returned by the allocation engine.
Lease4 original_lease(*lease);
......@@ -543,6 +596,13 @@ TEST_F(AllocEngine4Test, requestReuseExpiredLease4) {
// lease should be equal to the original lease.
ASSERT_TRUE(ctx.old_lease_);
EXPECT_TRUE(*ctx.old_lease_ == original_lease);
// Check that the stats declined stats were modified correctly. Note, because
// added the lease directly, assigned-leases never bumped to one, so when we
// reclaime it gets decremented to -1, then on assignment back to 0.
EXPECT_TRUE(testStatistics("assigned-addresses", 0, subnet_->getID()));
EXPECT_TRUE(testStatistics("reclaimed-leases", 1));
EXPECT_TRUE(testStatistics("reclaimed-leases", 1, subnet_->getID()));
}
// This test checks if an expired declined lease can be reused when responding
......@@ -599,35 +659,23 @@ TEST_F(AllocEngine4Test, discoverReuseDeclinedLease4Stats) {
pool_ = Pool4Ptr(new Pool4(addr, addr)); // just a single address
subnet_->addPool(pool_);
cfg_mgr.getStagingCfg()->getCfgSubnets4()->add(subnet_);
cfg_mgr.commit(); // so we will recalc stats
// Now create a declined lease, decline it and rewind its cltt, so it
// is expired.
Lease4Ptr declined = generateDeclinedLease("192.0.2.15", 100, -10);
// Let's fix some global stats...
StatsMgr& stats_mgr = StatsMgr::instance();
stats_mgr.setValue("declined-addresses", static_cast<int64_t>(1000));
stats_mgr.setValue("reclaimed-declined-addresses", static_cast<int64_t>(1000));
// ...and subnet specific stats as well.
string stat1 = StatsMgr::generateName("subnet", subnet_->getID(),
"declined-addresses");
string stat2 = StatsMgr::generateName("subnet", subnet_->getID(),
"reclaimed-declined-addresses");
stats_mgr.setValue(stat1, static_cast<int64_t>(1000));
stats_mgr.setValue(stat2, static_cast<int64_t>(1000));
// Ask for any address. There's only one address in the pool, so it doesn't
// matter much.
Lease4Ptr assigned;
testReuseLease4(engine, declined, "0.0.0.0", true, SHOULD_PASS, assigned);
// Check that the stats were not modified
testStatistics("declined-addresses", 1000);
testStatistics("reclaimed-declined-addresses", 1000);
testStatistics(stat1, 1000);
testStatistics(stat2, 1000);
// Check that the stats declined stats were not modified
EXPECT_TRUE(testStatistics("assigned-addresses", 0, subnet_->getID()));
EXPECT_TRUE(testStatistics("declined-addresses", 0));
EXPECT_TRUE(testStatistics("reclaimed-declined-addresses", 0));
EXPECT_TRUE(testStatistics("declined-addresses", 0, subnet_->getID()));
EXPECT_TRUE(testStatistics("reclaimed-declined-addresses", 0, subnet_->getID()));
}
// This test checks if an expired declined lease can be reused when responding
......@@ -682,36 +730,27 @@ TEST_F(AllocEngine4Test, requestReuseDeclinedLease4Stats) {
pool_ = Pool4Ptr(new Pool4(addr, addr)); // just a single address
subnet_->addPool(pool_);
cfg_mgr.getStagingCfg()->getCfgSubnets4()->add(subnet_);
cfg_mgr.commit();
// Now create a declined lease, decline it and rewind its cltt, so it
// is expired.
Lease4Ptr declined = generateDeclinedLease("192.0.2.15", 100, -10);
// Let's fix some global stats...
StatsMgr& stats_mgr = StatsMgr::instance();
stats_mgr.setValue("declined-addresses", static_cast<int64_t>(1000));
stats_mgr.setValue("reclaimed-declined-addresses", static_cast<int64_t>(1000));
// ...and subnet specific stats as well.
string stat1 = StatsMgr::generateName("subnet", subnet_->getID(),
"declined-addresses");
string stat2 = StatsMgr::generateName("subnet", subnet_->getID(),
"reclaimed-declined-addresses");
stats_mgr.setValue(stat1, static_cast<int64_t>(1000));
stats_mgr.setValue(stat2, static_cast<int64_t>(1000));
// Asking specifically for this address
Lease4Ptr assigned;
testReuseLease4(engine, declined, "192.0.2.15", false, SHOULD_PASS, assigned);
// Check that we got it.
ASSERT_TRUE(assigned);
// Check that the stats were modified
testStatistics("declined-addresses", 999);
testStatistics("reclaimed-declined-addresses", 1001);
testStatistics(stat1, 999);
testStatistics(stat2, 1001);
// Check that the stats are correct. Note that assigned-addresses does
// not get decremented when a lease is declined, ergo not incremented
// when it is reused. Declined address stats will be -1 since
// lease was created as declined which does not increment the stat.
EXPECT_TRUE(testStatistics("assigned-addresses", 0, subnet_->getID()));
EXPECT_TRUE(testStatistics("declined-addresses", -1));
EXPECT_TRUE(testStatistics("reclaimed-declined-addresses", 1));
EXPECT_TRUE(testStatistics("declined-addresses", -1, subnet_->getID()));
EXPECT_TRUE(testStatistics("reclaimed-declined-addresses", 1, subnet_->getID()));
}
// This test checks that the Allocation Engine correctly identifies the
......
......@@ -1437,13 +1437,12 @@ ExpirationAllocEngine6Test::testReclaimReusedLeases(const uint16_t msg_type,
// initially reclaimed.
if (use_reclaimed || (msg_type == DHCPV6_SOLICIT)) {
EXPECT_TRUE(testStatistics("reclaimed-leases", 0));
} else {
EXPECT_TRUE(testStatistics("reclaimed-leases", TEST_LEASES_NUM));
EXPECT_TRUE(testStatistics("assigned-nas", TEST_LEASES_NUM, subnet->getID()));
// Leases should have been updated in the lease database and their
// state should not be 'expired-reclaimed' anymore.
EXPECT_TRUE(testLeases(&leaseNotReclaimed, &allLeaseIndexes));
}
}
......@@ -2099,6 +2098,7 @@ ExpirationAllocEngine4Test::testReclaimReusedLeases(const uint8_t msg_type,
} else if (msg_type == DHCPREQUEST) {
// Re-allocation of expired leases should result in reclamations.
EXPECT_TRUE(testStatistics("reclaimed-leases", TEST_LEASES_NUM));
EXPECT_TRUE(testStatistics("assigned-addresses", TEST_LEASES_NUM, subnet->getID()));
// Leases should have been updated in the lease database and their
// state should not be 'expired-reclaimed' anymore.
EXPECT_TRUE(testLeases(&leaseNotReclaimed, &allLeaseIndexes));
......
......@@ -39,20 +39,23 @@ namespace isc {
namespace dhcp {
namespace test {
bool testStatistics(const std::string& stat_name, const int64_t exp_value) {
bool testStatistics(const std::string& stat_name, const int64_t exp_value,
const SubnetID subnet_id) {
try {
ObservationPtr observation = StatsMgr::instance().getObservation(stat_name);
std::string name = (!subnet_id ? stat_name :
StatsMgr::generateName("subnet", subnet_id, stat_name));
ObservationPtr observation = StatsMgr::instance().getObservation(name);
if (observation) {
if (observation->getInteger().first != exp_value) {
ADD_FAILURE()
<< "value of the observed statistics '"
<< stat_name << "' " << "("
<< name << "' " << "("
<< observation->getInteger().first << ") "
<< "doesn't match expected value (" << exp_value << ")";
}
return (observation->getInteger().first == exp_value);
} else {
ADD_FAILURE() << "Expected statistic " << stat_name
ADD_FAILURE() << "Expected statistic " << name
<< " not found.";
}
......@@ -136,7 +139,6 @@ AllocEngine6Test::AllocEngine6Test() {
// hardcoded anywhere.
const uint8_t mac[] = { 0, 1, 22, 33, 44, 55};
hwaddr_ = HWAddrPtr(new HWAddr(mac, sizeof(mac), HTYPE_FDDI));
// Initialize a subnet and short address pool.
initSubnet(IOAddress("2001:db8:1::"),
IOAddress("2001:db8:1::10"),
......@@ -145,7 +147,6 @@ AllocEngine6Test::AllocEngine6Test() {
64, 80);
initFqdn("", false, false);
}
void
......@@ -170,14 +171,6 @@ AllocEngine6Test::initSubnet(const asiolink::IOAddress& subnet,
cfg_mgr.getStagingCfg()->getCfgSubnets6()->add(subnet_);
cfg_mgr.commit();
// By default we pretend our subnet has 100 addresses and prefixes allocated.
StatsMgr::instance().setValue(
StatsMgr::generateName("subnet", subnet_->getID(), "assigned-nas"),
static_cast<int64_t>(100));
StatsMgr::instance().setValue(
StatsMgr::generateName("subnet", subnet_->getID(), "assigned-pds"),
static_cast<int64_t>(100));
}
void
......
// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef LIBDHCPSRV_ALLOC_ENGINE_UTILS_H
......@@ -39,10 +38,12 @@ namespace test {
///
/// @param stat_name Statistic name.
/// @param exp_value Expected value.
/// @param subnet_id subnet_id of the desired subnet, if not zero
///
/// @return true if the statistic manager holds a particular value,
/// false otherwise.
bool testStatistics(const std::string& stat_name, const int64_t exp_value);
bool testStatistics(const std::string& stat_name, const int64_t exp_value,
const SubnetID subnet_id = 0);
/// @brief Allocation engine with some internal methods exposed
class NakedAllocEngine : public AllocEngine {
......@@ -360,12 +361,26 @@ public:
host->addReservation(resv);
if (add_to_host_mgr) {
CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
CfgMgr::instance().commit();
addHost(host);
}
return (host);
}
/// @brief Add a host reservation to the curent configuration
///
/// Adds the given host reservation to the current configuration by
/// casting it to non-const. We do it this way rather than adding it to
/// staging and then committing as that wipes out the current configuration
/// such as subnets.
///
/// @param host host reservation to add
void
addHost(HostPtr& host) {
SrvConfigPtr cfg = boost::const_pointer_cast<SrvConfig>(CfgMgr::instance().getCurrentCfg());
cfg->getCfgHosts()->add(host);
}
/// @brief Utility function that creates a host reservation (hwaddr)
///
/// @param add_to_host_mgr true if the reservation should be added
......
......@@ -2404,7 +2404,7 @@ void
GenericLeaseMgrTest::checkLeaseStats(const StatValMapList& expectedStats) {
// Global accumulators
int64_t declined_addresses = 0;
int64_t declined_reclaimed_addresses = 0;
int64_t reclaimed_declined_addresses = 0;
// Iterate over all stats for each subnet
for (int subnet_idx = 0; subnet_idx < expectedStats.size(); ++subnet_idx) {
......@@ -2417,15 +2417,15 @@ GenericLeaseMgrTest::checkLeaseStats(const StatValMapList& expectedStats) {
// Add the value to globals as needed.
if (expectedStat.first == "declined-addresses") {
declined_addresses += expectedStat.second;
} else if (expectedStat.first == "declined-reclaimed-addresses") {
declined_reclaimed_addresses += expectedStat.second;
} else if (expectedStat.first == "reclaimed-declined-addresses") {
reclaimed_declined_addresses += expectedStat.second;
}
}
}
// Verify the globals.
checkStat("declined-addresses", declined_addresses);
checkStat("declined-reclaimed-addresses", declined_reclaimed_addresses);
checkStat("reclaimed-declined-addresses", reclaimed_declined_addresses);
}
void
......@@ -2501,7 +2501,8 @@ GenericLeaseMgrTest::testRecountLeaseStats4() {
expectedStats[i]["total-addresses"] = 256;
expectedStats[i]["assigned-addresses"] = 0;
expectedStats[i]["declined-addresses"] = 0;
expectedStats[i]["declined-reclaimed-addresses"] = 0;
expectedStats[i]["reclaimed-declined-addresses"] = 0;
expectedStats[i]["reclaimed-leases"] = 0;
}
// Make sure stats are as expected.
......@@ -2604,8 +2605,9 @@ GenericLeaseMgrTest::testRecountLeaseStats6() {
for (int i = 0; i < num_subnets; ++i) {
expectedStats[i]["assigned-nas"] = 0;
expectedStats[i]["declined-addresses"] = 0;
expectedStats[i]["declined-reclaimed-addresses"] = 0;
expectedStats[i]["reclaimed-declined-addresses"] = 0;
expectedStats[i]["assigned-pds"] = 0;
expectedStats[i]["reclaimed-leases"] = 0;
}