Commit 9663c46d authored by Francis Dupont's avatar Francis Dupont
Browse files

[5425] Checkpoint: alloc done, new tests todo

parent a02ee970
......@@ -4144,47 +4144,47 @@ TEST_F(Dhcp4ParserTest, classifyPools) {
// everyone).
ClientClasses classes;
classes.insert("alpha");
EXPECT_TRUE(pools.at(0)->clientSupported(classes));
EXPECT_FALSE(pools.at(1)->clientSupported(classes));
EXPECT_FALSE(pools.at(2)->clientSupported(classes));
EXPECT_TRUE(pools.at(3)->clientSupported(classes));
EXPECT_TRUE(pools.at(0)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(1)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(2)->clientSupported(classes, false));
EXPECT_TRUE(pools.at(3)->clientSupported(classes, false));
// Let's check if client belonging to beta class is supported in pool[1]
// and not supported in any other pool (except pools[3], which allows
// everyone).
classes.clear();
classes.insert("beta");
EXPECT_FALSE(pools.at(0)->clientSupported(classes));
EXPECT_TRUE(pools.at(1)->clientSupported(classes));
EXPECT_FALSE(pools.at(2)->clientSupported(classes));
EXPECT_TRUE(pools.at(3)->clientSupported(classes));
EXPECT_FALSE(pools.at(0)->clientSupported(classes, false));
EXPECT_TRUE(pools.at(1)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(2)->clientSupported(classes, false));
EXPECT_TRUE(pools.at(3)->clientSupported(classes, false));
// Let's check if client belonging to gamma class is supported in pool[2]
// and not supported in any other pool (except pool[3], which allows
// everyone).
classes.clear();
classes.insert("gamma");
EXPECT_FALSE(pools.at(0)->clientSupported(classes));
EXPECT_FALSE(pools.at(1)->clientSupported(classes));
EXPECT_TRUE(pools.at(2)->clientSupported(classes));
EXPECT_TRUE(pools.at(3)->clientSupported(classes));
EXPECT_FALSE(pools.at(0)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(1)->clientSupported(classes, false));
EXPECT_TRUE(pools.at(2)->clientSupported(classes, false));
EXPECT_TRUE(pools.at(3)->clientSupported(classes, false));
// Let's check if client belonging to some other class (not mentioned in
// the config) is supported only in pool[3], which allows everyone.
classes.clear();
classes.insert("delta");
EXPECT_FALSE(pools.at(0)->clientSupported(classes));
EXPECT_FALSE(pools.at(1)->clientSupported(classes));
EXPECT_FALSE(pools.at(2)->clientSupported(classes));
EXPECT_TRUE(pools.at(3)->clientSupported(classes));
EXPECT_FALSE(pools.at(0)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(1)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(2)->clientSupported(classes, false));
EXPECT_TRUE(pools.at(3)->clientSupported(classes, false));
// Finally, let's check class-less client. He should be allowed only in
// the last pool, which does not have any class restrictions.
classes.clear();
EXPECT_FALSE(pools.at(0)->clientSupported(classes));
EXPECT_FALSE(pools.at(1)->clientSupported(classes));
EXPECT_FALSE(pools.at(2)->clientSupported(classes));
EXPECT_TRUE(pools.at(3)->clientSupported(classes));
EXPECT_FALSE(pools.at(0)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(1)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(2)->clientSupported(classes, false));
EXPECT_TRUE(pools.at(3)->clientSupported(classes, false));
}
// This test verifies that the host reservations can be specified for
......
......@@ -4181,47 +4181,47 @@ TEST_F(Dhcp6ParserTest, classifyPools) {
// everyone).
ClientClasses classes;
classes.insert("alpha");
EXPECT_TRUE (pools.at(0)->clientSupported(classes));
EXPECT_FALSE(pools.at(1)->clientSupported(classes));
EXPECT_FALSE(pools.at(2)->clientSupported(classes));
EXPECT_TRUE (pools.at(3)->clientSupported(classes));
EXPECT_TRUE (pools.at(0)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(1)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(2)->clientSupported(classes, false));
EXPECT_TRUE (pools.at(3)->clientSupported(classes, false));
// Let's check if client belonging to beta class is supported in pool[1]
// and not supported in any other pool (except pool[3], which allows
// everyone).
classes.clear();
classes.insert("beta");
EXPECT_FALSE(pools.at(0)->clientSupported(classes));
EXPECT_TRUE (pools.at(1)->clientSupported(classes));
EXPECT_FALSE(pools.at(2)->clientSupported(classes));
EXPECT_TRUE (pools.at(3)->clientSupported(classes));
EXPECT_FALSE(pools.at(0)->clientSupported(classes, false));
EXPECT_TRUE (pools.at(1)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(2)->clientSupported(classes, false));
EXPECT_TRUE (pools.at(3)->clientSupported(classes, false));
// Let's check if client belonging to gamma class is supported in pool[2]
// and not supported in any other pool (except pool[3], which allows
// everyone).
classes.clear();
classes.insert("gamma");
EXPECT_FALSE(pools.at(0)->clientSupported(classes));
EXPECT_FALSE(pools.at(1)->clientSupported(classes));
EXPECT_TRUE (pools.at(2)->clientSupported(classes));
EXPECT_TRUE (pools.at(3)->clientSupported(classes));
EXPECT_FALSE(pools.at(0)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(1)->clientSupported(classes, false));
EXPECT_TRUE (pools.at(2)->clientSupported(classes, false));
EXPECT_TRUE (pools.at(3)->clientSupported(classes, false));
// Let's check if client belonging to some other class (not mentioned in
// the config) is supported only in pool[3], which allows everyone.
classes.clear();
classes.insert("delta");
EXPECT_FALSE(pools.at(0)->clientSupported(classes));
EXPECT_FALSE(pools.at(1)->clientSupported(classes));
EXPECT_FALSE(pools.at(2)->clientSupported(classes));
EXPECT_TRUE (pools.at(3)->clientSupported(classes));
EXPECT_FALSE(pools.at(0)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(1)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(2)->clientSupported(classes, false));
EXPECT_TRUE (pools.at(3)->clientSupported(classes, false));
// Finally, let's check class-less client. He should be allowed only in
// the last pool, which does not have any class restrictions.
classes.clear();
EXPECT_FALSE(pools.at(0)->clientSupported(classes));
EXPECT_FALSE(pools.at(1)->clientSupported(classes));
EXPECT_FALSE(pools.at(2)->clientSupported(classes));
EXPECT_TRUE (pools.at(3)->clientSupported(classes));
EXPECT_FALSE(pools.at(0)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(1)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(2)->clientSupported(classes, false));
EXPECT_TRUE (pools.at(3)->clientSupported(classes, false));
}
// Goal of this test is to verify that multiple pdpools can be configured
......@@ -4279,47 +4279,47 @@ TEST_F(Dhcp6ParserTest, classifyPdPools) {
// everyone).
ClientClasses classes;
classes.insert("alpha");
EXPECT_TRUE (pools.at(0)->clientSupported(classes));
EXPECT_FALSE(pools.at(1)->clientSupported(classes));
EXPECT_FALSE(pools.at(2)->clientSupported(classes));
EXPECT_TRUE (pools.at(3)->clientSupported(classes));
EXPECT_TRUE (pools.at(0)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(1)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(2)->clientSupported(classes, false));
EXPECT_TRUE (pools.at(3)->clientSupported(classes, false));
// Let's check if client belonging to beta class is supported in pool[1]
// and not supported in any other pool (except pool[3], which allows
// everyone).
classes.clear();
classes.insert("beta");
EXPECT_FALSE(pools.at(0)->clientSupported(classes));
EXPECT_TRUE (pools.at(1)->clientSupported(classes));
EXPECT_FALSE(pools.at(2)->clientSupported(classes));
EXPECT_TRUE (pools.at(3)->clientSupported(classes));
EXPECT_FALSE(pools.at(0)->clientSupported(classes, false));
EXPECT_TRUE (pools.at(1)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(2)->clientSupported(classes, false));
EXPECT_TRUE (pools.at(3)->clientSupported(classes, false));
// Let's check if client belonging to gamma class is supported in pool[2]
// and not supported in any other pool (except pool[3], which allows
// everyone).
classes.clear();
classes.insert("gamma");
EXPECT_FALSE(pools.at(0)->clientSupported(classes));
EXPECT_FALSE(pools.at(1)->clientSupported(classes));
EXPECT_TRUE (pools.at(2)->clientSupported(classes));
EXPECT_TRUE (pools.at(3)->clientSupported(classes));
EXPECT_FALSE(pools.at(0)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(1)->clientSupported(classes, false));
EXPECT_TRUE (pools.at(2)->clientSupported(classes, false));
EXPECT_TRUE (pools.at(3)->clientSupported(classes, false));
// Let's check if client belonging to some other class (not mentioned in
// the config) is supported only in pool[3], which allows everyone.
classes.clear();
classes.insert("delta");
EXPECT_FALSE(pools.at(0)->clientSupported(classes));
EXPECT_FALSE(pools.at(1)->clientSupported(classes));
EXPECT_FALSE(pools.at(2)->clientSupported(classes));
EXPECT_TRUE (pools.at(3)->clientSupported(classes));
EXPECT_FALSE(pools.at(0)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(1)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(2)->clientSupported(classes, false));
EXPECT_TRUE (pools.at(3)->clientSupported(classes, false));
// Finally, let's check class-less client. He should be allowed only in
// the last pool, which does not have any class restrictions.
classes.clear();
EXPECT_FALSE(pools.at(0)->clientSupported(classes));
EXPECT_FALSE(pools.at(1)->clientSupported(classes));
EXPECT_FALSE(pools.at(2)->clientSupported(classes));
EXPECT_TRUE (pools.at(3)->clientSupported(classes));
EXPECT_FALSE(pools.at(0)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(1)->clientSupported(classes, false));
EXPECT_FALSE(pools.at(2)->clientSupported(classes, false));
EXPECT_TRUE (pools.at(3)->clientSupported(classes, false));
}
// This test checks the ability of the server to parse a configuration
......
......@@ -158,6 +158,7 @@ AllocEngine::IterativeAllocator::increaseAddress(const isc::asiolink::IOAddress&
isc::asiolink::IOAddress
AllocEngine::IterativeAllocator::pickAddress(const SubnetPtr& subnet,
const ClientClasses& client_classes,
bool known_client,
const DuidPtr&,
const IOAddress&) {
......@@ -183,7 +184,7 @@ AllocEngine::IterativeAllocator::pickAddress(const SubnetPtr& subnet,
PoolCollection::const_iterator first = pools.end();
PoolPtr first_pool;
for (it = pools.begin(); it != pools.end(); ++it) {
if (!(*it)->clientSupported(client_classes)) {
if (!(*it)->clientSupported(client_classes, known_client)) {
continue;
}
if (first == pools.end()) {
......@@ -212,7 +213,7 @@ AllocEngine::IterativeAllocator::pickAddress(const SubnetPtr& subnet,
// Trying next pool
if (retrying) {
for (; it != pools.end(); ++it) {
if ((*it)->clientSupported(client_classes)) {
if ((*it)->clientSupported(client_classes, known_client)) {
break;
}
}
......@@ -271,7 +272,7 @@ AllocEngine::IterativeAllocator::pickAddress(const SubnetPtr& subnet,
// Let's rewind to the beginning.
for (it = first; it != pools.end(); ++it) {
if ((*it)->clientSupported(client_classes)) {
if ((*it)->clientSupported(client_classes, known_client)) {
(*it)->setLastAllocated((*it)->getFirstAddress());
(*it)->resetLastAllocated();
}
......@@ -293,6 +294,7 @@ AllocEngine::HashedAllocator::HashedAllocator(Lease::Type lease_type)
isc::asiolink::IOAddress
AllocEngine::HashedAllocator::pickAddress(const SubnetPtr&,
const ClientClasses&,
bool known_client,
const DuidPtr&,
const IOAddress&) {
isc_throw(NotImplemented, "Hashed allocator is not implemented");
......@@ -307,6 +309,7 @@ AllocEngine::RandomAllocator::RandomAllocator(Lease::Type lease_type)
isc::asiolink::IOAddress
AllocEngine::RandomAllocator::pickAddress(const SubnetPtr&,
const ClientClasses&,
bool known_client,
const DuidPtr&,
const IOAddress&) {
isc_throw(NotImplemented, "Random allocator is not implemented");
......@@ -447,7 +450,8 @@ inAllowedPool(AllocEngine::ClientContext6& ctx, const Lease::Type& lease_type,
}
} else {
if (current_subnet->inPool(lease_type, address,
ctx.query_->getClasses())) {
ctx.query_->getClasses(),
!ctx.hosts_.empty())) {
return (true);
}
}
......@@ -752,10 +756,12 @@ AllocEngine::allocateUnreservedLeases6(ClientContext6& ctx) {
// check if the hint is in pool and is available
// This is equivalent of subnet->inPool(hint), but returns the pool
pool = boost::dynamic_pointer_cast<Pool6>
(subnet->getPool(ctx.currentIA().type_, ctx.query_->getClasses(), hint));
(subnet->getPool(ctx.currentIA().type_, ctx.query_->getClasses(),
!ctx.hosts_.empty(), hint));
// check if the pool is allowed
if (pool && !pool->clientSupported(ctx.query_->getClasses())) {
if (pool && !pool->clientSupported(ctx.query_->getClasses(),
!ctx.hosts_.empty())) {
pool.reset();
}
......@@ -857,7 +863,8 @@ AllocEngine::allocateUnreservedLeases6(ClientContext6& ctx) {
// - we exhaust number of tries
uint64_t possible_attempts =
subnet->getPoolCapacity(ctx.currentIA().type_,
ctx.query_->getClasses());
ctx.query_->getClasses(),
!ctx.hosts_.empty());
// Try next subnet if there is no chance to get something
if (possible_attempts == 0) {
subnet = subnet->getNextSubnet(original_subnet);
......@@ -871,6 +878,7 @@ AllocEngine::allocateUnreservedLeases6(ClientContext6& ctx) {
IOAddress candidate = allocator->pickAddress(subnet,
ctx.query_->getClasses(),
!ctx.hosts_.empty(),
ctx.duid_,
hint);
......@@ -889,7 +897,10 @@ AllocEngine::allocateUnreservedLeases6(ClientContext6& ctx) {
uint8_t prefix_len = 128;
if (ctx.currentIA().type_ == Lease::TYPE_PD) {
pool = boost::dynamic_pointer_cast<Pool6>(
subnet->getPool(ctx.currentIA().type_, ctx.query_->getClasses(), candidate));
subnet->getPool(ctx.currentIA().type_,
ctx.query_->getClasses(),
!ctx.hosts_.empty(),
candidate));
if (pool) {
prefix_len = pool->getLength();
}
......@@ -2626,7 +2637,8 @@ inAllowedPool(AllocEngine::ClientContext4& ctx, const IOAddress& address) {
while (current_subnet) {
if (current_subnet->inPool(Lease::TYPE_V4, address,
ctx.query_->getClasses())) {
ctx.query_->getClasses(),
!ctx.hosts_.empty())) {
// We found a subnet that this address belongs to, so it
// seems that this subnet is the good candidate for allocation.
// Let's update the selected subnet.
......@@ -3354,7 +3366,8 @@ AllocEngine::allocateUnreservedLease4(ClientContext4& ctx) {
uint64_t possible_attempts =
subnet->getPoolCapacity(Lease::TYPE_V4,
ctx.query_->getClasses());
ctx.query_->getClasses(),
!ctx.hosts_.empty());
uint64_t max_attempts = (attempts_ > 0 ? attempts_ : possible_attempts);
// Skip trying if there is no chance to get something
if (possible_attempts == 0) {
......@@ -3364,6 +3377,7 @@ AllocEngine::allocateUnreservedLease4(ClientContext4& ctx) {
for (uint64_t i = 0; i < max_attempts; ++i) {
IOAddress candidate = allocator->pickAddress(subnet,
ctx.query_->getClasses(),
!ctx.hosts_.empty(),
client_id,
ctx.requested_address_);
// If address is not reserved for another client, try to allocate it.
......
......@@ -83,7 +83,7 @@ protected:
///
/// @param subnet next address will be returned from pool of that subnet
/// @param client_classes list of classes client belongs to
/// @param known_client client has a reservation
/// @param duid Client's DUID
/// @param hint client's hint
///
......@@ -91,6 +91,7 @@ protected:
virtual isc::asiolink::IOAddress
pickAddress(const SubnetPtr& subnet,
const ClientClasses& client_classes,
bool known_client,
const DuidPtr& duid,
const isc::asiolink::IOAddress& hint) = 0;
......@@ -133,12 +134,14 @@ protected:
///
/// @param subnet next address will be returned from pool of that subnet
/// @param client_classes list of classes client belongs to
/// @param known_client client has a reservation
/// @param duid Client's DUID (ignored)
/// @param hint client's hint (ignored)
/// @return the next address
virtual isc::asiolink::IOAddress
pickAddress(const SubnetPtr& subnet,
const ClientClasses& client_classes,
bool known_client,
const DuidPtr& duid,
const isc::asiolink::IOAddress& hint);
protected:
......@@ -188,12 +191,14 @@ protected:
///
/// @param subnet an address will be picked from pool of that subnet
/// @param client_classes list of classes client belongs to
/// @param known_client client has a reservation
/// @param duid Client's DUID
/// @param hint a hint (last address that was picked)
/// @return selected address
virtual isc::asiolink::IOAddress
pickAddress(const SubnetPtr& subnet,
const ClientClasses& client_classes,
bool known_client,
const DuidPtr& duid,
const isc::asiolink::IOAddress& hint);
};
......@@ -219,6 +224,7 @@ protected:
virtual isc::asiolink::IOAddress
pickAddress(const SubnetPtr& subnet,
const ClientClasses& client_classes,
bool known_client,
const DuidPtr& duid,
const isc::asiolink::IOAddress& hint);
};
......
......@@ -27,21 +27,39 @@ bool Pool::inRange(const isc::asiolink::IOAddress& addr) const {
return (first_.smallerEqual(addr) && addr.smallerEqual(last_));
}
bool Pool::clientSupported(const ClientClasses& classes) const {
bool Pool::clientSupported(const ClientClasses& classes,
bool known_client) const {
bool match = false;
if (white_list_.empty()) {
// There is no class defined for this pool, so we do
// support everyone.
return (true);
match = true;
} else {
for (ClientClasses::const_iterator it = white_list_.begin();
it != white_list_.end(); ++it) {
if (classes.contains(*it)) {
match = true;
break;
}
}
}
for (ClientClasses::const_iterator it = white_list_.begin();
it != white_list_.end(); ++it) {
if (classes.contains(*it)) {
return (true);
}
if (!match) {
return (false);
}
return (false);
switch (known_clients_) {
case SERVE_BOTH:
return (true);
case SERVE_KNOWN:
return (known_client);
case SERVE_UNKNOWN:
return (!known_client);
default:
// Saninity check for an impossible condition
isc_throw(BadValue, "Invalid value of known clients");
}
}
void Pool::allowClientClass(const ClientClass& class_name) {
......
......@@ -121,8 +121,11 @@ public:
/// is known to be improved.
///
/// @param client_classes list of all classes the client belongs to
/// @param known_client true if the client is known, i.e. has a
/// reservation
/// @return true if client can be supported, false otherwise
bool clientSupported(const ClientClasses& client_classes) const;
bool clientSupported(const ClientClasses& client_classes,
bool known_client) const;
/// @brief Adds class class_name to the list of supported classes
///
......
......@@ -136,15 +136,16 @@ Subnet::getPoolCapacity(Lease::Type type) const {
uint64_t
Subnet::getPoolCapacity(Lease::Type type,
const ClientClasses& client_classes) const {
const ClientClasses& client_classes,
bool known_client) const {
switch (type) {
case Lease::TYPE_V4:
case Lease::TYPE_NA:
return sumPoolCapacity(pools_, client_classes);
return sumPoolCapacity(pools_, client_classes, known_client);
case Lease::TYPE_TA:
return sumPoolCapacity(pools_ta_, client_classes);
return sumPoolCapacity(pools_ta_, client_classes, known_client);
case Lease::TYPE_PD:
return sumPoolCapacity(pools_pd_, client_classes);
return sumPoolCapacity(pools_pd_, client_classes, known_client);
default:
isc_throw(BadValue, "Unsupported pool type: "
<< static_cast<int>(type));
......@@ -171,10 +172,11 @@ Subnet::sumPoolCapacity(const PoolCollection& pools) const {
uint64_t
Subnet::sumPoolCapacity(const PoolCollection& pools,
const ClientClasses& client_classes) const {
const ClientClasses& client_classes,
bool known_client) const {
uint64_t sum = 0;
for (PoolCollection::const_iterator p = pools.begin(); p != pools.end(); ++p) {
if (!(*p)->clientSupported(client_classes)) {
if (!(*p)->clientSupported(client_classes, known_client)) {
continue;
}
uint64_t x = (*p)->getCapacity();
......@@ -370,6 +372,7 @@ const PoolPtr Subnet::getPool(Lease::Type type, const isc::asiolink::IOAddress&
const PoolPtr Subnet::getPool(Lease::Type type,
const ClientClasses& client_classes,
bool known_client,
const isc::asiolink::IOAddress& hint) const {
// check if the type is valid (and throw if it isn't)
checkType(type);
......@@ -385,7 +388,8 @@ const PoolPtr Subnet::getPool(Lease::Type type,
if (ub != pools.begin()) {
--ub;
if ((*ub)->inRange(hint) && (*ub)->clientSupported(client_classes)) {
if ((*ub)->inRange(hint) &&
(*ub)->clientSupported(client_classes, known_client)) {
candidate = *ub;
}
}
......@@ -478,7 +482,8 @@ Subnet::inPool(Lease::Type type, const isc::asiolink::IOAddress& addr) const {
bool
Subnet::inPool(Lease::Type type,
const isc::asiolink::IOAddress& addr,
const ClientClasses& client_classes) const {
const ClientClasses& client_classes,
bool known_client) const {
// Let's start with checking if it even belongs to that subnet.
if ((type != Lease::TYPE_PD) && !inRange(addr)) {
......@@ -489,7 +494,7 @@ Subnet::inPool(Lease::Type type,
for (PoolCollection::const_iterator pool = pools.begin();
pool != pools.end(); ++pool) {
if (!(*pool)->clientSupported(client_classes)) {
if (!(*pool)->clientSupported(client_classes, known_client)) {
continue;
}
if ((*pool)->inRange(addr)) {
......
......@@ -56,16 +56,18 @@ public:
/// @brief checks if the specified address is in allowed pools
///
/// This takes also into account client classes
/// This takes also into account client classes and known client
///
/// @param type type of pools to iterate over
/// @param addr this address will be checked if it belongs to any pools in
/// that subnet
/// @param client_classes client class list which must be allowed
/// @param known_client true if the client is known, i.e. has a reservation
/// @return true if the address is in any of the allowed pools
bool inPool(Lease::Type type,
const isc::asiolink::IOAddress& addr,
const ClientClasses& client_classes) const;
const ClientClasses& client_classes,
bool known_client) const;
/// @brief returns the last address that was tried from this subnet
///
......@@ -157,13 +159,15 @@ public:
/// @brief Returns a pool that specified address belongs to with classes
///
/// Variant using only pools allowing given classes
/// Variant using only pools allowing given classes and known clients
///
/// @param type pool type that the pool is looked for
/// @param client_classes client class list which must be allowed
/// @param known_client true if the client is known, i.e. has a reservation
/// @param addr address that the returned pool should cover (optional)
const PoolPtr getPool(Lease::Type type,
const ClientClasses& client_classes,
bool known_client,
const isc::asiolink::IOAddress& addr) const;
/// @brief Returns a pool without any address specified
......@@ -194,12 +198,15 @@ public:
uint64_t getPoolCapacity(Lease::Type type) const;
/// @brief Returns the number of possible leases for specified lease type
/// allowed for a client which belongs to classes.
/// allowed for a client which belongs to classes and matches known
/// clients constraint.
///
/// @param type type of the lease
/// @param client_classes List of classes the client belongs to.
/// @param known_client true if the client is known, i.e. has a reservation
uint64_t getPoolCapacity(Lease::Type type,
const ClientClasses& client_classes) const;
const ClientClasses& client_classes,
bool known_client) const;
/// @brief Returns textual representation of the subnet (e.g.
/// "2001:db8::/64")
......@@ -335,9 +342,11 @@ protected:
/// @brief returns a sum of possible leases in all pools allowing classes
/// @param pools list of pools
/// @param client_classes list of classes
/// @param known_client true if the client is known, i.e. has a reservation
/// @return sum of possible/allowed leases
uint64_t sumPoolCapacity(const PoolCollection& pools,
const ClientClasses& client_classes) const;
const ClientClasses& client_classes,
bool known_client) const;
/// @brief Checks if the specified pool overlaps with an existing pool.
///
......
......@@ -326,7 +326,8 @@ TEST_F(AllocEngine4Test, IterativeAllocator) {
alloc(new NakedAllo