]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5280] leaseWipe4,6 implemented in lease managers (base and memfile)
authorTomek Mrugalski <tomasz@isc.org>
Fri, 4 Aug 2017 19:00:11 +0000 (21:00 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Mon, 7 Aug 2017 16:25:27 +0000 (18:25 +0200)
18 files changed:
src/lib/dhcpsrv/cql_lease_mgr.cc
src/lib/dhcpsrv/cql_lease_mgr.h
src/lib/dhcpsrv/dhcpsrv_messages.mes
src/lib/dhcpsrv/lease_mgr.h
src/lib/dhcpsrv/memfile_lease_mgr.cc
src/lib/dhcpsrv/memfile_lease_mgr.h
src/lib/dhcpsrv/memfile_lease_storage.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 f7486c6054cfead2769a0502f00026332f3d86d4..c3030f1b04ca7341f1730b11404bf980c5aa8703 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2015 - 2016 Deutsche Telekom AG.
+// Copyright (C) 2015 - 2017 Deutsche Telekom AG.
 //
 // Author: Razvan Becheriu <razvan.becheriu@qualitance.com>
 //
@@ -1885,6 +1885,16 @@ CqlLeaseMgr::deleteExpiredReclaimedLeasesCommon(const uint32_t secs,
     return (result);
 }
 
+size_t
+CqlLeaseMgr::wipeLeases4(const SubnetID& /*subnet_id*/) {
+    isc_throw(NotImplemented, "wipeLeases4 is not implemented for Cassandra backend");
+}
+
+size_t
+CqlLeaseMgr::wipeLeases6(const SubnetID& /*subnet_id*/) {
+    isc_throw(NotImplemented, "wipeLeases6 is not implemented for Cassandra backend");
+}
+
 std::string
 CqlLeaseMgr::getName() const {
     std::string name = "";
index 2da7a46ec84a58cabcb6985096dad84d22c093a2..bff24148a43268664a249dc6688b9169ba1ac75f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2015 - 2016 Deutsche Telekom AG.
+// Copyright (C) 2015 - 2017 Deutsche Telekom AG.
 //
 // Author: Razvan Becheriu <razvan.becheriu@qualitance.com>
 //
@@ -379,6 +379,28 @@ public:
     /// @return Number of leases deleted.
     virtual uint64_t deleteExpiredReclaimedLeases6(const uint32_t );
 
+    /// @brief Removes specified IPv4 leases.
+    ///
+    /// This rather dangerous method is able to remove all leases from specified
+    /// subnet.
+    ///
+    /// @todo: Not implemented yet.
+    ///
+    /// @param subnet_id identifier of the subnet
+    /// @return number of leases removed.
+    virtual size_t wipeLeases4(const SubnetID& subnet_id);
+
+    /// @brief Removed specified IPv6 leases.
+    ///
+    /// This rather dangerous method is able to remove all leases from specified
+    /// subnet.
+    ///
+    /// @todo: Not implemented yet.
+    ///
+    /// @param subnet_id identifier of the subnet
+    /// @return number of leases removed.
+    virtual size_t wipeLeases6(const SubnetID& subnet_id);
+
     /// @brief Return backend type
     ///
     /// @return Type of the backend.
index 83f2d51bd093794bb42d219e726045b5bf17d237..9ec4f33897237e2df635cff3a3ce96631ae3865f 100644 (file)
@@ -545,6 +545,27 @@ lease from the memory file database for the specified address.
 A debug message issued when the server is attempting to update IPv6
 lease from the memory file database for the specified address.
 
+% DHCPSRV_MEMFILE_WIPE_LEASES4 removing all IPv4 leases from subnet %1
+This informational message is printed when removal of all leases from
+specified IPv4 subnet is commencing. This is a result of receiving administrative
+command.
+
+% DHCPSRV_MEMFILE_WIPE_LEASES4_FINISHED removing all IPv4 leases from subnet %1 finished, removed %2 leases
+This informational message is printed when removal of all leases from
+a specified IPv4 subnet has finished. The number of removed leases is
+printed.
+
+% DHCPSRV_MEMFILE_WIPE_LEASES6 removing all IPv6 leases from subnet %1
+This informational message is printed when removal of all leases from
+specified IPv6 subnet is commencing. This is a result of receiving administrative
+command.
+
+% DHCPSRV_MEMFILE_WIPE_LEASES6_FINISHED removing all IPv6 leases from subnet %1 finished, removed %2 leases
+This informational message is printed when removal of all leases from
+a specified IPv6 subnet has finished. The number of removed leases is
+printed.
+
+
 % DHCPSRV_MULTIPLE_RAW_SOCKETS_PER_IFACE current configuration will result in opening multiple broadcast capable sockets on some interfaces and some DHCP messages may be duplicated
 A warning message issued when the current configuration indicates that multiple
 sockets, capable of receiving broadcast traffic, will be opened on some of the
index c1baf8407c0a729ef9a9caae5c66f7fb8960181c..5f70a55c137cbfec5d1f723938f1afb43470b803 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2017 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
@@ -539,6 +539,24 @@ public:
     /// @return A populated LeaseStatsQuery
     virtual LeaseStatsQueryPtr startLeaseStatsQuery6();
 
+    /// @brief Virtual method which removes specified leases.
+    ///
+    /// This rather dangerous method is able to remove all leases from specified
+    /// subnet.
+    ///
+    /// @param subnet_id identifier of the subnet (or 0 for all subnets)
+    /// @return number of leases removed.
+    virtual size_t wipeLeases4(const SubnetID& subnet_id) = 0;
+
+    /// @brief Virtual method which removes specified leases.
+    ///
+    /// This rather dangerous method is able to remove all leases from specified
+    /// subnet.
+    ///
+    /// @param subnet_id identifier of the subnet (or 0 for all subnets)
+    /// @return number of leases removed.
+    virtual size_t wipeLeases6(const SubnetID& subnet_id) = 0;
+
     /// @brief Return backend type
     ///
     /// Returns the type of the backend (e.g. "mysql", "memfile" etc.)
@@ -588,10 +606,6 @@ public:
     /// Rolls back all pending database operations.  On databases that don't
     /// support transactions, this is a no-op.
     virtual void rollback() = 0;
-
-    /// @todo: Add host management here
-    /// As host reservation is outside of scope for 2012, support for hosts
-    /// is currently postponed.
 };
 
 }; // end of isc::dhcp namespace
