summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv/testutils
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2023-12-14 15:21:15 +0100
committerFrancis Dupont <fdupont@isc.org>2024-01-17 11:06:16 +0100
commit032a8ad465b57d7ffeb119c34c3e5606f81c57bf (patch)
tree03a92d3721a5a8686252c4d285bd6e27a192aa95 /src/lib/dhcpsrv/testutils
parent[#3149] Fixed mysql admin tests (diff)
downloadkea-032a8ad465b57d7ffeb119c34c3e5606f81c57bf.tar.xz
kea-032a8ad465b57d7ffeb119c34c3e5606f81c57bf.zip
[#3149] Rewrote getLeases6ByLink
Diffstat (limited to 'src/lib/dhcpsrv/testutils')
-rw-r--r--src/lib/dhcpsrv/testutils/concrete_lease_mgr.cc3
-rw-r--r--src/lib/dhcpsrv/testutils/concrete_lease_mgr.h3
-rw-r--r--src/lib/dhcpsrv/testutils/generic_lease_extended_info_unittest.h30
3 files changed, 15 insertions, 21 deletions
diff --git a/src/lib/dhcpsrv/testutils/concrete_lease_mgr.cc b/src/lib/dhcpsrv/testutils/concrete_lease_mgr.cc
index 6a99637c0a..0c162c7b78 100644
--- a/src/lib/dhcpsrv/testutils/concrete_lease_mgr.cc
+++ b/src/lib/dhcpsrv/testutils/concrete_lease_mgr.cc
@@ -280,8 +280,7 @@ ConcreteLeaseMgr::getLeases6ByRemoteId(const OptionBuffer& /* remote_id */,
}
Lease6Collection
-ConcreteLeaseMgr::getLeases6ByLink(const IOAddress& /* link_addr */,
- uint8_t /* link_len */,
+ConcreteLeaseMgr::getLeases6ByLink(SubnetID /* subnet_id */,
const IOAddress& /* lower_bound_address */,
const LeasePageSize& /* page_size */) {
isc_throw(NotImplemented, "ConcreteLeaseMgr::getLeases6ByLink not implemented");
diff --git a/src/lib/dhcpsrv/testutils/concrete_lease_mgr.h b/src/lib/dhcpsrv/testutils/concrete_lease_mgr.h
index d1ec4bb286..caab063290 100644
--- a/src/lib/dhcpsrv/testutils/concrete_lease_mgr.h
+++ b/src/lib/dhcpsrv/testutils/concrete_lease_mgr.h
@@ -368,8 +368,7 @@ public:
/// @brief Stub implementation.
Lease6Collection
- getLeases6ByLink(const asiolink::IOAddress& /* link_addr */,
- uint8_t /* link_len */,
+ getLeases6ByLink(SubnetID /* subnet_id */,
const asiolink::IOAddress& /* lower_bound_address */,
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 c785581740..45f41ca64e 100644
--- a/src/lib/dhcpsrv/testutils/generic_lease_extended_info_unittest.h
+++ b/src/lib/dhcpsrv/testutils/generic_lease_extended_info_unittest.h
@@ -1215,23 +1215,25 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testGetLeases6ByLink() {
start(false);
initLease6();
+ // Put leases in the subnet 1.
+ for (size_t i = 0; i < leases6.size(); ++i) {
+ Lease6Ptr lease(new Lease6(*leases6[i]));
+ leases6[i] = lease;
+ lease->subnet_id_ = 1;
+ EXPECT_NO_THROW(lease_mgr_->updateLease6(leases6[i]));
+ }
+
// Create parameter values.
- asiolink::IOAddress link_addr(ADDRESS6[4]);
- asiolink::IOAddress other_link_addr("2001:db8:1::4");
asiolink::IOAddress zero = asiolink::IOAddress::IPV6_ZERO_ADDRESS();
Lease6Collection got;
// Other link: nothing.
- EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByLink(other_link_addr,
- 64,
- zero,
+ EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByLink(100, zero,
LeasePageSize(10)));
EXPECT_EQ(0, got.size());
// Link: 8 entries.
- EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByLink(link_addr,
- 64,
- zero,
+ EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByLink(1, zero,
LeasePageSize(10)));
ASSERT_EQ(8, got.size());
@@ -1243,9 +1245,7 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testGetLeases6ByLink() {
}
// Link: initial partial: 4 entries.
- EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByLink(link_addr,
- 64,
- zero,
+ EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByLink(1, zero,
LeasePageSize(4)));
ASSERT_EQ(4, got.size());
for (size_t i = 0; i < 4; ++i) {
@@ -1255,9 +1255,7 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testGetLeases6ByLink() {
}
// Link: next partial: 4 entries.
- EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByLink(link_addr,
- 64,
- lease->addr_,
+ EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByLink(1, lease->addr_,
LeasePageSize(4)));
ASSERT_EQ(4, got.size());
for (size_t i = 0; i < 4; ++i) {
@@ -1267,9 +1265,7 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testGetLeases6ByLink() {
}
// Link: further partial: nothing.
- EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByLink(link_addr,
- 64,
- lease->addr_,
+ EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByLink(1, lease->addr_,
LeasePageSize(4)));
EXPECT_EQ(0, got.size());
}