Kea
1.9.9-git
|
JSON adaptor between canonical Kea and YANG models. More...
#include <adaptor.h>
Public Member Functions | |
Adaptor () | |
Constructor. More... | |
virtual | ~Adaptor () |
Destructor. More... | |
Static Public Member Functions | |
static void | fromParent (const std::string &name, isc::data::ConstElementPtr parent, isc::data::ConstElementPtr list) |
Moves a parameter from parent to a list of children. More... | |
static isc::data::ConstElementPtr | getContext (isc::data::ConstElementPtr parent) |
Get user context. More... | |
static void | modify (isc::data::ConstElementPtr path, isc::data::ConstElementPtr actions, isc::data::ElementPtr config) |
Modify a configuration in its JSON element format. More... | |
static void | toParent (const std::string &name, isc::data::ElementPtr parent, isc::data::ConstElementPtr list) |
Moves a parameter to a parent. More... | |
JSON adaptor between canonical Kea and YANG models.
An adaptor slightly modifies a JSON configuration between canonical Kea what required or rendered by a YANG model, e.g. moving a parameter to/from a parent. The basic adaptor provides a set of tools.
isc::yang::Adaptor::Adaptor | ( | ) |
Constructor.
Definition at line 20 of file adaptor.cc.
|
virtual |
Destructor.
Definition at line 23 of file adaptor.cc.
|
static |
Moves a parameter from parent to a list of children.
Move a parameter from the parent to each item in a list. If the parameter exists in a child, it is skipped for this particular child, not overridden.
name | The parameter name. |
parent | The parent element. |
list | The children list. |
Definition at line 45 of file adaptor.cc.
|
static |
Get user context.
Get user-context and/or comment and return it with the comment if exists moved inside the user-context (without checking if there is already a comment as it should never be the case).
This behavior is used to handle comments. For historical purposes Kea allows to define comments in some scopes. Once the user-context has been introduced, the comment (as a separate text field) disappeared and was moved to comment key within user-context. Nevertheless, the old syntax is still supported.
Definition at line 27 of file adaptor.cc.
References isc::data::copy().
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::TranslatorPdPool::setPdPoolKea(), isc::yang::TranslatorPool::setPoolKea(), isc::yang::TranslatorConfig::setServerKeaDhcp4(), isc::yang::TranslatorConfig::setServerKeaDhcp6(), isc::yang::TranslatorConfig::setServerKeaDhcpCommon(), isc::yang::TranslatorSharedNetwork::setSharedNetworkKea(), and isc::yang::TranslatorSubnet::setSubnetKea().
|
static |
Modify a configuration in its JSON element format.
Apply recursively starting at the beginning of the path.
Smart merging tool, e.g. completing a from yang configuration.
A modification is a path and actions:
path item can be:
}: current scope is a list, go down to the item using the key / value pair.
For instance to add a control-socket entry in a configuration from a generic (vs Kea) model:
path | The search list to follow down to the place to apply the action list. |
actions | The action list |
config | The configuration (JSON map) to modify. |
Definition at line 302 of file adaptor.cc.
|
static |
Moves a parameter to a parent.
Move a parameter from children to the parent. All children on the list must have the parameter specified and it has to have the same value.
name | The parameter name. |
parent | The parent element. |
list | The children list. |
Definition at line 61 of file adaptor.cc.
References isc_throw.