Kea
1.9.9-git
|
Between YANG and JSON translator class for basic values. More...
#include <translator.h>
Public Member Functions | |
TranslatorBasic (sysrepo::S_Session session, const std::string &model) | |
Constructor. More... | |
virtual | ~TranslatorBasic () |
Destructor. More... | |
void | delItem (const std::string &xpath) |
Delete basic value from YANG. More... | |
isc::data::ElementPtr | getItem (const std::string &xpath) |
Get and translate basic value from YANG to JSON. More... | |
isc::data::ElementPtr | getItems (const std::string &xpath) |
Get and translate a list of basic values from YANG to JSON. More... | |
sysrepo::S_Iter_Value | getIter (const std::string &xpath) |
List iterator methods keeping the session private. More... | |
std::string | getNext (sysrepo::S_Iter_Value iter) |
Get xpath of the next YANG list item. More... | |
void | setItem (const std::string &xpath, isc::data::ConstElementPtr elem, sr_type_t type) |
Translate and set basic value from JSON to YANG. More... | |
Static Public Member Functions | |
static isc::data::ElementPtr | value (sysrepo::S_Val s_val) |
Translate basic value from YANG to JSON. More... | |
static sysrepo::S_Val | value (isc::data::ConstElementPtr elem, sr_type_t type) |
Translate basic value from JSON to YANG. More... | |
Protected Attributes | |
std::string | model_ |
The model. More... | |
sysrepo::S_Session | session_ |
The sysrepo session. More... | |
Between YANG and JSON translator class for basic values.
Definition at line 27 of file translator.h.
isc::yang::TranslatorBasic::TranslatorBasic | ( | sysrepo::S_Session | session, |
const std::string & | model | ||
) |
Constructor.
session | Sysrepo session. |
model | Model name (used and shared by derived classes). |
Definition at line 43 of file translator.cc.
|
virtual |
Destructor.
Definition at line 47 of file translator.cc.
void isc::yang::TranslatorBasic::delItem | ( | const std::string & | xpath | ) |
Delete basic value from YANG.
xpath | The xpath of the basic value. |
Definition at line 304 of file translator.cc.
References isc_throw, session_, and isc::Exception::what().
Referenced by isc::yang::TranslatorConfig::delConfigIetf6(), isc::yang::TranslatorConfig::delConfigKea(), isc::yang::TranslatorControlSocket::setControlSocketKea(), isc::yang::TranslatorDatabase::setDatabaseKea(), and isc::yang::TranslatorDatabases::setDatabasesKea().
ElementPtr isc::yang::TranslatorBasic::getItem | ( | const std::string & | xpath | ) |
Get and translate basic value from YANG to JSON.
xpath | The xpath of the basic value. |
SysrepoError | when sysrepo raises an error. |
NotImplemented | when the value type is not supported. |
Definition at line 111 of file translator.cc.
References isc_throw, session_, value(), and isc::Exception::what().
Referenced by isc::yang::TranslatorClass::getClassKea(), isc::yang::TranslatorControlSocket::getControlSocketKea(), isc::yang::TranslatorDatabase::getDatabaseKea(), isc::yang::TranslatorConfig::getDdnsKea(), isc::yang::TranslatorConfig::getHooksKea(), isc::yang::TranslatorHost::getHostKea(), isc::yang::TranslatorLogger::getLoggerKea(), isc::yang::TranslatorOptionData::getOptionDataKea(), isc::yang::TranslatorOptionDef::getOptionDefKea(), isc::yang::TranslatorLogger::getOutputOption(), isc::yang::TranslatorConfig::getParam(), isc::yang::TranslatorPdPool::getPdPoolIetf6(), isc::yang::TranslatorPdPool::getPdPoolKea(), isc::yang::TranslatorPool::getPoolIetf6(), isc::yang::TranslatorPool::getPoolKea(), isc::yang::TranslatorConfig::getServerKeaDhcp4(), isc::yang::TranslatorConfig::getServerKeaDhcp6(), isc::yang::TranslatorConfig::getServerKeaDhcpCommon(), isc::yang::TranslatorSharedNetwork::getSharedNetworkKea(), isc::yang::TranslatorSubnet::getSubnetIetf6(), and isc::yang::TranslatorSubnet::getSubnetKea().
ElementPtr isc::yang::TranslatorBasic::getItems | ( | const std::string & | xpath | ) |
Get and translate a list of basic values from YANG to JSON.
xpath | The xpath of the list of basic values. |
Definition at line 126 of file translator.cc.
References isc_throw, session_, value(), and isc::Exception::what().
Referenced by isc::yang::TranslatorHost::getHostKea(), isc::yang::TranslatorPdPool::getPdPoolKea(), isc::yang::TranslatorPool::getPoolKea(), isc::yang::TranslatorConfig::getServerKeaDhcp4(), isc::yang::TranslatorConfig::getServerKeaDhcp6(), isc::yang::TranslatorConfig::getServerKeaDhcpCommon(), isc::yang::TranslatorSharedNetwork::getSharedNetworkKea(), and isc::yang::TranslatorSubnet::getSubnetKea().
S_Iter_Value isc::yang::TranslatorBasic::getIter | ( | const std::string & | xpath | ) |
List iterator methods keeping the session private.
Get iterator over a YANG list.
xpath | The xpath of the list. |
Definition at line 316 of file translator.cc.
References session_.
Referenced by isc::yang::TranslatorClasses::getClassesKea(), isc::yang::TranslatorDatabases::getDatabasesKea(), isc::yang::TranslatorConfig::getHooksKea(), isc::yang::TranslatorHosts::getHosts(), isc::yang::TranslatorLoggers::getLoggersKea(), isc::yang::TranslatorOptionDataList::getOptionDataListKea(), isc::yang::TranslatorOptionDefList::getOptionDefListKea(), isc::yang::TranslatorLogger::getOutputOptions(), isc::yang::TranslatorPdPools::getPdPoolsCommon(), isc::yang::TranslatorPools::getPoolsIetf(), isc::yang::TranslatorPools::getPoolsKea(), isc::yang::TranslatorSharedNetworks::getSharedNetworks(), and isc::yang::TranslatorSubnets::getSubnetsCommon().
string isc::yang::TranslatorBasic::getNext | ( | sysrepo::S_Iter_Value | iter | ) |
Get xpath of the next YANG list item.
iter | The iterator pointing to the previous element |
Definition at line 321 of file translator.cc.
References isc_throw, and session_.
Referenced by isc::yang::TranslatorClasses::getClassesKea(), isc::yang::TranslatorDatabases::getDatabasesKea(), isc::yang::TranslatorConfig::getHooksKea(), isc::yang::TranslatorHosts::getHosts(), isc::yang::TranslatorLoggers::getLoggersKea(), isc::yang::TranslatorOptionDataList::getOptionDataListKea(), isc::yang::TranslatorOptionDefList::getOptionDefListKea(), isc::yang::TranslatorLogger::getOutputOptions(), isc::yang::TranslatorPdPools::getPdPoolsCommon(), isc::yang::TranslatorPools::getPoolsIetf(), isc::yang::TranslatorPools::getPoolsKea(), isc::yang::TranslatorSharedNetworks::getSharedNetworks(), and isc::yang::TranslatorSubnets::getSubnetsCommon().
void isc::yang::TranslatorBasic::setItem | ( | const std::string & | xpath, |
isc::data::ConstElementPtr | elem, | ||
sr_type_t | type | ||
) |
Translate and set basic value from JSON to YANG.
xpath | The xpath of the basic value. |
elem | The JSON element. |
type | The sysrepo type. |
Definition at line 288 of file translator.cc.
References isc_throw, session_, value(), and isc::Exception::what().
Referenced by isc::yang::TranslatorClass::setClassKea(), isc::yang::TranslatorControlSocket::setControlSocketKea(), isc::yang::TranslatorDatabase::setDatabaseKea(), isc::yang::TranslatorHost::setHostKea(), isc::yang::TranslatorLogger::setLoggerKea(), isc::yang::TranslatorOptionData::setOptionDataKea(), isc::yang::TranslatorOptionDef::setOptionDefKea(), isc::yang::TranslatorLogger::setOutputOption(), isc::yang::TranslatorPdPool::setPdPoolIetf6(), isc::yang::TranslatorPdPool::setPdPoolKea(), isc::yang::TranslatorPool::setPoolIetf6(), isc::yang::TranslatorPool::setPoolKea(), isc::yang::TranslatorConfig::setServerKeaDhcp4(), isc::yang::TranslatorConfig::setServerKeaDhcp6(), isc::yang::TranslatorConfig::setServerKeaDhcpCommon(), isc::yang::TranslatorSharedNetwork::setSharedNetworkKea(), isc::yang::TranslatorSubnet::setSubnetIetf6(), and isc::yang::TranslatorSubnet::setSubnetKea().
|
static |
Translate basic value from YANG to JSON.
s_val | The value. |
NotImplemented | when the value type is not supported. |
Definition at line 52 of file translator.cc.
References isc_throw.
Referenced by getItem(), getItems(), and setItem().
|
static |
Translate basic value from JSON to YANG.
elem | The JSON element. |
type | The sysrepo type. |
Definition at line 147 of file translator.cc.
References isc_throw.
|
protected |
The model.
Definition at line 132 of file translator.h.
Referenced by isc::yang::TranslatorConfig::delConfigIetf6(), isc::yang::TranslatorConfig::delConfigKea(), isc::yang::TranslatorClass::getClass(), isc::yang::TranslatorClasses::getClasses(), isc::yang::TranslatorClass::getClassKea(), isc::yang::TranslatorConfig::getConfig(), isc::yang::TranslatorConfig::getConfigIetf6(), isc::yang::TranslatorControlSocket::getControlSocket(), isc::yang::TranslatorDatabase::getDatabase(), isc::yang::TranslatorDatabases::getDatabases(), isc::yang::TranslatorHost::getHost(), isc::yang::TranslatorHost::getHostKea(), isc::yang::TranslatorLogger::getLogger(), isc::yang::TranslatorLoggers::getLoggers(), isc::yang::TranslatorOptionData::getOptionData(), isc::yang::TranslatorOptionDataList::getOptionDataList(), isc::yang::TranslatorOptionDef::getOptionDef(), isc::yang::TranslatorOptionDefList::getOptionDefList(), isc::yang::TranslatorPdPool::getPdPool(), isc::yang::TranslatorPdPools::getPdPools(), isc::yang::TranslatorPool::getPool(), isc::yang::TranslatorPools::getPools(), isc::yang::TranslatorSharedNetwork::getSharedNetwork(), isc::yang::TranslatorSubnet::getSubnet(), isc::yang::TranslatorSubnet::getSubnetIetf6(), isc::yang::TranslatorSubnet::getSubnetKea(), isc::yang::TranslatorSubnets::getSubnets(), isc::yang::TranslatorClass::setClass(), isc::yang::TranslatorClasses::setClasses(), isc::yang::TranslatorClass::setClassKea(), isc::yang::TranslatorConfig::setConfig(), isc::yang::TranslatorConfig::setConfigIetf6(), isc::yang::TranslatorControlSocket::setControlSocket(), isc::yang::TranslatorDatabase::setDatabase(), isc::yang::TranslatorDatabases::setDatabases(), isc::yang::TranslatorHost::setHost(), isc::yang::TranslatorHost::setHostKea(), isc::yang::TranslatorHosts::setHosts(), isc::yang::TranslatorHosts::setHostsKea(), isc::yang::TranslatorLogger::setLogger(), isc::yang::TranslatorLoggers::setLoggers(), isc::yang::TranslatorOptionData::setOptionData(), isc::yang::TranslatorOptionDataList::setOptionDataList(), isc::yang::TranslatorOptionDef::setOptionDef(), isc::yang::TranslatorOptionDefList::setOptionDefList(), isc::yang::TranslatorPdPool::setPdPool(), isc::yang::TranslatorPdPools::setPdPools(), isc::yang::TranslatorPool::setPool(), isc::yang::TranslatorPools::setPools(), isc::yang::TranslatorSharedNetwork::setSharedNetwork(), isc::yang::TranslatorSharedNetworks::setSharedNetworks(), isc::yang::TranslatorSubnet::setSubnet(), isc::yang::TranslatorSubnet::setSubnetIetf6(), isc::yang::TranslatorSubnet::setSubnetKea(), and isc::yang::TranslatorSubnets::setSubnets().
|
protected |
The sysrepo session.
Definition at line 126 of file translator.h.
Referenced by delItem(), getItem(), getItems(), getIter(), getNext(), and setItem().