Commit 27322572 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[5468] Implemented getting leases by subnet id and all leases.

This change affects Memfile, MySQL and Postgres backend. These functions
aren't implemented for CQL at this time.
parent 126e683f
// Copyright (C) 2015-2017 Deutsche Telekom AG.
// Copyright (C) 2015-2018 Deutsche Telekom AG.
//
// Authors: Razvan Becheriu <razvan.becheriu@qualitance.com>
// Andrei Pavel <andrei.pavel@qualitance.com>
......@@ -1620,6 +1620,16 @@ CqlLeaseMgr::getLease4(const ClientId &clientid, SubnetID subnet_id) const {
return (result);
}
Lease4Collection
CqlLeaseMgr::getLeases4(SubnetID) const {
isc_throw(NotImplemented, "getLeases4(subnet_id) is not implemented");
}
Lease4Collection
CqlLeaseMgr::getLeases4() const {
isc_throw(NotImplemented, "getLeases4() is not implemented");
}
Lease6Ptr
CqlLeaseMgr::getLease6(Lease::Type lease_type, const IOAddress &addr) const {
std::string addr_data = addr.toText();
......
// Copyright (C) 2015-2017 Deutsche Telekom AG.
// Copyright (C) 2015-2018 Deutsche Telekom AG.
//
// Authors: Razvan Becheriu <razvan.becheriu@qualitance.com>
// Andrei Pavel <andrei.pavel@qualitance.com>
......@@ -183,6 +183,18 @@ public:
const HWAddr& hwaddr,
SubnetID subnet_id) const override;
/// @brief Returns all IPv4 leases for the particular subnet identifier.
///
/// @param subnet_id subnet identifier.
///
/// @return Lease collection (may be empty if no IPv4 lease found).
virtual Lease4Collection getLeases4(SubnetID subnet_id) const;
/// @brief Returns all IPv4 leases.
///
/// @return Lease collection (may be empty if no IPv4 lease found).
virtual Lease4Collection getLeases4() const;
/// @brief Returns existing IPv4 lease for specified client-id
///
/// There can be at most one lease for a given HW address in a single
......@@ -198,6 +210,18 @@ public:
virtual Lease4Ptr getLease4(const ClientId& clientid,
SubnetID subnet_id) const override;
/// @brief Returns all IPv4 leases for the particular subnet identifier.
///
/// @param subnet_id subnet identifier.
///
/// @return Lease collection (may be empty if no IPv4 lease found).
virtual Lease4Collection getLeases4(SubnetID subnet_id) const;
/// @brief Returns all IPv4 leases.
///
/// @return Lease collection (may be empty if no IPv4 lease found).
virtual Lease4Collection getLeases4() const;
/// @brief Returns existing IPv6 lease for a given IPv6 address.
///
/// For a given address, we assume that there will be only one lease.
......
# Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
# Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -459,6 +459,10 @@ A debug message issued when the server has found expired-reclaimed
leases to be removed. The number of leases to be removed is logged
in the message.
% DHCPSRV_MEMFILE_GET4 obtaining all IPv4 leases
A debug message issued when the server is attempting to obtain all IPv4
leases from the memory file database.
% DHCPSRV_MEMFILE_GET_ADDR4 obtaining IPv4 lease for address %1
A debug message issued when the server is attempting to obtain an IPv4
lease from the memory file database for the specified address.
......@@ -502,6 +506,10 @@ A debug message issued when the server is attempting to obtain an IPv6
lease from the memory file database for a client with the specified IAID
(Identity Association ID), Subnet ID and DUID (DHCP Unique Identifier).
% DHCPSRV_MEMFILE_GET_SUBID4 obtaining IPv4 leases for subnet ID %1
A debug message issued when the server is attempting to obtain all IPv4
leases for a given subnet identifier from the memory file database.
% DHCPSRV_MEMFILE_GET_SUBID_CLIENTID obtaining IPv4 lease for subnet ID %1 and client ID %2
A debug message issued when the server is attempting to obtain an IPv4
lease from the memory file database for a client with the specified
......@@ -685,6 +693,10 @@ An error message indicating that communication with the MySQL database server
has been lost. When this occurs the server exits immediately with a non-zero
exit code. This is most likely due to a network issue.
% DHCPSRV_MYSQL_GET4 obtaining all IPv4 leases
A debug message issued when the server is attempting to obtain all IPv4
leases from the MySQL database.
% DHCPSRV_MYSQL_GET_ADDR4 obtaining IPv4 lease for address %1
A debug message issued when the server is attempting to obtain an IPv4
lease from the MySQL database for the specified address.
......@@ -723,6 +735,10 @@ A debug message issued when the server is attempting to obtain an IPv6
lease from the MySQL database for a client with the specified IAID
(Identity Association ID), Subnet ID and DUID (DHCP Unique Identifier).
% DHCPSRV_MYSQL_GET_SUBID4 obtaining IPv4 leases for subnet ID %1
A debug message issued when the server is attempting to obtain all IPv4
leases for a given subnet identifier from the MySQL database.
% DHCPSRV_MYSQL_GET_SUBID_CLIENTID obtaining IPv4 lease for subnet ID %1 and client ID %2
A debug message issued when the server is attempting to obtain an IPv4
lease from the MySQL database for a client with the specified subnet ID
......@@ -839,6 +855,10 @@ An error message indicating that communication with the MySQL database server
has been lost. When this occurs the server exits immediately with a non-zero
exit code. This is most likely due to a network issue.
% DHCPSRV_PGSQL_GET4 obtaining all IPv4 leases
A debug message issued when the server is attempting to obtain all IPv4
leases from the PostgreSQL database.
% DHCPSRV_PGSQL_GET_ADDR4 obtaining IPv4 lease for address %1
A debug message issued when the server is attempting to obtain an IPv4
lease from the PostgreSQL database for the specified address.
......@@ -877,6 +897,10 @@ A debug message issued when the server is attempting to obtain an IPv6
lease from the PostgreSQL database for a client with the specified IAID
(Identity Association ID), Subnet ID and DUID (DHCP Unique Identifier).
% DHCPSRV_PGSQL_GET_SUBID4 obtaining IPv4 leases for subnet ID %1
A debug message issued when the server is attempting to obtain all IPv4
leases for a given subnet identifier from the PostgreSQL database.
% DHCPSRV_PGSQL_GET_SUBID_CLIENTID obtaining IPv4 lease for subnet ID %1 and client ID %2
A debug message issued when the server is attempting to obtain an IPv4
lease from the PostgreSQL database for a client with the specified subnet ID
......
// Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -261,6 +261,18 @@ public:
virtual Lease4Ptr getLease4(const ClientId& clientid,
SubnetID subnet_id) const = 0;
/// @brief Returns all IPv4 leases for the particular subnet identifier.
///
/// @param subnet_id subnet identifier.
///
/// @return Lease collection (may be empty if no IPv4 lease found).
virtual Lease4Collection getLeases4(SubnetID subnet_id) const = 0;
/// @brief Returns all IPv4 leases.
///
/// @return Lease collection (may be empty if no IPv4 lease found).
virtual Lease4Collection getLeases4() const = 0;
/// @brief Returns existing IPv6 lease for a given IPv6 address.
///
/// For a given address, we assume that there will be only one lease.
......
// Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -733,6 +733,36 @@ Memfile_LeaseMgr::getLease4(const ClientId& client_id,
return (Lease4Ptr(new Lease4(**lease)));
}
Lease4Collection
Memfile_LeaseMgr::getLeases4(SubnetID subnet_id) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MEMFILE_GET_SUBID4)
.arg(subnet_id);
Lease4Collection collection;
const Lease4StorageSubnetIdIndex& idx = storage4_.get<SubnetIdIndexTag>();
std::pair<Lease4StorageSubnetIdIndex::const_iterator,
Lease4StorageSubnetIdIndex::const_iterator> l =
idx.equal_range(subnet_id);
for (auto lease = l.first; lease != l.second; ++lease) {
collection.push_back(Lease4Ptr(new Lease4(**lease)));
}
return (collection);
}
Lease4Collection
Memfile_LeaseMgr::getLeases4() const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MEMFILE_GET4);
Lease4Collection collection;
for (auto lease = storage4_.begin(); lease != storage4_.end(); ++lease ) {
collection.push_back(Lease4Ptr(new Lease4(**lease)));
}
return (collection);
}
Lease6Ptr
Memfile_LeaseMgr::getLease6(Lease::Type type,
const isc::asiolink::IOAddress& addr) const {
......
// Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -220,6 +220,18 @@ public:
virtual Lease4Ptr getLease4(const ClientId& clientid,
SubnetID subnet_id) const;
/// @brief Returns all IPv4 leases for the particular subnet identifier.
///
/// @param subnet_id subnet identifier.
///
/// @return Lease collection (may be empty if no IPv4 lease found).
virtual Lease4Collection getLeases4(SubnetID subnet_id) const;
/// @brief Returns all IPv4 leases.
///
/// @return Lease collection (may be empty if no IPv4 lease found).
virtual Lease4Collection getLeases4() const;
/// @brief Returns existing IPv6 lease for a given IPv6 address.
///
/// This function returns a copy of the lease. The modification in the
......
// Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -96,6 +96,12 @@ tagged_statements = { {
{MySqlLeaseMgr::DELETE_LEASE6_STATE_EXPIRED,
"DELETE FROM lease6 "
"WHERE state = ? AND expire < ?"},
{MySqlLeaseMgr::GET_LEASE4,
"SELECT address, hwaddr, client_id, "
"valid_lifetime, expire, subnet_id, "
"fqdn_fwd, fqdn_rev, hostname, "
"state "
"FROM lease4"},
{MySqlLeaseMgr::GET_LEASE4_ADDR,
"SELECT address, hwaddr, client_id, "
"valid_lifetime, expire, subnet_id, "
......@@ -131,6 +137,13 @@ tagged_statements = { {
"state "
"FROM lease4 "
"WHERE hwaddr = ? AND subnet_id = ?"},
{MySqlLeaseMgr::GET_LEASE4_SUBID,
"SELECT address, hwaddr, client_id, "
"valid_lifetime, expire, subnet_id, "
"fqdn_fwd, fqdn_rev, hostname, "
"state "
"FROM lease4 "
"WHERE subnet_id = ?"},
{MySqlLeaseMgr::GET_LEASE4_EXPIRE,
"SELECT address, hwaddr, client_id, "
"valid_lifetime, expire, subnet_id, "
......@@ -1492,9 +1505,13 @@ void MySqlLeaseMgr::getLeaseCollection(StatementIndex stindex,
LeaseCollection& result,
bool single) const {
// Bind the selection parameters to the statement
int status = mysql_stmt_bind_param(conn_.statements_[stindex], bind);
checkError(status, stindex, "unable to bind WHERE clause parameter");
int status;
if (bind) {
// Bind the selection parameters to the statement
int status = mysql_stmt_bind_param(conn_.statements_[stindex], bind);
checkError(status, stindex, "unable to bind WHERE clause parameter");
}
// Set up the MYSQL_BIND array for the data being returned and bind it to
// the statement.
......@@ -1735,6 +1752,36 @@ MySqlLeaseMgr::getLease4(const ClientId& clientid, SubnetID subnet_id) const {
return (result);
}
Lease4Collection
MySqlLeaseMgr::getLeases4(SubnetID subnet_id) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET_SUBID4)
.arg(subnet_id);
// Set up the WHERE clause value
MYSQL_BIND inbind[1];
memset(inbind, 0, sizeof(inbind));
// Subnet ID
inbind[0].buffer_type = MYSQL_TYPE_LONG;
inbind[0].buffer = reinterpret_cast<char*>(&subnet_id);
inbind[0].is_unsigned = MLM_TRUE;
// ... and get the data
Lease4Collection result;
getLeaseCollection(GET_LEASE4_SUBID, inbind, result);
return (result);
}
Lease4Collection
MySqlLeaseMgr::getLeases4() const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET4);
Lease4Collection result;
getLeaseCollection(GET_LEASE4, 0, result);
return (result);
}
Lease6Ptr
MySqlLeaseMgr::getLease6(Lease::Type lease_type,
......
// Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -193,6 +193,18 @@ public:
virtual Lease4Ptr getLease4(const ClientId& clientid,
SubnetID subnet_id) const;
/// @brief Returns all IPv4 leases for the particular subnet identifier.
///
/// @param subnet_id subnet identifier.
///
/// @return Lease collection (may be empty if no IPv4 lease found).
virtual Lease4Collection getLeases4(SubnetID subnet_id) const;
/// @brief Returns all IPv4 leases.
///
/// @return Lease collection (may be empty if no IPv4 lease found).
virtual Lease4Collection getLeases4() const;
/// @brief Returns existing IPv6 lease for a given IPv6 address.
///
/// For a given address, we assume that there will be only one lease.
......@@ -416,11 +428,13 @@ public:
DELETE_LEASE4_STATE_EXPIRED, // Delete expired lease4 in a given state
DELETE_LEASE6, // Delete from lease6 by address
DELETE_LEASE6_STATE_EXPIRED, // Delete expired lease6 in a given state
GET_LEASE4, // Get all IPv4 leases
GET_LEASE4_ADDR, // Get lease4 by address
GET_LEASE4_CLIENTID, // Get lease4 by client ID
GET_LEASE4_CLIENTID_SUBID, // Get lease4 by client ID & subnet ID
GET_LEASE4_HWADDR, // Get lease4 by HW address
GET_LEASE4_HWADDR_SUBID, // Get lease4 by HW address & subnet ID
GET_LEASE4_SUBID, // Get IPv4 leases by subnet ID
GET_LEASE4_EXPIRE, // Get lease4 by expiration.
GET_LEASE6_ADDR, // Get lease6 by address
GET_LEASE6_DUID_IAID, // Get lease6 by DUID and IAID
......
// Copyright (C) 2014-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -55,6 +55,14 @@ PgSqlTaggedStatement tagged_statements[] = {
"DELETE FROM lease6 "
"WHERE state = $1 AND expire < $2"},
// GET_LEASE4
{ 0, { OID_NONE },
"get_lease4",
"SELECT address, hwaddr, client_id, "
"valid_lifetime, extract(epoch from expire)::bigint, subnet_id, "
"fqdn_fwd, fqdn_rev, hostname, state "
"FROM lease4"},
// GET_LEASE4_ADDR
{ 1, { OID_INT8 },
"get_lease4_addr",
......@@ -100,6 +108,15 @@ PgSqlTaggedStatement tagged_statements[] = {
"FROM lease4 "
"WHERE hwaddr = $1 AND subnet_id = $2"},
// GET_LEASE4_SUBID
{ 1, { OID_INT8 },
"get_lease4_subid",
"SELECT address, hwaddr, client_id, "
"valid_lifetime, extract(epoch from expire)::bigint, subnet_id, "
"fqdn_fwd, fqdn_rev, hostname, state "
"FROM lease4 "
"WHERE subnet_id = $1"},
// GET_LEASE4_EXPIRE
{ 3, { OID_INT8, OID_TIMESTAMP, OID_INT8 },
"get_lease4_expire",
......@@ -892,11 +909,11 @@ void PgSqlLeaseMgr::getLeaseCollection(StatementIndex stindex,
Exchange& exchange,
LeaseCollection& result,
bool single) const {
PgSqlResult r(PQexecPrepared(conn_, tagged_statements[stindex].name,
tagged_statements[stindex].nbparams,
&bind_array.values_[0],
&bind_array.lengths_[0],
&bind_array.formats_[0], 0));
const int n = tagged_statements[stindex].nbparams;
PgSqlResult r(PQexecPrepared(conn_, tagged_statements[stindex].name, n,
n > 0 ? &bind_array.values_[0] : NULL,
n > 0 ? &bind_array.lengths_[0] : NULL,
n > 0 ? &bind_array.formats_[0] : NULL, 0));
conn_.checkStatementError(r, tagged_statements[stindex]);
......@@ -1072,6 +1089,38 @@ PgSqlLeaseMgr::getLease4(const ClientId&, const HWAddr&, SubnetID) const {
" called, but it is not implemented");
}
Lease4Collection
PgSqlLeaseMgr::getLeases4(SubnetID subnet_id) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_PGSQL_GET_SUBID4)
.arg(subnet_id);
// Set up the WHERE clause value
PsqlBindArray bind_array;
// SUBNET_ID
std::string subnet_id_str = boost::lexical_cast<std::string>(subnet_id);
bind_array.add(subnet_id_str);
// ... and get the data
Lease4Collection result;
getLeaseCollection(GET_LEASE4_SUBID, bind_array, result);
return (result);
}
Lease4Collection
PgSqlLeaseMgr::getLeases4() const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_PGSQL_GET4);
// Provide empty binding array because our query has no parameters in
// WHERE clause.
PsqlBindArray bind_array;
Lease4Collection result;
getLeaseCollection(GET_LEASE4, bind_array, result);
return (result);
}
Lease6Ptr
PgSqlLeaseMgr::getLease6(Lease::Type lease_type,
const isc::asiolink::IOAddress& addr) const {
......
// Copyright (C) 2013-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -161,6 +161,17 @@ public:
virtual Lease4Ptr getLease4(const ClientId& client_id, const HWAddr& hwaddr,
SubnetID subnet_id) const;
/// @brief Returns all IPv4 leases for the particular subnet identifier.
///
/// @param subnet_id subnet identifier.
///
/// @return Lease collection (may be empty if no IPv4 lease found).
virtual Lease4Collection getLeases4(SubnetID subnet_id) const;
/// @brief Returns all IPv4 leases.
///
/// @return Lease collection (may be empty if no IPv4 lease found).
virtual Lease4Collection getLeases4() const;
/// @brief Returns existing IPv4 lease for specified client-id
///
......@@ -408,11 +419,13 @@ public:
DELETE_LEASE4_STATE_EXPIRED,// Delete expired lease4s in certain state.
DELETE_LEASE6, // Delete from lease6 by address
DELETE_LEASE6_STATE_EXPIRED,// Delete expired lease6s in certain state.
GET_LEASE4, // Get all IPv4 leases
GET_LEASE4_ADDR, // Get lease4 by address
GET_LEASE4_CLIENTID, // Get lease4 by client ID
GET_LEASE4_CLIENTID_SUBID, // Get lease4 by client ID & subnet ID
GET_LEASE4_HWADDR, // Get lease4 by HW address
GET_LEASE4_HWADDR_SUBID, // Get lease4 by HW address & subnet ID
GET_LEASE4_SUBID, // Get IPv4 leases by subnet ID
GET_LEASE4_EXPIRE, // Get expired lease4
GET_LEASE6_ADDR, // Get lease6 by address
GET_LEASE6_DUID_IAID, // Get lease6 by DUID and IAID
......
// Copyright (C) 2014-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -1219,6 +1219,33 @@ GenericLeaseMgrTest::testGetLease4ClientIdSubnetId() {
EXPECT_FALSE(returned);
}
void
GenericLeaseMgrTest::testGetLeases4SubnetId() {
// Get the leases to be used for the test and add to the database.
vector<Lease4Ptr> leases = createLeases4();
for (size_t i = 0; i < leases.size(); ++i) {
EXPECT_TRUE(lmptr_->addLease(leases[i]));
}
// There should be exactly two leases for the subnet id that the second
// lease belongs to.
Lease4Collection returned = lmptr_->getLeases4(leases[1]->subnet_id_);
ASSERT_EQ(2, returned.size());
}
void
GenericLeaseMgrTest::testGetLeases4() {
// Get the leases to be used for the test and add to the database
vector<Lease4Ptr> leases = createLeases4();
for (size_t i = 0; i < leases.size(); ++i) {
EXPECT_TRUE(lmptr_->addLease(leases[i]));
}
// All leases should be returned.
Lease4Collection returned = lmptr_->getLeases4();
ASSERT_EQ(leases.size(), returned.size());
}
void
GenericLeaseMgrTest::testGetLeases6DuidIaid() {
// Get the leases to be used for the test.
......
// Copyright (C) 2014-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -200,6 +200,12 @@ public:
/// a combination of client and subnet IDs.
void testGetLease4ClientIdSubnetId();
/// @brief Test method which returns all IPv4 leases for Subnet ID.
void testGetLeases4SubnetId();
/// @brief Test method which returns all IPv4 leases.
void testGetLeases4();
/// @brief Basic Lease4 Checks
///
/// Checks that the addLease, getLease4(by address), getLease4(hwaddr,subnet_id),
......
// Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -129,6 +129,22 @@ public:
return (Lease4Ptr());
}
/// @brief Returns all IPv4 leases for the particular subnet identifier.
///
/// @param subnet_id subnet identifier.
///
/// @return Lease collection (may be empty if no IPv4 lease found).
virtual Lease4Collection getLeases4(SubnetID) const {
return (Lease4Collection());
}
/// @brief Returns all IPv4 leases.
///
/// @return Lease collection (may be empty if no IPv4 lease found).
virtual Lease4Collection getLeases4() const {
return (Lease4Collection());
}
/// @brief Returns existing IPv6 lease for a given IPv6 address.
///
/// @param addr address of the searched lease
......
// Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -917,6 +917,18 @@ TEST_F(MemfileLeaseMgrTest, getLease4ClientIdSubnetId) {
testGetLease4ClientIdSubnetId();
}
// This test checks that all IPv4 leases for a specified subnet id are returned.
TEST_F(MemfileLeaseMgrTest, getLeases4SubnetId) {
startBackend(V4);
testGetLeases4SubnetId();
}
// This test checks that all IPv4 leases are returned.
TEST_F(MemfileLeaseMgrTest, getLeases4) {
startBackend(V4);
testGetLeases4();
}
/// @brief Basic Lease6 Checks
///
/// Checks that the addLease, getLease6 (by address) and deleteLease (with an
......
// Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -321,6 +321,16 @@ TEST_F(MySqlLeaseMgrTest, getLease4ClientIdSubnetId) {
testGetLease4ClientIdSubnetId();
}
// This test checks that all IPv4 leases for a specified subnet id are returned.
TEST_F(MySqlLeaseMgrTest, getLeases4SubnetId) {
testGetLeases4SubnetId();
}
// This test checks that all IPv4 leases are returned.
TEST_F(MySqlLeaseMgrTest, getLeases4) {
testGetLeases4();
}
/// @brief Basic Lease4 Checks
///
/// Checks that the addLease, getLease4(by address), getLease4(hwaddr,subnet_id),
......