diff options
author | Francis Dupont <fdupont@isc.org> | 2018-09-11 01:27:16 +0200 |
---|---|---|
committer | Francis Dupont <fdupont@isc.org> | 2018-09-11 01:27:16 +0200 |
commit | a8b2b4d4fff79a221d8bd2fb07c6b552afbef237 (patch) | |
tree | fbf4c2656fb8120762655c0ad861f414653b75e1 | |
parent | [!17, #65] Changes after review of kea-dhcp6 (also some kea-dhcp4 tweaks) (diff) | |
download | kea-a8b2b4d4fff79a221d8bd2fb07c6b552afbef237.tar.xz kea-a8b2b4d4fff79a221d8bd2fb07c6b552afbef237.zip |
[65-libyang-models] Massive cleanup
-rw-r--r-- | src/lib/yang/models/ietf-dhcpv4-options.yang | 243 | ||||
-rw-r--r-- | src/lib/yang/models/ietf-dhcpv4-types.yang | 64 | ||||
-rw-r--r-- | src/lib/yang/models/ietf-kea-dhcpv6.yang | 315 | ||||
-rw-r--r-- | src/lib/yang/models/kea-control-agent.yang | 33 | ||||
-rw-r--r-- | src/lib/yang/models/kea-dhcp-types.yang | 734 | ||||
-rw-r--r-- | src/lib/yang/models/kea-dhcp4.yang | 648 | ||||
-rw-r--r-- | src/lib/yang/models/kea-dhcp6.yang | 691 | ||||
-rw-r--r-- | src/lib/yang/models/kea-dhcpddns.yang | 19 | ||||
-rw-r--r-- | src/lib/yang/models/kea-dhcpv4-server.yang | 585 | ||||
-rw-r--r-- | src/lib/yang/models/kea-server.yang | 85 | ||||
-rw-r--r-- | src/lib/yang/models/kea-types.yang | 9 |
11 files changed, 1007 insertions, 2419 deletions
diff --git a/src/lib/yang/models/ietf-dhcpv4-options.yang b/src/lib/yang/models/ietf-dhcpv4-options.yang deleted file mode 100644 index 57a081c19d..0000000000 --- a/src/lib/yang/models/ietf-dhcpv4-options.yang +++ /dev/null @@ -1,243 +0,0 @@ -module ietf-dhcpv4-options { - yang-version 1.1; - namespace "urn:ietf:params:xml:ns:yang:ietf-dhcpv4-options"; - prefix "dhcpv4-options"; - - import ietf-inet-types { - prefix inet; - } - import ietf-yang-types { - prefix yang; - } - import ietf-dhcpv4-types { - prefix dhcpv4-types; - } - - organization "DHC WG"; - contact - "piotr.strzyzewski@polsl.pl"; - description "This model defines a YANG data model that can be - used to configure DHCPv4 options."; - - revision 2018-07-14 { - description "Initial revision"; - reference ""; - } - - /* - * Features - */ - - // features for server options - feature router-op { - description "Support for Router Option"; - } - feature time-server-op { - description "Support for Time Server Option"; - } - feature domain-server-op { - description "Support for Domain Server Option"; - } - feature log-server-op { - description "Support for Log Server Option"; - } - feature hostname-op { - description "Support for Hostname Option"; - } - feature domain-name-op { - description "Support for Domain Name Option"; - } - feature broadcast-op { - description "Support for Broadcast Address Option"; - } - feature ntp-server-op { - description "Support for NTP Servers Option"; - } - feature server-name-op { - description "Support for Server-Name Option"; - } - feature bootfile-name-op { - description "Support for Bootfile-Name Option"; - } - - /* - * Groupings - */ - - grouping server-option-definitions { - description "Contains definitions for options configured on the - DHCPv4 server which will be supplied to clients."; - - container router-option { - // if-feature router-op - // presence "Enable this option"; - description "Router (3) Router addresses"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - list router { - key router-id; - description "Router info"; - leaf router-id { - type uint8; - mandatory true; - description "Router list entry ID"; - } - leaf router-addr { - type inet:ipv4-address; - mandatory true; - description "Router address"; - } - } - } - container time-server-option { - // if-feature time-server-op - // presence "Enable this option"; - description "Time Server (4) Timeserver addresses"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - list time-server { - key time-server-id; - description "Time Server info"; - leaf time-server-id { - type uint8; - mandatory true; - description "Time Server list entry ID"; - } - leaf time-server-addr { - type inet:ipv4-address; - mandatory true; - description "Time Server address"; - } - } - } - container domain-server-option { - // if-feature domain-server-op - // presence "Enable this option"; - description "Domain Server (6) DNS Server addresses"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - list domain-server { - key domain-server-id; - description "DNS Server info"; - leaf domain-server-id { - type uint8; - mandatory true; - description "DNS Server list entry ID"; - } - leaf domain-server-addr { - type inet:ipv4-address; - mandatory true; - description "DNS Server address"; - } - } - } - container log-server-option { - // if-feature log-server-op - // presence "Enable this option"; - description "Log Server (7) Logging Server addresses"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - list log-server { - key log-server-id; - description "Logging Server info"; - leaf log-server-id { - type uint8; - mandatory true; - description "Logging Server list entry ID"; - } - leaf log-server-addr { - type inet:ipv4-address; - mandatory true; - description "Logging Server address"; - } - } - } - container hostname-option { - // if-feature hostname-op; - // presence "Enable this option"; - description "Hostname (12) Hostname string"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - leaf hostname { - type string; - description "Hostname"; - } - } - container domain-name-option { - // if-feature domain-name-op; - // presence "Enable this option"; - description "Domain Name (15) The DNS domain name of the client"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - leaf domain-name { - type string; - description "Domain Name"; - } - } - container broadcast-option { - // if-feature broadcast-op - // presence "Enable this option"; - description "Broadcast Address (28) Broadcast Address"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - leaf broadcast-addr { - type inet:ipv4-address; - description "Broadcast address"; - } - } - container ntp-server-option { - // if-feature ntp-server-op - // presence "Enable this option"; - description "NTP Servers (42) NTP Server addresses"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - list ntp-server { - key ntp-server-id; - description "NTP Server info"; - leaf ntp-server-id { - type uint8; - mandatory true; - description "NTP Server list entry ID"; - } - leaf ntp-server-addr { - type inet:ipv4-address; - mandatory true; - description "NTP Server address"; - } - } - } - container server-name-option { - // if-feature server-name-op; - // presence "Enable this option"; - description "Server-Name (66) TFTP Server Name"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - leaf server-name { - type string; - description "TFTP Server Name"; - } - } - container bootfile-name-option { - // if-feature bootfile-name-op; - // presence "Enable this option"; - description "Bootfile-Name (67) Boot File Name"; - reference "RFC2132: DHCP Options and BOOTP Vendor Extensions"; - leaf bootfile-name { - type string; - description "Boot File Name"; - } - } - container domain-search-option { - // if-feature domain-search-op; - // presence "Enable this option"; - description "Domain Search (119) DNS domain search list"; - reference "RFC3397: Dynamic Host Configuration Protocol - (DHCP) Domain Search Option"; - list domain-search { - key domain-search-id; - description "Domain Search info"; - leaf domain-search-id { - type uint8; - mandatory true; - description "Domain Search entry ID"; - } - leaf domain-search-entry { - type string; - mandatory true; - description "Domain Search list entry"; - } - } - } - } -} diff --git a/src/lib/yang/models/ietf-dhcpv4-types.yang b/src/lib/yang/models/ietf-dhcpv4-types.yang deleted file mode 100644 index 4b33d2a418..0000000000 --- a/src/lib/yang/models/ietf-dhcpv4-types.yang +++ /dev/null @@ -1,64 +0,0 @@ -module ietf-dhcpv4-types { - yang-version 1.1; - namespace "urn:ietf:params:xml:ns:yang:ietf-dhcpv4-types"; - prefix "dhcpv4-types"; - - import ietf-inet-types { - prefix inet; - } - import ietf-yang-types { - prefix yang; - } - - organization "DHC WG"; - contact - "piotr.strzyzewski@polsl.pl"; - description "This model defines a YANG data model that can be - used to define some commonly used DHCPv4 types"; - - revision 2018-07-14 { - description "Initial revision"; - reference ""; - } - - /* - * Grouping - */ - grouping vendor-infor { - description "Vendor information."; - container vendor-info { - description ""; - leaf ent-num { - type uint32; - description "enterprise number"; - } - leaf-list data { - type string; - description "specific vendor info"; - } - } - } - - grouping portset-para { - description "portset parameters"; - container port-parameter { - description "port parameter"; - leaf offset { - type uint8; - mandatory true; - description "offset in a port set"; - } - leaf psid-len { - type uint8; - mandatory true; - description "length of a psid"; - } - leaf psid { - type uint16; - mandatory true; - description "psid value"; - } - } - } - -} diff --git a/src/lib/yang/models/ietf-kea-dhcpv6.yang b/src/lib/yang/models/ietf-kea-dhcpv6.yang deleted file mode 100644 index eb736cb10e..0000000000 --- a/src/lib/yang/models/ietf-kea-dhcpv6.yang +++ /dev/null @@ -1,315 +0,0 @@ -module ietf-kea-dhcpv6 { - namespace "urn:ietf:params:xml:ns:yang:ietf-kea-dhcpv6"; - prefix "dhcpv6"; - - import ietf-inet-types { - prefix inet; - revision-date "2013-07-15"; - } - import ietf-yang-types { - prefix yang; - revision-date "2013-07-15"; - } - - organization "ISC, DT, Sysrepo, Tsinghua"; - - contact "lh.sunlinh@gmail.com"; - - description "This model defines a YANG data model that can be - used to configure and manage Kea DHCPv6 server."; - - revision 2016-07-16 { - description "version00: the minimum mapping between Kea - configuration and dhcpv6 YANG model."; - - reference "sysrepo.org"; - - } - -/* - * Typedef - */ - - typedef duidtype { - type union { - type uint16; - type string { - pattern '(([0-9a-fA-F]{2}){2,128})'; - } - } - description "the type defined for duid"; - } - -/* - * Data Nodes - */ - - container server { - description "Kea dhcpv6 server configuration"; - container serv-attributes { - description "gloabl attributes"; - leaf name { - type string; - description "server's name"; - } - leaf duid { - type duidtype; - description "DHCP Unique Identifer"; - } - leaf enable { - type boolean; - description "whether to enable the server"; - } - container lease-database { - leaf type { - type string; - description "defines database type. Supported - values are: memfile, mysql, pgsql, - cassandra"; - } - description "Defines database connection"; - } - container control-socket { - leaf socket-type { - type string; - /* @todo: change this to enum */ - description "Type of control socket used - to send commands to Kea"; - } - leaf socket-name { - type string; - description "Specifies location of the - unix socket Kea uses to receive commands"; - } - description "Defines control API socket"; - } - container interfaces-config { - description "A leaf list to denote which one or - more interfaces the server should listen on. The - default value is to listen on all the interfaces. - This node is also used to set a unicast address - for the server to listen with a specific interface. - For example, if people want the server to listen - on a unicast address with a specific interface, he - can use the format like 'eth1/2001:db8::1'."; - leaf-list interfaces { - type string; - description "the specific interfaces"; - } - } - leaf description { - type string; - description "description of the server"; - } - leaf stateless-service { - type boolean; - description "A boolean value specifies whether - the server support client-server exchanges - involving two messages defined in ([RFC3315])."; - } - leaf renew-timer { - type yang:timeticks; - description "renew time in seconds"; - } - leaf rebind-timer { - type yang:timeticks; - description "rebind time in seconds"; - } - leaf preferred-lifetime { - type yang:timeticks; - description "preferred lifetime IA in seconds"; - } - leaf valid-lifetime { - type yang:timeticks; - description "valid liftime for IA"; - } - } - container custom-options { - description "container for defining custom - DHCPv6 options"; - list custon-option{ - key option-code; - description "container for defining custom - DHCPv6 options"; - leaf option-code { - type uint16; - description "option code for custom option"; - } - leaf option-name { - type string; - description "option name for custom option"; - } - leaf option-type { - type string; - description "option type for custom option"; - } - - } - } - container option-sets { - description "option sets configruation"; - list option-set { - key option-set-id; - description "a specific option set"; - leaf option-set-id { - type uint8; - description "identifier for specific option - set"; - } - leaf description{ - type string; - description "description for the option set"; - } - list standard-option { - key option-code; - description "standard format for DHCPv6 - option"; - leaf option-code { - type uint16; - description "option code for standard option"; - } - leaf option-name { - type string; - description "option name for standard option"; - } - leaf option-value { - type string; - description "option data for standard option"; - } - leaf csv-format { - type boolean; - description "whether csv-format is employed"; - } - } - } - } - container network-ranges { - description "gloabl level for DHCPv6 server"; - leaf option-set-id { - type uint8; - description "selected option set for global level"; - } - leaf rapid-commit { - type boolean; - description "whether rapid commit is enabled - gloablly"; - } - list subnet6 { - key subnet; - description "A subnet of DHCPv6 server"; - leaf network-range-id { - type uint8; - description "subnet id"; - } - leaf network-description { - type string; - description "description for the subnet"; - } - leaf subnet { - type inet:ipv6-prefix; - description "the subnet prefix"; - } - leaf option-set-id { - type uint8; - description "selected option set for this - subnet"; - } - leaf rapid-commit { - type boolean; - description "whether rapid commit is enabled - for this subnet"; - } - leaf interface { - type string; - description "IPv6 subnet selction"; - } - leaf interface-id { - type string; - description "content of the interface-id - option used by relays"; - } - leaf relay-address { - type inet:ipv6-address; - description "specify which relay will be - used"; - } - container pools { - description "address pools for this subnet"; - list address-pool { - key pool-id; - description "a specific address pool"; - leaf pool-id { - type uint8; - description "address pool - indentifier"; - } - leaf pool-prefix { - type inet:ipv6-prefix; - description "the pool prefix"; - } - leaf start-address { - type inet:ipv6-address; - description "start address"; - } - leaf end-address { - type inet:ipv6-address; - description "end address"; - } - } - } - container prefix-pools { - description "prefix pools for this subnet"; - list prefix-pool { - key pool-id; - description "a specific prefix pool"; - leaf pool-id { - type uint8; - description "prefix pool - indentifier"; - } - leaf pool-prefix { - type inet:ipv6-prefix; - description "available prefix"; - } - } - } - list reserved-host { - key cli-id; - description "host reservation"; - leaf cli-id { - type uint32; - description "a cli-id is corresponding - to a specific host (DUID)"; - } - leaf duid { - type duidtype; - description "host's DUID"; - } - leaf hardware-addr { - type yang:mac-address; - description "host's mac address"; - } - leaf-list reserv-addr { - type inet:ipv6-address; - description "reserved IPv6 addresses"; - } - } - } - } - container rsoo-enabled-options { - description "rsoo enabled options"; - list rsoo-enabled-option{ - key option-code; - description "rsoo enabled option"; - leaf option-code { - type uint16; - description "option code"; - } - leaf description { - type string; - description "description of the option"; - } - } - } - } -} diff --git a/src/lib/yang/models/kea-control-agent.yang b/src/lib/yang/models/kea-control-agent.yang index d2fcb06f62..b9c69aa3b0 100644 --- a/src/lib/yang/models/kea-control-agent.yang +++ b/src/lib/yang/models/kea-control-agent.yang @@ -12,11 +12,14 @@ module kea-control-agent { import kea-types { prefix kea; } + import kea-logging { + prefix logging; + } organization "Internet Systems Consortium"; contact "kea-dev@lists.isc.org"; description "This model defines a YANG data model that can be - used to configure and manage a Kea control agent."; + used to configure and manage a Kea control agent."; revision 2018-08-20 { description "Initial revision"; @@ -24,11 +27,12 @@ module kea-control-agent { } /* - * Groupings + * Data Nodes */ - grouping configuration { - description "Contains parameters for control agent configuration."; + container config { + description "Contains control agent configuration."; + config true; leaf http-host { type inet:ip-address; @@ -59,13 +63,20 @@ module kea-control-agent { uses kea:control-socket; } } - } + } - uses kea:hooks-libraries; + uses kea:hooks-libraries; - leaf user-context { - type kea:user-context; - description "Control agent user context."; - } - } + leaf user-context { + type kea:user-context; + description "Control agent user context."; + } + } + + container logging { + description "Logging"; + config true; + + uses logging:configuration; + } } diff --git a/src/lib/yang/models/kea-dhcp-types.yang b/src/lib/yang/models/kea-dhcp-types.yang new file mode 100644 index 0000000000..3adf1f6793 --- /dev/null +++ b/src/lib/yang/models/kea-dhcp-types.yang @@ -0,0 +1,734 @@ +module kea-dhcp-types { + yang-version 1.1; + namespace "urn:ietf:params:xml:ns:yang::kea-dhcp-types"; + prefix "kea-dhcp-types"; + + import ietf-inet-types { + prefix inet; + } + import ietf-yang-types { + prefix yang; + } + import kea-types { + prefix kea; + } + + organization "Internet Systems Consortium"; + contact "kea-dev@lists.isc.org"; + description "This file defines some commonly used Kea DHCP types and + groupings."; + revision 2018-08-20 { + description "Initial revision"; + reference ""; + } + + /* + * Typedef + */ + typedef host-reservation-mode { + type enumeration { + enum "disabled"; + enum "out-of-pool"; + enum "all"; + } + description "Host reservation mode."; + } + + typedef lease-state { + type enumeration { + enum "default"; + enum "declined"; + enum "expired-reclaimed"; + } + description "Defines state of the lease."; + } + + /* + * Grouping + */ + grouping valid-lifetime { + leaf valid-lifetime { + type uint32; + units "seconds"; + description "Valid lifetime."; + } + } + + grouping renew-timer { + leaf renew-timer { + type uint32; + units "seconds"; + description "Renew timer."; + } + } + + grouping rebind-timer { + leaf rebind-timer { + type uint32; + units "seconds"; + description "Rebind timer."; + } + } + + grouping database { + leaf database-type { + type string; + mandatory true; + description "Database type (e.g. mysql)."; + } + leaf user { + type string; + description "Database user name."; + } + leaf password { + type string; + description "Database user password."; + } + leaf host { + type string; + description "Database host."; + } + leaf name { + type string; + description "Database name."; + } + leaf persist { + type boolean; + default true; + description "Write lease to disk file. This parameter applies only to + memfile backend."; + } + leaf port { + type uint16; + description "Database port."; + } + leaf lfc-interval { + type uint32; + units "seconds"; + default 3600; + description "Interval between two lease file cleanups."; + } + leaf readonly { + type boolean; + default false; + description "If set to true, the database will be connected in + read-only mode. This does not make sense for lease + databases, only for host reservations and possibly + for upcoming config backend."; + } + leaf connect-timeout { + type uint32; + units "milliseconds"; + description "Database connection timeout."; + } + leaf contact-points { + type string; + description "Cassandra database contact points, a coma separated list of + IP addresses."; + } + leaf keyspace { + type string; + description "Cassandra database keyspace (this is Cassandra's equivalent + of a database name)."; + } + leaf max-reconnect-tries { + type uint32; + default 0; + description "Maximum of recovery attempts before exit."; + } + leaf reconnect-wait-time { + type uint32; + default 0; + units "milliseconds"; + description "Waiting delay between two recovery attempts."; + } + leaf request-timeout { + type uint32; + units "milliseconds"; + description "Timeout waiting for a response."; + } + leaf tcp-keepalive { + type uint32; + units "seconds"; + default 0; + description "TCP keepalive for the database connection."; + } + leaf tcp-nodelay { + type boolean; + default true; + description "TCP nodelay for the database connection."; + } + uses kea:user-context { + refine user-context { + description "Database user context. Arbitrary JSON data can be + stored here."; + } + } + } + + grouping databases { + container lease-database { + description "Lease database."; + uses database; + } + container hosts-databases { + description "Hosts databases."; + list hosts-database { + key database-type; + uses database; + } + } + } + + grouping expired-leases-processing { + container expired-leases-processing { + description "Expired leases processing setup."; + leaf reclaim-timer-wait-time { + type uint32; + units "seconds"; + default 10; + description "Interval between reclamation cycles."; + } + leaf flush-reclaimed-timer-wait-time { + type uint32; + units "seconds"; + default 25; + description "Interval between reclaimed leases collection."; + } + leaf hold-reclaimed-time { + type uint32; + units "seconds"; + default 3600; + description "Hold timer for re-assignment."; + } + leaf max-reclaim-leases { + type uint32; + default 100; + description "Maximum number of reclaimed leases per cycle."; + } + leaf max-reclaim-time { + type uint32; + units "milliseconds"; + default 250; + description "Maximum duration of a reclamation cycle."; + } + leaf unwarned-reclaim-cycles { + type uint32; + default 5; + description "Maximum numbers of uncomplete cycles before warning."; + } + } + } + + grouping control-socket { + container control-socket { + description "Control socket"; + uses kea:control-socket; + } + } + + grouping dhcp-ddns { + container dhcp-ddns { + description "DHCP-DDNS client setup."; + leaf enable-updates { + type boolean; + default false; + description "Enable DHCP-DDNS updates."; + } + leaf qualifying-suffix { + type string; + description "DHCP-DDNS qualifying suffix."; + } + leaf server-ip { + type inet:ip-address; + default "127.0.0.1"; + description "DHCP-DDNS server IP address."; + } + leaf server-port { + type uint16; + default 53001; + description "DHCP-DDNS server port."; + } + leaf sender-ip { + type inet:ip-address; + description "DHCP-DDNS sender IP address."; + } + leaf sender-port { + type uint16; + description "DHCP-DDNS sender port."; + } + leaf max-queue-size { + type uint32; + default 1024; + description "Maximum DHCP-DDNS queue size."; + } + leaf ncr-protocol { + type enumeration { + enum "UDP"; + enum "TCP"; + } + default "UDP"; + description "Protocol to use for DHCP-DDNS communication. + Currently only UDP is supported."; + } + leaf ncr-format { + type enumeration { + enum "JSON"; + } + default "JSON"; + description "Packet format to use for DHCP-DDNS."; + } + leaf always-include-fqdn { + type boolean; + description "???"; + } + leaf override-no-update { + type boolean; + default false; + description "Ignore client request and send update."; + } + leaf override-client-update { + type boolean; + default false; + description "Ignore client delegation."; + } + leaf replace-client-name { + type enumeration { + enum "when-present"; + enum "never"; + enum "always"; + enum "when-not-present"; + } + default "never"; + description "Replace the name provided by the client."; + } + leaf generated-prefix { + type string; + default "myhost"; + description "DHCP-DDNS generated prefix."; + } + leaf hostname-char-set { + type string; + description "A regex defining invalid characters. If detected, those + will be replaced by hostname-char-replacement."; + } + leaf hostname-char-replacement { + type string; + description "Replacement for invalid charaters. See + hostname-char-set."; + } + uses kea:user-context { + refine user-context { + description "DHCP-DDNS user context. Arbitrary JSON data can + be stored here."; + } + } + } + } + + grouping sanity-checks { + container sanity-checks { + description "Sanity checks."; + leaf lease-checks { + type enumeration { + enum "none" { + description "No checks."; + } + enum "warn" { + description "When a check fails print a warning and accept the + lease."; + } + enum "fix" { + description "When a check fails try to fix it and accept the + lease."; + } + enum "fix-del" { + description "When a check fails try to fix it and reject the + lease if still bad."; + } + enum "del" { + description "When a check fails reject the lease."; + } + } + default "warn"; + description "Lease checks: verify subnet-id consistency on memfile + loading."; + } + } + } + + grouping client-class { + leaf client-class { + type string; + } + } + + grouping pool-client-class { + uses client-class { + refine client-class { + description "Pool client class guard (only clients belonging + to this class will be allowed in this pool)."; + } + } + } + + grouping subnet-client-class { + uses client-class { + refine client-class { + description "Subnet client class guard (only clients belonging to this + class will be allowed in this subnet)."; + } + } + } + + grouping network-client-class { + uses client-class { + refine client-class { + description "Shared network client class guard (only clients + belonging to this class will be allowed in this + shared network)."; + } + } + } + + grouping require-client-classes { + leaf-list require-client-classes { + type string; + } + } + + grouping pool-require-client-classes { + uses require-client-classes { + refine require-client-classes { + description "Pool require client classes."; + } + } + } + + grouping subnet-require-client-classes { + uses require-client-classes { + refine require-client-classes { + description "Subnet require client classes."; + } + } + } + + grouping network-require-client-classes { + uses require-client-classes { + refine require-client-classes { + description "Shared network require client classes."; + } + } + } + + grouping interface { + leaf interface { + type string; + } + } + + grouping subnet-interface { + uses interface { + refine interface { + description "Name of the network interface this subnet is directly + accessible with (optional)."; + } + } + } + + grouping network-interface { + uses interface { + refine interface { + description "Specifies the network interface this shared network is + directly accessible with. (optional)"; + } + } + } + + grouping interface-id { + leaf interface-id { + type string; + } + } + + grouping subnet-interface-id { + uses interface-id { + refine interface-id { + description "Subnet interface-id option."; + } + } + } + + grouping network-interface-id { + uses interface-id { + refine interface-id { + description "Shared network interface-id option."; + } + } + } + + grouping subnet-id { + leaf id { + type uint32 { + range 1..max; + } + mandatory true; + description "Subnet ID, a unique identifier used to locate or reference + a subnet."; + } + } + + grouping host-identifier { + leaf identifier { + type string; + description "Host identifier."; + } + } + + grouping host-hostname { + leaf hostname { + type string; + description "Host DNS name."; + } + } + + grouping host-client-classes { + leaf-list client-classes { + type string; + description "Host client classes (if host identifier matches, a + client's packet will be added to the classes liste + here.)"; + } + } + + grouping host-subnet-id { + leaf subnet-id { + type uint32; + mandatory true; + description "Host subnet ID."; + } + } + + grouping reservation-mode { + leaf reservation-mode { + type host-reservation-mode; + } + } + + grouping subnet-reservation-mode { + uses reservation-mode { + refine reservation-mode { + description "Subnet host reservation mode."; + } + } + } + + grouping network-reservation-mode { + uses reservation-mode { + refine reservation-mode { + description "Shared network host reservation mode."; + } + } + } + + grouping interfaces-re-detect { + leaf re-detect { + type boolean; + default false; + description "Re-detect interfaces at each reconfiguration."; + } + } + + grouping class-name { + leaf name { + type string; + mandatory true; + description "Name of the client class."; + } + } + + grouping class-test { + leaf test { + type string; + description "Defines an expression that evaluates every incoming + packet."; + } + } + + grouping class-only-if-required { + leaf only-if-required { + type boolean; + default false; + description "Client class only if required flag."; + } + } + + grouping option-def-name { + leaf name { + type string; + mandatory true; + description "Name of the new option being defined."; + } + } + + grouping option-def-type { + leaf type { + type string; + mandatory true; + description "Type of the new option being defined (such as + string, record or uint8)."; + } + } + + grouping option-def-record-types { + leaf record-types { + type string; + description "Option definition record types."; + } + } + + grouping option-def-encapsulate { + leaf encapsulate { + type string; + description "Defines option space this new option encapsulates. + Usually empty."; + } + } + + grouping option-data-name { + leaf name { + type string; + description "Option name."; + } + } + + grouping option-data-data { + leaf data { + type string; + description "Option data."; + } + } + + grouping option-data-csv-format { + leaf csv-format { + type boolean; + default true; + description "If true, the option is specified as comma separated + values. If false, it is expected as a hex string."; + } + } + + grouping option-data-always-send { + leaf always-send { + type boolean; + default false; + description "Defines whether to always send the option, + regardless if the client requested it or not."; + } + } + + grouping option-def-array { + leaf array { + type boolean; + default false; + description "Option definition array flag."; + } + } + + grouping decline-probation-period { + leaf decline-probation-period { + type uint32; + units "seconds"; + default 86400; + description "Decline probabation period."; + } + } + + grouping network-name { + leaf name { + type string; + mandatory true; + description "Shared network name."; + } + } + + grouping dhcp4o6-port { + leaf dhcp4o6-port { + type uint16; + description "DHCPv4-over-DHCPv6 interserver port."; + } + } + + grouping pool-user-context { + uses kea:user-context { + refine user-context { + description "Pool user context. Arbitrary JSON data can be + stored here."; + } + } + } + + grouping host-user-context { + uses kea:user-context { + refine user-context { + description "Host user context. Arbitrary JSON data can be + stored here."; + } + } + } + + grouping subnet-user-context { + uses kea:user-context { + refine user-context { + description "Subnet user context. Arbitrary JSON data can be + stored here."; + } + } + } + + grouping network-user-context { + uses kea:user-context { + refine user-context { + description "Shared network user context. Arbitrary JSON data can be + stored here."; + } + } + } + + grouping interfaces-user-context { + uses kea:user-context { + refine user-context { + description "Interfaces user context. Arbitrary JSON data can + be stored here."; + } + } + } + + grouping class-user-context { + uses kea:user-context { + refine user-context { + description "Client class user context. Arbitrary JSON data can + be stored here."; + } + } + } + + grouping option-def-user-context { + uses kea:user-context { + refine user-context { + description "Option definition user context. Arbitrary JSON data + can be stored here."; + } + } + } + + grouping option-data-user-context { + uses kea:user-context { + refine user-context { + description "Option user context. Arbitrary JSON data can be + stored here."; + } + } + } + +} diff --git a/src/lib/yang/models/kea-dhcp4.yang b/src/lib/yang/models/kea-dhcp4.yang index 0345bd5143..6f62e6362e 100644 --- a/src/lib/yang/models/kea-dhcp4.yang +++ b/src/lib/yang/models/kea-dhcp4.yang @@ -12,11 +12,17 @@ module kea-dhcp4 { import kea-types { prefix kea; } + import kea-dhcp-types { + prefix dhcp; + } + import kea-logging { + prefix logging; + } organization "Internet Systems Consortium"; contact "kea-dev@lists.isc.org"; description "This model defines a YANG data model that can be - used to configure and manage a Kea DHCPv4 server."; + used to configure and manage a Kea DHCPv4 server."; revision 2018-08-20 { description "Initial revision"; @@ -37,52 +43,9 @@ module kea-dhcp4 { description "Host identifier type."; } - typedef host-reservation-mode { - type enumeration { - enum "disabled"; - enum "out-of-pool"; - enum "all"; - enum "global"; - } - description "Host reservation mode."; - } - - typedef lease-state { - type enumeration { - enum "default"; - enum "declined"; - enum "expired-reclaimed"; - } - description "Defines state of the lease."; - } - /* * Groupings */ - grouping valid-lifetime { - leaf valid-lifetime { - type uint32; - units "seconds"; - description "Valid lifetime."; - } - } - - grouping renew-timer { - leaf renew-timer { - type uint32; - units "seconds"; - description "Renew timer."; - } - } - - grouping rebind-timer { - leaf rebind-timer { - type uint32; - units "seconds"; - description "Rebind timer."; - } - } - grouping match-client-id { leaf match-client-id { type boolean; @@ -126,13 +89,14 @@ module kea-dhcp4 { list subnet4 { key id; ordered-by user; - uses valid-lifetime; - uses renew-timer; - uses rebind-timer; + uses dhcp:valid-lifetime; + uses dhcp:renew-timer; + uses dhcp:rebind-timer; uses option-data-list; container pools { list pool { key "start-address end-address"; + ordered-by user; leaf prefix { type inet:ipv4-prefix; description "Defines a pool of dynamic IPv4 addresses to be managed @@ -149,19 +113,9 @@ module kea-dhcp4 { description "Last IPv4 address in a pool."; } uses option-data-list; - leaf client-class { - type string; - description "Pool client class guard (only clients belonging to this - class will be allowed in this pool)."; - } - leaf-list require-client-classes { - type string; - description "Pool require client classes."; - } - leaf user-context { - type kea:user-context; - description "Pool user context. Arbitrary JSON data can be stored here."; - } + uses dhcp:pool-client-class; + uses dhcp:pool-require-client-classes; + uses dhcp:pool-user-context; } } leaf subnet { @@ -169,72 +123,35 @@ module kea-dhcp4 { mandatory true; description "IPv4 subnet prefix."; } - leaf interface { - type string; - description "Name of the network interface this subnet is directly - accessible with (optional)."; - } - leaf interface-id { - type string; - description "Subnet interface-id option."; - } - leaf id { - type uint32 { - range 1..max; - } - mandatory true; - description "Subnet ID, a unique identifier used to locate or reference - a subnet."; - } - leaf client-class { - type string; - description "Subnet client class guard (only clients belonging to this - clas will be allowed in this subnet)."; - - } - leaf-list require-client-classes { - type string; - description "Subnet require client classes."; - } + uses dhcp:subnet-interface; + uses dhcp:subnet-interface-id; + uses dhcp:subnet-id; + uses dhcp:subnet-client-class; + uses dhcp:subnet-require-client-classes; container reservations { - description "A container with host reservations specific to this IPv4 subnet."; + description "A container with host reservations specific to + this IPv4 subnet."; list host { key "identifier-type identifier"; leaf identifier-type { type host-identifier-type; description "Host identifier type."; } - leaf identifier { - type string; - description "Host identifier."; - } - leaf-list client-classes { - type string; - description "Host client classes (if host identifier matches, a client's - packet will be added to the classes liste here.)"; - } + uses dhcp:host-identifier; leaf ip-address { type inet:ipv4-address; description "Host reserved IPv4 address."; } - leaf hostname { - type string; - description "Host DNS name."; - } + uses dhcp:host-hostname; + uses dhcp:host-client-classes; uses option-data-list; uses next-server; uses server-hostname; uses boot-file-name; - leaf user-context { - type kea:user-context; - description "Host user context. Arbitrary JSON data can be stored here."; - } + uses dhcp:host-user-context; } } - leaf reservation-mode { - type host-reservation-mode; - description "Subnet host reservation mode."; - } + uses dhcp:subnet-reservation-mode; container relay { description "Optional information about relay agent."; uses relay; @@ -255,130 +172,20 @@ module kea-dhcp4 { type inet:ipv6-prefix; description "Subnet DHCPv4-over-DHCPv6 IPv6 prefix."; } - leaf user-context { - type kea:user-context; - description "Subnet user context. Arbitrary JSON data can be stored here."; - } - } - } - - grouping database { - leaf database-type { - type string; - mandatory true; - description "Database type (e.g. mysql)."; - } - leaf user { - type string; - description "Database user name."; - } - leaf password { - type string; - description "Database user password."; - } - leaf host { - type string; - description "Database host."; - } - leaf name { - type string; - description "Database name."; - } - leaf persist { - type boolean; - default true; - description "Write lease to disk file. This parameter applies only to - memfile backend."; - } - leaf port { - type uint16; - description "Database port."; - } - leaf lfc-interval { - type uint32; - units "seconds"; - default 3600; - description "Interval between two lease file cleanups."; - } - leaf readonly { - type boolean; - default false; - description "If set to true, the database will be connected in read-only - mode. This does not make sense for lease databases, only for - host reservations and possibly for upcoming config backend."; - } - leaf connect-timeout { - type uint32; - units "milliseconds"; - description "Database connection timeout."; - } - leaf contact-points { - type string; - description "Cassandra database contact points, a coma separated list of - IPv4 addresses."; - } - leaf keyspace { - type string; - description "Cassandra database keyspace (this is Cassandra's equivalent - of a database name)."; - } - leaf max-reconnect-tries { - type uint32; - default 0; - description "Maximum of recovery attempts before exit."; - } - leaf reconnect-wait-time { - type uint32; - default 0; - units "milliseconds"; - description "Waiting delay between two recovery attempts."; - } - leaf request-timeout { - type uint32; - units "milliseconds"; - description "Timeout waiting for a response."; - } - leaf tcp-keepalive { - type uint32; - units "seconds"; - default 0; - description "TCP keepalive for the database connection."; - } - leaf tcp-nodelay { - type boolean; - default true; - description "TCP nodelay for the database connection."; - } - leaf user-context { - type kea:user-context; - description "Database user context. Arbitrary JSON data can be stored here."; + uses dhcp:subnet-user-context; } } grouping client-class { - leaf name { - type string; - mandatory true; - description "Name of the client class."; - } - leaf test { - type string; - description "Defines an expression that evaluates every incoming packet."; - } - leaf only-if-required { - type boolean; - default false; - description "Client class only if required flag."; - } + uses dhcp:class-name; + uses dhcp:class-test; + uses dhcp:class-only-if-required; uses option-def-list; uses option-data-list; uses next-server; uses server-hostname; uses boot-file-name; - leaf user-context { - type kea:user-context; - description "Client class user context. Arbitrary JSON data can be stored here."; - } + uses dhcp:class-user-context; } grouping option-def-list { @@ -386,44 +193,22 @@ module kea-dhcp4 { description "List with custom option definitions."; list option-def { key "code space"; - leaf name { - type string; - mandatory true; - description "Name of the new option being defined."; - } leaf code { type uint8; mandatory true; description "Option code to be used by the new option definition."; } - leaf type { - type string; - mandatory true; - description "Type of the new option being defined (such as string or uint8)."; - } - leaf record-types { - type string; - description "Option definition record types."; - } leaf space { type string; mandatory true; description "Option space for the new option (typically dhcp4)."; } - leaf encapsulate { - type string; - description "Defines option space this new option encapsulates. - Usually empty."; - } - leaf array { - type boolean; - default false; - description "Option definition array flag."; - } - leaf user-context { - type kea:user-context; - description "Option definition user context."; - } + uses dhcp:option-def-name; + uses dhcp:option-def-type; + uses dhcp:option-def-record-types; + uses dhcp:option-def-encapsulate; + uses dhcp:option-def-array; + uses dhcp:option-def-user-context; } } } @@ -433,14 +218,6 @@ module kea-dhcp4 { description "Option data list."; list option-data { key "code space"; - leaf name { - type string; - description "Option name."; - } - leaf data { - type string; - description "Option data."; - } leaf code { type uint8; mandatory true; @@ -451,39 +228,27 @@ module kea-dhcp4 { mandatory true; description "Option space."; } - leaf csv-format { - type boolean; - default true; - description "If true, the option is specified as comma separated values. - If false, it is expected as a hex string."; - } - leaf always-send { - type boolean; - default false; - description "Defines whether to always send the option, regardless if the - client requested it or not."; - } - leaf user-context { - type kea:user-context; - description "Option user context. Arbitrary JSON data can be stored here."; - } + uses dhcp:option-data-name; + uses dhcp:option-data-data; + uses dhcp:option-data-csv-format; + uses dhcp:option-data-always-send; + uses dhcp:option-data-user-context; } } } - grouping configuration { - description "Contains parameters for DHCPv4 server configuration."; + /* + * Data Nodes + */ - uses valid-lifetime; - uses renew-timer; - uses rebind-timer; + container config { + description "Contains DHCPv4 server configuration."; + config true; - leaf decline-probation-period { - type uint32; - units "seconds"; - default 86400; - description "Decline probabation period."; - } + uses dhcp:valid-lifetime; + uses dhcp:renew-timer; + uses dhcp:rebind-timer; + uses dhcp:decline-probation-period; container subnet4 { description "Global list of IPv4 subnets."; @@ -494,22 +259,15 @@ module kea-dhcp4 { description "Defines a list of IPv4 shared networks."; list shared-network { key name; - leaf name { - type string; - mandatory true; - description "Shared network name."; - } + uses dhcp:network-name; container subnet4 { - description "List of IPv4 subnets that belong to this shared network."; + description "List of IPv4 subnets that belong to this shared + network."; uses subnet4-list; } - leaf interface { - type string; - description "Specifies the network interface this shared network is - directly accessible with. (optional)"; - } - uses renew-timer; - uses rebind-timer; + uses dhcp:network-interface; + uses dhcp:renew-timer; + uses dhcp:rebind-timer; uses option-data-list; uses match-client-id; uses next-server; @@ -519,25 +277,11 @@ module kea-dhcp4 { description "Optional information about relay agent."; uses relay; } - leaf reservation-mode { - type host-reservation-mode; - description "Shared network host reservation mode."; - } - leaf client-class { - type string; - description "Shared network client class guard (only clients belonging - to this class will be allowed in this shared network)."; - } - leaf-list require-client-classes { - type string; - description "Shared network require client classes."; - } - uses valid-lifetime; - leaf user-context { - type kea:user-context; - description "Shared network user context. Arbitrary JSON data can be - stored here."; - } + uses dhcp:network-reservation-mode; + uses dhcp:network-client-class; + uses dhcp:network-require-client-classes; + uses dhcp:valid-lifetime; + uses dhcp:network-user-context; } } @@ -564,7 +308,7 @@ module kea-dhcp4 { type enumeration { enum "same-as-inbound" { description "Send the response on the interface where the query - was received."; + was received."; } enum "use-routing" { description "Use kernel routing."; @@ -573,31 +317,11 @@ module kea-dhcp4 { default "same-as-inbound"; description "Control the interface used to send a response."; } - leaf re-detect { - type boolean; - default false; - description "Re-detect interfaces at each reconfiguration."; - } - leaf user-context { - type kea:user-context; - description "Interfaces user context. Arbitrary JSON data can be stored - here."; - } + uses dhcp:interfaces-re-detect; + uses dhcp:interfaces-user-context; } - container lease-database { - description "Lease database."; - presence "Enable lease database."; - uses database; - } - - container hosts-databases { - description "Hosts databases."; - list hosts-database { - key database-type; - uses database; - } - } + uses dhcp:databases; leaf-list host-reservation-identifiers { type host-identifier-type; @@ -616,202 +340,45 @@ module kea-dhcp4 { uses option-def-list; uses option-data-list; uses kea:hooks-libraries; - - container expired-leases-processing { - description "Expired leases processing setup."; - leaf reclaim-timer-wait-time { - type uint32; - units "seconds"; - default 10; - description "Interval between reclamation cycles."; - } - leaf flush-reclaimed-timer-wait-time { - type uint32; - units "seconds"; - default 25; - description "Interval between reclaimed leases collection."; - } - leaf hold-reclaimed-time { - type uint32; - units "seconds"; - default 3600; - description "Hold timer for re-assignment."; - } - leaf max-reclaim-leases { - type uint32; - default 100; - description "Maximum number of reclaimed leases per cycle."; - } - leaf max-reclaim-time { - type uint32; - units "milliseconds"; - default 250; - description "Maximum duration of a reclamation cycle."; - } - leaf unwarned-reclaim-cycles { - type uint32; - default 5; - description "Maximum numbers of uncomplete cycles before warning."; - } - } - - leaf dhcp4o6-port { - type uint16; - description "DHCPv4-over-DHCPv6 interserver port."; - } - - container control-socket { - description "Control socket"; - presence "Enable control socket."; - uses kea:control-socket; - } - - container dhcp-ddns { - description "DHCP-DDNS client setup."; - leaf enable-updates { - type boolean; - default false; - description "Enable DHCP-DDNS updates."; - } - leaf qualifying-suffix { - type string; - description "DHCP-DDNS qualifying suffix."; - } - leaf server-ip { - type inet:ip-address; - default "127.0.0.1"; - description "DHCP-DDNS server IP address."; - } - leaf server-port { - type uint16; - default 53001; - description "DHCP-DDNS server port."; - } - leaf sender-ip { - type inet:ip-address; - description "DHCP-DDNS sender IP address."; - } - leaf sender-port { - type uint16; - description "DHCP-DDNS sender port."; - } - leaf max-queue-size { - type uint32; - default 1024; - description "Maximum DHCP-DDNS queue size."; - } - leaf ncr-protocol { - type enumeration { - enum "UDP"; - enum "TCP"; - } - default "UDP"; - description "Protocol to use for DHCP-DDNS communication. - Currently only UDP is supported."; - } - leaf ncr-format { - type enumeration { - enum "JSON"; - } - default "JSON"; - description "Packet format to use for DHCP-DDNS."; - } - leaf always-include-fqdn { - type boolean; - description "???"; - } - leaf override-no-update { - type boolean; - default false; - description "Ignore client request and send update."; - } - leaf override-client-update { - type boolean; - default false; - description "Ignore client delegation."; - } - leaf replace-client-name { - type enumeration { - enum "when-present"; - enum "never"; - enum "always"; - enum "when-not-present"; - } - default "never"; - description "Replace the name provided by the client."; - } - leaf generated-prefix { - type string; - default "myhost"; - description "DHCP-DDNS generated prefix."; - } - leaf hostname-char-set { - type string; - description "A regex defining invalid characters. If detected, those - will be replaced by hostname-char-replacement."; - } - leaf hostname-char-replacement { - type string; - description "Replacement for invalid charaters. See hostname-char-set."; - } - leaf user-context { - type kea:user-context; - description "DHCP-DDNS user context. Arbitrary JSON data can be stored here."; - } - } + uses dhcp:expired-leases-processing; + uses dhcp:dhcp4o6-port; + uses dhcp:control-socket; + uses dhcp:dhcp-ddns; leaf echo-client-id { type boolean; default true; - description "Send client-id back when the client sent it. This is conformant - with RFC6842, but some older, buggy clients have problems with it."; + description "Send client-id back when the client sent it. This + is conformant with RFC6842, but some older, buggy + clients have problems with it."; } uses match-client-id; uses next-server; uses server-hostname; uses boot-file-name; - - leaf user-context { - type kea:user-context; - description "DHCPv4 server user context. Arbitrary JSON data can be stored here."; - } - - container sanity-checks { - description "Sanity checks."; - leaf lease-checks { - type enumeration { - enum "none" { - description "No checks."; - } - enum "warn" { - description "When a check fails print a warning and accept the - lease."; - } - enum "fix" { - description "When a check fails try to fix it and accept the - lease."; - } - enum "fix-del" { - description "When a check fails try to fix it and reject the - lease if still bad."; - } - enum "del" { - description "When a check fails reject the lease."; - } - } - default "warn"; - description "Lease checks: verify subnet-id consistency on memfile - loading."; + uses kea:user-context { + refine user-context { + description "DHCPv4 server user context. Arbitrary JSON data can + be stored here."; } } + uses dhcp:sanity-checks; + } + + container logging { + description "Logging"; + config true; + + uses logging:configuration; } /* * State data */ - grouping state { + container state { description "State of Kea DHCPv4 server."; + config false; container leases { description "Kea DHCPv4 leases."; @@ -831,11 +398,10 @@ module kea-dhcp4 { type binary; description "Lease client-id."; } - leaf valid-lifetime { - type uint32; - units "seconds"; - mandatory true; - description "Lease valid lifetime."; + uses dhcp:valid-lifetime { + refine valid-lifetime { + mandatory true; + } } leaf cltt { type uint32; @@ -864,7 +430,7 @@ module kea-dhcp4 { description "Lease hostname."; } leaf state { - type lease-state; + type dhcp:lease-state; default "default"; description "Lease state."; } @@ -905,42 +471,24 @@ module kea-dhcp4 { description "Kea DHCPv4 hosts."; list host { key "subnet-id identifier-type identifier"; - leaf identifier { - type string; - mandatory true; - description "Host identifier."; - } leaf identifier-type { type host-identifier-type; mandatory true; description "Host identifier type."; } - leaf subnet-id { - type uint32; - mandatory true; - description "Host subnet ID."; - } + uses dhcp:host-identifier; + uses dhcp:host-subnet-id; leaf ip-address { type inet:ipv4-address; description "Host reserved IP address."; } - leaf hostname { - type string; - description "Host name."; - } - leaf-list client-classes { - type string; - description "Host client classes. (if host identifier matches, a client's - packet will be added to the classes liste here)"; - } + uses dhcp:host-hostname; + uses dhcp:host-client-classes; uses option-data-list; uses next-server; uses server-hostname; uses boot-file-name; - leaf user-context { - type kea:user-context; - description "Host user context. Arbitrary JSON data can be stored here."; - } + uses dhcp:host-user-context; leaf auth-key { type string; description "Host authentication key (unused in DHCPv4)."; diff --git a/src/lib/yang/models/kea-dhcp6.yang b/src/lib/yang/models/kea-dhcp6.yang index 49aaeac027..55372493f2 100644 --- a/src/lib/yang/models/kea-dhcp6.yang +++ b/src/lib/yang/models/kea-dhcp6.yang @@ -12,11 +12,18 @@ module kea-dhcp6 { import kea-types { prefix kea; } + import kea-dhcp-types { + prefix dhcp; + } + import kea-logging { + prefix logging; + } + organization "Internet Systems Consortium"; contact "kea-dev@lists.isc.org"; description "This model defines a YANG data model that can be - used to configure and manage a Kea DHCPv6 server."; + used to configure and manage a Kea DHCPv6 server."; revision 2018-08-20 { description "Initial revision"; @@ -35,25 +42,6 @@ module kea-dhcp6 { description "Host identifier type."; } - typedef host-reservation-mode { - type enumeration { - enum "disabled"; - enum "out-of-pool"; - enum "all"; - enum "global"; - } - description "Host reservation mode."; - } - - typedef lease-state { - type enumeration { - enum "default"; - enum "declined"; - enum "expired-reclaimed"; - } - description "Defines state of the lease."; - } - /* * Groupings */ @@ -65,30 +53,6 @@ module kea-dhcp6 { } } - grouping valid-lifetime { - leaf valid-lifetime { - type uint32; - units "seconds"; - description "Valid lifetime."; - } - } - - grouping renew-timer { - leaf renew-timer { - type uint32; - units "seconds"; - description "Renew timer."; - } - } - - grouping rebind-timer { - leaf rebind-timer { - type uint32; - units "seconds"; - description "Rebind timer."; - } - } - grouping relay { leaf-list ip-addresses { type inet:ipv6-address; @@ -96,19 +60,27 @@ module kea-dhcp6 { } } + grouping rapid-commit { + leaf rapid-commit { + type boolean; + default false; + } + } + grouping subnet6-list { description "Subnet6 list."; list subnet6 { key id; ordered-by user; uses preferred-lifetime; - uses valid-lifetime; - uses renew-timer; - uses rebind-timer; + uses dhcp:valid-lifetime; + uses dhcp:renew-timer; + uses dhcp:rebind-timer; uses option-data-list; container pools { list pool { key "start-address end-address"; + ordered-by user; leaf prefix { type inet:ipv6-prefix; description "Pool prefix."; @@ -124,24 +96,15 @@ module kea-dhcp6 { description "Last IPv6 address in a pool."; } uses option-data-list; - leaf client-class { - type string; - description "Pool client class guard. (only clients belonging to this - class will be allowed in this pool)."; - } - leaf-list require-client-classes { - type string; - description "Pool require client classes."; - } - leaf user-context { - type kea:user-context; - description "Pool user context. Arbitrary JSON data can be stored here."; - } + uses dhcp:pool-client-class; + uses dhcp:pool-require-client-classes; + uses dhcp:pool-user-context; } } container pd-pools { list pd-pool { key prefix; + ordered-by user; leaf prefix { type inet:ipv6-prefix; mandatory true; @@ -152,23 +115,28 @@ module kea-dhcp6 { description "Prefix pool delegated length."; } uses option-data-list; - leaf client-class { - type string; - description "Prefix pool client class guard. (only clients belonging to this - class will be allowed in this pool)."; + uses dhcp:client-class { + refine client-class { + description "Prefix pool client class guard. (only + clients belonging to this class will be + allowed in this pool)."; + } } - leaf-list require-client-classes { - type string; - description "Prefix pool require client classes."; + uses dhcp:require-client-classes { + refine require-client-classes { + description "Prefix pool require client classes."; + } } leaf excluded-prefix { type inet:ipv6-prefix; description "Prefix pool excluded prefix."; } - leaf user-context { - type kea:user-context; - description "Prefix pool user context. Arbitrary JSON data can be stored here."; - } + uses kea:user-context { + refine user-context { + description "Prefix pool user context. Arbitrary JSON data + can be stored here."; + } + } } } leaf subnet { @@ -176,54 +144,27 @@ module kea-dhcp6 { mandatory true; description "IPv6 subnet prefix."; } - leaf interface { - type string; - description "Name of the network interface this subnet is directly - accessible with (optional)."; - } - leaf interface-id { - type string; - description "Subnet interface-id option."; - } - leaf id { - type uint32 { - range 1..max; + uses dhcp:subnet-interface; + uses dhcp:subnet-interface-id; + uses dhcp:subnet-id; + uses rapid-commit { + refine rapid-commit { + description "Subnet rapid commit flag."; } - mandatory true; - description "Subnet ID, a unique identifier used to locate or reference - a subnet."; - } - leaf rapid-commit { - type boolean; - default false; - description "Subnet rapid commit flag."; - } - leaf client-class { - type string; - description "Subnet client class guard (only clients belonging to this - clas will be allowed in this subnet)."; - } - leaf-list require-client-classes { - type string; - description "Subnet require client classes."; } + uses dhcp:subnet-client-class; + uses dhcp:require-client-classes; container reservations { - description "A container with host reservations specific to this IPv6 subnet."; + description "A container with host reservations specific to + this IPv6 subnet."; list host { key "identifier-type identifier"; leaf identifier-type { type host-identifier-type; + mandatory true; description "Host identifier type."; } - leaf identifier { - type string; - description "Host identifier."; - } - leaf-list client-classes { - type string; - description "Host client classes. (if host identifier matches, a client's - packet will be added to the classes liste here.)"; - } + uses dhcp:host-identifier; leaf-list ip-addresses { type inet:ipv6-address; description "Host reserved IP addresses."; @@ -232,143 +173,27 @@ module kea-dhcp6 { type inet:ipv6-prefix; description "Host reserved IP prefixes."; } - leaf hostname { - type string; - description "Host DNS name."; - } + uses dhcp:host-hostname; + uses dhcp:host-client-classes; uses option-data-list; - leaf user-context { - type kea:user-context; - description "Host user context."; - } + uses dhcp:host-user-context; } } - leaf reservation-mode { - type host-reservation-mode; - description "Subnet host reservation mode."; - } + uses dhcp:subnet-reservation-mode; container relay { description "Optional information about relay agent."; uses relay; } - leaf user-context { - type kea:user-context; - description "Subnet user context."; - } - } - } - - grouping database { - leaf database-type { - type string; - mandatory true; - description "Database type (e.g. mysql)."; - } - leaf user { - type string; - description "Database user name."; - } - leaf password { - type string; - description "Database user password."; - } - leaf host { - type string; - description "Database host."; - } - leaf name { - type string; - description "Database name."; - } - leaf persist { - type boolean; - default true; - description "Write lease to disk file. This parameter applies only to - memfile backend."; - } - leaf port { - type uint16; - description "Database port."; - } - leaf lfc-interval { - type uint32; - units "seconds"; - default 3600; - description "Interval between two lease file cleanups."; - } - leaf readonly { - type boolean; - default false; - description "If set to true, the database will be connected in read-only - mode. This does not make sense for lease databases, only for - host reservations and possibly for upcoming config backend."; - } - leaf connect-timeout { - type uint32; - units "milliseconds"; - description "Database connection timeout."; - } - leaf contact-points { - type string; - description "Cassandra database contact points."; - } - leaf keyspace { - type string; - description "Cassandra database keyspace."; - } - leaf max-reconnect-tries { - type uint32; - default 0; - description "Maximum of recovery attempts before exit."; - } - leaf reconnect-wait-time { - type uint32; - default 0; - units "milliseconds"; - description "Waiting delay between two recovery attempts."; - } - leaf request-timeout { - type uint32; - units "milliseconds"; - description "Timeout waiting for a response."; - } - leaf tcp-keepalive { - type uint32; - units "seconds"; - default 0; - description "TCP keepalive for the database connection."; - } - leaf tcp-nodelay { - type boolean; - default true; - description "TCP nodelay for the database connection."; - } - leaf user-context { - type kea:user-context; - description "Database user context."; + uses dhcp:subnet-user-context; } } grouping client-class { - leaf name { - type string; - mandatory true; - description "Client class name."; - } - leaf test { - type string; - description "Defines an expression that evaluates every incoming packet."; - } - leaf only-if-required { - type boolean; - default false; - description "Client class only if required flag."; - } + uses dhcp:class-name; + uses dhcp:class-test; + uses dhcp:class-only-if-required; uses option-data-list; - leaf user-context { - type kea:user-context; - description "Client class user context."; - } + uses dhcp:class-user-context; } grouping option-def-list { @@ -376,44 +201,22 @@ module kea-dhcp6 { description "Option definition list."; list option-def { key "code space"; - leaf name { - type string; - mandatory true; - description "Name of the new option being defined."; - } leaf code { type uint16; mandatory true; description "Option code to be used by the new option definition."; } - leaf type { - type string; - mandatory true; - description "Type of the new option being defined (such as string or uint8)."; - } - leaf record-types { - type string; - description "Option definition record types."; - } leaf space { type string; mandatory true; description "Option space for the new option (typically dhcp6)."; } - leaf encapsulate { - type string; - description "Defines option space this new option encapsulates. - Usually empty."; - } - leaf array { - type boolean; - default false; - description "Option definition array flag."; - } - leaf user-context { - type kea:user-context; - description "Option definition user context."; - } + uses dhcp:option-def-name; + uses dhcp:option-def-type; + uses dhcp:option-def-record-types; + uses dhcp:option-def-encapsulate; + uses dhcp:option-def-array; + uses dhcp:option-def-user-context; } } } @@ -423,14 +226,6 @@ module kea-dhcp6 { description "Option data list."; list option-data { key "code space"; - leaf name { - type string; - description "Option name."; - } - leaf data { - type string; - description "Option data."; - } leaf code { type uint16; mandatory true; @@ -441,40 +236,28 @@ module kea-dhcp6 { mandatory true; description "Option space."; } - leaf csv-format { - type boolean; - default true; - description "If true, the option is specified as comma separated values. - If false, it is expected as a hex string."; - } - leaf always-send { - type boolean; - default false; - description "Defines whether to always send the option, regardless if the - client requested it or not."; - } - leaf user-context { - type kea:user-context; - description "Option user context. Arbitrary JSON data can be stored here."; - } - } + uses dhcp:option-data-name; + uses dhcp:option-data-data; + uses dhcp:option-data-csv-format; + uses dhcp:option-data-always-send; + uses dhcp:option-data-user-context; + } } } - grouping configuration { - description "Contains parameters for DHCPv6 server configuration."; + /* + * Data Nodes + */ - uses preferred-lifetime; - uses valid-lifetime; - uses renew-timer; - uses rebind-timer; + container config { + description "Contains DHCPv6 server configuration."; + config true; - leaf decline-probation-period { - type uint32; - units "seconds"; - default 86400; - description "Decline probabation period."; - } + uses preferred-lifetime; + uses dhcp:valid-lifetime; + uses dhcp:renew-timer; + uses dhcp:rebind-timer; + uses dhcp:decline-probation-period; container subnet6 { description "Global subnet6 list."; @@ -485,54 +268,32 @@ module kea-dhcp6 { description "Defines a list of IPv6 shared networks."; list shared-network { key name; - leaf name { - type string; - mandatory true; - description "Shared network name."; - } + uses dhcp:network-name; container subnet6 { - description "List of IPv6 subnets that belong to this shared network."; + description "List of IPv6 subnets that belong to this shared + network."; uses subnet6-list; } - leaf interface { - type string; - description "Shared network interface."; - } - leaf interface-id { - type string; - description "Shared network interface-id option."; - } - uses renew-timer; - uses rebind-timer; + uses dhcp:network-interface; + uses dhcp:network-interface-id; + uses dhcp:renew-timer; + uses dhcp:rebind-timer; uses option-data-list; container relay { description "Optional information about relay agent."; uses relay; } - leaf reservation-mode { - type host-reservation-mode; - description "Shared network host reservation mode."; - } - leaf client-class { - type string; - description "Shared network client class guard (only clients belonging - to this class will be allowed in this shared network)."; - } - leaf-list require-client-classes { - type string; - description "Shared network require client classes."; - } + uses dhcp:network-reservation-mode; + uses dhcp:network-client-class; + uses dhcp:require-client-classes; uses preferred-lifetime; - leaf rapid-commit { - type boolean; - default false; - description "Shared network rapid commit flag."; - } - uses valid-lifetime; - leaf user-context { - type kea:user-context; - description "Shared network user context."; + uses rapid-commit { + refine rapid-commit { + description "Shared network rapid commit flag."; + } } + uses dhcp:valid-lifetime; + uses dhcp:network-user-context; } } @@ -543,30 +304,11 @@ module kea-dhcp6 { description "Name of the interface (e.g. eth0) or name/address (e.g. eth0/2001:db8::1) or * (use all interfaces)."; } - leaf re-detect { - type boolean; - default false; - description "Re-detect interfaces at each reconfiguration."; - } - leaf user-context { - type kea:user-context; - description "Interfaces user context."; - } - } - - container lease-database { - description "Lease database."; - presence "Enable lease database."; - uses database; + uses dhcp:interfaces-re-detect; + uses dhcp:interfaces-user-context; } - container hosts-databases { - description "Hosts databases."; - list hosts-database { - key database-type; - uses database; - } - } + uses dhcp:databases; leaf-list relay-supplied-options { type string; @@ -595,44 +337,7 @@ module kea-dhcp6 { uses option-def-list; uses option-data-list; uses kea:hooks-libraries; - - container expired-leases-processing { - description "Expired leases processing setup."; - leaf reclaim-timer-wait-time { - type uint32; - units "seconds"; - default 10; - description "Interval between reclamation cycles."; - } - leaf flush-reclaimed-timer-wait-time { - type uint32; - units "seconds"; - default 25; - description "Interval between reclaimed leases collection."; - } - leaf hold-reclaimed-time { - type uint32; - units "seconds"; - default 3600; - description "Hold timer for re-assignment."; - } - leaf max-reclaim-leases { - type uint32; - default 100; - description "Maximum number of reclaimed leases per cycle."; - } - leaf max-reclaim-time { - type uint32; - units "milliseconds"; - default 250; - description "Maximum duration of a reclamation cycle."; - } - leaf unwarned-reclaim-cycles { - type uint32; - default 5; - description "Maximum numbers of uncomplete cycles before warning."; - } - } + uses dhcp:expired-leases-processing; container server-id { description "Server DUID."; @@ -671,151 +376,31 @@ module kea-dhcp6 { } } - leaf dhcp4o6-port { - type uint16; - description "DHCPv4-over-DHCPv6 interserver port."; - } - - container control-socket { - description "Control socket"; - presence "Enable control socket."; - uses kea:control-socket; - } - - container dhcp-ddns { - description "DHCP-DDNS client setup."; - leaf enable-updates { - type boolean; - default false; - description "Enable DHCP-DDNS updates."; - } - leaf qualifying-suffix { - type string; - description "DHCP-DDNS qualifying suffix."; - } - leaf server-ip { - type inet:ip-address; - default "127.0.0.1"; - description "DHCP-DDNS server IP address."; - } - leaf server-port { - type uint16; - default 53001; - description "DHCP-DDNS server port."; - } - leaf sender-ip { - type inet:ip-address; - description "DHCP-DDNS sender IP address."; - } - leaf sender-port { - type uint16; - description "DHCP-DDNS sender port."; - } - leaf max-queue-size { - type uint32; - default 1024; - description "Maximum DHCP-DDNS queue size."; - } - leaf ncr-protocol { - type enumeration { - enum "UDP"; - enum "TCP"; - } - default "UDP"; - description "Protocol to use for DHCP-DDNS communication. - Currently only UDP is supported."; - } - leaf ncr-format { - type enumeration { - enum "JSON"; - } - default "JSON"; - description "Packet format to use for DHCP-DDNS."; - } - leaf always-include-fqdn { - type boolean; - description "???"; - } - leaf override-no-update { - type boolean; - default false; - description "Ignore client request and send update."; - } - leaf override-client-update { - type boolean; - default false; - description "Ignore client delegation."; - } - leaf replace-client-name { - type enumeration { - enum "when-present"; - enum "never"; - enum "always"; - enum "when-not-present"; - } - default "never"; - description "Replace the name provided by the client."; - } - leaf generated-prefix { - type string; - default "myhost"; - description "DHCP-DDNS generated prefix."; - } - leaf hostname-char-set { - type string; - description "A regex defining invalid characters. If detected, those - will be replaced by hostname-char-replacement."; - } - leaf hostname-char-replacement { - type string; - description "Replacement for invalid charaters. See hostname-char-set."; - } - leaf user-context { - type kea:user-context; - description "DHCP-DDNS user context. Arbitrary JSON data can be stored here."; + uses dhcp:dhcp4o6-port; + uses dhcp:control-socket; + uses dhcp:dhcp-ddns; + uses kea:user-context { + refine user-context { + description "DHCPv6 server user context. Arbitrary JSON data can + be stored here."; } } + uses dhcp:sanity-checks; + } - leaf user-context { - type kea:user-context; - description "DHCPv6 server user context. Arbitrary JSON data can be stored here."; - } + container logging { + description "Logging"; + config true; - container sanity-checks { - description "Sanity checks."; - leaf lease-checks { - type enumeration { - enum "none" { - description "No checks."; - } - enum "warn" { - description "When a check fails print a warning and accept the - lease."; - } - enum "fix" { - description "When a check fails try to fix it and accept the - lease."; - } - enum "fix-del" { - description "When a check fails try to fix it and reject the - lease if still bad."; - } - enum "del" { - description "When a check fails reject the lease."; - } - } - default "warn"; - description "Lease checks: verify subnet-id consistency on memfile - loading."; - } - } + uses logging:configuration; } /* * State data */ - grouping state { + container state { description "State of Kea DHCPv6 server."; + config false; container leases { description "Kea DHCPv6 leases."; @@ -831,11 +416,10 @@ module kea-dhcp6 { mandatory true; description "Lease DUID."; } - leaf valid-lifetime { - type uint32; - units "seconds"; - mandatory true; - description "Lease valid lifetime."; + uses dhcp:valid-lifetime { + refine valid-lifetime { + mandatory true; + } } leaf cltt { type uint32; @@ -890,7 +474,7 @@ module kea-dhcp6 { description "Lease hostname."; } leaf state { - type lease-state; + type dhcp:lease-state; default "default"; description "Lease state."; } @@ -910,7 +494,7 @@ module kea-dhcp6 { key subnet-id; leaf subnet-id { type uint32; - mandatory true; + mandatory true; description "Subnet ID."; } leaf total-nas { @@ -945,21 +529,13 @@ module kea-dhcp6 { description "Kea DHCPv6 hosts."; list host { key "subnet-id identifier-type identifier"; - leaf identifier { - type string; - mandatory true; - description "Host identifier."; - } leaf identifier-type { type host-identifier-type; mandatory true; description "Host identifier type."; } - leaf subnet-id { - type uint32; - mandatory true; - description "Host subnet ID."; - } + uses dhcp:host-identifier; + uses dhcp:host-subnet-id; leaf-list ip-addresses { type inet:ipv6-address; description "Host reserved IP addresses."; @@ -968,19 +544,10 @@ module kea-dhcp6 { type inet:ipv6-prefix; description "Host reserved prefixes."; } - leaf hostname { - type string; - description "Host name."; - } - leaf-list client-classes { - type string; - description "Host client classes."; - } + uses dhcp:host-hostname; + uses dhcp:host-client-classes; uses option-data-list; - leaf user-context { - type kea:user-context; - description "Host user context."; - } + uses dhcp:host-user-context; leaf auth-key { type string; description "Host authentication key."; diff --git a/src/lib/yang/models/kea-dhcpddns.yang b/src/lib/yang/models/kea-dhcpddns.yang index af7fb767b1..2de9e735c9 100644 --- a/src/lib/yang/models/kea-dhcpddns.yang +++ b/src/lib/yang/models/kea-dhcpddns.yang @@ -12,6 +12,9 @@ module kea-dhcpddns { import kea-types { prefix kea; } + import kea-logging { + prefix logging; + } organization "Internet Systems Consortium"; contact "kea-dev@lists.isc.org"; @@ -76,8 +79,13 @@ module kea-dhcpddns { } } - grouping configuration { - description "Contains parameters for DHCP-DDNS server configuration."; + /* + * Data Nodes + */ + + container config { + description "Contains DHCP-DDNS server configuration."; + config true; leaf ip-address { type inet:ip-address; @@ -159,4 +167,11 @@ module kea-dhcpddns { description "DHCP-DDNS server user context."; } } + + container logging { + description "Logging"; + config true; + + uses logging:configuration; + } } diff --git a/src/lib/yang/models/kea-dhcpv4-server.yang b/src/lib/yang/models/kea-dhcpv4-server.yang deleted file mode 100644 index 9d6a7bbf22..0000000000 --- a/src/lib/yang/models/kea-dhcpv4-server.yang +++ /dev/null @@ -1,585 +0,0 @@ -module ietf-dhcpv4-server { - yang-version 1.1; - namespace "urn:ietf:params:xml:ns:yang:ietf-dhcpv4-server"; - prefix "dhcpv4-server"; - - import ietf-inet-types { - prefix inet; - } - import ietf-yang-types { - prefix yang; - } - import ietf-dhcpv4-options { - prefix dhcpv4-options; - } - import ietf-dhcpv4-types { - prefix dhcpv4-types; - } - import ietf-interfaces { - prefix if; - } - - organization "ISC"; - - contact - "The Kea DHCPv4 model is now maitained by ISC, please send - your comments to the kea-dev@lists.isc.org mailing list. - - The original author was Piotr Strzyżewski - piotr.strzyzewski@polsl.pl"; - - description - "This model defines a YANG data model that can be - used to configure and manage Kea DHCPv4 server."; - - revision 2018-07-14 { - description "Initial revision; mostly based on DHCPv6 version"; - reference ""; - } - - /* - * Typedef - */ - typedef threshold { - type union { - type uint16 { - range 0..100; - } - type enumeration { - enum "disabled" { - description "No threshold"; - } - } - } - description "Threshold value in percent"; - } - - /* - * Data Nodes - */ - container server { - presence "Enables the server"; - description "DHCPv4 server portion"; - - /* - * Configuration data - */ - container server-config { - description "This container contains the configuration data - of a server."; - container serv-attributes { - description - "This container contains basic attributes of a DHCPv4 server - such as IPv4 address, server name and so on. Some optional - functions that can be provided by the server are also included."; - leaf name { - type string; - description "server's name"; - } - leaf description { - type string; - description "description of the server."; - } - leaf-list ipv4-address { - type inet:ipv4-address; - description "server's IPv4 address."; - } - leaf-list interfaces-config { - // Note - this should probably be references to - // entries in the ietf-interfaces model - type if:interface-ref; - description "A leaf list to denote which one or more interfaces - the server should listen on. The default value is to listen - on all the interfaces. This node is also used to set a unicast - address for the server to listen with a specific interface. - For example, if someone want the server to listen on a unicast - address with a specific interface, she/he can use the format - like 'eth0/192.0.2.1'."; - } - uses dhcpv4-types:vendor-infor; - } - - container option-sets { - description "DHCPv4 employs various options to carry additional - information and parameters in DHCP messages. This container defines - all the possible options that need to be configured at the server - side."; - list option-set { - key option-set-id; - description "A server may allow different option sets to be - configured for different conditions (i.e. different networks, - clients and etc). This 'option-set' list enables various sets of - options being defined and configured in a single server. Different - sets are distinguished by the key called 'option-set-id'. All the - possible options discussed above are defined in the list and each - option is corresponding to a container. Since all the options in - the list are optional, each container in this list has a 'presence' - statement to indicate whether this option (container) will be - included in the current option set or not. In addition, each container - also has a 'if-feature' statement to indicate whether the server - supports this option (container)."; - leaf option-set-id { - type uint32; - description "option set id"; - } - uses dhcpv4-options:server-option-definitions; - } - } - - container network-ranges { - description "This model supports a hierarchy to achieve dynamic - configuration. This level represents IPv4 subnets. The top level is a global - level which is defined as the container 'network-ranges'. The following - levels are defined as sub-containers under it. The 'network-ranges' - (which reprents pools within subnets) contains the parameters - (e.g. option-sets) that would be allocated to all the clients served by - this server."; - - leaf option-set-id { - type leafref { - path "/server/server-config/option-sets/option-set/option-set-id"; - } - description - "The ID field of relevant global option-set to be provisioned to - clients."; - } - list network-range { - key network-range-id; - description - "Under the 'network-ranges' container, a 'network-range' list - is defined to configure the server at a network level which is also - considered as the second level. Different network are identified by the - key 'network-range-id'. This is because a server may have different - configuration parameters (e.g. option sets) for different networks."; - leaf network-range-id { - type uint32; - mandatory true; - description "equivalent to subnet id"; - } - leaf network-description { - type string; - description "description of the subnet"; - } - leaf network-prefix { - type inet:ipv4-prefix; - mandatory true; - description "subnet prefix"; - } - leaf option-set-id { - type leafref { - path "/server/server-config/option-sets/option-set/option-set-id"; - } - description "The ID field of relevant option-set to be provisioned to - clients of this network-range."; - } - - container address-pools { - description - "A container that describes the DHCPv4 server's - address pools."; - list address-pool { - key pool-id; - description "A DHCPv4 server can be configured with - several address pools. This list defines such address pools - which are distinguished by the key called 'pool-id'."; - leaf pool-id { - type uint32; - mandatory true; - description "pool id"; - } - leaf pool-prefix { - type inet:ipv4-prefix; - mandatory true; - description "pool prefix"; - } - leaf start-address { - type inet:ipv4-address-no-zone; - mandatory true; - description "start address"; - } - leaf end-address { - type inet:ipv4-address-no-zone; - mandatory true; - description "end address"; - } - leaf renew-time { - type uint32; - units "seconds"; - description "renew time"; - } - leaf rebind-time { - type uint32; - units "seconds"; - description "rebind time"; - } -// leaf rapid-commit { -// type boolean; -// mandatory false; -// description "A boolean value specifies whether the pool -// supports client-server exchanges involving two messages."; -// } - leaf client-class { - type string; - description - "If this leaf is specified, this pool will only serve - the clients belonging to this class."; - } - leaf max-address-count { - type threshold; - description "maximum count of addresses that can - be allocated in this pool. This value may be - less than count of total addresses."; - } - leaf option-set-id { - type leafref { - path "/server/server-config/option-sets/option-set/option-set-id"; - } - description "The ID field of relevant option-set to be - provisioned to clients of this address-pool."; - } - } - } - - container host-reservations { - description - "This container allows the server to make reservations at host level."; - list host-reservation { - key cli-id; - description "This list allows the server to reserve addresses, - prefixes, hostname and options for different clients."; - leaf cli-id { - type uint32; - mandatory true; - description "client id"; - } - - choice client-identifier { - description "When making reservations, the server needs to choose a - identifier to identify the client. Currently 'Client ID' and - 'hardware address' are supported."; - case client-id { - description "Client ID"; - leaf client-ident { - type string; - description "Client ID"; - } - } - case hw-address { - description "hardware address"; - leaf hardware-address { - type yang:mac-address; - description "MAC address of client"; - } - } - } - - leaf-list reserv-addr { - type inet:ipv4-address-no-zone; - description "reserved addr"; - } - - leaf hostname { - type string; - description "reserved hostname"; - } - - leaf option-set-id { - type leafref { - path "/server/server-config/option-sets/option-set/option-set-id"; - } - description "The ID field of relevant option-set to be provisioned - in the host reservation."; - } - } - } - - } - } - -/* - container relay-opaque-paras { - description "This container contains some opaque values in Relay Agent - options that need to be configured on the server side only for value - match. Such Relay Agent options include Interface-Id option, - Remote-Id option and Subscriber-Id option."; - list relays { - key relay-name; - description "relay agents"; - leaf relay-name { - type string; - mandatory true; - description "relay agent name"; - } - list interface-info { - key if-name; - description "interface info"; - leaf if-name { - type string; - mandatory true; - description "interface name"; - } - leaf interface-id { - type string; - mandatory true; - description "interface id"; - } - } - list subscribers { - key subscriber; - description "subscribers"; - leaf subscriber { - type uint32; - mandatory true; - description "subscriber"; - } - leaf subscriber-id { - type string; - mandatory true; - description "subscriber id"; - } - } - list remote-host { - key ent-num; - description "remote host"; - leaf ent-num { - type uint32; - mandatory true; - description "enterprise number"; - } - leaf remote-id { - type string; - mandatory true; - description "remote id"; - } - } - } - } -*/ - } - - /* - * State data - */ - container server-state { - config "false"; - description "states of server"; - container network-ranges { - description "This model supports a hierarchy to achieve dynamic configuration. - That is to say we could configure the server at different levels through - this model. The top level is a global level which is defined as the container - 'network-ranges'. The following levels are defined as sub-containers under it. - The 'network-ranges' contains the parameters (e.g. option-sets) that would be - allocated to all the clients served by this server."; - list network-range { - key network-range-id; - description "The ID field of relevant option-set to be provisioned - to clients of this network-range."; - leaf network-range-id { - type uint32; - mandatory true; - description "equivalent to subnet id"; - } - container address-pools { - description "A container that describes the DHCPv4 server's address pools"; - list address-pool { - key pool-id; - description "A DHCPv4 server can be configured with - several address pools. This list defines such address pools - which are distinguished by the key called 'pool-id'."; - leaf pool-id { - type uint32; - mandatory true; - description "pool id"; - } - leaf total-address-count { - type uint32; - mandatory true; - description "count of total addresses in the pool"; - } - leaf allocated-address-conut { - type uint32; - mandatory true; - description "count of allocated addresses in the pool"; - } - } - list binding-info { - key cli-id; - description "A list that records a binding information for each DHCPv4 - client that has already been allocated IPv4 addresses."; - leaf cli-id { - type uint32; - mandatory true; - description "client id"; - } - list cli-hw { - key hw-address; - description "client host id"; - leaf hw-address { - type yang:mac-address; - mandatory true; - description "HW address"; - } - leaf-list cli-addr { - type inet:ipv4-address; - description "client addr"; - } - leaf pool-id { - type uint32; - mandatory true; - description "pool id"; - } - } - } - } - - container host-reservations { - description "This container provides host reservations in the host level."; - list binding-info { - key cli-id; - description - "A list records a binding information for each DHCPv4 - client that has already been alloated IPv4 addresses or prefixes - by host reservations."; - leaf cli-id { - type uint32; - mandatory true; - description "client id"; - } - list cli-hw { - key hw-address; - description "client host id"; - leaf hw-address { - type yang:mac-address; - mandatory true; - description "HW address"; - } - leaf-list cli-addr { - type inet:ipv4-address; - description "client addr"; - } - } - } - } - - } - } - - container packet-stats { - description "A container presents the packet statistics related to - the DHCPv4 server."; - leaf request-count { - type uint32; - mandatory true; - description "request counter"; - } - leaf renew-count { - type uint32; - mandatory true; - description "renew counter"; - } - leaf rebind-count { - type uint32; - mandatory true; - description "rebind counter"; - } - leaf decline-count { - type uint32; - mandatory true; - description "decline count"; - } - leaf release-count { - type uint32; - mandatory true; - description "release counter"; - } - leaf info-req-count { - type uint32; - mandatory true; - description "information request counter"; - } - leaf advertise-count { - type uint32; - mandatory true; - description "advertise counter"; - } - leaf confirm-count { - type uint32; - mandatory true; - description "confirm counter"; - } - leaf reconfigure-count { - type uint32; - mandatory true; - description "reconfigure counter"; - } - leaf relay-forward-count { - type uint32; - mandatory true; - description "relay forward counter"; - } - leaf relay-reply-count { - type uint32; - mandatory true; - description "relay reply counter"; - } - } - } - } - - /* - * Notifications - */ - - notification notifications { - description "dhcpv4 server notification module"; - container dhcpv4-server-event { - description "dhcpv4 server event"; - container address-pool-running-out { - description "Raised when the address pool is going to - run out. A threshold for utilization ratio of the pool has - been defined in the server feature so that it will notify the - administrator when the utilization ratio reaches the - threshold, and such threshold is a settable parameter."; - leaf total-address-count { - type uint32; - mandatory true; - description "Count of total addresses in the pool."; - } - leaf max-address-count { - type uint32; - mandatory true; - description "Maximum count of addresses that can be allocated - in the pool. This value may be less than count of total - addresses."; - } - leaf allocated-address-conut { - type uint32; - mandatory true; - description "Count of allocated addresses in the pool."; - } - leaf serv-name { - type string; - description "server name"; - } - leaf pool-name { - type string; - mandatory true; - description "pool name"; - } - } - container invalid-client-detected { - description "Raised when the server has found a client which - can be regarded as a potential attacker. Some description - could also be included."; - leaf hw { - type yang:mac-address; - description "HW address"; - } - leaf description { - type string; - description "description of the event"; - } - } - } - } -} diff --git a/src/lib/yang/models/kea-server.yang b/src/lib/yang/models/kea-server.yang deleted file mode 100644 index 536600f244..0000000000 --- a/src/lib/yang/models/kea-server.yang +++ /dev/null @@ -1,85 +0,0 @@ -module kea-server { - yang-version 1.1; - namespace "urn:ietf:params:xml:ns:yang::kea-server"; - prefix "kea-server"; - - import kea-dhcp4 { - prefix dhcp4; - } - import kea-dhcp6 { - prefix dhcp6; - } - import kea-dhcpddns { - prefix d2; - } - import kea-control-agent { - prefix agent; - } - import kea-logging { - prefix logging; - } - - organization "Internet Systems Consortium"; - contact "kea-dev@lists.isc.org"; - description "This model defines a YANG data model that can be - used to define some commonly used Kea server"; - - revision 2018-08-20 { - description "Initial revision"; - reference ""; - } - - /* - * Data Nodes - */ - container dhcp4 { - presence "Enables DHCPv4 server"; - description "DHCPv4 server configuration"; - - uses dhcp4:configuration; - } - - container dhcp6 { - presence "Enables DHCPv6 server"; - description "DHCPv6 server configuration"; - - uses dhcp6:configuration; - } - - container dhcpddns { - presence "Enables DHCP-DDNS server"; - description "DHCP-DDNS server configuration"; - - uses d2:configuration; - } - - container control-agent { - presence "Enables control agent"; - description "Control agent configuration"; - - uses agent:configuration; - } - - container logging { - description "Logging"; - - uses logging:configuration; - } - - /* - * State data - */ - container state { - config true; - - container dhcp4 { - description "DHCPv4 server state."; - uses dhcp4:state; - } - - container dhcp6 { - description "DHCPv6 server state."; - uses dhcp6:state; - } - } -} diff --git a/src/lib/yang/models/kea-types.yang b/src/lib/yang/models/kea-types.yang index e6954e9512..7639600393 100644 --- a/src/lib/yang/models/kea-types.yang +++ b/src/lib/yang/models/kea-types.yang @@ -12,8 +12,7 @@ module kea-types { organization "Internet Systems Consortium"; contact "kea-dev@lists.isc.org"; - description "This model defines a YANG data model that can be - used to define some commonly used Kea types"; + description "This file defines some commonly used Kea types and groupings."; revision 2018-08-20 { description "Initial revision"; @@ -31,6 +30,12 @@ module kea-types { /* * Grouping */ + grouping user-context { + leaf user-context { + type user-context; + } + } + grouping control-socket { description "Control socket."; leaf socket-name { |