]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[65-libyang-option-data] Added Kea models
authorFrancis Dupont <fdupont@isc.org>
Thu, 13 Sep 2018 23:36:27 +0000 (01:36 +0200)
committerFrancis Dupont <fdupont@isc.org>
Thu, 13 Sep 2018 23:36:27 +0000 (01:36 +0200)
src/lib/yang/models/kea-ctrl-agent.yang [new file with mode: 0644]
src/lib/yang/models/kea-dhcp-ddns.yang [new file with mode: 0644]
src/lib/yang/models/kea-dhcp-types.yang [new file with mode: 0644]
src/lib/yang/models/kea-dhcp4-server.yang [new file with mode: 0644]
src/lib/yang/models/kea-dhcp6-server.yang [new file with mode: 0644]
src/lib/yang/models/kea-logging.yang [new file with mode: 0644]
src/lib/yang/models/kea-types.yang [new file with mode: 0644]

diff --git a/src/lib/yang/models/kea-ctrl-agent.yang b/src/lib/yang/models/kea-ctrl-agent.yang
new file mode 100644 (file)
index 0000000..eb56f26
--- /dev/null
@@ -0,0 +1,87 @@
+module kea-ctrl-agent {
+  yang-version 1.1;
+  namespace "urn:ietf:params:xml:ns:yang:kea-ctrl-agent";
+  prefix "kea-ctrl-agent";
+
+  import ietf-inet-types {
+    prefix inet;
+  }
+  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.";
+
+  revision 2018-08-20 {
+    description "Initial revision";
+    reference "";
+  }
+
+  /*
+  * Data Nodes
+  */
+
+  container config {
+    // config true;
+    description "Contains 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 {
+      description "Control sockets.";
+      list socket {
+        key server-type;
+        description "List of server control socket.";
+        leaf server-type {
+          type enumeration {
+            enum "dhcp4" {
+              description "kea-dhcp4 server";
+            }
+            enum "dhcp6" {
+              description "kea-dhcp6 server";
+            }
+            enum "d2" {
+              description "kea-dhcp-ddns server";
+            }
+          }
+          mandatory true;
+          description "Server type.";
+        }
+        container control-socket {
+          description "Control socket information.";
+          uses kea:control-socket;
+        }
+      }
+    }
+
+    uses kea:hooks-libraries;
+
+    leaf user-context {
+      type kea:user-context;
+      description "Control agent user context.";
+    }
+  }
+
+  container logging {
+    // config true;
+    description "Logging";
+
+    uses logging:configuration;
+  }
+}
diff --git a/src/lib/yang/models/kea-dhcp-ddns.yang b/src/lib/yang/models/kea-dhcp-ddns.yang
new file mode 100644 (file)
index 0000000..af4d146
--- /dev/null
@@ -0,0 +1,185 @@
+module kea-dhcp-ddns {
+  yang-version 1.1;
+  namespace "urn:ietf:params:xml:ns:yang:kea-dhcp-ddns";
+  prefix "kea-dhcp-ddns";
+
+  import ietf-inet-types {
+    prefix inet;
+  }
+  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 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;
+        description "List of DDNS domains.";
+        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;
+            description "List of DNS servers.";
+            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.";
+        }
+      }
+    }
+  }
+
+  /*
+  * Data Nodes
+  */
+
+  container config {
+    // config true;
+    description "Contains 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" {
+          description "UDP transport";
+        }
+        enum "TCP" {
+          description "TCP transport";
+        }
+      }
+      default "UDP";
+      description "Protocol to use when sending requests to the server.";
+    }
+
+    leaf ncr-format {
+      type enumeration {
+        enum "JSON" {
+          description "JSON format";
+        }
+      }
+      default "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;
+        description "List of TSIG keys.";
+        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.";
+    }
+  }
+
+  container logging {
+    // config true;
+    description "Logging";
+
+    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 (file)
index 0000000..3e236c2
--- /dev/null
@@ -0,0 +1,826 @@
+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 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" {
+        description "Host reservation support is disabled.";
+      }
+      enum "out-of-pool" {
+        description "Allows only out of pool host reservations.";
+      }
+      enum "all" {
+        description "Allows both in pool and out of pool host reservations.";
+      }
+      enum "global" {
+        description "Allows only global host reservations.";
+      }
+    }
+    default "all";
+    description "Host reservation mode.";
+  }
+
+  typedef lease-state {
+    type enumeration {
+      enum "default" {
+        description "Active/default";
+      }
+      enum "declined" {
+        description "Declined";
+      }
+      enum "expired-reclaimed" {
+        description "Expired-reclaimed";
+      }
+    }
+    default "default";
+    description "Defines state of the lease.";
+  }
+
+  /*
+  * Grouping
+  */
+  grouping valid-lifetime {
+    description "Valid lifetime grouping.";
+    leaf valid-lifetime {
+      type uint32;
+      units "seconds";
+      description "Valid lifetime entry.";
+    }
+  }
+
+  grouping renew-timer {
+    description "Renew timer grouping.";
+    leaf renew-timer {
+      type uint32;
+      units "seconds";
+      description "Renew timer entry.";
+    }
+  }
+
+  grouping rebind-timer {
+    description "Rebind timer grouping.";
+    leaf rebind-timer {
+      type uint32;
+      units "seconds";
+      description "Rebind timer entry.";
+    }
+  }
+
+  grouping database {
+    description "Database grouping.";
+    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;
+      units "milliseconds";
+      default 0;
+      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 {
+    description "Databases grouping.";
+    container lease-database {
+      presence "Have lease database.";
+      description "Lease database.";
+      uses database;
+    }
+    container hosts-databases {
+      description "Hosts databases.";
+      list hosts-database {
+        key database-type;
+        description "List of databases.";
+        uses database;
+      }
+    }
+  }
+
+  grouping expired-leases-processing {
+    description "Expired leases processing grouping.";
+    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 {
+    description "Control socket grouping.";
+    container control-socket {
+      presence "Have control socket.";
+      description "Control socket container.";
+      uses kea:control-socket;
+    }
+  }
+
+  grouping dhcp-ddns {
+    description "DHCP-DDNS grouping.";
+    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" {
+            description "UDP transport";
+          }
+          enum "TCP" {
+            description "TCP transport";
+          }
+        }
+        default "UDP";
+        description "Protocol to use for DHCP-DDNS communication.
+                     Currently only UDP is supported.";
+      }
+      leaf ncr-format {
+        type enumeration {
+          enum "JSON" {
+            description "JSON format";
+          }
+        }
+        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" {
+            description "When the client sent a name.";
+          }
+          enum "never" {
+            description "Never replace or generate a name.";
+          }
+          enum "always" {
+            description "Always replace or generate a name.";
+          }
+          enum "when-not-present" {
+            description "When the client did not send a name.";
+          }
+        }
+        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 {
+    description "Sanity checks grouping.";
+    container sanity-checks {
+      description "Sanity checks container.";
+      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 {
+    description "Client class grouping.";
+    leaf client-class {
+      type string;
+      description "Client class entry.";
+    }
+  }
+
+  grouping pool-client-class {
+    description "Client class grouping for a pool.";
+    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 {
+    description "Client class grouping for a subnet.";
+    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 {
+    description "Client class grouping for a shared network.";
+    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 {
+    description "Require client classes grouping.";
+    leaf-list require-client-classes {
+      type string;
+      description "List of client classes.";
+    }
+  }
+
+  grouping pool-require-client-classes {
+    description "Require client classes grouping for a pool.";
+    uses require-client-classes {
+      refine require-client-classes {
+        description "Pool require client classes.";
+      }
+    }
+  }
+
+  grouping subnet-require-client-classes {
+    description "Require client classes grouping for a subnet.";
+    uses require-client-classes {
+      refine require-client-classes {
+        description "Subnet require client classes.";
+      }
+    }
+  }
+
+  grouping network-require-client-classes {
+    description "Require client classes grouping for a shared network.";
+    uses require-client-classes {
+      refine require-client-classes {
+        description "Shared network require client classes.";
+      }
+    }
+  }
+
+  grouping interface {
+    description "Interface grouping.";
+    leaf interface {
+      type string;
+      description "Interface entry.";
+    }
+  }
+
+  grouping subnet-interface {
+    description "Interface grouping for a subnet.";
+    uses interface {
+      refine interface {
+        description "Name of the network interface this subnet is directly
+                     accessible with (optional).";
+      }
+    }
+  }
+
+  grouping network-interface {
+    description "Interface grouping for a shared network.";
+    uses interface {
+      refine interface {
+        description "Specifies the network interface this shared network is
+                     directly accessible with. (optional)";
+      }
+    }
+  }
+
+  // To move to DHCPv6.
+  grouping interface-id {
+    description "Interface ID grouping.";
+    leaf interface-id {
+      type string;
+      description "Interface ID entry.";
+    }
+  }
+
+  grouping subnet-interface-id {
+    description "Interface ID grouping for a subnet.";
+    uses interface-id {
+      refine interface-id {
+        description "Subnet interface-id option.";
+      }
+    }
+  }
+
+  grouping network-interface-id {
+    description "Interface ID grouping for a shared network.";
+    uses interface-id {
+      refine interface-id {
+        description "Shared network interface-id option.";
+      }
+    }
+  }
+
+  grouping subnet-id {
+    description "Subnet ID grouping.";
+    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 {
+    description "Host identifier grouping.";
+    leaf identifier {
+      type string;
+      description "Host identifier.";
+    }
+  }
+
+  grouping host-hostname {
+    description "Host DNS name grouping.";
+    leaf hostname {
+      type string;
+      description "Host DNS name.";
+    }
+  }
+
+  grouping host-client-classes {
+    description "Host client classes grouping.";
+    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 {
+    description "Host subnet ID grouping.";
+    leaf subnet-id {
+      type uint32;
+      mandatory true;
+      description "Host subnet ID.";
+    }
+  }
+
+  grouping reservation-mode {
+    description "Reservation mode grouping.";
+    leaf reservation-mode {
+      type host-reservation-mode;
+      description "Reservation mode entry.";
+    }
+  }
+
+  grouping subnet-reservation-mode {
+    description "Reservation mode grouping for a subnet.";
+    uses reservation-mode {
+      refine reservation-mode {
+        description "Subnet host reservation mode.";
+      }
+    }
+  }
+
+  grouping network-reservation-mode {
+    description "Reservation mode grouping for a shared network.";
+    uses reservation-mode {
+      refine reservation-mode {
+        description "Shared network host reservation mode.";
+      }
+    }
+  }
+
+  grouping interfaces-re-detect {
+    description "Interfaces re-detect grouping.";
+    leaf re-detect {
+      type boolean;
+      default false;
+      description "Re-detect interfaces at each reconfiguration.";
+    }
+  }
+
+  grouping class-name {
+    description "Client class name grouping.";
+    leaf name {
+      type string;
+      mandatory true;
+      description "Name of the client class.";
+    }
+  }
+
+  grouping class-test {
+    description "Client class test grouping.";
+    leaf test {
+      type string;
+      description "Defines an expression that evaluates every incoming
+                   packet.";
+    }
+  }
+
+  grouping class-only-if-required {
+    description "Client class only-if-required grouping.";
+    leaf only-if-required {
+      type boolean;
+      default false;
+      description "Client class only if required flag.";
+    }
+  }
+
+  grouping option-def-name {
+    description "Option definition name grouping.";
+    leaf name {
+      type string;
+      mandatory true;
+      description "Name of the new option being defined.";
+    }
+  }
+
+  grouping option-def-type {
+    description "Option definition type grouping.";
+    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 {
+    description "Option definition record types grouping.";
+    leaf record-types {
+      type string;
+      description "Option definition record types.";
+    }
+  }
+
+  grouping option-def-encapsulate {
+    description "Option definition encapsulate grouping.";
+    leaf encapsulate {
+      type string;
+      description "Defines option space this new option encapsulates.
+                   Usually empty.";
+    }
+  }
+
+  grouping option-data-name {
+    description "Option data name grouping.";
+    leaf name {
+      type string;
+      description "Option name.";
+    }
+  }
+
+  grouping option-data-data {
+    description "Option data data grouping.";
+    leaf data {
+      type string;
+      description "Option data.";
+    }
+  }
+
+  grouping option-data-csv-format {
+    description "Option data csv-format grouping.";
+    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 {
+    description "Option data always-send grouping.";
+    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 {
+    description "Option data array grouping.";
+    leaf array {
+      type boolean;
+      default false;
+      description "Option definition array flag.";
+    }
+  }
+
+  grouping decline-probation-period {
+    description "Decline probation period grouping.";
+    leaf decline-probation-period {
+      type uint32;
+      units "seconds";
+      default 86400;
+      description "Decline probabation period.";
+    }
+  }
+
+  grouping network-name {
+    description "Shared network name grouping.";
+    leaf name {
+      type string;
+      mandatory true;
+      description "Shared network name.";
+    }
+  }
+
+  grouping dhcp4o6-port {
+    description "DHCPv4-over-DHCPv6 port grouping.";
+    leaf dhcp4o6-port {
+      type uint16;
+      description "DHCPv4-over-DHCPv6 interserver port.";
+    }
+  }
+
+  grouping pool-user-context {
+    description "User context grouping for a pool.";
+    uses kea:user-context {
+      refine user-context {
+        description "Pool user context. Arbitrary JSON data can be
+                     stored here.";
+      }
+    }
+  }   
+
+  grouping host-user-context {
+    description "User context grouping for a host reservation.";
+    uses kea:user-context {
+      refine user-context {
+        description "Host user context. Arbitrary JSON data can be
+                     stored here.";
+      }
+    }
+  }
+
+  grouping subnet-user-context {
+    description "User context grouping for a subnet.";
+    uses kea:user-context {
+      refine user-context {
+        description "Subnet user context. Arbitrary JSON data can be
+                     stored here.";
+      }
+    }
+  }   
+
+  grouping network-user-context {
+    description "User context grouping for a shared network.";
+    uses kea:user-context {
+      refine user-context {
+        description "Shared network user context. Arbitrary JSON data can be
+                     stored here.";
+      }
+    }
+  }
+
+  grouping interfaces-user-context {
+    description "User context grouping for interfaces.";
+    uses kea:user-context {
+      refine user-context {
+        description "Interfaces user context. Arbitrary JSON data can
+                     be stored here.";
+      }
+    }
+  }
+
+  grouping class-user-context {
+    description "User context grouping for a client class.";
+    uses kea:user-context {
+      refine user-context {
+        description "Client class user context. Arbitrary JSON data can
+                     be stored here.";
+      }
+    }
+  }
+
+  grouping option-def-user-context {
+    description "User context grouping for an option definition.";
+    uses kea:user-context {
+      refine user-context {
+        description "Option definition user context. Arbitrary JSON data
+                     can be stored here.";
+      }
+    }
+  }
+
+  grouping option-data-user-context {
+    description "User context grouping for an option data.";
+    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-server.yang b/src/lib/yang/models/kea-dhcp4-server.yang
new file mode 100644 (file)
index 0000000..2b9683f
--- /dev/null
@@ -0,0 +1,526 @@
+module kea-dhcp4-server {
+  yang-version 1.1;
+  namespace "urn:ietf:params:xml:ns:yang:kea-dhcp4-server";
+  prefix "kea-dhcp4-server";
+
+  import ietf-inet-types {
+    prefix inet;
+  }
+  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.";
+
+  revision 2018-08-20 {
+    description "Initial revision";
+    reference "";
+  }
+
+  /*
+  * Typedefs
+  */
+  typedef host-identifier-type {
+    type enumeration {
+      enum "duid" {
+        description "DUID";
+      }
+      enum "hw-address" {
+        description "Hardware address";
+      }
+      enum "circuit-id" {
+        description "Circuit-id option";
+      }
+      enum "client-id" {
+        description "Client identifier";
+      }
+      enum "flex-id" {
+        description "Flexible identifier";
+      }
+    }
+    description "Host identifier type.";
+  }
+
+  /*
+  * Groupings
+  */
+  grouping match-client-id {
+    description "Match client ID grouping.";
+    leaf match-client-id {
+      type boolean;
+      default true;
+      description "Use client-id for lease lookups. If set to false, client-id
+                   will be ignored.";
+    }
+  }
+
+  grouping next-server {
+    description "Next server address grouping.";
+    leaf next-server {
+      type inet:ipv4-address;
+      description "Next server IPv4 address. If set, this value will be set
+                   in siaddr field.";
+    }
+  }
+
+  grouping server-hostname {
+    description "Server hostname grouping.";
+    leaf server-hostname {
+      type string;
+      description "Server hostname (up to 64 bytes).";
+    }
+  }
+
+  grouping boot-file-name {
+    description "Boot file name grouping.";
+    leaf boot-file-name {
+      type string;
+      description "Boot file name (up to 128 bytes).";
+    }
+  }
+
+  grouping relay {
+    description "Relay grouping.";
+    leaf-list ip-addresses {
+      type inet:ipv4-address;
+      description "IPv4 addresses.";
+    }
+  }
+
+  grouping subnet4-list {
+    description "Subnet4 list grouping.";
+    list subnet4 {
+      key id;
+      ordered-by user;
+      description "List of IPv4 subnets.";
+      uses dhcp:valid-lifetime;
+      uses dhcp:renew-timer;
+      uses dhcp:rebind-timer;
+      uses option-data-list;
+      container pools {
+        description "List of pools.";
+        list pool {
+          key "start-address end-address";
+          ordered-by user;
+          description "Pool entry.";
+          leaf prefix {
+            type inet:ipv4-prefix;
+            description "Defines a pool of dynamic IPv4 addresses to be managed
+                         by the server.";
+          }
+          leaf start-address {
+            type inet:ipv4-address;
+            mandatory true;
+            description "First IPv4 address in a pool.";
+          }
+          leaf end-address {
+            type inet:ipv4-address;
+            mandatory true;
+            description "Last IPv4 address in a pool.";
+          }
+          uses option-data-list;
+          uses dhcp:pool-client-class;
+          uses dhcp:pool-require-client-classes;
+          uses dhcp:pool-user-context;
+        }
+      }
+      leaf subnet {
+        type inet:ipv4-prefix;
+        mandatory true;
+        description "IPv4 subnet prefix.";
+      }
+      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.";
+        list host {
+          key "identifier-type identifier";
+          description "Host reservation entry.";
+          leaf identifier-type {
+            type host-identifier-type;
+            description "Host identifier type.";
+          }
+          uses dhcp:host-identifier;
+          leaf ip-address {
+            type inet:ipv4-address;
+            description "Host reserved IPv4 address.";
+          }
+          uses dhcp:host-hostname;
+          uses dhcp:host-client-classes;
+          uses option-data-list;
+          uses next-server;
+          uses server-hostname;
+          uses boot-file-name;
+          uses dhcp:host-user-context;
+        }
+      }
+      uses dhcp:subnet-reservation-mode;
+      container relay {
+        description "Optional information about relay agent.";
+        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.";
+      }
+      uses dhcp:subnet-user-context;
+    }
+  }
+
+  grouping client-class {
+    description "Client class grouping.";
+    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;
+    uses dhcp:class-user-context;
+  }
+
+  grouping option-def-list {
+    description "Option definition list grouping.";
+    container option-def-list {
+      description "List with custom option definitions.";
+      list option-def {
+        key "code space";
+        description "Option definition entry.";
+        leaf code {
+          type uint8;
+          mandatory true;
+          description "Option code to be used by the new option definition.";
+        }
+        leaf space {
+          type string;
+          mandatory true;
+          description "Option space for the new option (typically dhcp4).";
+        }
+        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;
+      }
+    }
+  }
+
+  grouping option-data-list {
+    description "Option data list grouping.";
+    container option-data-list {
+      description "Option data list.";
+      list option-data {
+        key "code space";
+        description "Option data entry.";
+        leaf code {
+          type uint8;
+          mandatory true;
+          description "Option code.";
+        }
+        leaf space {
+          type string;
+          mandatory true;
+          description "Option space.";
+        }
+        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;
+      }
+    }
+  }
+
+  /*
+  * Data Nodes
+  */
+
+  container config {
+    // config true;
+    description "Contains DHCPv4 server configuration.";
+
+    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.";
+      uses subnet4-list;
+    }
+
+    container shared-networks {
+      description "Defines a list of IPv4 shared networks.";
+      list shared-network {
+        key name;
+        description "List of IPv4 shared networks.";
+        uses dhcp:network-name;
+        container subnet4 {
+          description "List of IPv4 subnets that belong to this shared
+                       network.";
+          uses subnet4-list;
+        }
+        uses dhcp:network-interface;
+        uses dhcp:renew-timer;
+        uses dhcp:rebind-timer;
+        uses option-data-list;
+        uses match-client-id;
+        uses next-server;
+        uses server-hostname;
+        uses boot-file-name;
+        container relay {
+          description "Optional information about relay agent.";
+          uses relay;
+        }
+        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;
+      }
+    }
+
+    container interfaces-config {
+      description "Network interfaces configuration.";
+      leaf-list interfaces {
+        type string;
+        description "Name of the interface (e.g. eth0) or name/address
+                     (e.g. eth0/192.168.1.1) or * (use all interfaces).";
+      }
+      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.";
+      }
+      uses dhcp:interfaces-re-detect;
+      uses dhcp:interfaces-user-context;
+    }
+
+    uses dhcp:databases;
+
+    leaf-list host-reservation-identifiers {
+      type host-identifier-type;
+      description "Host reservation identifiers.";
+    }
+
+    container client-classes {
+      description "Client classes.";
+      list client-class {
+        key name;
+        ordered-by user;
+        description "List of client classes.";
+        uses client-class;
+      }
+    }
+
+    uses option-def-list;
+    uses option-data-list;
+    uses kea:hooks-libraries;
+    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.";
+    }
+
+    uses match-client-id;
+    uses next-server;
+    uses server-hostname;
+    uses boot-file-name;
+    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 {
+    // config true;
+    description "Logging";
+
+    uses logging:configuration;
+  }
+
+  /*
+  * State data
+  */
+  container state {
+    config false;
+    description "State of Kea DHCPv4 server.";
+
+    container leases {
+      description "Kea DHCPv4 leases.";
+      list lease {
+        key ip-address;
+        description "List of Kea DHCPv4 leases.";
+        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.";
+        }
+        uses dhcp:valid-lifetime {
+          refine valid-lifetime {
+            mandatory true;
+          }
+        }
+        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 dhcp:lease-state;
+          default "default";
+          description "Lease state.";
+        }
+        leaf user-context {
+          type kea:user-context;
+          description "Lease user context.";
+        }
+      }
+    }
+
+    container lease-stats {
+      description "Lease statistics.";
+      list subnet {
+        key subnet-id;
+        description "List of IPv4 subnets.";
+        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";
+        description "List of Kea DHCPv4 hosts.";
+        leaf identifier-type {
+          type host-identifier-type;
+          mandatory true;
+          description "Host identifier type.";
+        }
+        uses dhcp:host-identifier;
+        uses dhcp:host-subnet-id;
+        leaf ip-address {
+          type inet:ipv4-address;
+          description "Host reserved IP address.";
+        }
+        uses dhcp:host-hostname;
+        uses dhcp:host-client-classes;
+        uses option-data-list;
+        uses next-server;
+        uses server-hostname;
+        uses boot-file-name;
+        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-server.yang b/src/lib/yang/models/kea-dhcp6-server.yang
new file mode 100644 (file)
index 0000000..519a404
--- /dev/null
@@ -0,0 +1,594 @@
+module kea-dhcp6-server {
+  yang-version 1.1;
+  namespace "urn:ietf:params:xml:ns:yang:kea-dhcp6-server";
+  prefix "kea-dhcp6-server";
+
+  import ietf-inet-types {
+    prefix inet;
+  }
+  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.";
+
+  revision 2018-08-20 {
+    description "Initial revision";
+    reference "";
+  }
+
+  /*
+  * Typedefs
+  */
+  typedef host-identifier-type {
+    type enumeration {
+      enum "duid" {
+        description "DUID";
+      }
+      enum "hw-address" {
+        description "Hardware address";
+      }
+      enum "flex-id" {
+        description "Flexible identifier";
+      }
+    }
+    description "Host identifier type.";
+  }
+
+  /*
+  * Groupings
+  */
+  grouping preferred-lifetime {
+    description "Preferred lifetime grouping.";
+    leaf preferred-lifetime {
+      type uint32;
+      units "seconds";
+      description "Preferred lifetime.";
+    }
+  }
+
+  grouping relay {
+    description "Relay grouping.";
+    leaf-list ip-addresses {
+      type inet:ipv6-address;
+      description "IPv6 addresses.";
+    }
+  }
+
+  grouping rapid-commit {
+    description "Rapid commit grouping.";
+    leaf rapid-commit {
+      type boolean;
+      default false;
+      description "Rapid commit entry.";
+    }
+  }
+
+  grouping subnet6-list {
+    description "Subnet6 list grouping.";
+    list subnet6 {
+      key id;
+      ordered-by user;
+      description "List of IPv6 subnets.";
+      uses preferred-lifetime;
+      uses dhcp:valid-lifetime;
+      uses dhcp:renew-timer;
+      uses dhcp:rebind-timer;
+      uses option-data-list;
+      container pools {
+        description "List of pools.";
+        list pool {
+          key "start-address end-address";
+          ordered-by user;
+          description "Pool entry.";
+          leaf prefix {
+            type inet:ipv6-prefix;
+            description "Pool prefix.";
+          }
+          leaf start-address {
+            type inet:ipv6-address;
+            mandatory true;
+            description "First IPv6 address in a pool.";
+          }
+          leaf end-address {
+            type inet:ipv6-address;
+            mandatory true;
+            description "Last IPv6 address in a pool.";
+          }
+          uses option-data-list;
+          uses dhcp:pool-client-class;
+          uses dhcp:pool-require-client-classes;
+          uses dhcp:pool-user-context;
+        }
+      }
+      container pd-pools {
+        description "List of prefix delegation pools.";
+        list pd-pool {
+          key prefix;
+          ordered-by user;
+          description "Prefix delegation pool entry.";
+          leaf prefix {
+            type inet:ipv6-prefix;
+            mandatory true;
+            description "IPv6 pool prefix.";
+          }
+          leaf delegated-len {
+            type uint8;
+            description "Prefix pool delegated length.";
+          }
+          uses option-data-list;
+          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).";
+            }
+          }
+          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.";
+          }
+          uses kea:user-context {
+            refine user-context {
+              description "Prefix pool user context. Arbitrary JSON data
+                           can be stored here.";
+            }
+          }
+        }
+      }
+      leaf subnet {
+        type inet:ipv6-prefix;
+        mandatory true;
+        description "IPv6 subnet prefix.";
+      }
+      uses dhcp:subnet-interface;
+      uses dhcp:subnet-interface-id;
+      uses dhcp:subnet-id;
+      uses rapid-commit {
+        refine rapid-commit {
+          description "Subnet rapid commit flag.";
+        }
+      }
+      uses dhcp:subnet-client-class;
+      uses dhcp:require-client-classes;
+      container reservations {
+        description "A container with host reservations specific to
+                     this IPv6 subnet.";
+        list host {
+          key "identifier-type identifier";
+          description "Host reservation entry.";
+          leaf identifier-type {
+            type host-identifier-type;
+            mandatory true;
+            description "Host identifier type.";
+          }
+          uses dhcp:host-identifier;
+          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.";
+          }
+          uses dhcp:host-hostname;
+          uses dhcp:host-client-classes;
+          uses option-data-list;
+          uses dhcp:host-user-context;
+        }
+      }
+      uses dhcp:subnet-reservation-mode;
+      container relay {
+        description "Optional information about relay agent.";
+        uses relay;
+      }
+      uses dhcp:subnet-user-context;
+    }
+  }
+
+  grouping client-class {
+    description "Client class grouping.";
+    uses dhcp:class-name;
+    uses dhcp:class-test;
+    uses dhcp:class-only-if-required;
+    uses option-data-list;
+    uses dhcp:class-user-context;
+  }
+
+  grouping option-def-list {
+    description "Option definition list grouping.";
+    container option-def-list {
+      description "Option definition list.";
+      list option-def {
+        key "code space";
+        description "Option definition entry.";
+        leaf code {
+          type uint16;
+          mandatory true;
+          description "Option code to be used by the new option definition.";
+        }
+        leaf space {
+          type string;
+          mandatory true;
+          description "Option space for the new option (typically dhcp6).";
+        }
+        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;
+      }
+    }
+  }
+
+  grouping option-data-list {
+    description "Option data list grouping.";
+    container option-data-list {
+      description "Option data list.";
+      list option-data {
+        key "code space";
+        description "Option data entry.";
+        leaf code {
+          type uint16;
+          mandatory true;
+          description "Option code.";
+        }
+        leaf space {
+          type string;
+          mandatory true;
+          description "Option space.";
+        }
+        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;
+      }
+    }
+  }
+
+  /*
+  * Data Nodes
+  */
+
+  container config {
+    // config true;
+    description "Contains DHCPv6 server configuration.";
+
+    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.";
+      uses subnet6-list;
+    }
+
+    container shared-networks {
+      description "Defines a list of IPv6 shared networks.";
+      list shared-network {
+        key name;
+        uses dhcp:network-name;
+        description "List of IPv4 shared networks.";
+        container subnet6 {
+          description "List of IPv6 subnets that belong to this shared
+                       network.";
+          uses subnet6-list;
+        }
+        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;
+        }
+        uses dhcp:network-reservation-mode;
+        uses dhcp:network-client-class;
+        uses dhcp:require-client-classes;
+        uses preferred-lifetime;
+        uses rapid-commit {
+          refine rapid-commit {
+            description "Shared network rapid commit flag.";
+          }
+        }
+        uses dhcp:valid-lifetime;
+        uses dhcp:network-user-context;
+      }
+    }
+
+    container interfaces-config {
+      description "Network interfaces configuration.";
+      leaf-list interfaces {
+        type string;
+        description "Name of the interface (e.g. eth0) or name/address
+                     (e.g. eth0/2001:db8::1) or * (use all interfaces).";
+      }
+      uses dhcp:interfaces-re-detect;
+      uses dhcp:interfaces-user-context;
+    }
+
+    uses dhcp:databases;
+
+    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 identifiers.";
+    }
+
+    container client-classes {
+      description "Client classes.";
+      list client-class {
+        key name;
+        ordered-by user;
+        description "List of client classes.";
+        uses client-class;
+      }
+    }
+
+    uses option-def-list;
+    uses option-data-list;
+    uses kea:hooks-libraries;
+    uses dhcp:expired-leases-processing;
+
+    container server-id {
+      description "Server DUID.";
+      leaf type {
+        type enumeration {
+          enum "LLT" {
+            description "Link-layer address and timestamp.";
+          }
+          enum "EN" {
+            description "Enterprise number.";
+          }
+          enum "LL" {
+            description "Link-layer address.";
+          }
+        }
+        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.";
+      }
+    }
+
+    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;
+  }
+
+  container logging {
+    // config true;
+    description "Logging";
+
+    uses logging:configuration;
+  }
+
+  /*
+  * State data
+  */
+  container state {
+    config false;
+    description "State of Kea DHCPv6 server.";
+
+    container leases {
+      description "Kea DHCPv6 leases.";
+      list lease {
+        key ip-address;
+        description "List of Kea DHCPv6 leases.";
+        leaf ip-address {
+          type inet:ipv6-address;
+          mandatory true;
+          description "Lease IP address.";
+        }
+        leaf duid {
+          type binary;
+          mandatory true;
+          description "Lease DUID.";
+        }
+        uses dhcp:valid-lifetime {
+          refine valid-lifetime {
+            mandatory true;
+          }
+        }
+        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" {
+              description "Identity association for non-temporary addresses.";
+            }
+            enum "IA_TA" {
+              description "Identity association for temporary addresses.";
+            }
+            enum "IA_PD" {
+              description "Identity association for prefix delegation.";
+            }
+          }
+          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 dhcp: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 {
+      description "Lease statistics.";
+      list subnet {
+        key subnet-id;
+        description "List of IPv6 subnets.";
+        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";
+        description "List of Kea DHCPv6 hosts.";
+        leaf identifier-type {
+          type host-identifier-type;
+          mandatory true;
+          description "Host identifier type.";
+        }
+        uses dhcp:host-identifier;
+        uses dhcp: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.";
+        }
+        uses dhcp:host-hostname;
+        uses dhcp:host-client-classes;
+        uses option-data-list;
+        uses dhcp:host-user-context;
+        leaf auth-key {
+          type string;
+          description "Host authentication key.";
+        }
+      }
+    }
+  }
+}
diff --git a/src/lib/yang/models/kea-logging.yang b/src/lib/yang/models/kea-logging.yang
new file mode 100644 (file)
index 0000000..a2412c7
--- /dev/null
@@ -0,0 +1,108 @@
+module kea-logging {
+  yang-version 1.1;
+  namespace "urn:ietf:params:xml:ns:yang:kea-logging";
+  prefix "kea-logging";
+
+  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;
+        description "List of loggers.";
+        leaf name {
+          type string;
+          mandatory true;
+          description "Name of the logger.";
+        }
+        container output-options {
+          description "Output options.";
+          list option {
+            key output;
+            description "List of 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-types.yang b/src/lib/yang/models/kea-types.yang
new file mode 100644 (file)
index 0000000..d896907
--- /dev/null
@@ -0,0 +1,75 @@
+module kea-types {
+  yang-version 1.1;
+  namespace "urn:ietf:params:xml:ns:yang:kea-types";
+  prefix "kea-types";
+
+  organization "Internet Systems Consortium";
+  contact "kea-dev@lists.isc.org";
+  description "This file defines some commonly used Kea types and groupings.";
+
+  revision 2018-08-20 {
+    description "Initial revision";
+    reference "";
+  }
+
+  /*
+  * Typedef
+  */
+  typedef user-context {
+    type string;
+    description "User context (JSON map).";
+  }
+
+  /*
+  * Grouping
+  */
+  grouping user-context {
+    description "User context grouping.";
+    leaf user-context {
+      type user-context;
+      description "User context entry.";
+    }
+  }
+
+  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" {
+          description "Unix socket type.";
+        }
+      }
+      mandatory true;
+      description "Socket type.";
+    }
+    leaf user-context {
+      type user-context;
+      description "Control socket user context.";
+    }
+  }
+
+  grouping hooks-libraries {
+    description "Hooks libraries grouping.";
+    container hooks-libraries {
+      description "Hook libraries.";
+      list hook-library {
+        key library;
+        description "List of hook library.";
+        leaf library {
+          type string;
+          mandatory true;
+          description "Path to the DSO.";
+        }
+        leaf parameters {
+          type string;
+          description "Parameters (JSON value).";
+        }
+      }
+    }
+  }
+}