]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3427] deprecate warning for lease wipe
authorMarcin Godzina <mgodzina@isc.org>
Fri, 24 May 2024 07:38:03 +0000 (07:38 +0000)
committerMarcin Godzina <mgodzina@isc.org>
Fri, 24 May 2024 07:38:03 +0000 (07:38 +0000)
ChangeLog
doc/sphinx/arm/hooks-lease-cmds.rst
src/hooks/dhcp/lease_cmds/lease_cmds.cc
src/hooks/dhcp/lease_cmds/lease_cmds_messages.cc
src/hooks/dhcp/lease_cmds/lease_cmds_messages.h
src/hooks/dhcp/lease_cmds/lease_cmds_messages.mes
src/hooks/dhcp/lease_cmds/tests/lease_cmds4_unittest.cc
src/hooks/dhcp/lease_cmds/tests/lease_cmds6_unittest.cc
src/share/api/lease4-wipe.json
src/share/api/lease6-wipe.json

index 3854c97d39aa783b54cd2c78b22a72cc107ba4c5..06b63ed25e57c6023beadbb86513c3205beacda6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2244.  [func]          mgodzina
+       lease4-wipe and lease6-wipe now log a deprecation warning.
+       (Gitlab #3427)
+
 2243.  [func]          razvan
        Updated yang modules: removed qualifying-suffix,
        override-no-update, override-client-update,
index ba92617506ad34d8e6f61f1c656c95999ec48e7a..827ddd90b2ca09385ea734ca9b32dc21a038eee7 100644 (file)
@@ -87,10 +87,12 @@ This library provides the following commands:
 -  :isccmd:`lease6-update` - updates (replaces) an existing IPv6 lease.
 
 -  :isccmd:`lease4-wipe` - removes all leases from a specific IPv4 subnet or
-   from all subnets.
+   from all subnets. This command is deprecated and it will be removed
+   in the future.
 
 -  :isccmd:`lease6-wipe` - removes all leases from a specific IPv6 subnet or
-   from all subnets.
+   from all subnets. This command is deprecated and it will be removed
+   in the future.
 
 -  :isccmd:`lease4-resend-ddns` - resends a request to update DNS entries for
    an existing lease.
@@ -961,6 +963,11 @@ response, modifying it to the required outcome, and then issuing the
 The ``lease4-wipe``, ``lease6-wipe`` Commands
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+.. warning::
+
+   The :isccmd:`lease4-wipe` and :isccmd:`lease6-wipe` commands are deprecated
+   and they will be removed in the future.
+
 :isccmd:`lease4-wipe` and :isccmd:`lease6-wipe` are designed to remove all leases
 associated with a given subnet. This administrative task is expected to
 be used when an existing subnet is being retired. The leases
index 54e63641310766b42bcde9a411c8e3dd43a51537..b0baf990796443c544ac231c7c5f762f3ec0152c 100644 (file)
@@ -2298,7 +2298,8 @@ LeaseCmdsImpl::lease4WipeHandler(CalloutHandle& handle) {
         }
 
         stringstream tmp;
-        tmp << "Deleted " << num << " IPv4 lease(s) from subnet(s)" << ids.str();
+        tmp << "Deleted " << num << " IPv4 lease(s) from subnet(s)" << ids.str()
+            << " WARNING: lease4-wipe is deprecated!";
         ConstElementPtr response = createAnswer(num ? CONTROL_RESULT_SUCCESS
                                                     : CONTROL_RESULT_EMPTY, tmp.str());
         setResponse(handle, response);
@@ -2306,12 +2307,14 @@ LeaseCmdsImpl::lease4WipeHandler(CalloutHandle& handle) {
         LOG_ERROR(lease_cmds_logger, LEASE_CMDS_WIPE4_FAILED)
             .arg(cmd_args_ ? cmd_args_->str() : "<no args>")
             .arg(ex.what());
+        LOG_WARN(lease_cmds_logger, LEASE_CMDS_WIPE4_DEPRECATED);
         setErrorResponse(handle, ex.what());
         return (1);
     }
 
     LOG_INFO(lease_cmds_logger, LEASE_CMDS_WIPE4)
         .arg(cmd_args_ ? cmd_args_->str() : "<no args>");
+    LOG_WARN(lease_cmds_logger, LEASE_CMDS_WIPE4_DEPRECATED);
     return (0);
 }
 
@@ -2443,7 +2446,8 @@ LeaseCmdsImpl::lease6WipeHandler(CalloutHandle& handle) {
         }
 
         stringstream tmp;
