"re-detect": true
},
- // Boolean parameter which controls whether an early global host
+ // Boolean parameter which controls whether an early global host
// reservations lookup should be performed. This lookup takes place
// before subnet selection and when a global reservation is found
// with some client classes triggers a second phase classification.
"re-detect": true
},
- // Boolean parameter which controls whether an early global host
+ // Boolean parameter which controls whether an early global host
// reservations lookup should be performed. This lookup takes place
// before subnet selection and when a global reservation is found
// with some client classes triggers a second phase classification.
class. After a subnet is selected, the server determines whether
there is a reservation for a given client. Therefore, it is not
possible to use the ``UNKNOWN`` class to select a shared network or
- a subnet, and for using the ``KNOWN`` class only global reservations
- can be used and the ``early-global-reservations-lookup`` parameter
- must be configured to true
+ a subnet. For the ``KNOWN`` class only global reservations only
+ global reservations are used and the ``early-global-reservations-lookup``
+ parameter must be configured to true
10. When the incoming packet belongs to the special class ``DROP``, it is
dropped and an informational message is logged with the packet
/// Returns ACK message, NAK message, or NULL
///
/// @param request a message received from client
- /// @param context pointer to the client context where allocated and
+ /// @param context pointer to the client context where allocated and
/// deleted leases are stored.
///
/// @return ACK or NAK message
// Add classes from the global reservations.
const ClientClasses& classes = global_host->getClientClasses6();
- for (ClientClasses::const_iterator cclass = classes.cbegin();
- cclass != classes.cend(); ++cclass) {
+ for (ClientClasses::const_iterator cclass = classes.cbegin();
+ cclass != classes.cend(); ++cclass) {
query->addClass(*cclass);
}
// time evaluate to false as desired.
removeDependentEvaluatedClasses(pkt);
setReservedClientClasses(pkt, ctx);
- evaluateClasses(pkt, false);
+ evaluateClasses(pkt, false);
}
// Set KNOWN builtin class if something was found, UNKNOWN if not.
ASSERT_NO_THROW(client2.doSolicit(true));
- // Not matchine so not dropped.
+ // Not matching so not dropped.
EXPECT_TRUE(client2.getContext().response_);
}
AllocEngine::ClientContext6 ctx;
bool drop = !srv_->earlyGHRLookup(query, ctx);
+ ASSERT_FALSE(drop);
srv_->initContext(query, ctx, drop);
+ ASSERT_FALSE(drop);
Pkt6Ptr answer = generateMessageWithIds(DHCPV6_ADVERTISE);
ASSERT_NO_THROW(srv_->processClientFqdn(query, answer, ctx));
/// update existing lease.
bool fake_allocation_;
- /// @brief Indicates if early global reservation is looked for.
- ///
- /// This caches the early-global-reservations-lookup value.
- bool early_global_reservations_lookup_;
+ /// @brief Indicates if early global reservation is looked for.
+ ///
+ /// This caches the early-global-reservations-lookup value.
+ bool early_global_reservations_lookup_;
/// @brief Subnet selected for the client by the server.
Subnet6Ptr subnet_;
public:
/// @brief Determines the preferred and valid v6 lease lifetimes.
///
- /// A candidate triplet for both preferred and valid lifetimes will be
+ /// A candidate triplet for both preferred and valid lifetimes will be
/// selected from the first class matched to the query which defines the
- /// value or from the subnet if none do. Classes are searched in the order
+ /// value or from the subnet if none do. Classes are searched in the order
/// they are assigned to the query.
///
/// If the client requested a lifetime IA hint, then the
/// information to the allocation engine methods is that adding
/// new information doesn't modify the API of the allocation engine.
struct ClientContext4 : public boost::noncopyable {
- /// @brief Indicates if early global reservation is looked for.
- ///
- /// This caches the early-global-reservations-lookup value.
- bool early_global_reservations_lookup_;
+ /// @brief Indicates if early global reservation is looked for.
+ ///
+ /// This caches the early-global-reservations-lookup value.
+ bool early_global_reservations_lookup_;
/// @brief Subnet selected for the client by the server.
Subnet4Ptr subnet_;
lease->cltt_ = time(NULL) - 10; // Allocated 10 seconds ago
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease2));
ctx.subnet_ = subnet1_;
+ ctx.hosts_.clear();
AllocEngine::findReservation(ctx);
lease = engine_.allocateLease4(ctx);
ASSERT_TRUE(lease);
lease->cltt_ = time(NULL) - 10; // Allocated 10 seconds ago
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease2));
ctx.subnet_ = subnet1_;
+ ctx.hosts_.clear();
AllocEngine::findReservation(ctx);
lease = engine_.allocateLease4(ctx);
ASSERT_TRUE(lease);
lease->cltt_ = time(NULL) - 10; // Allocated 10 seconds ago
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease2));
ctx.subnet_ = subnet1_;
+ ctx.hosts_.clear();
AllocEngine::findReservation(ctx);
lease = engine_.allocateLease4(ctx);
ASSERT_TRUE(lease);
lease->cltt_ = time(NULL) - 10; // Allocated 10 seconds ago
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease2));
ctx.subnet_ = subnet1_;
+ ctx.hosts_.clear();
AllocEngine::findReservation(ctx);
lease = engine_.allocateLease4(ctx);
ASSERT_TRUE(lease);
CfgMgr::instance().commit();
// This time the reservation should be returned.
+ ctx.hosts_.clear();
ASSERT_NO_THROW(engine.findReservation(ctx));
EXPECT_TRUE(ctx.currentHost());
EXPECT_EQ(ctx.currentHost()->getIPv4Reservation(), host->getIPv4Reservation());
// It shouldn't be returned when reservations-in-subnet is disabled.
subnet_->setReservationsInSubnet(false);
+ ctx.hosts_.clear();
ASSERT_NO_THROW(engine.findReservation(ctx));
EXPECT_FALSE(ctx.currentHost());
// Check the reservations-in-subnet and reservations-out-of-pool flags.
subnet_->setReservationsInSubnet(true);
subnet_->setReservationsOutOfPool(true);
+ ctx.hosts_.clear();
ASSERT_NO_THROW(engine.findReservation(ctx));
EXPECT_TRUE(ctx.currentHost());
EXPECT_EQ(ctx.currentHost()->getIPv4Reservation(), host->getIPv4Reservation());
CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
CfgMgr::instance().commit();
+ ctx.hosts_.clear();
ASSERT_NO_THROW(engine.findReservation(ctx));
EXPECT_TRUE(ctx.currentHost());
EXPECT_EQ(ctx.currentHost()->getIPv4Reservation(), host->getIPv4Reservation());
// Remove the subnet. Subnet id is required to find host reservations, so
// if it is set to NULL, no reservation should be returned
ctx.subnet_.reset();
+ ctx.hosts_.clear();
ASSERT_NO_THROW(engine.findReservation(ctx));
EXPECT_FALSE(ctx.currentHost());
CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
CfgMgr::instance().commit();
+ ctx.hosts_.clear();
ASSERT_NO_THROW(engine.findReservation(ctx));
EXPECT_FALSE(ctx.currentHost());
}