mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 05:27:55 +00:00
[65-libyang-simplify-update-models] Added new entries - fixed syntax
This commit is contained in:
parent
5f1eea775b
commit
d0985556e1
@ -135,6 +135,8 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
|
||||
return isc::dhcp::Dhcp4Parser::make_SUB_HOOKS_LIBRARY(driver.loc_);
|
||||
case Parser4Context::PARSER_DHCP_DDNS:
|
||||
return isc::dhcp::Dhcp4Parser::make_SUB_DHCP_DDNS(driver.loc_);
|
||||
case Parser4Context::PARSER_CONFIG_CONTROL:
|
||||
return isc::dhcp::Dhcp4Parser::make_SUB_CONFIG_CONTROL(driver.loc_);
|
||||
case Parser4Context::PARSER_LOGGING:
|
||||
return isc::dhcp::Dhcp4Parser::make_SUB_LOGGING(driver.loc_);
|
||||
}
|
||||
|
@ -2070,15 +2070,6 @@ control_agent_json_object: CONTROL_AGENT {
|
||||
ctx.leave();
|
||||
};
|
||||
|
||||
config_control: LCURLY_BRACKET {
|
||||
ElementPtr m(new MapElement(ctx.loc2pos(@1)));
|
||||
ctx.stack_.back()->add(m);
|
||||
ctx.stack_.push_back(m);
|
||||
} config_control_params RCURLY_BRACKET {
|
||||
ctx.stack_.pop_back();
|
||||
};
|
||||
|
||||
|
||||
config_control: CONFIG_CONTROL {
|
||||
ElementPtr i(new MapElement(ctx.loc2pos(@1)));
|
||||
ctx.stack_.back()->set("config-control", i);
|
||||
@ -2101,13 +2092,12 @@ sub_config_control: LCURLY_BRACKET {
|
||||
|
||||
// This defines that subnet can have one or more parameters.
|
||||
config_control_params: config_control_param
|
||||
| config_control_params COMMA config_control_param
|
||||
;
|
||||
| config_control_params COMMA config_control_param
|
||||
;
|
||||
|
||||
// This defines a list of allowed parameters for each subnet.
|
||||
config_control_param: config_databases
|
||||
| unknown_map_entry
|
||||
;
|
||||
;
|
||||
|
||||
config_databases: CONFIG_DATABASES {
|
||||
ElementPtr l(new ListElement(ctx.loc2pos(@1)));
|
||||
|
@ -88,6 +88,9 @@ public:
|
||||
/// This will parse the input as dhcp-ddns.
|
||||
PARSER_DHCP_DDNS,
|
||||
|
||||
/// This will parse the input as config-control.
|
||||
PARSER_CONFIG_CONTROL,
|
||||
|
||||
/// This will parse the content of Logging.
|
||||
PARSER_LOGGING
|
||||
} ParserType;
|
||||
|
@ -137,6 +137,8 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
|
||||
return isc::dhcp::Dhcp6Parser::make_SUB_HOOKS_LIBRARY(driver.loc_);
|
||||
case Parser6Context::PARSER_DHCP_DDNS:
|
||||
return isc::dhcp::Dhcp6Parser::make_SUB_DHCP_DDNS(driver.loc_);
|
||||
case Parser6Context::PARSER_CONFIG_CONTROL:
|
||||
return isc::dhcp::Dhcp6Parser::make_SUB_CONFIG_CONTROL(driver.loc_);
|
||||
case Parser6Context::PARSER_LOGGING:
|
||||
return isc::dhcp::Dhcp6Parser::make_SUB_LOGGING(driver.loc_);
|
||||
}
|
||||
|
@ -2162,15 +2162,6 @@ control_agent_json_object: CONTROL_AGENT {
|
||||
|
||||
// Config control information element
|
||||
|
||||
config_control: LCURLY_BRACKET {
|
||||
ElementPtr m(new MapElement(ctx.loc2pos(@1)));
|
||||
ctx.stack_.back()->add(m);
|
||||
ctx.stack_.push_back(m);
|
||||
} config_control_params RCURLY_BRACKET {
|
||||
ctx.stack_.pop_back();
|
||||
};
|
||||
|
||||
|
||||
config_control: CONFIG_CONTROL {
|
||||
ElementPtr i(new MapElement(ctx.loc2pos(@1)));
|
||||
ctx.stack_.back()->set("config-control", i);
|
||||
@ -2193,13 +2184,12 @@ sub_config_control: LCURLY_BRACKET {
|
||||
|
||||
// This defines that subnet can have one or more parameters.
|
||||
config_control_params: config_control_param
|
||||
| config_control_params COMMA config_control_param
|
||||
;
|
||||
| config_control_params COMMA config_control_param
|
||||
;
|
||||
|
||||
// This defines a list of allowed parameters for each subnet.
|
||||
config_control_param: config_databases
|
||||
| unknown_map_entry
|
||||
;
|
||||
;
|
||||
|
||||
config_databases: CONFIG_DATABASES {
|
||||
ElementPtr l(new ListElement(ctx.loc2pos(@1)));
|
||||
|
@ -91,6 +91,9 @@ public:
|
||||
/// This will parse the input as dhcp-ddns. (D2 client config)
|
||||
PARSER_DHCP_DDNS,
|
||||
|
||||
/// This will parse the input as config-control.
|
||||
PARSER_CONFIG_CONTROL,
|
||||
|
||||
/// This will parse the content of Logging.
|
||||
PARSER_LOGGING
|
||||
|
||||
|
@ -15,7 +15,7 @@ module kea-dhcp-types {
|
||||
contact "kea-dev@lists.isc.org";
|
||||
description "This file defines some commonly used Kea DHCP types and
|
||||
groupings.";
|
||||
revision 2018-11-11 {
|
||||
revision 2018-11-13 {
|
||||
description "Initial revision";
|
||||
reference "";
|
||||
}
|
||||
@ -761,4 +761,32 @@ module kea-dhcp-types {
|
||||
}
|
||||
}
|
||||
|
||||
grouping config-control {
|
||||
description "Config control grouping.";
|
||||
container config-control {
|
||||
description "Config control.";
|
||||
list config-databases {
|
||||
key database-type;
|
||||
description "List of databases.";
|
||||
uses database;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
grouping server-tag {
|
||||
description "Server tag grouping.";
|
||||
leaf server-tag {
|
||||
type string;
|
||||
description "Server tag.";
|
||||
}
|
||||
}
|
||||
|
||||
grouping dhcp-queue-control {
|
||||
description "DHCP queue control grouping.";
|
||||
leaf dhcp-queue-control {
|
||||
type string;
|
||||
description "DHCP queue control (JSON map).";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ module kea-dhcp4-server {
|
||||
}
|
||||
import kea-dhcp-types {
|
||||
prefix dhcp;
|
||||
revision-date 2018-11-11;
|
||||
revision-date 2018-11-13;
|
||||
}
|
||||
import kea-logging {
|
||||
prefix logging;
|
||||
@ -24,7 +24,7 @@ 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 2018-11-12 {
|
||||
revision 2018-11-13 {
|
||||
description "Initial revision";
|
||||
reference "";
|
||||
}
|
||||
@ -403,6 +403,7 @@ module kea-dhcp4-server {
|
||||
uses next-server;
|
||||
uses server-hostname;
|
||||
uses boot-file-name;
|
||||
uses authoritative;
|
||||
uses kea:user-context {
|
||||
refine user-context {
|
||||
description "DHCPv4 server user context. Arbitrary JSON data can
|
||||
@ -415,7 +416,9 @@ module kea-dhcp4-server {
|
||||
description "Global host reservations.";
|
||||
}
|
||||
}
|
||||
uses authoritative;
|
||||
uses dhcp:config-control;
|
||||
uses dhcp:server-tag;
|
||||
uses dhcp:dhcp-queue-control;
|
||||
}
|
||||
|
||||
container logging {
|
||||
|
@ -12,20 +12,19 @@ module kea-dhcp6-server {
|
||||
}
|
||||
import kea-dhcp-types {
|
||||
prefix dhcp;
|
||||
revision-date 2018-11-11;
|
||||
revision-date 2018-11-13;
|
||||
}
|
||||
import kea-logging {
|
||||
prefix logging;
|
||||
revision-date 2018-11-11;
|
||||
}
|
||||
|
||||
|
||||
organization "Internet Systems Consortium";
|
||||
contact "kea-dev@lists.isc.org";
|
||||
description "This model defines a YANG data model that can be
|
||||
used to configure and manage a Kea DHCPv6 server.";
|
||||
|
||||
revision 2018-11-12 {
|
||||
revision 2018-11-13 {
|
||||
description "Initial revision";
|
||||
reference "";
|
||||
}
|
||||
@ -448,6 +447,9 @@ module kea-dhcp6-server {
|
||||
description "Global host reservations.";
|
||||
}
|
||||
}
|
||||
uses dhcp:config-control;
|
||||
uses dhcp:server-tag;
|
||||
uses dhcp:dhcp-queue-control;
|
||||
}
|
||||
|
||||
container logging {
|
||||
|
@ -111,7 +111,7 @@ TranslatorConfig::getParam(ElementPtr& storage, const std::string& xpath,
|
||||
}
|
||||
|
||||
ElementPtr
|
||||
TranslatorConfig::getHooksKea(std::string xpath) {
|
||||
TranslatorConfig::getHooksKea(const std::string& xpath) {
|
||||
S_Iter_Value iter = getIter(xpath + "/*");
|
||||
if (iter) {
|
||||
ElementPtr hook_libs = Element::createList();
|
||||
@ -143,7 +143,7 @@ TranslatorConfig::getHooksKea(std::string xpath) {
|
||||
}
|
||||
|
||||
isc::data::ElementPtr
|
||||
TranslatorConfig::getExpiredKea(std::string xpath) {
|
||||
TranslatorConfig::getExpiredKea(const std::string& xpath) {
|
||||
ElementPtr expired = Element::createMap();
|
||||
|
||||
getParam(expired, xpath, "reclaim-timer-wait-time");
|
||||
@ -161,7 +161,7 @@ TranslatorConfig::getExpiredKea(std::string xpath) {
|
||||
}
|
||||
|
||||
isc::data::ElementPtr
|
||||
TranslatorConfig::getDdnsKea(std::string xpath) {
|
||||
TranslatorConfig::getDdnsKea(const std::string& xpath) {
|
||||
ElementPtr ddns = Element::createMap();
|
||||
getParam(ddns, xpath, "enable-updates");
|
||||
getParam(ddns, xpath, "qualifying-suffix");
|
||||
@ -189,7 +189,23 @@ TranslatorConfig::getDdnsKea(std::string xpath) {
|
||||
return (ddns);
|
||||
}
|
||||
|
||||
// If not, return null
|
||||
// If not, return null.
|
||||
return (ElementPtr());
|
||||
}
|
||||
|
||||
ElementPtr
|
||||
TranslatorConfig::getConfigControlKea(const string& xpath) {
|
||||
ElementPtr config_ctrl = Element::createMap();
|
||||
ConstElementPtr databases = getDatabases(xpath + "/config-databases");
|
||||
if (databases && !databases->empty()) {
|
||||
config_ctrl->set("config-databases", databases);
|
||||
}
|
||||
if (!config_ctrl->empty()) {
|
||||
// If there's something to return, use it.
|
||||
return (config_ctrl);
|
||||
}
|
||||
|
||||
// If not, return null.
|
||||
return (ElementPtr());
|
||||
}
|
||||
|
||||
@ -263,6 +279,17 @@ TranslatorConfig::getServerKeaDhcpCommon(const string& xpath) {
|
||||
if (hosts && !hosts->empty()) {
|
||||
result->set("reservations", hosts);
|
||||
}
|
||||
ConstElementPtr config_ctrl =
|
||||
getConfigControlKea(xpath + "/config-control");
|
||||
if (config_ctrl) {
|
||||
result->set("config-control", config_ctrl);
|
||||
}
|
||||
getParam(result, xpath, "server-tag");
|
||||
ConstElementPtr queue_ctrl = getItem(xpath + "/dhcp-queue-control");
|
||||
if (queue_ctrl) {
|
||||
result->set("dhcp-queue-control",
|
||||
Element::fromJSON(queue_ctrl->stringValue()));
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
@ -666,6 +693,23 @@ TranslatorConfig::setServerKeaDhcpCommon(const string& xpath,
|
||||
if (hosts && !hosts->empty()) {
|
||||
setHosts(xpath + "/reservations", hosts);
|
||||
}
|
||||
ConstElementPtr config_ctrl = elem->get("config-control");
|
||||
if (config_ctrl && !config_ctrl->empty()) {
|
||||
databases = config_ctrl->get("config-databases");
|
||||
if (databases && !databases->empty()) {
|
||||
setDatabases(xpath + "/config-control/config-databases",
|
||||
databases);
|
||||
}
|
||||
}
|
||||
ConstElementPtr server_tag = elem->get("server-tag");
|
||||
if (server_tag) {
|
||||
setItem(xpath + "/server-tag", server_tag, SR_STRING_T);
|
||||
}
|
||||
ConstElementPtr queue_ctrl = elem->get("dhcp-queue-control");
|
||||
if (queue_ctrl) {
|
||||
ConstElementPtr repr = Element::create(queue_ctrl->str());
|
||||
setItem(xpath + "/dhcp-queue-control", repr, SR_STRING_T);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -51,10 +51,14 @@ namespace yang {
|
||||
/// "next-server": <next server address>,
|
||||
/// "server-hostname": <server hostname>,
|
||||
/// "boot-file-name": <boot file name>,
|
||||
/// "authoritative": <authoritative flag>,
|
||||
/// <user-context>,
|
||||
/// <comment>,
|
||||
/// "sanity-checks": { <sanity checks> },
|
||||
/// "reservations": [ <list of host reservations> ]
|
||||
/// "reservations": [ <list of host reservations> ],
|
||||
/// <config-control>,
|
||||
/// "server-tag": <server tag>,
|
||||
/// "dhcp-queue-control": { <DHCP queue control> }
|
||||
/// },
|
||||
/// "Logging": <logging>
|
||||
/// @endcode
|
||||
@ -91,9 +95,14 @@ namespace yang {
|
||||
/// +--rw next-server? inet:ipv4-address
|
||||
/// +--rw server-hostname? string
|
||||
/// +--rw boot-file-name? string
|
||||
/// +--rw authoritative? boolean
|
||||
/// +--rw user-context? string
|
||||
/// +--rw sanity-checks
|
||||
/// +--rw lease-checks? enumeration
|
||||
/// +--rw config-control
|
||||
/// +--rw config-databases config-databases*
|
||||
/// +--rw server-tag string
|
||||
/// +--rw dhcp-queue-control string
|
||||
/// @endcode
|
||||
///
|
||||
/// Example of kea-dhcp6 simple configuration:
|
||||
@ -182,7 +191,10 @@ namespace yang {
|
||||
/// <user-context>,
|
||||
/// <comment>
|
||||
/// "sanity-checks": { <sanity checks> },
|
||||
/// "reservations": [ <list of host reservations> ]
|
||||
/// "reservations": [ <list of host reservations> ],
|
||||
/// <config-control>,
|
||||
/// "server-tag": <server tag>,
|
||||
/// "dhcp-queue-control": { <DHCP queue control> }
|
||||
/// },
|
||||
/// "Logging": <logging>
|
||||
/// @endcode
|
||||
@ -220,6 +232,10 @@ namespace yang {
|
||||
/// +--rw user-context? string
|
||||
/// +--rw sanity-checks
|
||||
/// +--rw lease-checks? enumeration
|
||||
/// +--rw config-control
|
||||
/// +--rw config-databases config-databases*
|
||||
/// +--rw server-tag string
|
||||
/// +--rw dhcp-queue-control string
|
||||
/// @endcode
|
||||
///
|
||||
/// Example of kea-dhcp6 simple configuration:
|
||||
@ -496,23 +512,29 @@ protected:
|
||||
void setServerKeaDhcpCommon(const std::string& xpath,
|
||||
isc::data::ConstElementPtr elem);
|
||||
|
||||
/// @brief Retrieves hooks configuration from sysrepo
|
||||
/// @brief Retrieves hooks configuration from sysrepo.
|
||||
///
|
||||
/// @param xpath path to hooks configuration
|
||||
/// @return ElementList with hooks configuration
|
||||
isc::data::ElementPtr getHooksKea(std::string xpath);
|
||||
/// @param xpath path to hooks configuration.
|
||||
/// @return ElementList with hooks configuration.
|
||||
isc::data::ElementPtr getHooksKea(const std::string& xpath);
|
||||
|
||||
/// @brief Retrieves expired leases processing parameters from sysrepo
|
||||
/// @brief Retrieves expired leases processing parameters from sysrepo.
|
||||
///
|
||||
/// @param xpath path to expired leases configuration
|
||||
/// @return ElementList with expired leases configuration
|
||||
isc::data::ElementPtr getExpiredKea(std::string xpath);
|
||||
/// @param xpath path to expired leases configuration.
|
||||
/// @return ElementList with expired leases configuration.
|
||||
isc::data::ElementPtr getExpiredKea(const std::string& xpath);
|
||||
|
||||
/// @brief Retrieves DDNS configuration from sysrepo
|
||||
///
|
||||
/// @param xpath path to dhcp-ddns configuration
|
||||
/// @return ElementList with dhcp-ddns configuration
|
||||
isc::data::ElementPtr getDdnsKea(std::string xpath);
|
||||
/// @param xpath path to dhcp-ddns configuration.
|
||||
/// @return ElementList with dhcp-ddns configuration.
|
||||
isc::data::ElementPtr getDdnsKea(const std::string& xpath);
|
||||
|
||||
/// @brief Retrieves configuration control from sysrepo.
|
||||
///
|
||||
/// @param xpath path to configuration control.
|
||||
/// @return ElementMap with configuration control.
|
||||
isc::data::ElementPtr getConfigControlKea(const std::string& xpath);
|
||||
|
||||
/// @brief setServer for kea-dhcp4-server:config.
|
||||
///
|
||||
|
@ -42,7 +42,7 @@ namespace yang {
|
||||
///
|
||||
/// YANG syntax for kea-dhcp[46] is using database-type as the list key:
|
||||
/// @code
|
||||
/// +--rw database container
|
||||
/// +--rw database (list)
|
||||
/// |
|
||||
/// +--rw database-type? string
|
||||
/// +--rw user? string
|
||||
|
@ -34,6 +34,7 @@ namespace yang {
|
||||
/// "next-server": "<next server>",
|
||||
/// "server-hostname": "<server hostname>",
|
||||
/// "boot-file-name": "<boot file name>",
|
||||
/// "authoritative": <authoritative flag>,
|
||||
/// "user-context": { <json map> },
|
||||
/// "comment": "<comment>"
|
||||
/// }
|
||||
@ -80,6 +81,7 @@ namespace yang {
|
||||
/// +--rw next-server? inet:ipv4-address
|
||||
/// +--rw server-hostname? string
|
||||
/// +--rw boot-file-name? string
|
||||
/// +--rw authoritative? boolean
|
||||
/// (DHCPv6 only)
|
||||
/// +--rw subnet6 subnet6*
|
||||
/// +--rw preferred-lifetime? uint32
|
||||
|
@ -41,6 +41,7 @@ namespace yang {
|
||||
/// "4o6-interface": "<dhpv4-over-dhcpv6 interface>",
|
||||
/// "4o6-interface-id": "<dhpv4-over-dhcpv6 interface id>",
|
||||
/// "4o6-subnet": "<dhpv4-over-dhcpv6 subnet>",
|
||||
/// "authoritative": <authoritative flag>,
|
||||
/// "user-context": { <json map> },
|
||||
/// "comment": "<comment>"
|
||||
/// }
|
||||
@ -107,6 +108,7 @@ namespace yang {
|
||||
/// +--rw subnet-4o6-interface? string
|
||||
/// +--rw subnet-4o6-interface-id? string
|
||||
/// +--rw subnet-4o6-subnet? inet:ipv6-prefix
|
||||
/// +--rw authoritative? boolean
|
||||
/// (DHCPv6 only)
|
||||
/// +--rw preferred-lifetime? uint32
|
||||
/// +--rw pd-pools pd-pool*
|
||||
|
Loading…
x
Reference in New Issue
Block a user