![]() |
Kea 3.1.1
|
JSON adaptor for Kea server configurations. More...
#include <adaptor_config.h>
Static Public Member Functions | |
static void | preProcess4 (isc::data::ElementPtr config) |
Pre process a DHCPv4 configuration. | |
static void | preProcess6 (isc::data::ElementPtr config) |
Pre process a DHCPv6 configuration. | |
![]() | |
static void | quoteIdentifier (isc::data::ElementPtr host) |
Quote when needed a host identifier. | |
![]() | |
static void | checkCode (isc::data::ConstElementPtr option) |
Check if code is specified in option defintion. | |
static void | checkType (isc::data::ConstElementPtr option) |
Checks if type is specified in option definition. | |
static void | collect (isc::data::ConstElementPtr option, OptionCodes &codes) |
Collect definition. | |
static void | initCodes (OptionCodes &codes, const std::string &space) |
Initialize code map. | |
static void | setCode (isc::data::ElementPtr option, const OptionCodes &codes) |
Set code from name and definitions. | |
static void | setSpace (isc::data::ElementPtr option, const std::string &space) |
Set space. | |
![]() | |
static void | assignID (isc::data::ElementPtr subnet, isc::dhcp::SubnetIDSet &set, isc::dhcp::SubnetID &next) |
Assign subnet ID. | |
static bool | collectID (isc::data::ConstElementPtr subnet, isc::dhcp::SubnetIDSet &set) |
Collect a subnet ID. | |
static void | updateRelay (isc::data::ElementPtr subnet) |
Update relay. | |
Static Protected Member Functions | |
static void | preProcess (isc::data::ElementPtr dhcp, const std::string &subsel, const std::string &space) |
Pre process a configuration. | |
static void | sanitizeDatabase (isc::data::ElementPtr dhcp) |
Update (hosts) database. | |
static void | sanitizeEmptyListPools (isc::data::ConstElementPtr pools) |
Process empty lists in a pool list. | |
static void | sanitizeEmptyListSharedNetworks (isc::data::ConstElementPtr networks, const std::string &subsel) |
Process empty lists in a shared-network list. | |
static void | sanitizeEmptyListSubnets (isc::data::ConstElementPtr subnets) |
Process empty lists in a subnet list. | |
static void | sanitizeHostList (isc::data::ConstElementPtr hosts) |
Process host reservation list. | |
static void | SanitizeHostsInSharedNetworks (isc::data::ConstElementPtr networks, const std::string &space) |
Process host reservations in a shared network list. | |
static void | sanitizeHostSubnets (isc::data::ConstElementPtr subnets) |
Process host reservations in a subnet list. | |
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. | |
static void | sanitizeOptionDataList (isc::data::ConstElementPtr options, const std::string &space, const OptionCodes &codes) |
Set missing option codes to an option data list. | |
static void | sanitizeOptionDefList (isc::data::ConstElementPtr defs, const std::string &space, OptionCodes &codes) |
Collect option definitions from an option definition list. | |
static void | sanitizeOptionHosts (isc::data::ConstElementPtr hosts, const std::string &space, const OptionCodes &codes) |
Set missing option codes to a host reservation list. | |
static void | sanitizeOptionPools (isc::data::ConstElementPtr pools, const std::string &space, const OptionCodes &codes) |
Set missing option codes to a pool list. | |
static void | sanitizeOptionSharedNetworks (isc::data::ConstElementPtr networks, const std::string &space, const OptionCodes &codes) |
Set missing option codes to a shared network list. | |
static void | sanitizeOptionSubnets (isc::data::ConstElementPtr subnets, const std::string &space, const OptionCodes &codes) |
Set missing option codes to a subnet list. | |
static void | sanitizePools (isc::data::ConstElementPtr pools) |
Sanitizes all pools in a pools list. | |
static void | sanitizePoolsInSharedNetworks (isc::data::ConstElementPtr networks, const std::string &subsel) |
Sanitizes all pools in all subnets in a shared network list. | |
static void | sanitizePoolsInSubnets (isc::data::ConstElementPtr subnets) |
Sanitizes all pools in a subnets list. | |
static void | sanitizeRelayInSharedNetworks (isc::data::ConstElementPtr networks, const std::string &subsel) |
Sanitizes relay information in a shared network list. | |
static void | sanitizeRelaySubnets (isc::data::ConstElementPtr subnets) |
Sanitizes relay information in subnets in a subnet list. | |
static void | sanitizeRelaySuppliedOptions (isc::data::ElementPtr dhcp) |
Update relay supplied options. | |
static void | sharedNetworksAssignID (isc::data::ConstElementPtr networks, isc::dhcp::SubnetIDSet &set, isc::dhcp::SubnetID &next, const std::string &subsel) |
Assigns subnet-id to every subnet in a shared network list. | |
static bool | sharedNetworksCollectID (isc::data::ConstElementPtr networks, isc::dhcp::SubnetIDSet &set, const std::string &subsel) |
Collects subnet-ids in all subnets in all shared network list. | |
static void | subnetsAssignID (isc::data::ConstElementPtr subnets, isc::dhcp::SubnetIDSet &set, isc::dhcp::SubnetID &next) |
Assigns subnet-id to every subnet in a subnet list. | |
static bool | subnetsCollectID (isc::data::ConstElementPtr subnets, isc::dhcp::SubnetIDSet &set) |
Collects subnet-ids on all subnets. | |
![]() | |
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. | |
Additional Inherited Members | |
![]() | |
virtual | ~AdaptorHost ()=default |
Destructor. | |
![]() | |
virtual | ~AdaptorOption ()=default |
Destructor. | |
![]() | |
virtual | ~AdaptorSubnet ()=default |
Destructor. | |
![]() | |
static const std::string | STD_CHARACTERS |
The string of standard (vs special or not printable) characters (digit, letters, -, ., @, _). | |
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.
|
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 561 of file adaptor_config.cc.
References isc::yang::AdaptorOption::initCodes(), isc_throw, sanitizeDatabase(), sanitizeEmptyListSharedNetworks(), sanitizeEmptyListSubnets(), sanitizeHostList(), SanitizeHostsInSharedNetworks(), sanitizeHostSubnets(), sanitizeOptionClasses(), sanitizeOptionDataList(), sanitizeOptionDefList(), sanitizeOptionHosts(), sanitizeOptionSharedNetworks(), sanitizeOptionSubnets(), sanitizePoolsInSharedNetworks(), sanitizePoolsInSubnets(), sanitizeRelayInSharedNetworks(), sanitizeRelaySubnets(), sanitizeRelaySuppliedOptions(), sharedNetworksAssignID(), sharedNetworksCollectID(), subnetsAssignID(), and subnetsCollectID().
Referenced by preProcess4(), and preProcess6().
|
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 653 of file adaptor_config.cc.
References isc::data::copy(), isc_throw, Element::map, and preProcess().
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 673 of file adaptor_config.cc.
References isc::data::copy(), isc_throw, Element::map, and preProcess().
Referenced by isc::yang::TranslatorConfig::setConfig().
|
staticprotected |
Update (hosts) database.
Force the use of hosts-databases vs. hosts-database.
dhcp | The DHCP server. |
Definition at line 537 of file adaptor_config.cc.
References isc::data::copy(), and Element::createList().
Referenced by preProcess().
|
staticprotected |
Process empty lists in a pool list.
Remove empty lists in a pool list. removing:
pools | The pool list. |
Definition at line 377 of file adaptor_config.cc.
Referenced by sanitizeEmptyListSubnets().
|
staticprotected |
Process empty lists in a shared-network list.
Remove empty lists in a shared network list. removing:
networks | The shared network list. |
subsel | The subnet list name. |
Definition at line 435 of file adaptor_config.cc.
References sanitizeEmptyListSubnets().
Referenced by preProcess().
|
staticprotected |
Process empty lists in a subnet list.
Remove empty lists in a subnet list. removing:
subnets | The subnet list. |
Definition at line 405 of file adaptor_config.cc.
References sanitizeEmptyListPools().
Referenced by preProcess(), and sanitizeEmptyListSharedNetworks().
|
staticprotected |
Process host reservation list.
Quote when needed flex-id identifiers.
hosts | The host reservation list. |
Definition at line 465 of file adaptor_config.cc.
References isc::yang::AdaptorHost::quoteIdentifier().
Referenced by preProcess(), and sanitizeHostSubnets().
|
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 492 of file adaptor_config.cc.
References sanitizeHostSubnets().
Referenced by preProcess().
|
staticprotected |
Process host reservations in a subnet list.
Quote when needed flex-id identifiers.
subnets | The subnet list. |
Definition at line 479 of file adaptor_config.cc.
References sanitizeHostList().
Referenced by preProcess(), and SanitizeHostsInSharedNetworks().
|
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 198 of file adaptor_config.cc.
References sanitizeOptionDataList(), and sanitizeOptionDefList().
Referenced by preProcess().
|
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 176 of file adaptor_config.cc.
References isc::yang::AdaptorOption::setCode(), and isc::yang::AdaptorOption::setSpace().
Referenced by preProcess(), sanitizeOptionClasses(), sanitizeOptionHosts(), sanitizeOptionPools(), sanitizeOptionSharedNetworks(), and sanitizeOptionSubnets().
|
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 156 of file adaptor_config.cc.
References isc::yang::AdaptorOption::checkCode(), isc::yang::AdaptorOption::checkType(), isc::yang::AdaptorOption::collect(), and isc::yang::AdaptorOption::setSpace().
Referenced by preProcess(), and sanitizeOptionClasses().
|
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 259 of file adaptor_config.cc.
References sanitizeOptionDataList().
Referenced by preProcess(), and sanitizeOptionSubnets().
|
staticprotected |
Set missing option codes to a pool list.
pools | The pool list. |
space | The default space name. |
codes | Option definitions. |
Definition at line 238 of file adaptor_config.cc.
References sanitizeOptionDataList().
Referenced by sanitizeOptionSubnets().
|
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 336 of file adaptor_config.cc.
References sanitizeOptionDataList(), and sanitizeOptionSubnets().
Referenced by preProcess().
|
staticprotected |
Set missing option codes to a subnet list.
subnets | The subnet list. |
space | The default space name. |
codes | Option definitions. |
Definition at line 280 of file adaptor_config.cc.
References sanitizeOptionDataList(), sanitizeOptionHosts(), and sanitizeOptionPools().
Referenced by preProcess(), and sanitizeOptionSharedNetworks().
|
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 116 of file adaptor_config.cc.
References isc::yang::AdaptorPool::canonizePool().
Referenced by sanitizePoolsInSubnets().
|
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 143 of file adaptor_config.cc.
References sanitizePoolsInSubnets().
Referenced by preProcess().
|
staticprotected |
Sanitizes all pools in a subnets list.
subnets | The subnet list. |
Definition at line 131 of file adaptor_config.cc.
References sanitizePools().
Referenced by preProcess(), and sanitizePoolsInSharedNetworks().
|
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 522 of file adaptor_config.cc.
References sanitizeRelaySubnets(), and isc::yang::AdaptorSubnet::updateRelay().
Referenced by preProcess().
|
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 509 of file adaptor_config.cc.
References isc::yang::AdaptorSubnet::updateRelay().
Referenced by preProcess(), and sanitizeRelayInSharedNetworks().
|
staticprotected |
Update relay supplied options.
Remove empty relay supplied option list.
dhcp | The DHCPv6 server. |
Definition at line 551 of file adaptor_config.cc.
Referenced by preProcess().
|
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 94 of file adaptor_config.cc.
References isc::yang::AdaptorSubnet::assignID().
Referenced by preProcess().
|
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 47 of file adaptor_config.cc.
References subnetsCollectID().
Referenced by preProcess().
|
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 80 of file adaptor_config.cc.
References isc::yang::AdaptorSubnet::assignID().
Referenced by preProcess().
|
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 25 of file adaptor_config.cc.
References isc::yang::AdaptorSubnet::collectID().
Referenced by preProcess(), and sharedNetworksCollectID().