Kea 2.7.5
|
DHCP configuration translation between YANG and JSON. More...
#include <translator_config.h>
Public Member Functions | |
TranslatorConfig (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorConfig ()=default |
Destructor. | |
isc::data::ElementPtr | getConfig () |
Translate the whole DHCP server configuration from YANG to JSON. | |
void | setConfig (isc::data::ElementPtr elem) |
Translate and set the DHCP server configuration from JSON to YANG. | |
Public Member Functions inherited from isc::yang::TranslatorControlSocket | |
TranslatorControlSocket (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorControlSocket ()=default |
Destructor. | |
isc::data::ElementPtr | getControlSocket (libyang::DataNode const &data_node) |
Translate a control socket from YANG to JSON. | |
isc::data::ElementPtr | getControlSocketFromAbsoluteXpath (std::string const &xpath) |
Translate a control socket from YANG to JSON. | |
void | setControlSocket (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set control socket from JSON to YANG. | |
Public Member Functions inherited from isc::yang::Translator | |
Translator (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~Translator ()=default |
Destructor. | |
template<typename T > | |
void | checkAndGet (isc::data::ElementPtr const &storage, libyang::DataNode const &data_node, std::string const &xpath, T translate) const |
Calls {translate} for the element found at {xpath} relative to {data_node} and sets the result in {storage} with the {xpath} key. | |
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, converts it from string to JSON and stores it in the specified storage. | |
template<typename T > | |
void | checkAndGetDiverging (isc::data::ElementPtr const &storage, libyang::DataNode const &data_node, std::string const &key, std::string const &xpath, T translate) const |
Calls {translate} for the element found at {xpath} relative to {data_node} and sets the result in {storage} with the {key} key. | |
void | checkAndGetDivergingLeaf (isc::data::ElementPtr &storage, libyang::DataNode const &data_node, std::string const &name, std::string const &yang_name) const |
Retrieves a child YANG data node identified by name from the given parent YANG container node and stores it in the specified storage. | |
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 stores it in the specified storage. | |
void | checkAndSetDivergingLeaf (isc::data::ConstElementPtr const &from, std::string const &xpath, std::string const &name, std::string const &yang_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. | |
void | checkAndSetLeafList (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 as a leaf-list. | |
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 | checkAndStringifyAndSetLeaf (isc::data::ConstElementPtr const &from, std::string const &xpath, std::string const &name) |
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. | |
libyang::DataNode | findXPath (std::string const &xpath) const |
Retrieves a YANG data node by xpath. | |
template<typename functor_t > | |
void | forAll (std::string const &xpath, functor_t f) const |
Run a function for a node and all its children. | |
std::optional< libyang::DataNode > | getData (std::string const &xpath) const |
Get a YANG data node found at the given absolute xpath. | |
isc::data::ElementPtr | getItem (libyang::DataNode const &data_node, std::string const &xpath) const |
Translate a basic value from YANG to JSON for a given xpath that is relative to the given source node. | |
isc::data::ElementPtr | getItemFromAbsoluteXpath (std::string const &xpath) const |
Translate a basic value from YANG to JSON for a given absolute xpath. | |
template<typename T > | |
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 | getMandatoryDivergingLeaf (isc::data::ElementPtr &storage, libyang::DataNode const &data_node, std::string const &name, std::string const &yang_name) const |
Retrieves a child YANG data node identified by one name from the given parent YANG container node and stores it in the specified storage under a different name. | |
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 stores it in the specified storage. | |
bool | schemaNodeExists (std::string const &xpath) const |
Checks whether a YANG node exists in the schema. | |
void | setItem (const std::string &xpath, isc::data::ConstElementPtr const elem, libyang::LeafBaseType const type) |
Translate and set basic value from JSON to YANG. | |
void | setMandatoryDivergingLeaf (isc::data::ConstElementPtr const &from, std::string const &xpath, std::string const &name, std::string const &yang_name, libyang::LeafBaseType const type) |
Get an element from given ElementPtr node and set it in sysrepo at given 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. | |
Public Member Functions inherited from isc::yang::TranslatorDatabases | |
TranslatorDatabases (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorDatabases ()=default |
Destructor. | |
isc::data::ElementPtr | getDatabases (libyang::DataNode const &data_node, std::string const &xpath) |
Translate database accesses from YANG to JSON. | |
isc::data::ElementPtr | getDatabasesFromAbsoluteXpath (std::string const &xpath) |
Translate database accesses from YANG to JSON. | |
void | setDatabases (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set database accesses from JSON to YANG. | |
Public Member Functions inherited from isc::yang::TranslatorDatabase | |
TranslatorDatabase (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorDatabase ()=default |
Destructor. | |
isc::data::ElementPtr | getDatabase (libyang::DataNode const &data_node) |
Translate a database access from YANG to JSON. | |
isc::data::ElementPtr | getDatabaseFromAbsoluteXpath (std::string const &xpath) |
Translate a database access from YANG to JSON. | |
void | setDatabase (const std::string &xpath, isc::data::ConstElementPtr elem, bool skip=false) |
Translate and set database access from JSON to YANG. | |
Public Member Functions inherited from isc::yang::TranslatorClasses | |
TranslatorClasses (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorClasses ()=default |
Destructor. | |
isc::data::ElementPtr | getClasses (libyang::DataNode const &data_node) |
Translate client classes from YANG to JSON. | |
isc::data::ElementPtr | getClassesFromAbsoluteXpath (std::string const &xpath) |
Translate client classes from YANG to JSON. | |
void | setClasses (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set client classes from JSON to YANG. | |
Public Member Functions inherited from isc::yang::TranslatorClass | |
TranslatorClass (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorClass ()=default |
Destructor. | |
isc::data::ElementPtr | getClass (libyang::DataNode const &data_node) |
Translate a client class from YANG to JSON. | |
isc::data::ElementPtr | getClassFromAbsoluteXpath (std::string const &xpath) |
Translate a client class from YANG to JSON. | |
void | setClass (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set client class from JSON to YANG. | |
Public Member Functions inherited from isc::yang::TranslatorOptionDataList | |
TranslatorOptionDataList (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorOptionDataList ()=default |
Destructor. | |
isc::data::ConstElementPtr | getOptionDataList (libyang::DataNode const &data_node) |
Translate option data list from YANG to JSON. | |
isc::data::ConstElementPtr | getOptionDataListFromAbsoluteXpath (std::string const &xpath) |
Translate option data list from YANG to JSON. | |
void | setOptionDataList (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set option data list from JSON to YANG. | |
Public Member Functions inherited from isc::yang::TranslatorOptionData | |
TranslatorOptionData (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorOptionData ()=default |
Destructor. | |
isc::data::ElementPtr | getOptionData (libyang::DataNode const &data_node) |
Translate an option data from YANG to JSON. | |
isc::data::ElementPtr | getOptionDataFromAbsoluteXpath (std::string const &xpath) |
Translate an option data from YANG to JSON. | |
void | setOptionData (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set option data from JSON to YANG. | |
Public Member Functions inherited from isc::yang::TranslatorOptionDefList | |
TranslatorOptionDefList (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorOptionDefList ()=default |
Destructor. | |
isc::data::ConstElementPtr | getOptionDefList (libyang::DataNode const &data_node) |
Translate option definition list from YANG to JSON. | |
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. | |
Public Member Functions inherited from isc::yang::TranslatorOptionDef | |
TranslatorOptionDef (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorOptionDef ()=default |
Destructor. | |
isc::data::ElementPtr | getOptionDef (libyang::DataNode const &data_node) |
Translate an option definition from YANG to JSON. | |
isc::data::ElementPtr | getOptionDefFromAbsoluteXpath (std::string const &xpath) |
Translate an option definition from YANG to JSON. | |
void | setOptionDef (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set option definition from JSON to YANG. | |
Public Member Functions inherited from isc::yang::TranslatorSharedNetworks | |
TranslatorSharedNetworks (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorSharedNetworks ()=default |
Destructor. | |
isc::data::ElementPtr | getSharedNetworks (libyang::DataNode const &data_node) |
Translate shared networks from YANG to JSON. | |
isc::data::ElementPtr | getSharedNetworksFromAbsoluteXpath (std::string const &xpath) |
Translate shared networks from YANG to JSON. | |
void | setSharedNetworks (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set shared networks from JSON to YANG. | |
Public Member Functions inherited from isc::yang::TranslatorSharedNetwork | |
TranslatorSharedNetwork (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorSharedNetwork ()=default |
Destructor. | |
isc::data::ElementPtr | getSharedNetwork (libyang::DataNode const &data_node) |
Translate a shared network from YANG to JSON. | |
isc::data::ElementPtr | getSharedNetworkFromAbsoluteXpath (std::string const &xpath) |
Translate a shared network from YANG to JSON. | |
void | setSharedNetwork (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set shared network from JSON to YANG. | |
Public Member Functions inherited from isc::yang::TranslatorSubnets | |
TranslatorSubnets (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorSubnets ()=default |
Destructor. | |
isc::data::ElementPtr | getSubnets (libyang::DataNode const &data_node) |
Get and translate subnets from YANG to JSON. | |
isc::data::ElementPtr | getSubnetsFromAbsoluteXpath (std::string const &xpath) |
Get and translate subnets from YANG to JSON. | |
void | setSubnets (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set subnets from JSON to YANG. | |
Public Member Functions inherited from isc::yang::TranslatorSubnet | |
TranslatorSubnet (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorSubnet ()=default |
Destructor. | |
isc::data::ElementPtr | getSubnet (libyang::DataNode const &data_node) |
Get and translate a subnet from YANG to JSON. | |
isc::data::ElementPtr | getSubnetFromAbsoluteXpath (std::string const &xpath) |
Get and translate a subnet from YANG to JSON. | |
void | setSubnet (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set subnet from JSON to YANG. | |
Public Member Functions inherited from isc::yang::TranslatorPools | |
TranslatorPools (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorPools ()=default |
Destructor. | |
isc::data::ElementPtr | getPools (libyang::DataNode const &data_node) |
Translate pools from YANG to JSON. | |
isc::data::ElementPtr | getPoolsFromAbsoluteXpath (std::string const &xpath) |
Translate pools from YANG to JSON. | |
void | setPools (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set (address) pools from JSON to YANG. | |
Public Member Functions inherited from isc::yang::TranslatorPool | |
TranslatorPool (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorPool ()=default |
Destructor. | |
isc::data::ElementPtr | getPool (libyang::DataNode const &data_node) |
Translate a pool from YANG to JSON. | |
isc::data::ElementPtr | getPoolFromAbsoluteXpath (std::string const &xpath) |
Translate a pool from YANG to JSON. | |
void | setPool (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set (address) pool from JSON to YANG. | |
Public Member Functions inherited from isc::yang::TranslatorPdPools | |
TranslatorPdPools (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorPdPools ()=default |
Destructor. | |
isc::data::ElementPtr | getPdPools (libyang::DataNode const &data_node) |
Translate pd-pools from YANG to JSON. | |
isc::data::ElementPtr | getPdPoolsFromAbsoluteXpath (std::string const &xpath) |
Translate pd-pools from YANG to JSON. | |
void | setPdPools (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set pd-pools from JSON to YANG. | |
Public Member Functions inherited from isc::yang::TranslatorPdPool | |
TranslatorPdPool (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorPdPool ()=default |
Destructor. | |
isc::data::ElementPtr | getPdPool (libyang::DataNode const &data_node) |
Translate a pd-pool from YANG to JSON. | |
isc::data::ElementPtr | getPdPoolFromAbsoluteXpath (std::string const &xpath) |
Translate a pd-pool from YANG to JSON. | |
void | setPdPool (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set pd-pool from JSON to YANG. | |
Public Member Functions inherited from isc::yang::TranslatorHosts | |
TranslatorHosts (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorHosts ()=default |
Destructor. | |
isc::data::ElementPtr | getHosts (libyang::DataNode const &data_node) |
Translate host reservations from YANG to JSON. | |
isc::data::ElementPtr | getHostsFromAbsoluteXpath (std::string const &xpath) |
Translate host reservations from YANG to JSON. | |
void | setHosts (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set (address) host reservations from JSON to YANG. | |
Public Member Functions inherited from isc::yang::TranslatorHost | |
TranslatorHost (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorHost ()=default |
Destructor. | |
isc::data::ElementPtr | getHost (libyang::DataNode const &data_node) |
Translate a host reservation from YANG to JSON. | |
isc::data::ElementPtr | getHostFromAbsoluteXpath (std::string const &xpath) |
Translate a host reservation from YANG to JSON. | |
void | setHost (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set host reservation from JSON to YANG. | |
Public Member Functions inherited from isc::yang::TranslatorLoggers | |
TranslatorLoggers (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorLoggers ()=default |
Destructor. | |
isc::data::ConstElementPtr | getLoggers (libyang::DataNode const &data_node) |
Translate loggers from YANG to JSON. | |
isc::data::ConstElementPtr | getLoggersFromAbsoluteXpath (std::string const &xpath) |
Translate loggers from YANG to JSON. | |
void | setLoggers (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set loggers from JSON to YANG. | |
Public Member Functions inherited from isc::yang::TranslatorLogger | |
TranslatorLogger (sysrepo::Session session, const std::string &model) | |
Constructor. | |
virtual | ~TranslatorLogger ()=default |
Destructor. | |
isc::data::ElementPtr | getLogger (libyang::DataNode const &data_node) |
Translate a logger from YANG to JSON. | |
void | setLogger (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set logger from JSON to YANG. | |
Protected Member Functions | |
void | delConfigIetf6 () |
delConfig for ietf-dhcpv6-server. | |
void | delConfigKea () |
delConfig for kea-dhcp[46]-server. | |
isc::data::ElementPtr | getConfigControlKea (libyang::DataNode const &data_node) |
Retrieves configuration control from sysrepo. | |
isc::data::ElementPtr | getConfigIetf6 () |
getConfig for ietf-dhcpv6-server. | |
isc::data::ElementPtr | getConfigKea4 () |
getConfig for kea-dhcp4-server. | |
isc::data::ElementPtr | getConfigKea6 () |
getConfig for kea-dhcp6-server. | |
isc::data::ElementPtr | getDdnsKea (libyang::DataNode const &data_node) |
Retrieves DDNS configuration from sysrepo. | |
isc::data::ElementPtr | getExpiredKea (libyang::DataNode const &data_node) |
Retrieves expired leases processing parameters from sysrepo. | |
isc::data::ElementPtr | getHook (libyang::DataNode const &data_node) |
isc::data::ElementPtr | getHooksKea (libyang::DataNode const &data_node) |
Retrieves hooks configuration from sysrepo. | |
isc::data::ElementPtr | getInterfacesKea (libyang::DataNode const &data_node) |
Retrieves interfaces configuration from sysrepo. | |
isc::data::ElementPtr | getServerKeaDhcp4 () |
getServer for kea-dhcp4-server:config. | |
isc::data::ElementPtr | getServerKeaDhcp6 () |
getServer for kea-dhcp6-server:config. | |
isc::data::ElementPtr | getServerKeaDhcpCommon (libyang::DataNode const &data_node) |
getServer common part for kea-dhcp[46]-server:config. | |
void | setConfigIetf6 (isc::data::ConstElementPtr elem) |
setConfig for ietf-dhcpv6-server. | |
void | setConfigKea4 (isc::data::ConstElementPtr elem) |
setConfig for kea-dhcp[46]-server. | |
void | setConfigKea6 (isc::data::ConstElementPtr elem) |
setConfig for kea-dhcp6-server. | |
void | setServerKeaDhcp4 (isc::data::ConstElementPtr elem) |
setServer for kea-dhcp4-server:config. | |
void | setServerKeaDhcp6 (isc::data::ConstElementPtr elem) |
setServer for kea-dhcp6-server:config. | |
void | setServerKeaDhcpCommon (const std::string &xpath, isc::data::ConstElementPtr elem) |
setServer common part for kea-dhcp[46]-server:config. | |
Protected Member Functions inherited from isc::yang::TranslatorControlSocket | |
isc::data::ElementPtr | getControlSocketKea (libyang::DataNode const &data_node) |
getControlSocket JSON for kea models. | |
void | setControlSocketKea (const std::string &xpath, isc::data::ConstElementPtr elem) |
setControlSocket for kea models. | |
Protected Member Functions inherited from isc::yang::TranslatorDatabases | |
isc::data::ElementPtr | getDatabasesKea (libyang::DataNode const &data_node, std::string const &xpath) |
getDatabases JSON for kea-dhcp[46]-server models. | |
void | setDatabasesKea (const std::string &xpath, isc::data::ConstElementPtr elem) |
setDatabases for kea-dhcp[46]-server models. | |
Protected Member Functions inherited from isc::yang::TranslatorDatabase | |
isc::data::ElementPtr | getDatabaseKea (libyang::DataNode const &data_node) |
getDatabase JSON for kea-dhcp[46]-server models. | |
void | setDatabaseKea (const std::string &xpath, isc::data::ConstElementPtr elem, bool skip) |
setDatabase for kea-dhcp[46]-server models. | |
Protected Member Functions inherited from isc::yang::TranslatorClasses | |
isc::data::ElementPtr | getClassesKea (libyang::DataNode const &data_node) |
getClasses JSON for kea-dhcp[46]. | |
void | setClassesKea (const std::string &xpath, isc::data::ConstElementPtr elem) |
setClasses for kea-dhcp[46]. | |
Protected Member Functions inherited from isc::yang::TranslatorClass | |
isc::data::ElementPtr | getClassKea (libyang::DataNode const &data_node) |
getClass JSON for kea-dhcp[46]. | |
void | setClassKea (const std::string &xpath, isc::data::ConstElementPtr elem) |
setClass for kea-dhcp[46]. | |
Protected Member Functions inherited from isc::yang::TranslatorOptionDataList | |
isc::data::ConstElementPtr | getOptionDataListKea (libyang::DataNode const &data_node) |
getOptionDataList for kea-dhcp[46]. | |
void | setOptionDataListKea (const std::string &xpath, isc::data::ConstElementPtr elem) |
setOptionDataList for kea-dhcp[46]. | |
Protected Member Functions inherited from isc::yang::TranslatorOptionData | |
isc::data::ElementPtr | getOptionDataKea (libyang::DataNode const &data_node) |
getOptionData JSON for kea-dhcp[46]. | |
void | setOptionDataKea (const std::string &xpath, isc::data::ConstElementPtr elem) |
setOptionData for kea-dhcp[46]. | |
Protected Member Functions inherited from isc::yang::TranslatorOptionDefList | |
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. | |
Protected Member Functions inherited from isc::yang::TranslatorOptionDef | |
isc::data::ElementPtr | getOptionDefKea (libyang::DataNode const &data_node) |
getOptionDef implementation specific to kea-dhcp[46]-server models. | |
void | setOptionDefKea (const std::string &xpath, isc::data::ConstElementPtr elem) |
setOptionDef implementation specific to kea-dhcp[46]-server models. | |
Protected Member Functions inherited from isc::yang::TranslatorSharedNetworks | |
void | setSharedNetworksKea (const std::string &xpath, isc::data::ConstElementPtr elem) |
setSharedNetworks for kea-dhcp4-server and kea-dhcp6-server | |
Protected Member Functions inherited from isc::yang::TranslatorSharedNetwork | |
isc::data::ElementPtr | getSharedNetworkKea (libyang::DataNode const &data_node, const std::string &subsel) |
getSharedNetwork for kea-dhcp4-server and kea-dhcp6-server models | |
void | setSharedNetworkKea (const std::string &xpath, isc::data::ConstElementPtr elem, const std::string &subsel) |
setSharedNetwork for kea-dhcp4-server and kea-dhcp6-server models | |
Protected Member Functions inherited from isc::yang::TranslatorSubnets | |
isc::data::ElementPtr | getSubnetsCommon (libyang::DataNode const &data_node, const std::string &subsel) |
getSubnets common part. | |
void | setSubnetsIetf6 (const std::string &xpath, isc::data::ConstElementPtr elem) |
setSubnets for ietf-dhcpv6-server. | |
void | setSubnetsKea (const std::string &xpath, isc::data::ConstElementPtr elem, const std::string &subsel) |
setSubnets for kea-dhcp[46]-server. | |
Protected Member Functions inherited from isc::yang::TranslatorSubnet | |
isc::data::ElementPtr | getSubnetIetf6 (libyang::DataNode const &data_node) |
getSubnet for ietf-dhcpv6-server. | |
isc::data::ElementPtr | getSubnetKea (libyang::DataNode const &data_node) |
getSubnet for kea-dhcp[46]-server. | |
void | setSubnetIetf6 (const std::string &xpath, isc::data::ConstElementPtr elem) |
setSubnet for ietf-dhcpv6-server. | |
void | setSubnetKea (const std::string &xpath, isc::data::ConstElementPtr elem) |
setSubnet for kea-dhcp[46]-server. | |
Protected Member Functions inherited from isc::yang::TranslatorPools | |
isc::data::ElementPtr | getPoolsIetf (libyang::DataNode const &data_node) |
getPools for ietf-dhcpv6-server. | |
isc::data::ElementPtr | getPoolsKea (libyang::DataNode const &data_node) |
getPools for kea-dhcp[46]-server. | |
void | setPoolsByAddresses (const std::string &xpath, isc::data::ConstElementPtr elem) |
setPools using address pair. | |
void | setPoolsById (const std::string &xpath, isc::data::ConstElementPtr elem) |
setPools using pool-id. | |
Protected Member Functions inherited from isc::yang::TranslatorPool | |
isc::data::ElementPtr | getPoolIetf6 (libyang::DataNode const &data_node) |
getPool for ietf-dhcpv6-server. | |
isc::data::ElementPtr | getPoolKea (libyang::DataNode const &data_node) |
getPool for kea-dhcp[46]-server. | |
void | setPoolIetf6 (const std::string &xpath, isc::data::ConstElementPtr elem) |
setPool for ietf-dhcpv6-server. | |
void | setPoolKea (const std::string &xpath, isc::data::ConstElementPtr elem) |
setPool for kea-dhcp[46]-server. | |
Protected Member Functions inherited from isc::yang::TranslatorPdPools | |
isc::data::ElementPtr | getPdPoolsCommon (libyang::DataNode const &data_node) |
getPdPools common part. | |
void | setPdPoolsId (const std::string &xpath, isc::data::ConstElementPtr elem) |
setPdPools using pool-id. | |
void | setPdPoolsPrefix (const std::string &xpath, isc::data::ConstElementPtr elem) |
setPdPools using prefix. | |
Protected Member Functions inherited from isc::yang::TranslatorPdPool | |
isc::data::ElementPtr | getPdPoolIetf6 (libyang::DataNode const &data_node) |
getPdPool for ietf-dhcpv6-server. | |
isc::data::ElementPtr | getPdPoolKea (libyang::DataNode const &data_node) |
getPdPool for kea-dhcp6-server. | |
void | setPdPoolIetf6 (const std::string &xpath, isc::data::ConstElementPtr elem) |
setPdPool for ietf-dhcpv6-server. | |
void | setPdPoolKea (const std::string &xpath, isc::data::ConstElementPtr elem) |
setPdPool for kea-dhcp6-server. | |
Protected Member Functions inherited from isc::yang::TranslatorHosts | |
void | setHostsKea (const std::string &xpath, isc::data::ConstElementPtr elem) |
setHosts for kea-dhcp[46]. | |
Protected Member Functions inherited from isc::yang::TranslatorHost | |
isc::data::ElementPtr | getHostKea (libyang::DataNode const &data_node) |
getHost for kea-dhcp[46]-server models. | |
void | setHostKea (const std::string &xpath, isc::data::ConstElementPtr elem) |
setHost for kea-dhcp[46]-server models. | |
Protected Member Functions inherited from isc::yang::TranslatorLoggers | |
isc::data::ElementPtr | getLoggersKea (libyang::DataNode const &data_node) |
getLoggers JSON for loggers. | |
void | setLoggersKea (const std::string &xpath, isc::data::ConstElementPtr elem) |
setLoggers for loggers. | |
Protected Member Functions inherited from isc::yang::TranslatorLogger | |
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. | |
isc::data::ElementPtr | getOutputOptions (libyang::DataNode const &data_node) |
Translate output options from YANG to JSON. | |
void | setLoggerKea (const std::string &xpath, isc::data::ConstElementPtr elem) |
setLogger for loggers. | |
void | setOutputOption (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set an output option from JSON to YANG. | |
void | setOutputOptions (const std::string &xpath, isc::data::ConstElementPtr elem) |
Translate and set output options from JSON to YANG. | |
Additional Inherited Members | |
Static Public Member Functions inherited from isc::yang::Translator | |
static isc::data::ElementPtr | translateFromYang (std::optional< libyang::DataNode > data_node) |
Translate basic value from the given YANG data node to JSON element. | |
static std::optional< std::string > | translateToYang (isc::data::ConstElementPtr const &elem, libyang::LeafBaseType const type) |
Translate basic value from JSON to YANG. | |
Static Public Member Functions inherited from isc::yang::TranslatorPool | |
static void | getAddresses (const std::string &prefix, std::string &start_address, std::string &end_address) |
Get start and end addresses from prefix. | |
Protected Types inherited from isc::yang::Translator | |
using | Deserializer |
Maps YANG types to functions that transform a YANG type into an ElementPtr. | |
using | Serializer |
Maps YANG types to functions that transform the string representation of an Element into a string that can be passed into Session::setItem(). | |
Static Protected Member Functions inherited from isc::yang::Translator | |
static std::string | decode64 (std::string const &input) |
Decode a YANG element of binary type to a string that can be stored in an Element::string JSON. | |
static std::string | encode64 (std::string const &input) |
Encode a string such that it can be stored in a YANG element of binary type. | |
static Deserializer | initializeDeserializer () |
Initializes the deserializer which is used to translate a YANG node to an ElementPtr. | |
static Serializer | initializeSerializer () |
Initializes the serializer which is used to translate the string value of an Element to a string that can be passed into Session::setItem(). | |
Protected Attributes inherited from isc::yang::Translator | |
std::string | model_ |
The model. | |
sysrepo::Session | session_ |
The sysrepo session. | |
DHCP configuration translation between YANG and JSON.
This translator supports kea-dhcp4-server, kea-dhcp6-server and partially ietf-dhcpv6-server. JSON syntax for kea-dhcp4 is:
YANG syntax for kea-dhcp4-server:config is:
Example of kea-dhcp6 simple configuration:
The same configuration wrote into YANG datastore using setConfig()
with the kea-dhcp4-model and exported to XML format:
JSON syntax for kea-dhcp6 is:
YANG syntax for kea-dhcp6-server:config is:
Example of kea-dhcp6 simple configuration:
The same configuration wrote into YANG datastore using setConfig()
with the kea-dhcp6-model and exported to XML format:
Inheritance graph between translators is:
+-----------------------------------------+ | | +------------------------------+ | | | | +----------+-------------------+----------+ | | | | | | +---------+----------+ | | | | |
config +- shared +- subnet +- pool –+- option -+ basic | network (list) | (list) | data | | (list) | | (list) | | | | | | +- pd -—+ | | | pool | | | | (list) | | | | | | +-----------------—+- host –+ | | (liat) | | | | | | +-----------------—+-------—+ | | | +- class -+- option -------------------—+ | (list) | def | | | (list) | +------—+ | | |
'XXX (list)' stands for 'XXX list — XXX' which is a common motif (only database shows direct dependencies on both the list and the element)
A translator class for converting the config between YANG and JSON.
Currently supports the following models:
Definition at line 398 of file translator_config.h.
isc::yang::TranslatorConfig::TranslatorConfig | ( | sysrepo::Session | session, |
const std::string & | model ) |
Constructor.
session | Sysrepo session. |
model | Model name. |
Definition at line 23 of file translator_config.cc.
|
virtualdefault |
Destructor.
|
protected |
delConfig for ietf-dhcpv6-server.
Definition at line 459 of file translator_config.cc.
References isc::yang::Translator::deleteItem(), and isc::yang::Translator::model_.
Referenced by setConfig().
|
protected |
delConfig for kea-dhcp[46]-server.
Definition at line 480 of file translator_config.cc.
References isc::yang::Translator::deleteItem(), and isc::yang::Translator::model_.
Referenced by setConfig().
ElementPtr isc::yang::TranslatorConfig::getConfig | ( | ) |
Translate the whole DHCP server configuration from YANG to JSON.
NetconfError | when sysrepo raises an error. |
Definition at line 49 of file translator_config.cc.
References getConfigIetf6(), getConfigKea4(), getConfigKea6(), isc_throw, isc::yang::Translator::model_, and isc::Exception::what().
|
protected |
Retrieves configuration control from sysrepo.
data_node | the YANG node representing configuration control |
Definition at line 148 of file translator_config.cc.
References isc::yang::Translator::checkAndGetLeaf(), isc::data::Element::createMap(), and isc::yang::TranslatorDatabases::getDatabases().
Referenced by getServerKeaDhcpCommon().
|
protected |
getConfig for ietf-dhcpv6-server.
This implementation is very preliminary. It handles network-ranges only partially and nothing else.
NetconfError | when sysrepo raises an error. |
Definition at line 66 of file translator_config.cc.
References isc::yang::Translator::checkAndGetDiverging(), isc::data::Element::createMap(), isc::yang::Translator::findXPath(), and isc::yang::TranslatorSubnets::getSubnets().
Referenced by getConfig().
|
protected |
getConfig for kea-dhcp4-server.
NetconfError | when sysrepo raises an error. |
Definition at line 88 of file translator_config.cc.
References isc::data::Element::createMap(), and getServerKeaDhcp4().
Referenced by getConfig().
|
protected |
getConfig for kea-dhcp6-server.
NetconfError | when sysrepo raises an error. |
Definition at line 96 of file translator_config.cc.
References isc::data::Element::createMap(), and getServerKeaDhcp6().
Referenced by getConfig().
|
protected |
Retrieves DDNS configuration from sysrepo.
data_node | the YANG node representing dhcp-ddns configuration |
Definition at line 130 of file translator_config.cc.
References isc::yang::Translator::checkAndGetAndJsonifyLeaf(), isc::yang::Translator::checkAndGetLeaf(), and isc::data::Element::createMap().
Referenced by getServerKeaDhcpCommon().
|
protected |
Retrieves expired leases processing parameters from sysrepo.
data_node | the YANG node representing the configuration for expired lease processing |
Definition at line 116 of file translator_config.cc.
References isc::yang::Translator::checkAndGetLeaf(), and isc::data::Element::createMap().
Referenced by getServerKeaDhcpCommon().
|
protected |
Definition at line 103 of file translator_config.cc.
References isc::yang::Translator::checkAndGetAndJsonifyLeaf(), isc::yang::Translator::checkAndGetLeaf(), and isc::data::Element::createMap().
Referenced by getHooksKea().
|
protected |
Retrieves hooks configuration from sysrepo.
data_node | the YANG node representing the hook libraries |
Definition at line 111 of file translator_config.cc.
References getHook(), and isc::yang::Translator::getList().
Referenced by getServerKeaDhcpCommon().
|
protected |
Retrieves interfaces configuration from sysrepo.
data_node | the YANG node representing the interfaces configuration |
Definition at line 159 of file translator_config.cc.
References isc::yang::Translator::checkAndGetAndJsonifyLeaf(), isc::yang::Translator::checkAndGetLeaf(), and isc::data::Element::createMap().
Referenced by getServerKeaDhcp4(), and getServerKeaDhcp6().
|
protected |
getServer for kea-dhcp4-server:config.
NetconfError | when sysrepo raises an error. |
Definition at line 318 of file translator_config.cc.
References isc::yang::Translator::checkAndGet(), isc::yang::Translator::checkAndGetLeaf(), isc::data::copy(), isc::data::Element::createMap(), isc::yang::Translator::findXPath(), getInterfacesKea(), getServerKeaDhcpCommon(), and isc::yang::TranslatorSubnets::getSubnets().
Referenced by getConfigKea4().
|
protected |
getServer for kea-dhcp6-server:config.
NetconfError | when sysrepo raises an error. |
Definition at line 371 of file translator_config.cc.
References isc::yang::Translator::checkAndGetAndJsonifyLeaf(), isc::yang::Translator::checkAndGetLeaf(), isc::data::Element::createMap(), isc::yang::Translator::findXPath(), getInterfacesKea(), getServerKeaDhcpCommon(), and isc::yang::TranslatorSubnets::getSubnets().
Referenced by getConfigKea6().
|
protected |
getServer common part for kea-dhcp[46]-server:config.
data_node | the YANG node representing the server configuration |
Definition at line 180 of file translator_config.cc.
References isc::yang::Translator::checkAndGet(), isc::yang::Translator::checkAndGetAndJsonifyLeaf(), isc::yang::Translator::checkAndGetLeaf(), isc::data::Element::createMap(), isc::yang::TranslatorClasses::getClasses(), getConfigControlKea(), isc::yang::TranslatorControlSocket::getControlSocket(), isc::yang::TranslatorDatabase::getDatabase(), isc::yang::TranslatorDatabases::getDatabases(), getDdnsKea(), getExpiredKea(), getHooksKea(), isc::yang::TranslatorHosts::getHosts(), isc::yang::TranslatorLoggers::getLoggers(), isc::yang::TranslatorOptionDataList::getOptionDataList(), isc::yang::TranslatorOptionDefList::getOptionDefList(), and isc::yang::TranslatorSharedNetworks::getSharedNetworks().
Referenced by getServerKeaDhcp4(), and getServerKeaDhcp6().
void isc::yang::TranslatorConfig::setConfig | ( | isc::data::ElementPtr | elem | ) |
Translate and set the DHCP server configuration from JSON to YANG.
Null elem argument removes the config containers.
elem | The JSON element. |
Definition at line 424 of file translator_config.cc.
References delConfigIetf6(), delConfigKea(), isc_throw, isc::yang::Translator::model_, isc::yang::AdaptorConfig::preProcess4(), isc::yang::AdaptorConfig::preProcess6(), setConfigIetf6(), setConfigKea4(), setConfigKea6(), and isc::Exception::what().
|
protected |
setConfig for ietf-dhcpv6-server.
This implementation is very preliminary. It handles network-ranges only partially and nothing else.
elem | The JSON element. |
BadValue | on config without Dhcp6. |
Definition at line 464 of file translator_config.cc.
References isc_throw, isc::yang::Translator::model_, and isc::yang::TranslatorSubnets::setSubnets().
Referenced by setConfig().
|
protected |
setConfig for kea-dhcp[46]-server.
elem | The JSON element. |
Definition at line 485 of file translator_config.cc.
References setServerKeaDhcp4().
Referenced by setConfig().
|
protected |
setConfig for kea-dhcp6-server.
elem | The JSON element. |
Definition at line 493 of file translator_config.cc.
References setServerKeaDhcp6().
Referenced by setConfig().
|
protected |
setServer for kea-dhcp4-server:config.
elem | The JSON element. |
Definition at line 663 of file translator_config.cc.
References isc::yang::Translator::checkAndSetLeaf(), isc::yang::Translator::checkAndSetLeafList(), isc::yang::Translator::checkAndSetUserContext(), setServerKeaDhcpCommon(), and isc::yang::TranslatorSubnets::setSubnets().
Referenced by setConfigKea4().
|
protected |
setServer for kea-dhcp6-server:config.
elem | The JSON element. |
Definition at line 703 of file translator_config.cc.
References isc::yang::Translator::checkAndSetLeaf(), isc::yang::Translator::checkAndSetLeafList(), isc::yang::Translator::checkAndSetUserContext(), setServerKeaDhcpCommon(), and isc::yang::TranslatorSubnets::setSubnets().
Referenced by setConfigKea6().
|
protected |
setServer common part for kea-dhcp[46]-server:config.
xpath | The xpath of the server. |
elem | The JSON element. |
Definition at line 501 of file translator_config.cc.
References isc::yang::Translator::checkAndSetLeaf(), isc::yang::Translator::checkAndSetLeafList(), isc::yang::Translator::checkAndSetUserContext(), isc::yang::Translator::checkAndStringifyAndSetLeaf(), isc::yang::TranslatorClasses::setClasses(), isc::yang::TranslatorControlSocket::setControlSocket(), isc::yang::TranslatorDatabase::setDatabase(), isc::yang::TranslatorDatabases::setDatabases(), isc::yang::TranslatorHosts::setHosts(), isc::yang::Translator::setItem(), isc::yang::TranslatorLoggers::setLoggers(), isc::yang::TranslatorOptionDataList::setOptionDataList(), isc::yang::TranslatorOptionDefList::setOptionDefList(), and isc::yang::TranslatorSharedNetworks::setSharedNetworks().
Referenced by setServerKeaDhcp4(), and setServerKeaDhcp6().