]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5651] Removed lease queries by ranges and total lease count.
authorMarcin Siodelski <marcin@isc.org>
Thu, 28 Jun 2018 12:02:32 +0000 (14:02 +0200)
committerMarcin Siodelski <marcin@isc.org>
Thu, 28 Jun 2018 12:02:32 +0000 (14:02 +0200)
18 files changed:
src/hooks/dhcp/lease_cmds/lease_cmds.cc
src/hooks/dhcp/lease_cmds/tests/lease_cmds_unittest.cc
src/lib/dhcpsrv/cql_lease_mgr.cc
src/lib/dhcpsrv/cql_lease_mgr.h
src/lib/dhcpsrv/lease_mgr.h
src/lib/dhcpsrv/memfile_lease_mgr.cc
src/lib/dhcpsrv/memfile_lease_mgr.h
src/lib/dhcpsrv/mysql_lease_mgr.cc
src/lib/dhcpsrv/mysql_lease_mgr.h
src/lib/dhcpsrv/pgsql_lease_mgr.cc
src/lib/dhcpsrv/pgsql_lease_mgr.h
src/lib/dhcpsrv/tests/cql_lease_mgr_unittest.cc
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h
src/lib/dhcpsrv/tests/lease_mgr_unittest.cc
src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc
src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc

