// Instantiate allocation engine. The number of allocation attempts equal
// to zero indicates that the allocation engine will use the number of
// attempts depending on the pool size.
- alloc_engine_.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 0,
- false /* false = IPv4 */));
+ alloc_engine_.reset(new AllocEngine(0, false /* false = IPv4 */));
/// @todo call loadLibraries() when handling configuration changes
// Instantiate allocation engine. The number of allocation attempts equal
// to zero indicates that the allocation engine will use the number of
// attempts depending on the pool size.
- alloc_engine_.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 0));
+ alloc_engine_.reset(new AllocEngine(0));
/// @todo call loadLibraries() when handling configuration changes
namespace isc {
namespace dhcp {
-AllocEngine::AllocEngine(AllocType, uint64_t attempts, bool ipv6)
+AllocEngine::AllocEngine(uint64_t attempts, bool ipv6)
: attempts_(attempts), incomplete_v4_reclamations_(0),
incomplete_v6_reclamations_(0) {
/// This class represents a DHCP allocation engine. It is responsible
/// for picking subnets, choosing and allocating a lease, extending,
/// renewing, releasing and possibly expiring leases.
-///
-/// @todo: Does not handle out of leases well
-/// @todo: Does not handle out of allocation attempts well
class AllocEngine : public boost::noncopyable {
public:
- /// @brief Specifies allocation type
- typedef enum {
- ALLOC_ITERATIVE, // iterative - one address after another
- ALLOC_HASHED, // hashed - client's DUID/client-id is hashed
- ALLOC_RANDOM // random - an address is randomly selected
- } AllocType;
-
/// @brief Constructor.
///
/// Instantiates necessary services, required to run DHCP server.
/// network interaction. Will instantiate lease manager, and load
/// old or create new DUID.
///
- /// @param engine_type selects allocation algorithm
/// @param attempts number of attempts for each lease allocation before
/// we give up (0 means unlimited)
/// @param ipv6 specifies if the engine should work for IPv4 or IPv6
- AllocEngine(AllocType engine_type, uint64_t attempts, bool ipv6 = true);
+ AllocEngine(uint64_t attempts, bool ipv6 = true);
/// @brief Destructor.
virtual ~AllocEngine() { }
// Create V4 (ipv6=false) Allocation Engine that will try at most
// 100 attempts to pick up a lease
- ASSERT_NO_THROW(x.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100,
- false)));
+ ASSERT_NO_THROW(x.reset(new AllocEngine(100, false)));
}
// This test checks if two simple IPv4 allocations succeed and that the
// not interfere with the allocation.
TEST_F(AllocEngine4Test, simpleAlloc4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
// Assigned addresses should be zero.
// This test checks that simple allocation uses the default valid lifetime.
TEST_F(AllocEngine4Test, defaultAlloc4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
// This test checks that simple allocation uses the specified valid lifetime.
TEST_F(AllocEngine4Test, hintAlloc4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
// This test checks that simple allocation uses the min valid lifetime.
TEST_F(AllocEngine4Test, minAlloc4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
// This test checks that simple allocation uses the max valid lifetime.
TEST_F(AllocEngine4Test, maxAlloc4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
// This test checks that simple allocation handles BOOTP queries.
TEST_F(AllocEngine4Test, bootpAlloc4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
// This test checks if the fake allocation (for DHCPDISCOVER) can succeed
TEST_F(AllocEngine4Test, fakeAlloc4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
// Assigned addresses should be zero.
// in pool and free) can succeed
TEST_F(AllocEngine4Test, allocWithValidHint4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_,
// in pool, but is currently used can succeed
TEST_F(AllocEngine4Test, allocWithUsedHint4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
// Let's create a lease and put it in the LeaseMgr
// can succeed. The invalid hint should be ignored completely.
TEST_F(AllocEngine4Test, allocBogusHint4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
// Client would like to get a 10.1.1.1 lease, which does not belong to any
// This test checks that NULL values are handled properly
TEST_F(AllocEngine4Test, allocateLease4Nulls) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
// Allocations without subnet are not allowed
// 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,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
EXPECT_TRUE(testStatistics("assigned-addresses", 0, subnet_->getID()));
// This test checks simple renewal uses the default valid lifetime.
TEST_F(AllocEngine4Test, defaultRenew4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
// This test checks simple renewal uses the specified valid lifetime.
TEST_F(AllocEngine4Test, hintRenew4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
// This test checks simple renewal uses the min valid lifetime.
TEST_F(AllocEngine4Test, minRenew4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
// This test checks simple renewal uses the max valid lifetime.
TEST_F(AllocEngine4Test, maxRenew4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
// This test checks simple renewal handles BOOTP queries.
TEST_F(AllocEngine4Test, bootpRenew4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
// This test checks if really small pools are working
TEST_F(AllocEngine4Test, smallPool4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
IOAddress addr("192.0.2.17");
// to find out a new lease fails.
TEST_F(AllocEngine4Test, outOfAddresses4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
IOAddress addr("192.0.2.17");
/// @brief Initializes configuration (2 subnets, 1 shared network)
SharedNetworkAlloc4Test()
- :engine_(AllocEngine::ALLOC_ITERATIVE, 0, false) {
+ :engine_(0, false) {
// Create two subnets, each with a single address pool. The first subnet
// has only one address in its address pool to make it easier to simulate
// address exhaustion.
// allocation)
TEST_F(AllocEngine4Test, discoverReuseExpiredLease4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
IOAddress addr("192.0.2.15");
// This test checks if an expired lease can be reused in REQUEST (actual allocation)
TEST_F(AllocEngine4Test, requestReuseExpiredLease4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
IOAddress addr("192.0.2.105");
// to DHCPDISCOVER (fake allocation)
TEST_F(AllocEngine4Test, discoverReuseDeclinedLease4) {
- AllocEnginePtr engine(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false));
+ AllocEnginePtr engine(new AllocEngine( 0, false));
ASSERT_TRUE(engine);
// Now prepare a configuration with single address pool.
TEST_F(AllocEngine4Test, discoverReuseDeclinedLease4Stats) {
// Now prepare for DISCOVER processing
- AllocEnginePtr engine(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false));
+ AllocEnginePtr engine(new AllocEngine( 0, false));
ASSERT_TRUE(engine);
// Now prepare a configuration with single address pool.
// to REQUEST (actual allocation)
TEST_F(AllocEngine4Test, requestReuseDeclinedLease4) {
- AllocEnginePtr engine(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false));
+ AllocEnginePtr engine(new AllocEngine( 0, false));
ASSERT_TRUE(engine);
// Now prepare a configuration with single address pool.
// is reused when responding to DHCPREQUEST (actual allocation)
TEST_F(AllocEngine4Test, requestReuseDeclinedLease4Stats) {
- AllocEnginePtr engine(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false));
+ AllocEnginePtr engine(new AllocEngine( 0, false));
ASSERT_TRUE(engine);
// Now prepare a configuration with single address pool.
100, time(NULL), subnet_->getID()));
LeaseMgrFactory::instance().addLease(lease);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_,
IOAddress::IPV4_ZERO_ADDRESS(),
false, false, "", true);
LeaseMgrFactory::instance().addLease(lease);
LeaseMgrFactory::instance().addLease(lease2);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
// First client requests the lease which belongs to the second client.
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("192.0.2.102"),
CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
CfgMgr::instance().commit();
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
// Try to allocate a lease without specifying a hint. This is actually
// incorrect behavior of the client to not send an address it wants to
CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
CfgMgr::instance().commit();
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
// Query allocation engine for the lease to be assigned to this
// client without specifying the address to be assigned.
CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
CfgMgr::instance().commit();
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
AllocEngine::ClientContext4 ctx1(subnet_, clientid_, hwaddr_,
IOAddress("192.0.2.234"), false, false,
CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
CfgMgr::instance().commit();
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
// Query the allocation engine for the lease to be assigned to the client
// and specify a hint being a different address than the reserved one.
false, false, ""));
LeaseMgrFactory::instance().addLease(lease);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
// Request allocation of the reserved address.
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_,
false, false, ""));
LeaseMgrFactory::instance().addLease(lease);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
// Try to allocate the reserved lease to client B.
AllocEngine::ClientContext4 ctx1(subnet_, clientid_, hwaddr_,
false, false, ""));
LeaseMgrFactory::instance().addLease(lease);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
// Query allocation engine for the lease to be allocated to the client B.
// The allocation engine is not able to allocate the lease to the client
false, false, ""));
LeaseMgrFactory::instance().addLease(lease);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
// Try to allocate a lease and specify a different address than reserved
// and different from the one that client is currently using.
false, false, ""));
LeaseMgrFactory::instance().addLease(lease);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
// Try to allocate a lease and use a completely different address
// as a hint.
false, false, ""));
LeaseMgrFactory::instance().addLease(lease);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
// Try to allocate a lease with providing no hint.
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_,
false, false, ""));
LeaseMgrFactory::instance().addLease(lease);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
// Query the allocation engine for the lease to be allocated for the
// client.
false, false, ""));
LeaseMgrFactory::instance().addLease(lease);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
// Client B sends a DHCPREQUEST to allocate a reserved lease. The
// allocation engine can't allocate a reserved lease for this client
CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
CfgMgr::instance().commit();
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
// Different client tries to allocate a lease. Note, that we're using
// an iterative allocator which would pick the first address from the
CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
CfgMgr::instance().commit();
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
// Different client is requesting this address.
AllocEngine::ClientContext4 ctx1(subnet_, ClientIdPtr(), hwaddr_,
// address when the pool is exhausted, and the only available
// address is reserved for a different client.
TEST_F(AllocEngine4Test, reservedAddressShortPool) {
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
// Create short pool with only one address.
initSubnet(IOAddress("192.0.2.100"), IOAddress("192.0.2.100"));
// dynamic pool if the client's reservation is made for a hostname but
// not for an address.
TEST_F(AllocEngine4Test, reservedHostname) {
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
// Create a reservation for a hostname. Address is set to 0 which
// indicates that there is no reservation.
// the value of NULL in the host_ field of the client context.
TEST_F(AllocEngine4Test, findReservation) {
// Create the instance of the allocation engine.
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
// Context is required to call the AllocEngine::findReservation.
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_,
// statistic for allocated addresses is increased appropriately.
TEST_F(AllocEngine4Test, simpleAlloc4Stats) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
// and that it doesn't increase allocated-addresses statistic.
TEST_F(AllocEngine4Test, fakeAlloc4Stat) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 100, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_,
false, false, ""));
LeaseMgrFactory::instance().addLease(lease);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, false);
+ AllocEngine engine(100, false);
// Let's pretend 100 addresses were allocated already
string name = StatsMgr::generateName("subnet", subnet_->getID(),
CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
CfgMgr::instance().commit();
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
subnet_->setReservationsGlobal(true);
CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
CfgMgr::instance().commit();
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
subnet_->setReservationsGlobal(true);
CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
CfgMgr::instance().commit();
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
subnet_->setReservationsGlobal(true);
CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
CfgMgr::instance().commit();
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
subnet_->setReservationsGlobal(true);
CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
CfgMgr::instance().commit();
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
subnet_->setReservationsGlobal(true);
subnet_->setReservationsInSubnet(true);
CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
CfgMgr::instance().commit();
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
subnet_->setReservationsGlobal(true);
subnet_->setReservationsInSubnet(true);
CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
CfgMgr::instance().commit();
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
subnet_->setReservationsGlobal(true);
subnet_->setReservationsInSubnet(true);
CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
CfgMgr::instance().commit();
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
subnet_->setReservationsGlobal(true);
subnet_->setReservationsInSubnet(true);
}};
// Create the allocation engine, context and lease.
- NakedAllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ NakedAllocEngine engine(0, false);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_,
IOAddress::IPV4_ZERO_ADDRESS(),
}};
// Create the allocation engine, context and lease.
- NakedAllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ NakedAllocEngine engine(0, false);
// All of the scenarios require storage to be enabled.
subnet_->setStoreExtendedInfo(true);
}};
// Create the allocation engine, context and lease.
- NakedAllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ NakedAllocEngine engine(0, false);
// All of the scenarios require storage to be disabled.
subnet_->setStoreExtendedInfo(false);
// using cache threshold.
TEST_F(AllocEngine4Test, discoverCacheThreshold4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
// Set valid lifetime to 500.
// using cache threshold.
TEST_F(AllocEngine4Test, requestCacheThreshold4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
// Set valid lifetime to 500.
// using cache max age.
TEST_F(AllocEngine4Test, discoverCacheMaxAge4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
// Set valid lifetime to 500.
// using both cache threshold and max age.
TEST_F(AllocEngine4Test, requestCacheBoth4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
// Set valid lifetime to 500.
// using too small cache threshold.
TEST_F(AllocEngine4Test, discoverCacheBadThreshold4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
// Set valid lifetime to 500.
// using too small cache max age.
TEST_F(AllocEngine4Test, requestCacheBadMaxAge4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
// Set valid lifetime to 500.
// when the valid lifetime was reduced.
TEST_F(AllocEngine4Test, discoverCacheReducedValid4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
// Set valid lifetime to 200.
// when DDNS parameter changed.
TEST_F(AllocEngine4Test, requestCacheFwdDDNS4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
// Set valid lifetime to 500.
// when DDNS parameter changed.
TEST_F(AllocEngine4Test, discoverCacheRevDDNS4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
// Set valid lifetime to 500.
// when hostname changed.
TEST_F(AllocEngine4Test, requestCacheHostname4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
// Set valid lifetime to 500.
// Verifies that AllocEngine::getValidLft(ctx4) returns the appropriate
// lifetime value based on the context content.
TEST_F(AllocEngine4Test, getValidLft4) {
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+ AllocEngine engine(0, false);
// Let's make three classes, two with valid-lifetime and one without,
// and add them to the dictionary.
// This test checks that deleteRelease handles BOOTP leases.
TEST_F(AllocEngine4Test, bootpDelete) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
// This test checks that simple allocation handles BOOTP queries.
TEST_F(MySqlAllocEngine4Test, bootpAlloc4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
// This test checks simple renewal handles BOOTP queries.
TEST_F(MySqlAllocEngine4Test, bootpRenew4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
// This test checks that deleteRelease handles BOOTP leases.
TEST_F(MySqlAllocEngine4Test, bootpDelete) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
// This test checks that simple allocation handles BOOTP queries.
TEST_F(PgSqlAllocEngine4Test, bootpAlloc4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
// This test checks simple renewal handles BOOTP queries.
TEST_F(PgSqlAllocEngine4Test, bootpRenew4) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
// This test checks that deleteRelease handles BOOTP leases.
TEST_F(PgSqlAllocEngine4Test, bootpDelete) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 0, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
ASSERT_TRUE(engine);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
TEST_F(AllocEngine6Test, constructor) {
boost::scoped_ptr<AllocEngine> x;
- ASSERT_NO_THROW(x.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100, true)));
+ ASSERT_NO_THROW(x.reset(new AllocEngine(100, true)));
}
// This test checks if two simple IPv6 allocations succeed and that the
// This test checks that NULL values are handled properly
TEST_F(AllocEngine6Test, allocateAddress6Nulls) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Allocations without subnet are not allowed
// This test checks if really small pools are working
TEST_F(AllocEngine6Test, smallPool6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
IOAddress addr("2001:db8:1::ad");
// to find out a new lease fails.
TEST_F(AllocEngine6Test, outOfAddresses6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
IOAddress addr("2001:db8:1::ad");
// This test checks if an expired lease can be reused in SOLICIT (fake allocation)
TEST_F(AllocEngine6Test, solicitReuseExpiredLease6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
IOAddress addr("2001:db8:1::ad");
// This test checks if an expired lease can be reused using default lifetimes.
TEST_F(AllocEngine6Test, defaultReuseExpiredLease6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
IOAddress addr("2001:db8:1::ad");
// This test checks if an expired lease can be reused using specified lifetimes.
TEST_F(AllocEngine6Test, hintReuseExpiredLease6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
IOAddress addr("2001:db8:1::ad");
// This test checks if an expired lease can be reused using min lifetimes.
TEST_F(AllocEngine6Test, minReuseExpiredLease6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
IOAddress addr("2001:db8:1::ad");
// This test checks if an expired lease can be reused using max lifetimes.
TEST_F(AllocEngine6Test, maxReuseExpiredLease6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
IOAddress addr("2001:db8:1::ad");
// This test checks if an expired lease can be reused in REQUEST (actual allocation)
TEST_F(AllocEngine6Test, requestReuseExpiredLease6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
IOAddress addr("2001:db8:1::ad");
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100);
+ AllocEngine engine(100);
// This is what the client will send in his renew message.
AllocEngine::HintContainer hints;
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100);
+ AllocEngine engine(100);
subnet_->setPreferred(Triplet<uint32_t>(200, 300, 400));
subnet_->setValid(Triplet<uint32_t>(300, 400, 500));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100);
+ AllocEngine engine(100);
subnet_->setPreferred(Triplet<uint32_t>(200, 300, 400));
subnet_->setValid(Triplet<uint32_t>(300, 400, 500));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100);
+ AllocEngine engine(100);
subnet_->setPreferred(Triplet<uint32_t>(200, 300, 400));
subnet_->setValid(Triplet<uint32_t>(300, 400, 500));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100);
+ AllocEngine engine(100);
subnet_->setPreferred(Triplet<uint32_t>(200, 300, 400));
subnet_->setValid(Triplet<uint32_t>(300, 400, 500));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100);
+ AllocEngine engine(100);
// This is what the client will send in his renew message.
AllocEngine::HintContainer hints;
// as the pool is 2001:db8:1::10 - 2001:db8:1::20.
createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8:1::1c"), 128);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, false);
+ AllocEngine engine(100, false);
Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("::"), true);
ASSERT_TRUE(lease);
// as the pool is 2001:db8:1::10 - 2001:db8:1::20.
createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8:1::1c"), 128);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, false);
+ AllocEngine engine(100, false);
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
// as the pool is 2001:db8:1::10 - 2001:db8:1::20.
createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8:1::1c"), 128);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, false);
+ AllocEngine engine(100, false);
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
// as the pool is 2001:db8:1::10 - 2001:db8:1::20.
createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8:1::1c"), 128);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, false);
+ AllocEngine engine(100, false);
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
// as the pool is 2001:db8:1::10 - 2001:db8:1::20.
createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8:1::1c"), 128);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, false);
+ AllocEngine engine(100, false);
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
// as the pool is 2001:db8:1::10 - 2001:db8:1::20.
createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8:1::1c"), 128);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, false);
+ AllocEngine engine(100, false);
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
// as the pool is 2001:db8:1::10 - 2001:db8:1::20.
createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8::abcd"), 128);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, false);
+ AllocEngine engine(100, false);
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
// as the pool is 2001:db8:1::10 - 2001:db8:1::20.
createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8::abcd"), 128);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, false);
+ AllocEngine engine(100, false);
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
// as the pool is 2001:db8:1::10 - 2001:db8:1::20.
createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8::abcd"), 128);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, false);
+ AllocEngine engine(100, false);
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
// as the pool is 2001:db8:1::10 - 2001:db8:1::20.
createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8::abcd"), 128);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, false);
+ AllocEngine engine(100, false);
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
// as the pool is 2001:db8:1::10 - 2001:db8:1::20.
createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8::abcd"), 128);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, false);
+ AllocEngine engine(100, false);
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
// as the pool is 2001:db8:1::10 - 2001:db8:1::20.
createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8::abcd"), 128);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, false);
+ AllocEngine engine(100, false);
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
// Check that he is assigned a new lease for B
// - verify that the number of assigned address behaves as expected
TEST_F(AllocEngine6Test, reservedAddressInPoolReassignedThis) {
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, false);
+ AllocEngine engine(100, false);
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
// Check that his existing lease for lease A is removed
// Check that he is assigned a new lease
TEST_F(AllocEngine6Test, reservedAddressInPoolReassignedOther) {
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, false);
+ AllocEngine engine(100, false);
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
// we run out of addresses and remaining 14 clients will get nothing.
// Finally, we check that client A still can get his reserved address.
TEST_F(AllocEngine6Test, reservedAddress) {
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, true);
+ AllocEngine engine(100, true);
// Create reservation for the client. This is in-pool reservation,
// as the pool is 2001:db8:1::10 - 2001:db8:1::20.
// Checks if the allocateLeases throws exceptions for invalid input data.
TEST_F(AllocEngine6Test, allocateLeasesInvalidData) {
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, true);
+ AllocEngine engine(100, true);
// That looks like a valid context.
AllocEngine::ClientContext6 ctx(subnet_, duid_, false, false, "", false,
// Checks whether an address can be renewed (simple case, no reservation tricks)
TEST_F(AllocEngine6Test, addressRenewal) {
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100);
+ AllocEngine engine(100);
// Assigned count should zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
// as the pool is 2001:db8:1::10 - 2001:db8:1::20.
createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8:1::1c"), 128);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100);
+ AllocEngine engine(100);
// Assigned count should zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
CfgMgr::instance().commit();
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100);
+ AllocEngine engine(100);
AllocEngine::ClientContext6 ctx1(subnet_, duid_, false, false, "", true,
Pkt6Ptr(new Pkt6(DHCPV6_SOLICIT, 1234)));
CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
CfgMgr::instance().commit();
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100);
+ AllocEngine engine(100);
AllocEngine::ClientContext6 ctx1(subnet_, duid_, false, false, "", false,
Pkt6Ptr(new Pkt6(DHCPV6_REQUEST, 1234)));
// reservation for this client)
TEST_F(AllocEngine6Test, reservedAddressRenewChange) {
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100);
+ AllocEngine engine(100);
Lease6Collection leases;
// reservation for this address for another client)
TEST_F(AllocEngine6Test, reservedAddressRenewReserved) {
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100);
+ AllocEngine engine(100);
Lease6Collection leases;
createHost6HWAddr(true, IPv6Resrv::TYPE_NA, hwaddr_,
IOAddress("2001:db8:1::1c"), 128);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, false);
+ AllocEngine engine(100, false);
Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("::"), true);
ASSERT_TRUE(lease);
createHost6HWAddr(true, IPv6Resrv::TYPE_NA, hwaddr_,
IOAddress("2001:db8:1::1c"), 128);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, false);
+ AllocEngine engine(100, false);
Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("::"), false);
ASSERT_TRUE(lease);
createHost6HWAddr(true, IPv6Resrv::TYPE_NA, hwaddr_,
IOAddress("2001:db8:1::1c"), 128);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, false);
+ AllocEngine engine(100, false);
// Let's pretend the client sends hint 2001:db8:1::10.
Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("2001:db8:1::10"), true);
createHost6HWAddr(true, IPv6Resrv::TYPE_NA, hwaddr_,
IOAddress("2001:db8:1::1c"), 128);
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, false);
+ AllocEngine engine(100, false);
// Let's pretend the client sends hint 2001:db8:1::10.
Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("2001:db8:1::10"), false);
// value. This test verifies that the prefix can be allocated in that
// case.
TEST_F(AllocEngine6Test, largePDPool) {
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0);
+ AllocEngine engine(0);
// Remove the default PD pool.
subnet_->delPools(Lease::TYPE_PD);
// confuse the allocation engine if the number of available addresses
// was larger than 2^32.
TEST_F(AllocEngine6Test, largePoolOver32bits) {
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0);
+ AllocEngine engine(0);
// Configure 2001:db8::/32 subnet
subnet_ = Subnet6::create(IOAddress("2001:db8::"), 32, 1, 2, 3, 4);
// allocator will pick the addresses already allocated until it finds the
// available address. Since, we have restricted the number of attempts the
// allocation should fail.
- AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 3);
+ AllocEngine engine(3);
Lease6Collection leases = allocateTest(engine, pool_, IOAddress("::"),
false, true);
ASSERT_TRUE(leases.empty());
// This time, lets allow more attempts, and expect that the allocation will
// be successful.
- AllocEngine engine2(AllocEngine::ALLOC_ITERATIVE, 6);
+ AllocEngine engine2(6);
leases = allocateTest(engine2, pool_, IOAddress("::"), false, true);
ASSERT_EQ(1, leases.size());
}
// This test checks if an expired declined lease can be reused in SOLICIT (fake allocation)
TEST_F(AllocEngine6Test, solicitReuseDeclinedLease6) {
- AllocEnginePtr engine(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100));
+ AllocEnginePtr engine(new AllocEngine(100));
ASSERT_TRUE(engine);
// Now prepare a configuration with single address pool.
// to REQUEST (actual allocation)
TEST_F(AllocEngine6Test, requestReuseDeclinedLease6) {
- AllocEnginePtr engine(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100, true));
+ AllocEnginePtr engine(new AllocEngine(100, true));
ASSERT_TRUE(engine);
// Now prepare a configuration with single address pool.
TEST_F(AllocEngine6Test, solicitReuseDeclinedLease6Stats) {
// Now prepare for SOLICIT processing
- AllocEnginePtr engine(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 100, true));
+ AllocEnginePtr engine(new AllocEngine(100, true));
ASSERT_TRUE(engine);
// Now prepare a configuration with single address pool.
TEST_F(AllocEngine6Test, requestReuseDeclinedLease6Stats) {
// Prepare for REQUEST processing.
- AllocEnginePtr engine(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 100, true));
+ AllocEnginePtr engine(new AllocEngine(100, true));
ASSERT_TRUE(engine);
// Now prepare a configuration with single address pool.
// data across reboots.
TEST_F(AllocEngine6Test, reuseReclaimedExpiredViaRequest) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
IOAddress addr("2001:db8:1::ad");
class SharedNetworkAlloc6Test : public AllocEngine6Test {
public:
SharedNetworkAlloc6Test()
- :engine_(AllocEngine::ALLOC_ITERATIVE, 0) {
+ :engine_(0) {
subnet1_ = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
subnet2_ = Subnet6::create(IOAddress("2001:db8:2::"), 56, 1, 2, 3, 4);
// renew a dynamic lease from their selected subnet.
TEST_F(AllocEngine6Test, hostDynamicAddress) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
HostPtr host(new Host(&duid_->getDuid()[0], duid_->getDuid().size(),
// 3. Renew the same lease via RENEW/REBIND (calls renewLeases6)
TEST_F(AllocEngine6Test, globalHostDynamicAddress) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
HostPtr host(new Host(&duid_->getDuid()[0], duid_->getDuid().size(),
// renew a lease for an arbitrary address.
TEST_F(AllocEngine6Test, globalHostReservedAddress) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
HostPtr host(new Host(&duid_->getDuid()[0], duid_->getDuid().size(),
// renew a lease for an arbitrary prefix.
TEST_F(AllocEngine6Test, globalHostReservedPrefix) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
HostPtr host(new Host(&duid_->getDuid()[0], duid_->getDuid().size(),
// renew a lease for an address in the subnet.
TEST_F(AllocEngine6Test, mixedHostReservedAddress) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
HostPtr host(new Host(&duid_->getDuid()[0], duid_->getDuid().size(),
// renew a lease for a prefix in the subnet.
TEST_F(AllocEngine6Test, mixedHostReservedPrefix) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
HostPtr host(new Host(&duid_->getDuid()[0], duid_->getDuid().size(),
// can get and renew a lease for an address in the subnet.
TEST_F(AllocEngine6Test, bothHostReservedAddress) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
HostPtr ghost(new Host(&duid_->getDuid()[0], duid_->getDuid().size(),
// can get and renew a lease for a prefix in the subnet.
TEST_F(AllocEngine6Test, bothHostReservedPrefix) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
HostPtr ghost(new Host(&duid_->getDuid()[0], duid_->getDuid().size(),
public:
/// @brief Constructor
AllocEngine6ExtendedInfoTest()
- : engine_(AllocEngine::ALLOC_ITERATIVE, 100, true),
+ : engine_(100, true),
duid1_(), duid2_(), duid3_(), relay1_(), relay2_(), relay3_(),
duid1_addr_("::"), duid2_addr_("::") {
duid1_.reset(new DUID(std::vector<uint8_t>(8, 0x84)));
duid2_addr_ = IOAddress("2001:db8:1::11");
// Create the allocation engine, context and lease.
- NakedAllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100, true);
+ NakedAllocEngine engine(100, true);
}
/// Configuration elements. These are initialized in the constructor
// Checks whether fake allocation does not use the cache feature.
TEST_F(AllocEngine6Test, solicitNoCache) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Set the threshold to 25%.
// Checks whether a lease can be reused (request) using cache threshold.
TEST_F(AllocEngine6Test, requestCacheThreshold6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Set the threshold to 33%.
// Checks whether a lease can be reused (renew) using cache threshold.
TEST_F(AllocEngine6Test, renewCacheThreshold6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Set the threshold to 25%.
// Checks whether a lease can be reused (request) using cache max age.
TEST_F(AllocEngine6Test, requestCacheMaxAge6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Set the max age to 150.
// Checks whether a lease can be reused (renew) using cache max age.
TEST_F(AllocEngine6Test, renewCacheMaxAge6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Set the max age to 150.
// and max age.
TEST_F(AllocEngine6Test, requestCacheBoth6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Set the threshold to 25%.
// and max age.
TEST_F(AllocEngine6Test, renewCacheBoth6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Set the threshold to 25%.
// cache threshold.
TEST_F(AllocEngine6Test, requestCacheBadThreshold6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Set the threshold to 10%.
// cache threshold.
TEST_F(AllocEngine6Test, renewCacheBadThreshold6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Set the threshold to 10%.
// cache max age.
TEST_F(AllocEngine6Test, requestCacheBadMaxAge6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Set the threshold to 25%.
// cache max age.
TEST_F(AllocEngine6Test, renewCacheBadMaxAge6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Set the threshold to 25%.
// This works only when the lifetime is recomputed.
TEST_F(AllocEngine6Test, renewCacheReducedValid6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Set valid lifetime to 200.
// This works only when the lifetime is recomputed.
TEST_F(AllocEngine6Test, renewCacheReducedPreferred6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Set preferred lifetime to 100.
// Checks whether a lease can't be reused (request) when DDNS parameter changed.
TEST_F(AllocEngine6Test, requestCacheFwdDDNS6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Set the threshold to 25%.
// Checks whether a lease can't be reused (renew) when DDNS parameter changed.
TEST_F(AllocEngine6Test, renewCacheFwdDDNS6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Set the threshold to 25%.
// Checks whether a lease can't be reused (request) when DDNS parameter changed.
TEST_F(AllocEngine6Test, requestCacheRevDDNS6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Set the threshold to 25%.
// Checks whether a lease can't be reused (renew) when DDNS parameter changed.
TEST_F(AllocEngine6Test, renewCacheRevDDNS6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Set the threshold to 25%.
// Checks whether a lease can't be reused (request) when hostname changed.
TEST_F(AllocEngine6Test, requestCacheHostname6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Set the threshold to 25%.
// Checks whether a lease can't be reused (renew) when hostname changed.
TEST_F(AllocEngine6Test, renewCacheHostname6) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Set the threshold to 25%.
// valid lifetime value based on the context content.
TEST_F(AllocEngine6Test, getValidLifetime) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Let's make three classes, two with valid-lifetime and one without,
// preferred lifetime value based on the context content.
TEST_F(AllocEngine6Test, getPreferredLifetime) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Let's make three classes, two with preferred-lifetime and one without,
LeaseMgrFactory::create(lease_mgr_params);
// Create allocation engine instance.
- engine_.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 100, true));
+ engine_.reset(new AllocEngine(100, true));
}
/// @brief Destructor
-// Copyright (C) 2015-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2022 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
// Create allocation engine (hook names are registered in its ctor)
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Initialize Hooks Manager
// Create allocation engine (hook names are registered in its ctor)
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Initialize Hooks Manager
// Create allocation engine (hook names are registered in its ctor)
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Initialize Hooks Manager
// Create allocation engine (hook names are registered in its ctor)
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 100, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100, false)));
ASSERT_TRUE(engine);
// Initialize Hooks Manager
// Create allocation engine (hook names are registered in its ctor)
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 100, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100, false)));
ASSERT_TRUE(engine);
// Initialize Hooks Manager
// Create allocation engine (hook names are registered in its ctor)
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 100, false)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100, false)));
ASSERT_TRUE(engine);
// Initialize Hooks Manager
uint8_t expected_len = pool->getLength();
boost::scoped_ptr<AllocEngine> engine;
- EXPECT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 100)));
+ EXPECT_NO_THROW(engine.reset(new AllocEngine(100)));
// We can't use ASSERT macros in non-void methods
EXPECT_TRUE(engine);
if (!engine) {
uint8_t expected_len = pool->getLength();
boost::scoped_ptr<AllocEngine> engine;
- EXPECT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
- 100)));
+ EXPECT_NO_THROW(engine.reset(new AllocEngine(100)));
// We can't use ASSERT macros in non-void methods
EXPECT_TRUE(engine);
if (!engine) {
IOAddress requested,
uint8_t expected_pd_len) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Let's create a lease and put it in the LeaseMgr
AllocEngine6Test::allocBogusHint6(Lease::Type type, asiolink::IOAddress hint,
uint8_t expected_pd_len) {
boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
ASSERT_TRUE(engine);
// Client would like to get a 3000::abc lease, which does not belong to any
class NakedAllocEngine : public AllocEngine {
public:
/// @brief the sole constructor
- /// @param engine_type specifies engine type (e.g. iterative)
/// @param attempts number of lease selection attempts before giving up
/// @param ipv6 specifies if the engine is IPv6 or IPv4
- NakedAllocEngine(AllocEngine::AllocType engine_type, unsigned int attempts, bool ipv6 = true)
- : AllocEngine(engine_type, attempts, ipv6) {
+ NakedAllocEngine(unsigned int attempts, bool ipv6 = true)
+ : AllocEngine(attempts, ipv6) {
}
// Expose internal classes for testing purposes