From: Francis Dupont Date: Fri, 25 Oct 2019 20:47:24 +0000 (+0200) Subject: [904-add-ability-to-force-a-cb-update-remotely] Addressed last comments X-Git-Tag: Kea-1.7.1~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f3d76f6f038d61ac88c9c382a7404ec784d39d3;p=thirdparty%2Fkea.git [904-add-ability-to-force-a-cb-update-remotely] Addressed last comments --- diff --git a/doc/sphinx/arm/ctrl-channel.rst b/doc/sphinx/arm/ctrl-channel.rst index f5e0b5452d..4c609704b4 100644 --- a/doc/sphinx/arm/ctrl-channel.rst +++ b/doc/sphinx/arm/ctrl-channel.rst @@ -549,7 +549,7 @@ the DHCPv4 or DHCPv6 server (:ref:`cb-sharing` explains the server tag concept) .. _command-config-backend-pull: The config-backend-pull Command: --------------------------- +--------------------------~~~~~~ The ``config-backend-pull`` command triggers the polling of Config Backends (which should be configured for this command to do something) diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.cc b/src/bin/dhcp4/ctrl_dhcp4_srv.cc index 08f9bc0615..923daef33d 100644 --- a/src/bin/dhcp4/ctrl_dhcp4_srv.cc +++ b/src/bin/dhcp4/ctrl_dhcp4_srv.cc @@ -564,7 +564,7 @@ ControlledDhcpv4Srv::commandConfigBackendPullHandler(const std::string&, auto mode = CBControlDHCPv4::FetchMode::FETCH_UPDATE; server_->getCBControl()->databaseConfigFetch(srv_cfg, mode); } catch (const std::exception& ex) { - LOG_ERROR(dhcp4_logger, DHCP4_CB_PULL_FAIL) + LOG_ERROR(dhcp4_logger, DHCP4_CB_PULL_FETCH_UPDATES_FAIL) .arg(ex.what()); return (createAnswer(CONTROL_RESULT_ERROR, "Server update failed: " + string(ex.what()))); @@ -1076,14 +1076,15 @@ ControlledDhcpv4Srv::cbFetchUpdates(const SrvConfigPtr& srv_cfg, (*failure_count) = 0; } catch (const std::exception& ex) { - LOG_ERROR(dhcp4_logger, DHCP4_CB_FETCH_UPDATES_FAIL) + LOG_ERROR(dhcp4_logger, DHCP4_CB_PERIODIC_FETCH_UPDATES_FAIL) .arg(ex.what()); // We allow at most 10 consecutive failures after which we stop // making further attempts to fetch the configuration updates. // Let's return without re-scheduling the timer. if (++(*failure_count) > 10) { - LOG_ERROR(dhcp4_logger, DHCP4_CB_FETCH_UPDATES_RETRIES_EXHAUSTED); + LOG_ERROR(dhcp4_logger, + DHCP4_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED); return; } } diff --git a/src/bin/dhcp4/dhcp4_messages.cc b/src/bin/dhcp4/dhcp4_messages.cc index 4935291624..ab88a09c6d 100644 --- a/src/bin/dhcp4/dhcp4_messages.cc +++ b/src/bin/dhcp4/dhcp4_messages.cc @@ -1,4 +1,4 @@ -// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Fri Oct 25 2019 18:13 +// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Fri Oct 25 2019 22:42 #include #include @@ -13,9 +13,9 @@ extern const isc::log::MessageID DHCP4_BUFFER_RECEIVED = "DHCP4_BUFFER_RECEIVED" extern const isc::log::MessageID DHCP4_BUFFER_RECEIVE_FAIL = "DHCP4_BUFFER_RECEIVE_FAIL"; extern const isc::log::MessageID DHCP4_BUFFER_UNPACK = "DHCP4_BUFFER_UNPACK"; extern const isc::log::MessageID DHCP4_BUFFER_WAIT_SIGNAL = "DHCP4_BUFFER_WAIT_SIGNAL"; -extern const isc::log::MessageID DHCP4_CB_FETCH_UPDATES_FAIL = "DHCP4_CB_FETCH_UPDATES_FAIL"; -extern const isc::log::MessageID DHCP4_CB_FETCH_UPDATES_RETRIES_EXHAUSTED = "DHCP4_CB_FETCH_UPDATES_RETRIES_EXHAUSTED"; -extern const isc::log::MessageID DHCP4_CB_PULL_FAIL = "DHCP4_CB_PULL_FAIL"; +extern const isc::log::MessageID DHCP4_CB_PERIODIC_FETCH_UPDATES_FAIL = "DHCP4_CB_PERIODIC_FETCH_UPDATES_FAIL"; +extern const isc::log::MessageID DHCP4_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED = "DHCP4_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED"; +extern const isc::log::MessageID DHCP4_CB_PULL_FETCH_UPDATES_FAIL = "DHCP4_CB_PULL_FETCH_UPDATES_FAIL"; extern const isc::log::MessageID DHCP4_CLASS_ASSIGNED = "DHCP4_CLASS_ASSIGNED"; extern const isc::log::MessageID DHCP4_CLASS_UNCONFIGURED = "DHCP4_CLASS_UNCONFIGURED"; extern const isc::log::MessageID DHCP4_CLASS_UNDEFINED = "DHCP4_CLASS_UNDEFINED"; @@ -151,9 +151,9 @@ const char* values[] = { "DHCP4_BUFFER_RECEIVE_FAIL", "error on attempt to receive packet: %1", "DHCP4_BUFFER_UNPACK", "parsing buffer received from %1 to %2 over interface %3", "DHCP4_BUFFER_WAIT_SIGNAL", "signal received while waiting for next packet, next waiting signal is %1", - "DHCP4_CB_FETCH_UPDATES_FAIL", "error on attempt to fetch configuration updates from the configuration backend(s): %1", - "DHCP4_CB_FETCH_UPDATES_RETRIES_EXHAUSTED", "maximum number of configuration fetch attempts: 10, has been exhausted without success", - "DHCP4_CB_PULL_FAIL", "error on pull configuration updates from the configuration backend(s): %1", + "DHCP4_CB_PERIODIC_FETCH_UPDATES_FAIL", "error on periodic attempt to fetch configuration updates from the configuration backend(s): %1", + "DHCP4_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED", "maximum number of configuration fetch attempts: 10, has been exhausted without success", + "DHCP4_CB_PULL_FETCH_UPDATES_FAIL", "error on pull attempt to fetch configuration updates from the configuration backend(s): %1", "DHCP4_CLASS_ASSIGNED", "%1: client packet has been assigned to the following class(es): %2", "DHCP4_CLASS_UNCONFIGURED", "%1: client packet belongs to an unconfigured class: %2", "DHCP4_CLASS_UNDEFINED", "required class %1 has no definition", diff --git a/src/bin/dhcp4/dhcp4_messages.h b/src/bin/dhcp4/dhcp4_messages.h index 577771ced1..1b9bee80ee 100644 --- a/src/bin/dhcp4/dhcp4_messages.h +++ b/src/bin/dhcp4/dhcp4_messages.h @@ -1,4 +1,4 @@ -// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Fri Oct 25 2019 18:13 +// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Fri Oct 25 2019 22:42 #ifndef DHCP4_MESSAGES_H #define DHCP4_MESSAGES_H @@ -14,9 +14,9 @@ extern const isc::log::MessageID DHCP4_BUFFER_RECEIVED; extern const isc::log::MessageID DHCP4_BUFFER_RECEIVE_FAIL; extern const isc::log::MessageID DHCP4_BUFFER_UNPACK; extern const isc::log::MessageID DHCP4_BUFFER_WAIT_SIGNAL; -extern const isc::log::MessageID DHCP4_CB_FETCH_UPDATES_FAIL; -extern const isc::log::MessageID DHCP4_CB_FETCH_UPDATES_RETRIES_EXHAUSTED; -extern const isc::log::MessageID DHCP4_CB_PULL_FAIL; +extern const isc::log::MessageID DHCP4_CB_PERIODIC_FETCH_UPDATES_FAIL; +extern const isc::log::MessageID DHCP4_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED; +extern const isc::log::MessageID DHCP4_CB_PULL_FETCH_UPDATES_FAIL; extern const isc::log::MessageID DHCP4_CLASS_ASSIGNED; extern const isc::log::MessageID DHCP4_CLASS_UNCONFIGURED; extern const isc::log::MessageID DHCP4_CLASS_UNDEFINED; diff --git a/src/bin/dhcp4/dhcp4_messages.mes b/src/bin/dhcp4/dhcp4_messages.mes index d88d26cf92..1fc6c19d4f 100644 --- a/src/bin/dhcp4/dhcp4_messages.mes +++ b/src/bin/dhcp4/dhcp4_messages.mes @@ -46,23 +46,23 @@ by the process. The signal will be handled before the server starts waiting for next packets. The argument specifies the next signal to be handled by the server. -% DHCP4_CB_FETCH_UPDATES_FAIL error on attempt to fetch configuration updates from the configuration backend(s): %1 +% DHCP4_CB_PERIODIC_FETCH_UPDATES_FAIL error on periodic attempt to fetch configuration updates from the configuration backend(s): %1 This error message is issued when the server attempted to fetch -configuration updates from the database and this attempt failed. +configuration updates from the database and this periodic attempt failed. The server will re-try according to the configured value of the config-fetch-wait-time parameter. The sole argument contains the reason for failure. -% DHCP4_CB_FETCH_UPDATES_RETRIES_EXHAUSTED maximum number of configuration fetch attempts: 10, has been exhausted without success +% DHCP4_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED maximum number of configuration fetch attempts: 10, has been exhausted without success This error indicates that the server has made a number of unsuccessful -attempts to fetch configuration updates from a configuration backend. +periodic attempts to fetch configuration updates from a configuration backend. The server will continue to operate but won't make any further attempts to fetch configuration updates. The administrator must fix the configuration in the database and reload (or restart) the server. -% DHCP4_CB_PULL_FAIL error on pull configuration updates from the configuration backend(s): %1 -This error message is issued when the server attempted to pull -configuration updates from the database and this attempt failed. +% DHCP4_CB_PULL_FETCH_UPDATES_FAIL error on pull attempt to fetch configuration updates from the configuration backend(s): %1 +This error message is issued when the server attempted to fetch +configuration updates from the database and this pull attempt failed. The sole argument which is returned to the config-backend-pull command caller too contains the reason for failure. diff --git a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc index 3e78609c38..029055ac3d 100644 --- a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc @@ -479,13 +479,13 @@ TEST_F(CtrlChannelDhcpv4SrvTest, commandsRegistration) { EXPECT_TRUE(command_list.find("\"list-commands\"") != string::npos); EXPECT_TRUE(command_list.find("\"build-report\"") != string::npos); + EXPECT_TRUE(command_list.find("\"config-backend-pull\"") != string::npos); EXPECT_TRUE(command_list.find("\"config-get\"") != string::npos); EXPECT_TRUE(command_list.find("\"config-set\"") != string::npos); EXPECT_TRUE(command_list.find("\"config-write\"") != string::npos); EXPECT_TRUE(command_list.find("\"leases-reclaim\"") != string::npos); EXPECT_TRUE(command_list.find("\"libreload\"") != string::npos); EXPECT_TRUE(command_list.find("\"server-tag-get\"") != string::npos); - EXPECT_TRUE(command_list.find("\"config-backend-pull\"") != string::npos); EXPECT_TRUE(command_list.find("\"shutdown\"") != string::npos); EXPECT_TRUE(command_list.find("\"statistic-get\"") != string::npos); EXPECT_TRUE(command_list.find("\"statistic-get-all\"") != string::npos); @@ -1149,6 +1149,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, listCommands) { // We expect the server to report at least the following commands: checkListCommands(rsp, "build-report"); + checkListCommands(rsp, "config-backend-pull"); checkListCommands(rsp, "config-get"); checkListCommands(rsp, "config-reload"); checkListCommands(rsp, "config-set"); @@ -1159,7 +1160,6 @@ TEST_F(CtrlChannelDhcpv4SrvTest, listCommands) { checkListCommands(rsp, "libreload"); checkListCommands(rsp, "version-get"); checkListCommands(rsp, "server-tag-get"); - checkListCommands(rsp, "config-backend-pull"); checkListCommands(rsp, "shutdown"); checkListCommands(rsp, "statistic-get"); checkListCommands(rsp, "statistic-get-all"); diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.cc b/src/bin/dhcp6/ctrl_dhcp6_srv.cc index 9f86128b48..13093ddf5d 100644 --- a/src/bin/dhcp6/ctrl_dhcp6_srv.cc +++ b/src/bin/dhcp6/ctrl_dhcp6_srv.cc @@ -545,8 +545,8 @@ ControlledDhcpv6Srv::commandServerTagGetHandler(const std::string&, } ConstElementPtr -ControlledDhcpv6Srv::commandServerUpdateHandler(const std::string&, - ConstElementPtr) { +ControlledDhcpv6Srv::commandConfigBackendPullHandler(const std::string&, + ConstElementPtr) { auto ctl_info = CfgMgr::instance().getCurrentCfg()->getConfigControlInfo(); if (!ctl_info) { return (createAnswer(CONTROL_RESULT_EMPTY, "No config backend.")); @@ -564,8 +564,7 @@ ControlledDhcpv6Srv::commandServerUpdateHandler(const std::string&, auto mode = CBControlDHCPv6::FetchMode::FETCH_UPDATE; server_->getCBControl()->databaseConfigFetch(srv_cfg, mode); } catch (const std::exception& ex) { - LOG_ERROR(dhcp6_logger, DHCP6_CB_FETCH_UPDATES_FAIL) - .arg("server-update command") + LOG_ERROR(dhcp6_logger, DHCP6_CB_PULL_FETCH_UPDATES_FAIL) .arg(ex.what()); return (createAnswer(CONTROL_RESULT_ERROR, "Server update failed: " + string(ex.what()))); @@ -630,8 +629,8 @@ ControlledDhcpv6Srv::processCommand(const std::string& command, } else if (command == "server-tag-get") { return (srv->commandServerTagGetHandler(command, args)); - } else if (command == "server-update") { - return (srv->commandServerUpdateHandler(command, args)); + } else if (command == "config-backend-pull") { + return (srv->commandConfigBackendPullHandler(command, args)); } @@ -859,6 +858,9 @@ ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t server_port, CommandMgr::instance().registerCommand("build-report", boost::bind(&ControlledDhcpv6Srv::commandBuildReportHandler, this, _1, _2)); + CommandMgr::instance().registerCommand("config-backend-pull", + boost::bind(&ControlledDhcpv6Srv::commandConfigBackendPullHandler, this, _1, _2)); + CommandMgr::instance().registerCommand("config-get", boost::bind(&ControlledDhcpv6Srv::commandConfigGetHandler, this, _1, _2)); @@ -883,9 +885,6 @@ ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t server_port, CommandMgr::instance().registerCommand("server-tag-get", boost::bind(&ControlledDhcpv6Srv::commandServerTagGetHandler, this, _1, _2)); - CommandMgr::instance().registerCommand("server-update", - boost::bind(&ControlledDhcpv6Srv::commandServerUpdateHandler, this, _1, _2)); - CommandMgr::instance().registerCommand("libreload", boost::bind(&ControlledDhcpv6Srv::commandLibReloadHandler, this, _1, _2)); @@ -950,6 +949,7 @@ ControlledDhcpv6Srv::~ControlledDhcpv6Srv() { // Deregister any registered commands (please keep in alphabetic order) CommandMgr::instance().deregisterCommand("build-report"); + CommandMgr::instance().deregisterCommand("config-backend-pull"); CommandMgr::instance().deregisterCommand("config-get"); CommandMgr::instance().deregisterCommand("config-set"); CommandMgr::instance().deregisterCommand("config-reload"); @@ -960,7 +960,6 @@ ControlledDhcpv6Srv::~ControlledDhcpv6Srv() { CommandMgr::instance().deregisterCommand("leases-reclaim"); CommandMgr::instance().deregisterCommand("libreload"); CommandMgr::instance().deregisterCommand("server-tag-get"); - CommandMgr::instance().deregisterCommand("server-update"); CommandMgr::instance().deregisterCommand("shutdown"); CommandMgr::instance().deregisterCommand("statistic-get"); CommandMgr::instance().deregisterCommand("statistic-get-all"); @@ -1095,7 +1094,7 @@ ControlledDhcpv6Srv::cbFetchUpdates(const SrvConfigPtr& srv_cfg, (*failure_count) = 0; } catch (const std::exception& ex) { - LOG_ERROR(dhcp6_logger, DHCP6_CB_FETCH_UPDATES_FAIL) + LOG_ERROR(dhcp6_logger, DHCP6_CB_PERIODIC_FETCH_UPDATES_FAIL) .arg("periodic poll") .arg(ex.what()); @@ -1103,7 +1102,8 @@ ControlledDhcpv6Srv::cbFetchUpdates(const SrvConfigPtr& srv_cfg, // making further attempts to fetch the configuration updates. // Let's return without re-scheduling the timer. if (++(*failure_count) > 10) { - LOG_ERROR(dhcp6_logger, DHCP6_CB_FETCH_UPDATES_RETRIES_EXHAUSTED); + LOG_ERROR(dhcp6_logger, + DHCP6_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED); return; } } diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.h b/src/bin/dhcp6/ctrl_dhcp6_srv.h index 0be001c30e..fbe7252337 100644 --- a/src/bin/dhcp6/ctrl_dhcp6_srv.h +++ b/src/bin/dhcp6/ctrl_dhcp6_srv.h @@ -303,9 +303,9 @@ private: commandServerTagGetHandler(const std::string& command, isc::data::ConstElementPtr args); - /// @brief handler for server-update command + /// @brief handler for config-backend-pull command /// - /// This method handles the server-update command, which updates + /// This method handles the config-backend-pull command, which updates /// the server configuration from the Config Backends immediately. /// /// @param command (parameter ignored) @@ -313,8 +313,8 @@ private: /// /// @return status of the command/ isc::data::ConstElementPtr - commandServerUpdateHandler(const std::string& command, - isc::data::ConstElementPtr args); + commandConfigBackendPullHandler(const std::string& command, + isc::data::ConstElementPtr args); /// @brief Reclaims expired IPv6 leases and reschedules timer. /// diff --git a/src/bin/dhcp6/dhcp6_messages.cc b/src/bin/dhcp6/dhcp6_messages.cc index 1c47f130c6..3c5fc074e9 100644 --- a/src/bin/dhcp6/dhcp6_messages.cc +++ b/src/bin/dhcp6/dhcp6_messages.cc @@ -1,4 +1,4 @@ -// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Fri Oct 25 2019 16:41 +// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Fri Oct 25 2019 22:42 #include #include @@ -14,8 +14,9 @@ extern const isc::log::MessageID DHCP6_ALREADY_RUNNING = "DHCP6_ALREADY_RUNNING" extern const isc::log::MessageID DHCP6_BUFFER_RECEIVED = "DHCP6_BUFFER_RECEIVED"; extern const isc::log::MessageID DHCP6_BUFFER_UNPACK = "DHCP6_BUFFER_UNPACK"; extern const isc::log::MessageID DHCP6_BUFFER_WAIT_SIGNAL = "DHCP6_BUFFER_WAIT_SIGNAL"; -extern const isc::log::MessageID DHCP6_CB_FETCH_UPDATES_FAIL = "DHCP6_CB_FETCH_UPDATES_FAIL"; -extern const isc::log::MessageID DHCP6_CB_FETCH_UPDATES_RETRIES_EXHAUSTED = "DHCP6_CB_FETCH_UPDATES_RETRIES_EXHAUSTED"; +extern const isc::log::MessageID DHCP6_CB_PERIODIC_FETCH_UPDATES_FAIL = "DHCP6_CB_PERIODIC_FETCH_UPDATES_FAIL"; +extern const isc::log::MessageID DHCP6_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED = "DHCP6_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED"; +extern const isc::log::MessageID DHCP6_CB_PULL_FETCH_UPDATES_FAIL = "DHCP6_CB_PULL_FETCH_UPDATES_FAIL"; extern const isc::log::MessageID DHCP6_CLASS_ASSIGNED = "DHCP6_CLASS_ASSIGNED"; extern const isc::log::MessageID DHCP6_CLASS_UNCONFIGURED = "DHCP6_CLASS_UNCONFIGURED"; extern const isc::log::MessageID DHCP6_CLASS_UNDEFINED = "DHCP6_CLASS_UNDEFINED"; @@ -157,8 +158,9 @@ const char* values[] = { "DHCP6_BUFFER_RECEIVED", "received buffer from %1:%2 to %3:%4 over interface %5", "DHCP6_BUFFER_UNPACK", "parsing buffer received from %1 to %2 over interface %3", "DHCP6_BUFFER_WAIT_SIGNAL", "signal received while waiting for next packet, next waiting signal is %1", - "DHCP6_CB_FETCH_UPDATES_FAIL", "error on attempt to fetch configuration updates from the configuration backend(s): %1", - "DHCP6_CB_FETCH_UPDATES_RETRIES_EXHAUSTED", "maximum number of configuration fetch attempts: 10, has been exhausted without success", + "DHCP6_CB_PERIODIC_FETCH_UPDATES_FAIL", "error on periodic attempt to fetch configuration updates from the configuration backend(s): %1", + "DHCP6_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED", "maximum number of configuration fetch attempts: 10, has been exhausted without success", + "DHCP6_CB_PULL_FETCH_UPDATES_FAIL", "error on pull attempt to fetch configuration updates from the configuration backend(s): %1", "DHCP6_CLASS_ASSIGNED", "%1: client packet has been assigned to the following class(es): %2", "DHCP6_CLASS_UNCONFIGURED", "%1: client packet belongs to an unconfigured class: %2", "DHCP6_CLASS_UNDEFINED", "required class %1 has no definition", diff --git a/src/bin/dhcp6/dhcp6_messages.h b/src/bin/dhcp6/dhcp6_messages.h index c5a99b6e5b..3d708d369f 100644 --- a/src/bin/dhcp6/dhcp6_messages.h +++ b/src/bin/dhcp6/dhcp6_messages.h @@ -1,4 +1,4 @@ -// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Fri Oct 25 2019 16:41 +// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Fri Oct 25 2019 22:42 #ifndef DHCP6_MESSAGES_H #define DHCP6_MESSAGES_H @@ -15,8 +15,9 @@ extern const isc::log::MessageID DHCP6_ALREADY_RUNNING; extern const isc::log::MessageID DHCP6_BUFFER_RECEIVED; extern const isc::log::MessageID DHCP6_BUFFER_UNPACK; extern const isc::log::MessageID DHCP6_BUFFER_WAIT_SIGNAL; -extern const isc::log::MessageID DHCP6_CB_FETCH_UPDATES_FAIL; -extern const isc::log::MessageID DHCP6_CB_FETCH_UPDATES_RETRIES_EXHAUSTED; +extern const isc::log::MessageID DHCP6_CB_PERIODIC_FETCH_UPDATES_FAIL; +extern const isc::log::MessageID DHCP6_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED; +extern const isc::log::MessageID DHCP6_CB_PULL_FETCH_UPDATES_FAIL; extern const isc::log::MessageID DHCP6_CLASS_ASSIGNED; extern const isc::log::MessageID DHCP6_CLASS_UNCONFIGURED; extern const isc::log::MessageID DHCP6_CLASS_UNDEFINED; diff --git a/src/bin/dhcp6/dhcp6_messages.mes b/src/bin/dhcp6/dhcp6_messages.mes index d6e08f49ab..304a1c68f6 100644 --- a/src/bin/dhcp6/dhcp6_messages.mes +++ b/src/bin/dhcp6/dhcp6_messages.mes @@ -53,22 +53,26 @@ by the process. The signal will be handled before the server starts waiting for next packets. The argument specifies the next signal to be handled by the server. -% DHCP6_CB_FETCH_UPDATES_FAIL error on attempt to fetch configuration updates from the configuration backend(s): %1 +% DHCP6_CB_PERIODIC_FETCH_UPDATES_FAIL error on periodic attempt to fetch configuration updates from the configuration backend(s): %1 This error message is issued when the server attempted to fetch -configuration updates from the database and this attempt failed. -If the error happens during periodic poll, the server will re-try -according to the configured value of the config-fetch-wait-time -parameter. The arguments contain the fetch context, i.e. during -periodic poll or by the server-update command, and the reason for -failure. - -% DHCP6_CB_FETCH_UPDATES_RETRIES_EXHAUSTED maximum number of configuration fetch attempts: 10, has been exhausted without success +configuration updates from the database and this periodic attempt failed. +The server will re-try according to the configured value of the +config-fetch-wait-time parameter. The sole argument contains the +reason for failure. + +% DHCP6_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED maximum number of configuration fetch attempts: 10, has been exhausted without success This error indicates that the server has made a number of unsuccessful -attempts to fetch configuration updates from a configuration backend. +periodic attempts to fetch configuration updates from a configuration backend. The server will continue to operate but won't make any further attempts to fetch configuration updates. The administrator must fix the configuration in the database and reload (or restart) the server. +% DHCP6_CB_PULL_FETCH_UPDATES_FAIL error on pull attempt to fetch configuration updates from the configuration backend(s): %1 +This error message is issued when the server attempted to fetch +configuration updates from the database and this pull attempt failed. +The sole argument which is returned to the config-backend-pull command +caller too contains the reason for failure. + % DHCP6_CLASS_ASSIGNED %1: client packet has been assigned to the following class(es): %2 This debug message informs that incoming packet has been assigned to specified class or classes. This is a normal behavior and indicates successful operation. diff --git a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc index 06fcbba27a..44890b1b2c 100644 --- a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc +++ b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc @@ -498,13 +498,13 @@ TEST_F(CtrlDhcpv6SrvTest, commandsRegistration) { EXPECT_TRUE(command_list.find("\"list-commands\"") != string::npos); EXPECT_TRUE(command_list.find("\"build-report\"") != string::npos); + EXPECT_TRUE(command_list.find("\"config-backend-pull\"") != string::npos); EXPECT_TRUE(command_list.find("\"config-get\"") != string::npos); EXPECT_TRUE(command_list.find("\"config-set\"") != string::npos); EXPECT_TRUE(command_list.find("\"config-write\"") != string::npos); EXPECT_TRUE(command_list.find("\"leases-reclaim\"") != string::npos); EXPECT_TRUE(command_list.find("\"libreload\"") != string::npos); EXPECT_TRUE(command_list.find("\"server-tag-get\"") != string::npos); - EXPECT_TRUE(command_list.find("\"server-update\"") != string::npos); EXPECT_TRUE(command_list.find("\"shutdown\"") != string::npos); EXPECT_TRUE(command_list.find("\"statistic-get\"") != string::npos); EXPECT_TRUE(command_list.find("\"statistic-get-all\"") != string::npos); @@ -938,15 +938,15 @@ TEST_F(CtrlChannelDhcpv6SrvTest, serverTagGet) { expected = "{ \"arguments\": { \"server-tag\": \"foobar\" }, \"result\": 0 }"; } -// This test verifies that the DHCP server handles server-update command -TEST_F(CtrlChannelDhcpv6SrvTest, serverUpdate) { +// This test verifies that the DHCP server handles config-backend-pull command +TEST_F(CtrlChannelDhcpv6SrvTest, configBackendPull) { createUnixChannelServer(); std::string response; std::string expected; - // Send the server-update command. Note there is no configured backed. - sendUnixCommand("{ \"command\": \"server-update\" }", response); + // Send the config-backend-pull command. Note there is no configured backed. + sendUnixCommand("{ \"command\": \"config-backend-pull\" }", response); expected = "{ \"result\": 3, \"text\": \"No config backend.\" }"; EXPECT_EQ(expected, response); } @@ -1180,6 +1180,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, listCommands) { // We expect the server to report at least the following commands: checkListCommands(rsp, "build-report"); + checkListCommands(rsp, "config-backend-pull"); checkListCommands(rsp, "config-get"); checkListCommands(rsp, "config-reload"); checkListCommands(rsp, "config-set"); @@ -1190,7 +1191,6 @@ TEST_F(CtrlChannelDhcpv6SrvTest, listCommands) { checkListCommands(rsp, "libreload"); checkListCommands(rsp, "version-get"); checkListCommands(rsp, "server-tag-get"); - checkListCommands(rsp, "server-update"); checkListCommands(rsp, "shutdown"); checkListCommands(rsp, "statistic-get"); checkListCommands(rsp, "statistic-get-all"); diff --git a/src/bin/dhcp6/tests/kea_controller_unittest.cc b/src/bin/dhcp6/tests/kea_controller_unittest.cc index 6eebbe68ab..7837afc27a 100644 --- a/src/bin/dhcp6/tests/kea_controller_unittest.cc +++ b/src/bin/dhcp6/tests/kea_controller_unittest.cc @@ -257,7 +257,7 @@ public: EXPECT_EQ(cb_control->getDatabaseConfigFetchCalls(), 1); ConstElementPtr result = - ControlledDhcpv6Srv::processCommand("server-update", + ControlledDhcpv6Srv::processCommand("config-backend-pull", ConstElementPtr()); EXPECT_EQ(cb_control->getDatabaseConfigFetchCalls(), 2); std::string expected; @@ -878,20 +878,20 @@ TEST_F(JSONFileBackendTest, configBackendTimerWithThrow) { testConfigBackendTimer(1, true); } -// This test verifies that the server will be updated by the server-update -// command. +// This test verifies that the server will be updated by the +// config-backend-pull command. TEST_F(JSONFileBackendTest, configBackendCommand) { testConfigBackendTimer(0, false, true); } -// This test verifies that the server will be updated by the server-update -// command even when updates fail. +// This test verifies that the server will be updated by the +// config-backend-pull command even when updates fail. TEST_F(JSONFileBackendTest, configBackendCommandWithThrow) { testConfigBackendTimer(0, true, true); } -// This test verifies that the server will be updated by the server-update -// command and the timer rescheduled. +// This test verifies that the server will be updated by the +// config-backend-pull command and the timer rescheduled. TEST_F(JSONFileBackendTest, configBackendCommandWithTimer) { testConfigBackendTimer(1, false, true); }