index aee842d459c64a7d09f88fb2840a99bbe1e4ce34..8f2267906a44822fc238aeb44d73676b1f8c9581 100644 (file)
@@ -1323,5 +1323,62 @@ Memfile_LeaseMgr::startLeaseStatsQuery6() {
     return(query);
 }
 
+size_t Memfile_LeaseMgr::wipeLeases4(const SubnetID& subnet_id) {
+    LOG_INFO(dhcpsrv_logger, DHCPSRV_MEMFILE_WIPE_LEASES4)
+        .arg(subnet_id);
+
+    // Get the index by DUID, IAID, lease type.
+    const Lease4StorageSubnetIdIndex& idx = storage4_.get<SubnetIdIndexTag>();
+
+    // Try to get the lease using the DUID, IAID and lease type.
+    std::pair<Lease4StorageSubnetIdIndex::const_iterator,
+              Lease4StorageSubnetIdIndex::const_iterator> l =
+        idx.equal_range(subnet_id);
+
+    // Let's collect all leases.
+    Lease4Collection leases;
+    for(auto lease = l.first; lease != l.second; ++lease) {
+        leases.push_back(*lease);
+    }
+
+    size_t num = leases.size();
+    for (auto l = leases.begin(); l != leases.end(); ++l) {
+        deleteLease((*l)->addr_);
+    }
+    LOG_INFO(dhcpsrv_logger, DHCPSRV_MEMFILE_WIPE_LEASES4_FINISHED)
+        .arg(subnet_id).arg(num);
+
+    return (num);
+}
+
+size_t Memfile_LeaseMgr::wipeLeases6(const SubnetID& subnet_id) {
+    LOG_INFO(dhcpsrv_logger, DHCPSRV_MEMFILE_WIPE_LEASES6)
+        .arg(subnet_id);
+
+    // Get the index by DUID, IAID, lease type.
+    const Lease6StorageSubnetIdIndex& idx = storage6_.get<SubnetIdIndexTag>();
+
+    // Try to get the lease using the DUID, IAID and lease type.
+    std::pair<Lease6StorageSubnetIdIndex::const_iterator,
+              Lease6StorageSubnetIdIndex::const_iterator> l =
+        idx.equal_range(subnet_id);
+
+    // Let's collect all leases.
+    Lease6Collection leases;
+    for(auto lease = l.first; lease != l.second; ++lease) {
+        leases.push_back(*lease);
+    }
+
+    size_t num = leases.size();
+    for (auto l = leases.begin(); l != leases.end(); ++l) {
+        deleteLease((*l)->addr_);
+    }
+    LOG_INFO(dhcpsrv_logger, DHCPSRV_MEMFILE_WIPE_LEASES6_FINISHED)
+        .arg(subnet_id).arg(num);
+
+    return (num);
+}
+
+
 } // end of namespace isc::dhcp
 } // end of namespace isc