-        tmp << "Deleted " << num << " IPv6 lease(s) from subnet(s)" << ids.str();
+        tmp << "Deleted " << num << " IPv6 lease(s) from subnet(s)" << ids.str()
+            << " WARNING: lease6-wipe is deprecated!";
         ConstElementPtr response = createAnswer(num ? CONTROL_RESULT_SUCCESS
                                                     : CONTROL_RESULT_EMPTY, tmp.str());
         setResponse(handle, response);
@@ -2451,12 +2455,14 @@ LeaseCmdsImpl::lease6WipeHandler(CalloutHandle& handle) {
         LOG_ERROR(lease_cmds_logger, LEASE_CMDS_WIPE6_FAILED)
             .arg(cmd_args_ ? cmd_args_->str() : "<no args>")
             .arg(ex.what());
+        LOG_WARN(lease_cmds_logger, LEASE_CMDS_WIPE6_DEPRECATED);
         setErrorResponse(handle, ex.what());
         return (1);
     }
 
     LOG_INFO(lease_cmds_logger, LEASE_CMDS_WIPE6)
         .arg(cmd_args_ ? cmd_args_->str() : "<no args>");
+    LOG_WARN(lease_cmds_logger, LEASE_CMDS_WIPE6_DEPRECATED);
     return (0);
 }
 
index 36ff6dcdd95ffd61060493cf4caf921fb487d4fb..5efe6941b20d1bfaf08f2f312980f85148e317be 100644 (file)
@@ -33,8 +33,10 @@ extern const isc::log::MessageID LEASE_CMDS_UPDATE6 = "LEASE_CMDS_UPDATE6";
 extern const isc::log::MessageID LEASE_CMDS_UPDATE6_CONFLICT = "LEASE_CMDS_UPDATE6_CONFLICT";
 extern const isc::log::MessageID LEASE_CMDS_UPDATE6_FAILED = "LEASE_CMDS_UPDATE6_FAILED";
 extern const isc::log::MessageID LEASE_CMDS_WIPE4 = "LEASE_CMDS_WIPE4";
+extern const isc::log::MessageID LEASE_CMDS_WIPE4_DEPRECATED = "LEASE_CMDS_WIPE4_DEPRECATED";
 extern const isc::log::MessageID LEASE_CMDS_WIPE4_FAILED = "LEASE_CMDS_WIPE4_FAILED";
 extern const isc::log::MessageID LEASE_CMDS_WIPE6 = "LEASE_CMDS_WIPE6";
