16using namespace libyang;
 
   17using namespace sysrepo;
 
   29        if ((
model_ == KEA_DHCP4_SERVER) ||
 
   30            (
model_ == KEA_DHCP6_SERVER)) {
 
   33    } 
catch (Error 
const& ex) {
 
   35                  "getting logger: " << ex.
what());
 
   38              "getLogger not implemented for the model: " << 
model_);
 
 
   54        result->set(
"output-options", options);
 
   57    return (result->empty() ? 
ElementPtr() : result);
 
 
   71    return (result->empty() ? 
ElementPtr() : result);
 
 
   76    return getList(data_node, 
"output-option", *
this,
 
 
   83        if ((
model_ == KEA_DHCP4_SERVER) ||
 
   84            (
model_ == KEA_DHCP6_SERVER)) {
 
   88                      "setLogger not implemented for the model: " << 
model_);
 
   90    } 
catch (Error 
const& ex) {
 
   92                  "setting logger '" << elem->str()
 
   93                  << 
"' : " << ex.
what());
 
 
  110    if (options && !options->empty()) {
 
 
  128    for (
size_t i = 0; i < elem->size(); ++i) {
 
  130        if (!option->contains(
"output")) {
 
  134        string output = option->get(
"output")->stringValue();
 
  136        key << xpath << 
"/output-option[output='" << output << 
"']";
 
 
  149        if ((
model_ == KEA_DHCP4_SERVER) ||
 
  150            (
model_ == KEA_DHCP6_SERVER)) {
 
  153    } 
catch (Error 
const& ex) {
 
  155                  "getting loggers: " << ex.
what());
 
  158              "getLoggers not implemented for the model: " << 
model_);
 
 
  179        if ((
model_ == KEA_DHCP4_SERVER) ||
 
  180            (
model_ == KEA_DHCP6_SERVER)) {
 
  184                      "setLoggers not implemented for the model: " << 
model_);
 
  186    } 
catch (Error 
const& ex) {
 
  188                  "setting loggers '" << elem->str()
 
  189                  << 
"' : " << ex.
what());
 
 
  195    for (
size_t i = 0; i < elem->size(); ++i) {
 
  197        if (!logger->contains(
"name")) {
 
  200        string name = logger->get(
"name")->stringValue();
 
  202        key << xpath << 
"/logger[name='" << name << 
"']";
 
 
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
A generic exception that is thrown when a function is not implemented.
isc::data::ElementPtr getOutputOptions(libyang::DataNode const &data_node)
Translate output options from YANG to JSON.
void setLogger(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set logger from JSON to YANG.
void setOutputOption(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set an output option from JSON to YANG.
void setLoggerKea(const std::string &xpath, isc::data::ConstElementPtr elem)
setLogger for loggers.
isc::data::ElementPtr getLoggerKea(libyang::DataNode const &data_node)
getLogger JSON for loggers.
isc::data::ElementPtr getOutputOption(libyang::DataNode const &data_node)
Translate an output option from YANG to JSON.
TranslatorLogger(sysrepo::Session session, const std::string &model)
Constructor.
isc::data::ElementPtr getLogger(libyang::DataNode const &data_node)
Translate a logger from YANG to JSON.
void setOutputOptions(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set output options from JSON to YANG.
void setLoggers(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set loggers from JSON to YANG.
isc::data::ConstElementPtr getLoggersFromAbsoluteXpath(std::string const &xpath)
Translate loggers from YANG to JSON.
isc::data::ElementPtr getLoggersKea(libyang::DataNode const &data_node)
getLoggers JSON for loggers.
isc::data::ConstElementPtr getLoggers(libyang::DataNode const &data_node)
Translate loggers from YANG to JSON.
void setLoggersKea(const std::string &xpath, isc::data::ConstElementPtr elem)
setLoggers for loggers.
TranslatorLoggers(sysrepo::Session session, const std::string &model)
Constructor.
Between YANG and JSON translator class for basic values.
isc::data::ElementPtr getList(libyang::DataNode const &data_node, std::string const &xpath, T &t, isc::data::ElementPtr(T::*f)(libyang::DataNode const &)) const
Retrieve a list as ElementPtr from sysrepo from a certain xpath.
void checkAndSetLeaf(isc::data::ConstElementPtr const &from, std::string const &xpath, std::string const &name, libyang::LeafBaseType const type)
Get an element from given ElementPtr node and set it in sysrepo at given xpath.
libyang::DataNode findXPath(std::string const &xpath) const
Retrieves a YANG data node by xpath.
void getMandatoryLeaf(isc::data::ElementPtr &storage, libyang::DataNode const &data_node, std::string const &name) const
Retrieves a child YANG data node identified by name from the given parent YANG container node and sto...
void checkAndGetLeaf(isc::data::ElementPtr &storage, libyang::DataNode const &data_node, std::string const &name) const
Retrieves a child YANG data node identified by name from the given parent YANG container node and sto...
void checkAndSetUserContext(isc::data::ConstElementPtr const &from, std::string const &xpath)
Get an element from given ElementPtr node and set it in sysrepo at given xpath.
void setItem(const std::string &xpath, isc::data::ConstElementPtr const elem, libyang::LeafBaseType const type)
Translate and set basic value from JSON to YANG.
std::string model_
The model.
void checkAndGetAndJsonifyLeaf(isc::data::ElementPtr &storage, libyang::DataNode const &data_node, const std::string &name) const
Retrieves a child YANG data node identified by name from the given parent YANG container node,...
Translator(sysrepo::Session session, const std::string &model)
Constructor.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
Defines the logger used by the top-level component of kea-lfc.