]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2224] added missing parameters including TLS connection parameters to YANG models
authorRazvan Becheriu <razvan@isc.org>
Wed, 20 Jul 2022 16:45:31 +0000 (19:45 +0300)
committerRazvan Becheriu <razvan@isc.org>
Fri, 22 Jul 2022 08:12:54 +0000 (11:12 +0300)
40 files changed:
ChangeLog
doc/examples/ddns/all-keys-netconf.json
doc/examples/kea4/all-keys-netconf.json
doc/examples/kea4/all-keys.json
doc/examples/kea6/all-keys-netconf.json
doc/examples/kea6/all-keys.json
m4macros/ax_sysrepo.m4
src/lib/yang/adaptor.cc
src/lib/yang/adaptor.h
src/lib/yang/adaptor_config.cc
src/lib/yang/adaptor_config.h
src/lib/yang/adaptor_host.cc
src/lib/yang/adaptor_host.h
src/lib/yang/adaptor_option.cc
src/lib/yang/adaptor_option.h
src/lib/yang/adaptor_pool.cc
src/lib/yang/adaptor_pool.h
src/lib/yang/adaptor_subnet.cc
src/lib/yang/adaptor_subnet.h
src/lib/yang/sysrepo_error.h
src/lib/yang/tests/config_unittests.cc
src/lib/yang/translator_config.cc
src/lib/yang/translator_config.h
src/lib/yang/translator_database.cc
src/lib/yang/translator_database.h
src/lib/yang/yang_models.h
src/lib/yang/yang_revisions.h
src/share/yang/modules/Makefile.am
src/share/yang/modules/hashes/kea-dhcp-ddns@2019-08-12.hash [deleted file]
src/share/yang/modules/hashes/kea-dhcp-ddns@2022-07-27.hash [new file with mode: 0644]
src/share/yang/modules/hashes/kea-dhcp-types@2021-11-24.hash [deleted file]
src/share/yang/modules/hashes/kea-dhcp-types@2022-07-27.hash [new file with mode: 0644]
src/share/yang/modules/hashes/kea-dhcp4-server@2021-11-24.hash [deleted file]
src/share/yang/modules/hashes/kea-dhcp4-server@2022-07-27.hash [new file with mode: 0644]
src/share/yang/modules/hashes/kea-dhcp6-server@2021-11-24.hash [deleted file]
src/share/yang/modules/hashes/kea-dhcp6-server@2022-07-27.hash [new file with mode: 0644]
src/share/yang/modules/kea-dhcp-ddns@2022-07-27.yang [moved from src/share/yang/modules/kea-dhcp-ddns@2019-08-12.yang with 92% similarity]
src/share/yang/modules/kea-dhcp-types@2022-07-27.yang [moved from src/share/yang/modules/kea-dhcp-types@2021-11-24.yang with 91% similarity]
src/share/yang/modules/kea-dhcp4-server@2022-07-27.yang [moved from src/share/yang/modules/kea-dhcp4-server@2021-11-24.yang with 95% similarity]
src/share/yang/modules/kea-dhcp6-server@2022-07-27.yang [moved from src/share/yang/modules/kea-dhcp6-server@2021-11-24.yang with 95% similarity]

index a961ab484e161c6d99715b5b578dc968b3846d65..39bbd7052ac7a218b48a5b4e3b60d2298dd7b6e7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2042.  [func]          razvan
+       Added missing parameters to YANG modules, including TLS parameters
+       for database connections: trust-anchor, cert-file, key-file,
+       cipher-list, parameters which govern the way the server behaves
+       regarding detection of configured interfaces:
+       service-sockets-require-all, service-sockets-max-retries,
+       service-sockets-retry-wait-time, and parameters which govern
+       reservations lookup: early-global-reservations-lookup,
+       reservations-lookup-first.
+       (Gitlab #2224)
+
 2041.  [bug]           tmark
        HA now applies load balancing and scoping only to inbound
        client packet types that apply to client lease fulfillment,
index 765a20f13ac5ae44c9c19999362e81e57735ebd8..27299a8847ba8869f4d0dde380dd4c768e3c9687 100644 (file)
@@ -68,7 +68,8 @@
                 // Name of the zone (required).
                 "name": "example.com.",
 
-                // Name of the TSIG key used to protect DNS updates.
+                // Name of the TSIG key used to protect DNS updates for
+                // names in the domain.
                 "key-name": "d2.md5.key",
 
                 // List of DNS servers where to send DNS updates.
                         "ip-address": "2001:db8:1::10",
 
                         // DNS server UDP port. Default is 53 (DNS service).
-                        "port": 7802
+                        "port": 7802,
+
+                        // Name of the TSIG key used to protect DNS updates
+                        // sent to the DNS server.
+                        "key-name": "d2.sha1.key"
                     }
                 ]
             }
@@ -94,7 +99,8 @@
                 // Name of the zone (required).
                 "name": "2.0.192.in-addr.arpa.",
 
-                // Name of the TSIG key used to protect DNS updates.
+                // Name of the TSIG key used to protect DNS updates for
+                // names in the domain.
                 "key-name": "d2.sha1.key",
 
                 // List of DNS servers where to send DNS updates.
                         "ip-address": "172.16.1.1",
 
                         // DNS server UDP port. Default is 53 (DNS service).
-                        "port": 5301
+                        "port": 5301,
+
+                        // Name of the TSIG key used to protect DNS updates
+                        "key-name": "d2.md5.key"
                     }
                 ]
             }
index cb69a53039dd91c17da53ffa981ab2c289ef39e0..a754256e99f21b6264ccf123144536234c99a9d3 100644 (file)
                 "user": "kea",
 
                 // Read only mode.
-                "readonly": false
+                "readonly": false,
+
+                // Next entries are for the OpenSSL support in MySQL.
+
+                // Trust anchor aka certificate authority file or directory.
+                "trust-anchor": "my-ca",
+
+                // Client certificate file name.
+                "cert-file": "my-cert",
+
+                // Private key file name.
+                "key-file": "my-key",
+
+                // Cipher list (see the OpenSSL ciphers command manual).
+                "cipher-list": "AES"
             },
             {
                 // Name of the database to connect to.
 
                 // Connection reconnect wait time.
                 // This parameter governs how long Kea waits before attempting
-                // to reconnect. Expressed in milliseconds. The default is 2000 [ms]
-                // for Casandra and 0 (disabled) for MySQL and PostgreSQL.
+                // to reconnect. Expressed in milliseconds. The default is 0
+                // (disabled) for MySQL and PostgreSQL.
                 "reconnect-wait-time": 3000,
 
                 // Connection maximum reconnect tries.
             // be re-detected upon server reconfiguration. The default value
             // is true which means that the interfaces are always
             // re-detected.
-            "re-detect": true
+            "re-detect": true,
+
+            // Kea tries to bind the service sockets during initialization. It may
+            // fail due to a port being already opened or misconfiguration. Kea can
+            // suppress these errors and only logs them. This flag prevents starting
+            // the DHCP server without binding all sockets. If unspecified, it
+            // defaults to false.
+            "service-sockets-require-all": true,
+
+            // Kea tries to bind the service sockets during initialization. This
+            // option specifies how many times binding to interface will be retried.
+            // The default value is 0 which means that the operation will not be
+            // repeated.
+            "service-sockets-max-retries": 5,
+
+            // The time interval in milliseconds to wait before the next attempt to
+            // retry opening a service socket.
+            "service-sockets-retry-wait-time": 5000
         },
 
+        // Boolean parameter which controls whether an early global host
+        // reservations lookup should be performed. This lookup takes place
+        // before subnet selection and when a global reservation is found
+        // with some client classes, it triggers a second phase classification.
+        // It can also be used to drop queries using host reservations as a
+        // decision table indexed by reservation identifiers.
+        "early-global-reservations-lookup": true,
+
         // Boolean parameter which controls DHCP server's behavior with respect
         // to creating host reservations for the same IP address. By default
         // this flag is set to true in which case the server prevents creation
         // PostgreSQL backends do support this mode.
         "ip-reservations-unique": true,
 
