23 NetconfConfig::NetconfConfig()
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) {
65 for (
auto serv : *ctx->getCfgServersMap()) {
78 s <<
", " << libs.size() <<
" lib(s):";
79 for (
auto lib = libs.begin(); lib != libs.end(); ++lib) {
80 s << lib->first <<
" ";
102 ctx->extractConfiguredGlobals(config_set);
115 parser.
parse(ctx, cfg, check_only);
120 excuse =
"undefined configuration parsing error";
136 "Configuration check successful");
139 "Configuration applied successfully.");
151 netconf->setValue(configured_globals_->mapValue());
153 netconf->set(
"hooks-libraries", hooks_config_.
toElement());
156 for (
auto serv : *servers_map_) {
158 servers->set(serv.first, server);
160 netconf->set(
"managed-servers", servers);
163 result->set(
"Netconf", netconf);
167 std::list<std::list<std::string>>
169 static std::list<std::list<std::string>>
const list({
170 {
"hooks-libraries",
"[]",
"parameters",
"*"},
static size_t setAllDefaults(const isc::data::ElementPtr &global)
Sets all defaults for Netconf configuration.
const isc::log::MessageID NETCONF_CONFIG_CHECK_FAIL
Netconf Configuration Context.
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
ConstElementPtr createAnswer(const int status_code, const std::string &text, const ConstElementPtr &arg)
const int CONTROL_RESULT_SUCCESS
Status code indicating a successful operation.
Base class for all configurations.
#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.
boost::shared_ptr< Element > ElementPtr
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.
std::vector< HookLibInfo > HookLibsCollection
A storage for information about hook libraries.
void parse(const NetconfConfigPtr &ctx, const isc::data::ConstElementPtr &config, bool check_only)
Parses the netconf configuration.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
virtual std::string getConfigSummary(const uint32_t selection)
Returns configuration summary in the textual format.
std::map< std::string, CfgServerPtr > CfgServersMap
Defines a map of CfgServers, keyed by the name.
To be removed. Please use ConfigError instead.
isc::data::ElementPtr toElement() const
Unparse a configuration object.
std::list< std::list< std::string > > jsonPathsToRedact() const
Return a list of all paths that contain passwords or secrets for kea-netconf.
boost::shared_ptr< const Element > ConstElementPtr
virtual ~NetconfCfgMgr()
Destructor.
NetconfConfig()
Default constructor.
isc::log::Logger netconf_logger(NETCONF_LOGGER_NAME)
Base logger for the netconf agent.
virtual isc::data::ConstElementPtr parse(isc::data::ConstElementPtr config, bool check_only)
Parses configuration of Netconf.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
NetconfCfgMgr()
Constructor.
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-dhcp-ddns.
This file contains several functions and constants that are used for handling commands and responses ...
virtual process::ConfigPtr createNewContext()
Creates a new, blank NetconfConfig context.
const isc::log::MessageID NETCONF_CONFIG_FAIL
The Element class represents a piece of data, used by the command channel and configuration parts...
Contains declarations for loggers used by the Kea netconf agent.
NetconfConfigPtr getNetconfConfig()
Convenience method that returns the Netconf configuration context.
static size_t deriveParameters(isc::data::ConstElementPtr global)
Derives (inherits) all parameters from global to more specific scopes.
void addConfiguredGlobal(const std::string &name, isc::data::ConstElementPtr value)
Adds a parameter to the collection configured globals.
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.
void extractConfiguredGlobals(isc::data::ConstElementPtr config)
Saves scalar elements from the global scope of a configuration.
boost::shared_ptr< NetconfConfig > NetconfConfigPtr
Pointer to a configuration context.