index dcf2810689391bcf32d038ede51c87399194b83b..3d76f94468c3112e6aa9f6093a7065dde769b30f 100644 (file)
@@ -332,6 +332,24 @@ public:
     /// @return Number of leases deleted.
     virtual uint64_t deleteExpiredReclaimedLeases6(const uint32_t secs);
 
+    /// @brief Removes specified IPv4 leases.
+    ///
+    /// This rather dangerous method is able to remove all leases from specified
+    /// subnet.
+    ///
+    /// @param subnet_id identifier of the subnet
+    /// @return number of leases removed.
+    virtual size_t wipeLeases4(const SubnetID& subnet_id);
+
+    /// @brief Removed specified IPv6 leases.
+    ///
+    /// This rather dangerous method is able to remove all leases from specified
+    /// subnet.
+    ///
+    /// @param subnet_id identifier of the subnet
+    /// @return number of leases removed.
+    virtual size_t wipeLeases6(const SubnetID& subnet_id);
+
 private:
 
     /// @brief Deletes all expired-reclaimed leases.
index d16fec4606d22a1ebe4ea22ba2efc115e9a2960c..059210f8aa5082744b87584ba722151bb9c98a53 100644 (file)
@@ -42,6 +42,9 @@ struct ClientIdSubnetIdIndexTag { };
 /// @brief Tag for indexes by client id, HW address and subnet id.
 struct ClientIdHWAddressSubnetIdIndexTag { };
 
+/// @brief Tag for indexs by subnet-id.
+struct SubnetIdIndexTag { };
+
 /// @name Multi index containers holding DHCPv4 and DHCPv6 leases.
 ///
 //@{
@@ -103,6 +106,13 @@ typedef boost::multi_index_container<
                 boost::multi_index::const_mem_fun<Lease, int64_t,
                                                   &Lease::getExpirationTime>
             >
+        >,
+
+        // Specification of the fourth index starts here.
+        // This index sorts leases by SubnetID.
+        boost::multi_index::ordered_non_unique<
+            boost::multi_index::tag<SubnetIdIndexTag>,
+            boost::multi_index::member<Lease, isc::dhcp::SubnetID, &Lease::subnet_id_>
         >
      >
 > Lease6Storage; // Specify the type name of this container.
@@ -210,7 +220,15 @@ typedef boost::multi_index_container<
                 boost::multi_index::const_mem_fun<Lease, int64_t,
                                                   &Lease::getExpirationTime>
             >
+        >,
+
+        // Specification of the sixth index starts here.
+        // This index sorts leases by SubnetID.
+        boost::multi_index::ordered_non_unique<
+            boost::multi_index::tag<SubnetIdIndexTag>,
+            boost::multi_index::member<Lease, isc::dhcp::SubnetID, &Lease::subnet_id_>
         >
+
     >
 > Lease4Storage; // Specify the type name for this container.
 
@@ -229,6 +247,9 @@ typedef Lease6Storage::index<DuidIaidTypeIndexTag>::type Lease6StorageDuidIaidTy
 /// @brief DHCPv6 lease storage index by expiration time.
 typedef Lease6Storage::index<ExpirationIndexTag>::type Lease6StorageExpirationIndex;
 
+/// @brief DHCPv6 lease storage index by Subnet-id.
+typedef Lease6Storage::index<SubnetIdIndexTag>::type Lease6StorageSubnetIdIndex;
+
 /// @brief DHCPv4 lease storage index by address.
 typedef Lease4Storage::index<AddressIndexTag>::type Lease4StorageAddressIndex;
 
@@ -247,6 +268,9 @@ Lease4StorageClientIdSubnetIdIndex;
 typedef Lease4Storage::index<ClientIdHWAddressSubnetIdIndexTag>::type
 Lease4StorageClientIdHWAddressSubnetIdIndex;
 