index 955e75d6da739b77d0365347ca9e8c81974f8cfb..e1a1e9056a403cbf342e59bf3d589fb8e23683c2 100644 (file)
@@ -691,7 +691,6 @@ LeaseCmdsImpl::leaseGetPageHandler(CalloutHandle& handle) {
         // Put gathered data into arguments map.
         args->set("leases", leases_json);
         args->set("count", Element::create(static_cast<int64_t>(leases_json->size())));
-        args->set("total-count", Element::create(total_leases));
 
         // Create the response.
         ConstElementPtr response =
index 315a86f1e5e853864957d7129877879c0a31c8c3..bf9eb6c1039125aa5d105b18d57bf1062a5357c0 100644 (file)
@@ -1638,15 +1638,7 @@ TEST_F(LeaseCmdsTest, Lease4GetPaged) {
         ASSERT_TRUE(args);
         ASSERT_EQ(Element::map, args->getType());
 
-        // Each response must include total number of leases to allow the
-        // controlling client to track progress (e.g. percentage of leases
-        // already viewed).
-        ConstElementPtr total_count = args->get("total-count");
-        ASSERT_TRUE(total_count);
-        ASSERT_EQ(Element::integer, total_count->getType());
-        EXPECT_EQ(4, total_count->intValue());
-
-        // For convenience, we also return the number of returned leases,
+        // For convenience, we return the number of returned leases,
         // so as the client can check whether there was anything returned
         // before parsing the leases structure.
         ConstElementPtr page_count = args->get("count");
@@ -1981,15 +1973,7 @@ TEST_F(LeaseCmdsTest, Lease6GetPaged) {
         ASSERT_TRUE(args);
         ASSERT_EQ(Element::map, args->getType());
 
-        // Each response must include total number of leases to allow the
-        // controlling client to track progress (e.g. percentage of leases
-        // already viewed).
-        ConstElementPtr total_count = args->get("total-count");
-        ASSERT_TRUE(total_count);
-        ASSERT_EQ(Element::integer, total_count->getType());
-        EXPECT_EQ(4, total_count->intValue());
-
-        // For convenience, we also return the number of returned leases,
+        // For convenience, we return the number of returned leases,
         // so as the client can check whether there was anything returned
         // before parsing the leases structure.
         ConstElementPtr page_count = args->get("count");
index e1c995dce12ea01f54ea8720f053842ae544a8b5..ae29d44667a75aeb7cb719ac49fb0db7860c062d 100644 (file)
@@ -2192,42 +2192,6 @@ CqlLeaseMgr::getLeases4(const asiolink::IOAddress& lower_bound_address,
     return (result);
 }
 
-Lease4Collection
-CqlLeaseMgr::getLeases4(const IOAddress& lower_bound_address,
-                        const IOAddress& upper_bound_address) const {
-    // Expecting two IPv4 addresses.
-    if (!lower_bound_address.isV4() || !upper_bound_address.isV4()) {
-        isc_throw(InvalidAddressFamily, "expected two IPv4 addresses for "
-                  "retrieving a range of leases, got "
-                  << lower_bound_address << " and " << upper_bound_address);
-    }
-
-    if (upper_bound_address < lower_bound_address) {
-        isc_throw(InvalidRange, "upper bound address " << upper_bound_address
-                  << " is lower than lower bound address " << lower_bound_address);
-    }
-
-    LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_CQL_GET_ADDR_RANGE4)
-        .arg(lower_bound_address.toText())
-        .arg(upper_bound_address.toText());
-
-    // Set up the WHERE clause value
-    AnyArray data;
-
-    cass_int32_t lb_address_data = static_cast<cass_int32_t>(lower_bound_address.toUint32());
-    data.add(&lb_address_data);
-
-    cass_int32_t ub_address_data = static_cast<cass_int32_t>(upper_bound_address.toUint32());
-    data.add(&ub_address_data);
-
-    // Get the data.
-    Lease4Collection result;
-    std::unique_ptr<CqlLease4Exchange> exchange4(new CqlLease4Exchange(dbconn_));
-    exchange4->getLeaseCollection(CqlLease4Exchange::GET_LEASE4_RANGE, data, result);
-
-    return (result);
-}
-
 Lease6Ptr
 CqlLeaseMgr::getLease6(Lease::Type lease_type, const IOAddress &addr) const {
     std::string addr_data = addr.toText();
@@ -2380,13 +2344,6 @@ CqlLeaseMgr::getLeases6(const asiolink::IOAddress& lower_bound_address,
     return (result);
 }
 
-Lease6Collection
-CqlLeaseMgr::getLeases6(const asiolink::IOAddress& lower_bound_address,
-                        const asiolink::IOAddress& upper_bound_address) const {
-    isc_throw(NotImplemented, "getLeases6(lower_bound_address, upper_bound_address) "
-              "is not implemented");
-}
-
 void
 CqlLeaseMgr::getExpiredLeases4(Lease4Collection &expired_leases,
                                const size_t max_leases) const {
index c47708a61dce8788a8452f60d65c7696e5c77a73..39382b2f4efaaced27a8ada18270916d4413b55b 100644 (file)
@@ -243,20 +243,6 @@ public:
     getLeases4(const asiolink::IOAddress& lower_bound_address,
                const LeasePageSize& page_size) const override;
 
-    /// @brief Returns a range of IPv4 leases.
-    ///
-    /// @param lower_bound_address IPv4 address used as a lower bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    /// @param upper_bound_address IPv4 address used as an upper bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    ///
-    /// @return Lease collection (may be empty if no IPv4 lease found).
-    virtual Lease4Collection
-    getLeases4(const asiolink::IOAddress& lower_bound_address,
-               const asiolink::IOAddress& upper_bound_address) const override;
-
     /// @brief Returns existing IPv6 lease for a given IPv6 address.
     ///
     /// For a given address, we assume that there will be only one lease.
@@ -367,20 +353,6 @@ public:
     getLeases6(const asiolink::IOAddress& lower_bound_address,
                const LeasePageSize& page_size) const override;
 
-    /// @brief Returns a range of IPv6 leases.
-    ///
-    /// @param lower_bound_address IPv6 address used as a lower bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    /// @param upper_bound_address IPv6 address used as an upper bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    ///
-    /// @return Lease collection (may be empty if no IPv6 lease found).
-    virtual Lease6Collection
-    getLeases6(const asiolink::IOAddress& lower_bound_address,
-               const asiolink::IOAddress& upper_bound_address) const override;
-
     /// @brief Returns a collection of expired DHCPv4 leases.
     ///
     /// This method returns at most @c max_leases expired leases. The leases
index 81e2dc93a9fe666657e5f5823c7b3729319186d1..852e5b2da8cd6d9b1fcb528b1e11ef035e36b697 100644 (file)
@@ -392,20 +392,6 @@ public:
     getLeases4(const asiolink::IOAddress& lower_bound_address,
                const LeasePageSize& page_size) const = 0;
 
-    /// @brief Returns a range of IPv4 leases.
-    ///
-    /// @param lower_bound_address IPv4 address used as a lower bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    /// @param upper_bound_address IPv4 address used as an upper bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    ///
-    /// @return Lease collection (may be empty if no IPv4 lease found).
-    virtual Lease4Collection
-    getLeases4(const asiolink::IOAddress& lower_bound_address,
-               const asiolink::IOAddress& upper_bound_address) 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.
@@ -514,20 +500,6 @@ public:
     getLeases6(const asiolink::IOAddress& lower_bound_address,
                const LeasePageSize& page_size) const = 0;
 
-    /// @brief Returns a range of IPv6 leases.
-    ///
-    /// @param lower_bound_address IPv6 address used as a lower bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    /// @param upper_bound_address IPv6 address used as an upper bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    ///
-    /// @return Lease collection (may be empty if no IPv6 lease found).
-    virtual Lease6Collection
-    getLeases6(const asiolink::IOAddress& lower_bound_address,
-               const asiolink::IOAddress& upper_bound_address) const = 0;
-
     /// @brief Returns a collection of expired DHCPv4 leases.
     ///
     /// This method returns at most @c max_leases expired leases. The leases
index 4541b59aaeb43999856d234d8cbb243f15cf7aba..a4b4a1114c3417029aeb8cdbf263416332073ad7 100644 (file)
@@ -917,40 +917,6 @@ Memfile_LeaseMgr::getLeases4(const asiolink::IOAddress& lower_bound_address,
     return (collection);
 }
 
-Lease4Collection
-Memfile_LeaseMgr::getLeases4(const IOAddress& lower_bound_address,
-                             const IOAddress& upper_bound_address) const {
-    // Expecting two IPv4 addresses.
-    if (!lower_bound_address.isV4() || !upper_bound_address.isV4()) {
-        isc_throw(InvalidAddressFamily, "expected two IPv4 addresses for "
-                  "retrieving a range of leases, got "
-                  << lower_bound_address << " and " << upper_bound_address);
-    }
-
-    // Check if the range boundaries aren't swapped.
-    if (upper_bound_address < lower_bound_address) {
-        isc_throw(InvalidRange, "upper bound address " << upper_bound_address
-                  << " is lower than lower bound address " << lower_bound_address);
-    }
-
-    LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MEMFILE_GET_ADDR_RANGE4)
-        .arg(lower_bound_address.toText())
-        .arg(upper_bound_address.toText());
-
-    Lease4Collection collection;
-    const Lease4StorageAddressIndex& idx = storage4_.get<AddressIndexTag>();
-    std::pair<Lease4StorageAddressIndex::const_iterator,
-              Lease4StorageAddressIndex::const_iterator> l =
-        std::make_pair(idx.lower_bound(lower_bound_address),
-                       idx.upper_bound(upper_bound_address));
-
-    for (auto lease = l.first; lease != l.second; ++lease) {
-        collection.push_back(Lease4Ptr(new Lease4(**lease)));
-    }
-
-    return (collection);
-}
-
 Lease6Ptr
 Memfile_LeaseMgr::getLease6(Lease::Type type,
                             const isc::asiolink::IOAddress& addr) const {
@@ -1082,40 +1048,6 @@ Memfile_LeaseMgr::getLeases6(const asiolink::IOAddress& lower_bound_address,
     return (collection);
 }
 
-Lease6Collection
-Memfile_LeaseMgr::getLeases6(const asiolink::IOAddress& lower_bound_address,
-                             const asiolink::IOAddress& upper_bound_address) const {
-    // Expecting two IPv6 addresses.
-    if (!lower_bound_address.isV6() || !upper_bound_address.isV6()) {
-        isc_throw(InvalidAddressFamily, "expected two IPv6 addresses for "
-                  "retrieving a range of leases, got "
-                  << lower_bound_address << " and " << upper_bound_address);
-    }
-
-    // Check if the range boundaries aren't swapped.
-    if (upper_bound_address < lower_bound_address) {
-        isc_throw(InvalidRange, "upper bound address " << upper_bound_address
-                  << " is lower than lower bound address " << lower_bound_address);
-    }
-
-    LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MEMFILE_GET_ADDR_RANGE6)
-        .arg(lower_bound_address.toText())
-        .arg(upper_bound_address.toText());
-
-    Lease6Collection collection;
-    const Lease6StorageAddressIndex& idx = storage6_.get<AddressIndexTag>();
-    std::pair<Lease6StorageAddressIndex::const_iterator,
-              Lease6StorageAddressIndex::const_iterator> l =
-        std::make_pair(idx.lower_bound(lower_bound_address),
-                       idx.upper_bound(upper_bound_address));
-
-    for (auto lease = l.first; lease != l.second; ++lease) {
-        collection.push_back(Lease6Ptr(new Lease6(**lease)));
-    }
-
-    return (collection);
-}
-
 void
 Memfile_LeaseMgr::getExpiredLeases4(Lease4Collection& expired_leases,
                                     const size_t max_leases) const {
index b9fce8e79938b49f8c72bfea2f44d5836d51d6ea..8d77df4788bba3488a1268c6f62ea0670760855d 100644 (file)
@@ -260,20 +260,6 @@ public:
     getLeases4(const asiolink::IOAddress& lower_bound_address,
                const LeasePageSize& page_size) const;
 
-    /// @brief Returns a range of IPv4 leases.
-    ///
-    /// @param lower_bound_address IPv4 address used as a lower bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    /// @param upper_bound_address IPv4 address used as an upper bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    ///
-    /// @return Lease collection (may be empty if no IPv4 lease found).
-    virtual Lease4Collection
-    getLeases4(const asiolink::IOAddress& lower_bound_address,
-               const asiolink::IOAddress& upper_bound_address) const;
-
     /// @brief Returns existing IPv6 lease for a given IPv6 address.
     ///
     /// This function returns a copy of the lease. The modification in the
@@ -353,20 +339,6 @@ public:
     getLeases6(const asiolink::IOAddress& lower_bound_address,
                const LeasePageSize& page_size) const;
 
-    /// @brief Returns a range of IPv6 leases.
-    ///
-    /// @param lower_bound_address IPv6 address used as a lower bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    /// @param upper_bound_address IPv6 address used as an upper bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    ///
-    /// @return Lease collection (may be empty if no IPv6 lease found).
-    virtual Lease6Collection
-    getLeases6(const asiolink::IOAddress& lower_bound_address,
-               const asiolink::IOAddress& upper_bound_address) const;
-
     /// @brief Returns a collection of expired DHCPv4 leases.
     ///
     /// This method returns at most @c max_leases expired leases. The leases
index b437856a7b78f0adafa606982685d382224055b8..c52cf94acbc8836736d4b7a0a818279ee05fd83f 100644 (file)
@@ -1977,48 +1977,6 @@ MySqlLeaseMgr::getLeases4(const asiolink::IOAddress& lower_bound_address,
     return (result);
 }
 
-Lease4Collection
-MySqlLeaseMgr::getLeases4(const IOAddress& lower_bound_address,
-                          const IOAddress& upper_bound_address) const {
-    // Expecting two IPv4 addresses.
-    if (!lower_bound_address.isV4() || !upper_bound_address.isV4()) {
-        isc_throw(InvalidAddressFamily, "expected two IPv4 addresses for "
-                  "retrieving a range of leases, got "
-                  << lower_bound_address << " and " << upper_bound_address);
-    }
-
-    if (upper_bound_address < lower_bound_address) {
-        isc_throw(InvalidRange, "upper bound address " << upper_bound_address
-                  << " is lower than lower bound address " << lower_bound_address);
-    }
-
-    LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET_ADDR_RANGE4)
-        .arg(lower_bound_address.toText())
-        .arg(upper_bound_address.toText());
-
-    // Prepare WHERE clause
-    MYSQL_BIND inbind[2];
-    memset(inbind, 0, sizeof(inbind));
-
-    // Bind lower bound address as uint32 value
-    uint32_t lb_address_data = lower_bound_address.toUint32();
-    inbind[0].buffer_type = MYSQL_TYPE_LONG;
-    inbind[0].buffer = reinterpret_cast<char*>(&lb_address_data);
-    inbind[0].is_unsigned = MLM_TRUE;
-
-    // Bind upper bound address as uint32 value
-    uint32_t ub_address_data = upper_bound_address.toUint32();
-    inbind[1].buffer_type = MYSQL_TYPE_LONG;
-    inbind[1].buffer = reinterpret_cast<char*>(&ub_address_data);
-    inbind[1].is_unsigned = MLM_TRUE;
-
-    // Get the leases
-    Lease4Collection result;
-    getLeaseCollection(GET_LEASE4_RANGE, inbind, result);
-
-    return (result);
-}
-
 Lease6Ptr
 MySqlLeaseMgr::getLease6(Lease::Type lease_type,
                          const isc::asiolink::IOAddress& addr) const {
@@ -2221,52 +2179,6 @@ MySqlLeaseMgr::getLeases6(const asiolink::IOAddress& lower_bound_address,
     return (result);
 }
 
-Lease6Collection
-MySqlLeaseMgr::getLeases6(const IOAddress& lower_bound_address,
-                          const IOAddress& upper_bound_address) const {
-    // Expecting two IPv6 addresses.
-    if (!lower_bound_address.isV6() || !upper_bound_address.isV6()) {
-        isc_throw(InvalidAddressFamily, "expected two IPv6 addresses for "
-                  "retrieving a range of leases, got "
-                  << lower_bound_address << " and " << upper_bound_address);
-    }
-
-    if (upper_bound_address < lower_bound_address) {
-        isc_throw(InvalidRange, "upper bound address " << upper_bound_address
-                  << " is lower than lower bound address " << lower_bound_address);
-    }
-
-    LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET_ADDR_RANGE6)
-        .arg(lower_bound_address.toText())
-        .arg(upper_bound_address.toText());
-
-    // Prepare WHERE clause
-    MYSQL_BIND inbind[2];
-    memset(inbind, 0, sizeof(inbind));
-
-    // Bind lower bound address
-    std::string lb_address_data = lower_bound_address.toText();
-    unsigned long lb_address_data_size = lb_address_data.size();
-    inbind[0].buffer_type = MYSQL_TYPE_STRING;
-    inbind[0].buffer = const_cast<char*>(lb_address_data.c_str());
-    inbind[0].buffer_length = lb_address_data_size;
-    inbind[0].length = &lb_address_data_size;
-
-    // Bind upper bound address
-    std::string ub_address_data = upper_bound_address.toText();
-    unsigned long ub_address_data_size = ub_address_data.size();
-    inbind[1].buffer_type = MYSQL_TYPE_STRING;
-    inbind[1].buffer = const_cast<char*>(ub_address_data.c_str());
-    inbind[1].buffer_length = ub_address_data_size;
-    inbind[1].length = &ub_address_data_size;
-
-    // Get the leases
-    Lease6Collection result;
-    getLeaseCollection(GET_LEASE6_RANGE, inbind, result);
-
-    return (result);
-}
-
 void
 MySqlLeaseMgr::getExpiredLeases4(Lease4Collection& expired_leases,
                                  const size_t max_leases) const {
index b8f5555db321a6a9a83ad32814af837feca96edc..bb1a7738a9ce043756e14929f44e7a30dfea69d0 100644 (file)
@@ -234,20 +234,6 @@ public:
     getLeases4(const asiolink::IOAddress& lower_bound_address,
                const LeasePageSize& page_size) const;
 
-    /// @brief Returns a range of IPv4 leases.
-    ///
-    /// @param lower_bound_address IPv4 address used as a lower bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    /// @param upper_bound_address IPv4 address used as an upper bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    ///
-    /// @return Lease collection (may be empty if no IPv4 lease found).
-    virtual Lease4Collection
-    getLeases4(const asiolink::IOAddress& lower_bound_address,
-               const asiolink::IOAddress& upper_bound_address) const;
-
     /// @brief Returns existing IPv6 lease for a given IPv6 address.
     ///
     /// For a given address, we assume that there will be only one lease.
@@ -351,20 +337,6 @@ public:
     getLeases6(const asiolink::IOAddress& lower_bound_address,
                const LeasePageSize& page_size) const;
 
-    /// @brief Returns a range of IPv6 leases.
-    ///
-    /// @param lower_bound_address IPv6 address used as a lower bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    /// @param upper_bound_address IPv6 address used as an upper bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    ///
-    /// @return Lease collection (may be empty if no IPv6 lease found).
-    virtual Lease6Collection
-    getLeases6(const asiolink::IOAddress& lower_bound_address,
-               const asiolink::IOAddress& upper_bound_address) const;
-
     /// @brief Returns a collection of expired DHCPv4 leases.
     ///
     /// This method returns at most @c max_leases expired leases. The leases
index 8676c0185fec58e596232e8c5d21de5dea314188..561a2e71871f6c784f32b750bd6ebd7a54b3abcb 100644 (file)
@@ -1374,45 +1374,6 @@ PgSqlLeaseMgr::getLeases4(const asiolink::IOAddress& lower_bound_address,
     return (result);
 }
 
-Lease4Collection
-PgSqlLeaseMgr::getLeases4(const IOAddress& lower_bound_address,
-                          const IOAddress& upper_bound_address) const {
-    // Expecting two IPv4 addresses.
-    if (!lower_bound_address.isV4() || !upper_bound_address.isV4()) {
-        isc_throw(InvalidAddressFamily, "expected two IPv4 addresses for "
-                  "retrieving a range of leases, got "
-                  << lower_bound_address << " and " << upper_bound_address);
-    }
-
-    if (upper_bound_address < lower_bound_address) {
-        isc_throw(InvalidRange, "upper bound address " << upper_bound_address
-                  << " is lower than lower bound address " << lower_bound_address);
-    }
-
-    LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_PGSQL_GET_ADDR_RANGE4)
-        .arg(lower_bound_address.toText())
-        .arg(upper_bound_address.toText());
-
-    // Prepare WHERE clause
-    PsqlBindArray bind_array;
-
-    // Bind lower bound address
-    std::string lb_address_data = boost::lexical_cast<std::string>
-        (lower_bound_address.toUint32());
-    bind_array.add(lb_address_data);
-
-    // Bind upper bound address
-    std::string ub_address_data = boost::lexical_cast<std::string>
-        (upper_bound_address.toUint32());
-    bind_array.add(ub_address_data);
-
-    // Get the leases
-    Lease4Collection result;
-    getLeaseCollection(GET_LEASE4_RANGE, bind_array, result);
-
-    return (result);
-}
-
 Lease6Ptr
 PgSqlLeaseMgr::getLease6(Lease::Type lease_type,
                          const isc::asiolink::IOAddress& addr) const {
@@ -1531,7 +1492,7 @@ PgSqlLeaseMgr::getLeases6() const {
 
 Lease6Collection
 PgSqlLeaseMgr::getLeases6(const asiolink::IOAddress& lower_bound_address,
-                             const LeasePageSize& page_size) const {
+                          const LeasePageSize& page_size) const {
     // Expecting IPv6 address.
     if (!lower_bound_address.isV6()) {
         isc_throw(InvalidAddressFamily, "expected IPv6 address while "
@@ -1568,41 +1529,6 @@ PgSqlLeaseMgr::getLeases6(const asiolink::IOAddress& lower_bound_address,
     return (result);
 }
 
-Lease6Collection
-PgSqlLeaseMgr::getLeases6(const asiolink::IOAddress& lower_bound_address,
-                          const asiolink::IOAddress& upper_bound_address) const {
-    // Expecting two IPv6 addresses.
-    if (!lower_bound_address.isV6() || !upper_bound_address.isV6()) {
-        isc_throw(InvalidAddressFamily, "expected two IPv6 addresses for "
-                  "retrieving a range of leases, got "
-                  << lower_bound_address << " and " << upper_bound_address);
-    }
-
-    if (upper_bound_address < lower_bound_address) {
-        isc_throw(InvalidRange, "upper bound address " << upper_bound_address
-                  << " is lower than lower bound address " << lower_bound_address);
-    }
-
-    LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_PGSQL_GET_ADDR_RANGE6)
-        .arg(lower_bound_address.toText())
-        .arg(upper_bound_address.toText());
-
-    // Prepare WHERE clause
-    PsqlBindArray bind_array;
-
-    std::string lb_address_data = lower_bound_address.toText();
-    bind_array.add(lb_address_data);
-
-    std::string ub_address_data = upper_bound_address.toText();
-    bind_array.add(ub_address_data);
-
-    // Get the leases
-    Lease6Collection result;
-    getLeaseCollection(GET_LEASE6_RANGE, bind_array, result);
-
-    return (result);
-}
-
 void
 PgSqlLeaseMgr::getExpiredLeases4(Lease4Collection& expired_leases,
                                  const size_t max_leases) const {
index 84ab7a6382b49e1f1d9c1db84b838ead1f4c408d..9df8cf9c00658cf4dec64079bb2679a9cee18d41 100644 (file)
@@ -215,20 +215,6 @@ public:
     getLeases4(const asiolink::IOAddress& lower_bound_address,
                const LeasePageSize& page_size) const;
 
-    /// @brief Returns a range of IPv4 leases.
-    ///
-    /// @param lower_bound_address IPv4 address used as a lower bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    /// @param upper_bound_address IPv4 address used as an upper bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    ///
-    /// @return Lease collection (may be empty if no IPv4 lease found).
-    virtual Lease4Collection
-    getLeases4(const asiolink::IOAddress& lower_bound_address,
-               const asiolink::IOAddress& upper_bound_address) const;
-
     /// @brief Returns existing IPv6 lease for a given IPv6 address.
     ///
     /// For a given address, we assume that there will be only one lease.
@@ -323,20 +309,6 @@ public:
     getLeases6(const asiolink::IOAddress& lower_bound_address,
                const LeasePageSize& page_size) const;
 
-    /// @brief Returns a range of IPv6 leases.
-    ///
-    /// @param lower_bound_address IPv6 address used as a lower bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    /// @param upper_bound_address IPv6 address used as an upper bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    ///
-    /// @return Lease collection (may be empty if no IPv6 lease found).
-    virtual Lease6Collection
-    getLeases6(const asiolink::IOAddress& lower_bound_address,
-               const asiolink::IOAddress& upper_bound_address) const;
-
     /// @brief Returns a collection of expired DHCPv4 leases.
     ///
     /// This method returns at most @c max_leases expired leases. The leases
index ba95b0b7c2dce0c181864d03f7c894a93c7d44cd..dca9146727b6f6e89ade46981ccc12dbc7e7b4cb 100644 (file)
@@ -592,11 +592,6 @@ TEST_F(CqlLeaseMgrTest, getLeases4Paged) {
     testGetLeases4Paged();
 }
 
-// Test that a range of IPv4 leases is returmed.
-TEST_F(CqlLeaseMgrTest, getLeases4Range) {
-    testGetLeases4Range();
-}
-
 /// @brief Basic Lease4 Checks
 ///
 /// Checks that the addLease, getLease4(by address), getLease4(hwaddr,subnet_id),
index 289da233b2829df78f7d5b4c70cb318719b7f1d2..2fb01f6218b08080641d9a42084895eea214f5ff 100644 (file)
@@ -1311,51 +1311,6 @@ GenericLeaseMgrTest::testGetLeases4Paged() {
                  InvalidAddressFamily);
 }
 
-void
-GenericLeaseMgrTest::testGetLeases4Range() {
-    // 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 addresses in the specified range should be returned.
-    Lease4Collection returned = lmptr_->getLeases4(IOAddress("192.0.2.2"),
-                                                   IOAddress("192.0.2.6"));
-    EXPECT_EQ(5, returned.size());
-
-    // The lower bound address is below the range, so the first two addresses
-    // in the database should be returned.
-    returned = lmptr_->getLeases4(IOAddress("192.0.1.0"), IOAddress("192.0.2.1"));
-    EXPECT_EQ(2, returned.size());
-
-    // The lower bound address is the last address in the database, so only this
-    // address should be returned.
-    returned = lmptr_->getLeases4(IOAddress("192.0.2.7"), IOAddress("192.0.2.15"));
-    EXPECT_EQ(1, returned.size());
-
-    // The lower bound is below the range and the upper bound is above the range,
-    // so the whole range should be returned.
-    returned = lmptr_->getLeases4(IOAddress("192.0.1.7"), IOAddress("192.0.2.15"));
-    EXPECT_EQ(8, returned.size());
-
-    // No addresses should be returned because our desired range does not
-    // overlap with leases in the database.
-    returned = lmptr_->getLeases4(IOAddress("192.0.2.8"), IOAddress("192.0.2.15"));
-    EXPECT_TRUE(returned.empty());
-
-    // Swapping the lower bound and upper bound should cause an error.
-    EXPECT_THROW(lmptr_->getLeases4(IOAddress("192.0.2.8"), IOAddress("192.0.2.1")),
-                 InvalidRange);
-
-    // Both must be IPv4 addresses.
-    EXPECT_THROW(lmptr_->getLeases4(IOAddress("192.0.2.3"), IOAddress("2001:db8::8")),
-                 InvalidAddressFamily);
-
-    EXPECT_THROW(lmptr_->getLeases4(IOAddress("2001:db8::2"), IOAddress("192.0.2.7")),
-                 InvalidAddressFamily);
-}
-
 void
 GenericLeaseMgrTest::testGetLeases6SubnetId() {
     // Get the leases to be used for the test and add to the database.
@@ -1437,51 +1392,6 @@ GenericLeaseMgrTest::testGetLeases6Paged() {
                  
 }
 
-void
-GenericLeaseMgrTest::testGetLeases6Range() {
-    // Get the leases to be used for the test and add to the database.
-    vector<Lease6Ptr> leases = createLeases6();
-    for (size_t i = 0; i < leases.size(); ++i) {
-        EXPECT_TRUE(lmptr_->addLease(leases[i]));
-    }
-
-    // All addresses in the specified range should be returned.
-    Lease6Collection returned = lmptr_->getLeases6(IOAddress("2001:db8::2"),
-                                                   IOAddress("2001:db8::6"));
-    EXPECT_EQ(5, returned.size());
-
-    // The lower bound address is below the range, so the first two addresses
-    // in the database should be returned.
-    returned = lmptr_->getLeases6(IOAddress("2001::"), IOAddress("2001:db8::1"));
-    EXPECT_EQ(2, returned.size());
-
-    // The lower bound address is the last address in the database, so only this
-    // address should be returned.
-    returned = lmptr_->getLeases6(IOAddress("2001:db8::7"), IOAddress("2001:db8::15"));
-    EXPECT_EQ(1, returned.size());
-
-    // The lower bound is below the range and the upper bound is above the range,
-    // so the whole range should be returned.
-    returned = lmptr_->getLeases6(IOAddress("2001::"), IOAddress("2001:db8::15"));
-    EXPECT_EQ(8, returned.size());
-
-    // No addresses should be returned because our desired range does not
-    // overlap with leases in the database.
-    returned = lmptr_->getLeases6(IOAddress("2001:db8::8"), IOAddress("2001:db8::15"));
-    EXPECT_TRUE(returned.empty());
-
-    // Swapping the lower bound and upper bound should cause an error.
-    EXPECT_THROW(lmptr_->getLeases6(IOAddress("2001:db8::8"), IOAddress("2001:db8::1")),
-                 InvalidRange);
-
-    // Both must be IPv6 addresses.
-    EXPECT_THROW(lmptr_->getLeases6(IOAddress("192.0.2.3"), IOAddress("2001:db8::8")),
-                 InvalidAddressFamily);
-
-    EXPECT_THROW(lmptr_->getLeases6(IOAddress("2001:db8::2"), IOAddress("192.0.2.7")),
-                 InvalidAddressFamily);
-}
-
 void
 GenericLeaseMgrTest::testGetLeases6DuidIaid() {
     // Get the leases to be used for the test.
index 34de9f1abd20cb32bb17d0487d80f38ce226865d..77ef96dd7095f2ee62f6568bb1e28bfc64a17de9 100644 (file)
@@ -206,9 +206,6 @@ public:
     /// @brief Test method which returns range of IPv4 leases with paging.
     void testGetLeases4Paged();
 
-    /// @brief Test method which returns range of IPv4 leases.
-    void testGetLeases4Range();
-
     /// @brief Test method which returns all IPv6 leases for Subnet ID.
     void testGetLeases6SubnetId();
 
@@ -218,9 +215,6 @@ public:
     /// @brief Test method which returns range of IPv6 leases with paging.
     void testGetLeases6Paged();
 
-    /// @brief Test method which returns range of IPv6 leases.
-    void testGetLeases6Range();
-
     /// @brief Basic Lease4 Checks
     ///
     /// Checks that the addLease, getLease4(by address), getLease4(hwaddr,subnet_id),
index 8ded197f5f8de043dc334c74fe12ad4a167f8eb3..d32379fe8dd2e0a3c538ed8788ce723ef5b65075 100644 (file)
@@ -175,24 +175,6 @@ public:
         return (Lease4Collection());
     }
 
-    /// @brief Returns a range of IPv4 leases.
-    ///
-    /// Returned leases are ordered by IPv4 addresses.
-    ///
-    /// @param lower_bound_address IPv4 address used as a lower bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    /// @param upper_bound_address IPv4 address used as an upper bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    ///
-    /// @return Lease collection (may be empty if no IPv4 lease found).
-    virtual Lease4Collection
-    getLeases4(const asiolink::IOAddress& /* lower_bound_address */,
-               const asiolink::IOAddress& /* upper_bound_address */) const {
-        return (Lease4Collection());
-    }
-
     /// @brief Returns existing IPv6 lease for a given IPv6 address.
     ///
     /// @param addr address of the searched lease
@@ -242,22 +224,6 @@ public:
         return (Lease6Collection());
     }
 
-    /// @brief Returns a range of IPv6 leases.
-    ///
-    /// @param lower_bound_address IPv6 address used as a lower bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    /// @param upper_bound_address IPv6 address used as an upper bound for the
-    /// returned range. The lease for this address is included in the returned
-    /// range if the lease exists.
-    ///
-    /// @return Lease collection (may be empty if no IPv6 lease found).
-    virtual Lease6Collection
-    getLeases6(const asiolink::IOAddress& /* lower_bound_address */,
-               const asiolink::IOAddress& /* upper_bound_address */) const {
-        return (Lease6Collection());
-    }
-
     /// @brief Returns range of IPv6 leases using paging.
     ///
     /// This method implements paged browsing of the lease database. The first
index 26f157b866c293c4bb4f1b67473f290e8e795c64..417feca8e3a32644823e10540c969a741fd9f44a 100644 (file)
@@ -936,12 +936,6 @@ TEST_F(MemfileLeaseMgrTest, getLeases4Paged) {
     testGetLeases4Paged();
 }
 
-// Test that a range of IPv4 leases is returmed.
-TEST_F(MemfileLeaseMgrTest, getLeases4Range) {
-    startBackend(V4);
-    testGetLeases4Range();
-}
-
 // This test checks that all IPv6 leases for a specified subnet id are returned.
 TEST_F(MemfileLeaseMgrTest, getLeases6SubnetId) {
     startBackend(V6);
@@ -960,12 +954,6 @@ TEST_F(MemfileLeaseMgrTest, getLeases6Paged) {
     testGetLeases6Paged();
 }
 
-// Test that a range of IPv6 leases is returmed.
-TEST_F(MemfileLeaseMgrTest, getLeases6Range) {
-    startBackend(V6);
-    testGetLeases6Range();
-}
-
 /// @brief Basic Lease6 Checks
 ///
 /// Checks that the addLease, getLease6 (by address) and deleteLease (with an
index 5f92bac4f77f907584c1d8b18669a5ad554b142b..35aeaaaffc80245e8866b410c937267d000b2d9e 100644 (file)
@@ -360,11 +360,6 @@ TEST_F(MySqlLeaseMgrTest, getLeases4Paged) {
     testGetLeases4Paged();
 }
 
-// Test that a range of IPv4 leases is returmed.
-TEST_F(MySqlLeaseMgrTest, getLeases4Range) {
-    testGetLeases4Range();
-}
-
 // This test checks that all IPv6 leases for a specified subnet id are returned.
 TEST_F(MySqlLeaseMgrTest, getLeases6SubnetId) {
     testGetLeases6SubnetId();
@@ -380,11 +375,6 @@ TEST_F(MySqlLeaseMgrTest, getLeases6Paged) {
     testGetLeases6Paged();
 }
 
-// Test that a range of IPv6 leases is returmed.
-TEST_F(MySqlLeaseMgrTest, getLeases6Range) {
-    testGetLeases6Range();
-}
-
 /// @brief Basic Lease4 Checks
 ///
 /// Checks that the addLease, getLease4(by address), getLease4(hwaddr,subnet_id),
index 62334514d2273b942b6c71ce9c31a0195d1419be..e288e96ea10fa2e03718171a323f1d372ea51e65 100644 (file)
@@ -349,11 +349,6 @@ TEST_F(PgSqlLeaseMgrTest, getLeases4Paged) {
     testGetLeases4Paged();
 }
 
-// Test that a range of IPv4 leases is returmed.
-TEST_F(PgSqlLeaseMgrTest, getLeases4Range) {
-    testGetLeases4Range();
-}
-
 // This test checks that all IPv6 leases for a specified subnet id are returned.
 TEST_F(PgSqlLeaseMgrTest, getLeases6SubnetId) {
     testGetLeases6SubnetId();
@@ -369,11 +364,6 @@ TEST_F(PgSqlLeaseMgrTest, getLeases6Paged) {
     testGetLeases6Paged();
 }
 
-// Test that a range of IPv6 leases is returmed.
-TEST_F(PgSqlLeaseMgrTest, getLeases6Range) {
-    testGetLeases6Range();
-}
-
 /// @brief Basic Lease4 Checks
 ///
 /// Checks that the addLease, getLease4(by address), getLease4(hwaddr,subnet_id),