Commit 0b0bb4a2 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰

[3146] getLease6() renamed to getLeases6()

parent abd29c04
...@@ -552,8 +552,8 @@ public: ...@@ -552,8 +552,8 @@ public:
/// @param iaid IA identifier /// @param iaid IA identifier
/// ///
/// @return Lease collection (may be empty if no lease is found) /// @return Lease collection (may be empty if no lease is found)
virtual Lease6Collection getLease6(Lease6::LeaseType type, const DUID& duid, virtual Lease6Collection getLeases6(Lease6::LeaseType type, const DUID& duid,
uint32_t iaid) const = 0; uint32_t iaid) const = 0;
/// @brief Returns existing IPv6 lease for a given DUID+IA combination /// @brief Returns existing IPv6 lease for a given DUID+IA combination
/// ///
......
...@@ -200,11 +200,13 @@ Memfile_LeaseMgr::getLease6(Lease6::LeaseType /* not used yet */, ...@@ -200,11 +200,13 @@ Memfile_LeaseMgr::getLease6(Lease6::LeaseType /* not used yet */,
} }
Lease6Collection Lease6Collection
Memfile_LeaseMgr::getLease6(Lease6::LeaseType /* not used yet */, Memfile_LeaseMgr::getLeases6(Lease6::LeaseType /* not used yet */,
const DUID& duid, uint32_t iaid) const { const DUID& duid, uint32_t iaid) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MEMFILE_GET_IAID_DUID).arg(iaid).arg(duid.toText()); DHCPSRV_MEMFILE_GET_IAID_DUID).arg(iaid).arg(duid.toText());
/// @todo Not implemented.
return (Lease6Collection()); return (Lease6Collection());
} }
......
...@@ -156,8 +156,8 @@ public: ...@@ -156,8 +156,8 @@ public:
/// @param iaid IA identifier /// @param iaid IA identifier
/// ///
/// @return collection of IPv6 leases /// @return collection of IPv6 leases
virtual Lease6Collection getLease6(Lease6::LeaseType type, virtual Lease6Collection getLeases6(Lease6::LeaseType type,
const DUID& duid, uint32_t iaid) const; const DUID& duid, uint32_t iaid) const;
/// @brief Returns existing IPv6 lease for a given DUID/IA/subnet-id tuple /// @brief Returns existing IPv6 lease for a given DUID/IA/subnet-id tuple
/// ///
......
...@@ -1678,8 +1678,8 @@ MySqlLeaseMgr::getLease6(Lease6::LeaseType /* type - not used yet */, ...@@ -1678,8 +1678,8 @@ MySqlLeaseMgr::getLease6(Lease6::LeaseType /* type - not used yet */,
Lease6Collection Lease6Collection
MySqlLeaseMgr::getLease6(Lease6::LeaseType /* type - not used yet */, MySqlLeaseMgr::getLeases6(Lease6::LeaseType /* type - not used yet */,
const DUID& duid, uint32_t iaid) const { const DUID& duid, uint32_t iaid) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_IAID_DUID).arg(iaid).arg(duid.toText()); DHCPSRV_MYSQL_GET_IAID_DUID).arg(iaid).arg(duid.toText());
......
...@@ -279,8 +279,8 @@ public: ...@@ -279,8 +279,8 @@ public:
/// programming error. /// programming error.
/// @throw isc::dhcp::DbOperationError An operation on the open database has /// @throw isc::dhcp::DbOperationError An operation on the open database has
/// failed. /// failed.
virtual Lease6Collection getLease6(Lease6::LeaseType type, const DUID& duid, virtual Lease6Collection getLeases6(Lease6::LeaseType type, const DUID& duid,
uint32_t iaid) const; uint32_t iaid) const;
/// @brief Returns existing IPv6 lease for a given DUID+IA combination /// @brief Returns existing IPv6 lease for a given DUID+IA combination
/// ///
......
...@@ -142,8 +142,8 @@ public: ...@@ -142,8 +142,8 @@ public:
/// @param iaid ignored /// @param iaid ignored
/// ///
/// @return whatever is set in leases6_ field /// @return whatever is set in leases6_ field
virtual Lease6Collection getLease6(Lease6::LeaseType /* not used yet */, virtual Lease6Collection getLeases6(Lease6::LeaseType /* not used yet */,
const DUID&, uint32_t) const { const DUID&, uint32_t) const {
return (leases6_); return (leases6_);
} }
......
...@@ -835,9 +835,9 @@ TEST_F(MySqlLeaseMgrTest, getLease6DuidIaid) { ...@@ -835,9 +835,9 @@ TEST_F(MySqlLeaseMgrTest, getLease6DuidIaid) {
} }
// Get the leases matching the DUID and IAID of lease[1]. // Get the leases matching the DUID and IAID of lease[1].
Lease6Collection returned = lmptr_->getLease6(leasetype6_[1], Lease6Collection returned = lmptr_->getLeases6(leasetype6_[1],
*leases[1]->duid_, *leases[1]->duid_,
leases[1]->iaid_); leases[1]->iaid_);
// Should be three leases, matching leases[1], [4] and [5]. // Should be three leases, matching leases[1], [4] and [5].
ASSERT_EQ(3, returned.size()); ASSERT_EQ(3, returned.size());
...@@ -855,15 +855,15 @@ TEST_F(MySqlLeaseMgrTest, getLease6DuidIaid) { ...@@ -855,15 +855,15 @@ TEST_F(MySqlLeaseMgrTest, getLease6DuidIaid) {
// Check that nothing is returned when either the IAID or DUID match // Check that nothing is returned when either the IAID or DUID match
// nothing. // nothing.
returned = lmptr_->getLease6(leasetype6_[1], *leases[1]->duid_, returned = lmptr_->getLeases6(leasetype6_[1], *leases[1]->duid_,
leases[1]->iaid_ + 1); leases[1]->iaid_ + 1);
EXPECT_EQ(0, returned.size()); EXPECT_EQ(0, returned.size());
// Alter the leases[1] DUID to match nothing in the database. // Alter the leases[1] DUID to match nothing in the database.
vector<uint8_t> duid_vector = leases[1]->duid_->getDuid(); vector<uint8_t> duid_vector = leases[1]->duid_->getDuid();
++duid_vector[0]; ++duid_vector[0];
DUID new_duid(duid_vector); DUID new_duid(duid_vector);
returned = lmptr_->getLease6(leasetype6_[1], new_duid, leases[1]->iaid_); returned = lmptr_->getLeases6(leasetype6_[1], new_duid, leases[1]->iaid_);
EXPECT_EQ(0, returned.size()); EXPECT_EQ(0, returned.size());
} }
...@@ -887,9 +887,9 @@ TEST_F(MySqlLeaseMgrTest, getLease6DuidIaidSize) { ...@@ -887,9 +887,9 @@ TEST_F(MySqlLeaseMgrTest, getLease6DuidIaidSize) {
vector<uint8_t> duid_vec(i, i); vector<uint8_t> duid_vec(i, i);
leases[1]->duid_.reset(new DUID(duid_vec)); leases[1]->duid_.reset(new DUID(duid_vec));
EXPECT_TRUE(lmptr_->addLease(leases[1])); EXPECT_TRUE(lmptr_->addLease(leases[1]));
Lease6Collection returned = lmptr_->getLease6(leasetype6_[1], Lease6Collection returned = lmptr_->getLeases6(leasetype6_[1],
*leases[1]->duid_, *leases[1]->duid_,
leases[1]->iaid_); leases[1]->iaid_);
ASSERT_EQ(1, returned.size()); ASSERT_EQ(1, returned.size());
detailCompareLease(leases[1], *returned.begin()); detailCompareLease(leases[1], *returned.begin());
(void) lmptr_->deleteLease(leases[1]->addr_); (void) lmptr_->deleteLease(leases[1]->addr_);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment