]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2601] update the YANG modules with three extra nodes
authorAndrei Pavel <andrei@isc.org>
Tue, 8 Nov 2022 10:21:44 +0000 (12:21 +0200)
committerRazvan Becheriu <razvan@isc.org>
Fri, 25 Nov 2022 16:15:33 +0000 (18:15 +0200)
* extended-info-checks
* ignore-rai-link-selection
* template-test

17 files changed:
doc/examples/kea4/all-keys-netconf.json
doc/examples/kea4/all-keys.json
doc/examples/kea6/all-keys-netconf.json
doc/sphinx/arm/ext-netconf.rst
src/lib/yang/translator_class.cc
src/lib/yang/translator_config.cc
src/lib/yang/yang_revisions.h
src/share/yang/modules/Makefile.am
src/share/yang/modules/hashes/kea-dhcp-types@2022-07-27.hash [deleted file]
src/share/yang/modules/hashes/kea-dhcp-types@2022-11-30.hash [new file with mode: 0644]
src/share/yang/modules/hashes/kea-dhcp4-server@2022-07-27.hash [deleted file]
src/share/yang/modules/hashes/kea-dhcp4-server@2022-11-30.hash [new file with mode: 0644]
src/share/yang/modules/hashes/kea-dhcp6-server@2022-07-27.hash [deleted file]
src/share/yang/modules/hashes/kea-dhcp6-server@2022-11-30.hash [new file with mode: 0644]
src/share/yang/modules/kea-dhcp-types@2022-11-30.yang [moved from src/share/yang/modules/kea-dhcp-types@2022-07-27.yang with 93% similarity]
src/share/yang/modules/kea-dhcp4-server@2022-11-30.yang [moved from src/share/yang/modules/kea-dhcp4-server@2022-07-27.yang with 99% similarity]
src/share/yang/modules/kea-dhcp6-server@2022-11-30.yang [moved from src/share/yang/modules/kea-dhcp6-server@2022-07-27.yang with 99% similarity]

index 5122e9136b380119d1ccd62bd3cb912b786c7c10..cae52551691edd1496278ee85116b08ca07078c0 100644 (file)
                 "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
                 "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"
             }
         ],
 
             // 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
index 75072f0928fa5230a3e9ef65845a4ed1469154fb..47fed5debe4173415869578d597b0f480b2a5345 100644 (file)
         // 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.
index a1def030f6d4c046a98e0cd895c29f2efc7193b1..fe6e54a46f9eb2db76454e676c206dd9ecca23d8 100644 (file)
                 "only-if-required": true,
 
                 // Class selection expression.
-                "test": "member('ALL')"
+                "test": "member('ALL')",
+
+                // Template class flag.
+                "template-test": ""
             }
         ],
 
                 "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"
             }
         ],
 
             // 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.
index 17632e51519e131fda590a881046a0a0e4a0efd6..ac7256fb912277087b609fe8f0f115bbc19afdd8 100644 (file)
@@ -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           |            |
index 2cf714aefbc10a81ebeb2873a9847e0fd9ade7f6..bf774a510a43366cf1b44242eb4860a324cb08de 100644 (file)
@@ -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);
 
index 648a8a433ba4ab2c522c72889dd5d60d0ca579c6..be849fc5070e2842e58cac269d80e3fda45ad63f 100644 (file)
@@ -237,6 +237,7 @@ TranslatorConfig::getServerKeaDhcpCommon(DataNode const& data_node) {
     Set<DataNode> 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<DataNode> 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);
     }
 
index 6c9286b0c9952c99e28dfa9637c8205419204e22..44cce00d3251950bf8266fbe123479eff6e93506 100644 (file)
@@ -22,9 +22,9 @@ static const std::unordered_map<std::string, std::string> 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
index 643458482ff841dc2f51c1d556c9b731da77e8a6..2d97db09a0739bbda6847d3421eaa7fccf75c42e 100644 (file)
@@ -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 (file)
index 01d714d..0000000
+++ /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 (file)
index 0000000..aaf058b
--- /dev/null
@@ -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 (file)
index a06853e..0000000
+++ /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 (file)
index 0000000..40f4eff
--- /dev/null
@@ -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 (file)
index 115a93b..0000000
+++ /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 (file)
index 0000000..2024f37
--- /dev/null
@@ -0,0 +1 @@
+9b07383279d1857dd9fc5aa0be4baadd10b6589ccdcda95dbaf983eeb5c703dd
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 68b3ce3deea24d5706400633feacf89e5677c016..dd9fff610cfbf54d32460860499a12629a4fdc65 100644 (file)
@@ -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.";
       }
     }
   }
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 de56557eedd8153e6024e4cf5ed64acf818d50e5..3466e314a171714e20a9389078b4118efa47369c 100644 (file)
@@ -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;
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 b7f6e7fef0bd684ab53e7a0a6a83c39515807fe2..57d74d0cbf57178987d86aa5145dfae8c7709b30 100644 (file)
@@ -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;