+/// @brief DHCPv4 lease storage index by client id, HW address and subnet id.
+typedef Lease4Storage::index<SubnetIdIndexTag>::type Lease4StorageSubnetIdIndex;
+
 //@}
 } // end of isc::dhcp namespace
 } // end of isc namespace
index 3eb6062ed5cb736b6c4b8743be5daaf93847094d..63d4cabdc3b4609bad949114b12949e62261916b 100644 (file)
@@ -2100,7 +2100,15 @@ MySqlLeaseMgr::deleteExpiredReclaimedLeasesCommon(const uint32_t secs,
     return (deleted_leases);
 }
 
+size_t
+MySqlLeaseMgr::wipeLeases4(const SubnetID& /*subnet_id*/) {
+    isc_throw(NotImplemented, "wipeLeases4 is not implemented for MySQL backend");
+}
 
+size_t
+MySqlLeaseMgr::wipeLeases6(const SubnetID& /*subnet_id*/) {
+    isc_throw(NotImplemented, "wipeLeases6 is not implemented for MySQL backend");
+}
 
 // Miscellaneous database methods.
 
index f20e8681eea1c0fc98b831bb8acca43a96c4dce1..5c47e8ede95e1649f4e35031a006b057d5eb7696 100644 (file)
@@ -329,6 +329,28 @@ public:
     /// @return Number of leases deleted.
     virtual uint64_t deleteExpiredReclaimedLeases4(const uint32_t secs);
 
+    /// @brief Removes specified IPv4 leases.
+    ///
+    /// This rather dangerous method is able to remove all leases from specified
+    /// subnet.
+    ///
+    /// @todo: Not implemented yet.
+    ///
+    /// @param subnet_id identifier of the subnet
+    /// @return number of leases removed.
+    virtual size_t wipeLeases4(const SubnetID& subnet_id);
+
+    /// @brief Removed specified IPv6 leases.
+    ///
+    /// This rather dangerous method is able to remove all leases from specified
+    /// subnet.
+    ///
+    /// @todo: Not implemented yet.
+    ///
+    /// @param subnet_id identifier of the subnet
+    /// @return number of leases removed.
+    virtual size_t wipeLeases6(const SubnetID& subnet_id);
+
     /// @brief Deletes all expired-reclaimed DHCPv6 leases.
     ///
     /// @param secs Number of seconds since expiration of leases before
index bb40366079c22861b26af2d31863a1c14607a5ea..c2d0d43f39c3bd204b6f0f3f4caca41793b2b2bd 100644 (file)
@@ -1363,6 +1363,16 @@ PgSqlLeaseMgr::startLeaseStatsQuery6() {
     return(query);
 }
 
+size_t
+PgSqlLeaseMgr::wipeLeases4(const SubnetID& /*subnet_id*/) {
+    isc_throw(NotImplemented, "wipeLeases4 is not implemented for PgSQL backend");
+}
+
+size_t
+PgSqlLeaseMgr::wipeLeases6(const SubnetID& /*subnet_id*/) {
+    isc_throw(NotImplemented, "wipeLeases6 is not implemented for PgSQL backend");
+}
+
 string
 PgSqlLeaseMgr::getName() const {
     string name = "";
index ed8b192530723eaa573b23c772487be9fac5f9b2..01b9ae41a9bf6647b8bea671ae08c9a26f22a33c 100644 (file)
@@ -319,7 +319,7 @@ public:
     /// invokes its start method, which fetches its statistical data
     /// result set by executing the RECOUNT_LEASE_STATS4 query.
     /// The query object is then returned.
-    /// 
+    ///
     /// @return The populated query as a pointer to an LeaseStatsQuery
     virtual LeaseStatsQueryPtr startLeaseStatsQuery4();
 
@@ -329,10 +329,32 @@ public:
     /// invokes its start method, which fetches its statistical data
     /// result set by executing the RECOUNT_LEASE_STATS6 query.
     /// The query object is then returned.
-    /// 
+    ///
     /// @return The populated query as a pointer to an LeaseStatsQuery
     virtual LeaseStatsQueryPtr startLeaseStatsQuery6();
 
+    /// @brief Removes specified IPv4 leases.
+    ///
+    /// This rather dangerous method is able to remove all leases from specified
+    /// subnet.
+    ///
+    /// @todo: Not implemented yet.
+    ///
+    /// @param subnet_id identifier of the subnet
+    /// @return number of leases removed.
+    virtual size_t wipeLeases4(const SubnetID& subnet_id);
+
+    /// @brief Removed specified IPv6 leases.
+    ///
+    /// This rather dangerous method is able to remove all leases from specified
+    /// subnet.
+    ///
+    /// @todo: Not implemented yet.
+    ///
+    /// @param subnet_id identifier of the subnet
+    /// @return number of leases removed.
+    virtual size_t wipeLeases6(const SubnetID& subnet_id);
+
     /// @brief Return backend type
     ///
     /// Returns the type of the backend (e.g. "mysql", "memfile" etc.)
index baa2f7190f65c629c1f066aca0b63fdb1a065e9c..3da3658d1e935fd04cb061e37b43deaf2789e3dd 100644 (file)
@@ -643,4 +643,14 @@ TEST_F(CqlLeaseMgrTest, deleteExpiredReclaimedLeases4) {
     testDeleteExpiredReclaimedLeases4();
 }
 
+// Tests that leases from specific subnet can be removed.
+TEST_F(CqlLeaseMgrTest, DISABLED_wipeLeases4) {
+    testWipeLeases4();
+}
+
+// Tests that leases from specific subnet can be removed.
+TEST_F(CqlLeaseMgrTest, DISABLED_wipeLeases6) {
+    testWipeLeases6();
+}
+
 }; // Of anonymous namespace
