Kea
1.9.9-git
|
JSON adaptor for Kea server configurations. More...
#include <adaptor_config.h>
Public Member Functions | |
AdaptorConfig () | |
Constructor. More... | |
virtual | ~AdaptorConfig () |
Destructor. More... | |
Public Member Functions inherited from isc::yang::AdaptorHost | |
AdaptorHost () | |
Constructor. More... | |
virtual | ~AdaptorHost () |
Destructor. More... | |
Public Member Functions inherited from isc::yang::AdaptorOption | |
AdaptorOption () | |
Constructor. More... | |
virtual | ~AdaptorOption () |
Destructor. More... | |
Public Member Functions inherited from isc::yang::AdaptorSubnet | |
AdaptorSubnet () | |
Constructor. More... | |
virtual | ~AdaptorSubnet () |
Destructor. More... | |
Static Public Member Functions | |
static void | preProcess4 (isc::data::ConstElementPtr config) |
Pre process a DHCPv4 configuration. More... | |
static void | preProcess6 (isc::data::ConstElementPtr config) |
Pre process a DHCPv6 configuration. More... | |
Static Public Member Functions inherited from isc::yang::AdaptorHost | |
static void | quoteIdentifier (isc::data::ElementPtr host) |
Quote when needed a host identifier. More... | |
Static Public Member Functions inherited from isc::yang::AdaptorOption | |
static void | checkCode (isc::data::ConstElementPtr option) |
Check if code is specified in option defintion. More... | |
static void | checkType (isc::data::ConstElementPtr option) |
Checks if type is specified in option definition. More... | |
static void | collect (isc::data::ConstElementPtr option, OptionCodes &codes) |
Collect definition. More... | |
static void | initCodes (OptionCodes &codes, const std::string &space) |
Initialize code map. More... | |
static void | setCode (isc::data::ElementPtr option, const OptionCodes &codes) |
Set code from name and definitions. More... | |
static void | setSpace (isc::data::ElementPtr option, const std::string &space) |
Set space. More... | |
Static Public Member Functions inherited from isc::yang::AdaptorSubnet | |
static void | assignID (isc::data::ElementPtr subnet, SubnetIDSet &set, isc::dhcp::SubnetID &next) |
Assign subnet ID. More... | |
static bool | collectID (isc::data::ConstElementPtr subnet, SubnetIDSet &set) |
Collect a subnet ID. More... | |
static void | updateRelay (isc::data::ElementPtr subnet) |
Update relay. More... | |
Static Protected Member Functions | |
static void | preProcess (isc::data::ElementPtr dhcp, const std::string &subsel, const std::string &space) |
Pre process a configuration. More... | |
static void | requireClassesSharedNetworks (isc::data::ConstElementPtr networks, const std::string &subsel) |
Process require client classes in a shared network list. More... | |
static void | sanitizeDatabase (isc::data::ConstElementPtr dhcp) |
Update (hosts) database. More... | |
static void | sanitizeHostList (isc::data::ConstElementPtr hosts) |
Process host reservation list. More... | |
static void | SanitizeHostsInSharedNetworks (isc::data::ConstElementPtr networks, const std::string &space) |
Process host reservations in a shared network list. More... | |
static void | sanitizeHostSubnets (isc::data::ConstElementPtr subnets) |
Process host reservations in a subnet list. More... | |
static void | sanitizeOptionClasses (isc::data::ConstElementPtr classes, const std::string &space, OptionCodes &codes) |
Collect option definitions from a client class list and set missing option codes. More... | |
static void | sanitizeOptionDataList (isc::data::ConstElementPtr options, const std::string &space, const OptionCodes &codes) |
Set missing option codes to an option data list. More... | |
static void | sanitizeOptionDefList (isc::data::ConstElementPtr defs, const std::string &space, OptionCodes &codes) |
Collect option definitions from an option definition list. More... | |
static void | sanitizeOptionHosts (isc::data::ConstElementPtr hosts, const std::string &space, const OptionCodes &codes) |
Set missing option codes to a host reservation list. More... | |
static void | sanitizeOptionPools (isc::data::ConstElementPtr pools, const std::string &space, const OptionCodes &codes) |
Set missing option codes to a pool list. More... | |
static void | sanitizeOptionSharedNetworks (isc::data::ConstElementPtr networks, const std::string &space, const OptionCodes &codes) |
Set missing option codes to a shared network list. More... | |
static void | sanitizeOptionSubnets (isc::data::ConstElementPtr subnets, const std::string &space, const OptionCodes &codes) |
Set missing option codes to a subnet list. More... | |
static void | sanitizePools (isc::data::ConstElementPtr pools) |
Sanitizes all pools in a pools list. More... | |
static void | sanitizePoolsInSharedNetworks (isc::data::ConstElementPtr networks, const std::string &subsel) |
Sanitizes all pools in all subnets in a shared network list. More... | |
static void | sanitizePoolsInSubnets (isc::data::ConstElementPtr subnets) |
Sanitizes all pools in a subnets list. More... | |
static void | sanitizeRelayInSharedNetworks (isc::data::ConstElementPtr networks, const std::string &subsel) |
Sanitizes relay information in a shared network list. More... | |
static void | sanitizeRelaySubnets (isc::data::ConstElementPtr subnets) |
Sanitizes relay information in subnets in a subnet list. More... | |
static void | sanitizeRelaySuppliedOptions (isc::data::ConstElementPtr dhcp) |
Update relay supplied options. More... | |
static void | sanitizeRequireClassesPools (isc::data::ConstElementPtr pools) |
Process require client classes in a pool list. More... | |
static void | sanitizeRequireClassesSubnets (isc::data::ConstElementPtr subnets) |
Process require client classes in a subnet list. More... | |
static void | sharedNetworksAssignID (isc::data::ConstElementPtr networks, SubnetIDSet &set, isc::dhcp::SubnetID &next, const std::string &subsel) |
Assigns subnet-id to every subnet in a shared network list. More... | |
static bool | sharedNetworksCollectID (isc::data::ConstElementPtr networks, SubnetIDSet &set, const std::string &subsel) |
Collects subnet-ids in all subnets in all shared network list. More... | |
static void | subnetsAssignID (isc::data::ConstElementPtr subnets, SubnetIDSet &set, isc::dhcp::SubnetID &next) |
Assigns subnet-id to every subnet in a subnet list. More... | |
static bool | subnetsCollectID (isc::data::ConstElementPtr subnets, SubnetIDSet &set) |
Collects subnet-ids on all subnets. More... | |
Static Protected Member Functions inherited from isc::yang::AdaptorOption | |
static void | initCodesInternal (OptionCodes &codes, const std::string &space, const isc::dhcp::OptionDefParams *params, size_t params_size) |
Initialize code map from option definition parameters. More... | |
Additional Inherited Members | |
Static Public Attributes inherited from isc::yang::AdaptorHost | |
static const std::string | STD_CHARACTERS |
The string of standard (vs special or not printable) characters (digit, letters, -, ., @, _). More... | |
JSON adaptor for Kea server configurations.
Currently only from JSON to YANG for DHCPv4 and DHCPv6 available as preProcess4 and preProcess6 class methods, filling some required (by YANG) fields (e.g. subnet IDs, or option code and space), or transforming a hand-written JSON configuration into a canonical form.
Definition at line 25 of file adaptor_config.h.
isc::yang::AdaptorConfig::AdaptorConfig | ( | ) |
Constructor.
Definition at line 23 of file adaptor_config.cc.
|
virtual |
Destructor.
Definition at line 26 of file adaptor_config.cc.
|
staticprotected |
Pre process a configuration.
Assign subnet IDs, check and set default in options, etc.
dhcp | The server configuration. |
subsel | The subnet list name. |
space | The default option space name. |
MissingKey | when a required key is missing. |
Definition at line 528 of file adaptor_config.cc.
References isc_throw.
|
static |
Pre process a DHCPv4 configuration.
Assign subnet IDs, check and set defaults in options, etc. Note even though the parameter is a ConstElementPtr and is not modified, sub-structures can modify it, so if you need a copy do a deep one.
config | The configuration. |
MissingKey | when a required key is missing. |
BadValue | when null or not a map or deprecated Logging present. |
Definition at line 620 of file adaptor_config.cc.
References isc_throw.
Referenced by isc::yang::TranslatorConfig::setConfig().
|
static |
Pre process a DHCPv6 configuration.
Assign subnet IDs, check and set default in options, etc. Note even though the parameter is a ConstElementPtr and is not modified, sub-structures can modify it, so if you need a copy do a deep one.
config | The configuration. |
MissingKey | when a required key is missing. |
BadValue | when null or not a map or deprecated Logging present. |
Definition at line 639 of file adaptor_config.cc.
References isc_throw.
Referenced by isc::yang::TranslatorConfig::setConfig().
|
staticprotected |
Process require client classes in a shared network list.
Remove empty require client class lists.
networks | The shared network list. |
subsel | The subnet list name. |
Definition at line 412 of file adaptor_config.cc.
|
staticprotected |
Update (hosts) database.
Force the use of hosts-databases vs. hosts-database.
dhcp | The DHCP server. |
Definition at line 502 of file adaptor_config.cc.
References isc::data::Element::remove().
|
staticprotected |
Process host reservation list.
Quote when needed flex-id identifiers.
hosts | The host reservation list. |
Definition at line 430 of file adaptor_config.cc.
|
staticprotected |
Process host reservations in a shared network list.
Quote when needed flex-id identifiers.
networks | The shared network list. |
space | The default space name. |
Definition at line 457 of file adaptor_config.cc.
|
staticprotected |
Process host reservations in a subnet list.
Quote when needed flex-id identifiers.
subnets | The subnet list. |
Definition at line 444 of file adaptor_config.cc.
|
staticprotected |
Collect option definitions from a client class list and set missing option codes.
classes | The client class list. |
space | The default space name. |
codes | Option definitions. |
Definition at line 199 of file adaptor_config.cc.
|
staticprotected |
Set missing option codes to an option data list.
options | The option data list. |
space | The default space name. |
codes | Option definitions. |
Definition at line 181 of file adaptor_config.cc.
|
staticprotected |
Collect option definitions from an option definition list.
Collects options definitions, but also sets missing option space with default.
defs | The option definition list. |
space | The default space name (missing will be filled with this) |
codes | Option definitions. |
Definition at line 161 of file adaptor_config.cc.
|
staticprotected |
Set missing option codes to a host reservation list.
hosts | The host reservation list. |
space | The default space name. |
codes | Option definitions. |
Definition at line 260 of file adaptor_config.cc.
|
staticprotected |
Set missing option codes to a pool list.
pools | The pool list. |
space | The default space name. |
codes | Option definitions. |
Definition at line 239 of file adaptor_config.cc.
|
staticprotected |
Set missing option codes to a shared network list.
networks | The shared network list. |
space | The default space name. |
codes | Option definitions. |
Definition at line 337 of file adaptor_config.cc.
|
staticprotected |
Set missing option codes to a subnet list.
subnets | The subnet list. |
space | The default space name. |
codes | Option definitions. |
Definition at line 281 of file adaptor_config.cc.
|
staticprotected |
Sanitizes all pools in a pools list.
Goes over each pool and cleans up its definition (removes extra spaces, adds one space before and after - ).
pools | The pool list. |
Definition at line 121 of file adaptor_config.cc.
|
staticprotected |
Sanitizes all pools in all subnets in a shared network list.
networks | The shared network list. |
subsel | The subnet list name. |
Definition at line 148 of file adaptor_config.cc.
|
staticprotected |
Sanitizes all pools in a subnets list.
subnets | The subnet list. |
Definition at line 136 of file adaptor_config.cc.
|
staticprotected |
Sanitizes relay information in a shared network list.
Force the use of ip-addresses when it finds an ip-address entry.
networks | The shared network list. |
subsel | The subnet list name. |
Definition at line 487 of file adaptor_config.cc.
|
staticprotected |
Sanitizes relay information in subnets in a subnet list.
Force the use of ip-addresses when it finds an ip-address entry.
subnets | The subnet list. |
Definition at line 474 of file adaptor_config.cc.
|
staticprotected |
Update relay supplied options.
Remove empty relay supplied option list.
dhcp | The DHCPv6 server. |
Definition at line 517 of file adaptor_config.cc.
References isc::data::Element::remove().
|
staticprotected |
Process require client classes in a pool list.
Remove empty require client class list.
pools | The pool list. |
Definition at line 378 of file adaptor_config.cc.
|
staticprotected |
Process require client classes in a subnet list.
Remove empty require client class lists.
subnets | The subnet list. |
Definition at line 394 of file adaptor_config.cc.
|
staticprotected |
Assigns subnet-id to every subnet in a shared network list.
Only those subnets that don't have one subnet-id assigned yet, will get a new subnet-id value.
networks | The shared network list. |
set | The reference to the set of assigned IDs. |
next | The next ID. |
subsel | The subnet list name. |
Definition at line 99 of file adaptor_config.cc.
|
staticprotected |
Collects subnet-ids in all subnets in all shared network list.
It will go over all subnets in all shared networks specified to collect their subnet-ids. It will then return true if all subnets have ids. If the subnets list is empty, it will also return true. False will be returned if there is at least one subnet that doesn't have subnet-id.
networks | The shared network list. |
set | The reference to the set of assigned IDs. |
subsel | The subnet list name. |
Definition at line 52 of file adaptor_config.cc.
|
staticprotected |
Assigns subnet-id to every subnet in a subnet list.
Only those subnets that don't have one subnet-id assigned yet, will get a new subnet-id value.
subnets | The subnet list. |
set | The reference to the set of assigned IDs. |
next | The next ID. |
Definition at line 85 of file adaptor_config.cc.
|
staticprotected |
Collects subnet-ids on all subnets.
It will go over all subnets and collect their ids. It will then return true if all subnets have ids. If the subnets list is empty, it will also return true. False will be returned if there is at least one subnet that doesn't have subnet-id.
subnets | The subnet list. |
set | The reference to the set of assigned IDs. |
Definition at line 30 of file adaptor_config.cc.