Kea  1.9.9-git
isc::yang::AdaptorPool Class Reference

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

#include <adaptor_pool.h>

Public Member Functions

 AdaptorPool ()
 Constructor. More...
 
virtual ~AdaptorPool ()
 Destructor. More...
 

Static Public Member Functions

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

Static Protected Member Functions

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

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 28 of file adaptor_pool.h.

Constructor & Destructor Documentation

isc::yang::AdaptorPool::AdaptorPool ( )

Constructor.

Definition at line 18 of file adaptor_pool.cc.

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

Destructor.

Definition at line 21 of file adaptor_pool.cc.

Member Function Documentation

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 25 of file adaptor_pool.cc.

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 47 of file adaptor_pool.cc.

References isc_throw.

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

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 59 of file adaptor_pool.cc.

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 67 of file adaptor_pool.cc.

References isc_throw.

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

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 79 of file adaptor_pool.cc.


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