From: Francis Dupont Date: Fri, 31 Aug 2018 13:44:47 +0000 (+0200) Subject: [65-libyang-models] Added missing models X-Git-Tag: 65-libyang-models-update_base~1^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=315dc3e931550e5ce73eeb3e1406a1488c62f3a4;p=thirdparty%2Fkea.git [65-libyang-models] Added missing models --- diff --git a/src/lib/yang/models/ietf-dhcpv4-server.yang b/src/lib/yang/models/ietf-dhcpv4-server.yang new file mode 100644 index 0000000000..d156f7e75a --- /dev/null +++ b/src/lib/yang/models/ietf-dhcpv4-server.yang @@ -0,0 +1,578 @@ +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 "DHC WG"; + contact + "piotr.strzyzewski@polsl.pl"; + description "This model defines a YANG data model that can be + used to configure and manage a 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 is 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. 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."; + + 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/ietf-kea-dhcpv6.yang b/src/lib/yang/models/ietf-kea-dhcpv6.yang new file mode 100644 index 0000000000..eb736cb10e --- /dev/null +++ b/src/lib/yang/models/ietf-kea-dhcpv6.yang @@ -0,0 +1,315 @@ +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 new file mode 100644 index 0000000000..c1f1621cf5 --- /dev/null +++ b/src/lib/yang/models/kea-control-agent.yang @@ -0,0 +1,74 @@ +module kea-control-agent { + yang-version 1.1; + namespace "urn:ietf:params:xml:ns:yang::kea-control-agent"; + prefix "kea-control-agent"; + + 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 model defines a YANG data model that can be + used to configure and manage a Kea control agent."; + + revision 2018-08-20 { + description "Initial revision"; + reference ""; + } + + /* + * Groupings + */ + + grouping configuration { + description "Contains parameters for control agent configuration."; + + leaf http-host { + type inet:ip-address; + default "127.0.0.1"; + description "IP address to which HTTP service will be bound."; + } + + leaf http-port { + type uint16; + default 8000; + description "Port to which HTTP service will be bound."; + } + + container control-sockets { + list socket { + key server-type; + leaf server-type { + type enumeration { + enum "dhcp4"; + enum "dhcp6"; + enum "d2"; + } + mandatory true; + description "Server type."; + } + container control-socket { + description "Control socket information."; + uses kea:control-socket; + } + } + } + + container hooks-libraries { + description "Hooks libraries."; + uses kea:hooks-libraries; + } + + leaf user-context { + type kea:user-context; + description "Control agent user context."; + } + } +} diff --git a/src/lib/yang/models/kea-dhcp4.yang b/src/lib/yang/models/kea-dhcp4.yang new file mode 100644 index 0000000000..6dc8bf1147 --- /dev/null +++ b/src/lib/yang/models/kea-dhcp4.yang @@ -0,0 +1,921 @@ +module kea-dhcp4 { + yang-version 1.1; + namespace "urn:ietf:params:xml:ns:yang::kea-dhcp4"; + prefix "kea-dhcp4"; + + 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 model defines a YANG data model that can be + used to configure and manage a Kea DHCPv4 server."; + + revision 2018-08-20 { + description "Initial revision"; + reference ""; + } + + /* + * Typedefs + */ + typedef host-identifier-type { + type enumeration { + enum "duid"; + enum "hw-address"; + enum "circuit-id"; + enum "client-id"; + enum "flex-id"; + } + description "Host identifier type."; + } + + 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 "Lease state."; + } + + /* + * 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; + default true; + description "Use client-id for lease lookups."; + } + } + + grouping next-server { + leaf next-server { + type inet:ipv4-address; + description "Next server."; + } + } + + grouping server-hostname { + leaf server-hostname { + type string; + description "Server hostname."; + } + } + + grouping boot-file-name { + leaf boot-file-name { + type string; + description "Boot file name."; + } + } + + grouping relay { + leaf-list ip-addresses { + type inet:ipv4-address; + description "IP addresses."; + } + } + + grouping subnet4-list { + description "Subnet4 list."; + list subnet4 { + key id; + ordered-by user; + uses valid-lifetime; + uses renew-timer; + uses rebind-timer; + uses option-data-list; + container pools { + list pool { + key "start-address end-address"; + leaf prefix { + type inet:ipv4-prefix; + description "Pool prefix."; + } + leaf start-address { + type inet:ipv4-address; + mandatory true; + description "Pool start address."; + } + leaf end-address { + type inet:ipv4-address; + mandatory true; + description "Pool end address."; + } + uses option-data-list; + leaf client-class { + type string; + description "Pool client class guard."; + } + leaf-list require-client-classes { + type string; + description "Pool require client classes."; + } + leaf user-context { + type kea:user-context; + description "Pool user context."; + } + } + } + leaf subnet { + type inet:ipv4-prefix; + mandatory true; + description "Subnet prefix."; + } + leaf interface { + type string; + description "Subnet interface."; + } + leaf interface-id { + type string; + description "Subnet interface-id option."; + } + leaf id { + type uint32 { + range 1..max; + } + mandatory true; + description "Subnet ID."; + } + leaf client-class { + type string; + description "Subnet client class guard."; + } + leaf-list require-client-classes { + type string; + description "Subnet require client classes."; + } + container reservations { + description "Subnet host reservations."; + 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."; + } + leaf ip-address { + type inet:ipv4-address; + description "Host reserved IP address."; + } + leaf hostname { + type string; + description "Host DNS name."; + } + 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."; + } + } + } + leaf reservation-mode { + type host-reservation-mode; + description "Subnet host reservation mode."; + } + container relay { + description "Relay."; + uses relay; + } + uses match-client-id; + uses next-server; + uses server-hostname; + uses boot-file-name; + leaf subnet-4o6-interface { + type string; + description "Subnet DHCPv4-over-DHCPv6 interface."; + } + leaf subnet-4o6-interface-id { + type string; + description "Subnet DHCPv4-over-DHCPv6 interface-id option."; + } + leaf subnet-4o6-subnet { + type inet:ipv6-prefix; + description "Subnet DHCPv4-over-DHCPv6 IPv6 prefix."; + } + 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."; + } + 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 "Read-only database."; + } + leaf connect-timeout { + type uint32; + description "Database connection timeout."; + } + leaf-list contact-points { + type inet:ip-address; + 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; + description "Waiting delay between two recovery attempts."; + } + leaf request-timeout { + type uint32; + 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."; + } + } + + grouping client-class { + leaf name { + type string; + mandatory true; + description "Client class name."; + } + leaf test { + type string; + description "Client class test expression."; + } + leaf only-if-required { + type boolean; + default false; + description "Client class only if required flag."; + } + 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."; + } + } + + grouping option-def-list { + container option-def-list { + description "Option definition list."; + list option-def { + key "code space"; + leaf name { + type string; + mandatory true; + description "Option definition name."; + } + leaf code { + type uint8; + mandatory true; + description "Option definition code."; + } + leaf type { + type string; + mandatory true; + description "Option definition type."; + } + leaf record-types { + type string; + description "Option definition record types."; + } + leaf space { + type string; + mandatory true; + description "Option definition space."; + } + leaf encapsulate { + type string; + description "Option definition encapsulate."; + } + leaf array { + type boolean; + default false; + description "Option definition array flag."; + } + leaf user-context { + type kea:user-context; + description "Option definition user context."; + } + } + } + } + + grouping option-data-list { + container option-data-list { + 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; + description "Option code."; + } + leaf space { + type string; + mandatory true; + description "Option space."; + } + leaf csv-format { + type boolean; + default true; + description "Option CSV format flag."; + } + leaf always-send { + type boolean; + default false; + description "Option always send flag."; + } + leaf user-context { + type kea:user-context; + description "Option user context."; + } + } + } + } + + grouping configuration { + description "Contains parameters for DHCPv4 server configuration."; + + uses valid-lifetime; + uses renew-timer; + uses rebind-timer; + + leaf decline-probation-period { + type uint32; + units "seconds"; + default 86400; + description "Decline probabation period."; + } + + container subnet4 { + description "Global subnet4 list."; + uses subnet4-list; + } + + container shared-networks { + description "Shared networks."; + list shared-network { + key name; + leaf name { + type string; + mandatory true; + description "Shared network name."; + } + container subnet4 { + description "Shared network subnet4 list."; + uses subnet4-list; + } + leaf interface { + type string; + description "Shared network interface."; + } + uses renew-timer; + uses rebind-timer; + uses option-data-list; + uses match-client-id; + uses next-server; + uses server-hostname; + uses boot-file-name; + container relay { + description "Relay."; + 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."; + } + 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."; + } + } + } + + container interfaces-config { + description "Interfaces configuration."; + leaf-list interfaces { + type string; + description "Interface name or name/address or *."; + } + leaf dhcp-socket-type { + type enumeration { + enum "raw" { + description "DHCP service uses RAW sockets."; + } + enum "udp" { + description "DHCP service uses UDP sockets."; + } + } + default "raw"; + description "Type of sockets to use."; + } + leaf outbound-interface { + type enumeration { + enum "same-as-inbound" { + description "Send the response on the interface where the query + was received."; + } + enum "use-routing" { + description "Use kernel routing."; + } + } + 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."; + } + } + + 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; + } + } + + leaf-list host-reservation-identifiers { + type host-identifier-type; + description "Host reservation identifier."; + } + + container client-classes { + description "Client classes."; + list client-class { + key name; + ordered-by user; + uses client-class; + } + } + + 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."; + } + 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 "Invalid character set in hostnames."; + } + leaf hostname-char-replacement { + type string; + description "Replacement for invalid charaters."; + } + leaf user-context { + type kea:user-context; + description "DHCP-DDNS user context."; + } + } + + leaf echo-client-id { + type boolean; + default true; + description "Send client-id when the client sent 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."; + } + + 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."; + } + } + } + + /* + * State data + */ + grouping state { + description "State of Kea DHCPv4 server."; + + container leases { + description "Kea DHCPv4 leases."; + list lease { + key ip-address; + leaf ip-address { + type inet:ipv4-address; + mandatory true; + description "Lease IP address."; + } + leaf hw-address { + type binary; + mandatory true; + description "Lease hardware address."; + } + leaf client-id { + type binary; + description "Lease client-id."; + } + leaf valid-lifetime { + type uint32; + units "seconds"; + mandatory true; + description "Lease valid lifetime."; + } + leaf cltt { + type uint32; + units "seconds"; + mandatory true; + description "Lease client last transmission time."; + } + leaf subnet-id { + type uint32; + mandatory true; + description "Lease subnet ID."; + } + leaf fqdn-fwd { + type boolean; + default false; + description "Lease FQDN forward flag."; + } + leaf fqdn-rev { + type boolean; + default false; + description "Lease FQDN reverse lag."; + } + leaf hostname { + type string; + default ""; + description "Lease hostname."; + } + leaf state { + type lease-state; + default "default"; + description "Lease state."; + } + leaf user-context { + type kea:user-context; + description "Lease user context."; + } + } + } + + container lease-stats { + list subnet { + key subnet-id; + leaf subnet-id { + type uint32; + mandatory true; + description "Subnet ID."; + } + leaf total-addresses { + type uint32; + mandatory true; + description "Total addresses counter."; + } + leaf assigned-addresses { + type uint32; + mandatory true; + description "Assigned addresses counter."; + } + leaf declined-addresses { + type uint32; + mandatory true; + description "Declined addresses counter."; + } + } + } + + container hosts { + 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."; + } + 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."; + } + 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."; + } + leaf auth-key { + type string; + description "Host authentication key."; + } + } + } + } +} diff --git a/src/lib/yang/models/kea-dhcp6.yang b/src/lib/yang/models/kea-dhcp6.yang new file mode 100644 index 0000000000..2572b3653a --- /dev/null +++ b/src/lib/yang/models/kea-dhcp6.yang @@ -0,0 +1,971 @@ +module kea-dhcp6 { + yang-version 1.1; + namespace "urn:ietf:params:xml:ns:yang::kea-dhcp6"; + prefix "kea-dhcp6"; + + 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 model defines a YANG data model that can be + used to configure and manage a Kea DHCPv6 server."; + + revision 2018-08-20 { + description "Initial revision"; + reference ""; + } + + /* + * Typedefs + */ + typedef host-identifier-type { + type enumeration { + enum "duid"; + enum "hw-address"; + enum "flex-id"; + } + description "Host identifier type."; + } + + 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 "Lease state."; + } + + /* + * Groupings + */ + grouping preferred-lifetime { + leaf preferred-lifetime { + type uint32; + units "seconds"; + description "Preferred lifetime."; + } + } + + 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; + description "IP addresses."; + } + } + + 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 option-data-list; + container pools { + list pool { + key "start-address end-address"; + leaf prefix { + type inet:ipv6-prefix; + description "Pool prefix."; + } + leaf start-address { + type inet:ipv6-address; + mandatory true; + description "Pool start address."; + } + leaf end-address { + type inet:ipv6-address; + mandatory true; + description "Pool end address."; + } + uses option-data-list; + leaf client-class { + type string; + description "Pool client class guard."; + } + leaf-list require-client-classes { + type string; + description "Pool require client classes."; + } + leaf user-context { + type kea:user-context; + description "Pool user context."; + } + } + } + container pd-pools { + list pd-pool { + key prefix; + leaf prefix { + type inet:ipv6-prefix; + mandatory true; + description "Prefix pool prefix."; + } + leaf delegated-len { + type uint8; + description "Prefix pool delegated length."; + } + uses option-data-list; + leaf client-class { + type string; + description "Prefix pool client class guard."; + } + leaf-list require-client-classes { + type string; + 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."; + } + } + } + leaf subnet { + type inet:ipv6-prefix; + mandatory true; + description "Subnet prefix."; + } + leaf interface { + type string; + description "Subnet interface."; + } + leaf interface-id { + type string; + description "Subnet interface-id option."; + } + leaf id { + type uint32 { + range 1..max; + } + mandatory true; + description "Subnet ID."; + } + leaf rapid-commit { + type boolean; + default false; + description "Subnet rapid commit flag."; + } + leaf client-class { + type string; + description "Subnet client class guard."; + } + leaf-list require-client-classes { + type string; + description "Subnet require client classes."; + } + container reservations { + description "Subnet host reservations."; + 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."; + } + leaf-list ip-addresses { + type inet:ipv6-address; + description "Host reserved IP addresses."; + } + leaf-list prefixes { + type inet:ipv6-prefix; + description "Host reserved IP prefixes."; + } + leaf hostname { + type string; + description "Host DNS name."; + } + uses option-data-list; + leaf user-context { + type kea:user-context; + description "Host user context."; + } + } + } + leaf reservation-mode { + type host-reservation-mode; + description "Subnet host reservation mode."; + } + container relay { + description "Relay."; + 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."; + } + 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 "Read-only database."; + } + leaf connect-timeout { + type uint32; + description "Database connection timeout."; + } + leaf-list contact-points { + type inet:ip-address; + 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; + description "Waiting delay between two recovery attempts."; + } + leaf request-timeout { + type uint32; + 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."; + } + } + + grouping client-class { + leaf name { + type string; + mandatory true; + description "Client class name."; + } + leaf test { + type string; + description "Client class test expression."; + } + leaf only-if-required { + type boolean; + default false; + description "Client class only if required flag."; + } + uses option-data-list; + leaf user-context { + type kea:user-context; + description "Client class user context."; + } + } + + grouping option-def-list { + container option-def-list { + description "Option definition list."; + list option-def { + key "code space"; + leaf name { + type string; + mandatory true; + description "Option definition name."; + } + leaf code { + type uint16; + mandatory true; + description "Option definition code."; + } + leaf type { + type string; + mandatory true; + description "Option definition type."; + } + leaf record-types { + type string; + description "Option definition record types."; + } + leaf space { + type string; + mandatory true; + description "Option definition space."; + } + leaf encapsulate { + type string; + description "Option definition encapsulate."; + } + leaf array { + type boolean; + default false; + description "Option definition array flag."; + } + leaf user-context { + type kea:user-context; + description "Option definition user context."; + } + } + } + } + + grouping option-data-list { + container option-data-list { + 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; + description "Option code."; + } + leaf space { + type string; + mandatory true; + description "Option space."; + } + leaf csv-format { + type boolean; + default true; + description "Option CSV format flag."; + } + leaf always-send { + type boolean; + default false; + description "Option always send flag."; + } + leaf user-context { + type kea:user-context; + description "Option user context."; + } + } + } + } + + grouping configuration { + description "Contains parameters for DHCPv6 server configuration."; + + uses preferred-lifetime; + uses valid-lifetime; + uses renew-timer; + uses rebind-timer; + + leaf decline-probation-period { + type uint32; + units "seconds"; + default 86400; + description "Decline probabation period."; + } + + container subnet6 { + description "Global subnet6 list."; + uses subnet6-list; + } + + container shared-networks { + description "Shared networks."; + list shared-network { + key name; + leaf name { + type string; + mandatory true; + description "Shared network name."; + } + container subnet6 { + description "Shared network subnet6 list."; + 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 option-data-list; + container relay { + description "Relay."; + 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."; + } + leaf-list require-client-classes { + type string; + description "Shared network 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."; + } + } + } + + container interfaces-config { + description "Interfaces configuration."; + leaf-list interfaces { + type string; + description "Interface name or name/address or *."; + } + 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; + } + + container hosts-databases { + description "Hosts databases."; + list hosts-database { + key database-type; + uses database; + } + } + + leaf-list relay-supplied-options { + type string; + description "Relay supplied options."; + } + + leaf-list mac-sources { + type string; + description "MAC address sources."; + } + + leaf-list host-reservation-identifiers { + type host-identifier-type; + description "Host reservation identifier."; + } + + container client-classes { + description "Client classes."; + list client-class { + key name; + ordered-by user; + uses client-class; + } + } + + 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."; + } + } + + container server-id { + description "Server DUID."; + leaf type { + type enumeration { + enum "LLT"; + enum "EN"; + enum "LL"; + } + description "Server DIOD type."; + } + leaf identifier { + type string; + description "Server DUID identifier."; + } + leaf time { + type uint32; + description "Server DUID time."; + } + leaf htype { + type uint16; + description "Server DUID hardware type."; + } + leaf enterprise-id { + type uint32; + description "Server DUID enterprise ID."; + } + leaf persist { + type boolean; + default true; + description "Server DUID persist flag."; + } + leaf user-context { + type kea:user-context; + description "Server DUID user context."; + } + } + + 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."; + } + 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 "Invalid character set in hostnames."; + } + leaf hostname-char-replacement { + type string; + description "Replacement for invalid charaters."; + } + leaf user-context { + type kea:user-context; + description "DHCP-DDNS user context."; + } + } + + leaf user-context { + type kea:user-context; + description "DHCPv6 server user context."; + } + + 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."; + } + } + } + + /* + * State data + */ + grouping state { + description "State of Kea DHCPv6 server."; + + container leases { + description "Kea DHCPv6 leases."; + list lease { + key ip-address; + leaf ip-address { + type inet:ipv6-address; + mandatory true; + description "Lease IP address."; + } + leaf duid { + type binary; + mandatory true; + description "Lease DUID."; + } + leaf valid-lifetime { + type uint32; + units "seconds"; + mandatory true; + description "Lease valid lifetime."; + } + leaf cltt { + type uint32; + units "seconds"; + mandatory true; + description "Lease client last transmission time."; + } + leaf subnet-id { + type uint32; + mandatory true; + description "Lease subnet ID."; + } + leaf preferred-lifetime { + type uint32; + units "seconds"; + mandatory true; + description "Lease preferred lifetime."; + } + leaf lease-type { + type enumeration { + enum "IA_NA"; + enum "IA_TA"; + enum "IA_PD"; + } + mandatory true; + description "Lease IA type."; + } + leaf iaid { + type uint32; + mandatory true; + description "Lease IA ID."; + } + leaf prefix-length { + type uint8 { + range 0..128; + } + description "Lease prefix length."; + } + leaf fqdn-fwd { + type boolean; + default false; + description "Lease FQDN forward flag."; + } + leaf fqdn-rev { + type boolean; + default false; + description "Lease FQDN reverse lag."; + } + leaf hostname { + type string; + default ""; + description "Lease hostname."; + } + leaf state { + type lease-state; + default "default"; + description "Lease state."; + } + leaf user-context { + type kea:user-context; + description "Lease user context."; + } + leaf hw-address { + type string; + description "Lease hardware address."; + } + } + } + + container lease-stats { + list subnet { + key subnet-id; + leaf subnet-id { + type uint32; + mandatory true; + description "Subnet ID."; + } + leaf total-nas { + type uint32; + mandatory true; + description "Total non-temporary addresses counter."; + } + leaf assigned-nas { + type uint32; + mandatory true; + description "Assigned non-temporary counter."; + } + leaf declined-nas { + type uint32; + mandatory true; + description "Declined non-temporary addresses counter."; + } + leaf total-pds { + type uint32; + mandatory true; + description "Total delegated prefixes counter."; + } + leaf assigned-pds { + type uint32; + mandatory true; + description "Assigned delegated prefixe counter."; + } + } + } + + container hosts { + 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."; + } + leaf-list ip-addresses { + type inet:ipv6-address; + description "Host reserved IP addresses."; + } + leaf-list prefixes { + 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 option-data-list; + leaf user-context { + type kea:user-context; + description "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 new file mode 100644 index 0000000000..af7fb767b1 --- /dev/null +++ b/src/lib/yang/models/kea-dhcpddns.yang @@ -0,0 +1,162 @@ +module kea-dhcpddns { + yang-version 1.1; + namespace "urn:ietf:params:xml:ns:yang::kea-dhcpddns"; + prefix "kea-dhcpddns"; + + 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 model defines a YANG data model that can be + used to configure and manage a Kea DHCP-DDNS server."; + + revision 2018-08-20 { + description "Initial revision"; + reference ""; + } + + /* + * Groupings + */ + + grouping managed-domains { + description "Contains parameters for forward or reverse DDNS managed + domains."; + + container ddns-domains { + description "DDNS domains."; + list ddns-domain { + key name; + leaf name { + type string; + mandatory true; + description "DDNS domain name."; + } + leaf key-name { + type string; + description "TSIG key to use. Blank means no TSIG."; + } + container dns-servers { + description "DNS servers."; + list server { + key ip-address; + leaf hostname { + type string; + description "DNS server hostname."; + } + leaf ip-address { + type inet:ip-address; + mandatory true; + description "DNS server IP address."; + } + leaf port { + type uint16; + default 53; + description "DNS server port."; + } + leaf user-context { + type kea:user-context; + description "DNS server user context."; + } + } + } + leaf user-context { + type kea:user-context; + description "DDNS domain user context."; + } + } + } + } + + grouping configuration { + description "Contains parameters for DHCP-DDNS server configuration."; + + leaf ip-address { + type inet:ip-address; + default "127.0.0.1"; + description "IP address on which the server listens for requests."; + } + + leaf port { + type uint16; + default 53001; + description "Port on which the server listens for requests."; + } + + leaf dns-server-timeout { + type uint32; + units "milliseconds"; + description "Maximum amount of time that the server will wait for + a response from a DNS server to a single DNS update message."; + } + + leaf ncr-protocol { + type enumeration { + enum "UDP"; + enum "TCP"; + } + description "Protocol to use when sending requests to the server."; + } + + leaf ncr-format { + type enumeration { + enum "JSON"; + } + description "Packet format to use when sending requests to the server."; + } + + container forward-ddns { + description "Forward DNS zones."; + uses managed-domains; + } + + container reverse-ddns { + description "Reverse DNS zones."; + uses managed-domains; + } + + container tsig-keys { + description "Keys to use with TSIG."; + list key { + key name; + leaf name { + type string; + mandatory true; + description "Key name."; + } + leaf algorithm { + type string; + mandatory true; + description "Hashing algorithm to use with the key."; + } + leaf digest-bits { + type uint16; + units "bits"; + default 0; + description "Minimum truncated length. 0 means no truncation."; + } + leaf secret { + type string; + mandatory true; + description "Shared secret for the key."; + } + leaf user-context { + type kea:user-context; + description "Key user context."; + } + } + } + leaf user-context { + type kea:user-context; + description "DHCP-DDNS server user context."; + } + } +} diff --git a/src/lib/yang/models/kea-logging.yang b/src/lib/yang/models/kea-logging.yang new file mode 100644 index 0000000000..00fb3a4115 --- /dev/null +++ b/src/lib/yang/models/kea-logging.yang @@ -0,0 +1,109 @@ +module kea-logging { + yang-version 1.1; + namespace "urn:ietf:params:xml:ns:yang::kea-logging"; + prefix "kea-logging"; + + 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 model defines a YANG data model that can be + used to configure and manage logging of a Kea server."; + + revision 2018-08-20 { + description "Initial revision"; + reference ""; + } + + /* + * Groupings + */ + + grouping configuration { + description "Contains parameters for logging configuration."; + + container loggers { + description "Loggers."; + list logger { + key name; + leaf name { + type string; + description "Name of the logger."; + mandatory true; + } + container output-options { + description "Output options."; + leaf output { + type string; + description "Type of output. Special values are stdout (standard + output), stderr (standard error), syslog (syslog using default + name), syslog:name (syslog using specified name). Any other + value is interpreted as a filename."; + } + leaf flush { + type boolean; + default true; + description "When true flush buffers after each message."; + } + leaf maxsize { + type uint32; + default 10240000; + description "Maximum size of output file before rotation. + Values below 204800 including 0 disable rotation."; + } + leaf maxver { + type uint32 { + range 1..max; + } + default 1; + description "Maximum version to keep a rotated output file."; + } + } + leaf debuglevel { + type uint8 { + range 0..99; + } + description "What level of debug messages should be printed."; + } + leaf severity { + type enumeration { + enum "FATAL" { + description "Condition is so serious that the server cannot + continue executing"; + } + enum "ERROR" { + description "Error condition. The server will continue + executing, but the results may not be as expected."; + } + enum "WARN" { + description "Out of the ordinary condition. However, the server + will continue executing normally."; + } + enum "INFO" { + description "Information message marking some event."; + } + enum "DEBUG" { + description "For debugging purposes."; + } + enum "NONE" { + description "All messages are inhibited."; + } + } + description "Category of messages logged."; + } + leaf user-context { + type kea:user-context; + description "Logger user context."; + } + } + } + } +} diff --git a/src/lib/yang/models/kea-server.yang b/src/lib/yang/models/kea-server.yang new file mode 100644 index 0000000000..536600f244 --- /dev/null +++ b/src/lib/yang/models/kea-server.yang @@ -0,0 +1,85 @@ +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 new file mode 100644 index 0000000000..08b01860f8 --- /dev/null +++ b/src/lib/yang/models/kea-types.yang @@ -0,0 +1,69 @@ +module kea-types { + yang-version 1.1; + namespace "urn:ietf:params:xml:ns:yang::kea-types"; + prefix "kea-types"; + + import ietf-inet-types { + prefix inet; + } + import ietf-yang-types { + prefix yang; + } + + 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"; + + revision 2018-08-20 { + description "Initial revision"; + reference ""; + } + + /* + * Typedef + */ + typedef user-context { + type string; + description "User context (JSON map)."; + } + + /* + * Grouping + */ + grouping control-socket { + description "Control socket."; + leaf socket-name { + type string; + mandatory true; + description "Path to the UNIX socket."; + } + leaf socket-type { + type enumeration { + enum "unix"; + } + mandatory true; + description "Socket type."; + } + leaf user-context { + type user-context; + description "Control socket user context."; + } + } + + grouping hooks-libraries { + description "Hook libraries."; + list hook-library { + key library; + leaf library { + type string; + mandatory true; + description "Path to the DSO."; + } + leaf parameters { + type string; + description "Parameters (JSON value)."; + } + } + } +}