From: Razvan Becheriu Date: Wed, 20 Jul 2022 16:45:31 +0000 (+0300) Subject: [#2224] added missing parameters including TLS connection parameters to YANG models X-Git-Tag: Kea-2.2.0~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f7c1b15217149451cfb805770dbee5491560d6d;p=thirdparty%2Fkea.git [#2224] added missing parameters including TLS connection parameters to YANG models --- diff --git a/ChangeLog b/ChangeLog index a961ab484e..39bbd7052a 100644 --- 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, diff --git a/doc/examples/ddns/all-keys-netconf.json b/doc/examples/ddns/all-keys-netconf.json index 765a20f13a..27299a8847 100644 --- a/doc/examples/ddns/all-keys-netconf.json +++ b/doc/examples/ddns/all-keys-netconf.json @@ -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. @@ -78,7 +79,11 @@ "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. @@ -104,7 +110,10 @@ "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" } ] } diff --git a/doc/examples/kea4/all-keys-netconf.json b/doc/examples/kea4/all-keys-netconf.json index cb69a53039..a754256e99 100644 --- a/doc/examples/kea4/all-keys-netconf.json +++ b/doc/examples/kea4/all-keys-netconf.json @@ -316,7 +316,21 @@ "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. @@ -339,8 +353,8 @@ // 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. @@ -400,9 +414,34 @@ // 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 @@ -419,6 +458,13 @@ // 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 diff --git a/doc/examples/kea4/all-keys.json b/doc/examples/kea4/all-keys.json index 2c363aab59..40c0f3a2fb 100644 --- a/doc/examples/kea4/all-keys.json +++ b/doc/examples/kea4/all-keys.json @@ -366,8 +366,8 @@ // 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. diff --git a/doc/examples/kea6/all-keys-netconf.json b/doc/examples/kea6/all-keys-netconf.json index a2098225ef..6712be2e11 100644 --- a/doc/examples/kea6/all-keys-netconf.json +++ b/doc/examples/kea6/all-keys-netconf.json @@ -276,7 +276,20 @@ "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. @@ -299,8 +312,8 @@ // 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. @@ -343,9 +356,34 @@ // 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 @@ -363,6 +401,13 @@ // 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 diff --git a/doc/examples/kea6/all-keys.json b/doc/examples/kea6/all-keys.json index 7ddc196ef6..c3437d0424 100644 --- a/doc/examples/kea6/all-keys.json +++ b/doc/examples/kea6/all-keys.json @@ -279,7 +279,6 @@ "readonly": false, // Next entries are for the OpenSSL support in MySQL. - // Trust anchor aka certificate authority file or directory. "trust-anchor": "my-ca", @@ -326,8 +325,8 @@ // 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. diff --git a/m4macros/ax_sysrepo.m4 b/m4macros/ax_sysrepo.m4 index 925affb76d..415125e6b2 100644 --- a/m4macros/ax_sysrepo.m4 +++ b/m4macros/ax_sysrepo.m4 @@ -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. diff --git a/src/lib/yang/adaptor.cc b/src/lib/yang/adaptor.cc index 597f233055..cf512bbab5 100644 --- a/src/lib/yang/adaptor.cc +++ b/src/lib/yang/adaptor.cc @@ -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 diff --git a/src/lib/yang/adaptor.h b/src/lib/yang/adaptor.h index fa1bbd6884..6a9452ec7c 100644 --- a/src/lib/yang/adaptor.h +++ b/src/lib/yang/adaptor.h @@ -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 diff --git a/src/lib/yang/adaptor_config.cc b/src/lib/yang/adaptor_config.cc index 0128792a6a..f19f274879 100644 --- a/src/lib/yang/adaptor_config.cc +++ b/src/lib/yang/adaptor_config.cc @@ -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 diff --git a/src/lib/yang/adaptor_config.h b/src/lib/yang/adaptor_config.h index d849a611ee..da71b9cc7a 100644 --- a/src/lib/yang/adaptor_config.h +++ b/src/lib/yang/adaptor_config.h @@ -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 diff --git a/src/lib/yang/adaptor_host.cc b/src/lib/yang/adaptor_host.cc index c02896af0e..35c55571bc 100644 --- a/src/lib/yang/adaptor_host.cc +++ b/src/lib/yang/adaptor_host.cc @@ -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 diff --git a/src/lib/yang/adaptor_host.h b/src/lib/yang/adaptor_host.h index 918b4bf7b2..488e435a26 100644 --- a/src/lib/yang/adaptor_host.h +++ b/src/lib/yang/adaptor_host.h @@ -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 diff --git a/src/lib/yang/adaptor_option.cc b/src/lib/yang/adaptor_option.cc index db61ac366f..7da06a0ae7 100644 --- a/src/lib/yang/adaptor_option.cc +++ b/src/lib/yang/adaptor_option.cc @@ -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 diff --git a/src/lib/yang/adaptor_option.h b/src/lib/yang/adaptor_option.h index e3c53f18e2..1a5f171f06 100644 --- a/src/lib/yang/adaptor_option.h +++ b/src/lib/yang/adaptor_option.h @@ -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 diff --git a/src/lib/yang/adaptor_pool.cc b/src/lib/yang/adaptor_pool.cc index a6586332dc..1b6811a80e 100644 --- a/src/lib/yang/adaptor_pool.cc +++ b/src/lib/yang/adaptor_pool.cc @@ -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 diff --git a/src/lib/yang/adaptor_pool.h b/src/lib/yang/adaptor_pool.h index f8e72bf2c4..8a8fa0a9ed 100644 --- a/src/lib/yang/adaptor_pool.h +++ b/src/lib/yang/adaptor_pool.h @@ -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 diff --git a/src/lib/yang/adaptor_subnet.cc b/src/lib/yang/adaptor_subnet.cc index bb352b979f..dd75710873 100644 --- a/src/lib/yang/adaptor_subnet.cc +++ b/src/lib/yang/adaptor_subnet.cc @@ -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 diff --git a/src/lib/yang/adaptor_subnet.h b/src/lib/yang/adaptor_subnet.h index 0bfcae00ef..581c39f6f0 100644 --- a/src/lib/yang/adaptor_subnet.h +++ b/src/lib/yang/adaptor_subnet.h @@ -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 diff --git a/src/lib/yang/sysrepo_error.h b/src/lib/yang/sysrepo_error.h index 65be9fcd5a..b436109a96 100644 --- a/src/lib/yang/sysrepo_error.h +++ b/src/lib/yang/sysrepo_error.h @@ -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 diff --git a/src/lib/yang/tests/config_unittests.cc b/src/lib/yang/tests/config_unittests.cc index 41f024737b..7a655a747f 100644 --- a/src/lib/yang/tests/config_unittests.cc +++ b/src/lib/yang/tests/config_unittests.cc @@ -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", diff --git a/src/lib/yang/translator_config.cc b/src/lib/yang/translator_config.cc index 05a964828b..e4fc040d73 100644 --- a/src/lib/yang/translator_config.cc +++ b/src/lib/yang/translator_config.cc @@ -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()); diff --git a/src/lib/yang/translator_config.h b/src/lib/yang/translator_config.h index 72eae7be5d..2afa4d6fd4 100644 --- a/src/lib/yang/translator_config.h +++ b/src/lib/yang/translator_config.h @@ -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 diff --git a/src/lib/yang/translator_database.cc b/src/lib/yang/translator_database.cc index 08dfe70a97..1536dd7a8c 100644 --- a/src/lib/yang/translator_database.cc +++ b/src/lib/yang/translator_database.cc @@ -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) { diff --git a/src/lib/yang/translator_database.h b/src/lib/yang/translator_database.h index c62edc6275..f1aa566fb2 100644 --- a/src/lib/yang/translator_database.h +++ b/src/lib/yang/translator_database.h @@ -27,6 +27,10 @@ namespace yang { /// "port": , /// "lfc-interval": , /// "readonly": , +/// "trust-anchor": , +/// "cert-file": , +/// "key-file": , +/// "cipher-list": , /// "connect-timeout": , /// "max-reconnect-tries": , /// "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 diff --git a/src/lib/yang/yang_models.h b/src/lib/yang/yang_models.h index 75944f805a..5f4233a8aa 100644 --- a/src/lib/yang/yang_models.h +++ b/src/lib/yang/yang_models.h @@ -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 diff --git a/src/lib/yang/yang_revisions.h b/src/lib/yang/yang_revisions.h index 466264cf94..40100b9d10 100644 --- a/src/lib/yang/yang_revisions.h +++ b/src/lib/yang/yang_revisions.h @@ -22,11 +22,11 @@ static const std::map 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 diff --git a/src/share/yang/modules/Makefile.am b/src/share/yang/modules/Makefile.am index e0ec6ad543..9a2f88dd6a 100644 --- a/src/share/yang/modules/Makefile.am +++ b/src/share/yang/modules/Makefile.am @@ -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 index 537b73cbf0..0000000000 --- a/src/share/yang/modules/hashes/kea-dhcp-ddns@2019-08-12.hash +++ /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 index 0000000000..e0e5205252 --- /dev/null +++ b/src/share/yang/modules/hashes/kea-dhcp-ddns@2022-07-27.hash @@ -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 index 3cee75b84f..0000000000 --- a/src/share/yang/modules/hashes/kea-dhcp-types@2021-11-24.hash +++ /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 index 0000000000..a03e11a2c5 --- /dev/null +++ b/src/share/yang/modules/hashes/kea-dhcp-types@2022-07-27.hash @@ -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 index 9fee2d195e..0000000000 --- a/src/share/yang/modules/hashes/kea-dhcp4-server@2021-11-24.hash +++ /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 index 0000000000..dcd2bbe960 --- /dev/null +++ b/src/share/yang/modules/hashes/kea-dhcp4-server@2022-07-27.hash @@ -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 index 0004024a30..0000000000 --- a/src/share/yang/modules/hashes/kea-dhcp6-server@2021-11-24.hash +++ /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 index 0000000000..a0d37df2c1 --- /dev/null +++ b/src/share/yang/modules/hashes/kea-dhcp6-server@2022-07-27.hash @@ -0,0 +1 @@ +9d1ec0093e418675db838a23782bf880971067f68ec1ea2803a61f8656bcf22c diff --git a/src/share/yang/modules/kea-dhcp-ddns@2019-08-12.yang b/src/share/yang/modules/kea-dhcp-ddns@2022-07-27.yang 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 fdffc1560f..bafa6a3de1 100644 --- a/src/share/yang/modules/kea-dhcp-ddns@2019-08-12.yang +++ b/src/share/yang/modules/kea-dhcp-ddns@2022-07-27.yang @@ -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."; diff --git a/src/share/yang/modules/kea-dhcp-types@2021-11-24.yang b/src/share/yang/modules/kea-dhcp-types@2022-07-27.yang 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 bab099ad86..68b3ce3dee 100644 --- a/src/share/yang/modules/kea-dhcp-types@2021-11-24.yang +++ b/src/share/yang/modules/kea-dhcp-types@2022-07-27.yang @@ -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 diff --git a/src/share/yang/modules/kea-dhcp4-server@2021-11-24.yang b/src/share/yang/modules/kea-dhcp4-server@2022-07-27.yang 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 1efde0816e..de56557eed 100644 --- a/src/share/yang/modules/kea-dhcp4-server@2021-11-24.yang +++ b/src/share/yang/modules/kea-dhcp4-server@2022-07-27.yang @@ -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; diff --git a/src/share/yang/modules/kea-dhcp6-server@2021-11-24.yang b/src/share/yang/modules/kea-dhcp6-server@2022-07-27.yang 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 e430ddd83a..b7f6e7fef0 100644 --- a/src/share/yang/modules/kea-dhcp6-server@2021-11-24.yang +++ b/src/share/yang/modules/kea-dhcp6-server@2022-07-27.yang @@ -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;