mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 13:37:55 +00:00
[#1415] Do not use nested types
Removed Range and PrefixRange typedefs from FreeLeaseQueue and IPRangePermutation. This prevents compilation failures with g++.
This commit is contained in:
parent
03330c8a2e
commit
38f142af43
@ -24,7 +24,7 @@ FreeLeaseQueue::FreeLeaseQueue()
|
||||
}
|
||||
|
||||
void
|
||||
FreeLeaseQueue::addRange(const Range& range) {
|
||||
FreeLeaseQueue::addRange(const AddressRange& range) {
|
||||
// If the container with ranges is empty, there are is no need for
|
||||
// doing any checks. Let's just add the new range.
|
||||
if (!containers_.empty()) {
|
||||
@ -36,7 +36,7 @@ FreeLeaseQueue::addRange(const Range& range) {
|
||||
|
||||
void
|
||||
FreeLeaseQueue::addRange(const IOAddress& start, const IOAddress& end) {
|
||||
addRange(FreeLeaseQueue::Range(start, end));
|
||||
addRange(AddressRange(start, end));
|
||||
}
|
||||
|
||||
void
|
||||
@ -52,7 +52,7 @@ FreeLeaseQueue::addRange(const PrefixRange& range) {
|
||||
void
|
||||
FreeLeaseQueue::addRange(const asiolink::IOAddress& prefix, const uint8_t prefix_length,
|
||||
const uint8_t delegated_length) {
|
||||
addRange(FreeLeaseQueue::PrefixRange(prefix, prefix_length, delegated_length));
|
||||
addRange(PrefixRange(prefix, prefix_length, delegated_length));
|
||||
}
|
||||
|
||||
bool
|
||||
@ -76,7 +76,7 @@ FreeLeaseQueue::append(const IOAddress& address) {
|
||||
return (false);
|
||||
}
|
||||
// Use the range we found and append the address to it.
|
||||
FreeLeaseQueue::Range range(lb->range_start_, lb->range_end_);
|
||||
AddressRange range(lb->range_start_, lb->range_end_);
|
||||
append(range, address);
|
||||
|
||||
// Everything is fine.
|
||||
@ -105,7 +105,7 @@ FreeLeaseQueue::append(const IOAddress& prefix, const uint8_t delegated_length)
|
||||
return (false);
|
||||
}
|
||||
// Use the range we found and append the prefix to it.
|
||||
FreeLeaseQueue::PrefixRange range(lb->range_start_, lb->range_end_, lb->delegated_length_);
|
||||
PrefixRange range(lb->range_start_, lb->range_end_, lb->delegated_length_);
|
||||
append(range, prefix);
|
||||
|
||||
// Everything is fine.
|
||||
@ -113,7 +113,7 @@ FreeLeaseQueue::append(const IOAddress& prefix, const uint8_t delegated_length)
|
||||
}
|
||||
|
||||
void
|
||||
FreeLeaseQueue::append(const FreeLeaseQueue::Range& range, const IOAddress& address) {
|
||||
FreeLeaseQueue::append(const AddressRange& range, const IOAddress& address) {
|
||||
// Make sure the address is within the range boundaries.
|
||||
checkRangeBoundaries(range, address);
|
||||
auto cont = getContainer(range);
|
||||
@ -131,14 +131,14 @@ FreeLeaseQueue::append(const uint64_t range_index, const IOAddress& ip) {
|
||||
}
|
||||
|
||||
void
|
||||
FreeLeaseQueue::append(const FreeLeaseQueue::PrefixRange& range, const asiolink::IOAddress& prefix) {
|
||||
FreeLeaseQueue::append(const PrefixRange& range, const asiolink::IOAddress& prefix) {
|
||||
checkRangeBoundaries(range, prefix, true);
|
||||
auto cont = getContainer(range);
|
||||
cont->insert(prefix);
|
||||
}
|
||||
|
||||
bool
|
||||
FreeLeaseQueue::use(const FreeLeaseQueue::Range& range, const IOAddress& address) {
|
||||
FreeLeaseQueue::use(const AddressRange& range, const IOAddress& address) {
|
||||
checkRangeBoundaries(range, address);
|
||||
auto cont = getContainer(range);
|
||||
auto found = cont->find(address);
|
||||
@ -150,7 +150,7 @@ FreeLeaseQueue::use(const FreeLeaseQueue::Range& range, const IOAddress& address
|
||||
}
|
||||
|
||||
bool
|
||||
FreeLeaseQueue::use(const FreeLeaseQueue::PrefixRange& range, const IOAddress& prefix) {
|
||||
FreeLeaseQueue::use(const PrefixRange& range, const IOAddress& prefix) {
|
||||
checkRangeBoundaries(range, prefix, true);
|
||||
auto cont = getContainer(range);
|
||||
auto found = cont->find(prefix);
|
||||
@ -216,7 +216,7 @@ FreeLeaseQueue::checkRangeOverlaps(const IOAddress& start, const IOAddress& end)
|
||||
|
||||
|
||||
FreeLeaseQueue::ContainerPtr
|
||||
FreeLeaseQueue::getContainer(const FreeLeaseQueue::Range& range) const {
|
||||
FreeLeaseQueue::getContainer(const AddressRange& range) const {
|
||||
auto cont = containers_.find(range.start_);
|
||||
if (cont == containers_.end()) {
|
||||
isc_throw(BadValue, "conatiner for the specified address range " << range.start_
|
||||
@ -226,7 +226,7 @@ FreeLeaseQueue::getContainer(const FreeLeaseQueue::Range& range) const {
|
||||
}
|
||||
|
||||
FreeLeaseQueue::ContainerPtr
|
||||
FreeLeaseQueue::getContainer(const FreeLeaseQueue::PrefixRange& range) const {
|
||||
FreeLeaseQueue::getContainer(const PrefixRange& range) const {
|
||||
auto cont = containers_.find(range.start_);
|
||||
if (cont == containers_.end()) {
|
||||
isc_throw(BadValue, "conatiner for the specified prefix " << range.start_
|
||||
|
@ -76,12 +76,6 @@ namespace dhcp {
|
||||
class FreeLeaseQueue {
|
||||
public:
|
||||
|
||||
/// @brief Structure representing address range in the @c FreeLeaseQueue.
|
||||
typedef AddressRange Range;
|
||||
|
||||
/// @brief Structure representing delegated prefix range in @c FreeLeaseQueue.
|
||||
typedef PrefixRange PrefixRange;
|
||||
|
||||
/// @brief Constructor.
|
||||
FreeLeaseQueue();
|
||||
|
||||
@ -91,7 +85,7 @@ public:
|
||||
///
|
||||
/// @param range the new range to be added.
|
||||
/// @throw BadValue if the new range overlaps with any of the existing ranges.
|
||||
void addRange(const Range& range);
|
||||
void addRange(const AddressRange& range);
|
||||
|
||||
/// @brief Adds new address range to the container.
|
||||
///
|
||||
@ -169,7 +163,7 @@ public:
|
||||
/// @param address address to be appended to the range queue.
|
||||
/// @throw BadValue if the address does not belong to the specified
|
||||
/// range or if the given range does not exist.
|
||||
void append(const Range& range, const asiolink::IOAddress& address);
|
||||
void append(const AddressRange& range, const asiolink::IOAddress& address);
|
||||
|
||||
/// @brief Appends a prefix at the end of the queue for a range.
|
||||
///
|
||||
@ -209,7 +203,7 @@ public:
|
||||
/// @return true if the address was found and successfully removed,
|
||||
/// false otherwise.
|
||||
/// @throw BadValue if the range does not exist.
|
||||
bool use(const Range& range, const asiolink::IOAddress& address);
|
||||
bool use(const AddressRange& range, const asiolink::IOAddress& address);
|
||||
|
||||
/// @brief Removes the specified delegated prefix from the free prefixes.
|
||||
///
|
||||
@ -228,7 +222,7 @@ public:
|
||||
/// for the range.
|
||||
///
|
||||
/// @param range range for which next address is to be returned.
|
||||
/// @tparam RangeType type of the range, i.e. @c Range or @c PrefixRange.
|
||||
/// @tparam RangeType type of the range, i.e. @c AddressRange or @c PrefixRange.
|
||||
/// @return Next free address or delegated prefix in that range.
|
||||
/// @throw BadValue if the range does not exist.
|
||||
template<typename RangeType>
|
||||
@ -243,7 +237,7 @@ public:
|
||||
/// should be appended to the queue using the @c append method.
|
||||
///
|
||||
/// @param range range for which next address or prefix is to be returned.
|
||||
/// @tparam RangeType type of the range, i.e. @c Range or @c PrefixRange.
|
||||
/// @tparam RangeType type of the range, i.e. @c AddressRange or @c PrefixRange.
|
||||
/// @return Next free address or delegated prefix in that range.
|
||||
/// @throw BadValue if the range does not exist.
|
||||
template<typename RangeType>
|
||||
@ -258,7 +252,7 @@ public:
|
||||
/// range itself because it uses random access index.
|
||||
///
|
||||
/// @param range range which index is to be returned.
|
||||
/// @tparam RangeType type of the range, i.e. @c Range or PrefixRange.
|
||||
/// @tparam RangeType type of the range, i.e. @c AddressRange or PrefixRange.
|
||||
/// @return range index.
|
||||
/// @throw BadValue if the range does not exist.
|
||||
template<typename RangeType>
|
||||
@ -333,7 +327,7 @@ private:
|
||||
/// @param ip address or delegated prefix for which the check should be performed.
|
||||
/// @param prefix boolean value indicating if the specified IP is an address or
|
||||
/// delegated prefix - used in error logging.
|
||||
/// @tparam RangeType type of the range used, i.e. @c Range or @c PrefixRange.
|
||||
/// @tparam RangeType type of the range used, i.e. @c AddressRange or @c PrefixRange.
|
||||
/// @throw BadValue of the address or delegated prefix does not belong to the range.
|
||||
template<typename RangeType>
|
||||
void checkRangeBoundaries(const RangeType& range, const asiolink::IOAddress& ip,
|
||||
@ -353,7 +347,7 @@ private:
|
||||
/// @param range range for which the container should be returned.
|
||||
/// @return Pointer to the container (if found).
|
||||
/// @throw BadValue if the specified range does not exist.
|
||||
ContainerPtr getContainer(const Range& range) const;
|
||||
ContainerPtr getContainer(const AddressRange& range) const;
|
||||
|
||||
/// @brief Returns container for a given prefix range.
|
||||
///
|
||||
|
@ -15,14 +15,14 @@ using namespace isc::asiolink;
|
||||
namespace isc {
|
||||
namespace dhcp {
|
||||
|
||||
IPRangePermutation::IPRangePermutation(const IPRangePermutation::Range& range)
|
||||
IPRangePermutation::IPRangePermutation(const AddressRange& range)
|
||||
: range_start_(range.start_), step_(1), cursor_(addrsInRange(range_start_, range.end_) - 1),
|
||||
state_(), done_(false), generator_() {
|
||||
std::random_device rd;
|
||||
generator_.seed(rd());
|
||||
}
|
||||
|
||||
IPRangePermutation::IPRangePermutation(const IPRangePermutation::PrefixRange& range)
|
||||
IPRangePermutation::IPRangePermutation(const PrefixRange& range)
|
||||
: range_start_(range.start_), step_(static_cast<uint64_t>(1) << (128 - range.delegated_length_)),
|
||||
cursor_(prefixesInRange(range.prefix_length_, range.delegated_length_) - 1),
|
||||
state_(), done_(false), generator_() {
|
||||
|
@ -63,16 +63,10 @@ namespace dhcp {
|
||||
class IPRangePermutation {
|
||||
public:
|
||||
|
||||
/// Address range.
|
||||
typedef AddressRange Range;
|
||||
|
||||
/// Prefix range.
|
||||
typedef PrefixRange PrefixRange;
|
||||
|
||||
/// @brief Constructor for address ranges.
|
||||
///
|
||||
/// @param range address range for which the permutation will be generated.
|
||||
IPRangePermutation(const Range& range);
|
||||
IPRangePermutation(const AddressRange& range);
|
||||
|
||||
/// @brief Constructor for prefix ranges.
|
||||
///
|
||||
|
@ -145,8 +145,8 @@ TEST(FreeLeaseQueueTest, removeRange) {
|
||||
FreeLeaseQueue lq;
|
||||
|
||||
// Add two ranges.
|
||||
FreeLeaseQueue::Range range1(IOAddress("192.0.2.99"), IOAddress("192.0.2.100"));
|
||||
FreeLeaseQueue::Range range2(IOAddress("192.0.3.99"), IOAddress("192.0.3.100"));
|
||||
AddressRange range1(IOAddress("192.0.2.99"), IOAddress("192.0.2.100"));
|
||||
AddressRange range2(IOAddress("192.0.3.99"), IOAddress("192.0.3.100"));
|
||||
ASSERT_NO_THROW(lq.addRange(range1));
|
||||
ASSERT_NO_THROW(lq.addRange(range2));
|
||||
|
||||
@ -177,8 +177,8 @@ TEST(FreeLeaseQueueTest, removePrefixRange) {
|
||||
FreeLeaseQueue lq;
|
||||
|
||||
// Add two ranges.
|
||||
FreeLeaseQueue::PrefixRange range1(IOAddress("3000::"), 64, 96);
|
||||
FreeLeaseQueue::PrefixRange range2(IOAddress("3001::"), 64, 96);
|
||||
PrefixRange range1(IOAddress("3000::"), 64, 96);
|
||||
PrefixRange range2(IOAddress("3001::"), 64, 96);
|
||||
ASSERT_NO_THROW(lq.addRange(range1));
|
||||
ASSERT_NO_THROW(lq.addRange(range2));
|
||||
|
||||
@ -208,7 +208,7 @@ TEST(FreeLeaseQueueTest, removePrefixRange) {
|
||||
// given range throws and that an attempt to use non-existing in-range
|
||||
// address returns false.
|
||||
TEST(FreeLeaseQueueTest, useInvalidAddress) {
|
||||
FreeLeaseQueue::Range range(IOAddress("192.0.2.99"), IOAddress("192.0.2.100"));
|
||||
AddressRange range(IOAddress("192.0.2.99"), IOAddress("192.0.2.100"));
|
||||
|
||||
FreeLeaseQueue lq;
|
||||
ASSERT_NO_THROW(lq.addRange(range));
|
||||
@ -226,7 +226,7 @@ TEST(FreeLeaseQueueTest, useInvalidAddress) {
|
||||
// given range throws and that an attempt to use non-existing in-range
|
||||
// address returns false.
|
||||
TEST(FreeLeaseQueueTest, useInvalidPrefix) {
|
||||
FreeLeaseQueue::PrefixRange range(IOAddress("2001:db8:1::"), 64, 96);
|
||||
PrefixRange range(IOAddress("2001:db8:1::"), 64, 96);
|
||||
|
||||
FreeLeaseQueue lq;
|
||||
ASSERT_NO_THROW(lq.addRange(range));
|
||||
@ -245,7 +245,7 @@ TEST(FreeLeaseQueueTest, useInvalidPrefix) {
|
||||
TEST(FreeLeaseQueueTest, appendDuplicates) {
|
||||
FreeLeaseQueue lq;
|
||||
|
||||
FreeLeaseQueue::Range range(IOAddress("192.0.2.1"), IOAddress("192.0.2.255"));
|
||||
AddressRange range(IOAddress("192.0.2.1"), IOAddress("192.0.2.255"));
|
||||
ASSERT_NO_THROW(lq.addRange(range));
|
||||
|
||||
ASSERT_NO_THROW(lq.append(range, IOAddress("192.0.2.10")));
|
||||
@ -270,16 +270,16 @@ TEST(FreeLeaseQueueTest, next) {
|
||||
FreeLeaseQueue lq;
|
||||
|
||||
// Let's create two distinct address ranges.
|
||||
FreeLeaseQueue::Range range1(IOAddress("192.0.2.1"), IOAddress("192.0.2.255"));
|
||||
FreeLeaseQueue::Range range2(IOAddress("192.0.3.1"), IOAddress("192.0.3.255"));
|
||||
AddressRange range1(IOAddress("192.0.2.1"), IOAddress("192.0.2.255"));
|
||||
AddressRange range2(IOAddress("192.0.3.1"), IOAddress("192.0.3.255"));
|
||||
ASSERT_NO_THROW(lq.addRange(range1));
|
||||
ASSERT_NO_THROW(lq.addRange(range2));
|
||||
|
||||
// Append some IP addresses to those address ranges.
|
||||
ASSERT_NO_THROW(lq.append(FreeLeaseQueue::Range(range1), IOAddress("192.0.2.10")));
|
||||
ASSERT_NO_THROW(lq.append(FreeLeaseQueue::Range(range1), IOAddress("192.0.2.5")));
|
||||
ASSERT_NO_THROW(lq.append(FreeLeaseQueue::Range(range2), IOAddress("192.0.3.23")));
|
||||
ASSERT_NO_THROW(lq.append(FreeLeaseQueue::Range(range2), IOAddress("192.0.3.46")));
|
||||
ASSERT_NO_THROW(lq.append(AddressRange(range1), IOAddress("192.0.2.10")));
|
||||
ASSERT_NO_THROW(lq.append(AddressRange(range1), IOAddress("192.0.2.5")));
|
||||
ASSERT_NO_THROW(lq.append(AddressRange(range2), IOAddress("192.0.3.23")));
|
||||
ASSERT_NO_THROW(lq.append(AddressRange(range2), IOAddress("192.0.3.46")));
|
||||
|
||||
// Get the first address from the first range.
|
||||
IOAddress next(0);
|
||||
@ -328,7 +328,7 @@ TEST(FreeLeaseQueueTest, next) {
|
||||
TEST(FreeLeaseQueueTest, nextPrefix) {
|
||||
FreeLeaseQueue lq;
|
||||
|
||||
FreeLeaseQueue::PrefixRange range1(IOAddress("2001:db8:1::"), 64, 96);
|
||||
PrefixRange range1(IOAddress("2001:db8:1::"), 64, 96);
|
||||
ASSERT_NO_THROW(lq.addRange(range1));
|
||||
|
||||
ASSERT_NO_THROW(lq.append(range1, IOAddress("2001:db8:1::4:0")));
|
||||
@ -369,16 +369,16 @@ TEST(FreeLeaseQueueTest, pop) {
|
||||
FreeLeaseQueue lq;
|
||||
|
||||
// Let's create two distinct address ranges.
|
||||
FreeLeaseQueue::Range range1(IOAddress("192.0.2.1"), IOAddress("192.0.2.255"));
|
||||
FreeLeaseQueue::Range range2(IOAddress("192.0.3.1"), IOAddress("192.0.3.255"));
|
||||
AddressRange range1(IOAddress("192.0.2.1"), IOAddress("192.0.2.255"));
|
||||
AddressRange range2(IOAddress("192.0.3.1"), IOAddress("192.0.3.255"));
|
||||
ASSERT_NO_THROW(lq.addRange(range1));
|
||||
ASSERT_NO_THROW(lq.addRange(range2));
|
||||
|
||||
// Append some IP addresses to those address ranges.
|
||||
ASSERT_NO_THROW(lq.append(FreeLeaseQueue::Range(range1), IOAddress("192.0.2.10")));
|
||||
ASSERT_NO_THROW(lq.append(FreeLeaseQueue::Range(range1), IOAddress("192.0.2.5")));
|
||||
ASSERT_NO_THROW(lq.append(FreeLeaseQueue::Range(range2), IOAddress("192.0.3.23")));
|
||||
ASSERT_NO_THROW(lq.append(FreeLeaseQueue::Range(range2), IOAddress("192.0.3.46")));
|
||||
ASSERT_NO_THROW(lq.append(AddressRange(range1), IOAddress("192.0.2.10")));
|
||||
ASSERT_NO_THROW(lq.append(AddressRange(range1), IOAddress("192.0.2.5")));
|
||||
ASSERT_NO_THROW(lq.append(AddressRange(range2), IOAddress("192.0.3.23")));
|
||||
ASSERT_NO_THROW(lq.append(AddressRange(range2), IOAddress("192.0.3.46")));
|
||||
|
||||
// Pop first from first range.
|
||||
IOAddress next(0);
|
||||
@ -410,7 +410,7 @@ TEST(FreeLeaseQueueTest, popPrefix) {
|
||||
FreeLeaseQueue lq;
|
||||
|
||||
// Add the range.
|
||||
FreeLeaseQueue::PrefixRange range1(IOAddress("2001:db8:1::"), 64, 96);
|
||||
PrefixRange range1(IOAddress("2001:db8:1::"), 64, 96);
|
||||
ASSERT_NO_THROW(lq.addRange(range1));
|
||||
|
||||
// Append several prefixes to that range.
|
||||
@ -443,10 +443,10 @@ TEST(FreeLeaseQueueTest, popPrefix) {
|
||||
|
||||
// Check that out of bounds address can't be appended to the range.
|
||||
TEST(FreeLeaseQueueTest, nextRangeMismatch) {
|
||||
FreeLeaseQueue::Range range(IOAddress("192.0.2.1"), IOAddress("192.0.2.255"));
|
||||
AddressRange range(IOAddress("192.0.2.1"), IOAddress("192.0.2.255"));
|
||||
|
||||
FreeLeaseQueue lq;
|
||||
EXPECT_THROW(lq.append(FreeLeaseQueue::Range(range), IOAddress("192.0.3.1")),
|
||||
EXPECT_THROW(lq.append(AddressRange(range), IOAddress("192.0.3.1")),
|
||||
isc::BadValue);
|
||||
}
|
||||
|
||||
@ -456,9 +456,9 @@ TEST(FreeLeaseQueueTest, detectRange) {
|
||||
FreeLeaseQueue lq;
|
||||
|
||||
// Create three ranges.
|
||||
FreeLeaseQueue::Range range1(IOAddress("192.0.2.1"), IOAddress("192.0.2.255"));
|
||||
FreeLeaseQueue::Range range2(IOAddress("192.0.3.1"), IOAddress("192.0.3.255"));
|
||||
FreeLeaseQueue::Range range3(IOAddress("10.0.0.1"), IOAddress("10.8.1.45"));
|
||||
AddressRange range1(IOAddress("192.0.2.1"), IOAddress("192.0.2.255"));
|
||||
AddressRange range2(IOAddress("192.0.3.1"), IOAddress("192.0.3.255"));
|
||||
AddressRange range3(IOAddress("10.0.0.1"), IOAddress("10.8.1.45"));
|
||||
ASSERT_NO_THROW(lq.addRange(range1));
|
||||
ASSERT_NO_THROW(lq.addRange(range2));
|
||||
ASSERT_NO_THROW(lq.addRange(range3));
|
||||
@ -499,9 +499,9 @@ TEST(FreeLeaseQueueTest, detectPrefixRange) {
|
||||
FreeLeaseQueue lq;
|
||||
|
||||
// Create three ranges.
|
||||
FreeLeaseQueue::PrefixRange range1(IOAddress("2001:db8:1::"), 64, 96);
|
||||
FreeLeaseQueue::PrefixRange range2(IOAddress("2001:db8:2::"), 112, 120);
|
||||
FreeLeaseQueue::PrefixRange range3(IOAddress("2001:db8:3::"), 96, 104);
|
||||
PrefixRange range1(IOAddress("2001:db8:1::"), 64, 96);
|
||||
PrefixRange range2(IOAddress("2001:db8:2::"), 112, 120);
|
||||
PrefixRange range3(IOAddress("2001:db8:3::"), 96, 104);
|
||||
ASSERT_NO_THROW(lq.addRange(range1));
|
||||
ASSERT_NO_THROW(lq.addRange(range2));
|
||||
ASSERT_NO_THROW(lq.addRange(range3));
|
||||
@ -540,7 +540,7 @@ TEST(FreeLeaseQueueTest, detectPrefixRange) {
|
||||
// This test verifies that false is returned if the specified address to be
|
||||
// appended does not belong to any of the existing ranges.
|
||||
TEST(FreeLeaseQueueTest, detectRangeFailed) {
|
||||
FreeLeaseQueue::Range range(IOAddress("192.0.2.1"), IOAddress("192.0.2.255"));
|
||||
AddressRange range(IOAddress("192.0.2.1"), IOAddress("192.0.2.255"));
|
||||
|
||||
FreeLeaseQueue lq;
|
||||
ASSERT_NO_THROW(lq.addRange(range));
|
||||
@ -553,9 +553,9 @@ TEST(FreeLeaseQueueTest, detectRangeFailed) {
|
||||
TEST(FreeLeaseQueueTest, appendThroughRangeIndex) {
|
||||
FreeLeaseQueue lq;
|
||||
|
||||
FreeLeaseQueue::Range range1(IOAddress("192.0.2.1"), IOAddress("192.0.2.255"));
|
||||
FreeLeaseQueue::Range range2(IOAddress("192.0.3.1"), IOAddress("192.0.3.255"));
|
||||
FreeLeaseQueue::Range range3(IOAddress("10.0.0.1"), IOAddress("10.8.1.45"));
|
||||
AddressRange range1(IOAddress("192.0.2.1"), IOAddress("192.0.2.255"));
|
||||
AddressRange range2(IOAddress("192.0.3.1"), IOAddress("192.0.3.255"));
|
||||
AddressRange range3(IOAddress("10.0.0.1"), IOAddress("10.8.1.45"));
|
||||
ASSERT_NO_THROW(lq.addRange(range1));
|
||||
ASSERT_NO_THROW(lq.addRange(range2));
|
||||
ASSERT_NO_THROW(lq.addRange(range3));
|
||||
@ -584,9 +584,9 @@ TEST(FreeLeaseQueueTest, appendThroughRangeIndex) {
|
||||
TEST(FreeLeaseQueueTest, appendPrefixThroughRangeIndex) {
|
||||
FreeLeaseQueue lq;
|
||||
|
||||
FreeLeaseQueue::PrefixRange range1(IOAddress("2001:db8:1::"), 64, 96);
|
||||
FreeLeaseQueue::PrefixRange range2(IOAddress("2001:db8:2::"), 64, 96);
|
||||
FreeLeaseQueue::PrefixRange range3(IOAddress("2001:db8:3::"), 64, 96);
|
||||
PrefixRange range1(IOAddress("2001:db8:1::"), 64, 96);
|
||||
PrefixRange range2(IOAddress("2001:db8:2::"), 64, 96);
|
||||
PrefixRange range3(IOAddress("2001:db8:3::"), 64, 96);
|
||||
ASSERT_NO_THROW(lq.addRange(range1));
|
||||
ASSERT_NO_THROW(lq.addRange(range2));
|
||||
ASSERT_NO_THROW(lq.addRange(range3));
|
||||
|
@ -21,11 +21,11 @@ namespace {
|
||||
// both IPv4 and IPv6 address range.
|
||||
TEST(IPRangePermutationTest, constructor) {
|
||||
ASSERT_NO_THROW({
|
||||
IPRangePermutation::Range range(IOAddress("192.0.2.10"), IOAddress("192.0.2.100"));
|
||||
AddressRange range(IOAddress("192.0.2.10"), IOAddress("192.0.2.100"));
|
||||
IPRangePermutation perm(range);
|
||||
});
|
||||
ASSERT_NO_THROW({
|
||||
IPRangePermutation::Range range(IOAddress("3000::"), IOAddress("3000::10"));
|
||||
AddressRange range(IOAddress("3000::"), IOAddress("3000::10"));
|
||||
IPRangePermutation perm(range);
|
||||
});
|
||||
}
|
||||
@ -34,7 +34,7 @@ TEST(IPRangePermutationTest, constructor) {
|
||||
// be generated.
|
||||
TEST(IPRangePermutationTest, ipv4) {
|
||||
// Create address range with 91 addresses.
|
||||
IPRangePermutation::Range range(IOAddress("192.0.2.10"), IOAddress("192.0.2.100"));
|
||||
AddressRange range(IOAddress("192.0.2.10"), IOAddress("192.0.2.100"));
|
||||
IPRangePermutation perm(range);
|
||||
|
||||
// This set will record unique IP addresses generated.
|
||||
@ -67,7 +67,7 @@ TEST(IPRangePermutationTest, ipv4) {
|
||||
// This test verifies that a permutation of IPv6 address range can
|
||||
// be generated.
|
||||
TEST(IPRangePermutationTest, ipv6) {
|
||||
IPRangePermutation::Range range(IOAddress("2001:db8:1::1:fea0"),
|
||||
AddressRange range(IOAddress("2001:db8:1::1:fea0"),
|
||||
IOAddress("2001:db8:1::2:abcd"));
|
||||
IPRangePermutation perm(range);
|
||||
|
||||
@ -95,7 +95,7 @@ TEST(IPRangePermutationTest, ipv6) {
|
||||
// This test verifies that a permutation of delegated prefixes can be
|
||||
// generated.
|
||||
TEST(IPRangePermutationTest, pd) {
|
||||
IPRangePermutation::PrefixRange range(IOAddress("3000::"), 112, 120);
|
||||
PrefixRange range(IOAddress("3000::"), 112, 120);
|
||||
IPRangePermutation perm(range);
|
||||
|
||||
std::set<IOAddress> addrs;
|
||||
|
Loading…
x
Reference in New Issue
Block a user