Lease4Ptr lease = engine->allocateLease4(ctx);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Check that we got a lease
ASSERT_TRUE(lease);
lease = engine->allocateLease4(ctx2);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx2.old_lease_);
+ ASSERT_FALSE(ctx2.old_lease_);
// Check that we got a lease
ASSERT_TRUE(lease);
Lease4Ptr lease = engine->allocateLease4(ctx);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Check that we got a lease
ASSERT_TRUE(lease);
Lease4Ptr lease = engine->allocateLease4(ctx);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Check that we got a lease
ASSERT_TRUE(lease);
Lease4Ptr lease = engine->allocateLease4(ctx);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Check that we got a lease
ASSERT_TRUE(lease);
Lease4Ptr lease = engine->allocateLease4(ctx);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Check that we got a lease
ASSERT_TRUE(lease);
Lease4Ptr lease = engine->allocateLease4(ctx);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Check that we got a lease
ASSERT_TRUE(lease);
Lease4Ptr lease = engine->allocateLease4(ctx);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Check that we got a lease
ASSERT_TRUE(lease);
EXPECT_EQ(glbl_cumulative, getStatistics("cumulative-assigned-addresses"));
}
-
// This test checks if the allocation with a hint that is valid (in range,
// in pool and free) can succeed
TEST_F(AllocEngine4Test, allocWithValidHint4) {
ASSERT_TRUE(lease);
// We have allocated the new lease, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// We should get what we asked for
EXPECT_EQ(lease->addr_.toText(), "192.0.2.105");
detailCompareLease(lease, from_mgr);
}
-
// This test checks if the allocation with a hint that is in range,
// in pool, but is currently used can succeed
TEST_F(AllocEngine4Test, allocWithUsedHint4) {
Lease4Ptr lease = engine->allocateLease4(ctx);
// New lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Check that we got a lease
ASSERT_TRUE(lease);
ASSERT_FALSE(from_mgr);
}
-
// This test checks if an allocation with a hint that is out of the blue
// can succeed. The invalid hint should be ignored completely.
TEST_F(AllocEngine4Test, allocBogusHint4) {
ASSERT_TRUE(lease);
// We have allocated a new lease, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// We should NOT get what we asked for, because it is used already
EXPECT_NE("10.1.1.1", lease->addr_.toText());
// Allocations without subnet are not allowed
AllocEngine::ClientContext4 ctx1(Subnet4Ptr(), clientid_, hwaddr_,
- IOAddress("0.0.0.0"), false, false,
- "", false);
+ IOAddress("0.0.0.0"), false, false,
+ "", false);
ctx1.query_.reset(new Pkt4(DHCPREQUEST, 1234));
Lease4Ptr lease = engine->allocateLease4(ctx1);
- EXPECT_FALSE(lease);
+ ASSERT_FALSE(lease);
+
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
// Allocations without HW address are not allowed
AllocEngine::ClientContext4 ctx2(subnet_, clientid_, HWAddrPtr(),
- IOAddress("0.0.0.0"), false, false,
- "", false);
+ IOAddress("0.0.0.0"), false, false,
+ "", false);
ctx2.query_.reset(new Pkt4(DHCPREQUEST, 1234));
lease = engine->allocateLease4(ctx2);
- EXPECT_FALSE(lease);
- EXPECT_FALSE(ctx2.old_lease_);
+ ASSERT_FALSE(lease);
+ ASSERT_FALSE(ctx2.old_lease_);
+
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
// Allocations without client-id are allowed
clientid_.reset();
AllocEngine::ClientContext4 ctx3(subnet_, ClientIdPtr(), hwaddr_,
- IOAddress("0.0.0.0"), false, false,
- "", false);
+ IOAddress("0.0.0.0"), false, false,
+ "", false);
ctx3.query_.reset(new Pkt4(DHCPREQUEST, 1234));
lease = engine->allocateLease4(ctx3);
// Check that we got a lease
ASSERT_TRUE(lease);
// New lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx3.old_lease_);
+ ASSERT_FALSE(ctx3.old_lease_);
// Do all checks on the lease
checkLease4(lease);
checkLease4(lease);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// We should have incremented assigned-addresses
EXPECT_TRUE(testStatistics("assigned-addresses", 1, subnet_->getID()));
EXPECT_EQ(subnet_->getValid(), lease->valid_lft_);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Do it again, this should amount to the renew of an existing lease
Lease4Ptr lease2 = engine->allocateLease4(ctx);
EXPECT_EQ(opt->getValue(), lease->valid_lft_);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Do it again, this should amount to the renew of an existing lease
Lease4Ptr lease2 = engine->allocateLease4(ctx);
EXPECT_EQ(subnet_->getValid().getMin(), lease->valid_lft_);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Do it again, this should amount to the renew of an existing lease
Lease4Ptr lease2 = engine->allocateLease4(ctx);
EXPECT_EQ(subnet_->getValid().getMax(), lease->valid_lft_);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Do it again, this should amount to the renew of an existing lease
Lease4Ptr lease2 = engine->allocateLease4(ctx);
EXPECT_EQ(infinity_lft, lease->valid_lft_);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Do it again, this should amount to the renew of an existing lease
Lease4Ptr lease2 = engine->allocateLease4(ctx);
}
}
-
// This test checks if really small pools are working
TEST_F(AllocEngine4Test, smallPool4) {
boost::scoped_ptr<AllocEngine> engine;
ASSERT_TRUE(lease);
// We have allocated new lease, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
EXPECT_EQ("192.0.2.17", lease->addr_.toText());
"host.example.com.", false);
ctx.query_.reset(new Pkt4(DHCPREQUEST, 1234));
Lease4Ptr lease2 = engine->allocateLease4(ctx);
- EXPECT_FALSE(lease2);
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(lease2);
+ ASSERT_FALSE(ctx.old_lease_);
+
+ EXPECT_EQ(1, getStatistics("v4-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network"));
+ EXPECT_EQ(1, getStatistics("v4-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
}
/// @brief This test class is dedicated to testing shared networks
EXPECT_TRUE(subnet2_->inPool(Lease::TYPE_V4, lease->addr_));
}
-
// This test verifies that the server can offer an address from a
// different subnet than orginally selected, when the address pool in
// the first subnet is exhausted.
TEST_F(SharedNetworkAlloc4Test, discoverSharedNetworkClassification) {
// Try to offer address from subnet1. There is one address available
- // so it should be offerred.
+ // so it should be offered.
AllocEngine::ClientContext4
ctx(subnet1_, ClientIdPtr(), hwaddr_, IOAddress::IPV4_ZERO_ADDRESS(),
false, false, "host.example.com.", true);
EXPECT_TRUE(subnet2_->inPool(Lease::TYPE_V4, lease->addr_));
// Create reservation for the client in subnet1. Because this subnet is
- // not allowed for the client the client should still be offerred a
+ // not allowed for the client the client should still be offered a
// lease from subnet2.
HostPtr host(new Host(&hwaddr_->hwaddr_[0], hwaddr_->hwaddr_.size(),
Host::IDENT_HWADDR, subnet1_->getID(),
TEST_F(SharedNetworkAlloc4Test, discoverSharedNetworkPoolClassification) {
// Try to offer address from subnet1. There is one address available
- // so it should be offerred.
+ // so it should be offered.
AllocEngine::ClientContext4
ctx(subnet1_, ClientIdPtr(), hwaddr_, IOAddress::IPV4_ZERO_ADDRESS(),
false, false, "host.example.com.", true);
EXPECT_EQ("10.2.3.23", lease->addr_.toText());
// Let's create a lease for the client to make sure the lease is not
- // renewed but a reserved lease is offerred.
+ // renewed but a reserved lease is offered.
Lease4Ptr lease2(new Lease4(IOAddress("192.0.2.17"), hwaddr_, ClientIdPtr(),
501, time(NULL), subnet1_->getID()));
lease->cltt_ = time(NULL) - 10; // Allocated 10 seconds ago
EXPECT_EQ("10.2.3.23", lease->addr_.toText());
// Let's create a lease for the client to make sure the lease is not
- // renewed but a reserved lease is offerred.
+ // renewed but a reserved lease is offered.
Lease4Ptr lease2(new Lease4(IOAddress("192.0.2.17"), hwaddr_, ClientIdPtr(),
501, time(NULL), subnet1_->getID()));
lease->cltt_ = time(NULL) - 10; // Allocated 10 seconds ago
// Ok, we're out. We should not get anything now.
lease = engine_.allocateLease4(ctx);
- EXPECT_FALSE(lease);
+ ASSERT_FALSE(lease);
+
+ EXPECT_EQ(1, getStatistics("v4-allocation-fail"));
+ EXPECT_EQ(1, getStatistics("v4-allocation-fail-shared-network"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
}
// This test verifies that the server can offer an address from a
// the first subnet is exhausted.
TEST_F(SharedNetworkAlloc4Test, requestSharedNetworkClassification) {
// Try to offer address from subnet1. There is one address available
- // so it should be offerred.
+ // so it should be offered.
AllocEngine::ClientContext4
ctx(subnet1_, ClientIdPtr(), hwaddr_, IOAddress::IPV4_ZERO_ADDRESS(),
false, false, "host.example.com.", false);
// the first subnet requires another class.
TEST_F(SharedNetworkAlloc4Test, requestSharedNetworkPoolClassification) {
// Try to offer address from subnet1. There is one address available
- // so it should be offerred.
+ // so it should be offered.
AllocEngine::ClientContext4
ctx(subnet1_, ClientIdPtr(), hwaddr_, IOAddress::IPV4_ZERO_ADDRESS(),
false, false, "host.example.com.", false);
// CASE 1: Asking for any address
AllocEngine::ClientContext4 ctx1(subnet_, clientid_, hwaddr_,
- IOAddress("0.0.0.0"), false, false,
- "", true);
+ IOAddress("0.0.0.0"), false, false,
+ "", true);
ctx1.query_.reset(new Pkt4(DHCPDISCOVER, 1234));
lease = engine->allocateLease4(ctx1);
// Check that we got that single lease
// CASE 2: Asking specifically for this address
AllocEngine::ClientContext4 ctx2(subnet_, clientid_, hwaddr_,
- IOAddress(addr), false, false,
- "", true);
+ IOAddress(addr), false, false,
+ "", true);
ctx2.query_.reset(new Pkt4(DHCPDISCOVER, 1234));
lease = engine->allocateLease4(ctx2);
// Check that we got that single lease
// Allocation engine should return NULL.
ASSERT_FALSE(new_lease);
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
+
// Now simulate the DHCPDISCOVER case when the provided address is
// treated as a hint. The engine should return a lease for a
// different address than requested.
// Initially, there was no lease for this client, so the returned old
// lease should be NULL.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
}
// This test checks behavior of the allocation engine in the following scenario:
// Client had no lease in the database, so the old lease returned should
// be NULL.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
}
// This test checks the behavior of the allocation engine in the following
AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
AllocEngine::ClientContext4 ctx1(subnet_, clientid_, hwaddr_,
- IOAddress("192.0.2.234"), false, false,
- "", false);
+ IOAddress("192.0.2.234"), false, false,
+ "", false);
ctx1.query_.reset(new Pkt4(DHCPREQUEST, 1234));
AllocEngine::findReservation(ctx1);
Lease4Ptr lease = engine.allocateLease4(ctx1);
ASSERT_FALSE(lease);
ASSERT_FALSE(ctx1.old_lease_);
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
+
// Now, request a correct address. The client should obtain it.
AllocEngine::ClientContext4 ctx2(subnet_, clientid_, hwaddr_,
- IOAddress("192.0.2.123"), false, false,
- "", false);
+ IOAddress("192.0.2.123"), false, false,
+ "", false);
ctx2.query_.reset(new Pkt4(DHCPREQUEST, 1234));
AllocEngine::findReservation(ctx2);
lease = engine.allocateLease4(ctx2);
ASSERT_TRUE(from_mgr);
detailCompareLease(lease, from_mgr);
- EXPECT_FALSE(ctx2.old_lease_);
+ ASSERT_FALSE(ctx2.old_lease_);
}
// This test checks the behavior of the allocation engine in the following
// to the lease database.
EXPECT_FALSE(LeaseMgrFactory::instance().getLease4(lease->addr_));
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
}
// This test checks that the behavior of the allocation engine in the following
// Try to allocate the reserved lease to client B.
AllocEngine::ClientContext4 ctx1(subnet_, clientid_, hwaddr_,
- IOAddress("192.0.2.123"), false, false,
- "", false);
+ IOAddress("192.0.2.123"), false, false,
+ "", false);
ctx1.query_.reset(new Pkt4(DHCPREQUEST, 1234));
AllocEngine::findReservation(ctx1);
Lease4Ptr allocated_lease = engine.allocateLease4(ctx1);
// The lease is allocated to someone else, so the allocation should not
// succeed.
ASSERT_FALSE(allocated_lease);
- EXPECT_FALSE(ctx1.old_lease_);
+ ASSERT_FALSE(ctx1.old_lease_);
+
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
// Make sure that the allocation engine didn't modify the lease of the
// client A.
// Try doing the same thing, but this time do not request any specific
// address. It should have the same effect.
AllocEngine::ClientContext4 ctx2(subnet_, clientid_, hwaddr_,
- IOAddress("0.0.0.0"), false, false,
- "", false);
+ IOAddress("0.0.0.0"), false, false,
+ "", false);
ctx2.query_.reset(new Pkt4(DHCPREQUEST, 1234));
AllocEngine::findReservation(ctx2);
allocated_lease = engine.allocateLease4(ctx2);
ASSERT_FALSE(allocated_lease);
- EXPECT_FALSE(ctx2.old_lease_);
+ ASSERT_FALSE(ctx2.old_lease_);
+
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
from_mgr = LeaseMgrFactory::instance().getLease4(lease->addr_);
ASSERT_TRUE(from_mgr);
// The allocation engine is not able to allocate the lease to the client
// B, because the address is in use by client A.
AllocEngine::ClientContext4 ctx1(subnet_, clientid_, hwaddr_,
- IOAddress("192.0.2.123"), false, false,
- "", true);
+ IOAddress("192.0.2.123"), false, false,
+ "", true);
ctx1.query_.reset(new Pkt4(DHCPREQUEST, 1234));
AllocEngine::findReservation(ctx1);
Lease4Ptr allocated_lease = engine.allocateLease4(ctx1);
// The allocation engine should return a lease but for a different address
// than requested because this address is in use.
ASSERT_TRUE(allocated_lease);
- EXPECT_FALSE(ctx1.old_lease_);
+ ASSERT_FALSE(ctx1.old_lease_);
EXPECT_NE(allocated_lease->addr_.toText(), "192.0.2.123");
EXPECT_TRUE(subnet_->inPool(Lease::TYPE_V4, allocated_lease->addr_));
-
// Do the same test. But, this time do not specify any address to be
// allocated.
AllocEngine::ClientContext4 ctx2(subnet_, clientid_, hwaddr_,
- IOAddress("0.0.0.0"), false, false,
- "", true);
+ IOAddress("0.0.0.0"), false, false,
+ "", true);
ctx2.query_.reset(new Pkt4(DHCPREQUEST, 1234));
AllocEngine::findReservation(ctx2);
allocated_lease = engine.allocateLease4(ctx2);
ASSERT_TRUE(allocated_lease);
EXPECT_NE(allocated_lease->addr_.toText(), "192.0.2.123");
EXPECT_TRUE(subnet_->inPool(Lease::TYPE_V4, allocated_lease->addr_));
- EXPECT_FALSE(ctx2.old_lease_);
+ ASSERT_FALSE(ctx2.old_lease_);
}
// This test checks that the behavior of the allocation engine in the following
// Try to allocate a lease and specify a different address than reserved
// and different from the one that client is currently using.
AllocEngine::ClientContext4 ctx1(subnet_, clientid_, hwaddr_,
- IOAddress("192.0.2.102"), false, false,
- "", false);
+ IOAddress("192.0.2.102"), false, false,
+ "", false);
ctx1.query_.reset(new Pkt4(DHCPREQUEST, 1234));
AllocEngine::findReservation(ctx1);
Lease4Ptr allocated_lease = engine.allocateLease4(ctx1);
ASSERT_FALSE(allocated_lease);
ASSERT_FALSE(ctx1.old_lease_);
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
+
// Repeat the test, but this time ask for the address that the client
// has allocated.
AllocEngine::ClientContext4 ctx2(subnet_, clientid_, hwaddr_,
- IOAddress("192.0.2.101"), false, false,
- "", false);
+ IOAddress("192.0.2.101"), false, false,
+ "", false);
ctx2.query_.reset(new Pkt4(DHCPREQUEST, 1234));
AllocEngine::findReservation(ctx2);
allocated_lease = engine.allocateLease4(ctx2);
// for this client. The server doesn't allow for the renewal and
// responds with DHCPNAK to force the client to return to the
// DHCP server discovery.
- EXPECT_FALSE(allocated_lease);
- EXPECT_FALSE(ctx2.old_lease_);
+ ASSERT_FALSE(allocated_lease);
+ ASSERT_FALSE(ctx2.old_lease_);
+
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
}
// This test checks that the behavior of the allocation engine in the following
// Try to allocate a lease and use a completely different address
// as a hint.
AllocEngine::ClientContext4 ctx1(subnet_, clientid_, hwaddr_,
- IOAddress("192.0.2.102"), false, false,
- "", true);
+ IOAddress("192.0.2.102"), false, false,
+ "", true);
ctx1.query_.reset(new Pkt4(DHCPDISCOVER, 1234));
AllocEngine::findReservation(ctx1);
Lease4Ptr allocated_lease = engine.allocateLease4(ctx1);
// Repeat the test but this time ask for the address for which the
// client has a lease.
AllocEngine::ClientContext4 ctx2(subnet_, clientid_, hwaddr_,
- IOAddress("192.0.2.101"), false, false,
- "", true);
+ IOAddress("192.0.2.101"), false, false,
+ "", true);
ctx2.query_.reset(new Pkt4(DHCPDISCOVER, 1234));
AllocEngine::findReservation(ctx2);
allocated_lease = engine.allocateLease4(ctx2);
Lease4Ptr from_mgr = LeaseMgrFactory::instance().getLease4(lease->addr_);
ASSERT_TRUE(from_mgr);
detailCompareLease(lease, from_mgr);
-
-
}
// This test checks that the behavior of the allocation engine in the following
AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
-
// Client B sends a DHCPREQUEST to allocate a reserved lease. The
// allocation engine can't allocate a reserved lease for this client
// because this specific address is in use by the Client A.
AllocEngine::ClientContext4 ctx1(subnet_, ClientIdPtr(), hwaddr2_,
- IOAddress("192.0.2.101"), false, false,
- "", false);
+ IOAddress("192.0.2.101"), false, false,
+ "", false);
ctx1.query_.reset(new Pkt4(DHCPREQUEST, 1234));
AllocEngine::findReservation(ctx1);
Lease4Ptr offered_lease = engine.allocateLease4(ctx1);
ASSERT_FALSE(offered_lease);
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
+
// Client A tries to renew the lease. The renewal should fail because
// server detects that Client A doesn't have reservation for this
// address.
AllocEngine::ClientContext4 ctx2(subnet_, clientid_, hwaddr_,
- IOAddress("192.0.2.101"), false, false,
- "", false);
+ IOAddress("192.0.2.101"), false, false,
+ "", false);
ctx2.query_.reset(new Pkt4(DHCPREQUEST, 1234));
AllocEngine::findReservation(ctx2);
ASSERT_FALSE(engine.allocateLease4(ctx2));
-
ASSERT_FALSE(ctx2.old_lease_);
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
+
// Client A returns to DHCPDISCOVER and should be offered a lease.
// The offered lease address must be different than the one the
// Client B has reservation for.
AllocEngine::ClientContext4 ctx3(subnet_, clientid_, hwaddr_,
- IOAddress("192.0.2.101"), false, false,
- "", true);
+ IOAddress("192.0.2.101"), false, false,
+ "", true);
ctx3.query_.reset(new Pkt4(DHCPREQUEST, 1234));
AllocEngine::findReservation(ctx3);
offered_lease = engine.allocateLease4(ctx3);
// the previous lease should be released and become available for the
// Client B.
AllocEngine::ClientContext4 ctx4(subnet_, clientid_, hwaddr_,
- offered_lease->addr_, false, false,
- "", false);
+ offered_lease->addr_, false, false,
+ "", false);
ctx4.query_.reset(new Pkt4(DHCPREQUEST, 1234));
AllocEngine::findReservation(ctx4);
Lease4Ptr allocated_lease = engine.allocateLease4(ctx4);
// a reserved lease.
AllocEngine::ClientContext4 ctx5(subnet_, ClientIdPtr(), hwaddr2_,
IOAddress("0.0.0.0"), false, false,
- "", true);
+ "", true);
ctx5.query_.reset(new Pkt4(DHCPREQUEST, 1234));
AllocEngine::findReservation(ctx5);
offered_lease = engine.allocateLease4(ctx5);
// Client B requests allocation of the lease and it should succeed.
AllocEngine::ClientContext4 ctx6(subnet_, ClientIdPtr(), hwaddr2_,
offered_lease->addr_, false, false,
- "", false);
+ "", false);
ctx6.query_.reset(new Pkt4(DHCPREQUEST, 1234));
allocated_lease = engine.allocateLease4(ctx6);
// dynamic pool, i.e. 192.0.2.100. This address is reserved so we expect
// that a different address will be allocated.
AllocEngine::ClientContext4 ctx(subnet_, ClientIdPtr(), hwaddr_,
- IOAddress("0.0.0.0"), false, false,
+ IOAddress("0.0.0.0"), false, false,
"", false);
ctx.query_.reset(new Pkt4(DHCPREQUEST, 1234));
AllocEngine::findReservation(ctx);
// The client should get no lease (DHCPNAK).
ASSERT_FALSE(allocated_lease);
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
+
// The same client should get a different lease than requested if
// if is sending a DHCPDISCOVER (fake allocation is true).
AllocEngine::ClientContext4 ctx2(subnet_, ClientIdPtr(), hwaddr_,
AllocEngine::findReservation(ctx1);
Lease4Ptr allocated_lease = engine.allocateLease4(ctx1);
- EXPECT_FALSE(allocated_lease);
+ ASSERT_FALSE(allocated_lease);
+
+ EXPECT_EQ(1, getStatistics("v4-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network"));
+ EXPECT_EQ(1, getStatistics("v4-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
// Now, let's remove the reservation.
initSubnet(IOAddress("192.0.2.100"), IOAddress("192.0.2.100"));
Lease4Ptr lease = engine->allocateLease4(ctx);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Check that we got a lease
ASSERT_TRUE(lease);
Lease4Ptr lease = engine->allocateLease4(ctx);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Check that we got a lease
ASSERT_TRUE(lease);
// Client had no lease in the database, so the old lease returned should
// be NULL.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
}
// This test checks the behavior of the allocation engine in the following
// Client had no lease in the database, so the old lease returned should
// be NULL.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
}
// This test checks the behavior of the allocation engine in the following
// Client had no lease in the database, so the old lease returned should
// be NULL.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
}
// This test checks the behavior of the allocation engine in the following
// Client had no lease in the database, so the old lease returned should
// be NULL.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
}
// This test checks the behavior of the allocation engine in the following
// Client had no lease in the database, so the old lease returned should
// be NULL.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
}
// This test checks the behavior of the allocation engine in the following
// Client had no lease in the database, so the old lease returned should
// be NULL.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
}
// This test checks the behavior of the allocation engine in the following
// Client had no lease in the database, so the old lease returned should
// be NULL.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
}
// This test checks the behavior of the allocation engine in the following
// Client had no lease in the database, so the old lease returned should
// be NULL.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
}
-
// Exercises AllocEnginer4Test::updateExtendedInfo4() through various
// permutations of client packet content.
TEST_F(AllocEngine4Test, updateExtendedInfo4) {
// Create the allocation engine, context and lease.
NakedAllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
-
-
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_,
IOAddress::IPV4_ZERO_ADDRESS(),
false, false, "", true);
Lease4Ptr lease = engine->allocateLease4(ctx);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Check that we got a lease
ASSERT_TRUE(lease);
Lease4Ptr lease = engine->allocateLease4(ctx);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Check that we got a lease
ASSERT_TRUE(lease);
EXPECT_EQ(infinity_lft, lease->valid_lft_);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Do it again, this should amount to the renew of an existing lease
Lease4Ptr lease2 = engine->allocateLease4(ctx);
Lease4Ptr lease = engine->allocateLease4(ctx);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Check that we got a lease
ASSERT_TRUE(lease);
Lease4Ptr lease = engine->allocateLease4(ctx);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Check that we got a lease
ASSERT_TRUE(lease);
EXPECT_EQ(infinity_lft, lease->valid_lft_);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Do it again, this should amount to the renew of an existing lease
Lease4Ptr lease2 = engine->allocateLease4(ctx);
Lease4Ptr lease = engine->allocateLease4(ctx);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Check that we got a lease
ASSERT_TRUE(lease);
Lease4Ptr lease = engine->allocateLease4(ctx);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Check that we got a lease
ASSERT_TRUE(lease);
EXPECT_EQ(infinity_lft, lease->valid_lft_);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Do it again, this should amount to the renew of an existing lease
Lease4Ptr lease2 = engine->allocateLease4(ctx);
Lease4Ptr lease = engine->allocateLease4(ctx);
// The new lease has been allocated, so the old lease should not exist.
- EXPECT_FALSE(ctx.old_lease_);
+ ASSERT_FALSE(ctx.old_lease_);
// Check that we got a lease
ASSERT_TRUE(lease);
EXPECT_NO_THROW(lease = expectOneLease(engine->allocateLeases6(ctx1)));
ASSERT_FALSE(lease);
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes"));
+
// Allocations without DUID are not allowed either
AllocEngine::ClientContext6 ctx2(subnet_, DuidPtr(), false, false, "", false,
Pkt6Ptr(new Pkt6(DHCPV6_REQUEST, 1234)));
ctx2.currentIA().iaid_ = iaid_;
EXPECT_NO_THROW(lease = expectOneLease(engine->allocateLeases6(ctx2)));
ASSERT_FALSE(lease);
-}
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes"));
+}
// This test verifies that the allocator picks addresses that belong to the
// pool
Lease6Ptr lease2;
EXPECT_NO_THROW(lease2 = expectOneLease(engine->allocateLeases6(ctx)));
- EXPECT_FALSE(lease2);
+ ASSERT_FALSE(lease2);
+ EXPECT_EQ(1, getStatistics("v6-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network"));
+ EXPECT_EQ(1, getStatistics("v6-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes"));
}
-
// This test checks if an expired lease can be reused in SOLICIT (fake allocation)
TEST_F(AllocEngine6Test, solicitReuseExpiredLease6) {
boost::scoped_ptr<AllocEngine> engine;
ctx1.currentIA().iaid_ = iaid_;
EXPECT_NO_THROW(lease = expectOneLease(engine->allocateLeases6(ctx1)));
+
// Check that we got that single lease
ASSERT_TRUE(lease);
EXPECT_EQ(addr, lease->addr_);
// Check that the old lease has been returned.
Lease6Ptr old_lease = expectOneLease(ctx.currentIA().old_leases_);
+ ASSERT_TRUE(old_lease);
+
// It should at least have the same IPv6 address.
EXPECT_EQ(lease->addr_, old_lease->addr_);
// Check that it carries not updated FQDN data.
// The default pool is 2001:db8:1::10 to 2001:db8:1::20. There's 17
// addresses in it. One of them is reserved, so this means that we should
- // get 16 successes and 14 (20-16) failures.
+ // get 16 successes and 14 (30-16) failures.
int success = 0;
int failure = 0;
for (int i = 0; i < 30; i++) {
if (leases.empty()) {
failure++;
std::cout << "Alloc for client " << (int)i << " failed." << std::endl;
+ EXPECT_EQ(failure, getStatistics("v6-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network"));
+ EXPECT_EQ(failure, getStatistics("v6-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes"));
} else {
success++;
std::cout << "Alloc for client " << (int)i << " succeeded:"
// Subnet is required for allocation, so we should get no leases.
EXPECT_NO_THROW(leases = engine.allocateLeases6(ctx));
- EXPECT_TRUE(leases.empty());
+ ASSERT_TRUE(leases.empty());
+
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes"));
// Let's fix this and break it in a different way.
ctx.subnet_ = subnet_;
// We must know who we're allocating for. No duid = no service.
EXPECT_NO_THROW(leases = engine.allocateLeases6(ctx));
- EXPECT_TRUE(leases.empty());
+ ASSERT_TRUE(leases.empty());
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes"));
}
// Checks whether an address can be renewed (simple case, no reservation tricks)
EXPECT_EQ("2001:db8:1::1c", lease->addr_.toText());
}
-
// Checks that a client gets the address reserved (in-pool case)
// This test checks the behavior of the allocation engine in the following
// scenario:
AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 3);
Lease6Collection leases = allocateTest(engine, pool_, IOAddress("::"),
false, true);
- ASSERT_EQ(0, leases.size());
+ ASSERT_TRUE(leases.empty());
+
+ EXPECT_EQ(1, getStatistics("v6-allocation-fail"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network"));
+ EXPECT_EQ(1, getStatistics("v6-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes"));
// This time, lets allow more attempts, and expect that the allocation will
// be successful.
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 if an expired-reclaimed lease can be reused by
ASSERT_TRUE(subnet1_->inRange(lease->addr_));
}
-
// This test verifies that the server can pick a subnet from shared subnets
// based on hints.
TEST_F(SharedNetworkAlloc6Test, solicitSharedNetworkHint) {
ASSERT_TRUE(subnet2_->inRange(lease->addr_));
}
-// This test verifies that the client is offerred an address from an
+// This test verifies that the client is offered an address from an
// alternative subnet within shared network when the address pool is
// exhausted in the first address pool.
TEST_F(SharedNetworkAlloc6Test, solicitSharedNetworkOutOfAddresses) {
ASSERT_TRUE(lease2);
ASSERT_TRUE(subnet2_->inRange(lease2->addr_));
- // The client having a lease should be offerred this lease, even if
+ // The client having a lease should be offered this lease, even if
// the client starts allocation from the second subnet. The code should
// determine that the client has a lease in subnet1 and use this subnet
// instead.
// the first subnet is exhausted.
TEST_F(SharedNetworkAlloc6Test, solicitSharedNetworkClassification) {
// Try to offer address from subnet1. There is an address available so
- // it should be offerred.
+ // it should be offered.
Pkt6Ptr query(new Pkt6(DHCPV6_SOLICIT, 1234));
AllocEngine::ClientContext6 ctx(subnet1_, duid_, false, false, "", true,
query);
// the first subnet requires another class.
TEST_F(SharedNetworkAlloc6Test, solicitSharedNetworkPoolClassification) {
// Try to offer address from subnet1. There is an address available so
- // it should be offerred.
+ // it should be offered.
Pkt6Ptr query(new Pkt6(DHCPV6_SOLICIT, 1234));
AllocEngine::ClientContext6 ctx(subnet1_, duid_, false, false, "", true,
query);
EXPECT_EQ("2001:db8:1::1", lease->addr_.toText());
}
-// This test verifies that the client is offerred a reserved address
+// This test verifies that the client is offered a reserved address
// even if this address belongs to another subnet within the same
// shared network.
TEST_F(SharedNetworkAlloc6Test, solicitSharedNetworkReservations) {
ASSERT_EQ("2001:db8:2::15", lease->addr_.toText());
}
-// This test verifies that the client is offerred a reserved address
+// This test verifies that the client is offered a reserved address
// even if this address belongs to another subnet within the same
// shared network. Host lookups returning a collection are disabled.
// As it is only an optimization the behavior (so the test) must stay
Lease6Collection leases = engine_.allocateLeases6(ctx2);
// Bugger off, we're full!
- EXPECT_TRUE(leases.empty());
+ ASSERT_TRUE(leases.empty());
+
+ EXPECT_EQ(1, getStatistics("v6-allocation-fail"));
+ EXPECT_EQ(1, getStatistics("v6-allocation-fail-shared-network"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-subnet"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools"));
+ EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes"));
}
// Verifies that client with a hostname reservation can
IOAddress duid2_addr_;
};
-
// Exercises AllocEnginer6Test::updateExtendedInfo6() through various
// permutations of client packet content.
TEST_F(AllocEngine6ExtendedInfoTest, updateExtendedInfo6) {
ctx.currentIA().addHint(addr);
EXPECT_NO_THROW(lease = expectOneLease(engine->allocateLeases6(ctx)));
+ ASSERT_TRUE(lease);
EXPECT_EQ(addr, lease->addr_);
EXPECT_EQ(128, lease->prefixlen_);
ctx.currentIA().addHint(addr);
EXPECT_NO_THROW(lease = expectOneLease(engine->allocateLeases6(ctx)));
+ ASSERT_TRUE(lease);
EXPECT_EQ(addr, lease->addr_);
EXPECT_EQ(128, lease->prefixlen_);
ctx.currentIA().addHint(prefix, prefixlen);
EXPECT_NO_THROW(lease = expectOneLease(engine->renewLeases6(ctx)));
+ ASSERT_TRUE(lease);
EXPECT_EQ(prefix, lease->addr_);
EXPECT_EQ(prefixlen, lease->prefixlen_);
ctx.currentIA().addHint(addr);
EXPECT_NO_THROW(lease = expectOneLease(engine->allocateLeases6(ctx)));
+ ASSERT_TRUE(lease);
EXPECT_EQ(addr, lease->addr_);
EXPECT_EQ(128, lease->prefixlen_);
ctx.currentIA().addHint(prefix, prefixlen);
EXPECT_NO_THROW(lease = expectOneLease(engine->renewLeases6(ctx)));
+ ASSERT_TRUE(lease);
EXPECT_EQ(prefix, lease->addr_);
EXPECT_EQ(prefixlen, lease->prefixlen_);
ctx.currentIA().addHint(addr);
EXPECT_NO_THROW(lease = expectOneLease(engine->allocateLeases6(ctx)));
+ ASSERT_TRUE(lease);
EXPECT_EQ(addr, lease->addr_);
EXPECT_EQ(128, lease->prefixlen_);
ctx.currentIA().addHint(prefix, prefixlen);
EXPECT_NO_THROW(lease = expectOneLease(engine->renewLeases6(ctx)));
+ ASSERT_TRUE(lease);
EXPECT_EQ(prefix, lease->addr_);
EXPECT_EQ(prefixlen, lease->prefixlen_);
ctx.currentIA().addHint(addr);
EXPECT_NO_THROW(lease = expectOneLease(engine->allocateLeases6(ctx)));
+ ASSERT_TRUE(lease);
EXPECT_EQ(addr, lease->addr_);
EXPECT_EQ(128, lease->prefixlen_);
ctx.currentIA().addHint(prefix, prefixlen);
EXPECT_NO_THROW(lease = expectOneLease(engine->renewLeases6(ctx)));
+ ASSERT_TRUE(lease);
EXPECT_EQ(prefix, lease->addr_);
EXPECT_EQ(prefixlen, lease->prefixlen_);
ctx.currentIA().addHint(addr);
EXPECT_NO_THROW(lease = expectOneLease(engine->allocateLeases6(ctx)));
+ ASSERT_TRUE(lease);
EXPECT_EQ(addr, lease->addr_);
EXPECT_EQ(128, lease->prefixlen_);
ctx.currentIA().addHint(prefix, prefixlen);
EXPECT_NO_THROW(lease = expectOneLease(engine->renewLeases6(ctx)));
+ ASSERT_TRUE(lease);
EXPECT_EQ(prefix, lease->addr_);
EXPECT_EQ(prefixlen, lease->prefixlen_);
ctx.currentIA().addHint(addr);
EXPECT_NO_THROW(lease = expectOneLease(engine->renewLeases6(ctx)));
+ ASSERT_TRUE(lease);
EXPECT_EQ(addr, lease->addr_);
EXPECT_EQ(128, lease->prefixlen_);
ctx.currentIA().addHint(prefix, prefixlen);
EXPECT_NO_THROW(lease = expectOneLease(engine->renewLeases6(ctx)));
+ ASSERT_TRUE(lease);
EXPECT_EQ(prefix, lease->addr_);
EXPECT_EQ(prefixlen, lease->prefixlen_);
ctx.currentIA().addHint(addr);
EXPECT_NO_THROW(lease = expectOneLease(engine->allocateLeases6(ctx)));
+ ASSERT_TRUE(lease);
EXPECT_EQ(addr, lease->addr_);
EXPECT_EQ(128, lease->prefixlen_);
ctx.currentIA().addHint(prefix, prefixlen);
EXPECT_NO_THROW(lease = expectOneLease(engine->renewLeases6(ctx)));
+ ASSERT_TRUE(lease);
EXPECT_EQ(prefix, lease->addr_);
EXPECT_EQ(prefixlen, lease->prefixlen_);
ctx.currentIA().addHint(addr);
EXPECT_NO_THROW(lease = expectOneLease(engine->allocateLeases6(ctx)));
+ ASSERT_TRUE(lease);
EXPECT_EQ(addr, lease->addr_);
EXPECT_EQ(128, lease->prefixlen_);
ctx.currentIA().addHint(prefix, prefixlen);
EXPECT_NO_THROW(lease = expectOneLease(engine->renewLeases6(ctx)));
+ ASSERT_TRUE(lease);
EXPECT_EQ(prefix, lease->addr_);
EXPECT_EQ(prefixlen, lease->prefixlen_);
ctx.currentIA().addHint(addr);
EXPECT_NO_THROW(lease = expectOneLease(engine->allocateLeases6(ctx)));
+ ASSERT_TRUE(lease);
EXPECT_EQ(addr, lease->addr_);
EXPECT_EQ(128, lease->prefixlen_);
ctx.currentIA().addHint(prefix, prefixlen);
EXPECT_NO_THROW(lease = expectOneLease(engine->renewLeases6(ctx)));
+ ASSERT_TRUE(lease);
EXPECT_EQ(prefix, lease->addr_);
EXPECT_EQ(prefixlen, lease->prefixlen_);