2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-29 13:07:50 +00:00

[#1944] add store-extended-info to Kea YANG module

This commit is contained in:
Andrei Pavel 2021-07-21 23:45:04 +03:00
parent f8ca02c1fd
commit 110740fd85
No known key found for this signature in database
GPG Key ID: 86E9385BC2203766
21 changed files with 64 additions and 23 deletions

View File

@ -270,6 +270,16 @@ TranslatorBasic::setItem(const string& xpath, ConstElementPtr elem,
session_->apply_changes();
}
void TranslatorBasic::checkAndSetLeaf(ElementPtr const& from,
string const& xpath,
string const& name,
sr_type_t const& type) {
ElementPtr const& x(from->get(name));
if (x) {
setItem(xpath + "/" + name, x, type);
}
}
void
TranslatorBasic::delItem(const std::string& xpath) {
try {

View File

@ -79,6 +79,21 @@ public:
void setItem(const std::string& xpath, isc::data::ConstElementPtr elem,
sr_type_t type);
/// @brief Get an element from given ElementPtr node and set it in sysrepo
/// at given xpath.
///
/// @param from the parent configuration node from which to take the value
/// @param xpath the xpath to the YANG node without the last node
/// @param name the name of the YANG node which should also match the map
/// key in the JSON configuration
/// @param type the sysrepo node type
void checkAndSetLeaf(isc::data::ElementPtr const& from,
std::string const& xpath,
std::string const& name,
sr_type_t const& type);
/// @brief Delete basic value from YANG.
///
/// @param xpath The xpath of the basic value.

View File

@ -790,6 +790,7 @@ TranslatorConfig::setServerKeaDhcp4(ConstElementPtr elem) {
if (auth) {
setItem(xpath + "/authoritative", auth, SR_BOOL_T);
}
checkAndSetLeaf(elem, xpath, "store-extended-info", SR_BOOLEAN_T);
}
void
@ -881,6 +882,7 @@ TranslatorConfig::setServerKeaDhcp6(ConstElementPtr elem) {
setItem(xpath + "/server-id/user-context", repr, SR_STRING_T);
}
}
checkAndSetLeaf(elem, xpath, "store-extended-info", SR_BOOLEAN_T);
}
} // namespace yang

View File

