summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv/testutils
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2024-01-12 14:11:37 +0100
committerFrancis Dupont <fdupont@isc.org>2024-01-17 11:06:16 +0100
commit511e9c43a4ba2964dcc11d6258edb509cd8f8ead (patch)
tree2c8a22a4923497d33036e27b09975c7430506e97 /src/lib/dhcpsrv/testutils
parent[#3149] Simplified getLinks (diff)
downloadkea-511e9c43a4ba2964dcc11d6258edb509cd8f8ead.tar.xz
kea-511e9c43a4ba2964dcc11d6258edb509cd8f8ead.zip
[#3149] Moved to getLeases6 overload
Diffstat (limited to 'src/lib/dhcpsrv/testutils')
-rw-r--r--src/lib/dhcpsrv/testutils/concrete_lease_mgr.cc14
-rw-r--r--src/lib/dhcpsrv/testutils/concrete_lease_mgr.h19
-rw-r--r--src/lib/dhcpsrv/testutils/generic_lease_extended_info_unittest.h24
3 files changed, 32 insertions, 25 deletions
diff --git a/src/lib/dhcpsrv/testutils/concrete_lease_mgr.cc b/src/lib/dhcpsrv/testutils/concrete_lease_mgr.cc
index 0c162c7b78..45ba6af02c 100644
--- a/src/lib/dhcpsrv/testutils/concrete_lease_mgr.cc
+++ b/src/lib/dhcpsrv/testutils/concrete_lease_mgr.cc
@@ -125,6 +125,13 @@ ConcreteLeaseMgr::getLeases6(const IOAddress& /* lower_bound_address */,
return (Lease6Collection());
};
+Lease6Collection
+ConcreteLeaseMgr::getLeases6(SubnetID /* subnet_id */,
+ const IOAddress& /* lower_bound_address */,
+ const LeasePageSize& /* page_size */) const {
+ return (Lease6Collection());
+}
+
void
ConcreteLeaseMgr::getExpiredLeases6(Lease6Collection&, const size_t) const {
isc_throw(NotImplemented, "ConcreteLeaseMgr::getExpiredLeases6 is not"
@@ -279,13 +286,6 @@ ConcreteLeaseMgr::getLeases6ByRemoteId(const OptionBuffer& /* remote_id */,
isc_throw(NotImplemented, "ConcreteLeaseMgr::getLeases6ByRemoteId not implemented");
}
-Lease6Collection
-ConcreteLeaseMgr::getLeases6ByLink(SubnetID /* subnet_id */,
- const IOAddress& /* lower_bound_address */,
- const LeasePageSize& /* page_size */) {
- isc_throw(NotImplemented, "ConcreteLeaseMgr::getLeases6ByLink not implemented");
-}
-
size_t
ConcreteLeaseMgr::upgradeExtendedInfo4(const LeasePageSize& /* page_size */) {
return (0);
diff --git a/src/lib/dhcpsrv/testutils/concrete_lease_mgr.h b/src/lib/dhcpsrv/testutils/concrete_lease_mgr.h
index caab063290..c51a79bcde 100644
--- a/src/lib/dhcpsrv/testutils/concrete_lease_mgr.h
+++ b/src/lib/dhcpsrv/testutils/concrete_lease_mgr.h
@@ -220,6 +220,19 @@ public:
getLeases6(const asiolink::IOAddress& /* lower_bound_address */,
const LeasePageSize& /* page_size */) const override;
+ /// @brief Returns a page of IPv6 leases for a subnet identifier.
+ ///
+ /// @param subnet_id subnet identifier.
+ /// @param lower_bound_address IPv6 address used as lower bound for the
+ /// returned range.
+ /// @param page_size maximum size of the page returned.
+ ///
+ /// @return collection of IPv6 leases
+ virtual Lease6Collection
+ getLeases6(SubnetID /* subnet_id */,
+ const asiolink::IOAddress& /* lower_bound_address */,
+ const LeasePageSize& /* page_size */) const override;
+
/// @brief Returns expired DHCPv6 leases.
///
/// This method is not implemented.
@@ -367,12 +380,6 @@ public:
const LeasePageSize& /* page_size*/) override;
/// @brief Stub implementation.
- Lease6Collection
- getLeases6ByLink(SubnetID /* subnet_id */,
- const asiolink::IOAddress& /* lower_bound_address */,
- const LeasePageSize& /* page_size */) override;
-
- /// @brief Stub implementation.
virtual size_t
upgradeExtendedInfo4(const LeasePageSize& /* page_size */) override;
diff --git a/src/lib/dhcpsrv/testutils/generic_lease_extended_info_unittest.h b/src/lib/dhcpsrv/testutils/generic_lease_extended_info_unittest.h
index 45f41ca64e..8595884704 100644
--- a/src/lib/dhcpsrv/testutils/generic_lease_extended_info_unittest.h
+++ b/src/lib/dhcpsrv/testutils/generic_lease_extended_info_unittest.h
@@ -189,7 +189,7 @@ public:
/// @brief Test getLeases6ByRemoteId.
void testGetLeases6ByRemoteId();
- /// @brief Test getLeases6ByLink.
+ /// @brief Test paged getLeases6 by subnet id.
void testGetLeases6ByLink();
/// @brief Test upgradeExtendedInfo6.
@@ -1208,7 +1208,7 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testGetLeases6ByRemoteId() {
EXPECT_EQ(lease_addr2, lease->addr_);
}
-/// @brief Verifies that getLeases6ByLink works as expected.
+/// @brief Verifies that paged getLeases6 by subnet id works as expected.
template<typename NakedLeaseMgrType> void
GenericExtendedInfoTest<NakedLeaseMgrType>::testGetLeases6ByLink() {
// Lease manager is created with empty tables.
@@ -1228,13 +1228,13 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testGetLeases6ByLink() {
Lease6Collection got;
// Other link: nothing.
- EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByLink(100, zero,
- LeasePageSize(10)));
+ EXPECT_NO_THROW(got = lease_mgr_->getLeases6(100, zero,
+ LeasePageSize(10)));
EXPECT_EQ(0, got.size());
// Link: 8 entries.
- EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByLink(1, zero,
- LeasePageSize(10)));
+ EXPECT_NO_THROW(got = lease_mgr_->getLeases6(1, zero,
+ LeasePageSize(10)));
ASSERT_EQ(8, got.size());
Lease6Ptr lease;
@@ -1245,8 +1245,8 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testGetLeases6ByLink() {
}
// Link: initial partial: 4 entries.
- EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByLink(1, zero,
- LeasePageSize(4)));
+ EXPECT_NO_THROW(got = lease_mgr_->getLeases6(1, zero,
+ LeasePageSize(4)));
ASSERT_EQ(4, got.size());
for (size_t i = 0; i < 4; ++i) {
lease = got[i];
@@ -1255,8 +1255,8 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testGetLeases6ByLink() {
}
// Link: next partial: 4 entries.
- EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByLink(1, lease->addr_,
- LeasePageSize(4)));
+ EXPECT_NO_THROW(got = lease_mgr_->getLeases6(1, lease->addr_,
+ LeasePageSize(4)));
ASSERT_EQ(4, got.size());
for (size_t i = 0; i < 4; ++i) {
lease = got[i];
@@ -1265,8 +1265,8 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testGetLeases6ByLink() {
}
// Link: further partial: nothing.
- EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByLink(1, lease->addr_,
- LeasePageSize(4)));
+ EXPECT_NO_THROW(got = lease_mgr_->getLeases6(1, lease->addr_,
+ LeasePageSize(4)));
EXPECT_EQ(0, got.size());
}