mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 22:15:23 +00:00
[#3435] add exception handling for module changes
This commit is contained in:
@@ -440,15 +440,21 @@ NetconfAgent::subscribeToDataChanges(const CfgServersMapPair& service_pair) {
|
|||||||
Event event,
|
Event event,
|
||||||
uint32_t request_id) {
|
uint32_t request_id) {
|
||||||
NetconfAgentCallback agent(service_pair);
|
NetconfAgentCallback agent(service_pair);
|
||||||
return agent.module_change(session, subscription_id, module_name, sub_xpath, event, request_id);
|
return agent.module_change(session, subscription_id, module_name, sub_xpath, event,
|
||||||
|
request_id);
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
SubscribeOptions options(SubscribeOptions::Default);
|
SubscribeOptions options(SubscribeOptions::Default);
|
||||||
if (!configuration->getValidateChanges()) {
|
if (!configuration->getValidateChanges()) {
|
||||||
options = options | SubscribeOptions::DoneOnly;
|
options = options | SubscribeOptions::DoneOnly;
|
||||||
}
|
}
|
||||||
|
auto exception_handler = [model](std::exception& ex) {
|
||||||
|
LOG_ERROR(netconf_logger, NETCONF_MODULE_CHANGE_INTERNAL_ERROR)
|
||||||
|
.arg(model)
|
||||||
|
.arg(ex.what());
|
||||||
|
};
|
||||||
Subscription subscription(
|
Subscription subscription(
|
||||||
running_sess_->onModuleChange(model, callback, nullopt, 0, options));
|
running_sess_->onModuleChange(model, callback, nullopt, 0, options, exception_handler));
|
||||||
subscriptions_.emplace(server, std::forward<Subscription>(subscription));
|
subscriptions_.emplace(server, std::forward<Subscription>(subscription));
|
||||||
} catch (exception const& ex) {
|
} catch (exception const& ex) {
|
||||||
ostringstream msg;
|
ostringstream msg;
|
||||||
@@ -484,7 +490,8 @@ NetconfAgent::subscribeToNotifications(const CfgServersMapPair& service_pair) {
|
|||||||
optional<DataNode> const notification_tree,
|
optional<DataNode> const notification_tree,
|
||||||
NotificationTimeStamp const timestamp) {
|
NotificationTimeStamp const timestamp) {
|
||||||
NetconfAgentCallback agent(service_pair);
|
NetconfAgentCallback agent(service_pair);
|
||||||
return agent.event_notif(session, subscription_id, notification_type, notification_tree, timestamp);
|
return agent.event_notif(session, subscription_id, notification_type, notification_tree,
|
||||||
|
timestamp);
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
Subscription subscription(running_sess_->onNotification(model, callback));
|
Subscription subscription(running_sess_->onNotification(model, callback));
|
||||||
|
@@ -18,6 +18,7 @@ extern const isc::log::MessageID NETCONF_GET_CONFIG = "NETCONF_GET_CONFIG";
|
|||||||
extern const isc::log::MessageID NETCONF_GET_CONFIG_FAILED = "NETCONF_GET_CONFIG_FAILED";
|
extern const isc::log::MessageID NETCONF_GET_CONFIG_FAILED = "NETCONF_GET_CONFIG_FAILED";
|
||||||
extern const isc::log::MessageID NETCONF_GET_CONFIG_STARTED = "NETCONF_GET_CONFIG_STARTED";
|
extern const isc::log::MessageID NETCONF_GET_CONFIG_STARTED = "NETCONF_GET_CONFIG_STARTED";
|
||||||
extern const isc::log::MessageID NETCONF_LOG_CHANGE_FAIL = "NETCONF_LOG_CHANGE_FAIL";
|
extern const isc::log::MessageID NETCONF_LOG_CHANGE_FAIL = "NETCONF_LOG_CHANGE_FAIL";
|
||||||
|
extern const isc::log::MessageID NETCONF_MODULE_CHANGE_INTERNAL_ERROR = "NETCONF_MODULE_CHANGE_INTERNAL_ERROR";
|
||||||
extern const isc::log::MessageID NETCONF_MODULE_MISSING_ERR = "NETCONF_MODULE_MISSING_ERR";
|
extern const isc::log::MessageID NETCONF_MODULE_MISSING_ERR = "NETCONF_MODULE_MISSING_ERR";
|
||||||
extern const isc::log::MessageID NETCONF_MODULE_MISSING_WARN = "NETCONF_MODULE_MISSING_WARN";
|
extern const isc::log::MessageID NETCONF_MODULE_MISSING_WARN = "NETCONF_MODULE_MISSING_WARN";
|
||||||
extern const isc::log::MessageID NETCONF_MODULE_REVISION_ERR = "NETCONF_MODULE_REVISION_ERR";
|
extern const isc::log::MessageID NETCONF_MODULE_REVISION_ERR = "NETCONF_MODULE_REVISION_ERR";
|
||||||
@@ -59,6 +60,7 @@ const char* values[] = {
|
|||||||
"NETCONF_GET_CONFIG_FAILED", "getting configuration from %1 server failed: %2",
|
"NETCONF_GET_CONFIG_FAILED", "getting configuration from %1 server failed: %2",
|
||||||
"NETCONF_GET_CONFIG_STARTED", "getting configuration from %1 server",
|
"NETCONF_GET_CONFIG_STARTED", "getting configuration from %1 server",
|
||||||
"NETCONF_LOG_CHANGE_FAIL", "NETCONF configuration change logging failed: %1",
|
"NETCONF_LOG_CHANGE_FAIL", "NETCONF configuration change logging failed: %1",
|
||||||
|
"NETCONF_MODULE_CHANGE_INTERNAL_ERROR", "an internal error occurred while processing changes for module %1: %2",
|
||||||
"NETCONF_MODULE_MISSING_ERR", "Missing essential module %1 in sysrepo",
|
"NETCONF_MODULE_MISSING_ERR", "Missing essential module %1 in sysrepo",
|
||||||
"NETCONF_MODULE_MISSING_WARN", "Missing module %1 in sysrepo",
|
"NETCONF_MODULE_MISSING_WARN", "Missing module %1 in sysrepo",
|
||||||
"NETCONF_MODULE_REVISION_ERR", "Essential module %1 does NOT have the right revision: expected %2, got %3",
|
"NETCONF_MODULE_REVISION_ERR", "Essential module %1 does NOT have the right revision: expected %2, got %3",
|
||||||
|
@@ -19,6 +19,7 @@ extern const isc::log::MessageID NETCONF_GET_CONFIG;
|
|||||||
extern const isc::log::MessageID NETCONF_GET_CONFIG_FAILED;
|
extern const isc::log::MessageID NETCONF_GET_CONFIG_FAILED;
|
||||||
extern const isc::log::MessageID NETCONF_GET_CONFIG_STARTED;
|
extern const isc::log::MessageID NETCONF_GET_CONFIG_STARTED;
|
||||||
extern const isc::log::MessageID NETCONF_LOG_CHANGE_FAIL;
|
extern const isc::log::MessageID NETCONF_LOG_CHANGE_FAIL;
|
||||||
|
extern const isc::log::MessageID NETCONF_MODULE_CHANGE_INTERNAL_ERROR;
|
||||||
extern const isc::log::MessageID NETCONF_MODULE_MISSING_ERR;
|
extern const isc::log::MessageID NETCONF_MODULE_MISSING_ERR;
|
||||||
extern const isc::log::MessageID NETCONF_MODULE_MISSING_WARN;
|
extern const isc::log::MessageID NETCONF_MODULE_MISSING_WARN;
|
||||||
extern const isc::log::MessageID NETCONF_MODULE_REVISION_ERR;
|
extern const isc::log::MessageID NETCONF_MODULE_REVISION_ERR;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2012-2023 Internet Systems Consortium, Inc. ("ISC")
|
# Copyright (C) 2012-2024 Internet Systems Consortium, Inc. ("ISC")
|
||||||
#
|
#
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
# 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
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
@@ -56,6 +56,11 @@ configuration from a Kea server.
|
|||||||
The warning message indicates that the configuration change logging
|
The warning message indicates that the configuration change logging
|
||||||
encountered an unexpected condition. Details of it will be logged.
|
encountered an unexpected condition. Details of it will be logged.
|
||||||
|
|
||||||
|
% NETCONF_MODULE_CHANGE_INTERNAL_ERROR an internal error occurred while processing changes for module %1: %2
|
||||||
|
The error message indicates that kea-netconf got an error while sysrepo was processing modules changes.
|
||||||
|
This usually follows a config validation failure, and can be recovered from.
|
||||||
|
The name of the module and the internal error message are printed.
|
||||||
|
|
||||||
% NETCONF_MODULE_MISSING_ERR Missing essential module %1 in sysrepo
|
% NETCONF_MODULE_MISSING_ERR Missing essential module %1 in sysrepo
|
||||||
This fatal error message indicates that a module required by Netconf
|
This fatal error message indicates that a module required by Netconf
|
||||||
configuration is not available in the sysrepo repository. The name of
|
configuration is not available in the sysrepo repository. The name of
|
||||||
|
Reference in New Issue
Block a user