24 : configured_globals_(
Element::createMap()),
29 :
ConfigBase(), configured_globals_(orig.configured_globals_),
30 servers_map_(orig.servers_map_), hooks_config_(orig.hooks_config_) {
35 if (config->getType() != Element::map) {
37 "extractConfiguredGlobals must be given a map element");
40 const std::map<std::string, ConstElementPtr>& values = config->mapValue();
41 for (
auto value = values.begin(); value != values.end(); ++value) {
42 if (value->second->getType() != Element::list &&
43 value->second->getType() != Element::map) {
62 for (
auto serv : *ctx->getCfgServersMap()) {
75 s <<
", " << libs.size() <<
" lib(s):";
76 for (
auto lib = libs.begin(); lib != libs.end(); ++lib) {
77 s << lib->first <<
" ";
99 ctx->extractConfiguredGlobals(config_set);
102 ElementPtr cfg = boost::const_pointer_cast<Element>(config_set);
112 parser.
parse(ctx, cfg, check_only);
117 excuse =
"undefined configuration parsing error";
133 "Configuration check successful");
136 "Configuration applied successfully.");
148 netconf->setValue(configured_globals_->mapValue());
150 netconf->set(
"hooks-libraries", hooks_config_.
toElement());
153 for (
auto serv : *servers_map_) {
155 servers->set(serv.first, server);
157 netconf->set(
"managed-servers", servers);
160 result->set(
"Netconf", netconf);
164std::list<std::list<std::string>>
166 static std::list<std::list<std::string>>
const list({
167 {
"hooks-libraries",
"[]",
"parameters",
"*"},
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
An exception that is thrown if an error occurs while configuring any server.
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
The Element class represents a piece of data, used by the command channel and configuration parts.
isc::data::ElementPtr toElement() const
Unparse a configuration object.
virtual process::ConfigPtr createNewContext()
Creates a new, blank NetconfConfig context.
NetconfCfgMgr()
Constructor.
virtual std::string getConfigSummary(const uint32_t selection)
Returns configuration summary in the textual format.
NetconfConfigPtr getNetconfConfig()
Convenience method that returns the Netconf configuration context.
virtual isc::data::ConstElementPtr parse(isc::data::ConstElementPtr config, bool check_only)
Parses configuration of Netconf.
std::list< std::list< std::string > > jsonPathsToRedact() const
Return a list of all paths that contain passwords or secrets for kea-netconf.
Netconf Configuration Context.
NetconfConfig()
Default constructor.
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
void extractConfiguredGlobals(isc::data::ConstElementPtr config)
Saves scalar elements from the global scope of a configuration.
void addConfiguredGlobal(const std::string &name, isc::data::ConstElementPtr value)
Adds a parameter to the collection configured globals.
static size_t setAllDefaults(const isc::data::ElementPtr &global)
Sets all defaults for Netconf configuration.
void parse(const NetconfConfigPtr &ctx, const isc::data::ConstElementPtr &config, bool check_only)
Parses the netconf configuration.
static size_t deriveParameters(isc::data::ConstElementPtr global)
Derives (inherits) all parameters from global to more specific scopes.
Base class for all configurations.
This file contains several functions and constants that are used for handling commands and responses ...
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
const int CONTROL_RESULT_ERROR
Status code indicating a general failure.
ConstElementPtr createAnswer(const int status_code, const std::string &text, const ConstElementPtr &arg)
const int CONTROL_RESULT_SUCCESS
Status code indicating a successful operation.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
std::vector< HookLibInfo > HookLibsCollection
A storage for information about hook libraries.
isc::log::Logger netconf_logger(NETCONF_LOGGER_NAME)
Base logger for the netconf agent.
const isc::log::MessageID NETCONF_CONFIG_CHECK_FAIL
boost::shared_ptr< NetconfConfig > NetconfConfigPtr
Pointer to a configuration context.
std::map< std::string, CfgServerPtr > CfgServersMap
Defines a map of CfgServers, keyed by the name.
const isc::log::MessageID NETCONF_CONFIG_FAIL
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.
Defines the logger used by the top-level component of kea-lfc.
Contains declarations for loggers used by the Kea netconf agent.
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.