+        /// Boolean parameter which controls whether host reservations lookup
+        /// should be performed before lease lookup. This parameter has effect
+        /// only when multi-threading is disabled. When multi-threading is
+        /// enabled, host reservations lookup is always performed first to avoid
+        /// lease lookup resource locking.
+        "reservations-lookup-first": true,
+
         // Specifies credentials to access lease database.
         "lease-database": {
             // memfile backend specific parameter specifying the interval
index 2c363aab5985aa7fb01c6a032757c129ea10c240..40c0f3a2fb5b12245317029b91bab9e45d888d71 100644 (file)
 
                 // Connection reconnect wait time.
                 // This parameter governs how long Kea waits before attempting
-                // to reconnect. Expressed in milliseconds. The default is 2000 [ms]
-                // for Casandra and 0 (disabled) for MySQL and PostgreSQL.
+                // to reconnect. Expressed in milliseconds. The default is 0
+                // (disabled) for MySQL and PostgreSQL.
                 "reconnect-wait-time": 3000,
 
                 // Connection maximum reconnect tries.
index a2098225ef08137ff64adbc57e6633bc1b8e0cf5..6712be2e1106f2242800ac0cd0a1169bb20529da 100644 (file)
                 "user": "kea",
 
                 // Read only mode.
-                "readonly": false
+                "readonly": false,
+
+                // Next entries are for the OpenSSL support in MySQL.
+                // Trust anchor aka certificate authority file or directory.
+                "trust-anchor": "my-ca",
+
+                // Client certificate file name.
+                "cert-file": "my-cert",
+
+                // Private key file name.
+                "key-file": "my-key",
+
+                // Cipher list (see the OpenSSL ciphers command manual).
+                "cipher-list": "AES"
             },
             {
                 // Name of the database to connect to.
 
                 // Connection reconnect wait time.
                 // This parameter governs how long Kea waits before attempting
-                // to reconnect. Expressed in milliseconds. The default is 2000 [ms]
-                // for Casandra and 0 (disabled) for MySQL and PostgreSQL.
+                // to reconnect. Expressed in milliseconds. The default is 0
+                // (disabled) for MySQL and PostgreSQL.
                 "reconnect-wait-time": 3000,
 
                 // Connection maximum reconnect tries.
             // be re-detected upon server reconfiguration. The default value
             // is true which means that the interfaces are always
             // re-detected.
-            "re-detect": true
+            "re-detect": true,
+
+            // Kea tries to bind the service sockets during initialization. It may
+            // fail due to a port being already opened or misconfiguration. Kea can
+            // suppress these errors and only logs them. This flag prevents starting
+            // the DHCP server without binding all sockets. If unspecified, it
+            // defaults to false.
+            "service-sockets-require-all": true,
+
+            // Kea tries to bind the service sockets during initialization. This
+            // option specifies how many times binding to interface will be retried.
+            // The default value is 0 which means that the operation will not be
+            // repeated.
+            "service-sockets-max-retries": 5,
+
+            // The time interval in milliseconds to wait before the next attempt to
+            // retry opening a service socket.
+            "service-sockets-retry-wait-time": 5000
         },
 
+        // Boolean parameter which controls whether an early global host
+        // reservations lookup should be performed. This lookup takes place
+        // before subnet selection and when a global reservation is found
+        // with some client classes, it triggers a second phase classification.
+        // It can also be used to drop queries using host reservations as a
+        // decision table indexed by reservation identifiers.
+        "early-global-reservations-lookup": true,
+
         // Boolean parameter which controls DHCP server's behavior with respect
         // to creating host reservations for the same IP address or delegated
         // prefix. By default this flag is set to true in which case the server
         // support this mode.
         "ip-reservations-unique": true,
 
+        /// Boolean parameter which controls whether host reservations lookup
+        /// should be performed before lease lookup. This parameter has effect
+        /// only when multi-threading is disabled. When multi-threading is
+        /// enabled, host reservations lookup is always performed first to avoid
+        /// lease lookup resource locking.
+        "reservations-lookup-first": true,
+
         // Specifies credentials to access lease database.
         "lease-database": {
             // memfile backend specific parameter specifying the interval
index 7ddc196ef658c833f88a0cd08d59ed249642791e..c3437d04249b2d6968783bfea4c52cbbe66586a6 100644 (file)
                 "readonly": false,
 
                 // Next entries are for the OpenSSL support in MySQL.
-
                 // Trust anchor aka certificate authority file or directory.
                 "trust-anchor": "my-ca",
 
 
                 // Connection reconnect wait time.
                 // This parameter governs how long Kea waits before attempting
-                // to reconnect. Expressed in milliseconds. The default is 2000 [ms]
-                // for Casandra and 0 (disabled) for MySQL and PostgreSQL.
+                // to reconnect. Expressed in milliseconds. The default is 0
+                // (disabled) for MySQL and PostgreSQL.
                 "reconnect-wait-time": 3000,
 
                 // Connection maximum reconnect tries.
index 925affb76d5f5ada2846eb9298dfa2e79ed88a27..415125e6b2277191fae937a31eec152f2504c516 100644 (file)
@@ -189,7 +189,7 @@ AC_DEFUN([AX_SYSREPO], [
       )],
       [AC_MSG_RESULT([no])
        AX_DISPLAY_LIBRARY_WARNINGS()
-       AC_MSG_ERROR([Count not integrate with Sysrepo C++ bindings. Make sure that the sysrepo-cpp/Session.hpp header and the libsysrepo-cpp.so library can be found.])]
+       AC_MSG_ERROR([Could not integrate with Sysrepo C++ bindings. Make sure that the sysrepo-cpp/Session.hpp header and the libsysrepo-cpp.so library can be found.])]
     )
 
     # Restore flags.
index 597f233055305e87afb50d52b1a7666706fc514c..cf512bbab592f276e668c0e12c8b5817e1f6649d 100644 (file)
@@ -304,5 +304,5 @@ Adaptor::modify(ConstElementPtr path, ConstElementPtr actions,
     applyDown(path, actions, config, 0);
 }
 
-}; // end of namespace isc::yang
-}; // end of namespace isc
+}  // end of namespace isc::yang
+}  // end of namespace isc
index fa1bbd68847183e64c290702dedbf2eaea9c99db..6a9452ec7c2831afafbf58702a9e3292285b4a05 100644 (file)
@@ -127,7 +127,7 @@ public:
 
 };
 
-}; // end of namespace isc::yang
-}; // end of namespace isc
+}  // end of namespace isc::yang
+}  // end of namespace isc
 
 #endif // ISC_ADAPTOR_H
index 0128792a6a7b533e1ed9f597a19e8c1edd818030..f19f274879bc9bd62d32cad00c77831a32fb0660 100644 (file)
@@ -654,5 +654,5 @@ AdaptorConfig::preProcess6(ConstElementPtr config) {
     preProcess(mutable_dhcp, "subnet6", DHCP6_SPACE);
 }
 
-}; // end of namespace isc::yang
-}; // end of namespace isc
+}  // end of namespace isc::yang
+}  // end of namespace isc
index d849a611ee981391be47c7b10b349b826b7e5f1c..da71b9cc7acef65a6fc2f89a40684051f180876d 100644 (file)
@@ -288,7 +288,7 @@ protected:
                            const std::string& space);
 };
 
-}; // end of namespace isc::yang
-}; // end of namespace isc
+}  // end of namespace isc::yang
+}  // end of namespace isc
 
 #endif // ISC_ADAPTOR_CONFIG_H
index c02896af0e15cc10a0915879dc5c64f74ffbc7d9..35c55571bcbbb64e942c38811f5db5eab21c9cfb 100644 (file)
@@ -64,5 +64,5 @@ AdaptorHost::quoteIdentifier(ElementPtr host) {
     host->set("flex-id", Element::create(tmp.str()));
 }
 
-}; // end of namespace isc::yang
-}; // end of namespace isc
+}  // end of namespace isc::yang
+}  // end of namespace isc
index 918b4bf7b2198e5685b95cf111e71445200b023f..488e435a262169a7909666fbdeedeef53b1b036f 100644 (file)
@@ -41,7 +41,7 @@ public:
     static void quoteIdentifier(isc::data::ElementPtr host);
 };
 
-}; // end of namespace isc::yang
-}; // end of namespace isc
+}  // end of namespace isc::yang
+}  // end of namespace isc
 
 #endif // ISC_ADAPTOR_HOST_H
index db61ac366fa1cf1d8c147e2f0229b918d253d873..7da06a0ae7d86c3764ea5309d8ea58e18ac49834 100644 (file)
@@ -124,5 +124,5 @@ AdaptorOption::initCodesInternal(OptionCodes& codes, const string& space,
     }
 }
 
-}; // end of namespace isc::yang
-}; // end of namespace isc
+}  // end of namespace isc::yang
+}  // end of namespace isc
index e3c53f18e20957670a592219aed7d079a2bbb111..1a5f171f06b76ac99692aebf19845c5c5b702f95 100644 (file)
@@ -105,7 +105,7 @@ protected:
                                   size_t params_size);
 };
 
-}; // end of namespace isc::yang
-}; // end of namespace isc
+}  // end of namespace isc::yang
+}  // end of namespace isc
 
 #endif // ISC_ADAPTOR_OPTION_H
index a6586332dc09c029d3431eb84967eee1b771c001..1b6811a80eff7c2cdece3e75f76789fe4fb33719 100644 (file)
@@ -83,5 +83,5 @@ AdaptorPool::toSubnetIetf6(ElementPtr subnet, ConstElementPtr pools) {
     Adaptor::toParent("rebind-timer", subnet, pools);
 }
 
-}; // end of namespace isc::yang
-}; // end of namespace isc
+}  // end of namespace isc::yang
+}  // end of namespace isc
index f8e72bf2c48085e8b9da734378035d9d3f544e09..8a8fa0a9ed8397a150f60d6b081ef37e20584f63 100644 (file)
@@ -92,7 +92,7 @@ protected:
                               isc::data::ConstElementPtr pools);
 };
 
