ASSERT_TRUE(engine);
// Set valid lifetime to 500.
- subnet_->setValid(500);
+ uint32_t valid = 500;
+ subnet_->setValid(valid);
// Set the threshold to 25%.
subnet_->setCacheThreshold(.25);
IOAddress addr("192.0.2.105");
time_t now = time(NULL) - 100; // Allocated 100 seconds ago.
Lease4Ptr lease(new Lease4(addr, hwaddr_, clientid_,
- 500, now, subnet_->getID()));
+ valid, now, subnet_->getID()));
ASSERT_FALSE(lease->expired());
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
time_t age = lease->cltt_ - now;
EXPECT_GE(age, 100);
EXPECT_LE(age, 110);
- EXPECT_EQ(500 - age, lease->reuseable_valid_lft_);
+ EXPECT_EQ(valid - age, lease->reuseable_valid_lft_);
// Check other lease parameters.
EXPECT_EQ(lease->subnet_id_, subnet_->getID());
ASSERT_TRUE(engine);
// Set valid lifetime to 500.
- subnet_->setValid(500);
+ uint32_t valid = 500;
+ subnet_->setValid(valid);
// Set the threshold to 25%.
subnet_->setCacheThreshold(.25);
IOAddress addr("192.0.2.105");
time_t now = time(NULL) - 100; // Allocated 100 seconds ago.
Lease4Ptr lease(new Lease4(addr, hwaddr_, clientid_,
- 500, now, subnet_->getID()));
+ valid, now, subnet_->getID()));
ASSERT_FALSE(lease->expired());
// Copy the lease, so as it can be compared with.
Lease4Ptr original_lease(new Lease4(*lease));
time_t age = lease->cltt_ - now;
EXPECT_GE(age, 100);
EXPECT_LE(age, 110);
- EXPECT_EQ(500 - age, lease->reuseable_valid_lft_);
+ EXPECT_EQ(valid - age, lease->reuseable_valid_lft_);
// Check other lease parameters.
EXPECT_EQ(lease->subnet_id_, subnet_->getID());
ASSERT_TRUE(engine);
// Set valid lifetime to 500.
- subnet_->setValid(500);
+ uint32_t valid = 500;
+ subnet_->setValid(valid);
// Set the max age to 200.
subnet_->setCacheMaxAge(200);
IOAddress addr("192.0.2.105");
time_t now = time(NULL) - 100; // Allocated 100 seconds ago.
Lease4Ptr lease(new Lease4(addr, hwaddr_, clientid_,
- 500, now, subnet_->getID()));
+ valid, now, subnet_->getID()));
ASSERT_FALSE(lease->expired());
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
time_t age = lease->cltt_ - now;
EXPECT_GE(age, 100);
EXPECT_LE(age, 110);
- EXPECT_EQ(500 - age, lease->reuseable_valid_lft_);
+ EXPECT_EQ(valid - age, lease->reuseable_valid_lft_);
// Check other lease parameters.
EXPECT_EQ(lease->subnet_id_, subnet_->getID());
ASSERT_TRUE(engine);
// Set valid lifetime to 500.
- subnet_->setValid(500);
+ uint32_t valid = 500;
+ subnet_->setValid(valid);
// Set the threshold to 25%.
subnet_->setCacheThreshold(.25);
IOAddress addr("192.0.2.105");
time_t now = time(NULL) - 100; // Allocated 100 seconds ago.
Lease4Ptr lease(new Lease4(addr, hwaddr_, clientid_,
- 500, now, subnet_->getID()));
+ valid, now, subnet_->getID()));
ASSERT_FALSE(lease->expired());
// Copy the lease, so as it can be compared with.
Lease4Ptr original_lease(new Lease4(*lease));
time_t age = lease->cltt_ - now;
EXPECT_GE(age, 100);
EXPECT_LE(age, 110);
- EXPECT_EQ(500 - age, lease->reuseable_valid_lft_);
+ EXPECT_EQ(valid - age, lease->reuseable_valid_lft_);
// Check other lease parameters.
EXPECT_EQ(lease->subnet_id_, subnet_->getID());
ASSERT_TRUE(engine);
// Set valid lifetime to 500.
- subnet_->setValid(500);
+ uint32_t valid = 500;
+ subnet_->setValid(valid);
// Set the threshold to 25%.
subnet_->setCacheThreshold(.25);
IOAddress addr("192.0.2.105");
time_t now = time(NULL) - 100; // Allocated 100 seconds ago.
Lease4Ptr lease(new Lease4(addr, hwaddr_, clientid_,
- 500, now, subnet_->getID()));
+ valid, now, subnet_->getID()));
ASSERT_FALSE(lease->expired());
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
ASSERT_TRUE(engine);
// Set valid lifetime to 500.
- subnet_->setValid(500);
+ uint32_t valid = 500;
+ subnet_->setValid(valid);
// Set the threshold to 25%.
subnet_->setCacheThreshold(.25);
IOAddress addr("192.0.2.105");
time_t now = time(NULL) - 100; // Allocated 100 seconds ago.
Lease4Ptr lease(new Lease4(addr, hwaddr_, clientid_,
- 500, now, subnet_->getID()));
+ valid, now, subnet_->getID()));
ASSERT_FALSE(lease->expired());
// Create a context for real allocation.
IOAddress addr("192.0.2.105");
time_t now = time(NULL) - 100; // Allocated 100 seconds ago.
+ uint32_t valid = 500; // Used a value greater than subnet_->getValid().
Lease4Ptr lease(new Lease4(addr, hwaddr_, clientid_,
- 500, now, subnet_->getID()));
+ valid, now, subnet_->getID()));
ASSERT_FALSE(lease->expired());
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
ASSERT_TRUE(engine);
// Set valid lifetime to 500.
- subnet_->setValid(500);
+ uint32_t valid = 500;
+ subnet_->setValid(valid);
// Set the max age to 200.
subnet_->setCacheMaxAge(200);
IOAddress addr("192.0.2.105");
time_t now = time(NULL) - 100; // Allocated 100 seconds ago.
Lease4Ptr lease(new Lease4(addr, hwaddr_, clientid_,
- 500, now, subnet_->getID()));
+ valid, now, subnet_->getID()));
ASSERT_FALSE(lease->expired());
// Create a context for real allocation with fwd_dns_update changed.
ASSERT_TRUE(engine);
// Set valid lifetime to 500.
- subnet_->setValid(500);
+ uint32_t valid = 500;
+ subnet_->setValid(valid);
// Set the threshold to 10%.
subnet_->setCacheThreshold(.1);
IOAddress addr("192.0.2.105");
time_t now = time(NULL) - 100; // Allocated 100 seconds ago.
Lease4Ptr lease(new Lease4(addr, hwaddr_, clientid_,
- 500, now, subnet_->getID()));
+ valid, now, subnet_->getID()));
ASSERT_FALSE(lease->expired());
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
ASSERT_TRUE(engine);
// Set valid lifetime to 500.
- subnet_->setValid(500);
+ uint32_t valid = 500;
+ subnet_->setValid(valid);
// Set the max age to 200.
subnet_->setCacheMaxAge(200);
IOAddress addr("192.0.2.105");
time_t now = time(NULL) - 100; // Allocated 100 seconds ago.
Lease4Ptr lease(new Lease4(addr, hwaddr_, clientid_,
- 500, now, subnet_->getID(),
+ valid, now, subnet_->getID(),
false, false, "foo"));
ASSERT_FALSE(lease->expired());