Kea 2.5.7
isc::yang::AdaptorPool Class Reference

JSON adaptor for pools between canonical Kea and YANG models. More...

#include <adaptor_pool.h>

Public Member Functions

virtual ~AdaptorPool ()=default
 Destructor.
 

Static Public Member Functions

static void canonizePool (isc::data::ElementPtr pool)
 Canonize pool.
 
static void fromSubnet (const std::string &model, isc::data::ConstElementPtr subnet, isc::data::ConstElementPtr pools)
 Moves parameters from subnets to pools.
 
static void toSubnet (const std::string &model, isc::data::ElementPtr subnet, isc::data::ConstElementPtr pools)
 Move parameters from pools to the subnet.
 

Static Protected Member Functions

static void fromSubnetIetf6 (isc::data::ConstElementPtr subnet, isc::data::ConstElementPtr pools)
 From subnets for ietf-dhcpv6-server.
 
static void toSubnetIetf6 (isc::data::ElementPtr subnet, isc::data::ConstElementPtr pools)
 To subnet for ietf-dhcpv6-server.
 

Detailed Description

JSON adaptor for pools between canonical Kea and YANG models.

First adaptor canonizePool checks and fixes if needed the pool entry to a canonical form which is no space for prefix and one space each side of the minus character for ranges.

Second adaptor is specific to the IETF DHCPv6 model (and does nothing with a Kea DHCP model): it moves timer definitions from the subnet scope, i.e. the scope where they are in Kea, to the pool scope, i.e. the scope where they are in the IETF model, and back. The from way leaves timers in the subnet scope as they are ignored by the translator, the to way removes timers from pools as they are not expected by Kea at this scope.

Definition at line 27 of file adaptor_pool.h.

Constructor & Destructor Documentation

◆ ~AdaptorPool()

virtual isc::yang::AdaptorPool::~AdaptorPool ( )
virtualdefault

Destructor.

Member Function Documentation

◆ canonizePool()

void isc::yang::AdaptorPool::canonizePool ( isc::data::ElementPtr  pool)
static

Canonize pool.

Remove spaces and replace "-" by " - " for readability.

Parameters
poolThe pool.

Definition at line 21 of file adaptor_pool.cc.

References isc::data::Element::create().

Referenced by isc::yang::AdaptorConfig::sanitizePools().

+ Here is the call graph for this function:

◆ fromSubnet()

void isc::yang::AdaptorPool::fromSubnet ( const std::string &  model,
isc::data::ConstElementPtr  subnet,
isc::data::ConstElementPtr  pools 
)
static

Moves parameters from subnets to pools.

Move parameters from the subnet to each pool. Currently the only supported model is ietf-dhcpv6-server. The parameters moved are valid-lifetime, preferred-lifetime, renew-timer, rebind-timer.

Parameters
modelModel name.
subnetThe subnet element.
poolsThe children pools.
Exceptions
NotImplementedon unexpected model.

Definition at line 43 of file adaptor_pool.cc.

References fromSubnetIetf6(), and isc_throw.

Referenced by isc::yang::TranslatorSubnet::setSubnetIetf6().

+ Here is the call graph for this function:

◆ fromSubnetIetf6()

void isc::yang::AdaptorPool::fromSubnetIetf6 ( isc::data::ConstElementPtr  subnet,
isc::data::ConstElementPtr  pools 
)
staticprotected

From subnets for ietf-dhcpv6-server.

Use common and move valid-lifetime and preferred-lifetime.

Parameters
subnetThe subnet element.
poolsThe children pools.

Definition at line 55 of file adaptor_pool.cc.

References isc::yang::Adaptor::fromParent().

Referenced by fromSubnet().

+ Here is the call graph for this function:

◆ toSubnet()

void isc::yang::AdaptorPool::toSubnet ( const std::string &  model,
isc::data::ElementPtr  subnet,
isc::data::ConstElementPtr  pools 
)
static

Move parameters from pools to the subnet.

Move parameters from pool to its parent subnet. Currently the only supported model is ietf-dhcpv6-server. The parameters moved are valid-lifetime, preferred-lifetime, renew-timer, rebind-timer.

Note
: currently it is the only from YANG to JSON aka post-processing adaptor.
Parameters
modelModel name.
subnetThe subnet element.
poolsThe children pools.
Exceptions
NotImplementedon unexpected model.
BadValueon inconsistent (different timer values) pools.

Definition at line 63 of file adaptor_pool.cc.

References isc_throw, and toSubnetIetf6().

Referenced by isc::yang::TranslatorSubnet::getSubnetIetf6().

+ Here is the call graph for this function:

◆ toSubnetIetf6()

void isc::yang::AdaptorPool::toSubnetIetf6 ( isc::data::ElementPtr  subnet,
isc::data::ConstElementPtr  pools 
)
staticprotected

To subnet for ietf-dhcpv6-server.

Use common and move valid-lifetime and preferred-lifetime.

Parameters
subnetThe subnet element.
poolsThe children pools.

Definition at line 75 of file adaptor_pool.cc.

References isc::yang::Adaptor::toParent().

Referenced by toSubnet().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: