summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Pavel <andrei@isc.org>2022-11-08 10:18:28 +0100
committerRazvan Becheriu <razvan@isc.org>2022-11-25 17:15:33 +0100
commite4e9d0e362781d405246287c556c1165949a2dd0 (patch)
tree362df1cdadf94035b3221350f335e683e0981f9b
parent[#2601] remove std:: prefix from .cc files (diff)
downloadkea-e4e9d0e362781d405246287c556c1165949a2dd0.tar.xz
kea-e4e9d0e362781d405246287c556c1165949a2dd0.zip
[#2601] fix doxygen and add override final
-rw-r--r--src/bin/netconf/http_control_socket.h10
-rw-r--r--src/bin/netconf/netconf_cfg_mgr.h13
-rw-r--r--src/bin/netconf/netconf_config.h4
-rw-r--r--src/bin/netconf/netconf_controller.h4
-rw-r--r--src/bin/netconf/netconf_process.h12
-rw-r--r--src/bin/netconf/stdout_control_socket.h10
-rw-r--r--src/bin/netconf/tests/control_socket_unittests.cc9
-rw-r--r--src/bin/netconf/unix_control_socket.h10
-rw-r--r--src/lib/yang/translator.cc4
-rw-r--r--src/lib/yang/translator.h33
10 files changed, 52 insertions, 57 deletions
diff --git a/src/bin/netconf/http_control_socket.h b/src/bin/netconf/http_control_socket.h
index b63022c7e0..6bc83a66f0 100644
--- a/src/bin/netconf/http_control_socket.h
+++ b/src/bin/netconf/http_control_socket.h
@@ -37,7 +37,7 @@ public:
/// @param service The target service.
/// @return The JSON element answer of config-get.
/// @throw ControlSocketError when a communication error occurs.
- virtual data::ConstElementPtr configGet(const std::string& service);
+ data::ConstElementPtr configGet(const std::string& service) override final;
/// @brief Test configuration.
///
@@ -47,8 +47,8 @@ public:
/// @param service The target service.
/// @return The JSON element answer of config-test.
/// @throw ControlSocketError when a communication error occurs.
- virtual data::ConstElementPtr configTest(data::ConstElementPtr config,
- const std::string& service);
+ data::ConstElementPtr configTest(data::ConstElementPtr config,
+ const std::string& service) override final;
/// @brief Set configuration.
///
@@ -58,8 +58,8 @@ public:
/// @param service The target service.
/// @return The JSON element answer of config-set.
/// @throw ControlSocketError when a communication error occurs.
- virtual data::ConstElementPtr configSet(data::ConstElementPtr config,
- const std::string& service);
+ data::ConstElementPtr configSet(data::ConstElementPtr config,
+ const std::string& service) override final;
private:
/// @brief Perform the actual communication.
diff --git a/src/bin/netconf/netconf_cfg_mgr.h b/src/bin/netconf/netconf_cfg_mgr.h
index c7568d4094..3a9f472a3b 100644
--- a/src/bin/netconf/netconf_cfg_mgr.h
+++ b/src/bin/netconf/netconf_cfg_mgr.h
@@ -90,7 +90,7 @@ public:
///
/// @return a pointer to a configuration which can be parsed into
/// the initial configuration object
- virtual isc::data::ElementPtr toElement() const;
+ isc::data::ElementPtr toElement() const override final;
private:
@@ -142,25 +142,24 @@ public:
/// to be returned. This parameter is ignored for Netconf.
///
/// @return Summary of the configuration in the textual format.
- virtual std::string getConfigSummary(const uint32_t selection);
+ std::string getConfigSummary(const uint32_t selection) override final;
/// @brief Return a list of all paths that contain passwords or secrets for
/// kea-netconf.
///
/// @return the list of lists of sequential JSON map keys needed to reach
/// the passwords and secrets.
- std::list<std::list<std::string>> jsonPathsToRedact() const;
+ std::list<std::list<std::string>> jsonPathsToRedact() const override final;
protected:
-
/// @brief Parses configuration of Netconf.
///
/// @param config Pointer to a configuration specified for netconf.
/// @param check_only Boolean flag indicating if this method should
/// only verify correctness of the provided configuration.
/// @return Pointer to a result of configuration parsing.
- virtual isc::data::ConstElementPtr
- parse(isc::data::ConstElementPtr config, bool check_only);
+ isc::data::ConstElementPtr
+ parse(isc::data::ConstElementPtr config, bool check_only) override final;
/// @brief Creates a new, blank NetconfConfig context.
///
@@ -172,7 +171,7 @@ protected:
/// error.
///
/// @return Returns a ConfigPtr to the new context instance.
- virtual process::ConfigPtr createNewContext();
+ process::ConfigPtr createNewContext() override final;
}; // NetconfCfgMgr
/// @brief Defines a shared pointer to NetconfCfgMgr.
diff --git a/src/bin/netconf/netconf_config.h b/src/bin/netconf/netconf_config.h
index 8671c07503..b4f6339c88 100644
--- a/src/bin/netconf/netconf_config.h
+++ b/src/bin/netconf/netconf_config.h
@@ -127,7 +127,7 @@ public:
/// @brief Unparse a configuration object
///
/// @return a pointer to a configuration
- virtual isc::data::ElementPtr toElement() const;
+ isc::data::ElementPtr toElement() const override final;
private:
/// @brief The socket type.
@@ -234,7 +234,7 @@ public:
/// @brief Unparse a configuration object
///
/// @return a pointer to a configuration
- virtual isc::data::ElementPtr toElement() const;
+ isc::data::ElementPtr toElement() const override final;
private:
/// @brief The model name.
diff --git a/src/bin/netconf/netconf_controller.h b/src/bin/netconf/netconf_controller.h
index 02d4f3f776..6bbc4e091d 100644
--- a/src/bin/netconf/netconf_controller.h
+++ b/src/bin/netconf/netconf_controller.h
@@ -56,7 +56,7 @@ public:
/// This method ignores SIGHUP as configuration reloading is not yet
/// supported.
/// @param signum signal number to process.
- virtual void processSignal(int signum);
+ void processSignal(int signum) override final;
private:
@@ -69,7 +69,7 @@ private:
/// Note the caller is responsible for destructing the process. This
/// is handled by the base class, which wraps this pointer with a smart
/// pointer.
- virtual process::DProcessBase* createProcess();
+ process::DProcessBase* createProcess() override final;
/// @brief Constructor is declared private to maintain the integrity of
/// the singleton instance.
diff --git a/src/bin/netconf/netconf_process.h b/src/bin/netconf/netconf_process.h
index 302f33c1a9..0c8b6ce702 100644
--- a/src/bin/netconf/netconf_process.h
+++ b/src/bin/netconf/netconf_process.h
@@ -42,12 +42,12 @@ public:
/// as a place to perform any derivation-specific initialization steps
/// that are inappropriate for the constructor but necessary prior to
/// launch.
- virtual void init();
+ void init() override final;
/// @brief Implements the process's event loop.
///
/// @throw DProcessBaseError if an operational error is encountered.
- virtual void run();
+ void run() override final;
/// @brief Initiates the process's shutdown process.
///
@@ -62,8 +62,8 @@ public:
/// non-zero means failure), and a string explanation of the outcome.
///
/// @throw DProcessBaseError if an operational error is encountered.
- virtual isc::data::ConstElementPtr
- shutdown(isc::data::ConstElementPtr args);
+ isc::data::ConstElementPtr
+ shutdown(isc::data::ConstElementPtr args) override final;
/// @brief Processes the given configuration.
///
@@ -78,9 +78,9 @@ public:
/// @return an Element that contains the results of configuration composed
/// of an integer status value (0 means successful, non-zero means failure),
/// and a string explanation of the outcome.
- virtual isc::data::ConstElementPtr
+ isc::data::ConstElementPtr
configure(isc::data::ConstElementPtr config_set,
- bool check_only = false);
+ bool check_only = false) override final;
/// @brief Returns a pointer to the configuration manager.
NetconfCfgMgrPtr getNetconfCfgMgr();
diff --git a/src/bin/netconf/stdout_control_socket.h b/src/bin/netconf/stdout_control_socket.h
index 79a8a45fad..78eca2984d 100644
--- a/src/bin/netconf/stdout_control_socket.h
+++ b/src/bin/netconf/stdout_control_socket.h
@@ -40,7 +40,7 @@ public:
/// @param service The target service (ignored).
/// @return The JSON element answer of config-get.
/// @throw NotImplemented
- virtual data::ConstElementPtr configGet(const std::string& service);
+ data::ConstElementPtr configGet(const std::string& service) override final;
/// @brief Test configuration.
///
@@ -49,8 +49,8 @@ public:
/// @param config The configuration to test (ignored).
/// @param service The target service (ignored).
/// @return The JSON element answer of config-test (fixed answer).
- virtual data::ConstElementPtr configTest(data::ConstElementPtr config,
- const std::string& service);
+ data::ConstElementPtr configTest(data::ConstElementPtr config,
+ const std::string& service) override final;
/// @brief Set configuration.
///
@@ -59,8 +59,8 @@ public:
/// @param config The configuration to set.
/// @param service The target service.
/// @return The JSON element answer of config-set (fixed answer).
- virtual data::ConstElementPtr configSet(data::ConstElementPtr config,
- const std::string& service);
+ data::ConstElementPtr configSet(data::ConstElementPtr config,
+ const std::string& service) override final;
protected:
/// @brief Alternative constructor for tests.
diff --git a/src/bin/netconf/tests/control_socket_unittests.cc b/src/bin/netconf/tests/control_socket_unittests.cc
index 10a5d2fa24..c5cd387a98 100644
--- a/src/bin/netconf/tests/control_socket_unittests.cc
+++ b/src/bin/netconf/tests/control_socket_unittests.cc
@@ -428,8 +428,7 @@ public:
/// @brief Create a new request.
///
/// @return Pointer to the new instance of the HttpRequest.
- virtual HttpRequestPtr
- createNewHttpRequest() const {
+ HttpRequestPtr createNewHttpRequest() const override final {
return (HttpRequestPtr(new PostHttpRequestJson()));
}
@@ -438,9 +437,9 @@ protected:
///
/// @param request Pointer to the HTTP request.
/// @return Pointer to the generated HTTP response.
- virtual HttpResponsePtr
+ HttpResponsePtr
createStockHttpResponse(const HttpRequestPtr& request,
- const HttpStatusCode& status_code) const {
+ const HttpStatusCode& status_code) const override final {
// Data is in the request context.
HttpVersion http_version(request->context()->http_version_major_,
request->context()->http_version_minor_);
@@ -504,7 +503,7 @@ class TestHttpResponseCreatorFactory : public HttpResponseCreatorFactory {
public:
/// @brief Creates @ref TestHttpResponseCreator instance.
- virtual HttpResponseCreatorPtr create() const {
+ HttpResponseCreatorPtr create() const override final {
HttpResponseCreatorPtr response_creator(new TestHttpResponseCreator());
return (response_creator);
}
diff --git a/src/bin/netconf/unix_control_socket.h b/src/bin/netconf/unix_control_socket.h
index a05c5091e5..1e64392bc2 100644
--- a/src/bin/netconf/unix_control_socket.h
+++ b/src/bin/netconf/unix_control_socket.h
@@ -37,7 +37,7 @@ public:
/// @param service The target service (ignored).
/// @return The JSON element answer of config-get.
/// @throw ControlSocketError when a communication error occurs.
- virtual data::ConstElementPtr configGet(const std::string& service);
+ data::ConstElementPtr configGet(const std::string& service) override final;
/// @brief Test configuration.
///
@@ -47,8 +47,8 @@ public:
/// @param config The configuration to test.
/// @return The JSON element answer of config-test.
/// @throw ControlSocketError when a communication error occurs.
- virtual data::ConstElementPtr configTest(data::ConstElementPtr config,
- const std::string& service);
+ data::ConstElementPtr configTest(data::ConstElementPtr config,
+ const std::string& service) override final;
/// @brief Set configuration.
///
@@ -58,8 +58,8 @@ public:
/// @param service The target service (ignored).
/// @return The JSON element answer of config-set.
/// @throw ControlSocketError when a communication error occurs.
- virtual data::ConstElementPtr configSet(data::ConstElementPtr config,
- const std::string& service);
+ data::ConstElementPtr configSet(data::ConstElementPtr config,
+ const std::string& service) override final;
private:
/// @brief Perform the actual communication.
diff --git a/src/lib/yang/translator.cc b/src/lib/yang/translator.cc
index acae315386..b2df24b57c 100644
--- a/src/lib/yang/translator.cc
+++ b/src/lib/yang/translator.cc
@@ -145,7 +145,7 @@ Translator::encode64(string const& input) {
}
DataNode
-Translator::findXPath(string const& xpath) {
+Translator::findXPath(string const& xpath) const {
optional<DataNode> const& data_node(getData(xpath));
if (!data_node) {
isc_throw(NetconfError, "no data at xpath " << xpath);
@@ -287,7 +287,7 @@ Translator::initializeSerializer() {
}
-bool Translator::schemaNodeExists(string const& xpath) {
+bool Translator::schemaNodeExists(string const& xpath) const {
Context const& context(session_.getContext());
try {
context.findPath(xpath);
diff --git a/src/lib/yang/translator.h b/src/lib/yang/translator.h
index b8ea89e5a2..1d279d4a77 100644
--- a/src/lib/yang/translator.h
+++ b/src/lib/yang/translator.h
@@ -35,14 +35,13 @@ public:
///
/// @param storage ElementMap where result will be stored
/// @param data_node parent data node of container type
- /// @param key where to set the result in the {storage} map
/// @param xpath relative xpath to search by
/// @param translate function to be called to translate a data node to an element pointer
template <typename T>
void checkAndGet(isc::data::ElementPtr const& storage,
libyang::DataNode const& data_node,
std::string const& xpath,
- T translate) {
+ T translate) const {
libyang::Set<libyang::DataNode> const& nodes(data_node.findXPath(xpath));
if (!nodes.empty()) {
isc::data::ElementPtr const& element(translate(nodes.front()));
@@ -70,7 +69,7 @@ public:
libyang::DataNode const& data_node,
std::string const& key,
std::string const& xpath,
- T translate) {
+ T translate) const {
libyang::Set<libyang::DataNode> const& nodes(data_node.findXPath(xpath));
if (!nodes.empty()) {
isc::data::ElementPtr const& element(translate(nodes.front()));
@@ -85,7 +84,7 @@ public:
///
/// @param storage ElementMap where result will be stored
/// @param data_node parent data node of container type
- /// @param name name of the parameter
+ /// @param name the name of the parameter to be set in storage
void checkAndGetLeaf(isc::data::ElementPtr& storage,
libyang::DataNode const& data_node,
std::string const& name) const;
@@ -98,7 +97,8 @@ public:
///
/// @param storage ElementMap where result will be stored
/// @param data_node parent data node of container type
- /// @param name name of the parameter
+ /// @param name the name of the parameter to be set in storage
+ /// @param yang_name the name by which to find the parameter in the YANG data node
void checkAndGetDivergingLeaf(isc::data::ElementPtr& storage,
libyang::DataNode const& data_node,
std::string const& name,
@@ -109,7 +109,7 @@ public:
///
/// @param storage ElementMap where result will be stored
/// @param data_node parent data node of container type
- /// @param name name of the parameter
+ /// @param name the name of the parameter to be set in storage
void checkAndGetAndJsonifyLeaf(isc::data::ElementPtr& storage,
libyang::DataNode const& data_node,
const std::string& name) const;
@@ -121,7 +121,6 @@ public:
/// @param xpath the xpath to the YANG node without the last node
/// @param name the name of the YANG node which should also match the map
/// key in the JSON configuration
- /// @param type the sysrepo node type
void checkAndJsonifyAndSetLeaf(isc::data::ConstElementPtr const& from,
std::string const& xpath,
std::string const& name);
@@ -147,8 +146,8 @@ public:
///
/// @param from the parent configuration node from which to take the value
/// @param xpath the xpath to the YANG node without the last node
- /// @param name the name of the YANG node which should also match the map
- /// key in the JSON configuration
+ /// @param name the name of the parameter to be set in storage
+ /// @param yang_name the name by which to find the parameter in the YANG data node
/// @param type the sysrepo node type
void checkAndSetDivergingLeaf(isc::data::ConstElementPtr const& from,
std::string const& xpath,
@@ -161,8 +160,7 @@ public:
///
/// @param from the parent configuration node from which to take the value
/// @param xpath the xpath to the YANG node without the last node
- /// @param name the name of the YANG node which should also match the map
- /// key in the JSON configuration
+ /// @param name the name of the parameter to be set in storage
/// @param type the sysrepo node type
void checkAndSetLeafList(isc::data::ConstElementPtr const& from,
std::string const& xpath,
@@ -174,9 +172,6 @@ public:
///
/// @param from the parent configuration node from which to take the value
/// @param xpath the xpath to the YANG node without the last node
- /// @param name the name of the YANG node which should also match the map
- /// key in the JSON configuration
- /// @param type the sysrepo node type
void checkAndSetUserContext(isc::data::ConstElementPtr const& from,
std::string const& xpath);
@@ -196,7 +191,7 @@ public:
/// @return the requested YANG data node
///
/// @throw NetconfError if no YANG data node was found
- libyang::DataNode findXPath(std::string const& xpath);
+ libyang::DataNode findXPath(std::string const& xpath) const;
/// @brief Run a function for a node and all its children.
///
@@ -210,7 +205,7 @@ public:
/// @param f the function to be called on the node itself and each
/// descendant
template <typename functor_t>
- void forAll(std::string const& xpath, functor_t f) {
+ void forAll(std::string const& xpath, functor_t f) const {
std::optional<libyang::DataNode> const& data_node(session_.getData(xpath));
if (!data_node) {
return;
@@ -228,7 +223,7 @@ public:
/// @param xpath the xpath to be checked
///
/// @return true if the YANG node exists in the schema, false otherwise
- bool schemaNodeExists(std::string const& xpath);
+ bool schemaNodeExists(std::string const& xpath) const;
/// @brief Get a YANG data node found at the given absolute xpath.
///
@@ -283,7 +278,7 @@ public:
isc::data::ElementPtr getList(libyang::DataNode const& data_node,
std::string const& xpath,
T& t,
- isc::data::ElementPtr (T::*f)(libyang::DataNode const&)) {
+ isc::data::ElementPtr (T::*f)(libyang::DataNode const&)) const {
try {
libyang::Set<libyang::DataNode> const& nodes(data_node.findXPath(xpath));
if (nodes.empty()) {
@@ -322,6 +317,7 @@ public:
/// @param storage ElementMap where result will be stored
/// @param data_node parent data node of container type
/// @param name name of the parameter
+ /// @param yang_name the name by which to find the parameter in the YANG data node
///
/// @throw MissingNode if leaf is not found
void getMandatoryDivergingLeaf(isc::data::ElementPtr& storage,
@@ -358,6 +354,7 @@ public:
/// @param xpath the xpath to the YANG node without the last node
/// @param name the name of the YANG node which should also match the map
/// key in the JSON configuration
+ /// @param yang_name the name by which to find the parameter in the YANG data node
/// @param type the sysrepo node type
void setMandatoryDivergingLeaf(isc::data::ConstElementPtr const& from,
std::string const& xpath,