index b3d46c69e0a62d103c5ad2137a2205f6086e00d3..3a0c65783a97c353b926486e6ff42d2664332057 100644 (file)
@@ -2684,6 +2684,69 @@ GenericLeaseMgrTest::testRecountLeaseStats6() {
     ASSERT_NO_FATAL_FAILURE(checkLeaseStats(expectedStats));
 }
 
+void
+GenericLeaseMgrTest::testWipeLeases6() {
+    // Get the leases to be used for the test and add to the database
+    vector<Lease6Ptr> leases = createLeases6();
+    leases[0]->subnet_id_ = 1;
+    leases[1]->subnet_id_ = 1;
+    leases[2]->subnet_id_ = 1;
+    leases[3]->subnet_id_ = 22;
+    leases[4]->subnet_id_ = 333;
+    leases[5]->subnet_id_ = 333;
+    leases[6]->subnet_id_ = 333;
+    leases[7]->subnet_id_ = 333;
+
+    for (size_t i = 0; i < leases.size(); ++i) {
+        EXPECT_TRUE(lmptr_->addLease(leases[i]));
+    }
+
+    // Let's try something simple. There shouldn't be any leases in
+    // subnet 2. The keep deleting the leases, perhaps in a different
+    // order they were added.
+    EXPECT_EQ(0, lmptr_->wipeLeases6(2));
+    EXPECT_EQ(4, lmptr_->wipeLeases6(333));
+    EXPECT_EQ(3, lmptr_->wipeLeases6(1));
+    EXPECT_EQ(1, lmptr_->wipeLeases6(22));
+
+    // All the leases should be gone now. Check that that repeated
+    // attempt to delete them will not result in any additional removals.
+    EXPECT_EQ(0, lmptr_->wipeLeases6(1));
+    EXPECT_EQ(0, lmptr_->wipeLeases6(22));
+    EXPECT_EQ(0, lmptr_->wipeLeases6(333));
+}
+
+void
+GenericLeaseMgrTest::testWipeLeases4() {
+    // Get the leases to be used for the test and add to the database
+    vector<Lease4Ptr> leases = createLeases4();
+    leases[0]->subnet_id_ = 1;
+    leases[1]->subnet_id_ = 1;
+    leases[2]->subnet_id_ = 1;
+    leases[3]->subnet_id_ = 22;
+    leases[4]->subnet_id_ = 333;
+    leases[5]->subnet_id_ = 333;
+    leases[6]->subnet_id_ = 333;
+    leases[7]->subnet_id_ = 333;
+
+    for (size_t i = 0; i < leases.size(); ++i) {
+        EXPECT_TRUE(lmptr_->addLease(leases[i]));
+    }
+
+    // Let's try something simple. There shouldn't be any leases in
+    // subnet 2. The keep deleting the leases, perhaps in a different
+    // order they were added.
+    EXPECT_EQ(0, lmptr_->wipeLeases4(2));
+    EXPECT_EQ(4, lmptr_->wipeLeases4(333));
+    EXPECT_EQ(3, lmptr_->wipeLeases4(1));
+    EXPECT_EQ(1, lmptr_->wipeLeases4(22));
+
+    // All the leases should be gone now. Check that that repeated
+    // attempt to delete them will not result in any additional removals.
+    EXPECT_EQ(0, lmptr_->wipeLeases4(1));
+    EXPECT_EQ(0, lmptr_->wipeLeases4(22));
+    EXPECT_EQ(0, lmptr_->wipeLeases4(333));
+}
 
 }; // namespace test
 }; // namespace dhcp
