for (auto const& lease : *deleted_leases) {
ElementPtr lease_as_json = lease->toElement();
insertLeaseExpireTime(lease_as_json);
- // If the deleted/released lease has zero lifetimes it means that
- // it should be preserved in the database. It is treated as released
+ // If the deleted lease is in the released state it means that it
+ // should be preserved in the database. It is treated as released
// but can be re-allocated to the same client later (lease affinity).
// Such a lease should be updated by the partner rather than deleted.
if (lease->state_ == Lease6::STATE_RELEASED) {
// Lease updates for deleted leases.
for (auto const& l : *deleted_leases) {
// If a released lease is preserved in the database send the lease
- // update with the zero lifetime to the partner. Otherwise, delete
- // the lease.
+ // update to the partner. Otherwise, delete the lease.
if (l->state_ == Lease4::STATE_RELEASED) {
lease_update_backlog_.push(LeaseUpdateBacklog::ADD, l);
} else {
// Lease updates for deleted leases.
for (auto const& l : *deleted_leases) {
// If a released lease is preserved in the database send the lease
- // update with the zero lifetime to the partner. Otherwise, delete
- // the lease.
+ // update to the partner. Otherwise, delete the lease.
if (l->state_ == Lease4::STATE_RELEASED) {
asyncSendLeaseUpdate(query, conf, CommandCreator::createLease4Update(*l),
parking_lot);
if (shouldQueueLeaseUpdates(conf)) {
for (auto const& l : *deleted_leases) {
// If a released lease is preserved in the database send the lease
- // update with the zero lifetime to the partner. Otherwise, delete
- // the lease.
+ // update to the partner. Otherwise, delete the lease.
if (l->state_ == Lease4::STATE_RELEASED) {
lease_update_backlog_.push(LeaseUpdateBacklog::ADD, l);
} else {
EXPECT_EQ(leaseAsJson(lease)->str(), lease_as_json->str());
}
-// This test verifies that the lease6-bulk-apply command is correct when
-// deleted leases have lifetimes of 0.
+// This test verifies that the lease6-bulk-apply command is correct
+// when sending a lease update for the lease in the relased state.
TEST(CommandCreatorTest, createLease6BulkApplySoftDelete) {
Lease6Ptr deleted_lease = createLease6();
deleted_lease->valid_lft_ = 0;
ASSERT_EQ(Element::list, deleted_leases_json->getType());
EXPECT_EQ(0, deleted_leases_json->size());
- // The lease with the valid lifetime of 0 should be in the updated
- // leases list.
+ // The lease in the released state should be in the updated leases list.
auto leases_json = arguments->get("leases");
ASSERT_TRUE(leases_json);
ASSERT_EQ(Element::list, leases_json->getType());
/// @param create_service a boolean flag indicating whether the test should
/// re-create HA service and communication state.
/// @param soft_delete_leases a boolean flag indicating that the test should simulate
- /// soft release of leases, i.e., lease lifetime is set to 0 and the lease is not
- /// deleted.
+ /// soft release of leases, i.e., lease state is released and the lease is not deleted.
void testSendLeaseUpdates(std::function<void()> unpark_handler,
const bool should_fail,
const size_t num_updates,
/// @param create_service a boolean flag indicating whether the test should
/// re-create HA service and communication state.
/// @param soft_delete_leases a boolean flag indicating that the test should simulate
- /// soft release of leases, i.e., lease lifetime is set to 0 and the lease is not
- /// deleted.
+ /// soft release of leases, i.e., lease is released and the lease is not deleted.
void testSendLeaseUpdates6(std::function<void()> unpark_handler,
const bool should_fail,
const size_t num_updates,
EXPECT_TRUE(delete_request3);
}
- /// @brief Tests scenarios when released leases have zero valid
- /// lifetime and should be preserved in the partner's lease
- /// database.
+ /// @brief Tests scenarios when released leases should be preserved
+ /// in the partner's lease database.
void testSendSuccessfulUpdatesSoftDelete() {
// Start HTTP servers.
ASSERT_NO_THROW({
EXPECT_TRUE(update_request3);
}
- /// @brief Tests scenarios when released leases have zero valid
- /// lifetime and should be preserved in the partner's lease
- /// database.
+ /// @brief Tests scenarios when released leases should be preserved
+ /// in the partner's lease database.
void testSendSuccessfulUpdates6SoftDelete() {
// Start HTTP servers.
ASSERT_NO_THROW({
testSendSuccessfulUpdates();
}
-// Tests scenarios when released leases have zero valid lifetime
-// and should be preserved in the partner's lease database.
+// Tests scenarios when released leases should be preserved in the
+/// partner's lease database.
TEST_F(HAServiceTest, sendSuccessfulUpdatesSoftDelete) {
testSendSuccessfulUpdatesSoftDelete();
}
-// Tests scenarios when released leases are have zero valid lifetime
-// and should be preserved in the partner's lease database.
+// Tests scenarios when released leases should be preserved in the
+/// partner's lease database.
TEST_F(HAServiceTest, sendSuccessfulUpdatesSoftDeleteMultiThreading) {
MultiThreadingMgr::instance().setMode(true);
testSendSuccessfulUpdatesSoftDelete();
createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8:1::1c"), 128);
AllocEngine engine(100);
-
- }
+}
// Checks that a client gets the address reserved (in-pool case)
// This test checks the behavior of the allocation engine in the following