Setting ``ip-reservations-unique`` to ``false`` when using memfile, MySQL or PostgreSQL is supported.
This setting is not supported when using Host Cache (see :ref:`hooks-host-cache`), and the RADIUS backend
-(see :ref:`hooks-radius`). These reservation backends simply do not support multiple reservations for the
+(see :ref:`hooks-radius`). These reservation backends simply do not support multiple reservations for the
same IP. If either of these hooks are loaded and ``ip-reservations-unique`` is set to ``false``, then a
-configuration error will be emitted and the server will fail to start.
+configuration error will be emitted and the server will fail to start.
.. note::
| subnet[id].total-addresses | integer | Total number of addresses |
| | | available for DHCPv4 management |
| | | for a given subnet; in other |
- | | | words, this is the sum of all |
+ | | | words, this is the count of all |
| | | addresses in all configured pools. |
| | | This statistic changes only during |
| | | configuration updates. It does not |
| subnet[id].pool[pid].total-addresses | integer | Total number of addresses |
| | | available for DHCPv4 management |
| | | for a given subnet pool; in other |
- | | | words, this is the sum of all |
+ | | | words, this is the count of all |
| | | addresses in configured subnet |
| | | pool. This statistic changes only |
| | | during configuration updates. It |
| subnet[id].total-nas | big integer | Total number of NA addresses |
| | | available for DHCPv6 management |
| | | for a given subnet; in other |
- | | | words, this is the sum of all |
+ | | | words, this is the count of all |
| | | addresses in all configured pools. |
| | | This statistic changes only during |
| | | configuration changes. It does not |
| subnet[id].pool[pid].total-nas | big integer | Total number of NA addresses |
| | | available for DHCPv6 management |
| | | for a given subnet pool; in other |
- | | | words, this is the sum of all |
+ | | | words, this is the count of all |
| | | addresses in configured subnet |
| | | pool. This statistic changes only |
| | | during configuration changes. It |
| subnet[id].total-pds | big integer | Total number of PD prefixes |
| | | available for DHCPv6 management |
| | | for a given subnet; in other |
- | | | words, this is the sum of all |
+ | | | words, this is the count of all |
| | | prefixes in all configured pools. |
| | | This statistic changes only during |
| | | configuration changes. Note it |
| subnet[id].pd-pool[pid].total-pds | big integer | Total number of PD prefixes |
| | | available for DHCPv6 management |
| | | for a given subnet pool; in other |
- | | | words, this is the sum of all |
+ | | | words, this is the count of all |
| | | prefixes in configured subnet |
| | | pd-pool. This statistic changes |
| | | only during configuration changes. |
the element "result-set", which is patterned after SQL statement
responses:
- - ``columns`` - a list of text column labels. The columns returned
- for DHCPv4 are:
+ - ``columns`` - a list of text column labels.
+
+ The columns returned for DHCPv4 are:
- ``subnet-id`` - the ID of the subnet.
- ``total-addresses`` - the total number of addresses available for
DHCPv4 management in the subnet. In other words, this is the
- sum of all addresses in all the configured pools in the subnet.
+ count of all addresses in all the configured pools in the subnet.
- - ``cumulative-assigned-addresses`` - the cumulative number of addresses
- in the subnet that have been assigned to a client by the server
- since it started.
+ - ``cumulative-assigned-addresses`` - the cumulative number of addresses
+ in the subnet that have been assigned to a client by the server
+ since it started.
- ``assigned-addresses`` - the number of addresses in the subnet that
are currently assigned to a client.
- ``declined-addresses`` - the number of addresses in the subnet that
are currently declined and are thus unavailable for assignment.
- - The columns returned for DHCPv6 are:
+ The columns returned for DHCPv6 are:
- ``subnet-id`` - the ID of the subnet.
- ``total-nas`` - the number of NA addresses available for DHCPv6
- management in the subnet. In other words, this is the sum of
+ management in the subnet. In other words, this is the count of
all the NA addresses in all the configured NA pools in the
subnet.
- - ``cumulative-assigned-nas`` - the cumulative number of NA addresses
- in the subnet that have been assigned to a client by the server
- since it started.
+ - ``cumulative-assigned-nas`` - the cumulative number of NA addresses
+ in the subnet that have been assigned to a client by the server
+ since it started.
- ``assigned-nas`` - the number of NA addresses in the subnet that
are currently assigned to a client.
declined and are thus unavailable for assignment.
- ``total-pds`` - the total number of PD prefixes available of DHCPv6
- management in the subnet. In other words, this is the sum of
+ management in the subnet. In other words, this is the count of
all prefixes in all the configured prefix pools in the subnet.
- - ``cumulative-assigned-pds`` - the cumulative number of PD prefixes
- in the subnet that have been assigned to a client by the server
- since it started.
+ - ``cumulative-assigned-pds`` - the cumulative number of PD prefixes
+ in the subnet that have been assigned to a client by the server
+ since it started.
- ``assigned-pds`` - the number of PD prefixes in the subnet that are
currently assigned to a client.
}
}
}
+ } catch (const std::exception& e) {
+ ADD_FAILURE() << "Uncaught exception " << e.what();
} catch (...) {
- ;
+ ADD_FAILURE() << "Unknown exception";
}
return (false);
}
if (observation) {
return (observation->getInteger().first);
}
+ } catch (const std::exception& e) {
+ ADD_FAILURE() << "Uncaught exception " << e.what();
} catch (...) {
- ;
+ ADD_FAILURE() << "Unknown exception";
}
return (0);
}
/// This function may be used in many allocation tests and there's no
/// single base class for it. @todo consider moving it src/lib/util.
///
+/// It checks statistics by name, either the global version when the subnet ID
+/// is SUBNET_ID_UNUSED or the subnet statistic, including the pool 0 respective
+/// statistic.
+///
/// @param stat_name Statistic name.
/// @param exp_value Expected value.
/// @param subnet_id subnet_id of the desired subnet, if not zero
///
/// @param stat_name Statistic name.
/// @param subnet_id subnet_id of the desired subnet, if not zero.
+///
/// @return the value held by the statistic manager or zero.
-int64_t getStatistics(const std::string& stat_name, const SubnetID subnet_id = SUBNET_ID_UNUSED);
+int64_t getStatistics(const std::string& stat_name,
+ const SubnetID subnet_id = SUBNET_ID_UNUSED);
/// @brief IterativeAllocator with internal methods exposed
class NakedIterativeAllocator : public IterativeAllocator {
public:
/// @brief constructor
+ ///
/// @param type pool types that will be iterated through
NakedIterativeAllocator(Lease::Type type, const WeakSubnetPtr& subnet)
: IterativeAllocator(type, subnet) {
class NakedAllocEngine : public AllocEngine {
public:
/// @brief the sole constructor
+ ///
/// @param attempts number of lease selection attempts before giving up
NakedAllocEngine(unsigned int attempts)
: AllocEngine(attempts) {
using AllocEngine::updateLease4ExtendedInfo;
/// @brief Wrapper method for invoking AllocEngine4::updateLease4ExtendedInfo().
+ ///
/// @param lease lease to update
/// @param ctx current packet processing context
+ ///
/// @return true if extended information was changed
bool callUpdateLease4ExtendedInfo(const Lease4Ptr& lease,
AllocEngine::ClientContext4& ctx) const {
}
/// @brief Wrapper method for invoking AllocEngine6::updateLease6ExtendedInfo().
+ ///
/// @param lease lease to update
/// @param ctx current packet processing context
void callUpdateLease6ExtendedInfo(const Lease6Ptr& lease,
AllocEngine::ClientContext6& ctx) const {
- return (updateLease6ExtendedInfo(lease, ctx));
+ updateLease6ExtendedInfo(lease, ctx);
}
-
};
/// @brief Used in Allocation Engine tests for IPv6
///
/// @param col collection of leases (zero or one leases allowed)
/// @throw MultipleRecords if there is more than one lease
+ ///
/// @return Lease6 pointer (or NULL if collection was empty)
Lease6Ptr expectOneLease(const Lease6Collection& col) {
if (col.size() > 1) {
/// @param hint address to be used as a hint
/// @param fake true - this is fake allocation (SOLICIT)
/// @param in_pool specifies whether the lease is expected to be in pool
+ ///
/// @return allocated lease (or NULL)
Lease6Ptr simpleAlloc6Test(const Pool6Ptr& pool,
const asiolink::IOAddress& hint,
/// @param exp_preferred expected lease preferred lifetime
/// @param exp_valid expected lease valid lifetime
/// @param class_def class definition to add to the context
+ ///
/// @return allocated lease (or NULL)
Lease6Ptr simpleAlloc6Test(const Pool6Ptr& pool,
const asiolink::IOAddress& hint,
/// @param hint address to be used as a hint
/// @param fake true - this is fake allocation (SOLICIT)
/// @param in_pool specifies whether the lease is expected to be in pool
+ ///
/// @return allocated lease (or NULL)
Lease6Ptr simpleAlloc6Test(const Pool6Ptr& pool,
const DuidPtr& duid,
/// @param in_pool specifies whether the lease is expected to be in pool
/// @param hint_prefix_length The hint prefix length that the client
/// provided.
+ ///
/// @return allocated lease(s) (may be empty)
Lease6Collection allocateTest(AllocEngine& engine,
const Pool6Ptr& pool,
/// @param hints address to be used as a hint
/// @param in_subnet whether the lease is expected to be in subnet
/// @param in_pool specifies whether the lease is expected to be in pool
+ ///
/// @return allocated lease(s) (may be empty)
Lease6Collection renewTest(AllocEngine& engine,
const Pool6Ptr& pool,
/// @param addr address of the lease
/// @param probation_period expressed in seconds
/// @param expired number of seconds when the lease will expire
+ ///
+ /// @return generated lease
Lease6Ptr generateDeclinedLease(const std::string& addr,
time_t probation_period,
int32_t expired);
/// @param type specifies reservation type
/// @param addr specifies reserved address or prefix
/// @param prefix_len prefix length (should be 128 for addresses)
+ ///
/// @return created Host object.
HostPtr createHost6(bool add_to_host_mgr,
IPv6Resrv::Type type,
/// @param hwaddr hardware address to be reserved to
/// @param addr specifies reserved address or prefix
/// @param prefix_len prefix length (should be 128 for addresses)
+ ///
/// @return created Host object.
HostPtr createHost6HWAddr(bool add_to_host_mgr,
IPv6Resrv::Type type,
/// @param addr address of the lease
/// @param probation_period expressed in seconds
/// @param expired number of seconds when the lease will expire
+ ///
+ /// @return generated lease
Lease4Ptr generateDeclinedLease(const std::string& addr,
time_t probation_period,
int32_t expired);
void initSubnet(const asiolink::IOAddress& pool_start,
const asiolink::IOAddress& pool_end);
+ /// @brief Default constructor
virtual ~AllocEngine4Test() {
factory_.destroy();
}