index 5f23e4f5af291d8b489b7c9250d711eb990c644d..1a4b55277c08b3b40e087e23a75efaf58d48e622 100644 (file)
@@ -374,6 +374,19 @@ public:
     /// after altering the lease states in various ways.
     void testRecountLeaseStats6();
 
+
+    /// @brief Check if wipeLeases4 works properly.
+    ///
+    /// This test creates a bunch of leases in several subnets and then
+    /// attempts to delete them, one subnet at a time.
+    void testWipeLeases4();
+
+    /// @brief Check if wipeLeases6 works properly.
+    ///
+    /// This test creates a bunch of leases in several subnets and then
+    /// attempts to delete them, one subnet at a time.
+    void testWipeLeases6();
+
     /// @brief String forms of IPv4 addresses
     std::vector<std::string>  straddress4_;
 
index 3a894da998b5fff32da40fb075a82b2195638706..34b595286a3197d80007f00a82d2c942b80ae2f3 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2017 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
@@ -223,6 +223,16 @@ public:
                   " is not implemented");
     }
 
+    /// @brief Pretends to will all IPv4 leases from a subnet
+    virtual size_t wipeLeases4(const SubnetID&) {
+        isc_throw(NotImplemented, "ConreteLeaseMgr::wipeLeases4 not implemented");
+    }
+
+    /// @brief Pretends to will all IPv4 leases from a subnet
+    virtual size_t wipeLeases6(const SubnetID&) {
+        isc_throw(NotImplemented, "ConreteLeaseMgr::wipeLeases4 not implemented");
+    }
+
     /// @brief Returns backend type.
     ///
     /// Returns the type of the backend (e.g. "mysql", "memfile" etc.)
index 3cf84c770e940ca6a9575bec8ab180b655c11d8b..8471ff7ed836ebed3765b467a1eb70551364a5bf 100644 (file)
@@ -1894,4 +1894,16 @@ TEST_F(MemfileLeaseMgrTest, recountLeaseStats6) {
     testRecountLeaseStats6();
 }
 
+// Tests that leases from specific subnet can be removed.
+TEST_F(MemfileLeaseMgrTest, wipeLeases4) {
+    startBackend(V4);
+    testWipeLeases4();
+}
+
+// Tests that leases from specific subnet can be removed.
+TEST_F(MemfileLeaseMgrTest, wipeLeases6) {
+    startBackend(V6);
+    testWipeLeases6();
+}
+
 }; // end of anonymous namespace
index 4502bb23c720d1667c7ba1aa8f30589658230a82..bb2b5463f3972c7cdd4da82cea2aa293903fb17c 100644 (file)
@@ -487,4 +487,14 @@ TEST_F(MySqlLeaseMgrTest, recountLeaseStats6) {
     testRecountLeaseStats6();
 }
 
+// Tests that leases from specific subnet can be removed.
+TEST_F(MySqlLeaseMgrTest, DISABLED_wipeLeases4) {
+    testWipeLeases4();
+}
+
+// Tests that leases from specific subnet can be removed.
+TEST_F(MySqlLeaseMgrTest, DISABLED_wipeLeases6) {
+    testWipeLeases6();
+}
+
 }; // Of anonymous namespace
index 19cf0c4d682ad417be2978ba16013773e70df8ac..6b59fcdb2c3b2d786895c3b8ba32f1257c70ffe2 100644 (file)
@@ -412,4 +412,14 @@ TEST_F(PgSqlLeaseMgrTest, recountLeaseStats6) {
     testRecountLeaseStats6();
 }
 
+// Tests that leases from specific subnet can be removed.
+TEST_F(PgSqlLeaseMgrTest, DISABLED_wipeLeases4) {
+    testWipeLeases4();
+}
+
+// Tests that leases from specific subnet can be removed.
+TEST_F(PgSqlLeaseMgrTest, DISABLED_wipeLeases6) {
+    testWipeLeases6();
+}
+
 }; // namespace