/// @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.
///
/// @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.
///
/// @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.
///
/// @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:
/// 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.
///
/// 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.
/// @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.
/// @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.
/// 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:
/// 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.
/// 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.
///
/// 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.
///
/// @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();
/// @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.
///
/// @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.
///
/// @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.
/// @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()));
}
///
/// @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_);
public:
/// @brief Creates @ref TestHttpResponseCreator instance.
- virtual HttpResponseCreatorPtr create() const {
+ HttpResponseCreatorPtr create() const override final {
HttpResponseCreatorPtr response_creator(new TestHttpResponseCreator());
return (response_creator);
}
/// @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.
///
/// @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.
///
/// @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.
}
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);
}
-bool Translator::schemaNodeExists(string const& xpath) {
+bool Translator::schemaNodeExists(string const& xpath) const {
Context const& context(session_.getContext());
try {
context.findPath(xpath);
///
/// @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()));
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()));
///
/// @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;
///
/// @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,
///
/// @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;
/// @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);
///
/// @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,
///
/// @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,
///
/// @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);
/// @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.
///
/// @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;
/// @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.
///
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()) {
/// @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,
/// @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,