16using namespace libyang;
 
   17using namespace sysrepo;
 
   30        if ((
model_ == KEA_DHCP4_SERVER) ||
 
   31            (
model_ == KEA_DHCP6_SERVER)) {
 
   34    } 
catch (Error 
const& ex) {
 
   36                  "getting option definition:" 
   40              "getOptionDef not implemented for the model: " << 
model_);
 
 
   67    return (result->empty() ? 
ElementPtr() : result);
 
 
   73        if ((
model_ == KEA_DHCP4_SERVER) ||
 
   74            (
model_ == KEA_DHCP6_SERVER)) {
 
   78                      "setOptionDef not implemented for the model: " 
   81    } 
catch (Error 
const& ex) {
 
   83                  "setting option definition '" << elem->str()
 
   84                  << 
"' : " << ex.
what());
 
 
  116        if ((
model_ == KEA_DHCP4_SERVER) ||
 
  117            (
model_ == KEA_DHCP6_SERVER)) {
 
  120    } 
catch (Error 
const& ex) {
 
  122                  "getting option definition list:" 
  126              "getOptionDefList not implemented for the model: " << 
model_);
 
 
  148        if ((
model_ == KEA_DHCP4_SERVER) ||
 
  149            (
model_ == KEA_DHCP6_SERVER)) {
 
  153                      "setOptionDefList not implemented for the model: " 
  156    } 
catch (Error 
const& ex) {
 
  158                  "setting option definition list '" 
  159                  << elem->str() << 
"' : " << ex.
what());
 
 
  166    for (
size_t i = 0; i < elem->size(); ++i) {
 
  168        if (!def->contains(
"code")) {
 
  170                      "option definition without code: " << def->str());
 
  172        unsigned code = 
static_cast<unsigned>(def->get(
"code")->intValue());
 
  173        if (!def->contains(
"space")) {
 
  175                      "option definition without space: " << def->str());
 
  177        string space = def->get(
"space")->stringValue();
 
  179        keys << xpath << 
"/option-def[code='" << code
 
  180            << 
"'][space='" << space << 
"']";
 
 
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::ConstElementPtr getOptionDefListKea(libyang::DataNode const &data_node)
getOptionDefList implementation specific to kea-dhcp[46]-server models.
void setOptionDefListKea(const std::string &xpath, isc::data::ConstElementPtr elem)
setOptionDefList implementation specific to kea-dhcp[46]-server models.
isc::data::ConstElementPtr getOptionDefList(libyang::DataNode const &data_node)
Translate option definition list from YANG to JSON.
TranslatorOptionDefList(sysrepo::Session session, const std::string &model)
Constructor.
isc::data::ConstElementPtr getOptionDefListFromAbsoluteXpath(std::string const &xpath)
Translate option definition list from YANG to JSON.
void setOptionDefList(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set option definition list from JSON to YANG.
isc::data::ElementPtr getOptionDefFromAbsoluteXpath(std::string const &xpath)
Translate an option definition from YANG to JSON.
isc::data::ElementPtr getOptionDefKea(libyang::DataNode const &data_node)
getOptionDef implementation specific to kea-dhcp[46]-server models.
void setOptionDef(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set option definition from JSON to YANG.
void setOptionDefKea(const std::string &xpath, isc::data::ConstElementPtr elem)
setOptionDef implementation specific to kea-dhcp[46]-server models.
TranslatorOptionDef(sysrepo::Session session, const std::string &model)
Constructor.
isc::data::ElementPtr getOptionDef(libyang::DataNode const &data_node)
Translate an option definition from YANG to JSON.
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 setMandatoryLeaf(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.
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.