+extern const isc::log::MessageID LEASE_CMDS_WIPE6_DEPRECATED = "LEASE_CMDS_WIPE6_DEPRECATED";
 extern const isc::log::MessageID LEASE_CMDS_WIPE6_FAILED = "LEASE_CMDS_WIPE6_FAILED";
 
 namespace {
@@ -69,8 +71,10 @@ const char* values[] = {
     "LEASE_CMDS_UPDATE6_CONFLICT", "lease6-update command failed due to conflict (parameters: %1, reason: %2)",
     "LEASE_CMDS_UPDATE6_FAILED", "lease6-add command failed (parameters: %1, reason: %2)",
     "LEASE_CMDS_WIPE4", "lease4-wipe command successful (parameters: %1)",
+    "LEASE_CMDS_WIPE4_DEPRECATED", "lease4-wipe command is deprecated and it will be removed in the future.",
     "LEASE_CMDS_WIPE4_FAILED", "lease4-wipe command failed (parameters: %1, reason: %2)",
     "LEASE_CMDS_WIPE6", "lease6-wipe command successful (parameters: %1)",
+    "LEASE_CMDS_WIPE6_DEPRECATED", "lease6-wipe command is deprecated and it will be removed in the future.",
     "LEASE_CMDS_WIPE6_FAILED", "lease6-wipe command failed (parameters: %1, reason: %2)",
     NULL
 };
index 2492c4e2e713e1038c80352591e3d2e438634071..84613b09009699e174247054af7ffbbbef414856 100644 (file)
@@ -34,8 +34,10 @@ extern const isc::log::MessageID LEASE_CMDS_UPDATE6;
 extern const isc::log::MessageID LEASE_CMDS_UPDATE6_CONFLICT;
 extern const isc::log::MessageID LEASE_CMDS_UPDATE6_FAILED;
 extern const isc::log::MessageID LEASE_CMDS_WIPE4;
+extern const isc::log::MessageID LEASE_CMDS_WIPE4_DEPRECATED;
 extern const isc::log::MessageID LEASE_CMDS_WIPE4_FAILED;
 extern const isc::log::MessageID LEASE_CMDS_WIPE6;
+extern const isc::log::MessageID LEASE_CMDS_WIPE6_DEPRECATED;
 extern const isc::log::MessageID LEASE_CMDS_WIPE6_FAILED;
 
 #endif // LEASE_CMDS_MESSAGES_H
index 3b0858928ced2e0f80fb3f9f556902d0ec7b9bfb..7f179a6af1d2e6f124c2a1691d4dd9a1d64b9554 100644 (file)
@@ -128,6 +128,9 @@ are logged.
 The lease4-wipe command has failed. Both the reason as well as the
 parameters passed are logged.
 
+% LEASE_CMDS_WIPE4_DEPRECATED lease4-wipe command is deprecated and it will be removed in the future.
+The lease4-wipe command is deprecated and it will be removed in the future.
+
 % LEASE_CMDS_WIPE6 lease6-wipe command successful (parameters: %1)
 The lease6-wipe command has been successful. Parameters of the command
 are logged.
@@ -135,3 +138,6 @@ are logged.
 % LEASE_CMDS_WIPE6_FAILED lease6-wipe command failed (parameters: %1, reason: %2)
 The lease6-wipe command has failed. Both the reason as well as the
 parameters passed are logged.
+
+% LEASE_CMDS_WIPE6_DEPRECATED lease6-wipe command is deprecated and it will be removed in the future.
+The lease6-wipe command is deprecated and it will be removed in the future.
index 5f62c9ffafc3b4419fa486a9700474f9215cbe6f..9416e34d45e1a02dcacb04c156d7b0531320cbc7 100644 (file)
@@ -2806,7 +2806,8 @@ void Lease4CmdsTest::testLease4Wipe() {
         "        \"subnet-id\": 44"
         "    }\n"
         "}";
-    string exp_rsp = "Deleted 2 IPv4 lease(s) from subnet(s) 44";
+    string exp_rsp = "Deleted 2 IPv4 lease(s) from subnet(s) 44"
+                     " WARNING: lease4-wipe is deprecated!";
 
     // The status expected is success. The lease should be deleted.
     testCommand(cmd, CONTROL_RESULT_SUCCESS, exp_rsp);
@@ -2840,7 +2841,8 @@ void Lease4CmdsTest::testLease4WipeAll() {
         "        \"subnet-id\": 0"
         "    }\n"
         "}";
-    string exp_rsp = "Deleted 4 IPv4 lease(s) from subnet(s) 44 88";
+    string exp_rsp = "Deleted 4 IPv4 lease(s) from subnet(s) 44 88"
+                     " WARNING: lease4-wipe is deprecated!";
 
     // The status expected is success. The lease should be deleted.
     testCommand(cmd, CONTROL_RESULT_SUCCESS, exp_rsp);
@@ -2871,7 +2873,8 @@ void Lease4CmdsTest::testLease4WipeAllNoArgs() {
         "{\n"
         "    \"command\": \"lease4-wipe\"\n"
         "}";
-    string exp_rsp = "Deleted 4 IPv4 lease(s) from subnet(s) 44 88";
+    string exp_rsp = "Deleted 4 IPv4 lease(s) from subnet(s) 44 88"
+                     " WARNING: lease4-wipe is deprecated!";
 
     // The status expected is success. The lease should be deleted.
     testCommand(cmd, CONTROL_RESULT_SUCCESS, exp_rsp);
@@ -2905,7 +2908,8 @@ void Lease4CmdsTest::testLease4WipeNoLeases() {
         "        \"subnet-id\": 44"
         "    }\n"
         "}";
-    string exp_rsp = "Deleted 0 IPv4 lease(s) from subnet(s) 44";
+    string exp_rsp = "Deleted 0 IPv4 lease(s) from subnet(s) 44"
+                     " WARNING: lease4-wipe is deprecated!";
     testCommand(cmd, CONTROL_RESULT_EMPTY, exp_rsp);
 
     checkLease4Stats(44, 0, 0);
@@ -2929,7 +2933,8 @@ void Lease4CmdsTest::testLease4WipeNoLeasesAll() {
         "        \"subnet-id\": 0"
         "    }\n"
         "}";
-    string exp_rsp = "Deleted 0 IPv4 lease(s) from subnet(s) 44 88";
+    string exp_rsp = "Deleted 0 IPv4 lease(s) from subnet(s) 44 88"
+                     " WARNING: lease4-wipe is deprecated!";
     testCommand(cmd, CONTROL_RESULT_EMPTY, exp_rsp);
 
     checkLease4Stats(44, 0, 0);
index cf299092e1048ff7b7079d04ef0fac8aa3acc5fe..65cdda2275205553e0465c8acaab635db75d5dff 100644 (file)
@@ -2969,7 +2969,8 @@ void Lease6CmdsTest::testLease6Wipe() {
         "        \"subnet-id\": 66\n"
         "    }\n"
         "}";
-    string exp_rsp = "Deleted 2 IPv6 lease(s) from subnet(s) 66";
+    string exp_rsp = "Deleted 2 IPv6 lease(s) from subnet(s) 66"
+                     " WARNING: lease6-wipe is deprecated!";
 
     // The status expected is success. The lease should be deleted.
     testCommand(cmd, CONTROL_RESULT_SUCCESS, exp_rsp);
@@ -3003,7 +3004,8 @@ void Lease6CmdsTest::testLease6WipeAll() {
         "        \"subnet-id\": 0\n"
         "    }\n"
         "}";
-    string exp_rsp = "Deleted 4 IPv6 lease(s) from subnet(s) 66 99";
+    string exp_rsp = "Deleted 4 IPv6 lease(s) from subnet(s) 66 99"
+                     " WARNING: lease6-wipe is deprecated!";
 
     // The status expected is success. The lease should be deleted.
     testCommand(cmd, CONTROL_RESULT_SUCCESS, exp_rsp);
@@ -3034,7 +3036,8 @@ void Lease6CmdsTest::testLease6WipeAllNoArgs() {
         "{\n"
         "    \"command\": \"lease6-wipe\"\n"
         "}";
-    string exp_rsp = "Deleted 4 IPv6 lease(s) from subnet(s) 66 99";
+    string exp_rsp = "Deleted 4 IPv6 lease(s) from subnet(s) 66 99"
+                     " WARNING: lease6-wipe is deprecated!";
 
     // The status expected is success. The lease should be deleted.
     testCommand(cmd, CONTROL_RESULT_SUCCESS, exp_rsp);
@@ -3068,7 +3071,8 @@ void Lease6CmdsTest::testLease6WipeNoLeases() {
         "        \"subnet-id\": 66"
         "    }\n"
         "}";
-    string exp_rsp = "Deleted 0 IPv6 lease(s) from subnet(s) 66";
+    string exp_rsp = "Deleted 0 IPv6 lease(s) from subnet(s) 66"
+                     " WARNING: lease6-wipe is deprecated!";
     testCommand(cmd, CONTROL_RESULT_EMPTY, exp_rsp);
 
     checkLease6Stats(66, 0, 0, 0);
@@ -3092,7 +3096,8 @@ void Lease6CmdsTest::testLease6WipeNoLeasesAll() {
         "        \"subnet-id\": 0"
         "    }\n"
         "}";
-    string exp_rsp = "Deleted 0 IPv6 lease(s) from subnet(s) 66 99";
+    string exp_rsp = "Deleted 0 IPv6 lease(s) from subnet(s) 66 99"
+                     " WARNING: lease6-wipe is deprecated!";
     testCommand(cmd, CONTROL_RESULT_EMPTY, exp_rsp);
 
     checkLease6Stats(66, 0, 0, 0);
index 5ee4fcc10ac7e1c14a4c75a5e3c52a7bf4dd3890..f823c223f455647dd0f56acfc3d3ca8f66622501 100644 (file)
@@ -2,7 +2,8 @@
     "access": "write",
     "avail": "1.3.0",
     "brief": [
-        "This command removes all leases associated with a given subnet."
+        "This command removes all leases associated with a given subnet.",
+        "This command is deprecated and it will be removed in the future."
     ],
     "cmd-syntax": [
         "{",
index eb6f55a28071067b5a154a3dc7f63fe17f4b6a23..3d63134ef8df38e6320ad120de4d09f946180404 100644 (file)
@@ -2,7 +2,8 @@
     "access": "write",
     "avail": "1.3.0",
     "brief": [
-        "This command removes all leases associated with a given subnet."
+        "This command removes all leases associated with a given subnet.",
+        "This command is deprecated and it will be removed in the future."
     ],
     "cmd-comment": [
         "Note: not all backends support this command."