#include <dhcp/dhcp6.h>
#include <dhcp/option_space.h>
+// NOTE:
+// When adding a new space, make sure you also update
+// src/lib/yang/adaptor_option.cc
+
namespace isc {
namespace dhcp {
return;
}
const string& id = flex_id->stringValue();
+ // Empty is allowed.
if (id.empty()) {
- isc_throw(BadValue, "empty flexible identifier in " << host->str());
+ return;
}
// No special and no not printable characters?
if (id.find_first_not_of(STD_CHARACTERS) == string::npos) {
void
AdaptorOption::collect(ConstElementPtr option, OptionCodes& codes) {
- ConstElementPtr space = option->get("space");
- ConstElementPtr code = option->get("code");
ConstElementPtr name = option->get("name");
if (name) {
+ ConstElementPtr space = option->get("space");
+ ConstElementPtr code = option->get("code");
string index = space->stringValue() + "@" + name->stringValue();
uint16_t val = static_cast<uint16_t>(code->intValue());
codes.insert(std::pair<string, uint16_t>(index, val));
/// @brief Map for DHCP option definitions handling code and
/// an index built from space and name.
+///
+/// The map is used to store space+name to code mappings so for
+/// an option data without a code entry the code entry can be supplied.
typedef std::map<std::string, uint16_t> OptionCodes;
/// @brief JSON adaptor for option data or definition setting defaults.
/// @brief Collect definition.
///
+ /// This method looks at an option definition and adds the
+ /// space+name to code maping into the OptionCodes codes store
+ /// aka definitions.
+ ///
/// @param option The option definition.
/// @param codes The reference to option definitions.
static void collect(isc::data::ConstElementPtr option, OptionCodes& codes);
/// supported model is ietf-dhcpv6-server. The parameters moved are
/// valid-lifetime, preferred-lifetime, renew-timer, renbind-timer.
///
+ /// @note: currently it is the only from YANH to JSON aka
+ /// post-processing adaptor.
+ ///
/// @param model Model name.
/// @param subnet The subnet element.
/// @param pools The children pools.
/// @brief Update relay.
///
- /// Force the use of ip-addresses vs. ip-address.
+ /// Force the use of ip-addresses when it finds an ip-address entry.
/// Can be used for shared networks too.
///
/// @param subnet The subnet.
components which are not in the model.
Methods provided by adaptors are class methods (i.e. declared static).
-Specific adaptors are derived from the isc::yang::Adaptor base class.
-
- @page unitTestsSysrepo Running unit-tests with Sysrepo
+Specific adaptors can be derived from the isc::yang::Adaptor base class.
+
+There are a few basic adaptors and per structure adaptors. The second
+category of adaptors are divided into:
+ - from JSON to YANG adaptors or pre-processing which adapt a JSON
+ configuration to make it acceptable by a from JSON to YANG (setXXX)
+ translators. For a Kea model this kind of adaptors fill some required
+ but missing fields, or only transform a configuration into a canonical
+ form. Note for a Kea model and a configuration taken from config-get
+ or config-write it likely does nearly nothing but the code must
+ handle any hand written configuration so these adaptors are always
+ applied.
+
+ - from YANG to JSON adaptors or post-processing which adapt translated
+ YANG configuration (by getXXX) to make it acceptable by a Kea server.
+ By definition they are not defined for Kea models.
+
+@section unitTestsSysrepo Running unit-tests with Sysrepo
To run YANG/NETCONF/Sysrepo tests you obviously need to compile Kea with
Sysrepo support: