diff options
author | Marcin Godzina <mgodzina@isc.org> | 2024-05-24 09:38:03 +0200 |
---|---|---|
committer | Marcin Godzina <mgodzina@isc.org> | 2024-05-24 09:38:03 +0200 |
commit | 228e848be38223dfc3ce2a859ee45cb27ffe6307 (patch) | |
tree | 32824e0424251d59052b1f40b47c30a6b179e3ed | |
parent | [#3301] addressed comments (diff) | |
download | kea-228e848be38223dfc3ce2a859ee45cb27ffe6307.tar.xz kea-228e848be38223dfc3ce2a859ee45cb27ffe6307.zip |
[#3427] deprecate warning for lease wipe
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | doc/sphinx/arm/hooks-lease-cmds.rst | 11 | ||||
-rw-r--r-- | src/hooks/dhcp/lease_cmds/lease_cmds.cc | 10 | ||||
-rw-r--r-- | src/hooks/dhcp/lease_cmds/lease_cmds_messages.cc | 4 | ||||
-rw-r--r-- | src/hooks/dhcp/lease_cmds/lease_cmds_messages.h | 2 | ||||
-rw-r--r-- | src/hooks/dhcp/lease_cmds/lease_cmds_messages.mes | 6 | ||||
-rw-r--r-- | src/hooks/dhcp/lease_cmds/tests/lease_cmds4_unittest.cc | 15 | ||||
-rw-r--r-- | src/hooks/dhcp/lease_cmds/tests/lease_cmds6_unittest.cc | 15 | ||||
-rw-r--r-- | src/share/api/lease4-wipe.json | 3 | ||||
-rw-r--r-- | src/share/api/lease6-wipe.json | 3 |
10 files changed, 57 insertions, 16 deletions
@@ -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, diff --git a/doc/sphinx/arm/hooks-lease-cmds.rst b/doc/sphinx/arm/hooks-lease-cmds.rst index ba92617506..827ddd90b2 100644 --- a/doc/sphinx/arm/hooks-lease-cmds.rst +++ b/doc/sphinx/arm/hooks-lease-cmds.rst @@ -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 diff --git a/src/hooks/dhcp/lease_cmds/lease_cmds.cc b/src/hooks/dhcp/lease_cmds/lease_cmds.cc index 54e6364131..b0baf99079 100644 --- a/src/hooks/dhcp/lease_cmds/lease_cmds.cc +++ b/src/hooks/dhcp/lease_cmds/lease_cmds.cc @@ -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); } diff --git a/src/hooks/dhcp/lease_cmds/lease_cmds_messages.cc b/src/hooks/dhcp/lease_cmds/lease_cmds_messages.cc index 36ff6dcdd9..5efe6941b2 100644 --- a/src/hooks/dhcp/lease_cmds/lease_cmds_messages.cc +++ b/src/hooks/dhcp/lease_cmds/lease_cmds_messages.cc @@ -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 }; diff --git a/src/hooks/dhcp/lease_cmds/lease_cmds_messages.h b/src/hooks/dhcp/lease_cmds/lease_cmds_messages.h index 2492c4e2e7..84613b0900 100644 --- a/src/hooks/dhcp/lease_cmds/lease_cmds_messages.h +++ b/src/hooks/dhcp/lease_cmds/lease_cmds_messages.h @@ -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 diff --git a/src/hooks/dhcp/lease_cmds/lease_cmds_messages.mes b/src/hooks/dhcp/lease_cmds/lease_cmds_messages.mes index 3b0858928c..7f179a6af1 100644 --- a/src/hooks/dhcp/lease_cmds/lease_cmds_messages.mes +++ b/src/hooks/dhcp/lease_cmds/lease_cmds_messages.mes @@ -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. diff --git a/src/hooks/dhcp/lease_cmds/tests/lease_cmds4_unittest.cc b/src/hooks/dhcp/lease_cmds/tests/lease_cmds4_unittest.cc index 5f62c9ffaf..9416e34d45 100644 --- a/src/hooks/dhcp/lease_cmds/tests/lease_cmds4_unittest.cc +++ b/src/hooks/dhcp/lease_cmds/tests/lease_cmds4_unittest.cc @@ -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); diff --git a/src/hooks/dhcp/lease_cmds/tests/lease_cmds6_unittest.cc b/src/hooks/dhcp/lease_cmds/tests/lease_cmds6_unittest.cc index cf299092e1..65cdda2275 100644 --- a/src/hooks/dhcp/lease_cmds/tests/lease_cmds6_unittest.cc +++ b/src/hooks/dhcp/lease_cmds/tests/lease_cmds6_unittest.cc @@ -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); diff --git a/src/share/api/lease4-wipe.json b/src/share/api/lease4-wipe.json index 5ee4fcc10a..f823c223f4 100644 --- a/src/share/api/lease4-wipe.json +++ b/src/share/api/lease4-wipe.json @@ -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": [ "{", diff --git a/src/share/api/lease6-wipe.json b/src/share/api/lease6-wipe.json index eb6f55a280..3d63134ef8 100644 --- a/src/share/api/lease6-wipe.json +++ b/src/share/api/lease6-wipe.json @@ -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." |