-}; // end of namespace isc::yang
-}; // end of namespace isc
+}  // end of namespace isc::yang
+}  // end of namespace isc
 
 #endif // ISC_ADAPTOR_POOL_H
index bb352b979f1b788c1225e99a303d4f75368a61a2..dd75710873ae3d89196897472ff071563736a6b2 100644 (file)
@@ -69,5 +69,5 @@ AdaptorSubnet::updateRelay(ElementPtr subnet) {
     }
 }
 
-}; // end of namespace isc::yang
-}; // end of namespace isc
+}  // end of namespace isc::yang
+}  // end of namespace isc
index 0bfcae00efb3c188853663aa43c0d677af7c512e..581c39f6f025b249c9b69915d0600e5c0ddbbc0e 100644 (file)
@@ -60,7 +60,7 @@ public:
     static void updateRelay(isc::data::ElementPtr subnet);
 };
 
-}; // end of namespace isc::yang
-}; // end of namespace isc
+}  // end of namespace isc::yang
+}  // end of namespace isc
 
 #endif // ISC_ADAPTOR_SUBNET_H
index 65be9fcd5a752a4832debe3ff0d9c2f4ac56678b..b436109a96440a0ec404be40a3ac877921f9f092 100644 (file)
@@ -20,7 +20,7 @@ public:
     {}
 };
 
-}; // end of namespace isc::yang
-}; // end of namespace isc
+}  // end of namespace isc::yang
+}  // end of namespace isc
 
 #endif // ISC_SYSREPO_ERROR_H
