From: Andrei Pavel Date: Wed, 10 May 2023 15:49:45 +0000 (+0300) Subject: [#2832] add missing YANG nodes X-Git-Tag: Kea-2.3.8~141 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2181cef68d6b49d68e4acb8f1c31f0cf978e2c26;p=thirdparty%2Fkea.git [#2832] add missing YANG nodes - allocator - ddns-ttl-percent - exclude-first-last-24, - ignore-dhcp-server-Identifier - offer-lifetime - pd-allocator - read-timeout - tcp-user-timeout - write-timeout Removed obsolete YANG nodes: contact-points, keyspace. --- diff --git a/doc/examples/kea4/all-keys-netconf.json b/doc/examples/kea4/all-keys-netconf.json index 29484cec26..442222ab9f 100644 --- a/doc/examples/kea4/all-keys-netconf.json +++ b/doc/examples/kea4/all-keys-netconf.json @@ -11,6 +11,9 @@ { // Kea DHCPv4 server configuration begins here. "Dhcp4": { + // Global flag selecting an IP address allocation strategy for all + // subnets. Use "random" for a random allocation strategy. + "allocator": "iterative", // Global authoritative flag to handle requests by clients for // unknown IP addresses (ignore if disabled, NAK if enabled). @@ -54,7 +57,11 @@ "min-valid-lifetime": 4000, // Class max valid lifetime. - "max-valid-lifetime": 8000 + "max-valid-lifetime": 8000, + + // If greater than zero, it is the lifetime of leases temporarily allocated + // on DISCOVER. When zero (the default), leases are not allocated on DISCOVER. + "offer-lifetime" : 65 }, { // Default value of the class-specific bootfile name. An empty name @@ -110,6 +117,13 @@ // Parameters for triggering behaviors compatible with broken or // non-compliant clients, relays, or other agents "compatibility": { + // Ignore DHCP Server Identifier option if set to true. + // Enabling this will cause Kea to accept any query, even + // if the address in the option belongs to another server, + // instead of dropping it. This config option defaults to + // false, as enabling it breaks RFC compliance. + "ignore-dhcp-server-identifier": false, + // Ignore Relay Agent Information Link Selection suboption if set // to true. Enabling this will cause Kea to use normal subnet // selection logic instead of attempting to use the subnet @@ -119,7 +133,13 @@ // Parse options more leniently where fields can be deduced // deterministically, even if against RFC or common practice. - "lenient-option-parsing": true + "lenient-option-parsing": true, + + // Boolean flag indicating whether .0 and .255 addresses + // must be considered as never free in subnets with a prefix length + // of 24 or less. The default is false, as these addresses are not + // special; only the first and the last addresses are. + "exclude-first-last-24": false }, // Command control socket configuration parameters for the Kea DHCPv4 server. @@ -193,6 +213,10 @@ // It may be specified at the global, shared-network, and subnet levels. "ddns-use-conflict-resolution": true, + // When greater than 0.0, it is the percent of the lease's lifetime + // to use for the DNS TTL. + "ddns-ttl-percent": 0.75, + // Time in seconds specifying how long a declined lease should be // excluded from DHCP assignments. The default value is 86400 (24 hours). "decline-probation-period": 86400, @@ -350,7 +374,30 @@ "key-file": "my-key", // Cipher list (see the OpenSSL ciphers command manual). - "cipher-list": "AES" + "cipher-list": "AES", + + // Connection reconnect wait time. + // This parameter governs how long Kea waits before attempting + // to reconnect. Expressed in milliseconds. The default is 0 + // (disabled) for MySQL and PostgreSQL. + "reconnect-wait-time": 3000, + + // Connection maximum reconnect tries. + "max-reconnect-tries": 3, + + // Action to take when connection recovery fails. + // Supported values: stop-retry-exit, serve-retry-exit, + // serve-retry-continue + "on-fail": "stop-retry-exit", + + // Connection connect timeout in seconds. + "connect-timeout": 100, + + // Timeout of database read operations in seconds. + "read-timeout": 120, + + // Timeout of database write operations in seconds. + "write-timeout": 180 }, { // Name of the database to connect to. @@ -371,22 +418,9 @@ // Username to be used to access the database. "user": "keatest", - // Connection reconnect wait time. - // This parameter governs how long Kea waits before attempting - // to reconnect. Expressed in milliseconds. The default is 0 - // (disabled) for MySQL and PostgreSQL. - "reconnect-wait-time": 3000, - - // Connection maximum reconnect tries. - "max-reconnect-tries": 3, - - // Action to take when connection recovery fails. - // Supported values: stop-retry-exit, serve-retry-exit, - // serve-retry-continue - "on-fail": "stop-retry-exit", - - // Connection connect timeout in seconds. - "connect-timeout": 100 + // TCP user timeout while communicating with the database. + // It is specified in seconds. + "tcp-user-timeout": 100 } ], @@ -681,6 +715,10 @@ // networks group subnets together. "shared-networks": [ { + // A flag selecting an IP address allocation strategy for all + // subnets in this shared network. + "allocator": "random", + // Shared-network level authoritative flag. "authoritative": false, @@ -716,6 +754,9 @@ // Shared-network level value. See description at the global level. "ddns-use-conflict-resolution": true, + // Shared-network level value. See description at the global level. + "ddns-ttl-percent": 0.65, + // Shared-network level value. See description at the global level. "hostname-char-replacement": "x", @@ -737,6 +778,10 @@ // to be sent in 'siaddr'. "next-server": "192.0.2.123", + // If greater than zero, it is the lifetime of leases temporarily allocated + // on DISCOVER. When zero (the default), leases are not allocated on DISCOVER. + "offer-lifetime" : 60, + // List of shared network-specific DHCP options. "option-data": [], @@ -812,6 +857,10 @@ // Prefix matched against source address. See RFC7341. "4o6-subnet": "2001:db8:1:1::/64", + // A flag selecting an IP address allocation strategy for + // the subnet. + "allocator": "iterative", + // Subnet-level authoritative flag. "authoritative": false, @@ -847,6 +896,9 @@ // Subnet-level value. See description at the global level. "ddns-use-conflict-resolution": true, + // Subnet-level value. See description at the global level. + "ddns-ttl-percent": 0.55, + // Subnet-level value. See description at the global level. "hostname-char-replacement": "x", @@ -868,6 +920,10 @@ // in 'siaddr'. "next-server": "0.0.0.0", + // If greater than zero, it is the lifetime of leases temporarily allocated + // on DISCOVER. When zero (the default), leases are not allocated on DISCOVER. + "offer-lifetime" : 60, + // Turn on storage of extended information (e.g. relay agent // information) with each lease for this subnet. "store-extended-info": true, @@ -940,8 +996,7 @@ // Subnet-level value of the rebind timer. "rebind-timer": 40, - // List of IPv4 relay addresses for which this subnet is - // selected. + // List of IPv4 relay addresses for which this subnet is selected. "relay": { "ip-addresses": [ "192.168.56.1" @@ -1035,10 +1090,10 @@ // Shared-network level (default) valid lifetime. "valid-lifetime": 6001, - // Subnet-level min valid lifetime. + // Shared-network level min valid lifetime. "min-valid-lifetime": 4001, - // Subnet-level max valid lifetime. + // Shared-network level max valid lifetime. "max-valid-lifetime": 8001 } ], @@ -1172,6 +1227,10 @@ } ], + // If greater than zero, it is the lifetime of leases temporarily allocated + // on DISCOVER. When zero (the default), leases are not allocated on DISCOVER. + "offer-lifetime" : 60, + // Look at advanced examples for the use of user-contexts. "user-context": { } } diff --git a/doc/examples/kea4/all-keys.json b/doc/examples/kea4/all-keys.json index 673856e45d..6016eb46e0 100644 --- a/doc/examples/kea4/all-keys.json +++ b/doc/examples/kea4/all-keys.json @@ -137,7 +137,7 @@ // Boolean flag indicating whether .0 and .255 addresses // must be considered as never free in subnets with a prefix length - // less than 24. The default is false, as these addresses are not + // of 24 or less. The default is false, as these addresses are not // special; only the first and the last addresses are. "exclude-first-last-24": false }, @@ -374,46 +374,7 @@ "key-file": "my-key", // Cipher list (see the OpenSSL ciphers command manual). - "cipher-list": "AES" - }, - { - // Name of the database to connect to. - "name": "keatest", - - // Host on which the database resides. - "host": "localhost", - - // Database password. - "password": "keatest", - - // Port on which the database is available. - "port": 5432, - - // Type of database, e.g. "mysql", "postgresql". - "type": "postgresql", - - // Username to be used to access the database. - "user": "keatest", - - // TCP user timeout while communicating with the database. - // It is specified in seconds. - "tcp-user-timeout": 100 - }, - { - // Name of the database to connect to. - "name": "keatest", - - // Database password. - "password": "keatest", - - // Port on which the database is available. - "port": 9042, - - // Type of database, e.g. "mysql", "postgresql". - "type": "mysql", - - // Username to be used to access the database. - "user": "keatest", + "cipher-list": "AES", // Connection reconnect wait time. // This parameter governs how long Kea waits before attempting @@ -437,6 +398,29 @@ // Timeout of database write operations in seconds. "write-timeout": 180 + }, + { + // Name of the database to connect to. + "name": "keatest", + + // Host on which the database resides. + "host": "localhost", + + // Database password. + "password": "keatest", + + // Port on which the database is available. + "port": 5432, + + // Type of database, e.g. "mysql", "postgresql". + "type": "postgresql", + + // Username to be used to access the database. + "user": "keatest", + + // TCP user timeout while communicating with the database. + // It is specified in seconds. + "tcp-user-timeout": 100 } ], diff --git a/doc/examples/kea6/all-keys-netconf.json b/doc/examples/kea6/all-keys-netconf.json index 8afab64409..04004697e8 100644 --- a/doc/examples/kea6/all-keys-netconf.json +++ b/doc/examples/kea6/all-keys-netconf.json @@ -11,6 +11,14 @@ { // Kea DHCPv6 server configuration begins here. "Dhcp6": { + // Global flag selecting an IP address allocation strategy for all + // subnets. + "allocator": "iterative", + + // Global flag selecting a delegated prefix allocation strategy + // for all subnets. + "pd-allocator": "random", + // Ordered list of client classes used by the DHCPv6 server. "client-classes": [ { @@ -156,6 +164,10 @@ // It may be specified at the global, shared-network, and subnet levels. "ddns-use-conflict-resolution": true, + // When greater than 0.0, it is the percent of the lease's lifetime + // to use for the DNS TTL. + "ddns-ttl-percent": 0.75, + // Time in seconds specifying how long a declined lease should be // excluded from DHCP assignments. The default value is 24 hours. "decline-probation-period": 86400, @@ -304,7 +316,30 @@ "key-file": "my-key", // Cipher list (see the OpenSSL ciphers command manual). - "cipher-list": "AES" + "cipher-list": "AES", + + // Connection reconnect wait time. + // This parameter governs how long Kea waits before attempting + // to reconnect. Expressed in milliseconds. The default is 0 + // (disabled) for MySQL and PostgreSQL. + "reconnect-wait-time": 3000, + + // Connection maximum reconnect tries. + "max-reconnect-tries": 3, + + // Action to take when connection recovery fails. + // Supported values: stop-retry-exit, serve-retry-exit, + // serve-retry-continue + "on-fail": "stop-retry-exit", + + // Connection connect timeout in seconds. + "connect-timeout": 100, + + // Timeout of database read operations in seconds. + "read-timeout": 120, + + // Timeout of database write operations in seconds. + "write-timeout": 180 }, { // Name of the database to connect to. @@ -325,22 +360,9 @@ // Username to be used to access the database. "user": "keatest", - // Connection reconnect wait time. - // This parameter governs how long Kea waits before attempting - // to reconnect. Expressed in milliseconds. The default is 0 - // (disabled) for MySQL and PostgreSQL. - "reconnect-wait-time": 3000, - - // Connection maximum reconnect tries. - "max-reconnect-tries": 3, - - // Action to take when connection recovery fails. - // Supported values: stop-retry-exit, serve-retry-exit, - // serve-retry-continue - "on-fail": "stop-retry-exit", - - // Connection connect timeout in seconds. - "connect-timeout": 100 + // TCP user timeout while communicating with the database. + // It is specified in seconds. + "tcp-user-timeout": 100 } ], @@ -638,6 +660,14 @@ // networks group subnets together. "shared-networks": [ { + // A flag selecting an IP address allocation strategy for all + // subnets in this shared network. + "allocator": "random", + + // A flag selecting a delegated prefix allocation strategy for + // all subnets in this shared network. + "pd-allocator": "iterative", + // Restricts this shared network to allow only clients // that belong to a particular client class. If an // empty string is provided, no restriction is applied. @@ -667,6 +697,9 @@ // Shared-network level value. See description at the global level. "ddns-use-conflict-resolution": true, + // Shared-network level value. See description at the global level. + "ddns-ttl-percent": 0.65, + // Shared-network level value. See description at the global level. "hostname-char-replacement": "x", @@ -761,6 +794,14 @@ // List of IPv6 subnets belonging to this shared network. "subnet6": [ { + // A flag selecting an IP address allocation strategy for + // the subnet. + "allocator": "iterative", + + // A flag selecting a delegated prefix allocation strategy + // for the subnet. + "pd-allocator": "iterative", + // Restricts this subnet to allow only clients that belong // to a particular client class. If an empty string is // provided, no restriction is applied. @@ -790,6 +831,9 @@ // Subnet-level value. See description at the global level. "ddns-use-conflict-resolution": true, + // Subnet-level value. See description at the global level. + "ddns-ttl-percent": 0.55, + // Subnet-level value. See description at the global level. "hostname-char-replacement": "x", @@ -875,6 +919,7 @@ } ], + // List of IP address pools belonging to the subnet. "pools": [ { // Restricts this pool to only be used for client @@ -922,11 +967,10 @@ // the Reply message (See DHCPv6 rapid commit). "rapid-commit": false, - // Subnet-level rebind timer. + // Subnet-level value of the rebind timer. "rebind-timer": 40, - // List of IPv4 relay addresses for which this subnet - // is selected. + // List of IPv6 relay addresses for which this subnet is selected. "relay": { "ip-addresses": [ "2001:db8:0:f::1" diff --git a/doc/examples/kea6/all-keys.json b/doc/examples/kea6/all-keys.json index 8e1ecc3964..b380b720fb 100644 --- a/doc/examples/kea6/all-keys.json +++ b/doc/examples/kea6/all-keys.json @@ -316,46 +316,7 @@ "key-file": "my-key", // Cipher list (see the OpenSSL ciphers command manual). - "cipher-list": "AES" - }, - { - // Name of the database to connect to. - "name": "keatest", - - // Host on which the database resides. - "host": "localhost", - - // Database password. - "password": "keatest", - - // Port on which the database is available. - "port": 5432, - - // Type of database, e.g. "mysql", "postgresql". - "type": "postgresql", - - // Username to be used to access the database. - "user": "keatest", - - // TCP user timeout while communicating with the database. - // It is specified in seconds. - "tcp-user-timeout": 100 - }, - { - // Name of the database to connect to. - "name": "keatest", - - // Database password. - "password": "keatest", - - // Port on which the database is available. - "port": 9042, - - // Type of database, e.g. "mysql", "postgresql". - "type": "mysql", - - // Username to be used to access the database. - "user": "keatest", + "cipher-list": "AES", // Connection reconnect wait time. // This parameter governs how long Kea waits before attempting @@ -379,6 +340,29 @@ // Timeout of database write operations in seconds. "write-timeout": 180 + }, + { + // Name of the database to connect to. + "name": "keatest", + + // Host on which the database resides. + "host": "localhost", + + // Database password. + "password": "keatest", + + // Port on which the database is available. + "port": 5432, + + // Type of database, e.g. "mysql", "postgresql". + "type": "postgresql", + + // Username to be used to access the database. + "user": "keatest", + + // TCP user timeout while communicating with the database. + // It is specified in seconds. + "tcp-user-timeout": 100 } ], diff --git a/src/lib/yang/translator_class.cc b/src/lib/yang/translator_class.cc index 7d3ec40189..eff8da89b4 100644 --- a/src/lib/yang/translator_class.cc +++ b/src/lib/yang/translator_class.cc @@ -75,6 +75,7 @@ TranslatorClass::getClassKea(DataNode const& data_node) { if (model_ == KEA_DHCP4_SERVER) { checkAndGetLeaf(result, data_node, "boot-file-name"); checkAndGetLeaf(result, data_node, "next-server"); + checkAndGetLeaf(result, data_node, "offer-lifetime"); checkAndGetLeaf(result, data_node, "server-hostname"); ConstElementPtr defs = getOptionDefList(data_node); @@ -127,6 +128,7 @@ TranslatorClass::setClassKea(string const& xpath, ConstElementPtr elem) { if (model_ == KEA_DHCP4_SERVER) { checkAndSetLeaf(elem, xpath, "boot-file-name", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "next-server", LeafBaseType::String); + checkAndSetLeaf(elem, xpath, "offer-lifetime", LeafBaseType::Uint32); checkAndSetLeaf(elem, xpath, "server-hostname", LeafBaseType::String); ConstElementPtr defs = elem->get("option-def"); diff --git a/src/lib/yang/translator_config.cc b/src/lib/yang/translator_config.cc index 13a29d82bf..c560b526b7 100644 --- a/src/lib/yang/translator_config.cc +++ b/src/lib/yang/translator_config.cc @@ -187,6 +187,8 @@ ElementPtr TranslatorConfig::getServerKeaDhcpCommon(DataNode const& data_node) { ElementPtr result = Element::createMap(); + checkAndGetLeaf(result, data_node, "allocator"); + checkAndGetLeaf(result, data_node, "cache-max-age"); checkAndGetLeaf(result, data_node, "cache-max-age"); checkAndGetLeaf(result, data_node, "cache-threshold"); checkAndGetLeaf(result, data_node, "calculate-tee-times"); @@ -197,6 +199,7 @@ TranslatorConfig::getServerKeaDhcpCommon(DataNode const& data_node) { checkAndGetLeaf(result, data_node, "ddns-qualifying-suffix"); checkAndGetLeaf(result, data_node, "ddns-replace-client-name"); checkAndGetLeaf(result, data_node, "ddns-send-updates"); + checkAndGetLeaf(result, data_node, "ddns-ttl-percent"); checkAndGetLeaf(result, data_node, "ddns-update-on-renew"); checkAndGetLeaf(result, data_node, "ddns-use-conflict-resolution"); checkAndGetLeaf(result, data_node, "decline-probation-period"); @@ -234,6 +237,8 @@ TranslatorConfig::getServerKeaDhcpCommon(DataNode const& data_node) { checkAndGet(result, data_node, "compatibility", [&](DataNode const& node) -> ElementPtr const { ElementPtr compatibility(Element::createMap()); + checkAndGetLeaf(compatibility, node, "exclude-first-last-24"); + checkAndGetLeaf(compatibility, node, "ignore-dhcp-server-identifier"); checkAndGetLeaf(compatibility, node, "ignore-rai-link-selection"); checkAndGetLeaf(compatibility, node, "lenient-option-parsing"); return compatibility; @@ -337,6 +342,7 @@ TranslatorConfig::getServerKeaDhcp4() { checkAndGetLeaf(result, config, "echo-client-id"); checkAndGetLeaf(result, config, "match-client-id"); checkAndGetLeaf(result, config, "next-server"); + checkAndGetLeaf(result, config, "offer-lifetime"); checkAndGetLeaf(result, config, "server-hostname"); // Handle interfaces. @@ -371,6 +377,7 @@ TranslatorConfig::getServerKeaDhcp6() { checkAndGetLeaf(result, config, "mac-sources"); checkAndGetLeaf(result, config, "max-preferred-lifetime"); checkAndGetLeaf(result, config, "min-preferred-lifetime"); + checkAndGetLeaf(result, config, "pd-allocator"); checkAndGetLeaf(result, config, "preferred-lifetime"); checkAndGetLeaf(result, config, "relay-supplied-options"); @@ -486,6 +493,7 @@ TranslatorConfig::setConfigKea6(ConstElementPtr elem) { void TranslatorConfig::setServerKeaDhcpCommon(string const& xpath, ConstElementPtr elem) { + checkAndSetLeaf(elem, xpath, "allocator", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "cache-max-age", LeafBaseType::Uint32); checkAndSetLeaf(elem, xpath, "cache-threshold", LeafBaseType::Dec64); checkAndSetLeaf(elem, xpath, "calculate-tee-times", LeafBaseType::Bool); @@ -495,6 +503,7 @@ TranslatorConfig::setServerKeaDhcpCommon(string const& xpath, checkAndSetLeaf(elem, xpath, "ddns-qualifying-suffix", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "ddns-replace-client-name", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "ddns-send-updates", LeafBaseType::Bool); + checkAndSetLeaf(elem, xpath, "ddns-ttl-percent", LeafBaseType::Dec64); checkAndSetLeaf(elem, xpath, "ddns-update-on-renew", LeafBaseType::Bool); checkAndSetLeaf(elem, xpath, "ddns-use-conflict-resolution", LeafBaseType::Bool); checkAndSetLeaf(elem, xpath, "dhcp4o6-port", LeafBaseType::Uint16); @@ -661,8 +670,15 @@ TranslatorConfig::setServerKeaDhcp4(ConstElementPtr elem) { checkAndSetLeaf(elem, xpath, "echo-client-id", LeafBaseType::Bool); checkAndSetLeaf(elem, xpath, "match-client-id", LeafBaseType::Bool); checkAndSetLeaf(elem, xpath, "next-server", LeafBaseType::String); + checkAndSetLeaf(elem, xpath, "offer-lifetime", LeafBaseType::Uint32); checkAndSetLeaf(elem, xpath, "server-hostname", LeafBaseType::String); + ConstElementPtr compatibility(elem->get("compatibility")); + if (compatibility) { + checkAndSetLeaf(compatibility, xpath + "/compatibility", "exclude-first-last-24", LeafBaseType::Bool); + checkAndSetLeaf(compatibility, xpath + "/compatibility", "ignore-dhcp-server-identifier", LeafBaseType::Bool); + } + ConstElementPtr if_config = elem->get("interfaces-config"); if (if_config) { string const if_cfg_xpath(xpath + "/interfaces-config"); @@ -691,6 +707,7 @@ TranslatorConfig::setServerKeaDhcp6(ConstElementPtr elem) { checkAndSetLeaf(elem, xpath, "data-directory", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "max-preferred-lifetime", LeafBaseType::Uint32); checkAndSetLeaf(elem, xpath, "min-preferred-lifetime", LeafBaseType::Uint32); + checkAndSetLeaf(elem, xpath, "pd-allocator", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "preferred-lifetime", LeafBaseType::Uint32); checkAndSetLeafList(elem, xpath, "mac-sources", LeafBaseType::String); diff --git a/src/lib/yang/translator_database.cc b/src/lib/yang/translator_database.cc index 1e6bb6e4cd..e75c47c735 100644 --- a/src/lib/yang/translator_database.cc +++ b/src/lib/yang/translator_database.cc @@ -66,10 +66,13 @@ TranslatorDatabase::getDatabaseKea(DataNode const& data_node) { checkAndGetLeaf(result, data_node, "password"); checkAndGetLeaf(result, data_node, "persist"); checkAndGetLeaf(result, data_node, "port"); + checkAndGetLeaf(result, data_node, "read-timeout"); checkAndGetLeaf(result, data_node, "readonly"); checkAndGetLeaf(result, data_node, "reconnect-wait-time"); + checkAndGetLeaf(result, data_node, "tcp-user-timeout"); checkAndGetLeaf(result, data_node, "trust-anchor"); checkAndGetLeaf(result, data_node, "user"); + checkAndGetLeaf(result, data_node, "write-timeout"); checkAndGetAndJsonifyLeaf(result, data_node, "user-context"); @@ -118,9 +121,12 @@ TranslatorDatabase::setDatabaseKea(string const& xpath, checkAndSetLeaf(elem, xpath, "persist", LeafBaseType::Bool); checkAndSetLeaf(elem, xpath, "port", LeafBaseType::Uint16); checkAndSetLeaf(elem, xpath, "readonly", LeafBaseType::Bool); + checkAndSetLeaf(elem, xpath, "read-timeout", LeafBaseType::Uint32); checkAndSetLeaf(elem, xpath, "reconnect-wait-time", LeafBaseType::Uint32); + checkAndSetLeaf(elem, xpath, "tcp-user-timeout", LeafBaseType::Uint32); checkAndSetLeaf(elem, xpath, "trust-anchor", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "user", LeafBaseType::String); + checkAndSetLeaf(elem, xpath, "write-timeout", LeafBaseType::Uint32); checkAndSetUserContext(elem, xpath); diff --git a/src/lib/yang/translator_shared_network.cc b/src/lib/yang/translator_shared_network.cc index ad5d121ffc..bc1aa284e0 100644 --- a/src/lib/yang/translator_shared_network.cc +++ b/src/lib/yang/translator_shared_network.cc @@ -67,6 +67,7 @@ TranslatorSharedNetwork::getSharedNetworkKea(DataNode const& data_node, getMandatoryLeaf(result, data_node, "name"); + checkAndGetLeaf(result, data_node, "allocator"); checkAndGetLeaf(result, data_node, "cache-max-age"); checkAndGetLeaf(result, data_node, "cache-threshold"); checkAndGetLeaf(result, data_node, "calculate-tee-times"); @@ -77,6 +78,7 @@ TranslatorSharedNetwork::getSharedNetworkKea(DataNode const& data_node, checkAndGetLeaf(result, data_node, "ddns-qualifying-suffix"); checkAndGetLeaf(result, data_node, "ddns-replace-client-name"); checkAndGetLeaf(result, data_node, "ddns-send-updates"); + checkAndGetLeaf(result, data_node, "ddns-ttl-percent"); checkAndGetLeaf(result, data_node, "ddns-update-on-renew"); checkAndGetLeaf(result, data_node, "ddns-use-conflict-resolution"); checkAndGetLeaf(result, data_node, "hostname-char-replacement"); @@ -119,6 +121,7 @@ TranslatorSharedNetwork::getSharedNetworkKea(DataNode const& data_node, checkAndGetLeaf(result, data_node, "interface-id"); checkAndGetLeaf(result, data_node, "max-preferred-lifetime"); checkAndGetLeaf(result, data_node, "min-preferred-lifetime"); + checkAndGetLeaf(result, data_node, "pd-allocator"); checkAndGetLeaf(result, data_node, "preferred-lifetime"); checkAndGetLeaf(result, data_node, "rapid-commit"); } else if (subsel == "subnet4") { @@ -126,6 +129,7 @@ TranslatorSharedNetwork::getSharedNetworkKea(DataNode const& data_node, checkAndGetLeaf(result, data_node, "boot-file-name"); checkAndGetLeaf(result, data_node, "match-client-id"); checkAndGetLeaf(result, data_node, "next-server"); + checkAndGetLeaf(result, data_node, "offer-lifetime"); checkAndGetLeaf(result, data_node, "server-hostname"); } @@ -158,6 +162,7 @@ TranslatorSharedNetwork::setSharedNetworkKea(string const& xpath, string const& subsel) { // Skip key "name". + checkAndSetLeaf(elem, xpath, "allocator", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "cache-max-age", LeafBaseType::Uint32); checkAndSetLeaf(elem, xpath, "cache-threshold", LeafBaseType::Dec64); checkAndSetLeaf(elem, xpath, "calculate-tee-times", LeafBaseType::Bool); @@ -168,6 +173,7 @@ TranslatorSharedNetwork::setSharedNetworkKea(string const& xpath, checkAndSetLeaf(elem, xpath, "ddns-qualifying-suffix", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "ddns-replace-client-name", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "ddns-send-updates", LeafBaseType::Bool); + checkAndSetLeaf(elem, xpath, "ddns-ttl-percent", LeafBaseType::Dec64); checkAndSetLeaf(elem, xpath, "ddns-update-on-renew", LeafBaseType::Bool); checkAndSetLeaf(elem, xpath, "ddns-use-conflict-resolution", LeafBaseType::Bool); checkAndSetLeaf(elem, xpath, "hostname-char-replacement", LeafBaseType::String); @@ -217,6 +223,7 @@ TranslatorSharedNetwork::setSharedNetworkKea(string const& xpath, checkAndSetLeaf(elem, xpath, "interface-id", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "max-preferred-lifetime", LeafBaseType::Uint32); checkAndSetLeaf(elem, xpath, "min-preferred-lifetime", LeafBaseType::Uint32); + checkAndSetLeaf(elem, xpath, "pd-allocator", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "preferred-lifetime", LeafBaseType::Uint32); checkAndSetLeaf(elem, xpath, "rapid-commit", LeafBaseType::Bool); } else { @@ -224,6 +231,7 @@ TranslatorSharedNetwork::setSharedNetworkKea(string const& xpath, checkAndSetLeaf(elem, xpath, "boot-file-name", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "match-client-id", LeafBaseType::Bool); checkAndSetLeaf(elem, xpath, "next-server", LeafBaseType::String); + checkAndSetLeaf(elem, xpath, "offer-lifetime", LeafBaseType::Uint32); checkAndSetLeaf(elem, xpath, "server-hostname", LeafBaseType::String); } } diff --git a/src/lib/yang/translator_subnet.cc b/src/lib/yang/translator_subnet.cc index ae9c0f654f..15a2e6ae96 100644 --- a/src/lib/yang/translator_subnet.cc +++ b/src/lib/yang/translator_subnet.cc @@ -100,6 +100,7 @@ TranslatorSubnet::getSubnetKea(DataNode const& data_node) { getMandatoryLeaf(result, data_node, "id"); getMandatoryLeaf(result, data_node, "subnet"); + checkAndGetLeaf(result, data_node, "allocator"); checkAndGetLeaf(result, data_node, "cache-max-age"); checkAndGetLeaf(result, data_node, "cache-threshold"); checkAndGetLeaf(result, data_node, "calculate-tee-times"); @@ -110,6 +111,7 @@ TranslatorSubnet::getSubnetKea(DataNode const& data_node) { checkAndGetLeaf(result, data_node, "ddns-qualifying-suffix"); checkAndGetLeaf(result, data_node, "ddns-replace-client-name"); checkAndGetLeaf(result, data_node, "ddns-send-updates"); + checkAndGetLeaf(result, data_node, "ddns-ttl-percent"); checkAndGetLeaf(result, data_node, "ddns-update-on-renew"); checkAndGetLeaf(result, data_node, "ddns-use-conflict-resolution"); checkAndGetLeaf(result, data_node, "hostname-char-replacement"); @@ -157,6 +159,7 @@ TranslatorSubnet::getSubnetKea(DataNode const& data_node) { checkAndGetLeaf(result, data_node, "interface-id"); checkAndGetLeaf(result, data_node, "max-preferred-lifetime"); checkAndGetLeaf(result, data_node, "min-preferred-lifetime"); + checkAndGetLeaf(result, data_node, "pd-allocator"); checkAndGetLeaf(result, data_node, "preferred-lifetime"); checkAndGetLeaf(result, data_node, "rapid-commit"); @@ -169,6 +172,7 @@ TranslatorSubnet::getSubnetKea(DataNode const& data_node) { checkAndGetLeaf(result, data_node, "boot-file-name"); checkAndGetLeaf(result, data_node, "match-client-id"); checkAndGetLeaf(result, data_node, "next-server"); + checkAndGetLeaf(result, data_node, "offer-lifetime"); checkAndGetLeaf(result, data_node, "server-hostname"); checkAndGetDivergingLeaf(result, data_node, "4o6-interface", "subnet-4o6-interface"); @@ -240,6 +244,7 @@ TranslatorSubnet::setSubnetKea(string const& xpath, ConstElementPtr elem) { } setItem(xpath + "/subnet", subnet, LeafBaseType::String); + checkAndSetLeaf(elem, xpath, "allocator", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "cache-max-age", LeafBaseType::Uint32); checkAndSetLeaf(elem, xpath, "cache-threshold", LeafBaseType::Dec64); checkAndSetLeaf(elem, xpath, "calculate-tee-times", LeafBaseType::Bool); @@ -250,6 +255,7 @@ TranslatorSubnet::setSubnetKea(string const& xpath, ConstElementPtr elem) { checkAndSetLeaf(elem, xpath, "ddns-qualifying-suffix", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "ddns-replace-client-name", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "ddns-send-updates", LeafBaseType::Bool); + checkAndSetLeaf(elem, xpath, "ddns-ttl-percent", LeafBaseType::Dec64); checkAndSetLeaf(elem, xpath, "ddns-update-on-renew", LeafBaseType::Bool); checkAndSetLeaf(elem, xpath, "ddns-use-conflict-resolution", LeafBaseType::Bool); checkAndSetLeaf(elem, xpath, "hostname-char-replacement", LeafBaseType::String); @@ -299,6 +305,7 @@ TranslatorSubnet::setSubnetKea(string const& xpath, ConstElementPtr elem) { checkAndSetLeaf(elem, xpath, "interface-id", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "max-preferred-lifetime", LeafBaseType::Uint32); checkAndSetLeaf(elem, xpath, "min-preferred-lifetime", LeafBaseType::Uint32); + checkAndSetLeaf(elem, xpath, "pd-allocator", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "preferred-lifetime", LeafBaseType::Uint32); checkAndSetLeaf(elem, xpath, "rapid-commit", LeafBaseType::Bool); @@ -311,6 +318,7 @@ TranslatorSubnet::setSubnetKea(string const& xpath, ConstElementPtr elem) { checkAndSetLeaf(elem, xpath, "boot-file-name", LeafBaseType::String); checkAndSetLeaf(elem, xpath, "match-client-id", LeafBaseType::Bool); checkAndSetLeaf(elem, xpath, "next-server", LeafBaseType::String); + checkAndSetLeaf(elem, xpath, "offer-lifetime", LeafBaseType::Uint32); checkAndSetLeaf(elem, xpath, "server-hostname", LeafBaseType::String); checkAndSetDivergingLeaf(elem, xpath, "4o6-interface", "subnet-4o6-interface", LeafBaseType::String); diff --git a/src/lib/yang/yang_revisions.h b/src/lib/yang/yang_revisions.h index 36fd06ce3c..ebd9c5a1c5 100644 --- a/src/lib/yang/yang_revisions.h +++ b/src/lib/yang/yang_revisions.h @@ -22,9 +22,9 @@ static const std::unordered_map YANG_REVISIONS = { { "ietf-dhcpv6-options", "2018-09-04" }, { "ietf-dhcpv6-server", "2018-09-04" }, { "kea-types", "2019-08-12" }, - { "kea-dhcp-types", "2022-12-27" }, - { "kea-dhcp4-server", "2022-12-27" }, - { "kea-dhcp6-server", "2022-12-27" }, + { "kea-dhcp-types", "2023-05-31" }, + { "kea-dhcp4-server", "2023-05-31" }, + { "kea-dhcp6-server", "2023-05-31" }, { "kea-ctrl-agent", "2019-08-12" }, { "kea-dhcp-ddns", "2022-07-27" } }; // YANG_REVISIONS diff --git a/src/share/yang/modules/Makefile.am b/src/share/yang/modules/Makefile.am index dd8737fa62..6b6cc0f930 100644 --- a/src/share/yang/modules/Makefile.am +++ b/src/share/yang/modules/Makefile.am @@ -13,9 +13,9 @@ yangmodules_list += ietf-inet-types@2013-07-15.yang yangmodules_list += ietf-yang-types@2013-07-15.yang yangmodules_list += kea-ctrl-agent@2019-08-12.yang yangmodules_list += kea-dhcp-ddns@2022-07-27.yang -yangmodules_list += kea-dhcp-types@2022-12-27.yang -yangmodules_list += kea-dhcp4-server@2022-12-27.yang -yangmodules_list += kea-dhcp6-server@2022-12-27.yang +yangmodules_list += kea-dhcp-types@2023-05-31.yang +yangmodules_list += kea-dhcp4-server@2023-05-31.yang +yangmodules_list += kea-dhcp6-server@2023-05-31.yang yangmodules_list += kea-types@2019-08-12.yang yangmodules_list += keatest-module@2022-11-30.yang diff --git a/src/share/yang/modules/hashes/kea-dhcp-types@2022-12-27.hash b/src/share/yang/modules/hashes/kea-dhcp-types@2022-12-27.hash deleted file mode 100644 index f3be9ece1c..0000000000 --- a/src/share/yang/modules/hashes/kea-dhcp-types@2022-12-27.hash +++ /dev/null @@ -1 +0,0 @@ -c7c3d49249be8027851050a5a11e888053253e4ef3863d9acd125062160e7190 diff --git a/src/share/yang/modules/hashes/kea-dhcp-types@2023-05-31.hash b/src/share/yang/modules/hashes/kea-dhcp-types@2023-05-31.hash new file mode 100644 index 0000000000..40d750d86a --- /dev/null +++ b/src/share/yang/modules/hashes/kea-dhcp-types@2023-05-31.hash @@ -0,0 +1 @@ +6dc9841ffdbd2b6af5c3d3fc5b065faf5da5fb2a6e4aa353bd354a912c1a8ff2 diff --git a/src/share/yang/modules/hashes/kea-dhcp4-server@2022-12-27.hash b/src/share/yang/modules/hashes/kea-dhcp4-server@2022-12-27.hash deleted file mode 100644 index 24abe8955c..0000000000 --- a/src/share/yang/modules/hashes/kea-dhcp4-server@2022-12-27.hash +++ /dev/null @@ -1 +0,0 @@ -2bef760a61ec2054c0398c75e31fb20208620d2bf7353cdf3c33fbebca32becb diff --git a/src/share/yang/modules/hashes/kea-dhcp4-server@2023-05-31.hash b/src/share/yang/modules/hashes/kea-dhcp4-server@2023-05-31.hash new file mode 100644 index 0000000000..6f52b83496 --- /dev/null +++ b/src/share/yang/modules/hashes/kea-dhcp4-server@2023-05-31.hash @@ -0,0 +1 @@ +1ca854318d678439af345dec3bc76a784fdc7a07ccb632e17819a4e32183b577 diff --git a/src/share/yang/modules/hashes/kea-dhcp6-server@2022-12-27.hash b/src/share/yang/modules/hashes/kea-dhcp6-server@2022-12-27.hash deleted file mode 100644 index 800bfc7120..0000000000 --- a/src/share/yang/modules/hashes/kea-dhcp6-server@2022-12-27.hash +++ /dev/null @@ -1 +0,0 @@ -25e02b2d4347dd95b58b8f397d3d506bf94483a3b2d85a90eb062aa1e52e3a5a diff --git a/src/share/yang/modules/hashes/kea-dhcp6-server@2023-05-31.hash b/src/share/yang/modules/hashes/kea-dhcp6-server@2023-05-31.hash new file mode 100644 index 0000000000..d50d36d8fe --- /dev/null +++ b/src/share/yang/modules/hashes/kea-dhcp6-server@2023-05-31.hash @@ -0,0 +1 @@ +a0d0f5874e8d57775b6b813d448aacf8c0b9eb8056160ecd79f5b597fe80dcf3 diff --git a/src/share/yang/modules/kea-dhcp-types@2022-12-27.yang b/src/share/yang/modules/kea-dhcp-types@2023-05-31.yang similarity index 92% rename from src/share/yang/modules/kea-dhcp-types@2022-12-27.yang rename to src/share/yang/modules/kea-dhcp-types@2023-05-31.yang index d46ac0e8cf..2daca51164 100644 --- a/src/share/yang/modules/kea-dhcp-types@2022-12-27.yang +++ b/src/share/yang/modules/kea-dhcp-types@2023-05-31.yang @@ -16,6 +16,13 @@ module kea-dhcp-types { description "This file defines some commonly used Kea DHCP types and groupings."; + revision 2023-05-31 { + description "Added allocator, ddns-ttl-percent, exclude-first-last-24, + ignore-dhcp-server-identifier, offer-lifetime, pd-allocator, + read-timeout, tcp-user-timeout, write-timeout. + Removed contact-points, keyspace."; + } + revision 2022-12-27 { description "Added never-send."; } @@ -257,15 +264,15 @@ module kea-dhcp-types { units "milliseconds"; description "Database connection timeout."; } - leaf contact-points { - type string; - description "Cassandra database contact points, a coma separated list of - IP addresses."; + leaf read-timeout { + type uint32; + units "seconds"; + description "timeout for database read operations"; } - leaf keyspace { - type string; - description "Cassandra database keyspace (this is Cassandra's equivalent - of a database name)."; + leaf write-timeout { + type uint32; + units "seconds"; + description "timeout for database write operations"; } leaf max-reconnect-tries { type uint32; @@ -290,6 +297,11 @@ module kea-dhcp-types { type boolean; description "TCP nodelay for the database connection."; } + leaf tcp-user-timeout { + type uint32; + units "seconds"; + description "TCP user timeout while communicating with the database"; + } leaf consistency { type string; description "Consistency level."; @@ -997,21 +1009,35 @@ module kea-dhcp-types { } } - grouping compatibility { - container compatibility { + grouping common-compatibility { + description + "parameters that are common to DHCPv4 and DHCPv6 for triggering behaviors compatible + with broken or non-compliant clients, relays or other agents"; + leaf ignore-rai-link-selection { + type boolean; description - "parameters for triggering behaviors compatible with broken or - non-compliant clients, relays or other agents"; - leaf ignore-rai-link-selection { - type boolean; - description - "Ignore the link selection RAI suboption."; - } - leaf lenient-option-parsing { - type boolean; - description - "Enable more lenient option parsing."; - } + "Ignore the link selection RAI suboption."; + } + leaf lenient-option-parsing { + type boolean; + description + "Enable more lenient option parsing."; + } + } + + grouping v4-compatibility { + description + "DHCPv4-specific parameters for triggering behaviors compatible + with broken or non-compliant clients, relays or other agents"; + leaf exclude-first-last-24 { + type boolean; + description + "Whether .0 and .255 addresses should be excluded from allocation in subnets with a prefix length of 24 or less."; + } + leaf ignore-dhcp-server-identifier { + type boolean; + description + "Whether the DHCP Server Identifier should be ignored in ingress packets."; } } @@ -1064,6 +1090,17 @@ module kea-dhcp-types { } } + grouping ddns-ttl-percent { + leaf ddns-ttl-percent { + type decimal64 { + fraction-digits 18; + range "0 .. 1"; + } + description + "the percentage of the leases's lifetime to use for the DNS TTL"; + } + } + grouping ddns-update-on-renew { leaf ddns-update-on-renew { type boolean; @@ -1178,4 +1215,28 @@ module kea-dhcp-types { "the maximum number of samples which are kept"; } } + + grouping allocator { + leaf allocator { + type string; + description + "the allocation strategy for IP addresses"; + } + } + + grouping pd-allocator { + leaf pd-allocator { + type string; + description + "the allocation strategy for delegted prefixes"; + } + } + + grouping offer-lifetime { + leaf offer-lifetime { + type uint32; + description + "the lifetime of leases temporarily allocated on DISCOVER"; + } + } } diff --git a/src/share/yang/modules/kea-dhcp4-server@2022-12-27.yang b/src/share/yang/modules/kea-dhcp4-server@2023-05-31.yang similarity index 96% rename from src/share/yang/modules/kea-dhcp4-server@2022-12-27.yang rename to src/share/yang/modules/kea-dhcp4-server@2023-05-31.yang index 95a850b098..3f53d3cb4c 100644 --- a/src/share/yang/modules/kea-dhcp4-server@2022-12-27.yang +++ b/src/share/yang/modules/kea-dhcp4-server@2023-05-31.yang @@ -12,7 +12,7 @@ module kea-dhcp4-server { } import kea-dhcp-types { prefix dhcp; - revision-date 2022-12-27; + revision-date 2023-05-31; } organization "Internet Systems Consortium"; @@ -20,6 +20,13 @@ 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 2023-05-31 { + description "Added allocator, ddns-ttl-percent, exclude-first-last-24, + ignore-dhcp-server-identifier, offer-lifetime, + read-timeout, tcp-user-timeout, write-timeout. + Removed contact-points, keyspace."; + } + revision 2022-12-27 { description "Added never-send to option-data."; } @@ -177,6 +184,8 @@ module kea-dhcp4-server { key id; ordered-by user; description "List of IPv4 subnets."; + uses dhcp:allocator; + uses dhcp:offer-lifetime; uses dhcp:valid-lifetime; uses dhcp:min-valid-lifetime; uses dhcp:max-valid-lifetime; @@ -254,6 +263,7 @@ module kea-dhcp4-server { uses dhcp:ddns-qualifying-suffix; uses dhcp:ddns-replace-client-name; uses dhcp:ddns-send-updates; + uses dhcp:ddns-ttl-percent; uses dhcp:ddns-update-on-renew; uses dhcp:ddns-use-conflict-resolution; uses dhcp:hostname-char-replacement; @@ -276,6 +286,7 @@ module kea-dhcp4-server { uses dhcp:class-test; uses dhcp:template-test; uses dhcp:class-only-if-required; + uses dhcp:offer-lifetime; uses option-def-list; uses option-data-list; uses next-server; @@ -344,6 +355,8 @@ module kea-dhcp4-server { // config true; description "Contains DHCPv4 server configuration."; + uses dhcp:allocator; + uses dhcp:offer-lifetime; uses dhcp:valid-lifetime; uses dhcp:min-valid-lifetime; uses dhcp:max-valid-lifetime; @@ -360,6 +373,8 @@ module kea-dhcp4-server { description "List of IPv4 shared networks."; uses dhcp:network-name; uses subnet4-list; + uses dhcp:allocator; + uses dhcp:offer-lifetime; uses dhcp:network-interface; uses dhcp:renew-timer; uses dhcp:rebind-timer; @@ -390,6 +405,7 @@ module kea-dhcp4-server { uses dhcp:ddns-qualifying-suffix; uses dhcp:ddns-replace-client-name; uses dhcp:ddns-send-updates; + uses dhcp:ddns-ttl-percent; uses dhcp:ddns-update-on-renew; uses dhcp:ddns-use-conflict-resolution; uses dhcp:hostname-char-replacement; @@ -487,13 +503,17 @@ module kea-dhcp4-server { uses kea:loggers; uses dhcp:cache-max-age; uses dhcp:cache-threshold; - uses dhcp:compatibility; + container compatibility { + uses dhcp:common-compatibility; + uses dhcp:v4-compatibility; + } uses dhcp:ddns-generated-prefix; uses dhcp:ddns-override-client-update; uses dhcp:ddns-override-no-update; uses dhcp:ddns-qualifying-suffix; uses dhcp:ddns-replace-client-name; uses dhcp:ddns-send-updates; + uses dhcp:ddns-ttl-percent; uses dhcp:ddns-update-on-renew; uses dhcp:ddns-use-conflict-resolution; uses dhcp:ip-reservations-unique; diff --git a/src/share/yang/modules/kea-dhcp6-server@2022-12-27.yang b/src/share/yang/modules/kea-dhcp6-server@2023-05-31.yang similarity index 97% rename from src/share/yang/modules/kea-dhcp6-server@2022-12-27.yang rename to src/share/yang/modules/kea-dhcp6-server@2023-05-31.yang index 20f38ee489..b1d1363991 100644 --- a/src/share/yang/modules/kea-dhcp6-server@2022-12-27.yang +++ b/src/share/yang/modules/kea-dhcp6-server@2023-05-31.yang @@ -12,7 +12,7 @@ module kea-dhcp6-server { } import kea-dhcp-types { prefix dhcp; - revision-date 2022-12-27; + revision-date 2023-05-31; } organization "Internet Systems Consortium"; @@ -20,6 +20,12 @@ 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 2023-05-31 { + description "Added allocator, ddns-ttl-percent, offer-lifetime, + pd-allocator, read-timeout, tcp-user-timeout, write-timeout. + Removed contact-points, keyspace."; + } + revision 2022-12-27 { description "Added never-send to option-data."; } @@ -180,6 +186,8 @@ module kea-dhcp6-server { key id; ordered-by user; description "List of IPv6 subnets."; + uses dhcp:allocator; + uses dhcp:pd-allocator; uses preferred-lifetime; uses min-preferred-lifetime; uses max-preferred-lifetime; @@ -289,6 +297,7 @@ module kea-dhcp6-server { uses dhcp:ddns-qualifying-suffix; uses dhcp:ddns-replace-client-name; uses dhcp:ddns-send-updates; + uses dhcp:ddns-ttl-percent; uses dhcp:ddns-update-on-renew; uses dhcp:ddns-use-conflict-resolution; uses dhcp:hostname-char-replacement; @@ -378,6 +387,8 @@ module kea-dhcp6-server { // config true; description "Contains DHCPv6 server configuration."; + uses dhcp:allocator; + uses dhcp:pd-allocator; uses data-directory; uses preferred-lifetime; uses min-preferred-lifetime; @@ -397,6 +408,8 @@ module kea-dhcp6-server { key name; uses dhcp:network-name; description "List of IPv4 shared networks."; + uses dhcp:allocator; + uses dhcp:pd-allocator; uses subnet6-list; uses dhcp:network-interface; uses interface-id { @@ -436,6 +449,7 @@ module kea-dhcp6-server { uses dhcp:ddns-qualifying-suffix; uses dhcp:ddns-replace-client-name; uses dhcp:ddns-send-updates; + uses dhcp:ddns-ttl-percent; uses dhcp:ddns-update-on-renew; uses dhcp:ddns-use-conflict-resolution; uses dhcp:hostname-char-replacement; @@ -551,13 +565,16 @@ module kea-dhcp6-server { uses kea:loggers; uses dhcp:cache-max-age; uses dhcp:cache-threshold; - uses dhcp:compatibility; + container compatibility { + uses dhcp:common-compatibility; + } uses dhcp:ddns-generated-prefix; uses dhcp:ddns-override-client-update; uses dhcp:ddns-override-no-update; uses dhcp:ddns-qualifying-suffix; uses dhcp:ddns-replace-client-name; uses dhcp:ddns-send-updates; + uses dhcp:ddns-ttl-percent; uses dhcp:ddns-update-on-renew; uses dhcp:ddns-use-conflict-resolution; uses dhcp:ip-reservations-unique; diff --git a/src/share/yang/modules/utils/bump-up-revisions.sh b/src/share/yang/modules/utils/bump-up-revisions.sh new file mode 100755 index 0000000000..3500155a7a --- /dev/null +++ b/src/share/yang/modules/utils/bump-up-revisions.sh @@ -0,0 +1,75 @@ +#!/bin/sh + +# Copyright (C) 2023 Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# This script can be used to bump up YANG module revisions. + +# Exit with error if commands exit with non-zero and if undefined variables are +# used. +set -eu + +# Print usage. +# Expressions don't expand in single quotes, use double quotes for that. [SC2016] +# shellcheck disable=SC2016 +print_usage() { + printf \ +'Usage: %s {{options}} +Options: + [-d|--debug] enable debug mode, showing every executed command + [-h|--help] print usage (this text) +' \ + "$(basename "${0}")" +} + +# Parse parameters. +while test ${#} -gt 0; do + case "${1}" in + # [-d|--debug] enable debug mode, showing every executed command + '-d'|'--debug') set -vx ;; + + # [-h|--help] print usage (this text) + '-h'|'--help') print_usage; exit 0 ;; + + # Unrecognized argument + *) + printf "${red}ERROR: Unrecognized argument '%s'${reset}\\n" "${1}" 1>&2; print_usage; exit 1 ;; + esac; shift +done + +#------------------------------------------------------------------------------# + +# Get script path. +script_path=$(cd "$(dirname "${0}")" && pwd) +pushd "${script_path}/.." + +# Get the last wednesday of the month. +this_month=$(date +%Y-%m) +wednesday=$(date -dwednesday +%Y-%m-%d) +i="${wednesday}" +while test "$(date -d "${i}" +%Y-%m)" == "${this_month}"; do + wednesday="${i}" + i=$(date -d"${wednesday} +7 days" +%Y-%m-%d) +done + +# For all modules that were modified in this branch: +# - rename it to the new revision +# - change its name in Makefile.am +# - change its name in yang_revisions.h +ca=$(git merge-base origin/master $(git rev-parse --abbrev-ref HEAD)) +for module in $(git diff "${ca}" --name-only . | grep -E '\.yang$'); do + module=$(basename "${module}") + new_module="$(printf '%s' "${module}" | sed "s/@.*\.yang/@${wednesday}.yang/g")" + if test "${module}" != "${new_module}"; then + mv "${module}" "${new_module}" + sed -i "s/${module}/${new_module}/g" ./Makefile.am + sed -i "s/${module}/${new_module}/g" ../../../lib/yang/yang_revisions.h + fi +done + +# Regenerate hashes. +rm hashes/* +./utils/check-hashes.sh -a