16 #ifndef HAVE_PRE_0_7_6_SYSREPO
23 TranslatorControlSocket::TranslatorControlSocket(S_Session session,
34 if ((
model_ == KEA_DHCP4_SERVER) ||
35 (
model_ == KEA_DHCP6_SERVER) ||
36 (
model_ == KEA_DHCP_DDNS) ||
37 (
model_ == KEA_CTRL_AGENT)) {
40 }
catch (
const sysrepo_exception& ex) {
42 "sysrepo error getting control socket at '" << xpath
43 <<
"': " << ex.
what());
46 "getControlSocket not implemented for the model: " <<
model_);
55 result->set(
"socket-name", name);
56 result->set(
"socket-type", type);
59 result->set(
"user-context",
60 Element::fromJSON(context->stringValue()));
71 if ((
model_ == KEA_DHCP4_SERVER) ||
72 (
model_ == KEA_DHCP6_SERVER) ||
73 (
model_ == KEA_DHCP_DDNS) ||
74 (
model_ == KEA_CTRL_AGENT)) {
78 "setControlSocket not implemented for the model: "
81 }
catch (
const sysrepo_exception& ex) {
83 "sysrepo error setting control socket '" << elem->str()
84 <<
"' at '" << xpath <<
"': " << ex.
what());
92 delItem(xpath +
"/socket-name");
93 delItem(xpath +
"/socket-type");
94 delItem(xpath +
"/user-context");
106 setItem(xpath +
"/socket-name", name, SR_STRING_T);
107 setItem(xpath +
"/socket-type", type, SR_ENUM_T);
110 setItem(xpath +
"/user-context", Element::create(context->str()),
A generic exception that is thrown when a function is not implemented.
Between YANG and JSON translator class for basic values.
boost::shared_ptr< Element > ElementPtr
void setControlSocket(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set control socket from JSON to YANG.
#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...
void setControlSocketKea(const std::string &xpath, isc::data::ConstElementPtr elem)
setControlSocket for kea models.
void setItem(const std::string &xpath, isc::data::ConstElementPtr elem, sr_type_t type)
Translate and set basic value from JSON to YANG.
std::string model_
The model.
boost::shared_ptr< const Element > ConstElementPtr
static isc::data::ConstElementPtr getContext(isc::data::ConstElementPtr parent)
Get user context.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
void delItem(const std::string &xpath)
Delete basic value from YANG.
Defines the logger used by the top-level component of kea-dhcp-ddns.
isc::data::ElementPtr getItem(const std::string &xpath)
Get and translate basic value from YANG to JSON.
virtual ~TranslatorControlSocket()
Destructor.
isc::data::ElementPtr getControlSocketKea(const std::string &xpath)
getControlSocket JSON for kea models.
isc::data::ConstElementPtr getControlSocket(const std::string &xpath)
Get and translate a control socket from YANG to JSON.