@ -406,6 +406,7 @@ TranslatorSubnet::setSubnetKea(const string& xpath, ConstElementPtr elem) {
}
}
}
checkAndSetLeaf(elem, xpath, "store-extended-info", SR_BOOLEAN_T);
if (model_ == KEA_DHCP4_SERVER) {
ConstElementPtr match = elem->get("match-client-id");
if (match) {

View File

@ -21,10 +21,10 @@ static const std::map<std::string, std::string> YANG_REVISIONS = {
{ "ietf-dhcpv6-types", "2018-09-04" },
{ "ietf-dhcpv6-options", "2018-09-04" },
{ "ietf-dhcpv6-server", "2018-09-04" },
{ "kea-types", "2019-08-12" },
{ "kea-types", "2021-07-28" },
{ "kea-dhcp-types", "2019-08-12" },
{ "kea-dhcp4-server", "2019-08-12" },
{ "kea-dhcp6-server", "2019-08-12" },
{ "kea-dhcp4-server", "2021-07-28" },
{ "kea-dhcp6-server", "2021-07-28" },
{ "kea-ctrl-agent", "2019-08-12" },
{ "kea-dhcp-ddns", "2019-08-12" }
};

View File

@ -14,9 +14,9 @@ yangmodules_list += ietf-yang-types@2013-07-15.yang
yangmodules_list += kea-ctrl-agent@2019-08-12.yang
yangmodules_list += kea-dhcp-ddns@2019-08-12.yang
yangmodules_list += kea-dhcp-types@2019-08-12.yang
yangmodules_list += kea-dhcp4-server@2019-08-12.yang
yangmodules_list += kea-dhcp6-server@2019-08-12.yang
yangmodules_list += kea-types@2019-08-12.yang
yangmodules_list += kea-dhcp4-server@2021-07-28.yang
yangmodules_list += kea-dhcp6-server@2021-07-28.yang
yangmodules_list += kea-types@2021-07-28.yang
yangmodules_list += keatest-module@2018-11-20.yang
EXTRA_DIST = hashes ${yangmodules_list}

View File

@ -1 +1 @@
5d11568b445edc65a4783f53fe5e8571af9a79b759272d4a3e4bfba994f71087
0eec8b9fda520d7d4160fb52a12f8e5488942de2acd49b70b9f3df12e018867d

View File

@ -1 +1 @@
230145eb977108912d0015b8fb0d77bd4f53df0f4dfc317329ea5892569a7ba8
96585e06eb96d3938cd63a98003cf6b35393b83700863e204fb56232c7b48c71

View File

@ -1 +1 @@
96c6a37dc93701ddd5a41ab0196fdbefeafba8c2d2a0503a05f34dcfd9accc3a
c3e17f01be9d00b33561ed7b1a8fb73ce95a7d3bdf4da36c340662410bfffb74

View File

@ -1 +0,0 @@
23762bc4dbd25cbd49b8c5e9c27c0eb4a627327b26d1a339ed0022d9708dc8c8

View File

@ -0,0 +1 @@
a3842405494ed469a91661cc32fe300326e55c4a1f3adde6b264ab1f54dbfe4b

View File

@ -1 +0,0 @@
cae7d4516cb6485c76ebce01dcfdb846f4b7470d932615df7e1f2eae8fa9d4f7

View File

@ -0,0 +1 @@
fa6065bce7e34f39a1cb1571a69795b37ec12d98aaa5cffa6e66aa7cbb2ad1e5

View File

@ -1 +0,0 @@
a2c7883852f3649b8d1df213f19a0d007d1652a8bc1b7262d98095905e1ae1e9

View File

@ -0,0 +1 @@
7fe443fddcc4831a6f28c2dadcbcfb786e7af72a0383db32630fc00bfca108dd

View File

@ -8,7 +8,7 @@ module kea-ctrl-agent {
}
import kea-types {
prefix kea;
revision-date 2019-08-12;
revision-date 2021-07-28;
}
organization "Internet Systems Consortium";

View File

@ -8,7 +8,7 @@ module kea-dhcp-ddns {
}
import kea-types {
prefix kea;
revision-date 2019-08-12;
revision-date 2021-07-28;
}
organization "Internet Systems Consortium";

View File

@ -8,7 +8,7 @@ module kea-dhcp-types {
}
import kea-types {
prefix kea;
revision-date 2019-08-12;
revision-date 2021-07-28;
}
organization "Internet Systems Consortium";

View File

@ -8,7 +8,7 @@ module kea-dhcp4-server {
}
import kea-types {
prefix kea;
revision-date 2019-08-12;
revision-date 2021-07-28;
}
import kea-dhcp-types {
prefix dhcp;
@ -20,8 +20,8 @@ module kea-dhcp4-server {
description "This model defines a YANG data model that can be
used to configure and manage a Kea DHCPv4 server.";
revision 2019-08-12 {
description "Initial revision";
revision 2021-07-28 {
description "Initial revision + added store-extended-info";
reference "";
}
@ -209,6 +209,7 @@ module kea-dhcp4-server {
}
uses authoritative;
uses dhcp:subnet-user-context;
uses kea:store-extended-info;
}
}
@ -515,5 +516,7 @@ module kea-dhcp4-server {
}
}
}
uses kea:store-extended-info;
}
}

View File

@ -8,7 +8,7 @@ module kea-dhcp6-server {
}
import kea-types {
prefix kea;
revision-date 2019-08-12;
revision-date 2021-07-28;
}
import kea-dhcp-types {
prefix dhcp;
@ -20,8 +20,8 @@ module kea-dhcp6-server {
description "This model defines a YANG data model that can be
used to configure and manage a Kea DHCPv6 server.";
revision 2019-08-12 {
description "Initial revision";
revision 2021-07-28 {
description "Initial revision + added store-extended-info";
reference "";
}
@ -244,6 +244,7 @@ module kea-dhcp6-server {
uses relay;
}
uses dhcp:subnet-user-context;
uses kea:store-extended-info;
}
}
@ -618,5 +619,7 @@ module kea-dhcp6-server {
}
}
}
uses kea:store-extended-info;
}
}

View File

@ -7,8 +7,8 @@ module kea-types {
contact "kea-dev@lists.isc.org";
description "This file defines some commonly used Kea types and groupings.";
revision 2019-08-12 {
description "Initial revision";
revision 2021-07-28 {
description "Initial revision + added store-extended-info";
reference "";
}
@ -157,4 +157,11 @@ module kea-types {
}
}
}
grouping store-extended-info {
leaf store-extended-info {
description "whether Kea should store additional client query data e.g. RAI in packets";
type boolean;
}
}
}