index 41f024737b116b429f97b0976f540db5f7f25e5e..7a655a747f45d0460cafe697daa0345911c48afc 100644 (file)
@@ -339,7 +339,7 @@ TEST_F(ConfigTestKeaV4, examples4) {
         "hooks-radius.json",
         "leases-expiration.json",
         "multiple-options.json",
-        //"mysql-reservations.json", commented for new TLS parameters
+        "mysql-reservations.json",
         "pgsql-reservations.json",
         "reservations.json",
         "several-subnets.json",
@@ -380,7 +380,7 @@ TEST_F(ConfigTestKeaV6, examples6) {
         "iPXE.json",
         "leases-expiration.json",
         "multiple-options.json",
-        //"mysql-reservations.json", commented for new TLS parameters
+        "mysql-reservations.json",
         "pgsql-reservations.json",
         "reservations.json",
         "several-subnets.json",
index 05a964828b013a21e20c00d869a199823be2512b..e4fc040d7300a5b898816fd2f848008a93d1d6ec 100644 (file)
@@ -290,10 +290,13 @@ TranslatorConfig::getServerKeaDhcpCommon(const string& xpath) {
     checkAndGetLeaf(result, xpath, "ddns-update-on-renew");
     checkAndGetLeaf(result, xpath, "ddns-use-conflict-resolution");
     checkAndGetLeaf(result, xpath, "ip-reservations-unique");
+    checkAndGetLeaf(result, xpath, "early-global-reservations-lookup");
+    checkAndGetLeaf(result, xpath, "reservations-lookup-first");
     ElementPtr multi_threading = Element::createMap();
-    checkAndGetLeaf(multi_threading, xpath + "/multi-threading", "enable-multi-threading");
-    checkAndGetLeaf(multi_threading, xpath + "/multi-threading", "packet-queue-size");
-    checkAndGetLeaf(multi_threading, xpath + "/multi-threading", "thread-pool-size");
+    string mt_xpath = xpath + "/multi-threading";
+    checkAndGetLeaf(multi_threading, mt_xpath, "enable-multi-threading");
+    checkAndGetLeaf(multi_threading, mt_xpath, "packet-queue-size");
+    checkAndGetLeaf(multi_threading, mt_xpath, "thread-pool-size");
     if (!multi_threading->empty()) {
         result->set("multi-threading", multi_threading);
     }
@@ -322,9 +325,13 @@ TranslatorConfig::getServerKeaDhcp4() {
     if (ifs && !ifs->empty()) {
         if_config->set("interfaces", ifs);
     }
-    checkAndGetLeaf(if_config, xpath + "/interfaces-config", "dhcp-socket-type");
-    checkAndGetLeaf(if_config, xpath + "/interfaces-config", "outbound-interface");
-    checkAndGetLeaf(if_config, xpath + "/interfaces-config", "re-detect");
+    string if_cfg_xpath = xpath + "/interfaces-config";
+    checkAndGetLeaf(if_config, if_cfg_xpath, "dhcp-socket-type");
+    checkAndGetLeaf(if_config, if_cfg_xpath, "outbound-interface");
+    checkAndGetLeaf(if_config, if_cfg_xpath, "service-sockets-require-all");
+    checkAndGetLeaf(if_config, if_cfg_xpath, "service-sockets-max-retries");
+    checkAndGetLeaf(if_config, if_cfg_xpath, "service-sockets-retry-wait-time");
+    checkAndGetLeaf(if_config, if_cfg_xpath, "re-detect");
     ConstElementPtr context =
         getItem(xpath + "/interfaces-config/user-context");
     if (context) {
@@ -364,7 +371,11 @@ TranslatorConfig::getServerKeaDhcp6() {
     if (ifs && !ifs->empty()) {
         if_config->set("interfaces", ifs);
     }
-    checkAndGetLeaf(if_config, xpath + "/interfaces-config", "re-detect");
+    string if_cfg_xpath = xpath + "/interfaces-config";
+    checkAndGetLeaf(if_config, if_cfg_xpath, "service-sockets-require-all");
+    checkAndGetLeaf(if_config, if_cfg_xpath, "service-sockets-max-retries");
+    checkAndGetLeaf(if_config, if_cfg_xpath, "service-sockets-retry-wait-time");
+    checkAndGetLeaf(if_config, if_cfg_xpath, "re-detect");
     ConstElementPtr context =
         getItem(xpath + "/interfaces-config/user-context");
     if (context) {
@@ -386,12 +397,13 @@ TranslatorConfig::getServerKeaDhcp6() {
     // Handle server-id.
     // @todo: move to a DUID translator.
     ElementPtr server_id = Element::createMap();
-    checkAndGetLeaf(server_id, xpath + "/server-id", "type");
-    checkAndGetLeaf(server_id, xpath + "/server-id", "identifier");
-    checkAndGetLeaf(server_id, xpath + "/server-id", "time");
-    checkAndGetLeaf(server_id, xpath + "/server-id", "htype");
-    checkAndGetLeaf(server_id, xpath + "/server-id", "enterprise-id");
-    checkAndGetLeaf(server_id, xpath + "/server-id", "persist");
+    string srv_id_xpath = xpath + "/server-id";
+    checkAndGetLeaf(server_id, srv_id_xpath, "type");
+    checkAndGetLeaf(server_id, srv_id_xpath, "identifier");
+    checkAndGetLeaf(server_id, srv_id_xpath, "time");
+    checkAndGetLeaf(server_id, srv_id_xpath, "htype");
+    checkAndGetLeaf(server_id, srv_id_xpath, "enterprise-id");
+    checkAndGetLeaf(server_id, srv_id_xpath, "persist");
     context = getItem(xpath + "/server-id/user-context");
     if (context) {
         server_id->set("user-context",
@@ -481,42 +493,15 @@ TranslatorConfig::setConfigKea6(ConstElementPtr elem) {
 void
 TranslatorConfig::setServerKeaDhcpCommon(const string& xpath,
                                          ConstElementPtr elem) {
-    ConstElementPtr valid = elem->get("valid-lifetime");
-    if (valid) {
-        setItem(xpath + "/valid-lifetime", valid, SR_UINT32_T);
-    }
-    ConstElementPtr min_valid = elem->get("min-valid-lifetime");
-    if (min_valid) {
-        setItem(xpath + "/min-valid-lifetime", min_valid, SR_UINT32_T);
-    }
-    ConstElementPtr max_valid = elem->get("max-valid-lifetime");
-    if (max_valid) {
-        setItem(xpath + "/max-valid-lifetime", max_valid, SR_UINT32_T);
-    }
-    ConstElementPtr renew = elem->get("renew-timer");
-    if (renew) {
-        setItem(xpath + "/renew-timer", renew, SR_UINT32_T);
-    }
-    ConstElementPtr rebind = elem->get("rebind-timer");
-    if (rebind) {
-        setItem(xpath + "/rebind-timer", rebind, SR_UINT32_T);
-    }
-    ConstElementPtr calculate = elem->get("calculate-tee-times");
-    if (calculate) {
-        setItem(xpath + "/calculate-tee-times", calculate, SR_BOOL_T);
-    }
-    ConstElementPtr t1_percent =  elem->get("t1-percent");
-    if (t1_percent) {
-        setItem(xpath + "/t1-percent", t1_percent, SR_DECIMAL64_T);
-    }
-    ConstElementPtr t2_percent =  elem->get("t2-percent");
-    if (t2_percent) {
-        setItem(xpath + "/t2-percent", t2_percent, SR_DECIMAL64_T);
-    }
-    ConstElementPtr period = elem->get("decline-probation-period");
-    if (period) {
-        setItem(xpath + "/decline-probation-period", period, SR_UINT32_T);
-    }
+    checkAndSetLeaf(elem, xpath, "valid-lifetime", SR_UINT32_T);
+    checkAndSetLeaf(elem, xpath, "min-valid-lifetime", SR_UINT32_T);
+    checkAndSetLeaf(elem, xpath, "max-valid-lifetime", SR_UINT32_T);
+    checkAndSetLeaf(elem, xpath, "renew-timer", SR_UINT32_T);
+    checkAndSetLeaf(elem, xpath, "rebind-timer", SR_UINT32_T);
+    checkAndSetLeaf(elem, xpath, "calculate-tee-times", SR_BOOL_T);
+    checkAndSetLeaf(elem, xpath, "t1-percent", SR_DECIMAL64_T);
+    checkAndSetLeaf(elem, xpath, "t2-percent", SR_DECIMAL64_T);
+    checkAndSetLeaf(elem, xpath, "decline-probation-period", SR_UINT32_T);
     ConstElementPtr networks = elem->get("shared-networks");
     if (networks) {
         setSharedNetworks(xpath, networks);
@@ -578,124 +563,39 @@ TranslatorConfig::setServerKeaDhcpCommon(const string& xpath,
     }
     ConstElementPtr expired = elem->get("expired-leases-processing");
     if (expired) {
-        ConstElementPtr reclaim = expired->get("reclaim-timer-wait-time");
-        if (reclaim) {
-            setItem(xpath + "/expired-leases-processing/reclaim-timer-wait-time",
-                    reclaim, SR_UINT32_T);
-        }
-        ConstElementPtr flush =
-            expired->get("flush-reclaimed-timer-wait-time");
-        if (flush) {
-            setItem(xpath + "/expired-leases-processing/flush-reclaimed-timer-wait-time",
-                    flush, SR_UINT32_T);
-        }
-        ConstElementPtr hold = expired->get("hold-reclaimed-time");
-        if (hold) {
-            setItem(xpath + "/expired-leases-processing/hold-reclaimed-time",
-                    hold, SR_UINT32_T);
-        }
-        ConstElementPtr max_leases = expired->get("max-reclaim-leases");
-        if (max_leases) {
-            setItem(xpath + "/expired-leases-processing/max-reclaim-leases",
-                    max_leases, SR_UINT32_T);
-        }
-        ConstElementPtr max_time = expired->get("max-reclaim-time");
-        if (max_time) {
-            setItem(xpath + "/expired-leases-processing/max-reclaim-time",
-                    max_time, SR_UINT32_T);
-        }
-        ConstElementPtr unwarned = expired->get("unwarned-reclaim-cycles");
-        if (unwarned) {
-            setItem(xpath + "/expired-leases-processing/unwarned-reclaim-cycles",
-                    unwarned, SR_UINT32_T);
-        }
-    }
-    ConstElementPtr port = elem->get("dhcp4o6-port");
-    if (port) {
-        setItem(xpath + "/dhcp4o6-port", port, SR_UINT16_T);
-    }
+        string expired_xpath = xpath + "/expired-leases-processing";
+        checkAndSetLeaf(expired, expired_xpath, "reclaim-timer-wait-time", SR_UINT32_T);
+        checkAndSetLeaf(expired, expired_xpath, "flush-reclaimed-timer-wait-time", SR_UINT32_T);
+        checkAndSetLeaf(expired, expired_xpath, "hold-reclaimed-time", SR_UINT32_T);
+        checkAndSetLeaf(expired, expired_xpath, "max-reclaim-leases", SR_UINT32_T);
+        checkAndSetLeaf(expired, expired_xpath, "max-reclaim-time", SR_UINT32_T);
+        checkAndSetLeaf(expired, expired_xpath, "unwarned-reclaim-cycles", SR_UINT32_T);
+    }
+    checkAndSetLeaf(elem, xpath, "dhcp4o6-port", SR_UINT16_T);
     ConstElementPtr socket = elem->get("control-socket");
     if (socket) {
         setControlSocket(xpath + "/control-socket", socket);
     }
-    ConstElementPtr char_set = elem->get("hostname-char-set");
-    if (char_set) {
-        setItem(xpath + "/hostname-char-set", char_set, SR_STRING_T);
-    }
-    ConstElementPtr char_repl = elem->get("hostname-char-replacement");
-    if (char_repl) {
-        setItem(xpath + "/hostname-char-replacement", char_repl, SR_STRING_T);
-    }
+    checkAndSetLeaf(elem, xpath, "hostname-char-set", SR_STRING_T);
+    checkAndSetLeaf(elem, xpath, "hostname-char-replacement", SR_STRING_T);
     ConstElementPtr ddns = elem->get("dhcp-ddns");
     if (ddns) {
-        ConstElementPtr enable = ddns->get("enable-updates");
-        if (enable) {
-            setItem(xpath + "/dhcp-ddns/enable-updates", enable, SR_BOOL_T);
-        }
-        ConstElementPtr suffix = ddns->get("qualifying-suffix");
-        if (suffix) {
-            setItem(xpath + "/dhcp-ddns/qualifying-suffix", suffix,
-                    SR_STRING_T);
-        }
-        ConstElementPtr server_ip = ddns->get("server-ip");
-        if (server_ip) {
-            setItem(xpath + "/dhcp-ddns/server-ip", server_ip, SR_STRING_T);
-        }
-        ConstElementPtr server_port = ddns->get("server-port");
-        if (server_port) {
-            setItem(xpath + "/dhcp-ddns/server-port", server_port,
-                    SR_UINT16_T);
-        }
-        ConstElementPtr sender_ip = ddns->get("sender-ip");
-        if (sender_ip) {
-            setItem(xpath + "/dhcp-ddns/sender-ip", sender_ip, SR_STRING_T);
-        }
-        ConstElementPtr sender_port = ddns->get("sender-port");
-        if (sender_port) {
-            setItem(xpath + "/dhcp-ddns/sender-port", sender_port,
-                    SR_UINT16_T);
-        }
-        ConstElementPtr queue = ddns->get("max-queue-size");
-        if (queue) {
-            setItem(xpath + "/dhcp-ddns/max-queue-size", queue, SR_UINT32_T);
-        }
-        ConstElementPtr protocol = ddns->get("ncr-protocol");
-        if (protocol) {
-            setItem(xpath + "/dhcp-ddns/ncr-protocol", protocol, SR_ENUM_T);
-        }
-        ConstElementPtr format = ddns->get("ncr-format");
-        if (format) {
-            setItem(xpath + "/dhcp-ddns/ncr-format", format, SR_ENUM_T);
-        }
-        ConstElementPtr no_up = ddns->get("override-no-update");
-        if (no_up) {
-            setItem(xpath + "/dhcp-ddns/override-no-update", no_up, SR_BOOL_T);
-        }
-        ConstElementPtr client = ddns->get("override-client-update");
-        if (client) {
-            setItem(xpath + "/dhcp-ddns/override-client-update", client,
-                    SR_BOOL_T);
-        }
-        ConstElementPtr replace = ddns->get("replace-client-name");
-        if (replace) {
-            setItem(xpath + "/dhcp-ddns/replace-client-name", replace,
-                    SR_ENUM_T);
-        }
-        ConstElementPtr generated = ddns->get("generated-prefix");
-        if (generated) {
-            setItem(xpath + "/dhcp-ddns/generated-prefix", generated,
-                    SR_STRING_T);
-        }
-        ConstElementPtr char_set = ddns->get("hostname-char-set");
-        if (char_set) {
-            setItem(xpath + "/dhcp-ddns/hostname-char-set", char_set,
-                    SR_STRING_T);
-        }
-        ConstElementPtr char_repl = ddns->get("hostname-char-replacement");
-        if (char_repl) {
-            setItem(xpath + "/dhcp-ddns/hostname-char-replacement", char_repl,
-                    SR_STRING_T);
-        }
+        string ddns_xpath = xpath + "/dhcp-ddns";
+        checkAndSetLeaf(ddns, ddns_xpath, "enable-updates", SR_BOOL_T);
+        checkAndSetLeaf(ddns, ddns_xpath, "qualifying-suffix", SR_STRING_T);
+        checkAndSetLeaf(ddns, ddns_xpath, "server-ip", SR_STRING_T);
+        checkAndSetLeaf(ddns, ddns_xpath, "server-port", SR_UINT16_T);
+        checkAndSetLeaf(ddns, ddns_xpath, "sender-ip", SR_STRING_T);
+        checkAndSetLeaf(ddns, ddns_xpath, "sender-port", SR_UINT16_T);
+        checkAndSetLeaf(ddns, ddns_xpath, "max-queue-size", SR_UINT32_T);
+        checkAndSetLeaf(ddns, ddns_xpath, "ncr-protocol", SR_ENUM_T);
+        checkAndSetLeaf(ddns, ddns_xpath, "ncr-format", SR_ENUM_T);
+        checkAndSetLeaf(ddns, ddns_xpath, "override-no-update", SR_BOOL_T);
+        checkAndSetLeaf(ddns, ddns_xpath, "override-client-update", SR_BOOL_T);
+        checkAndSetLeaf(ddns, ddns_xpath, "replace-client-name", SR_ENUM_T);
+        checkAndSetLeaf(ddns, ddns_xpath, "generated-prefix", SR_STRING_T);
+        checkAndSetLeaf(ddns, ddns_xpath, "hostname-char-set", SR_STRING_T);
+        checkAndSetLeaf(ddns, ddns_xpath, "hostname-char-replacement", SR_STRING_T);
         ConstElementPtr context = Adaptor::getContext(ddns);
         if (context) {
             ConstElementPtr repr = Element::create(context->str());
@@ -709,35 +609,22 @@ TranslatorConfig::setServerKeaDhcpCommon(const string& xpath,
     }
     ConstElementPtr sanity = elem->get("sanity-checks");
     if (sanity) {
-        ConstElementPtr checks = sanity->get("lease-checks");
-        if (checks) {
-            setItem(xpath + "/sanity-checks/lease-checks", checks, SR_ENUM_T);
-        }
-    }
-    ConstElementPtr hr_mode = elem->get("reservation-mode");
-    if (hr_mode) {
-        setItem(xpath + "/reservation-mode", hr_mode, SR_ENUM_T);
+        checkAndSetLeaf(sanity, xpath + "/sanity-checks", "lease-checks", SR_ENUM_T);
     }
+    checkAndSetLeaf(elem, xpath, "reservation-mode", SR_ENUM_T);
     ConstElementPtr hosts = elem->get("reservations");
     if (hosts && !hosts->empty()) {
         setHosts(xpath, hosts);
     }
     ConstElementPtr config_ctrl = elem->get("config-control");
     if (config_ctrl && !config_ctrl->empty()) {
-        ConstElementPtr cfwt = config_ctrl->get("config-fetch-wait-time");
-        if (cfwt) {
-            setItem(xpath + "/config-control/config-fetch-wait-time", cfwt,
-                    SR_UINT32_T);
-        }
+        checkAndSetLeaf(config_ctrl, xpath + "/config-control", "config-fetch-wait-time", SR_UINT32_T);
         databases = config_ctrl->get("config-databases");
         if (databases && !databases->empty()) {
             setDatabases(xpath + "/config-control/config-database", databases);
         }
     }
-    ConstElementPtr server_tag = elem->get("server-tag");
-    if (server_tag) {
-        setItem(xpath + "/server-tag", server_tag, SR_STRING_T);
-    }
+    checkAndSetLeaf(elem, xpath, "server-tag", SR_STRING_T);
     ConstElementPtr queue_ctrl = elem->get("dhcp-queue-control");
     if (queue_ctrl) {
         ConstElementPtr repr = Element::create(queue_ctrl->str());
@@ -762,11 +649,14 @@ TranslatorConfig::setServerKeaDhcpCommon(const string& xpath,
     checkAndSetLeaf(elem, xpath, "ddns-update-on-renew", SR_BOOL_T);
     checkAndSetLeaf(elem, xpath, "ddns-use-conflict-resolution", SR_BOOL_T);
     checkAndSetLeaf(elem, xpath, "ip-reservations-unique", SR_BOOL_T);
+    checkAndSetLeaf(elem, xpath, "early-global-reservations-lookup", SR_BOOL_T);
+    checkAndSetLeaf(elem, xpath, "reservations-lookup-first", SR_BOOL_T);
     ConstElementPtr multi_threading(elem->get("multi-threading"));
     if (multi_threading) {
-        checkAndSetLeaf(multi_threading, xpath + "/multi-threading", "enable-multi-threading", SR_BOOL_T);
-        checkAndSetLeaf(multi_threading, xpath + "/multi-threading", "packet-queue-size", SR_UINT32_T);
-        checkAndSetLeaf(multi_threading, xpath + "/multi-threading", "thread-pool-size", SR_UINT32_T);
+        string mt_xpath = xpath + "/multi-threading";
+        checkAndSetLeaf(multi_threading, mt_xpath, "enable-multi-threading", SR_BOOL_T);
+        checkAndSetLeaf(multi_threading, mt_xpath, "packet-queue-size", SR_UINT32_T);
+        checkAndSetLeaf(multi_threading, mt_xpath, "thread-pool-size", SR_UINT32_T);
     }
     checkAndSetLeaf(elem, xpath, "parked-packet-limit", SR_UINT32_T);
     checkAndSetLeaf(elem, xpath, "reservations-global", SR_BOOL_T);
@@ -794,73 +684,35 @@ TranslatorConfig::setServerKeaDhcp4(ConstElementPtr elem) {
                         intf, SR_STRING_T);
             }
         }
-        ConstElementPtr ds_type = if_config->get("dhcp-socket-type");
-        if (ds_type) {
-            setItem(xpath + "/interfaces-config/dhcp-socket-type",
-                    ds_type, SR_ENUM_T);
-        }
-        ConstElementPtr out_if = if_config->get("outbound-interface");
-        if (out_if) {
-            setItem(xpath + "/interfaces-config/outbound-interface",
-                    out_if, SR_ENUM_T);
-        }
-        ConstElementPtr redetect = if_config->get("re-detect");
-        if (redetect) {
-            setItem(xpath + "/interfaces-config/re-detect",
-                    redetect, SR_BOOL_T);
-        }
+        string if_cfg_xpath = xpath + "/interfaces-config";
+        checkAndSetLeaf(if_config, if_cfg_xpath, "dhcp-socket-type", SR_ENUM_T);
+        checkAndSetLeaf(if_config, if_cfg_xpath, "outbound-interface", SR_ENUM_T);
+        checkAndSetLeaf(if_config, if_cfg_xpath, "service-sockets-require-all", SR_BOOL_T);
+        checkAndSetLeaf(if_config, if_cfg_xpath, "service-sockets-max-retries", SR_UINT32_T);
+        checkAndSetLeaf(if_config, if_cfg_xpath, "service-sockets-retry-wait-time", SR_UINT32_T);
+        checkAndSetLeaf(if_config, if_cfg_xpath, "re-detect", SR_BOOL_T);
         ConstElementPtr context = Adaptor::getContext(if_config);
         if (context) {
             setItem(xpath + "/interfaces-config/user-context",
                     Element::create(context->str()), SR_STRING_T);
         }
     }
-    ConstElementPtr echo = elem->get("echo-client-id");
-    if (echo) {
-        setItem(xpath + "/echo-client-id", echo, SR_BOOL_T);
-    }
-    ConstElementPtr match = elem->get("match-client-id");
-    if (match) {
-        setItem(xpath + "/match-client-id", match, SR_BOOL_T);
-    }
-    ConstElementPtr next = elem->get("next-server");
-    if (next) {
-        setItem(xpath + "/next-server", next, SR_STRING_T);
-    }
-    ConstElementPtr hostname = elem->get("server-hostname");
-    if (hostname) {
-        setItem(xpath + "/server-hostname", hostname, SR_STRING_T);
-    }
-    ConstElementPtr boot = elem->get("boot-file-name");
-    if (boot) {
-        setItem(xpath + "/boot-file-name", boot, SR_STRING_T);
-    }
-    ConstElementPtr auth = elem->get("authoritative");
-    if (auth) {
-        setItem(xpath + "/authoritative", auth, SR_BOOL_T);
-    }
+    checkAndSetLeaf(elem, xpath, "echo-client-id", SR_BOOL_T);
+    checkAndSetLeaf(elem, xpath, "match-client-id", SR_BOOL_T);
+    checkAndSetLeaf(elem, xpath, "next-server", SR_STRING_T);
+    checkAndSetLeaf(elem, xpath, "server-hostname", SR_STRING_T);
+    checkAndSetLeaf(elem, xpath, "boot-file-name", SR_STRING_T);
+    checkAndSetLeaf(elem, xpath, "authoritative", SR_BOOL_T);
 }
 
 void
 TranslatorConfig::setServerKeaDhcp6(ConstElementPtr elem) {
     string xpath = "/kea-dhcp6-server:config";
     setServerKeaDhcpCommon(xpath, elem);
-    ConstElementPtr data_dir = elem->get("data-directory");
-    if (data_dir) {
-        setItem(xpath + "/data-directory", data_dir, SR_STRING_T);
-    }
-    ConstElementPtr preferred = elem->get("preferred-lifetime");
-    if (preferred) {
-        setItem(xpath + "/preferred-lifetime", preferred, SR_UINT32_T);
-    }
-    ConstElementPtr min_pref = elem->get("min-preferred-lifetime");
-    if (min_pref) {
-        setItem(xpath + "/min-preferred-lifetime", min_pref, SR_UINT32_T);
-    }
-    ConstElementPtr max_pref = elem->get("max-preferred-lifetime");
-    if (max_pref) {
-        setItem(xpath + "/max-preferred-lifetime", max_pref, SR_UINT32_T);
-    }
+    checkAndSetLeaf(elem, xpath, "data-directory", SR_STRING_T);
+    checkAndSetLeaf(elem, xpath, "preferred-lifetime", SR_UINT32_T);
+    checkAndSetLeaf(elem, xpath, "min-preferred-lifetime", SR_UINT32_T);
+    checkAndSetLeaf(elem, xpath, "max-preferred-lifetime", SR_UINT32_T);
     ConstElementPtr subnets = elem->get("subnet6");
     if (subnets) {
         setSubnets(xpath, subnets);
@@ -874,11 +726,11 @@ TranslatorConfig::setServerKeaDhcp6(ConstElementPtr elem) {
                         intf, SR_STRING_T);
             }
         }
-        ConstElementPtr redetect = if_config->get("re-detect");
-        if (redetect) {
-            setItem(xpath + "/interfaces-config/re-detect",
-                    redetect, SR_BOOL_T);
-        }
+        string if_cfg_xpath = xpath + "/interfaces-config";
+        checkAndSetLeaf(if_config, if_cfg_xpath, "service-sockets-require-all", SR_BOOL_T);
+        checkAndSetLeaf(if_config, if_cfg_xpath, "service-sockets-max-retries", SR_UINT32_T);
+        checkAndSetLeaf(if_config, if_cfg_xpath, "service-sockets-retry-wait-time", SR_UINT32_T);
+        checkAndSetLeaf(if_config, if_cfg_xpath, "re-detect", SR_BOOL_T);
         ConstElementPtr context = Adaptor::getContext(if_config);
         if (context) {
             setItem(xpath + "/interfaces-config/user-context",
@@ -899,31 +751,13 @@ TranslatorConfig::setServerKeaDhcp6(ConstElementPtr elem) {
     }
     ConstElementPtr server_id = elem->get("server-id");
     if (server_id) {
-        ConstElementPtr id_type = server_id->get("type");
-        if (id_type) {
-            setItem(xpath + "/server-id/type", id_type, SR_ENUM_T);
-        }
-        ConstElementPtr id_id = server_id->get("identifier");
-        if (id_id) {
-            setItem(xpath + "/server-id/identifier", id_id, SR_STRING_T);
-        }
-        ConstElementPtr id_time = server_id->get("time");
-        if (id_time) {
-            setItem(xpath + "/server-id/time", id_time, SR_UINT32_T);
-        }
-        ConstElementPtr id_htype = server_id->get("htype");
-        if (id_htype) {
-            setItem(xpath + "/server-id/htype", id_htype, SR_UINT16_T);
-        }
-        ConstElementPtr id_ent_id = server_id->get("enterprise-id");
-        if (id_ent_id) {
-            setItem(xpath + "/server-id/enterprise-id", id_ent_id,
-                    SR_UINT32_T);
-        }
-        ConstElementPtr id_persist = server_id->get("persist");
-        if (id_persist) {
-            setItem(xpath + "/server-id/persist", id_persist, SR_BOOL_T);
-        }
+        string srv_id_xpath = xpath + "/server-id";
+        checkAndSetLeaf(server_id, srv_id_xpath, "type", SR_ENUM_T);
+        checkAndSetLeaf(server_id, srv_id_xpath, "identifier", SR_STRING_T);
+        checkAndSetLeaf(server_id, srv_id_xpath, "time", SR_UINT32_T);
+        checkAndSetLeaf(server_id, srv_id_xpath, "htype", SR_UINT16_T);
+        checkAndSetLeaf(server_id, srv_id_xpath, "enterprise-id", SR_UINT32_T);
+        checkAndSetLeaf(server_id, srv_id_xpath, "persist", SR_BOOL_T);
         ConstElementPtr context = Adaptor::getContext(server_id);
         if (context) {
             ConstElementPtr repr = Element::create(context->str());
index 72eae7be5d433425e6ad0e6a1d27e307df5d4276..2afa4d6fd45352e2aa9a2b1cc514c17047f67da9 100644 (file)
@@ -124,6 +124,8 @@ namespace yang {
 /// +--rw ddns-update-on-renew?             boolean
 /// +--rw ddns-use-conflict-resolution?     boolean
 /// +--rw ip-reservations-unique?           boolean
+/// +--rw early-global-reservations-lookup? boolean
+/// +--rw reservations-lookup-first?        boolean
 /// +--rw multi-threading
 /// +--rw parked-packet-limit?              uint32
 /// +--rw reservations-global?              boolean
@@ -289,6 +291,8 @@ namespace yang {
 /// +--rw ddns-update-on-renew?             boolean
 /// +--rw ddns-use-conflict-resolution?     boolean
 /// +--rw ip-reservations-unique?           boolean
+/// +--rw early-global-reservations-lookup? boolean
+/// +--rw reservations-lookup-first?        boolean
 /// +--rw multi-threading
 /// +--rw parked-packet-limit?              uint32
 /// +--rw reservations-global?              boolean
@@ -538,7 +542,7 @@ protected:
     void setServerKeaDhcp6(isc::data::ConstElementPtr elem);
 };
 
-}; // end of namespace isc::yang
-}; // end of namespace isc
+}  // end of namespace isc::yang
+}  // end of namespace isc
 
 #endif // ISC_TRANSLATOR_CONFIG_H
index 08dfe70a973d712069fc06b5866b7ef0ff043d29..1536dd7a8c74744b2066080163c3cd85d92fb474 100644 (file)
@@ -49,54 +49,22 @@ TranslatorDatabase::getDatabaseKea(const string& xpath) {
     }
     ElementPtr result = Element::createMap();
     result->set("type", type);
-    ConstElementPtr user = getItem(xpath + "/user");
-    if (user) {
-        result->set("user", user);
-    }
-    ConstElementPtr password = getItem(xpath + "/password");
-    if (password) {
-        result->set("password", password);
-    }
-    ConstElementPtr host = getItem(xpath + "/host");
-    if (host) {
-        result->set("host", host);
-    }
-    ConstElementPtr name = getItem(xpath + "/name");
-    if (name) {
-        result->set("name", name);
-    }
-    ConstElementPtr persist = getItem(xpath + "/persist");
-    if (persist) {
-        result->set("persist", persist);
-    }
-    ConstElementPtr port = getItem(xpath + "/port");
-    if (port) {
-        result->set("port", port);
-    }
-    ConstElementPtr lfc_interval = getItem(xpath + "/lfc-interval");
-    if (lfc_interval) {
-        result->set("lfc-interval", lfc_interval);
-    }
-    ConstElementPtr readonly = getItem(xpath + "/readonly");
-    if (readonly) {
-        result->set("readonly", readonly);
-    }
-    ConstElementPtr connect_timeout = getItem(xpath + "/connect-timeout");
-    if (connect_timeout) {
-        result->set("connect-timeout", connect_timeout);
-    }
-    ConstElementPtr max_reconnect = getItem(xpath + "/max-reconnect-tries");
-    if (max_reconnect) {
-        result->set("max-reconnect-tries", max_reconnect);
-    }
-    ConstElementPtr reconnect_time = getItem(xpath + "/reconnect-wait-time");
-    if (reconnect_time) {
-        result->set("reconnect-wait-time", reconnect_time);
-    }
-    ConstElementPtr max_row_errors = getItem(xpath + "/max-row-errors");
-    if (max_row_errors) {
-        result->set("max-row-errors", max_row_errors);
-    }
+    checkAndGetLeaf(result, xpath, "user");
+    checkAndGetLeaf(result, xpath, "password");
+    checkAndGetLeaf(result, xpath, "host");
+    checkAndGetLeaf(result, xpath, "name");
+    checkAndGetLeaf(result, xpath, "persist");
+    checkAndGetLeaf(result, xpath, "port");
+    checkAndGetLeaf(result, xpath, "lfc-interval");
+    checkAndGetLeaf(result, xpath, "readonly");
+    checkAndGetLeaf(result, xpath, "trust-anchor");
+    checkAndGetLeaf(result, xpath, "cert-file");
+    checkAndGetLeaf(result, xpath, "key-file");
+    checkAndGetLeaf(result, xpath, "cipher-list");
+    checkAndGetLeaf(result, xpath, "connect-timeout");
+    checkAndGetLeaf(result, xpath, "max-reconnect-tries");
+    checkAndGetLeaf(result, xpath, "reconnect-wait-time");
+    checkAndGetLeaf(result, xpath, "max-row-errors");
     checkAndGetLeaf(result, xpath, "on-fail");
     ConstElementPtr context = getItem(xpath + "/user-context");
     if (context) {
@@ -140,54 +108,22 @@ TranslatorDatabase::setDatabaseKea(const string& xpath,
         }
         setItem(xpath + "/database-type", type, SR_STRING_T);
     }
-    ConstElementPtr user = elem->get("user");
-    if (user) {
-        setItem(xpath + "/user", user, SR_STRING_T);
-    }
-    ConstElementPtr password = elem->get("password");
-    if (password) {
-        setItem(xpath + "/password", password, SR_STRING_T);
-    }
-    ConstElementPtr host = elem->get("host");
-    if (host) {
-        setItem(xpath + "/host", host, SR_STRING_T);
-    }
-    ConstElementPtr name = elem->get("name");
-    if (name) {
-        setItem(xpath + "/name", name, SR_STRING_T);
-    }
-    ConstElementPtr persist = elem->get("persist");
-    if (persist) {
-        setItem(xpath + "/persist", persist, SR_BOOL_T);
-    }
-    ConstElementPtr port = elem->get("port");
-    if (port) {
-        setItem(xpath + "/port", port, SR_UINT16_T);
-    }
-    ConstElementPtr lfc_interval = elem->get("lfc-interval");
-    if (lfc_interval) {
-        setItem(xpath + "/lfc-interval", lfc_interval, SR_UINT32_T);
-    }
-    ConstElementPtr readonly = elem->get("readonly");
-    if (readonly) {
-        setItem(xpath + "/readonly", readonly, SR_BOOL_T);
-    }
-    ConstElementPtr connect_timeout = elem->get("connect-timeout");
-    if (connect_timeout) {
-        setItem(xpath + "/connect-timeout", connect_timeout, SR_UINT32_T);
-    }
-    ConstElementPtr max_reconnect = elem->get("max-reconnect-tries");
-    if (max_reconnect) {
-        setItem(xpath + "/max-reconnect-tries", max_reconnect, SR_UINT32_T);
-    }
-    ConstElementPtr reconnect_wait = elem->get("reconnect-wait-time");
-    if (reconnect_wait) {
-        setItem(xpath + "/reconnect-wait-time", reconnect_wait, SR_UINT32_T);
-    }
-    ConstElementPtr max_row_errors = elem->get("max-row-errors");
-    if (max_row_errors) {
-        setItem(xpath + "/max-row-errors", max_row_errors, SR_UINT32_T);
-    }
+    checkAndSetLeaf(elem, xpath, "user", SR_STRING_T);
+    checkAndSetLeaf(elem, xpath, "password", SR_STRING_T);
+    checkAndSetLeaf(elem, xpath, "host", SR_STRING_T);
+    checkAndSetLeaf(elem, xpath, "name", SR_STRING_T);
+    checkAndSetLeaf(elem, xpath, "persist", SR_BOOL_T);
+    checkAndSetLeaf(elem, xpath, "port", SR_UINT16_T);
+    checkAndSetLeaf(elem, xpath, "lfc-interval", SR_UINT32_T);
+    checkAndSetLeaf(elem, xpath, "readonly", SR_BOOL_T);
+    checkAndSetLeaf(elem, xpath, "trust-anchor", SR_STRING_T);
+    checkAndSetLeaf(elem, xpath, "cert-file", SR_STRING_T);
+    checkAndSetLeaf(elem, xpath, "key-file", SR_STRING_T);
+    checkAndSetLeaf(elem, xpath, "cipher-list", SR_STRING_T);
+    checkAndSetLeaf(elem, xpath, "connect-timeout", SR_UINT32_T);
+    checkAndSetLeaf(elem, xpath, "max-reconnect-tries", SR_UINT32_T);
+    checkAndSetLeaf(elem, xpath, "reconnect-wait-time", SR_UINT32_T);
+    checkAndSetLeaf(elem, xpath, "max-row-errors", SR_UINT32_T);
     checkAndSetLeaf(elem, xpath, "on-fail", SR_STRING_T);
     ConstElementPtr context = Adaptor::getContext(elem);
     if (context) {
index c62edc62758cf3c67ec7fe8fe532a341979f8f7b..f1aa566fb278fe6991e16a02bc6b9492b1af1c90 100644 (file)
@@ -27,6 +27,10 @@ namespace yang {
 ///     "port": <port>,
 ///     "lfc-interval": <lfc interval>,
 ///     "readonly": <readonly flag>,
+///     "trust-anchor": <trust anchor>,
+///     "cert-file": <cert file>,
+///     "key-file": <key file>,
+///     "cipher-list": <cipher list>,
 ///     "connect-timeout": <connect timeout>,
 ///     "max-reconnect-tries": <maximum reconnect tries>,
 ///     "reconnect-wait-time": <reconnect wait time>,
@@ -48,6 +52,10 @@ namespace yang {
 ///    +--rw port?                  uint16
 ///    +--rw lfc-interval?          uint32
 ///    +--rw readonly?              boolean
+///    +--rw trust-anchor?          string
+///    +--rw cert-file?             string
+///    +--rw key-file?              string
+///    +--rw cipher-list?           string
 ///    +--rw connect-timeout?       uint32
 ///    +--rw max-reconnect-tries?   uint32
 ///    +--rw reconnect-wait-time?   uint32
index 75944f805a578b25028d3f42659ab215a89a6ae7..5f4233a8aa6fecb243329a9880d5ba0d032b52e6 100644 (file)
@@ -31,7 +31,7 @@ static const std::string KEA_DHCP_DDNS = "kea-dhcp-ddns";
 /// by ISC in the near future.
 static const std::string KEA_CTRL_AGENT = "kea-ctrl-agent";
 
-}; // end of namespace isc::yang
-}; // end of namespace isc
+}  // end of namespace isc::yang
+}  // end of namespace isc
 
 #endif // ISC_YANG_MODELS_H
index 466264cf945e3ae27592900849702ec43178bde0..40100b9d107bf30e22e046c8b459e72d87bcdf8f 100644 (file)
@@ -22,11 +22,11 @@ static const std::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", "2021-11-24" },
-    { "kea-dhcp4-server", "2021-11-24" },
-    { "kea-dhcp6-server", "2021-11-24" },
+    { "kea-dhcp-types", "2022-07-27" },
+    { "kea-dhcp4-server", "2022-07-27" },
+    { "kea-dhcp6-server", "2022-07-27" },
     { "kea-ctrl-agent", "2019-08-12" },
-    { "kea-dhcp-ddns", "2019-08-12" }
+    { "kea-dhcp-ddns", "2022-07-27" }
 };
 
 }  // namespace yang
index e0ec6ad5430e39ead848bfce35963d85781bd9ca..9a2f88dd6aea1b5d2e021a94fd359696901c4d42 100644 (file)
@@ -12,10 +12,10 @@ yangmodules_list += ietf-dhcpv6-types@2018-09-04.yang
 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@2019-08-12.yang
-yangmodules_list += kea-dhcp-types@2021-11-24.yang
-yangmodules_list += kea-dhcp4-server@2021-11-24.yang
-yangmodules_list += kea-dhcp6-server@2021-11-24.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-types@2019-08-12.yang
 yangmodules_list += keatest-module@2018-11-20.yang
 
diff --git a/src/share/yang/modules/hashes/kea-dhcp-ddns@2019-08-12.hash b/src/share/yang/modules/hashes/kea-dhcp-ddns@2019-08-12.hash
deleted file mode 100644 (file)
index 537b73c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-230145eb977108912d0015b8fb0d77bd4f53df0f4dfc317329ea5892569a7ba8
diff --git a/src/share/yang/modules/hashes/kea-dhcp-ddns@2022-07-27.hash b/src/share/yang/modules/hashes/kea-dhcp-ddns@2022-07-27.hash
new file mode 100644 (file)
index 0000000..e0e5205
--- /dev/null
@@ -0,0 +1 @@
+5a1ad7031da9ab5f93a87df74ddba26aab2ade6250969c06504a0b5f13007d7f
diff --git a/src/share/yang/modules/hashes/kea-dhcp-types@2021-11-24.hash b/src/share/yang/modules/hashes/kea-dhcp-types@2021-11-24.hash
deleted file mode 100644 (file)
index 3cee75b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-f31e4c01a1122d69de1a8f67a5d34f88697a9ef89e901eab79cf3259244203f1
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
new file mode 100644 (file)
index 0000000..a03e11a
--- /dev/null
@@ -0,0 +1 @@
+37c464015c0ff912febacfd4cff17dd162e73d377df2630a3a3c09f16d812460
diff --git a/src/share/yang/modules/hashes/kea-dhcp4-server@2021-11-24.hash b/src/share/yang/modules/hashes/kea-dhcp4-server@2021-11-24.hash
deleted file mode 100644 (file)
index 9fee2d1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-1e5474091ab0ceb313cf7b28fd736ee7a2cedc90d52310339af089b0f4db9e17
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
new file mode 100644 (file)
index 0000000..dcd2bbe
--- /dev/null
@@ -0,0 +1 @@
+9337384d8f47ebbce2e6883d612487820cfd841cab9c1447ed25e8b991c64d81
diff --git a/src/share/yang/modules/hashes/kea-dhcp6-server@2021-11-24.hash b/src/share/yang/modules/hashes/kea-dhcp6-server@2021-11-24.hash
deleted file mode 100644 (file)
index 0004024..0000000
+++ /dev/null
@@ -1 +0,0 @@
-c9c9c05f600a3e93614305b4ea36bd80f4bd32d9576e2b8035f4f597537c3a79
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
new file mode 100644 (file)
index 0000000..a0d37df
--- /dev/null
@@ -0,0 +1 @@
+9d1ec0093e418675db838a23782bf880971067f68ec1ea2803a61f8656bcf22c
similarity index 92%
rename from src/share/yang/modules/kea-dhcp-ddns@2019-08-12.yang
rename to src/share/yang/modules/kea-dhcp-ddns@2022-07-27.yang
index fdffc1560f7bc885bc3e5ef5799617a687d3a84c..bafa6a3de12957525d53dd7d98f6b86741cadec3 100644 (file)
@@ -16,6 +16,11 @@ module kea-dhcp-ddns {
   description "This model defines a YANG data model that can be
     used to configure and manage a Kea DHCP-DDNS server.";
 
+  revision 2022-07-27 {
+    description "Added GSS-TSIG key-name configration parameter for DNS
+                 servers";
+  }
+
   revision 2019-08-12 {
     description "Initial revision";
     reference "";
@@ -61,6 +66,11 @@ module kea-dhcp-ddns {
               type uint16;
               description "DNS server port.";
             }
+            leaf key-name {
+              type string;
+              description "Name of the TSIG key used to protect DNS updates for
+                           this server.";
+            }
             leaf user-context {
               type kea:user-context;
               description "DNS server user context.";
similarity index 91%
rename from src/share/yang/modules/kea-dhcp-types@2021-11-24.yang
rename to src/share/yang/modules/kea-dhcp-types@2022-07-27.yang
index bab099ad860070088020fab5c1851726499a8327..68b3ce3deea24d5706400633feacf89e5677c016 100644 (file)
@@ -16,6 +16,16 @@ module kea-dhcp-types {
   description "This file defines some commonly used Kea DHCP types and
                groupings.";
 
+  revision 2022-07-27 {
+    description "Added TLS parameters for database connections: trust-anchor,
+                 cert-file, key-file, cipher-list. Added parameters which govern
+                 the way the server behaves regarding detection of configured
+                 interfaces: service-sockets-require-all,
+                 service-sockets-max-retries, service-sockets-retry-wait-time.
+                 Added parameters which govern reservations lookup:
+                 early-global-reservations-lookup, reservations-lookup-first.";
+  }
+
   revision 2021-11-24 {
     description "Fixed store-extended-info. Added several containers and leaves:
                  compatibility, lenient-option-parsing, multi-threading,
@@ -218,6 +228,22 @@ module kea-dhcp-types {
                    databases, only for host reservations and possibly
                    for upcoming config backend.";
     }
+    leaf trust-anchor {
+      type string;
+      description "TLS trust anchor.";
+    }
+    leaf cert-file {
+      type string;
+      description "TLS certificate file.";
+    }
+    leaf key-file {
+      type string;
+      description "TLS key file.";
+    }
+    leaf cipher-list {
+      type string;
+      description "TLS cipher list.";
+    }
     leaf connect-timeout {
       type uint32;
       units "milliseconds";
@@ -636,6 +662,37 @@ module kea-dhcp-types {
     }
   }
 
+  grouping interfaces-service-sockets-require-all {
+    description "Interfaces service-sockets-require-all grouping.";
+    leaf service-sockets-require-all {
+      type boolean;
+      description "Kea tries to bind the service sockets during initialization.
+                   It may fail due to a port being already opened or
+                   misconfiguration. Kea can suppress these errors and only logs
+                   them. This flag prevents starting the DHCP server without
+                   binding all sockets.";
+    }
+  }
+
+  grouping interfaces-service-sockets-max-retries {
+    description "Interfaces service-sockets-max-retries grouping.";
+    leaf service-sockets-max-retries {
+      type uint32;
+      description "Kea tries to bind the service sockets during initialization.
+                   This option specifies how many times binding to interface
+                   will be retried.";
+    }
+  }
+
+  grouping interfaces-service-sockets-retry-wait-time {
+    description "Interfaces service-sockets-retry-wait-time grouping.";
+    leaf service-sockets-retry-wait-time {
+      type uint32;
+      description "The time interval in milliseconds to wait before the next
+                   attempt to retry opening a service socket.";
+    }
+  }
+
   grouping class-name {
     description "Client class name grouping.";
     leaf name {
@@ -973,6 +1030,23 @@ module kea-dhcp-types {
     }
   }
 
+  grouping early-global-reservations-lookup {
+    leaf early-global-reservations-lookup {
+      type boolean;
+      description
+        "whether an early global host reservations lookup should be performed";
+    }
+  }
+
+  grouping reservations-lookup-first {
+    leaf reservations-lookup-first {
+      type boolean;
+      description
+        "whether host reservations lookup should be performed before lease
+         lookup";
+    }
+  }
+
   grouping multi-threading {
     container multi-threading {
       description
similarity index 95%
rename from src/share/yang/modules/kea-dhcp4-server@2021-11-24.yang
rename to src/share/yang/modules/kea-dhcp4-server@2022-07-27.yang
index 1efde0816e27a2da8e014dca943c21f6684520e6..de56557eedd8153e6024e4cf5ed64acf818d50e5 100644 (file)
@@ -12,7 +12,7 @@ module kea-dhcp4-server {
   }
   import kea-dhcp-types {
     prefix dhcp;
-    revision-date 2021-11-24;
+    revision-date 2022-07-27;
   }
 
   organization "Internet Systems Consortium";
@@ -20,6 +20,16 @@ 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-07-27 {
+    description "Added TLS parameters for database connections: trust-anchor,
+                 cert-file, key-file, cipher-list. Added parameters which govern
+                 the way the server behaves regarding detection of configured
+                 interfaces: service-sockets-require-all,
+                 service-sockets-max-retries, service-sockets-retry-wait-time.
+                 Added parameters which govern reservations lookup:
+                 early-global-reservations-lookup, reservations-lookup-first.";
+  }
+
   revision 2021-11-24 {
     description "Fixed store-extended-info. Added several containers and leaves:
                  compatibility, lenient-option-parsing, multi-threading,
@@ -412,6 +422,9 @@ module kea-dhcp4-server {
         description "Control the interface used to send a response.";
       }
       uses dhcp:interfaces-re-detect;
+      uses dhcp:interfaces-service-sockets-require-all;
+      uses dhcp:interfaces-service-sockets-max-retries;
+      uses dhcp:interfaces-service-sockets-retry-wait-time;
       uses dhcp:interfaces-user-context;
     }
 
@@ -474,6 +487,8 @@ module kea-dhcp4-server {
     uses dhcp:ddns-update-on-renew;
     uses dhcp:ddns-use-conflict-resolution;
     uses dhcp:ip-reservations-unique;
+    uses dhcp:early-global-reservations-lookup;
+    uses dhcp:reservations-lookup-first;
     uses dhcp:multi-threading;
     uses dhcp:parked-packet-limit;
     uses dhcp:reservations-global;
similarity index 95%
rename from src/share/yang/modules/kea-dhcp6-server@2021-11-24.yang
rename to src/share/yang/modules/kea-dhcp6-server@2022-07-27.yang
index e430ddd83a09281f9ef9e7318a4cb2b025ef3cca..b7f6e7fef0bd684ab53e7a0a6a83c39515807fe2 100644 (file)
@@ -12,7 +12,7 @@ module kea-dhcp6-server {
   }
   import kea-dhcp-types {
     prefix dhcp;
-    revision-date 2021-11-24;
+    revision-date 2022-07-27;
   }
 
   organization "Internet Systems Consortium";
@@ -20,6 +20,16 @@ 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-07-27 {
+    description "Added TLS parameters for database connections: trust-anchor,
+                 cert-file, key-file, cipher-list. Added parameters which govern
+                 the way the server behaves regarding detection of configured
+                 interfaces: service-sockets-require-all,
+                 service-sockets-max-retries, service-sockets-retry-wait-time.
+                 Added parameters which govern reservations lookup:
+                 early-global-reservations-lookup, reservations-lookup-first.";
+  }
+
   revision 2021-11-24 {
     description "Fixed store-extended-info. Added several containers and leaves:
                  compatibility, lenient-option-parsing, multi-threading,
@@ -435,6 +445,9 @@ module kea-dhcp6-server {
                      (e.g. eth0/2001:db8::1) or * (use all interfaces).";
       }
       uses dhcp:interfaces-re-detect;
+      uses dhcp:interfaces-service-sockets-require-all;
+      uses dhcp:interfaces-service-sockets-max-retries;
+      uses dhcp:interfaces-service-sockets-retry-wait-time;
       uses dhcp:interfaces-user-context;
     }
 
@@ -538,6 +551,8 @@ module kea-dhcp6-server {
     uses dhcp:ddns-update-on-renew;
     uses dhcp:ddns-use-conflict-resolution;
     uses dhcp:ip-reservations-unique;
+    uses dhcp:early-global-reservations-lookup;
+    uses dhcp:reservations-lookup-first;
     uses dhcp:multi-threading;
     uses dhcp:parked-packet-limit;
     uses dhcp:reservations-global;