// We should have bumped the assigned counter by 1
EXPECT_TRUE(testStatistics("assigned-nas", 1, subnet_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
+ cumulative, subnet_->getID()));
+ glbl_cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas", glbl_cumulative));
// Reset last allocated address to check that the other client will
// be refused the already allocated address and will get the one
// We should have bumped the assigned counter by 2
EXPECT_TRUE(testStatistics("assigned-nas", 2, subnet_->getID()));
- cumulative += 2;
+ cumulative += 1;
EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
cumulative, subnet_->getID()));
- glbl_cumulative += 2;
+ glbl_cumulative += 1;
EXPECT_TRUE(testStatistics("cumulative-assigned-nas", glbl_cumulative));
}
// Initialize FQDN data for the lease.
initFqdn("myhost.example.com", true, true);
- // Verify the none of relevant stats are zero.
+ // Verify the all of relevant stats are zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
EXPECT_TRUE(testStatistics("reclaimed-leases", 0));
EXPECT_TRUE(testStatistics("reclaimed-leases", 0, subnet_->getID()));
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr, other_duid, other_iaid,
501, 502, other_subnetid, HWAddrPtr(),
0));
- int64_t other_cumulative = getStatistics("cumulative-assigned-nas", other_subnetid);
+ int64_t other_cumulative =
+ getStatistics("cumulative-assigned-nas", other_subnetid);
lease->cltt_ = time(NULL) - 500; // Allocated 500 seconds ago
lease->valid_lft_ = 495; // Lease was valid for 495 seconds
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+ int64_t glbl_cumulative = getStatistics("cumulative-assigned-nas");
+
Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("::"), false);
ASSERT_TRUE(lease);
EXPECT_EQ("2001:db8:1::1c", lease->addr_.toText());
// Assigned count should have been incremented by one.
EXPECT_TRUE(testStatistics("assigned-nas", 1, subnet_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
+ cumulative, subnet_->getID()));
+ glbl_cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas", glbl_cumulative));
}
// Checks that a client gets the address reserved (in-pool case)
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+ int64_t glbl_cumulative = getStatistics("cumulative-assigned-nas");
+
// Let's pretend the client sends hint 2001:db8:1::10.
Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("2001:db8:1::10"), true);
ASSERT_TRUE(lease);
// Assigned count should not have been incremented.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ EXPECT_EQ(cumulative,
+ getStatistics("cumulative-assigned-nas", subnet_->getID()));
+ EXPECT_EQ(glbl_cumulative, getStatistics("cumulative-assigned-nas"));
}
// Checks that a client gets the address reserved (in-pool case)
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+ int64_t glbl_cumulative = getStatistics("cumulative-assigned-nas");
+
// Let's pretend the client sends hint 2001:db8:1::10.
Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("2001:db8:1::10"), false);
ASSERT_TRUE(lease);
// Assigned count should have been incremented.
EXPECT_TRUE(testStatistics("assigned-nas", 1, subnet_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
+ cumulative, subnet_->getID()));
+ glbl_cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas", glbl_cumulative));
}
// Checks that a client gets the address reserved (in-pool case)
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+ int64_t glbl_cumulative = getStatistics("cumulative-assigned-nas");
+
// Let's pretend the client sends hint 2001:db8:1::10.
Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("2001:db8:1::1c"), true);
ASSERT_TRUE(lease);
// Assigned count should not have been incremented.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ EXPECT_EQ(cumulative,
+ getStatistics("cumulative-assigned-nas", subnet_->getID()));
+ EXPECT_EQ(glbl_cumulative, getStatistics("cumulative-assigned-nas"));
}
// Checks that a client gets the address reserved (in-pool case)
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+ int64_t glbl_cumulative = getStatistics("cumulative-assigned-nas");
+
// Let's pretend the client sends hint 2001:db8:1::10.
Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("2001:db8:1::1c"), false);
ASSERT_TRUE(lease);
// Assigned count should have been incremented.
EXPECT_TRUE(testStatistics("assigned-nas", 1, subnet_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
+ cumulative, subnet_->getID()));
+ glbl_cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas", glbl_cumulative));
}
// Checks that a client gets the address reserved (out-of-pool case)
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+ int64_t glbl_cumulative = getStatistics("cumulative-assigned-nas");
+
Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("::"), true, false);
ASSERT_TRUE(lease);
EXPECT_EQ("2001:db8::abcd", lease->addr_.toText());
// Assigned count should not have been incremented.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
-
+ EXPECT_EQ(cumulative,
+ getStatistics("cumulative-assigned-nas", subnet_->getID()));
+ EXPECT_EQ(glbl_cumulative, getStatistics("cumulative-assigned-nas"));
}
// Checks that a client gets the address reserved (out-of-pool case)
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+ int64_t glbl_cumulative = getStatistics("cumulative-assigned-nas");
+
Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("::"), false, false);
ASSERT_TRUE(lease);
EXPECT_EQ("2001:db8::abcd", lease->addr_.toText());
// We should not have bumped the address counter
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ EXPECT_EQ(cumulative,
+ getStatistics("cumulative-assigned-nas", subnet_->getID()));
+ EXPECT_EQ(glbl_cumulative, getStatistics("cumulative-assigned-nas"));
}
// Checks that a client gets the address reserved (in-pool case)
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+ int64_t glbl_cumulative = getStatistics("cumulative-assigned-nas");
+
// Let's pretend the client sends hint 2001:db8:1::10.
Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("2001:db8:1::10"), true, false);
ASSERT_TRUE(lease);
// We should not have bumped the address counter
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ EXPECT_EQ(cumulative,
+ getStatistics("cumulative-assigned-nas", subnet_->getID()));
+ EXPECT_EQ(glbl_cumulative, getStatistics("cumulative-assigned-nas"));
}
// Checks that a client gets the address reserved (out-of-pool case)
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+ int64_t glbl_cumulative = getStatistics("cumulative-assigned-nas");
+
// Let's pretend the client sends hint 2001:db8:1::10.
Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("2001:db8:1::10"), false, false);
ASSERT_TRUE(lease);
// We should not have bumped the address counter
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ EXPECT_EQ(cumulative,
+ getStatistics("cumulative-assigned-nas", subnet_->getID()));
+ EXPECT_EQ(glbl_cumulative, getStatistics("cumulative-assigned-nas"));
}
// Checks that a client gets the address reserved (out-of-pool case)
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+ int64_t glbl_cumulative = getStatistics("cumulative-assigned-nas");
+
// Let's pretend the client sends hint 2001:db8:1::10.
Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("2001:db8:1::1c"), true, false);
ASSERT_TRUE(lease);
// We should not have bumped the address counter
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ EXPECT_EQ(cumulative,
+ getStatistics("cumulative-assigned-nas", subnet_->getID()));
+ EXPECT_EQ(glbl_cumulative, getStatistics("cumulative-assigned-nas"));
}
// Checks that a client gets the address reserved (out-of-pool case)
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+ int64_t glbl_cumulative = getStatistics("cumulative-assigned-nas");
+
// Let's pretend the client sends hint 2001:db8:1::10.
Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("2001:db8:1::1c"), false, false);
ASSERT_TRUE(lease);
// We should not have bumped the address counter
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ EXPECT_EQ(cumulative,
+ getStatistics("cumulative-assigned-nas", subnet_->getID()));
+ EXPECT_EQ(glbl_cumulative, getStatistics("cumulative-assigned-nas"));
}
// In the following situation:
// Assigned count should zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+ int64_t glbl_cumulative = getStatistics("cumulative-assigned-nas");
+
Lease6Collection leases;
leases = allocateTest(engine, pool_, IOAddress("::"), false, true);
// Assigned count should be one.
EXPECT_TRUE(testStatistics("assigned-nas", 1, subnet_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
+ cumulative, subnet_->getID()));
+ glbl_cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas", glbl_cumulative));
// This is what the client will send in his renew message.
AllocEngine::HintContainer hints;
// Assigned count should still be one.
EXPECT_TRUE(testStatistics("assigned-nas", 1, subnet_->getID()));
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
+ cumulative, subnet_->getID()));
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas", glbl_cumulative));
}
// Checks whether an address can be renewed (in-pool reservation)
// Assigned count should zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+ int64_t glbl_cumulative = getStatistics("cumulative-assigned-nas");
+
Lease6Collection leases;
leases = allocateTest(engine, pool_, IOAddress("::"), false, true);
// Assigned count should be one.
EXPECT_TRUE(testStatistics("assigned-nas", 1, subnet_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
+ cumulative, subnet_->getID()));
+ glbl_cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas", glbl_cumulative));
// This is what the client will send in his renew message.
AllocEngine::HintContainer hints;
// Assigned count should still be one.
EXPECT_TRUE(testStatistics("assigned-nas", 1, subnet_->getID()));
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
+ cumulative, subnet_->getID()));
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas", glbl_cumulative));
}
// Checks whether a single host can have more than one reservation.