From: Andrei Pavel Date: Tue, 8 Nov 2022 10:21:44 +0000 (+0200) Subject: [#2601] update the YANG modules with three extra nodes X-Git-Tag: Kea-2.3.3~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6437f377112a42428a20efead53d2f985c5a8331;p=thirdparty%2Fkea.git [#2601] update the YANG modules with three extra nodes * extended-info-checks * ignore-rai-link-selection * template-test --- diff --git a/doc/examples/kea4/all-keys-netconf.json b/doc/examples/kea4/all-keys-netconf.json index 5122e9136b..cae5255169 100644 --- a/doc/examples/kea4/all-keys-netconf.json +++ b/doc/examples/kea4/all-keys-netconf.json @@ -96,13 +96,23 @@ "only-if-required": true, // Class selection expression. - "test": "member('ALL')" + "test": "member('ALL')", + + // Template class flag. + "template-test": "" } ], // Parameters for triggering behaviors compatible with broken or // non-compliant clients, relays or other agents "compatibility": { + // Ignore Relay Agent Information Link Selection suboption if set + // to true. Enabling this will cause Kea use normal subnet + // selection logic instead of attempting to use the subnet + // specified in the suboption. This config option defaults to + // false, as enabling it breaks RFC compliance. + "ignore-rai-link-selection": false, + // Parse options more leniently where fields can be deduced // deterministically even if against RFC or common practice. "lenient-option-parsing": true @@ -357,24 +367,7 @@ "type": "postgresql", // User name to be used to access the database. - "user": "keatest", - - // Connection reconnect wait time. - // This parameter governs how long Kea waits before attempting - // to reconnect. Expressed in milliseconds. The default is 0 - // (disabled) for MySQL and PostgreSQL. - "reconnect-wait-time": 3000, - - // Connection maximum reconnect tries. - "max-reconnect-tries": 3, - - // Action to take when connection recovery fails. - // Supported values: stop-retry-exit, serve-retry-exit, - // serve-retry-continue - "on-fail": "stop-retry-exit", - - // Connection connect timeout. - "connect-timeout": 100 + "user": "keatest" } ], @@ -647,7 +640,17 @@ // to "fix" but delete the lease if no suitable subnet found), // "del" (delete the lease if the lease has invalid subnet // identifier value). - "lease-checks": "warn" + "lease-checks": "warn", + + // Specifies how Kea DHCPv4 server should behave when invalid + // extended info is read for a lease from the lease file, or + // whether to upgrade from old format. The following values + // are supported "none" (don't attempt to correct or upgrade + // the extended info), "fix" (fix common inconsistencies and + // upgrade from old format, this is the default), "strict" + // (fix inconsistencies with an impact on Lease Query), + // "pedantic" (enforce full Kea code format). + "extended-info-checks": "fix" }, // List of shared networks used by Kea DHCPv4 server. The shared diff --git a/doc/examples/kea4/all-keys.json b/doc/examples/kea4/all-keys.json index 75072f0928..47fed5debe 100644 --- a/doc/examples/kea4/all-keys.json +++ b/doc/examples/kea4/all-keys.json @@ -106,15 +106,16 @@ // Parameters for triggering behaviors compatible with broken or // non-compliant clients, relays or other agents "compatibility": { - // Parse options more leniently where fields can be deduced - // deterministically even if against RFC or common practice. - "lenient-option-parsing": true, // Ignore Relay Agent Information Link Selection suboption if set // to true. Enabling this will cause Kea use normal subnet // selection logic instead of attempting to use the subnet // specified in the suboption. This config option defaults to // false, as enabling it breaks RFC compliance. - "ignore-rai-link-selection": false + "ignore-rai-link-selection": false, + + // Parse options more leniently where fields can be deduced + // deterministically even if against RFC or common practice. + "lenient-option-parsing": true }, // Command control socket configuration parameters for Kea DHCPv4 server. diff --git a/doc/examples/kea6/all-keys-netconf.json b/doc/examples/kea6/all-keys-netconf.json index a1def030f6..fe6e54a46f 100644 --- a/doc/examples/kea6/all-keys-netconf.json +++ b/doc/examples/kea6/all-keys-netconf.json @@ -65,7 +65,10 @@ "only-if-required": true, // Class selection expression. - "test": "member('ALL')" + "test": "member('ALL')", + + // Template class flag. + "template-test": "" } ], @@ -316,24 +319,7 @@ "type": "postgresql", // User name to be used to access the database. - "user": "keatest", - - // Connection reconnect wait time. - // This parameter governs how long Kea waits before attempting - // to reconnect. Expressed in milliseconds. The default is 0 - // (disabled) for MySQL and PostgreSQL. - "reconnect-wait-time": 3000, - - // Connection maximum reconnect tries. - "max-reconnect-tries": 3, - - // Action to take when connection recovery fails. - // Supported values: stop-retry-exit, serve-retry-exit, - // serve-retry-continue - "on-fail": "stop-retry-exit", - - // Connection connect timeout. - "connect-timeout": 100 + "user": "keatest" } ], @@ -593,7 +579,17 @@ // to "fix" but delete the lease if no suitable subnet found), // "del" (delete the lease if the lease has invalid subnet // identifier value). - "lease-checks": "warn" + "lease-checks": "warn", + + // Specifies how Kea DHCPv4 server should behave when invalid + // extended info is read for a lease from the lease file, or + // whether to upgrade from old format. The following values + // are supported "none" (don't attempt to correct or upgrade + // the extended info), "fix" (fix common inconsistencies and + // upgrade from old format, this is the default), "strict" + // (fix inconsistencies with an impact on Lease Query), + // "pedantic" (enforce full Kea code format). + "extended-info-checks": "fix" }, // Custom DUID used by the DHCPv6 server. diff --git a/doc/sphinx/arm/ext-netconf.rst b/doc/sphinx/arm/ext-netconf.rst index 17632e5151..ac7256fb91 100644 --- a/doc/sphinx/arm/ext-netconf.rst +++ b/doc/sphinx/arm/ext-netconf.rst @@ -262,7 +262,7 @@ The installation should look similar to the following: [INF] No datastore changes to apply. [INF] Connection 23 created. [INF] Module "kea-dhcp-types" was installed. - [INF] File "kea-dhcp-types@2022-07-27.yang" was installed. + [INF] File "kea-dhcp-types@2022-11-30.yang" was installed. [INF] No datastore changes to apply. [INF] Connection 25 created. [INF] Module "kea-dhcp-ddns" was installed. @@ -274,11 +274,11 @@ The installation should look similar to the following: [INF] No datastore changes to apply. [INF] Connection 29 created. [INF] Module "kea-dhcp4-server" was installed. - [INF] File "kea-dhcp4-server@2022-07-27.yang" was installed. + [INF] File "kea-dhcp4-server@2022-11-30.yang" was installed. [INF] No datastore changes to apply. [INF] Connection 31 created. [INF] Module "kea-dhcp6-server" was installed. - [INF] File "kea-dhcp6-server@2022-07-27.yang" was installed. + [INF] File "kea-dhcp6-server@2022-11-30.yang" was installed. [INF] No datastore changes to apply. It is possible to confirm whether the modules are imported correctly. @@ -310,9 +310,9 @@ The list of currently installed YANG modules should be similar to this: ietf-yang-types | 2013-07-15 | I | user:user | 444 | | kea-ctrl-agent | 2019-08-12 | I | user:user | 600 | | kea-dhcp-ddns | 2022-07-27 | I | user:user | 600 | | - kea-dhcp-types | 2022-07-27 | I | user:user | 600 | | - kea-dhcp4-server | 2022-07-27 | I | user:user | 600 | | - kea-dhcp6-server | 2022-07-27 | I | user:user | 600 | | + kea-dhcp-types | 2022-11-30 | I | user:user | 600 | | + kea-dhcp4-server | 2022-11-30 | I | user:user | 600 | | + kea-dhcp6-server | 2022-11-30 | I | user:user | 600 | | kea-types | 2019-08-12 | I | user:user | 600 | | keatest-module | 2018-11-20 | I | user:user | 600 | | sysrepo-monitoring | 2022-04-08 | I | user:user | 600 | | diff --git a/src/lib/yang/translator_class.cc b/src/lib/yang/translator_class.cc index 2cf714aefb..bf774a510a 100644 --- a/src/lib/yang/translator_class.cc +++ b/src/lib/yang/translator_class.cc @@ -61,6 +61,7 @@ TranslatorClass::getClassKea(DataNode const& data_node) { checkAndGetLeaf(result, data_node, "max-valid-lifetime"); checkAndGetLeaf(result, data_node, "min-valid-lifetime"); checkAndGetLeaf(result, data_node, "only-if-required"); + checkAndGetLeaf(result, data_node, "template-test"); checkAndGetLeaf(result, data_node, "test"); checkAndGetLeaf(result, data_node, "valid-lifetime"); @@ -113,6 +114,7 @@ TranslatorClass::setClassKea(string const& xpath, ConstElementPtr elem) { checkAndSetLeaf(elem, xpath, "max-valid-lifetime", LeafBaseType::Uint32); checkAndSetLeaf(elem, xpath, "min-valid-lifetime", LeafBaseType::Uint32); checkAndSetLeaf(elem, xpath, "only-if-required", LeafBaseType::Bool); + checkAndSetLeaf(elem, xpath, "template-test", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "test", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "valid-lifetime", LeafBaseType::Uint32); diff --git a/src/lib/yang/translator_config.cc b/src/lib/yang/translator_config.cc index 648a8a433b..be849fc507 100644 --- a/src/lib/yang/translator_config.cc +++ b/src/lib/yang/translator_config.cc @@ -237,6 +237,7 @@ TranslatorConfig::getServerKeaDhcpCommon(DataNode const& data_node) { Set const& yang_compatibility(data_node.findXPath("compatibility")); if (!yang_compatibility.empty()) { ElementPtr compatibility(Element::createMap()); + checkAndGetLeaf(compatibility, yang_compatibility.front(), "ignore-rai-link-selection"); checkAndGetLeaf(compatibility, yang_compatibility.front(), "lenient-option-parsing"); if (!compatibility->empty()) { result->set("compatibility", compatibility); @@ -334,6 +335,7 @@ TranslatorConfig::getServerKeaDhcpCommon(DataNode const& data_node) { Set const& yang_sanity_checks(data_node.findXPath("sanity-checks")); if (!yang_sanity_checks.empty()) { ElementPtr sanity_checks = Element::createMap(); + checkAndGetLeaf(sanity_checks, yang_sanity_checks.front(), "extended-info-checks"); checkAndGetLeaf(sanity_checks, yang_sanity_checks.front(), "lease-checks"); if (!sanity_checks->empty()) { result->set("sanity-checks", sanity_checks); @@ -558,6 +560,7 @@ TranslatorConfig::setServerKeaDhcpCommon(string const& xpath, ConstElementPtr compatibility(elem->get("compatibility")); if (compatibility) { + checkAndSetLeaf(compatibility, xpath + "/compatibility", "ignore-rai-link-selection", LeafBaseType::Bool); checkAndSetLeaf(compatibility, xpath + "/compatibility", "lenient-option-parsing", LeafBaseType::Bool); } @@ -663,6 +666,7 @@ TranslatorConfig::setServerKeaDhcpCommon(string const& xpath, ConstElementPtr sanity = elem->get("sanity-checks"); if (sanity) { + checkAndSetLeaf(sanity, xpath + "/sanity-checks", "extended-info-checks", LeafBaseType::Enum); checkAndSetLeaf(sanity, xpath + "/sanity-checks", "lease-checks", LeafBaseType::Enum); } diff --git a/src/lib/yang/yang_revisions.h b/src/lib/yang/yang_revisions.h index 6c9286b0c9..44cce00d32 100644 --- a/src/lib/yang/yang_revisions.h +++ b/src/lib/yang/yang_revisions.h @@ -22,9 +22,9 @@ static const std::unordered_map YANG_REVISIONS = { { "ietf-dhcpv6-options", "2018-09-04" }, { "ietf-dhcpv6-server", "2018-09-04" }, { "kea-types", "2019-08-12" }, - { "kea-dhcp-types", "2022-07-27" }, - { "kea-dhcp4-server", "2022-07-27" }, - { "kea-dhcp6-server", "2022-07-27" }, + { "kea-dhcp-types", "2022-11-30" }, + { "kea-dhcp4-server", "2022-11-30" }, + { "kea-dhcp6-server", "2022-11-30" }, { "kea-ctrl-agent", "2019-08-12" }, { "kea-dhcp-ddns", "2022-07-27" } }; // YANG_REVISIONS diff --git a/src/share/yang/modules/Makefile.am b/src/share/yang/modules/Makefile.am index 643458482f..2d97db09a0 100644 --- a/src/share/yang/modules/Makefile.am +++ b/src/share/yang/modules/Makefile.am @@ -13,9 +13,9 @@ yangmodules_list += ietf-inet-types@2013-07-15.yang yangmodules_list += ietf-yang-types@2013-07-15.yang yangmodules_list += kea-ctrl-agent@2019-08-12.yang yangmodules_list += kea-dhcp-ddns@2022-07-27.yang -yangmodules_list += kea-dhcp-types@2022-07-27.yang -yangmodules_list += kea-dhcp4-server@2022-07-27.yang -yangmodules_list += kea-dhcp6-server@2022-07-27.yang +yangmodules_list += kea-dhcp-types@2022-11-30.yang +yangmodules_list += kea-dhcp4-server@2022-11-30.yang +yangmodules_list += kea-dhcp6-server@2022-11-30.yang yangmodules_list += kea-types@2019-08-12.yang yangmodules_list += keatest-module@2018-11-20.yang diff --git a/src/share/yang/modules/hashes/kea-dhcp-types@2022-07-27.hash b/src/share/yang/modules/hashes/kea-dhcp-types@2022-07-27.hash deleted file mode 100644 index 01d714d5f8..0000000000 --- a/src/share/yang/modules/hashes/kea-dhcp-types@2022-07-27.hash +++ /dev/null @@ -1 +0,0 @@ -6f93545be63df6bc80a3cfc08df93d49b06e1b12d1f308747e01f0992a2254f9 diff --git a/src/share/yang/modules/hashes/kea-dhcp-types@2022-11-30.hash b/src/share/yang/modules/hashes/kea-dhcp-types@2022-11-30.hash new file mode 100644 index 0000000000..aaf058b63a --- /dev/null +++ b/src/share/yang/modules/hashes/kea-dhcp-types@2022-11-30.hash @@ -0,0 +1 @@ +7d1d195bcbad2b14cbec09149373469d2ec39e8faf9b8d822d127027d8924220 diff --git a/src/share/yang/modules/hashes/kea-dhcp4-server@2022-07-27.hash b/src/share/yang/modules/hashes/kea-dhcp4-server@2022-07-27.hash deleted file mode 100644 index a06853ee1b..0000000000 --- a/src/share/yang/modules/hashes/kea-dhcp4-server@2022-07-27.hash +++ /dev/null @@ -1 +0,0 @@ -e36a2dab3da2b34811ce208581395b9b046fc63af5cd87d0802386e93d47a144 diff --git a/src/share/yang/modules/hashes/kea-dhcp4-server@2022-11-30.hash b/src/share/yang/modules/hashes/kea-dhcp4-server@2022-11-30.hash new file mode 100644 index 0000000000..40f4eff74b --- /dev/null +++ b/src/share/yang/modules/hashes/kea-dhcp4-server@2022-11-30.hash @@ -0,0 +1 @@ +138ee4d4bdcf7bd0bfd13a2b25cbafba59d9b452d4144b1055f4be9ce878be2d diff --git a/src/share/yang/modules/hashes/kea-dhcp6-server@2022-07-27.hash b/src/share/yang/modules/hashes/kea-dhcp6-server@2022-07-27.hash deleted file mode 100644 index 115a93b2f8..0000000000 --- a/src/share/yang/modules/hashes/kea-dhcp6-server@2022-07-27.hash +++ /dev/null @@ -1 +0,0 @@ -0f793b8021285706191cd178624041b2d85c81a84c299ded57f5ac0e97e8dcf5 diff --git a/src/share/yang/modules/hashes/kea-dhcp6-server@2022-11-30.hash b/src/share/yang/modules/hashes/kea-dhcp6-server@2022-11-30.hash new file mode 100644 index 0000000000..2024f3753c --- /dev/null +++ b/src/share/yang/modules/hashes/kea-dhcp6-server@2022-11-30.hash @@ -0,0 +1 @@ +9b07383279d1857dd9fc5aa0be4baadd10b6589ccdcda95dbaf983eeb5c703dd diff --git a/src/share/yang/modules/kea-dhcp-types@2022-07-27.yang b/src/share/yang/modules/kea-dhcp-types@2022-11-30.yang similarity index 93% rename from src/share/yang/modules/kea-dhcp-types@2022-07-27.yang rename to src/share/yang/modules/kea-dhcp-types@2022-11-30.yang index 68b3ce3dee..dd9fff610c 100644 --- a/src/share/yang/modules/kea-dhcp-types@2022-07-27.yang +++ b/src/share/yang/modules/kea-dhcp-types@2022-11-30.yang @@ -16,6 +16,10 @@ module kea-dhcp-types { description "This file defines some commonly used Kea DHCP types and groupings."; + revision 2022-11-30 { + description "Added the extended-info-checks and the ignore-rai-link-selection nodes."; + } + revision 2022-07-27 { description "Added TLS parameters for database connections: trust-anchor, cert-file, key-file, cipher-list. Added parameters which govern @@ -465,34 +469,64 @@ module kea-dhcp-types { } } } - grouping sanity-checks { - description "Sanity checks grouping."; + description + "Sanity checks grouping."; container sanity-checks { - description "Sanity checks container."; + description + "Sanity checks container."; + leaf extended-info-checks { + type enumeration { + enum "none" { + description + "Don't attempt to correct or upgrade the extended info."; + } + enum "fix" { + description + "Fix common inconsistencies and upgrade from old format. This is the default."; + } + enum "pedantic" { + description + "Enforce full Kea code formatting."; + } + enum "strict" { + description + "Fix inconsistencies with an impact on lease query."; + } + } + description + "Specifies how Kea DHCPv4 server should behave when + invalid extended info is read from a lease."; + } leaf lease-checks { type enumeration { enum "none" { - description "No checks."; + description + "No checks."; } enum "warn" { - description "When a check fails print a warning and accept the - lease."; + description + "When a check fails print a warning and accept the + lease."; } enum "fix" { - description "When a check fails try to fix it and accept the - lease."; + description + "When a check fails try to fix it and accept the + lease."; } enum "fix-del" { - description "When a check fails try to fix it and reject the - lease if still bad."; + description + "When a check fails try to fix it and reject the + lease if still bad."; } enum "del" { - description "When a check fails reject the lease."; + description + "When a check fails reject the lease."; } } - description "Lease checks: verify subnet-id consistency on memfile - loading."; + description + "Lease checks: verify subnet-id consistency on memfile + loading."; } } } @@ -711,6 +745,14 @@ module kea-dhcp-types { } } + grouping template-test { + leaf template-test { + type string; + description + "The test expression for a template class."; + } + } + grouping class-only-if-required { description "Client class only-if-required grouping."; leaf only-if-required { @@ -948,10 +990,15 @@ module kea-dhcp-types { description "parameters for triggering behaviors compatible with broken or non-compliant clients, relays or other agents"; + leaf ignore-rai-link-selection { + type boolean; + description + "Ignore the link selection RAI suboption."; + } leaf lenient-option-parsing { type boolean; description - "enable more lenient option parsing"; + "Enable more lenient option parsing."; } } } diff --git a/src/share/yang/modules/kea-dhcp4-server@2022-07-27.yang b/src/share/yang/modules/kea-dhcp4-server@2022-11-30.yang similarity index 99% rename from src/share/yang/modules/kea-dhcp4-server@2022-07-27.yang rename to src/share/yang/modules/kea-dhcp4-server@2022-11-30.yang index de56557eed..3466e314a1 100644 --- a/src/share/yang/modules/kea-dhcp4-server@2022-07-27.yang +++ b/src/share/yang/modules/kea-dhcp4-server@2022-11-30.yang @@ -12,7 +12,7 @@ module kea-dhcp4-server { } import kea-dhcp-types { prefix dhcp; - revision-date 2022-07-27; + revision-date 2022-11-30; } organization "Internet Systems Consortium"; @@ -20,6 +20,10 @@ 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 2022-11-30 { + description "Added the template-test node for client classes."; + } + revision 2022-07-27 { description "Added TLS parameters for database connections: trust-anchor, cert-file, key-file, cipher-list. Added parameters which govern @@ -266,6 +270,7 @@ module kea-dhcp4-server { description "List of client classes."; uses dhcp:class-name; uses dhcp:class-test; + uses dhcp:template-test; uses dhcp:class-only-if-required; uses option-def-list; uses option-data-list; diff --git a/src/share/yang/modules/kea-dhcp6-server@2022-07-27.yang b/src/share/yang/modules/kea-dhcp6-server@2022-11-30.yang similarity index 99% rename from src/share/yang/modules/kea-dhcp6-server@2022-07-27.yang rename to src/share/yang/modules/kea-dhcp6-server@2022-11-30.yang index b7f6e7fef0..57d74d0cbf 100644 --- a/src/share/yang/modules/kea-dhcp6-server@2022-07-27.yang +++ b/src/share/yang/modules/kea-dhcp6-server@2022-11-30.yang @@ -12,7 +12,7 @@ module kea-dhcp6-server { } import kea-dhcp-types { prefix dhcp; - revision-date 2022-07-27; + revision-date 2022-11-30; } organization "Internet Systems Consortium"; @@ -20,6 +20,10 @@ 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 2022-11-30 { + description "Added the template-test node for client classes."; + } + revision 2022-07-27 { description "Added TLS parameters for database connections: trust-anchor, cert-file, key-file, cipher-list. Added parameters which govern @@ -301,6 +305,7 @@ module kea-dhcp6-server { description "List of client classes."; uses dhcp:class-name; uses dhcp:class-test; + uses dhcp:template-test; uses dhcp:class-only-if-required; uses option-data-list; uses preferred-lifetime;