16using namespace libyang;
17using namespace sysrepo;
30 if ((
model_ == KEA_DHCP4_SERVER) ||
31 (
model_ == KEA_DHCP6_SERVER) ||
32 (
model_ == KEA_DHCP_DDNS) ||
33 (
model_ == KEA_CTRL_AGENT)) {
36 }
catch (Error
const& ex) {
38 "getting control socket: " << ex.
what());
41 "getControlSocket not implemented for the model: " <<
model_);
50 return (result->empty() ?
ElementPtr() : result);
66 if ((
model_ == KEA_DHCP4_SERVER) ||
67 (
model_ == KEA_DHCP6_SERVER) ||
68 (
model_ == KEA_DHCP_DDNS) ||
69 (
model_ == KEA_CTRL_AGENT)) {
73 "setControlSocket not implemented for the model: "
76 }
catch (Error
const& ex) {
78 "setting control socket '" << elem->str()
79 <<
"' at '" << xpath <<
"': " << ex.what());
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.
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
void setControlSocket(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set control socket from JSON to YANG.
TranslatorControlSocket(sysrepo::Session session, const std::string &model)
Constructor.
void setControlSocketKea(const std::string &xpath, isc::data::ConstElementPtr elem)
setControlSocket for kea models.
isc::data::ElementPtr getControlSocket(libyang::DataNode const &data_node)
Translate a control socket from YANG to JSON.
isc::data::ElementPtr getControlSocketKea(libyang::DataNode const &data_node)
getControlSocket JSON for kea models.
isc::data::ElementPtr getControlSocketFromAbsoluteXpath(std::string const &xpath)
Translate a control socket from YANG to JSON.
Between YANG and JSON translator class for basic values.
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.
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 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 deleteItem(const std::string &xpath)
Delete basic value from 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,...
#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.