DHC Working Group                                                 Y. Cui
Internet-Draft                                                    L. Sun
Intended status: Standards Track                     Tsinghua University
Expires: March 11, 7 May 2020                                        I.                                          I.F. Farrer
                                                              S.
                                                            S.Z. Zechlin
                                                     Deutsche Telekom AG
                                                                   Z. He
                                                     Tsinghua University
                                                       September 8,
                                                         M.N. Nowikowski
                                             Internet Systems Consortium
                                                         4 November 2019

                YANG Data Model for DHCPv6 Configuration
                     draft-ietf-dhc-dhcpv6-yang-09
                     draft-ietf-dhc-dhcpv6-yang-10

Abstract

   This document describes a several YANG data model [RFC6020] modules for the
   configuration and management of DHCPv6 servers, relays, and clients.

Requirements Language

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
   "OPTIONAL" in this document are to be interpreted as described in [RFC2119]. BCP
   14 [RFC2119] [RFC8174] when, and only when, they appear in all
   capitals, as shown here.

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at https://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on March 11, 7 May 2020.

Copyright Notice

   Copyright (c) 2019 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (https://trustee.ietf.org/license-info) (https://trustee.ietf.org/
   license-info) in effect on the date of publication of this document.
   Please review these documents carefully, as they describe your rights
   and restrictions with respect to this document.  Code Components
   extracted from this document must include Simplified BSD License text
   as described in Section 4.e of the Trust Legal Provisions and are
   provided without warranty as described in the Simplified BSD License.

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2   3
     1.1.  Terminology  Scope . . . . . . . . . . . . . . . . . . . . . . . . . .   3
     1.2.  Extensibility of the DHCPv6 Server YANG Module  . . . . .   3
       1.2.1.  DHCPv6 Option Definitions . . . . . . . . . . . . . .   4
     1.3.  Terminology . . . . . . . . . . . . . . . . . . . . . . .   4
   2.  DHCPv6 Tree Diagram . Diagrams  . . . . . . . . . . . . . . . . . . . .   3   4
     2.1.  DHCPv6 Server Tree Diagrams Diagram  . . . . . . . . . . . . . . .   3   4
     2.2.  DHCPv6 Relay Tree Diagrams Diagram . . . . . . . . . . . . . . .  16 .  11
     2.3.  DHCPv6 Client Tree Diagrams Diagram  . . . . . . . . . . . . . . .  20  14
   3.  DHCPv6 YANG Model . . . . . . . . . . . . . . . . . . . . . .  27  17
     3.1.  DHCPv6 Server YANG Model  . . . . . . . . . . . . . . . .  27  17
     3.2.  DHCPv6 Relay YANG Model . . . . . . . . . . . . . . . . .  47  29
     3.3.  DHCPv6 Client YANG Model  . . . . . . . . . . . . . . . .  57  36
     3.4.  DHCPv6 RFC8415 Options YANG Model . . . . . . . . . . . . . . . .  65  45
     3.5.  DHCPv6 Types Common YANG Model  . . . . . . . . . . . . . . . . .  94  54
   4.  Security Considerations (TBD) . . . . . . . . . . . . . . . .  99  58
   5.  IANA Considerations (TBD) . . . . . . . . . . . . . . . . . .  99  58
   6.  Acknowledgments . . . . . . . . . . . . . . . . . . . . . . .  99  59
   7.  Contributors  . . . . . . . . . . . . . . . . . . . . . . . .  99  59
   8.  References  . . . . . . . . . . . . . . . . . . . . . . . . . 100  59
     8.1.  Normative References  . . . . . . . . . . . . . . . . . . 100  59
     8.2.  Informative References  . . . . . . . . . . . . . . . . . 100  60
   Appendix A.  Example of Adding New DHCPv6 Option
           Definitions . . . . . . . . . . . . . . . . . . . . . . .  61
   Appendix B.  Example Vendor Specific Server Configuration
           Module  . . . . . . . . . . . . . . . . . . . . . . . . .  63
   Appendix C.  Example definition of class selector
           configuration . . . . . . . . . . . . . . . . . . . . . .  68
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . . 102  73

1.  Introduction

   DHCPv6 [RFC3315] [RFC8415] is widely used for supplying configuration and other
   relevant parameters to clients in IPv6 networks.  This document
   defines a DHCPv6 YANG data model, containing sub-modules modules for the configuration and management of
   DHCPv6 servers, relays and clients.
   A single YANG model covering all  This document defines separate
   'element' modules for each of these elements provides an
   operator with these.

   Additionally, a common interface for 'common' module contains typedefs and groupings used
   by the management element modules.  A further module contains an initial set of the entire
   DHCPv6 deployment in their network.

   Since option definitions.

   It is worth noting that as DHCPv6 is itself a client configuration
   protocol, it is not the publication intention of this document to replace the original
   allocation of DHCPv6 specification, there
   have been a assigned addressing and parameters using
   NETCONF/YANG.  The DHCPv6 client model is intended for the
   configuration and monitoring of the DHCPv6 client function and does
   not affect the normal DHCPv6 message flow.

1.1.  Scope

   [RFC8415] describes the current version of the DHCPv6 base protocol
   specification.  In addition to this, a large number of additional documents that update the
   protocol's operation, add new functions addition
   specifications have also been published, extending DHCPv6 element
   functionality and define adding new options.  The YANG model described modules contained in
   this document incorporates do not attempt to capture all relevant
   changes.  A full list of these extensions and
   additions, rather to model the documents which have been considered DHCPv6 functions and options covered
   in [RFC8415].  A focus has also been given on the development extensibility of this model
   the modules so that it is included easy to augment in Appendix A.

   IF - Comment - Does anyone have this list?

   It is worth noting that additional functionality
   as DHCPv6 is itself required by a device configuration
   protocol, it is not the intention particular implementation or deployment scenario.

1.2.  Extensibility of the DHCPv6 Server YANG Module

   The modules in this document only attempt to replace the
   configuration of model DHCPv6 options specific
   behavior and parameters using the DHCPv6
   protocol with do not cover the configuration and management of DHCPv6 options using NETCONF/YANG.
   functionality relevant for specific server implementations.  The DHCPv6 client model
   level of variance between implementations is intended too great to attempt to
   standardize in a way that is useful without being restrictive.

   However, it is recognized that implementation specific configuration
   and management is also an essential part of DHCP deployment and
   operations.  To resolve this, Appendix B contains an example YANG
   module for the configuration of implementation specific functions,
   illustrating how this functionality can be augmented into the main
   ietf-dhcpv6-server.yang module.

   In DHCPv6 client function and also for obtaining read-only state data
   from the client which has been learned via concept of 'class selection' for messages received by
   the normal DHCPv6 message
   flow. server is common.  This gives an operator a better method for managing DHCPv6
   clients and simplifies troubleshooting.

1.1.  Terminology

   The reader should be familiar with is the terms defined in DHCPv6
   [RFC3315] identification and other relevant documents.

   The DHCPv6 tree diagrams provide a concise representation classification
   of messages based on a YANG
   module to help the reader understand the number of parameters so that the correct
   provisioning information can be supplied.  For example, allocating a
   prefix from the correct pool, or supplying a set of options relevant
   for a specific vendor's client implementation.  During the
   development of this document, research has been carried out into a
   number of vendor's class selection implementations and the findings
   were that while this function is common to all, the method for
   implementing this differs greatly.  Therefore, configuration of the
   class selection function has been omitted from the DHCPv6 server
   module structure. to allow implementors to define their own suitable YANG
   module.  Appendix C provides an example of this, to demonstrate how
   this is can be integrated with the main "ietf-dhcpv6-server.yang"
   module.

1.2.1.  DHCPv6 Option Definitions

   A simplified graphical representation large number of DHCPv6 options have been created in addition to
   those defined in [RFC8415].  As implementations differ widely in
   which DHCPv6 options that they support, the data model is provided following approach has
   been taken to defining options: Only the relevant set of DHCPv6
   options defined in [RFC8415] are included in this document.  For a description  Further
   options definitions can be added by additional YANG modules via
   augmentation into the relevant element modules from this document.
   Appendix A contains an example module showing how the DHCPv6 option
   definitions can be extended in this manner and provides guidance on
   writing YANG modules for DHCPv6 options.

1.3.  Terminology

   The reader should be familiar with the YANG data modelling language
   defined in [RFC7950].

   The YANG modules in this document adopt the Network Management
   Datastore Architecture (NMDA) [RFC8342].  The meanings of the symbols
   used in these
   diagrams, please refer to [I-D.ietf-netmod-yang-tree-diagrams]. tree diagrams are defined in [RFC8340].

   The reader should be familiar with the terms defined in DHCPv6
   [RFC8415] and other relevant documents.

2.  DHCPv6 Tree Diagram Diagrams

2.1.  DHCPv6 Server Tree Diagrams Diagram

   The tree diagram in Figure 1 provides an overview of the DHCPv6
   server module.  The tree also includes the augmentations of the
   relevant option definitions from Section 3.4 and the common functions
   module Section 3.5.

    module: ietf-dhcpv6-server
      +--rw server!
     +--rw server-config
     | dhcpv6-node-type?   identityref
      +--rw serv-attributes
     |  | dhcpv6-server
         +--rw duid
     |  | server-duid
         |  +--rw type-code?                           uint16
         |  |  |  +--rw (duid-type)?
         |  |  |  +--:(duid-llt)
         |  |  |     |  +--rw duid-llt-hardware-type?        uint16
         |  |  |     |  +--rw duid-llt-time?                 yang:timeticks
         |  |  |     |  +--rw duid-llt-link-layer-addr?    yang:mac-address duid-llt-link-layer-address?
         |  |  |     +--:(duid-en)          yang:mac-address
         |  |  +--:(duid-en)
         |  |  |  +--rw duid-en-enterprise-number?     uint32
         |  |  |     |  +--rw duid-en-identifier?            string
         |  |  |  +--:(duid-ll)
         |  |  |     |  +--rw duid-ll-hardware-type?         uint16
         |  |  |     |  +--rw duid-ll-link-layer-addr?     yang:mac-address duid-ll-link-layer-address?
         |  |  |     +--:(duid-uuid)          yang:mac-address
         |  |  +--:(duid-uuid)
         |  |  |  +--rw uuid?                          yang:uuid
         |  |  |  +--:(duid-unknown)
         |  |  |     +--rw data?                          binary
         |  |  +--rw name?                string
     |  |  +--ro active-duid?                         binary
         +--rw description?         string
     |  | vendor-config
         +--rw ipv6-address*        inet:ipv6-address
     | option-sets
         |  +--rw interfaces-config*   if:interface-ref
     | option-set* [option-set-id]
         |     +--rw lease-storage option-set-id
         |     |       uint32
         |     +--rw (storage-type)?
     |  |  |     +--:(memfile)
     |  | description?
         |     |  +--rw memfile-name?       string
         |  |  |     |     +--rw memfile-lfc-interval?         uint64 rfc3319:sip-server-domain-name-list-option
         |     |  +--rw rfc3319:sip-serv-domain-name?
         |     +--:(mysql)     |          inet:domain-name
         |     +--rw rfc3319:sip-server-address-list-option
         |     |  +--rw mysql-name?                   string rfc3319:sip-server* [sip-serv-id]
         |     |     +--rw rfc3319:sip-serv-id      uint8
         |     |     +--rw mysql-host?                   string rfc3319:sip-serv-addr?   inet:ipv6-address
         |     +--rw rfc8415:preference-option
         |     |  +--rw rfc8415:pref-value?   uint8
         |     +--rw mysql-password?               string rfc8415:auth-option
         |     |  +--rw rfc8415:protocol?           uint8
         |     |  +--rw mysql-port? rfc8415:algorithm?          uint8
         |     |  +--rw rfc8415:rdm?                uint8
         |     |  +--rw mysql-lfc-interval? rfc8415:replay-detection?   uint64
         |     |  |  +--rw rfc8415:auth-information?   string
         |     +--rw mysql-connect-timeout?        uint64 rfc8415:server-unicast-option
         |     |  +--rw rfc8415:server-address?   inet:ipv6-address
         |     +--:(postgresql)     +--rw rfc8415:status-code-option
         |     |  +--rw rfc8415:status-code?      uint16
         |     |  +--rw postgresql-name? rfc8415:status-message?   string
         |     +--rw rfc8415:rapid-commit-option!
         |     +--rw rfc8415:vendor-specific-information-option
         |     |  +--rw postgresql-host?              string rfc8415:vendor-specific-information-option-inst
    ances*
         |     |          [enterprise-number]
         |     |     +--rw postgresql-password?          string
     |  | rfc8415:enterprise-number     uint32
         |     |     +--rw postgresql-port?              uint8 rfc8415:vendor-option-data*
         |     |             [sub-option-code]
         |     |        +--rw postgresql-lfc-interval?      uint64
     | rfc8415:sub-option-code    uint16
         |     |        +--rw rfc8415:sub-option-data?   string
         |     +--rw postgresql-connect-timeout?   uint64 rfc8415:reconfigure-message-option
         |     |  +--rw rfc8415:msg-type?   uint8
         |     +--:(cassandra)     +--rw rfc8415:reconfigure-accept-option!
         |     +--rw rfc8415:info-refresh-time-option
         |     |  +--rw cassandra-name?               string rfc8415:info-refresh-time?
         |     |          dhcpv6-common:timer-value-seconds32
         |     +--rw cassandra-contact-points?     string
     | rfc8415:sol-max-rt-option
         |     |  +--rw cassandra-password?           string rfc8415:sol-max-rt-value?
         |     |          dhcpv6-common:timer-value-seconds32
         |     +--rw cassandra-lfc-interval?       uint64
     | rfc8415:inf-max-rt-option
         |        +--rw rfc8415:inf-max-rt-value?
         |                dhcpv6-common:timer-value-seconds32
         +--rw cassandra-connect-timeout?    uint64 class-selector
         +--rw network-ranges
            +--rw option-set-id*        leafref
            +--rw valid-lifetime
            |       dhcpv6-common:timer-value-seconds32
            +--rw renew-time
            |       dhcpv6-common:timer-value-seconds32
            +--rw vendor-info rebind-time
            |       dhcpv6-common:timer-value-seconds32
            +--rw preferred-lifetime
            |       dhcpv6-common:timer-value-seconds32
            +--rw rapid-commit          boolean
            +--rw network-range* [network-range-id]
               +--rw ent-num network-range-id             uint32
     |  |
               +--rw data* network-description          string
               +--rw network-prefix               inet:ipv6-prefix
               +--rw option-set-id*               leafref
               +--rw valid-lifetime
               |       dhcpv6-common:timer-value-seconds32
               +--rw option-sets renew-time
               |       dhcpv6-common:timer-value-seconds32
               +--rw rebind-time
               |       dhcpv6-common:timer-value-seconds32
               +--rw option-set* [option-set-id] preferred-lifetime
               |       dhcpv6-common:timer-value-seconds32
               +--rw rapid-commit                 boolean
               +--rw address-pools
               |  +--rw address-pool* [pool-id]
               |     +--rw option-set-id pool-id               uint32
               |     +--rw pool-prefix           inet:ipv6-prefix
               |     +--rw server-unicast-option! {server-unicast-op}? start-address
               |     |       inet:ipv6-address-no-zone
               |     +--rw server-address?   inet:ipv6-address end-address
               |     |       inet:ipv6-address-no-zone
               |     +--rw sip-server-domain-name-list-option! {sip-server-domain-name-list-op}? max-address-count
               |     |       dhcpv6-common:threshold
               |     +--rw sip-serv-domain-name    string
     | option-set-id*        leafref
               |     +--rw sip-server-address-list-option! {sip-server-address-list-op}? valid-lifetime
               |     |       dhcpv6-common:timer-value-seconds32
               |     +--rw sip-server* [sip-serv-id] renew-time
               |     |       dhcpv6-common:timer-value-seconds32
               |     +--rw sip-serv-id      uint8 rebind-time
               |     |       dhcpv6-common:timer-value-seconds32
               |     +--rw sip-serv-addr    inet:ipv6-address preferred-lifetime
               |     |       dhcpv6-common:timer-value-seconds32
               |     +--rw dns-servers-option! {dns-servers-op}? rapid-commit          boolean
               |     +--rw host-reservations
               |     |  +--rw dns-server* [dns-serv-id] host-reservation* [reserved-addr]
               |     |     +--rw client-duid?          binary
               |     |     +--rw dns-serv-id      uint8 reserved-addr
               |     |     |     +--rw dns-serv-addr       inet:ipv6-address
               |     |     +--rw domain-searchlist-option! {domain-searchlist-op}? prefix-reservation*
               |     |     |  +--rw domain-searchlist* [domain-searchlist-id]       [reserv-prefix-id]
               |     |     |  +--rw domain-searchlist-id        uint8 reserv-prefix-id     uint32
               |     |     |  +--rw domain-search-list-entry    string
     | reserv-prefix
               |     +--rw nis-config-option! {nis-config-op}?     |     |  |  +--rw nis-server* [nis-serv-id]       inet:ipv6-prefix
               |     |     |  +--rw nis-serv-id reserv-prefix-len    uint8
               |     |     |     +--rw nis-serv-addr    inet:ipv6-address option-set-id*        leafref
               |     |     +--rw nis-plus-config-option! {nis-plus-config-op}?
     | valid-lifetime
               |     |  +--rw nis-plus-server* [nis-plus-serv-id]     |       dhcpv6-common:timer-value-seconds32
               |     |     +--rw nis-plus-serv-id      uint8 renew-time
               |     |     |     +--rw nis-plus-serv-addr    inet:ipv6-address       dhcpv6-common:timer-value-seconds32
               |     |     +--rw nis-domain-name-option! {nis-domain-name-op}? rebind-time
               |     |     |  +--rw nis-domain-name?   string       dhcpv6-common:timer-value-seconds32
               |     |     +--rw nis-plus-domain-name-option! {nis-plus-domain-name-op}? preferred-lifetime
               |     |     |  +--rw nis-plus-domain-name?   string       dhcpv6-common:timer-value-seconds32
               |     |     +--rw sntp-server-option! {sntp-server-op}? rapid-commit          boolean
               |     +--ro active-leases* [leased-address]
               |        +--ro leased-address
               |  +--rw sntp-server* [sntp-serv-id]        |       inet:ipv6-address
               |        +--ro total-address-count        uint64
               |     +--rw sntp-serv-id      uint8        +--ro allocated-address-count    uint64
               |        +--ro binding-info* [client-duid]
               |           +--ro client-duid    binary
               |     +--rw sntp-serv-addr    inet:ipv6-address           +--ro iaid* [iaid]
               |              +--ro iaid                  uint32
               |     +--rw info-refresh-time-option! {info-refresh-time-op}?              +--ro allocation-time?
               |              |       yang:date-and-time
               |  +--rw info-refresh-time    yang:timeticks              +--ro last-renew-rebind?
               |              |     +--rw client-fqdn-option! {client-fqdn-op}?       yang:date-and-time
               |              +--ro preferred-lifetime?
               |              |  +--rw server-initiate-update    boolean       dhcpv6-common:timer-value-seconds
    32
               |              +--ro valid-lifetime?
               |              |  +--rw client-initiate-update    boolean       dhcpv6-common:timer-value-seconds
    32
               |              +--ro lease-t1?
               |              |  +--rw modify-name-from-cli      boolean       dhcpv6-common:timer-value-seconds
    32
               |              +--ro lease-t2?
               |                      dhcpv6-common:timer-value-seconds
    32
               +--rw posix-timezone-option! {posix-timezone-op}?
     |  | prefix-pools {prefix-delegation}?
               |  +--rw tz-posix    string
     |  |     +--rw tzdb-timezone-option! {tzdb-timezone-op}?
     |  |     |  +--rw tz-database    string
     |  |     +--rw ntp-server-option! {ntp-server-op}?
     |  |     |  +--rw ntp-server* [ntp-serv-id]
     |  |     |     +--rw ntp-serv-id                          uint8
     |  |     |     +--rw (ntp-time-source-suboption)?
     |  |     |        +--:(server-address)
     |  |     |        |  +--rw ntp-serv-addr-suboption*       inet:ipv6-address
     |  |     |        +--:(server-multicast-address)
     |  |     |        |  +--rw ntp-serv-mul-addr-suboption*   inet:ipv6-address
     |  |     |        +--:(server-fqdn)
     |  |     |           +--rw ntp-serv-fqdn-suboption*       string
     | prefix-pool* [pool-id]
               |     +--rw boot-file-url-option! {boot-file-url-op}?
     |  | pool-id                     uint32
               |     +--rw boot-file* [boot-file-id] prefix
               |     |       inet:ipv6-prefix
               |     +--rw boot-file-id prefix-length               uint8
               |  |     |     +--rw suitable-arch-type*   uint16
     |  |     |     +--rw suitable-net-if*      uint32
     |  | max-pd-space-utilization
               |     +--rw boot-file-url         string     |       dhcpv6-common:threshold
               |     +--rw boot-file-param-option! {boot-file-param-op}?
     |  | option-set-id*              leafref
               |     +--rw boot-file-params* [param-id] valid-lifetime
               |     |       dhcpv6-common:timer-value-seconds32
               |     +--rw param-id      uint8
     |  | renew-time
               |     +--rw parameter    string     |       dhcpv6-common:timer-value-seconds32
               |     +--rw aftr-name-option! {aftr-name-op}?
     |  | rebind-time
               |  +--rw tunnel-endpoint-name    string     |       dhcpv6-common:timer-value-seconds32
               |     +--rw kbr-default-name-option! {kbr-default-name-op}? preferred-lifetime
               |     |       dhcpv6-common:timer-value-seconds32
               |     +--rw default-realm-name    string
     | rapid-commit                boolean
               |     +--rw kbr-kdc-option! {kbr-kdc-op}?
     |  | host-reservations
               |        +--rw kdc-info* [kdc-id]
     | prefix-reservation* [reserved-prefix]
               |        |  +--rw kdc-id            uint8
     | client-duid?         binary
               |        |  +--rw priority          uint16 reserved-prefix
               |        |  |     +--rw weight            uint16
     |       inet:ipv6-prefix
               |        |  +--rw transport-type reserv-prefix-len    uint8
               |  |     |     +--rw port-number       uint16
     |  |     |     +--rw kdc-ipv6-addr     inet:ipv6-address
     |  |     |        +--rw realm-name        string
     | option-set-id*        leafref
               |        +--rw sol-max-rt-option! {sol-max-rt-op}?
     |  | valid-lifetime
               |  +--rw sol-max-rt-value    yang:timeticks        |       dhcpv6-common:timer-value-seconds32
               |        +--rw inf-max-rt-option! {inf-max-rt-op}?
     |  | renew-time
               |  +--rw inf-max-rt-value    yang:timeticks        |       dhcpv6-common:timer-value-seconds32
               |        +--rw addr-selection-option! {addr-selection-op}? rebind-time
               |        |       dhcpv6-common:timer-value-seconds32
               |        +--rw a-bit-set       boolean preferred-lifetime
               |        |       dhcpv6-common:timer-value-seconds32
               |        +--rw p-bit-set rapid-commit          boolean
               |        +--ro active-leases* [leased-prefix]
               |     |  +--rw policy-table* [policy-id]
     |  |     |     +--rw policy-id     uint8
     |  |     |     +--rw label         uint8
     |  |     |     +--rw precedence    uint8
     |  |     |     +--rw prefix-len    uint8
     |           +--ro leased-prefix
               |           |     +--rw prefix       inet:ipv6-prefix
               |           +--ro total-address-count        uint64
               |     +--rw pcp-server-option! {pcp-server-op}?           +--ro allocated-address-count    uint64
               |           +--ro binding-info* [client-duid]
               |              +--ro client-duid    binary
               |  +--rw pcp-server* [pcp-serv-id]              +--ro iaid* [iaid]
               |                 +--ro iaid                  uint32
               |                 +--ro allocation-time?
               |     +--rw pcp-serv-id      uint8                 |       yang:date-and-time
               |                 +--ro last-renew-rebind?
               |     +--rw pcp-serv-addr    inet:ipv6-address                 |       yang:date-and-time
               |     +--rw s46-rule-option! {s46-rule-op}?                 +--ro preferred-lifetime?
               |                 |       dhcpv6-common:timer-value-seco
    nds32
               |  +--rw s46-rule* [rule-id]                 +--ro valid-lifetime?
               |                 |       dhcpv6-common:timer-value-seco
    nds32
               |     +--rw rule-id           uint8                 +--ro lease-t1?
               |                 |       dhcpv6-common:timer-value-seco
    nds32
               |                 +--ro lease-t2?
               |                         dhcpv6-common:timer-value-seco
    nds32
               +--ro solicit-count?               uint32
               +--ro advertise-count?             uint32
               +--ro request-count?               uint32
               +--ro confirm-count?               uint32
               +--ro renew-count?                 uint32
               +--ro rebind-count?                uint32
               +--ro reply-count?                 uint32
               +--rw rule-type         enumeration release-count?               uint32
               +--ro decline-count?               uint32
               +--ro reconfigure-count?           uint32
               +--ro information-request-count?   uint32

      notifications:
        +---n address-pool-running-out
        |  +--ro total-address-count        uint64
        |  +--ro max-address-count          uint64
        |     +--rw prefix4-len       uint8  +--ro allocated-address-count    uint64
        |  +--ro pool-id                    uint32
        +---n pd-pool-running-out
        |  +--ro max-pd-space-utilization    dhcpv6-common:threshold
        |     +--rw ipv4-prefix       inet:ipv4-prefix  +--ro pd-space-utilization        dhcpv6-common:threshold
        |  +--ro pool-id                     uint32
        +---n invalid-client-detected
        |  +--ro duid?          binary
        |     +--rw prefix6-len       uint8  +--ro description?   string
        +---n decline-received
        |  +--ro duid?        binary
        |     |     +--rw ipv6-prefix       inet:ipv6-prefix
     |  |     |     +--rw port-parameter
     |  |     |        +--rw offset      uint8
     |  |     |        +--rw psid-len    uint8
     |  |     |        +--rw psid        uint16
     |  |     +--rw s46-br-option! {s46-br-op}?
     |  |     |  +--rw br* [br-id]
     |  |     |     +--rw br-id           uint8
     |  |     |     +--rw br-ipv6-addr    inet:ipv6-address
     |  |     +--rw s46-dmr-option! {s46-dmr-op}?
     |  |     |  +--rw dmr* [dmr-id]
     |  |     |     +--rw dmr-id             uint8
     |  |     |     +--rw dmr-prefix-len     uint8
     |  |     |     +--rw dmr-ipv6-prefix    inet:ipv6-prefix
     |  |     +--rw s46-v4-v6-binding-option! {s46-v4-v6-binding-op}?
     |  |     |  +--rw ce* [ce-id]
     |  |     |     +--rw ce-id               uint8
     |  |     |     +--rw ipv4-addr           inet:ipv4-address
     |  |     |     +--rw bind-prefix6-len    uint8
     |  |     |     +--rw bind-ipv6-prefix    inet:ipv6-prefix
     |  |     |     +--rw port-parameter
     |  |     |        +--rw offset      uint8
     |  |     |        +--rw psid-len    uint8
     |  |     |        +--rw psid        uint16
     |  |     +--rw operator-option-ipv6-address! {operator-op-ipv6-address}?
     |  |     |  +--rw operator-ipv6-addr* [operator-ipv6-addr-id]
     |  |     |     +--rw operator-ipv6-addr-id    uint8
     |  |     |     +--rw operator-ipv6-addr       inet:ipv6-address
     |  |     +--rw operator-option-single-flag! {operator-op-single-flag}?
     |  |     |  +--rw flag* [flag-id]
     |  |     |     +--rw flag-id       uint8
     |  |     |     +--rw flag-value    boolean
     |  |     +--rw operator-option-ipv6-prefix! {operator-op-ipv6-prefix}?
     |  |     |  +--rw operator-ipv6-prefix* [operator-ipv6-prefix-id]
     |  |     |     +--rw operator-ipv6-prefix-id      uint8
     |  |     |     +--rw operator-ipv6-prefix6-len    uint8
     |  |     |     +--rw operator-ipv6-prefix         inet:ipv6-prefix
     |  |     +--rw operator-option-int32! {operator-op-int32}?
     |  |     |  +--rw int32val* [int32val-id]
     |  |     |     +--rw int32val-id    uint8
     |  |     |     +--rw int32val       uint32
     |  |     +--rw operator-option-int16! {operator-op-int16}?
     |  |     |  +--rw int16val* [int16val-id]
     |  |     |     +--rw int16val-id    uint8
     |  |     |     +--rw int16val       uint16
     |  |     +--rw operator-option-int8! {operator-op-int8}?
     |  |     |  +--rw int8val* [int8val-id]
     |  |     |     +--rw int8val-id    uint8
     |  |     |     +--rw int8val       uint8
     |  |     +--rw operator-option-uri! {operator-op-uri}?
     |  |     |  +--rw uri* [uri-id]
     |  |     |     +--rw uri-id    uint8
     |  |     |     +--rw uri       string
     |  |     +--rw operator-option-textstring! {operator-op-textstring}?
     |  |     |  +--rw textstring* [textstring-id]
     |  |     |     +--rw textstring-id    uint8
     |  |     |     +--rw textstring       string
     |  |     +--rw operator-option-var-data! {operator-op-var-data}?
     |  |     |  +--rw int32val* [var-data-id]
     |  |     |     +--rw var-data-id    uint8
     |  |     |     +--rw var-data       binary
     |  |     +--rw operator-option-dns-wire! {operator-op-dns-wire}?
     |  |        +--rw operator-option-dns-wire* [operator-option-dns-wire-id]
     |  |           +--rw operator-option-dns-wire-id    uint8
     |  |           +--rw operator-option-dns-wire       binary
     |  +--rw network-ranges
     |  |  +--rw option-set-id?   -> /server/server-config/option-sets/option-set/option-set-id
     |  |  +--rw network-range* [network-range-id]
     |  |     +--rw network-range-id       uint32
     |  |     +--rw network-description    string
     |  |     +--rw network-prefix         inet:ipv6-prefix
     |  |     +--rw option-set-id?         -> /server/server-config/option-sets/option-set/option-set-id
     |  |     +--rw address-pools
     |  |     |  +--rw address-pool* [pool-id]
     |  |     |     +--rw pool-id               uint32
     |  |     |     +--rw pool-prefix?          inet:ipv6-prefix
     |  |     |     +--rw start-address         inet:ipv6-address-no-zone
     |  |     |     +--rw end-address           inet:ipv6-address-no-zone
     |  |     |     +--rw valid-lifetime        yang:timeticks
     |  |     |     +--rw renew-time            yang:timeticks
     |  |     |     +--rw rebind-time           yang:timeticks
     |  |     |     +--rw preferred-lifetime    yang:timeticks
     |  |     |     +--rw rapid-commit          boolean
     |  |     |     +--rw client-class?         string
     |  |     |     +--rw max-address-count     threshold
     |  |     |     +--rw option-set-id?        -> /server/server-config/option-sets/option-set/option-set-id
     |  |     +--rw pd-pools
     |  |     |  +--rw pd-pool* [pool-id]
     |  |     |     +--rw pool-id                     uint32
     |  |     |     +--rw prefix                      inet:ipv6-prefix
     |  |     |     +--rw delegated-length            uint8
     |  |     |     +--rw valid-lifetime              yang:timeticks
     |  |     |     +--rw renew-time                  yang:timeticks
     |  |     |     +--rw rebind-time                 yang:timeticks
     |  |     |     +--rw preferred-lifetime          yang:timeticks
     |  |     |     +--rw rapid-commit                boolean
     |  |     |     +--rw client-class?               string
     |  |     |     +--rw max-pd-space-utilization    threshold
     |  |     |     +--rw option-set-id?              -> /server/server-config/option-sets/option-set/option-set-id
     |  |     +--rw host-reservations
     |  |        +--rw host-reservation* [cli-id]
     |  |           +--rw cli-id                                   uint32
     |  |           +--rw (client-identifier)?
     |  |           |  +--:(duid)
     |  |           |  |  +--rw type-code?                         uint16
     |  |           |  |  +--rw (duid-type)?
     |  |           |  |     +--:(duid-llt)
     |  |           |  |     |  +--rw duid-llt-hardware-type?      uint16
     |  |           |  |     |  +--rw duid-llt-time?               yang:timeticks
     |  |           |  |     |  +--rw duid-llt-link-layer-addr?    yang:mac-address
     |  |           |  |     +--:(duid-en)
     |  |           |  |     |  +--rw duid-en-enterprise-number?   uint32
     |  |           |  |     |  +--rw duid-en-identifier?          string
     |  |           |  |     +--:(duid-ll)
     |  |           |  |     |  +--rw duid-ll-hardware-type?       uint16
     |  |           |  |     |  +--rw duid-ll-link-layer-addr?     yang:mac-address
     |  |           |  |     +--:(duid-uuid)
     |  |           |  |     |  +--rw uuid?                        yang:uuid
     |  |           |  |     +--:(duid-unknown)
     |  |           |  |        +--rw data?                        binary
     |  |           |  +--:(hw-address)
     |  |           |     +--rw hardware-address?                  yang:mac-address
     |  |           +--rw reserv-addr*                             inet:ipv6-address
     |  |           +--rw prefix-reservation* [reserv-prefix-id]
     |  |           |  +--rw reserv-prefix-id     uint32
     |  |           |  +--rw reserv-prefix        inet:ipv6-prefix
     |  |           |  +--rw reserv-prefix-len    uint8
     |  |           +--rw hostname?                                string
     |  |           +--rw option-set-id?                           -> /server/server-config/option-sets/option-set/option-set-id
     |  +--rw relay-opaque-params
     |  |  +--rw relays* [relay-name]
     |  |     +--rw relay-name        string
     |  |     +--rw interface-info* [if-name]
     |  |     |  +--rw if-name         string
     |  |     |  +--rw interface-id    string
     |  |     +--rw subscribers* [subscriber]
     |  |     |  +--rw subscriber       uint32
     |  |     |  +--rw subscriber-id    string
     |  |     +--rw remote-host* [ent-num]
     |  |        +--rw ent-num      uint32
     |  |        +--rw remote-id    string
     |  +--rw rsoo-enabled-options
     |     +--rw rsoo-enabled-option* [option-code]
     |        +--rw option-code    uint16
     |        +--rw description    string
     +--ro server-state
        +--ro network-ranges
        |  +--ro network-range* [network-range-id]
        |     +--ro network-range-id     uint32
        |     +--ro address-pools
        |     |  +--ro address-pool* [pool-id]
        |     |  |  +--ro pool-id                    uint32
        |     |  |  +--ro total-address-count        uint64
        |     |  |  +--ro allocated-address-conut    uint64
        |     |  +--ro binding-info* [cli-id]
        |     |     +--ro cli-id    uint32
        |     |     +--ro duid
        |     |     |  +--ro type-code?                         uint16
        |     |     |  +--ro (duid-type)?
        |     |     |     +--:(duid-llt)
        |     |     |     |  +--ro duid-llt-hardware-type?      uint16
        |     |     |     |  +--ro duid-llt-time?               yang:timeticks
        |     |     |     |  +--ro duid-llt-link-layer-addr?    yang:mac-address
        |     |     |     +--:(duid-en)
        |     |     |     |  +--ro duid-en-enterprise-number?   uint32
        |     |     |     |  +--ro duid-en-identifier?          string
        |     |     |     +--:(duid-ll)
        |     |     |     |  +--ro duid-ll-hardware-type?       uint16
        |     |     |     |  +--ro duid-ll-link-layer-addr?     yang:mac-address
        |     |     |     +--:(duid-uuid)
        |     |     |     |  +--ro uuid?                        yang:uuid
        |     |     |     +--:(duid-unknown)
        |     |     |        +--ro data?                        binary
        |     |     +--ro cli-ia* [iaid]
        |     |        +--ro ia-type     string
        |     |        +--ro iaid        uint32
        |     |        +--ro cli-addr*   inet:ipv6-address
        |     |        +--ro pool-id     uint32
        |     +--ro pd-pools
        |     |  +--ro prefix-pool* [pool-id]
        |     |  |  +--ro pool-id                 uint32
        |     |  |  +--ro pd-space-utilization    threshold
        |     |  +--ro binding-info* [cli-id]
        |     |     +--ro cli-id      uint32
        |     |     +--ro duid
        |     |     |  +--ro type-code?                         uint16
        |     |     |  +--ro (duid-type)?
        |     |     |     +--:(duid-llt)
        |     |     |     |  +--ro duid-llt-hardware-type?      uint16
        |     |     |     |  +--ro duid-llt-time?               yang:timeticks
        |     |     |     |  +--ro duid-llt-link-layer-addr?    yang:mac-address
        |     |     |     +--:(duid-en)
        |     |     |     |  +--ro duid-en-enterprise-number?   uint32
        |     |     |     |  +--ro duid-en-identifier?          string
        |     |     |     +--:(duid-ll)
        |     |     |     |  +--ro duid-ll-hardware-type?       uint16
        |     |     |     |  +--ro duid-ll-link-layer-addr?     yang:mac-address
        |     |     |     +--:(duid-uuid)
        |     |     |     |  +--ro uuid?                        yang:uuid
        |     |     |     +--:(duid-unknown)
        |     |     |        +--ro data?                        binary
        |     |     +--ro cli-iapd* [iaid]
        |     |        +--ro iaid              uint32
        |     |        +--ro cli-prefix*       inet:ipv6-prefix
        |     |        +--ro cli-prefix-len*   uint8
        |     |        +--ro pool-id           uint32
        |     +--ro host-reservations
        |        +--ro binding-info* [cli-id]
        |           +--ro cli-id      uint32
        |           +--ro duid
        |           |  +--ro type-code?                         uint16
        |           |  +--ro (duid-type)?
        |           |     +--:(duid-llt)
        |           |     |  +--ro duid-llt-hardware-type?      uint16
        |           |     |  +--ro duid-llt-time?               yang:timeticks
        |           |     |  +--ro duid-llt-link-layer-addr?    yang:mac-address
        |           |     +--:(duid-en)
        |           |     |  +--ro duid-en-enterprise-number?   uint32
        |           |     |  +--ro duid-en-identifier?          string
        |           |     +--:(duid-ll)
        |           |     |  +--ro duid-ll-hardware-type?       uint16
        |           |     |  +--ro duid-ll-link-layer-addr?     yang:mac-address
        |           |     +--:(duid-uuid)
        |           |     |  +--ro uuid?                        yang:uuid
        |           |     +--:(duid-unknown)
        |           |        +--ro data?                        binary
        |           +--ro cli-ia* [iaid]
        |           |  +--ro ia-type     string
        |           |  +--ro iaid        uint32
        |           |  +--ro cli-addr*   inet:ipv6-address
        |           +--ro cli-iapd* [iaid]
        |              +--ro iaid              uint32
        |              +--ro cli-prefix*       inet:ipv6-prefix
        |              +--ro cli-prefix-len*   uint8
        +--ro packet-stats
           +--ro solicit-count          uint32
           +--ro request-count          uint32
           +--ro renew-count            uint32
           +--ro rebind-count           uint32
           +--ro decline-count          uint32
           +--ro release-count          uint32
           +--ro info-req-count         uint32
           +--ro advertise-count        uint32
           +--ro confirm-count          uint32
           +--ro reply-count            uint32
           +--ro reconfigure-count      uint32
           +--ro relay-forward-count    uint32
           +--ro relay-reply-count      uint32

  notifications:
    +---n notifications
       +--ro dhcpv6-server-event
          +--ro address-pool-running-out
          |  +--ro total-address-count        uint64
          |  +--ro max-address-count          uint64
          |  +--ro allocated-address-conut    uint64
          |  +--ro duid
          |  |  +--ro type-code?                         uint16
          |  |  +--ro (duid-type)?
          |  |     +--:(duid-llt)
          |  |     |  +--ro duid-llt-hardware-type?      uint16
          |  |     |  +--ro duid-llt-time?               yang:timeticks
          |  |     |  +--ro duid-llt-link-layer-addr?    yang:mac-address
          |  |     +--:(duid-en)
          |  |     |  +--ro duid-en-enterprise-number?   uint32
          |  |     |  +--ro duid-en-identifier?          string
          |  |     +--:(duid-ll)
          |  |     |  +--ro duid-ll-hardware-type?       uint16
          |  |     |  +--ro duid-ll-link-layer-addr?     yang:mac-address
          |  |     +--:(duid-uuid)
          |  |     |  +--ro uuid?                        yang:uuid
          |  |     +--:(duid-unknown)
          |  |        +--ro data?                        binary
          |  +--ro serv-name?                 string
          |  +--ro pool-name                  string
          +--ro pd-pool-running-out
          |  +--ro max-pd-space-utilization    threshold
          |  +--ro pd-space-utilization        threshold
          |  +--ro duid
          |  |  +--ro type-code?                         uint16
          |  |  +--ro (duid-type)?
          |  |     +--:(duid-llt)
          |  |     |  +--ro duid-llt-hardware-type?      uint16
          |  |     |  +--ro duid-llt-time?               yang:timeticks
          |  |     |  +--ro duid-llt-link-layer-addr?    yang:mac-address
          |  |     +--:(duid-en)
          |  |     |  +--ro duid-en-enterprise-number?   uint32
          |  |     |  +--ro duid-en-identifier?          string
          |  |     +--:(duid-ll)
          |  |     |  +--ro duid-ll-hardware-type?       uint16
          |  |     |  +--ro duid-ll-link-layer-addr?     yang:mac-address
          |  |     +--:(duid-uuid)
          |  |     |  +--ro uuid?                        yang:uuid
          |  |     +--:(duid-unknown)
          |  |        +--ro data?                        binary
          |  +--ro serv-name?                  string
          |  +--ro pool-name                   string
          +--ro invalid-client-detected
             +--ro duid
             |  +--ro type-code?                         uint16
             |  +--ro (duid-type)?
             |     +--:(duid-llt)
             |     |  +--ro duid-llt-hardware-type?      uint16
             |     |  +--ro duid-llt-time?               yang:timeticks
             |     |  +--ro duid-llt-link-layer-addr?    yang:mac-address
             |     +--:(duid-en)
             |     |  +--ro duid-en-enterprise-number?   uint32
             |     |  +--ro duid-en-identifier?          string
             |     +--:(duid-ll)
             |     |  +--ro duid-ll-hardware-type?       uint16
             |     |  +--ro duid-ll-link-layer-addr?     yang:mac-address
             |     +--:(duid-uuid)
             |     |  +--ro uuid?                        yang:uuid
             |     +--:(duid-unknown)
             |        +--ro data?                        binary
             +--ro description?   string

                   Figure 1: DHCPv6 Data Model Structure

   Introduction of important nodes:

   o  server-config: This container contains the configuration data of a
      server.

   o  serv-attributes: This container contains basic attributes of a
      DHCPv6 server such as DUID, server name and so on.  Some optional
      functions that can be provided by the server is also included.

   o  duid: Each server and client has only one DUID (DHCP Unique
      Identifier).  The DUID here identifies a unique DHCPv6 server for
      clients.  DUID consists of a two-octet type field and an arbitrary
      length (no more than 128 bytes) content field.  Currently there
      are four defined types of DUIDs in [RFC3315] and [RFC6355] - DUID-
      LLT, DUID-EN, DUID-LL and DUID-UUID.  DUID-Unknown represents
      those unconventional DUIDs.

   o  lease-storage: The server can store lease data in different
      repositories, whether in a CSV file for smaller deployments or in
      a database for larger deployments.

   o  operator-option-ipv6-address, operator-option-single-flag,
      operator-option-ipv6-prefix, operator-option-int32, operator-
      option-int16, operator-option-int8, operator-option-uri, operator-
      option-textstring, operator-option-var-data, operator-option-dns-
      wire: are generic option formats described in [RFC7227].

   o  interfaces-config: 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 the server is being configured to
      listen on a unicast address assigned to a specific interface, the
      format "eth1/2001:db8::1" can be used.

   o  option-sets: DHCPv6 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.  The relevant RFCs that define those options include:
      [RFC3315], [RFC3319], [RFC3646], [RFC3898], [RFC4242], [RFC4704],
      [RFC4833], [RFC5908], [RFC5970], [RFC4075], [RFC6334], [RFC6784],
      [RFC7078], [RFC7083], [RFC7291], [RFC7598].

   o  option-set: 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).

   o  network-ranges: 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.

   o  network-range: 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.

   o  address-pools: Under the "network-range" list, a container
      describes the DHCPv6 server's address pools for a specific network
      is defined.  This container supports the server to be configured
      at a pool level.

   o  address-pool: A DHCPv6 server can be configured with several
      address pools for a specific network.  This list defines such
      address pools which are distinguish by the key called "pool-id".

   o  rapid-commit: Setting the value to 'true' represents the address/
      prefix pool support the Solicit-Reply message exchange. 'false'
      means the server will simply ignore the Rapid Commit option in
      Solicit message.

   o  client-class: If this is instantiated, the address/pd pool will
      only serve the clients belonging to this class.

   o  max-address-count: Maximum count of addresses that can be
      allocated in this pool.  This value may be less than count of
      total addresses in this pool.

   o  prefix-pools: If a server supports prefix delegation function,
      this container under the "network-range" list will be valid to
      define the delegating router's prefix pools for a specific
      network.  This container also supports the server to be configured
      at a pool level.

   o  prefix-pool: Similar to server's address pools, a delegating
      router can also be configured with multiple prefix pools specified
      by a list called "prefix-pool".

   o  max-pd-space-utilization: Maximum utilization of pd space in this
      pool.

   o  host-reservations: This container allows the server to make
      reservations at host level.

   o  host-reservation: This list allows the server to reserve
      addresses, prefixes, hostname and options for different clients.
      A server may reserve multiple addresses and prefixes for a single
      client.

   o  relay-opaque-params: 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.

   o  rsoo-enabled-options: [RFC6422] requires that the server SHOULD
      have an administrator-configurable list of RSOO-enabled options.
      This container include a list called "rsoo-enabled-option" to
      allow new RSOO-enabled options to be defined at the server side.

   o  server-state: This container includes the state data of a server.

   o  binding-info: A list records a static binding information for each
      DHCPv6 client that has already been assigned IPv6 addresses/
      prefixes that are dynamically allocated and reserved in advance.

   o  packet-stats: A container presents the packet statistics related
      to the DHCPv6 server.

   Information about notifications:

   o  address/pd-pool-running-out: raised when the address/prefix pool
      is going to run out.  A threshold for utilization ratio of the
      pool (max-address-count/max-pd-space utilization) 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.

   o  invalid-client-detected: raised when the server has found a client
      which can be regarded as a potential attacker.  Some description
      could also be included.

2.2.  DHCPv6 Relay Tree Diagrams

module: ietf-dhcpv6-relay
    +--rw relay!
       +--rw relay-config
       |  +--rw relay-attributes
       |  |  +--rw name?          string
       |  |  +--rw description?   string
       |  |  +--rw dest-addrs*    inet:ipv6-address
       |  |  +--rw subscribers* [subscriber]
       |  |  |  +--rw subscriber       uint8
       |  |  |  +--rw subscriber-id    string
       |  |  +--rw remote-host* [ent-num]
       |  |  |  +--rw ent-num      uint32
       |  |  |  +--rw remote-id    string
       |  |  +--rw vendor-info
       |  |     +--rw ent-num    uint32
       |  |     +--rw data*      string
       |  +--rw rsoo-option-sets
       |  |  +--rw option-set* [option-set-id]
       |  |     +--rw option-set-id                   uint32
       |  |     +--rw erp-local-domain-name-option!
                                  {erp-local-domain-name-op}?
       |  |        +--rw erp-for-client* [cli-id]
       |  |           +--rw cli-id      uint32
       |  |           +--rw duid
       |  |           |  +--rw type-code?                   uint16
       |  |           |  +--rw (duid-type)?
       |  |           |     +--:(duid-llt)
       |  |           |     |  +--rw duid-llt-hardware-type?      uint16
       |  |           |     |  +--rw duid-llt-time?        yang:timeticks
       |  |           |     |  +--rw duid-llt-link-layer-addr?
                                                        yang:mac-address
       |  |           |     +--:(duid-en)
       |  |           |     |  +--rw duid-en-enterprise-number?   uint32
       |  |           |     |  +--rw duid-en-identifier?          string
       |  |           |     +--:(duid-ll)
       |  |           |     |  +--rw duid-ll-hardware-type?       uint16
       |  |           |     |  +--rw duid-ll-link-layer-addr?
                                                        yang:mac-address
       |  |           |     +--:(duid-uuid)
       |  |           |     |  +--rw uuid?                     yang:uuid
       |  |           |     +--:(duid-unknown)
       |  |           |        +--rw data?                        binary
       |  |           +--rw erp-name    string
       |  +--rw relay-if* [if-name]
       |     +--rw if-name               if:interface-ref
       |     +--rw interface-id?         string
       |     +--rw ipv6-address?         inet:ipv6-address
       |     +--rw rsoo-option-set-id?
        -> /relay/relay-config/rsoo-option-sets/option-set/option-set-id
       |     +--rw next-entity* [dest-addr]
       |        +--rw dest-addr    inet:ipv6-address
       |        +--rw available    boolean
       |        +--rw multicast    boolean
       |        +--rw server       boolean
       +--ro relay-state
          +--ro relay-if* [if-name]
          |  +--ro if-name        string
          |  +--ro pd-route* [pd-route-id]
          |  |  +--ro pd-route-id             uint8
          |  |  +--ro requesting-router-id    uint32
          |  |  +--ro delegating-router-id    uint32
          |  |  +--ro next-router             inet:ipv6-address
          |  |  +--ro last-router             inet:ipv6-address
          |  +--ro next-entity* [dest-addr]
          |     +--ro dest-addr       inet:ipv6-address
          |     +--ro packet-stats
          |        +--ro solicit-rvd-count       uint32
          |        +--ro request-rvd-count       uint32
          |        +--ro renew-rvd-count         uint32
          |        +--ro rebind-rvd-count        uint32
          |        +--ro decline-rvd-count       uint32
          |        +--ro release-rvd-count       uint32
          |        +--ro info-req-rvd-count      uint32
          |        +--ro relay-for-rvd-count     uint32
          |        +--ro relay-rep-rvd-count     uint32
          |        +--ro packet-to-cli-count     uint32
          |        +--ro adver-sent-count        uint32
          |        +--ro confirm-sent-count      uint32
          |        +--ro reply-sent-count        uint32
          |        +--ro reconfig-sent-count     uint32
          |        +--ro relay-for-sent-count    uint32
          |        +--ro relay-rep-sent-count    uint32
          +--ro relay-stats
             +--ro cli-packet-rvd-count      uint32
             +--ro relay-for-rvd-count       uint32
             +--ro relay-rep-rvd-count       uint32
             +--ro packet-to-cli-count       uint32
             +--ro relay-for-sent-count      uint32
             +--ro relay-rep-sent-count      uint32
             +--ro discarded-packet-count    uint32

  notifications:
    +---n notifications
       +--ro dhcpv6-relay-event
          +--ro topo-changed
             +--ro relay-if-name       string
             +--ro first-hop           boolean
             +--ro last-entity-addr    inet:ipv6-address

   Introduction of important nodes:

   o  relay-config: This container contains the configuration data of
      the relay.

   o  relay-attributes: A container describes some basic attributes of
      the relay agent including some relay agent specific options data
      that need to be configured previously.  Such options include
      Remote-Id option and Subscriber-Id option.

   o  dest-addrs: Each DHCPv6 relay agent may be configured with a list
      of destination addresses.  This node defines such a list of IPv6
      addresses that may include unicast addresses, multicast addresses
      or other addresses.

   o  rsoo-options-sets: DHCPv6 relay agent could provide some
      information that would be useful to DHCPv6 client.  Since relay
      agent cannot provide options directly to the client, [RFC6422]
      defines RSOO-enabled options to propose options for the server to
      send to the client.  This container models such RSOO-enabled
      options.

   o  option-set: This list under the "rsoo-option-sets" container is
      similar to the that defined in server module.  It allows the relay
      to implement several sets of RSOO-enabled options for different
      interfaces.  The list only include the EAP Re-authentication
      Protocol (ERP) Local Domain Name DHCPv6 Option defined in
      [RFC6440], since it is the only one RSOO-enabled options accepted
      by IANA so far.

   o  relay-if: A relay agent may have several interfaces, we should
      provide a way to configure and manage parameters on the interface-
      level.  A list that describes specific interfaces and their
      corresponding parameters is employed to fulfill the configuration.
      Here we use a string called "if-name" as the key of list.

   o  relay-state: This container contains the configuration data of the
      relay.

   o  pd-route: A sub-container of "relay-if" which describes the route
      for delegated prefixes into the provider edge router.

   o  next-entity: This node defines a list that is used to describe the
      next hop entity of this relay agent.  Different entities are
      distinguished by their addresses.

   o  packet-stats: A container shows packet state information of a
      specific data communication.

   o  relay-stats: The "relay-stats" container records and presents the
      overall packet statistics of the relay agent.

   Information about notifications:

   o  topo-changed: raised when the topology of the relay agent is
      changed.

2.3.  DHCPv6 Client Tree Diagrams

module: ietf-dhcpv6-client
    +--rw client!
       +--rw client-config
       |  +--rw duid
       |  |  +--rw type-code?                   uint16
       |  |  +--rw (duid-type)?
       |  |     +--:(duid-llt)
       |  |     |  +--rw duid-llt-hardware-type?      uint16
       |  |     |  +--rw duid-llt-time?               yang:timeticks
       |  |     |  +--rw duid-llt-link-layer-addr?    yang:mac-address
       |  |     +--:(duid-en)
       |  |     |  +--rw duid-en-enterprise-number?   uint32
       |  |     |  +--rw duid-en-identifier?          string
       |  |     +--:(duid-ll)
       |  |     |  +--rw duid-ll-hardware-type?       uint16
       |  |     |  +--rw duid-ll-link-layer-addr?     yang:mac-address
       |  |     +--:(duid-uuid)
       |  |     |  +--rw uuid?                        yang:uuid
       |  |     +--:(duid-unknown)
       |  |        +--rw data?                        binary
       |  +--rw client-if* [if-name]
       |     +--rw if-name                      if:interface-ref
       |     +--rw cli-id                       uint32
       |     +--rw pd-function                  boolean
       |     +--rw rapid-commit                 boolean
       |     +--rw client-configured-options
       |        +--rw new-or-standard-cli-option* [option-code]
       |        |  +--rw option-code           uint16
       |        |  +--rw option-name           string
       |        |  +--rw option-description    string
       |        |  +--rw option-reference?     string
       |        |  +--rw option-value          string
       |        +--rw option-request-option! {option-request-op}?
       |        |  +--rw oro-option* [option-code]
       |        |     +--rw option-code    uint16
       |        |     +--rw description    string
       |        +--rw user-class-option! {user-class-op}?
       |        |  +--rw user-class* [user-class-id]
       |        |     +--rw user-class-id      uint8
       |        |     +--rw user-class-data    string
       |        +--rw vendor-class-option! {vendor-class-op}?
       |        |  +--rw enterprise-number    uint32
       |        |  +--rw vendor-class* [vendor-class-id]
       |        |     +--rw vendor-class-id      uint8
       |        |     +--rw vendor-class-data    string
       |        +--rw client-fqdn-option! {client-fqdn-op}?
       |        |  +--rw fqdn                      string
       |        |  +--rw server-initiate-update    boolean
       |        |  +--rw client-initiate-update    boolean
       |        +--rw client-arch-type-option! {client-arch-type-op}?
       |        |  +--rw architecture-types* [type-id]
       |        |     +--rw type-id           uint16
       |        |     +--rw most-preferred    boolean
       |        +--rw client-network-interface-identifier-option!
                            {client-network-interface-identifier-op}?
       |        |  +--rw type     uint8
       |        |  +--rw major    uint8
       |        |  +--rw minor    uint8
       |        +--rw kbr-principal-name-option! {kbr-principal-name-op}?
       |        |  +--rw principle-name* [principle-name-id]
       |        |     +--rw principle-name-id    uint8
       |        |     +--rw name-type            int32
       |        |     +--rw name-string          string
       |        +--rw kbr-realm-name-option! {kbr-realm-name-op}?
       |        |  +--rw realm-name    string
       |        +--rw client-link-layer-addr-option!
                                            {client-link-layer-addr-op}?
       |           +--rw link-layer-type    uint16
       |           +--rw link-layer-addr    string
       +--ro client-state
          +--ro if-other-params
          |  +--ro server-unicast-option! {server-unicast-op}?
          |  |  +--ro server-address?   inet:ipv6-address
          |  +--ro sip-server-domain-name-list-option!
                                        {sip-server-domain-name-list-op}?
          |  |  +--ro sip-serv-domain-name    string
          |  +--ro sip-server-address-list-option!
                                            {sip-server-address-list-op}?
          |  |  +--ro sip-server* [sip-serv-id]
          |  |     +--ro sip-serv-id      uint8
          |  |     +--ro sip-serv-addr    inet:ipv6-address
          |  +--ro dns-servers-option! {dns-servers-op}?
          |  |  +--ro dns-server* [dns-serv-id]
          |  |     +--ro dns-serv-id      uint8
          |  |     +--ro dns-serv-addr    inet:ipv6-address
          |  +--ro domain-searchlist-option! {domain-searchlist-op}?
          |  |  +--ro domain-searchlist* [domain-searchlist-id]
          |  |     +--ro domain-searchlist-id        uint8
          |  |     +--ro domain-search-list-entry    string
          |  +--ro nis-config-option! {nis-config-op}?
          |  |  +--ro nis-server* [nis-serv-id]
          |  |     +--ro nis-serv-id      uint8
          |  |     +--ro nis-serv-addr    inet:ipv6-address
          |  +--ro nis-plus-config-option! {nis-plus-config-op}?
          |  |  +--ro nis-plus-server* [nis-plus-serv-id]
          |  |     +--ro nis-plus-serv-id      uint8
          |  |     +--ro nis-plus-serv-addr    inet:ipv6-address
          |  +--ro nis-domain-name-option! {nis-domain-name-op}?
          |  |  +--ro nis-domain-name?   string
          |  +--ro nis-plus-domain-name-option! {nis-plus-domain-name-op}?
          |  |  +--ro nis-plus-domain-name?   string
          |  +--ro sntp-server-option! {sntp-server-op}?
          |  |  +--ro sntp-server* [sntp-serv-id]
          |  |     +--ro sntp-serv-id      uint8
          |  |     +--ro sntp-serv-addr    inet:ipv6-address
          |  +--ro info-refresh-time-option! {info-refresh-time-op}?
          |  |  +--ro info-refresh-time    yang:timeticks
          |  +--ro client-fqdn-option! {client-fqdn-op}?
          |  |  +--ro server-initiate-update    boolean
          |  |  +--ro client-initiate-update    boolean
          |  |  +--ro modify-name-from-cli      boolean
          |  +--ro posix-timezone-option! {posix-timezone-op}?
          |  |  +--ro tz-posix    string
          |  +--ro tzdb-timezone-option! {tzdb-timezone-op}?
          |  |  +--ro tz-database    string
          |  +--ro ntp-server-option! {ntp-server-op}?
          |  |  +--ro ntp-server* [ntp-serv-id]
          |  |     +--ro ntp-serv-id                    uint8
          |  |     +--ro (ntp-time-source-suboption)?
          |  |        +--:(server-address)
          |  |        |  +--ro ntp-serv-addr-suboption*  inet:ipv6-address
          |  |        +--:(server-multicast-address)
          |  |        |  +--ro ntp-serv-mul-addr-suboption*
                                                        inet:ipv6-address
          |  |        +--:(server-fqdn)
          |  |           +--ro ntp-serv-fqdn-suboption*       string
          |  +--ro boot-file-url-option! {boot-file-url-op}?
          |  |  +--ro boot-file* [boot-file-id]
          |  |     +--ro boot-file-id          uint8
          |  |     +--ro suitable-arch-type*   uint16
          |  |     +--ro suitable-net-if*      uint32
          |  |     +--ro boot-file-url         string
          |  +--ro boot-file-param-option! {boot-file-param-op}?
          |  |  +--ro boot-file-params* [param-id]
          |  |     +--ro param-id      uint8
          |  |     +--ro parameter    string
          |  +--ro aftr-name-option! {aftr-name-op}?
          |  |  +--ro tunnel-endpoint-name    string
          |  +--ro kbr-default-name-option! {kbr-default-name-op}?
          |  |  +--ro default-realm-name    string
          |  +--ro kbr-kdc-option! {kbr-kdc-op}?
          |  |  +--ro kdc-info* [kdc-id]
          |  |     +--ro kdc-id            uint8
          |  |     +--ro priority          uint16
          |  |     +--ro weight            uint16
          |  |     +--ro transport-type    uint8
          |  |     +--ro port-number       uint16
          |  |     +--ro kdc-ipv6-addr     inet:ipv6-address
          |  |     +--ro realm-name        string
          |  +--ro sol-max-rt-option! {sol-max-rt-op}?
          |  |  +--ro sol-max-rt-value    yang:timeticks
          |  +--ro inf-max-rt-option! {inf-max-rt-op}?
          |  |  +--ro inf-max-rt-value    yang:timeticks
          |  +--ro addr-selection-option! {addr-selection-op}?
          |  |  +--ro a-bit-set       boolean
          |  |  +--ro p-bit-set       boolean
          |  |  +--ro policy-table* [policy-id]
          |  |     +--ro policy-id     uint8
          |  |     +--ro label         uint8
          |  |     +--ro precedence    uint8
          |  |     +--ro prefix-len    uint8
          |  |     +--ro prefix        inet:ipv6-prefix
          |  +--ro pcp-server-option! {pcp-server-op}?
          |  |  +--ro pcp-server* [pcp-serv-id]
          |  |     +--ro pcp-serv-id      uint8
          |  |     +--ro pcp-serv-addr    inet:ipv6-address
          |  +--ro s46-rule-option! {s46-rule-op}?
          |  |  +--ro s46-rule* [rule-id]
          |  |     +--ro rule-id           uint8
          |  |     +--ro rule-type         enumeration
          |  |     +--ro prefix4-len       uint8
          |  |     +--ro ipv4-prefix       inet:ipv4-prefix
          |  |     +--ro prefix6-len       uint8
          |  |     +--ro ipv6-prefix       inet:ipv6-prefix
          |  |     +--ro port-parameter
          |  |        +--ro offset      uint8
          |  |        +--ro psid-len    uint8
          |  |        +--ro psid        uint16
          |  +--ro s46-br-option! {s46-br-op}?
          |  |  +--ro br* [br-id]
          |  |     +--ro br-id           uint8
          |  |     +--ro br-ipv6-addr    inet:ipv6-address
          |  +--ro s46-dmr-option! {s46-dmr-op}?
          |  |  +--ro dmr* [dmr-id]
          |  |     +--ro dmr-id             uint8
          |  |     +--ro dmr-prefix-len     uint8
          |  |     +--ro dmr-ipv6-prefix    inet:ipv6-prefix
          |  +--ro s46-v4-v6-binding-option! {s46-v4-v6-binding-op}?
          |     +--ro ce* [ce-id]
          |        +--ro ce-id               uint8
          |        +--ro ipv4-addr           inet:ipv4-address
          |        +--ro bind-prefix6-len    uint8
          |        +--ro bind-ipv6-prefix    inet:ipv6-prefix
          |        +--ro port-parameter
          |           +--ro offset      uint8
          |           +--ro psid-len    uint8
          |           +--ro psid        uint16
          +--ro packet-stats
             +--ro solicit-count        uint32
             +--ro request-count        uint32
             +--ro renew-count          uint32
             +--ro rebind-count         uint32
             +--ro decline-count        uint32
             +--ro release-count        uint32
             +--ro info-req-count       uint32
             +--ro advertise-count      uint32
             +--ro confirm-count        uint32
             +--ro reply-count          uint32
             +--ro reconfigure-count    uint32

  notifications:
    +---n notifications
       +--ro dhcpv6-client-event
          +--ro ia-lease-event
          |  +--ro event-type     enumeration
          |  +--ro duid
          |  |  +--ro type-code?                   uint16
          |  |  +--ro (duid-type)?
          |  |     +--:(duid-llt)
          |  |     |  +--ro duid-llt-hardware-type?      uint16
          |  |     |  +--ro duid-llt-time?               yang:timeticks
          |  |     |  +--ro duid-llt-link-layer-addr?    yang:mac-address
          |  |     +--:(duid-en)
          |  |     |  +--ro duid-en-enterprise-number?   uint32
          |  |     |  +--ro duid-en-identifier?          string
          |  |     +--:(duid-ll)
          |  |     |  +--ro duid-ll-hardware-type?       uint16
          |  |     |  +--ro duid-ll-link-layer-addr?     yang:mac-address
          |  |     +--:(duid-uuid)
          |  |     |  +--ro uuid?                        yang:uuid
          |  |     +--:(duid-unknown)
          |  |        +--ro data?                        binary
          |  +--ro iaid           uint32
          |  +--ro serv-name?     string
          |  +--ro description?   string
          +--ro invalid-ia-detected
          |  +--ro duid
          |  |  +--ro type-code?                   uint16
          |  |  +--ro (duid-type)?
          |  |     +--:(duid-llt)
          |  |     |  +--ro duid-llt-hardware-type?      uint16
          |  |     |  +--ro duid-llt-time?               yang:timeticks
          |  |     |  +--ro duid-llt-link-layer-addr?    yang:mac-address
          |  |     +--:(duid-en)
          |  |     |  +--ro duid-en-enterprise-number?   uint32
          |  |     |  +--ro duid-en-identifier?          string
          |  |     +--:(duid-ll)
          |  |     |  +--ro duid-ll-hardware-type?       uint16
          |  |     |  +--ro duid-ll-link-layer-addr?     yang:mac-address
          |  |     +--:(duid-uuid)
          |  |     |  +--ro uuid?                        yang:uuid
          |  |     +--:(duid-unknown)
          |  |        +--ro data?                        binary
          |  +--ro cli-duid       uint32
          |  +--ro iaid           uint32
          |  +--ro serv-name?     string
          |  +--ro description?   string
          +--ro retransmission-failed
          |  +--ro duid
          |  |  +--ro type-code?                   uint16
          |  |  +--ro (duid-type)?
          |  |     +--:(duid-llt)
          |  |     |  +--ro duid-llt-hardware-type?      uint16
          |  |     |  +--ro duid-llt-time?               yang:timeticks
          |  |     |  +--ro duid-llt-link-layer-addr?    yang:mac-address
          |  |     +--:(duid-en)
          |  |     |  +--ro duid-en-enterprise-number?   uint32
          |  |     |  +--ro duid-en-identifier?          string
          |  |     +--:(duid-ll)
          |  |     |  +--ro duid-ll-hardware-type?       uint16
          |  |     |  +--ro duid-ll-link-layer-addr?     yang:mac-address
          |  |     +--:(duid-uuid)
          |  |     |  +--ro uuid?                        yang:uuid
          |  |     +--:(duid-unknown)
          |  |        +--ro data?                        binary
          |  +--ro description    enumeration
          +--ro failed-status-turn-up
             +--ro duid
             |  +--ro type-code?                   uint16
             |  +--ro (duid-type)?
             |     +--:(duid-llt)
             |     |  +--ro duid-llt-hardware-type?      uint16
             |     |  +--ro duid-llt-time?               yang:timeticks
             |     |  +--ro duid-llt-link-layer-addr?    yang:mac-address
             |     +--:(duid-en)
             |     |  +--ro duid-en-enterprise-number?   uint32
             |     |  +--ro duid-en-identifier?          string
             |     +--:(duid-ll)
             |     |  +--ro duid-ll-hardware-type?       uint16
             |     |  +--ro duid-ll-link-layer-addr?     yang:mac-address
             |     +--:(duid-uuid)
             |     |  +--ro uuid?                        yang:uuid
             |     +--:(duid-unknown)
             |        +--ro data?                        binary
             +--ro status-code    enumeration

   Introduction of important nodes:

   o  client-config: This container includes the configuration data of
      the client.

   o  duid: Each server and client has only one DUID (DHCP Unique
      Identifier).  The DUID here will be carried in the Client ID
      option to identify a specific DHCPv6 client.  This leaf are same
      as the "duid" leaf in "dhcpv6-server" feature.

   o  client-if: A client may have several interfaces, it is more
      reasonable to configure and manage parameters on the interface-
      level.  The list defines a specific client interface and its data.
      Different interfaces are distinguished by the "ifName" key which
      is a configurable string value.

   o  pd-function: Whether the client can act as a requesting router to
      request prefixes using prefix delegation ([RFC3633]).

   o  rapid-commit: 'true' indicates a client can initiate a Solicit-
      Reply message exchange by adding a Rapid Commit option in Solicit
      message.  'false' means the client is not allowed to add a Rapid
      Commit option to request addresses in a two-message exchange
      pattern.

   o  client-configured-options: Similar to the server, the client also
      need to configure some options to fulfill some desired functions.
      This container include all the potential options that need to be
      configured at the client side.  The relevant RFCs that define
      those options include: [RFC3315], [RFC4704], [RFC5970], [RFC6784],
      [RFC6939].

   o  option-request-option: This container provide a way to configure
      the list of options that the client will request in its ORO
      option.

   o  client-state: This container includes the state data of the
      client.

   o  if-other-params: A client can obtain extra configuration data
      other than address and prefix information through DHCPv6 options.
      This container describes such data the client was configured
      through DHCPv6.  The potential configuration data may include DNS
      server parameters, SIP server parameters and etc.

   o  packet-stats: A container records all the packet status
      information of a specific interface.

   Information about notifications:

   o  ia-lease-event: raised when the client was allocated a new IA from
      the server or it renew/rebind/release its current IA.

   o  invalid-ia-detected: raised when the identity association of the
      client can be proved to be invalid.  Possible condition includes
      duplicated address, illegal address, etc.

   o  retransmission-failed: raised when the retransmission mechanism
      defined in [RFC3315] is failed.

   o  failed-status-turn-up: raised when the client receives a message
      includes an unsuccessful Status Code option.

3.  DHCPv6 YANG Model

3.1.  DHCPv6 Server YANG Model

   This module imports typedefs from [RFC6991], [RFC7223].

<CODE BEGINS> file "ietf-dhcpv6-server.yang"
module ietf-dhcpv6-server {
        yang-version 1.1;
        namespace "urn:ietf:params:xml:ns:yang:ietf-dhcpv6-server";
        prefix "dhcpv6-server";

        import ietf-inet-types {
                prefix inet;
  }
        import ietf-yang-types {
        prefix yang;
        }
        import ietf-dhcpv6-options {
        prefix dhcpv6-options;
  }
  import ietf-dhcpv6-types {
        prefix dhcpv6-types;
  }
  import ietf-interfaces {
        prefix if;
  }

  organization "DHC WG";
  contact
        "cuiyong@tsinghua.edu.cn
         lh.sunlinh@gmail.com
         ian.farrer@telekom.de
         sladjana.zechlin@telekom.de
         hezihao9512@gmail.com";

        description "This model defines a YANG data model that can be
        used to configure and manage a DHCPv6 server.";

  revision 2018-09-04 {
    description "";
    reference "I-D: draft-ietf-dhc-dhcpv6-yang";
  }

  revision 2018-03-04 {
        description "Resolved most issues on the DHC official
        github";
        reference "I-D: draft-ietf-dhc-dhcpv6-yang";
  }

        revision 2017-12-22 {
                description "Resolve most issues on Ian's github.";
        reference "I-D: draft-ietf-dhc-dhcpv6-yang";
        }

        revision 2017-11-24 {
        description "First version of the separated server specific
                YANG model.";
        reference "I-D: draft-ietf-dhc-dhcpv6-yang";
        }

        /*
        * 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 "DHCPv6 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 DHCPv6 server
                     such as IPv6 address, server name  and so on. Some optional
                     functions that can be provided  by the server is also included.";
                    container duid {
                      description "Sets the DUID of server";
                      uses dhcpv6-types:duid;
                    }
                    leaf name {
                type string;
                description "server's name";
                    }
                    leaf description {
                type string;
                description "description of the server.";
                    }
                    leaf-list ipv6-address {
                type inet:ipv6-address;
                description "server's IPv6 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 people want the server to listen on a unicast
                  address with a specific interface, he can use the format like
                  'eth1/2001:db8::1'.";
                    }
                                container lease-storage {
                                        description "Indicates how the server stores the lease";
                                        choice storage-type {
                                                description "the type of lease storage";
                                                // leaf persist {
                                                //              type boolean;
                                                //              mandatory true;
                                                //              description "controls whether the new leases and updates to existing leases are
                                                //              written to the file";
                                                // }
                                                case memfile {
                                                        description "the server stores lease information in a CSV file";

                                                        leaf memfile-name {
                                                                type string;
                                                                description "specifies an absolute location of the lease file in which new leases
                                                                and lease updates will be recorded";
                                                        }

                                                        leaf memfile-lfc-interval {
                                                                type uint64;
                                                                description "specifies the interval in seconds, at which the server will perform a
                                                                lease file cleanup (LFC)";
                                                        }

                                                }
                                                case mysql {
                                                        leaf mysql-name {
                                                                type string;
                                                                description "type of the database";
                                                        }
                                                        leaf mysql-host {
                                                                type string;
                                                                description "If the database is located
                                                                on a different system to the DHCPv6 server, the database host name must also be specified.";
                                                        }
                                                        leaf mysql-password {
                                                                type string;
                                                                description "the credentials of the account under which the server will access the database";
                                                        }
                                                        leaf mysql-port {
                                                                type uint8;
                                                                description "If the database is located on a different system, the port number may be specified";
                                                        }
                                                        leaf mysql-lfc-interval {
                                                                type uint64;
                                                                description "specifies the interval in seconds, at which the server will perform a
                                                                lease file cleanup (LFC)";
                                                        }
                                                        leaf mysql-connect-timeout {
                                                                type uint64;
                                                                description "If the database is located on a different system, a longer interval needs to be specified";
                                                        }

                                                }
                                                case postgresql {
                                                        leaf postgresql-name {
                                                                type string;
                                                                description "type of the database";
                                                        }
                                                        leaf postgresql-host {
                                                                type string;
                                                                description "If the database is located
                                                                on a different system to the DHCPv6 server, the database host name must also be specified.";
                                                        }
                                                        leaf postgresql-password {
                                                                type string;
                                                                description "the credentials of the account under which the server will access the database";
                                                        }
                                                        leaf postgresql-port {
                                                                type uint8;
                                                                description "If the database is located on a different system, the port number may be specified";
                                                        }
                                                        leaf postgresql-lfc-interval {
                                                                type uint64;
                                                                description "specifies the interval in seconds, at which the server will perform a
                                                                lease file cleanup (LFC)";
                                                        }
                                                        leaf postgresql-connect-timeout {
                                                                type uint64;
                                                                description "If the database is located on a different system, a longer interval needs to be specified";
                                                        }
                                                }
                                                case cassandra {
                                                        leaf cassandra-name {
                                                                type string;
                                                                description "type of the database";
                                                        }
                                                        leaf cassandra-contact-points {
                                                                type string;
                                                                description "Cassandra takes a list of comma separated IP addresses to contact the cluster";
                                                        }
                                                        leaf cassandra-password {
                                                                type string;
                                                                description "the credentials of the account under which the server will access the database";
                                                        }
                                                        leaf cassandra-lfc-interval {
                                                                type uint64;
                                                                description "specifies the interval in seconds, at which the server will perform a
                                                                lease file cleanup (LFC)";
                                                        }
                                                        leaf cassandra-connect-timeout {
                                                                type uint64;
                                                                description "If the database is located on a different system, a longer interval needs to be specified";
                                                        }
                                                }
                                        }
                                }
                    uses dhcpv6-types:vendor-infor;
        }

            container option-sets {
                description "DHCPv6 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 dhcpv6-options:server-option-definitions;
          uses dhcpv6-options:custom-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;
                        mandatory true;
                        description "description of the subnet";
                }
                leaf network-prefix {
                        type inet:ipv6-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 DHCPv6 server's
             address pools.";
            list address-pool {
                key pool-id;
                description "A DHCPv6 server can be configured with
                several address pools. This list defines such address pools
                which are distinguished by the key called 'pool-id' inside
                a network range.";
                leaf pool-id {
                        type uint32;
                mandatory true;
                description "pool id";
                }
                                leaf pool-prefix {
                type inet:ipv6-prefix;
                description "Pool prefix. SHOULD be set when the
                'start-address..end-address' range is a prefix.";
                    }
                leaf start-address {
                type inet:ipv6-address-no-zone;
                mandatory true;
                description "start address";
                }
                leaf end-address {
                type inet:ipv6-address-no-zone;
                mandatory true;
                description "end address";
              }
                leaf valid-lifetime {
                type yang:timeticks;
                mandatory true;
                description "valid lifetime for IA";
                }
                leaf renew-time {
                type yang:timeticks;
                mandatory true;
                description "renew time";
              }
                leaf rebind-time {
                type yang:timeticks;
                mandatory true;
                description "rebind time";
                }
                leaf preferred-lifetime {
                      type yang:timeticks;
                      mandatory true;
                      description "preferred lifetime for IA";

                }
                leaf rapid-commit {
                                        type boolean;
                                        mandatory true;
                                        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;
                mandatory true;
                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 pd-pools {
            description "If a server supports prefix delegation function, this
                container will be used to define  the delegating router's prefix
                pools.";
            list pd-pool {
                key pool-id;
                description "Similar to server's address pools, a delegating
                        router can also be configured with multiple prefix pools
                        specified by a list called 'prefix-pool'.";
                                                        leaf pool-id {
                        type uint32;
                      mandatory true;
                      description "pool id";
                    }
                    leaf prefix {
                        type inet:ipv6-prefix;
                        mandatory true;
                        description "ipv6 prefix";

                    }
                    leaf delegated-length {
                        type uint8;
                        mandatory true;
                        description "default delegated prefix length";
                    }
                    leaf valid-lifetime {
                        type yang:timeticks;
                mandatory true;
                description "valid lifetime for IA";
                    }
                    leaf renew-time {
                type yang:timeticks;
                mandatory true;
                description "renew time";
                    }
                leaf rebind-time {
                type yang:timeticks;
                mandatory true;
                description "rebind time";
                        }
                    leaf preferred-lifetime {
                type yang:timeticks;
                mandatory true;
                description "preferred lifetime for IA";
                    }
                leaf rapid-commit {
                                        type boolean;
                                        mandatory true;
                                        description "A boolean value specifies whether the server
                                        support client-server exchanges involving two messages defined.";
                                        }
                                        leaf client-class {
                type string;
                description "client class";
              }
                    leaf max-pd-space-utilization {
                type threshold;
                mandatory true;
                description "Maximum utilization of pd space in this pool";
                    }
                    leaf option-set-id {
                        type leafref {
                                path "/server/server-config/option-sets/option-set/option-set-id";
                        }
                        description "The ID field  +--ro addresses*   inet:ipv6-address
        +---n non-success-code-sent
           +--ro status-code    uint16
           +--ro duid?          binary

                Figure 1: DHCPv6 Server Data Model Structure

   Description of important nodes:

   *  dhcpv6-node-type: The different functional DHCPv6 elements each
      have their relevant option-set to be
                          provisioned to clients of this prefix-pool.";
                    }

                  }
                }

          container host-reservations {
            description
                "This identities.

   *  dhcpv6-server: 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 holds the client. Currently 'DUID' and 'hardware
                address' are supported.";
                case duid {
                  description "DUID";
                  uses dhcpv6-types:duid;
                }
                case hw-address {
                  description "hardware address";
                  leaf hardware-address {
                  type yang:mac-address;
                  description "MAC address of client";
                  }
                }
              }

              leaf-list reserv-addr {
                type inet:ipv6-address;
                description "reserved addr";
              }

              list prefix-reservation {
                key reserv-prefix-id;
                description "reserved prefix reservation";
                leaf reserv-prefix-id {
                        type uint32;
                        mandatory true;
                        description "reserved prefix id";
                }
                leaf reserv-prefix {
                        type inet:ipv6-prefix;
                        mandatory true;
                        description "reserved prefix";
                      }
                leaf reserv-prefix-len {
                        type uint8;
                        mandatory true;
                        description "reserved prefix length";
                }
              }

              leaf hostname {
                type string;
                description "reserved hostname";
              }

              leaf option-set-id { server's DHCPv6 specific
      configuration.

   *  server-duid: Each server must have a DUID (DHCP Unique Identifier)
      to identify itself to clients.  A DUID consists of a two-octet
      type leafref {
                  path "/server/server-config/option-sets/option-set/option-set-id";
                }
                description "The ID field and an arbitrary length (of no more than 128-bytes)
      content field.  Currently there are four defined types of relevant option-set to be provisioned DUIDs in
      [RFC8415] and [RFC6355]: DUID-LLT, DUID-EN, DUID-LL, and DUID-
      UUID.  DUID-Unknown is used for arbitrary DUID formats which do
      not follow any of these defined types. 'active-duid' is a read-
      only field that the host reservation.";
              }
            }
          }

        }
                        }

        container relay-opaque-params {
        description "This server's current DUID can be retrieved from.
      The DUID definitions are imported from the 'ietf-
      dhcpv6-common.yang' module as they are also used by the 'ietf-
      dhcpv6-client.yang' module.

   *  vendor-config: This container contains some opaque values in Relay Agent
                options that need is provided as a location for
      additional implementation specific YANG nodes for the
      configuration of the device to be configured on the server side only augmented.  See Appendix B for value
                match. Such Relay Agent
      an example of this.

   *  option-sets: The server can be configured with multiple option-
      sets.  These are groups of DHCPv6 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";
                }
                }
              }
                }

            container rsoo-enabled-options {
        description "rsoo enabled options";
        list rsoo-enabled-option { with common parameters
      which will be supplied to the intended clients.  The 'option-set-
      id' field is the key option-code;
                description "rsoo enabled option";
                leaf option-code {
                type uint16;
                mandatory true;
                description "option code";
                }
                leaf description {
                type string;
                mandatory true;
                description "description field which is referenced by the relevant
      address or prefix pool configuration.

   *  option-set: Holds definitions for DHCPv6 options themselves.  The
      initial set of definitions are contained in the option";
                }
        }
            }

                }

          /* module 'ietf-
      dhcpv6-options-rfc8415.yang' and are augmented into the server
      module at this point.

   * State data
           */
    container server-state {
        config "false";
        description "states  class-selector: This is provided as a location for additional
      implementation specific YANG nodes for vendor specific class
      selector nodes to be augmented.  See Appendix C for an example of server";
        container network-ranges {
                description "This
      this.

   *  network-ranges: This model supports uses a hierarchy hierarchical model for the
      allocation of addresses and prefixes.  At the top level 'network-
      ranges' holds global configuration parameters.  Under this, a list
      of 'network-ranges' can be defined.  Inside 'network-rages',
      'address-pools' (for IA_NA and IA_TA allocations), and 'prefix-
      pools' (for IA_PD allocation) are defined.  Finally within the
      pools, specific host-reservations are held.

   *  prefix-pools: Defines prefix pools to achieve dynamic configuration.
                        That be used for prefix
      delegation to clients.  As prefix delegation is not supported by
      all DHCPv6 server implementations, it is enabled by a feature
      statement.

   Information about notifications:

   *  address/pd-pool-running-out: Raised when the address/prefix pool
      is going to say we could configure run out.  A threshold for the utilization ratio of the
      pool (max-address-count/max-pd-space utilization) has been defined
      in the server  at different levels through
                        this model. The top level features so that it will notify the administrator
      when the utilization ratio reaches the threshold, and such
      threshold is a settable parameter.

   *  invalid-client-detected: Raised when the server has found a client
      which can be regarded as a potential attacker.  A description may
      also be included.

   *  decline-received: Raised when a DHCPv6 Decline message is received
      from a client.

   *  non-success-code-sent: Raised when a global level which status message is defined as the container
                        'network-ranges'. The following levels are defined as sub-containers under it. raised for
      an error.

2.2.  DHCPv6 Relay Tree Diagram

   The 'network-ranges' contains tree diagram in Figure 2 provides an overview of the parameters (e.g. option-sets) that  would be
                        allocated to all DHCPv6 relay
   module.  The tree also includes the clients served by this server.";
                list network-range {
                        key network-range-id;
                description "The ID field augmentations of the 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
   option definitions from Section 3.4 and the common functions module
   Section 3.5.

       module: ietf-dhcpv6-relay
         +--rw dhcpv6-node-type?   identityref
         +--rw dhcpv6-relay
            +--rw relay-if* [if-name]
            |  +--rw if-name
            |  |       if:interface-ref
            |  +--rw destination-addresses*
            |  |       inet:ipv6-address
            |  +--rw link-address?                         binary
            |  +--rw relay-options
            |  |  +--rw rfc8415:auth-option
            |  |  |  +--rw rfc8415:protocol?           uint8
            |  |  |  +--rw rfc8415:algorithm?          uint8
            |  |  |  +--rw rfc8415:rdm?                uint8
            |  |  |  +--rw rfc8415:replay-detection?   uint64
            |  |  |  +--rw rfc8415:auth-information?   string
            |  |  +--rw rfc8415:status-code-option
            |  |  |  +--rw rfc8415:status-code?      uint16
            |  |  |  +--rw rfc8415:status-message?   string
            |  |  +--rw rfc8415:interface-id-option
            |  |     +--rw rfc8415:interface-id?   string
            |  +--ro solicit-received-count?               uint32
            |  +--ro advertise-sent-count?                 uint32
            |  +--ro request-received-count?               uint32
            |  +--ro confirm-received-count?               uint32
            |  +--ro renew-received-count?                 uint32
            |  +--ro rebind-received-count?                uint32
            |  +--ro reply-sent-count?                     uint32
            |  +--ro release-received-count?               uint32
            |  +--ro decline-received-count?               uint32
            |  +--ro reconfigure-sent-count?               uint32
            |  +--ro information-request-received-count?   uint32
            |  +--ro unknown-message-received-count?       uint32
            |  +--ro unknown-message-sent-count?           uint32
            |  +--ro discarded-message-count?              uint32
            |  +--rw prefix-delegation! {prefix-delegation}?
            |     +--ro pd-leases* [ia-pd-prefix]
            |        +--ro ia-pd-prefix           inet:ipv6-prefix
            |        +--ro last-renew?            yang:date-and-time
            |        +--ro client-peer-address?   inet:ipv6-address
            |        +--ro client-duid?           binary
            |        +--ro server-duid?           binary
            +--ro relay-forward-sent-count?               uint32
            +--ro relay-forward-received-count?           uint32
            +--ro relay-reply-received-count?             uint32
            +--ro relay-forward-unknown-sent-count?       uint32
            +--ro relay-forward-unknown-received-count?   uint32
            +--ro discarded-message-count?                uint32

         notifications:
           +---n relay-event
              +--ro topology-change
                 +--ro relay-if-name?
                 |       -> /dhcpv6-relay/relay-if/if-name
                 +--ro last-ipv6-addr?   inet:ipv6-address

                Figure 2: DHCPv6 server's address pools";
                        list address-pool {
                                key pool-id;
                                description "A Relay Data Model Structure

   Description of important nodes:

   *  dhcpv6-node-type: The different functional DHCPv6 server can be configured with
                                several address pools. elements each
      have their relevant identities.

   *  dhcpv6-relay: This list defines such address pools
                                which are distinguished by container holds the key called 'pool-id'.";
                leaf pool-id {
                        type uint32;
                        mandatory true;
                        description "pool id";
                    }
                                        leaf total-address-count {
                                                type uint64;
                                                mandatory true;
                                                description "count of total addresses relay's DHCPv6 specific
      configuration.

   *  relay-if: As a relay may have multiple client-facing interfaces,
      they are configured in the pool";

                                        } a list.  The if-name leaf allocated-address-conut {
                                                type uint64;
                                                mandatory true;
                                                description "count of allocated addresses in is the pool";
                                        }
                        }
                        list binding-info { key cli-id;
                                description "A and is
      an interface-ref to the applicable interface defined by the 'ietf-
      interfaces' YANG module.

   *  destination-addresses: Defines a list of IPv6 addresses that records a binding information for each DHCPv6
      client messages will be relayed to.  May include unicast or
      multicast addresses.

   *  link-address: Allows the configuration of the value that has already been allocated IPv6 addresses.";
                                leaf cli-id {
                                        type uint32;
                                        mandatory true;
                                        description "client id";
                }
                                container duid {
                                        description "Read the DUID";
                                        uses dhcpv6-types:duid;
                }
                                list cli-ia {
                                        key iaid;
                                        description "client IA";
                                        leaf ia-type {
                                                type string;
                                                mandatory true;
                                                description "IA type";
                                        }
                                        leaf iaid {
                                                type uint32;
                                                mandatory true;
                                                description "IAID";
                                        }
                                        leaf-list cli-addr {
                                                type inet:ipv6-address;
                                                description "client addr";
                                        }
                                        leaf pool-id {
                                                type uint32;
                                                mandatory true;
                                                description "pool id";
                                        }
                                }
                        }
                        }
                        container pd-pools {
                                description "If a server supports relay
      will put into the link-address field of Relay-Forward messages.

   *  prefix-delegation: As prefix delegation function, is not supported by all
      DHCPv6 relay implementations, it is enabled by this container will be used to define the delegating
                                        router's feature
      statement where required.

   *  pd-leases: Contains read only nodes for holding information about
      active delegated prefix pools.";
                                list prefix-pool {
                key pool-id;
                description "Similar to server's address pools, a delegating
                        router leases.

   *  relay-options: As with the Server module, DHCPv6 options that can also
      be configured with multiple prefix pools
                        specified sent by the relay are augmented here.

   Information about notifications:

   *  topology-changed: Raised when the topology of the relay agent is
      changed, e.g. a list called 'prefix-pool'.";
                leaf pool-id {
                        type uint32;
                        mandatory true;
                        description "pool id";
                }
                leaf pd-space-utilization {
                        type threshold;
                        mandatory true;
                        description "current PD space utilization";
                }
                                }
                                list binding-info {
                                        key cli-id;
                                        description "A list records a binding information for each client facing interface is reconfigured.

2.3.  DHCPv6 Client Tree Diagram

   The tree diagram in Figure 3 provides an overview of the DHCPv6
   client that has already been allocated IPv6 prefixes.";
                                                leaf cli-id {
                                                        type uint32;
                                                        mandatory true;
                                                        description "client id";
                                                }
                                                container duid {
                                                        description "Reads module.  The tree also includes the DUID";
                                                        uses dhcpv6-types:duid;
                                                }
                                                list cli-iapd {
                                                        key iaid;
                                                        description "client IAPD";
                                                        leaf augmentations of the
   relevant option definitions from Section 3.4 and the common functions
   module Section 3.5.

    module: ietf-dhcpv6-client
      +--rw dhcpv6-node-type?   identityref
      +--rw dhcpv6-client
         +--rw client-if* [if-name]
            +--rw if-name
            |       if:interface-ref
            +--rw type-code?                           uint16
            +--rw (duid-type)?
            |  +--:(duid-llt)
            |  |  +--rw duid-llt-hardware-type?        uint16
            |  |  +--rw duid-llt-time?                 yang:timeticks
            |  |  +--rw duid-llt-link-layer-address?
            |  |          yang:mac-address
            |  +--:(duid-en)
            |  |  +--rw duid-en-enterprise-number?     uint32
            |  |  +--rw duid-en-identifier?            string
            |  +--:(duid-ll)
            |  |  +--rw duid-ll-hardware-type?         uint16
            |  |  +--rw duid-ll-link-layer-address?
            |  |          yang:mac-address
            |  +--:(duid-uuid)
            |  |  +--rw uuid?                          yang:uuid
            |  +--:(duid-unknown)
            |     +--rw data?                          binary
            +--ro active-duid?                         binary
            +--rw client-configured-options
            |  +--rw rfc8415:option-request-option
            |  |  +--rw rfc8415:oro-option*   uint16
            |  +--rw rfc8415:status-code-option
            |  |  +--rw rfc8415:status-code?      uint16
            |  |  +--rw rfc8415:status-message?   string
            |  +--rw rfc8415:rapid-commit-option!
            |  +--rw rfc8415:user-class-option
            |  |  +--rw rfc8415:user-class-data*
            |  |          [user-class-datum-id]
            |  |     +--rw rfc8415:user-class-datum-id    uint8
            |  |     +--rw rfc8415:user-class-datum?      string
            |  +--rw rfc8415:vendor-class-option
            |  |  +--rw rfc8415:vendor-class-option-instances*
            |  |          [enterprise-number]
            |  |     +--rw rfc8415:enterprise-number    uint32
            |  |     +--rw rfc8415:vendor-class*
            |  |             [vendor-class-datum-id]
            |  |        +--rw rfc8415:vendor-class-datum-id    uint8
            |  |        +--rw rfc8415:vendor-class-datum?      string
            |  +--rw rfc8415:vendor-specific-information-option
            |  |  +--rw rfc8415:vendor-specific-information-option-inst
    ances*
            |  |          [enterprise-number]
            |  |     +--rw rfc8415:enterprise-number     uint32
            |  |     +--rw rfc8415:vendor-option-data*
            |  |             [sub-option-code]
            |  |        +--rw rfc8415:sub-option-code    uint16
            |  |        +--rw rfc8415:sub-option-data?   string
            |  +--rw rfc8415:reconfigure-accept-option!
            +--rw ia-na* [iaid]
            |  +--rw iaid {
                                                                type uint32;
                                                                mandatory true;
                                                                description "IAID";
                                                        }
                                                        leaf-list cli-prefix {
                                                                type inet:ipv6-prefix;
                                                                description "client ipv6 prefix";
                                                        }
                                                        leaf-list cli-prefix-len {
                                                                type uint8;
                                                                description "client prefix length";
                                                        }
                                                        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 DHCPv6
                                        client that has already been allocated IPv6 addresses or prefixes
                                        by host reservations.";
                                        leaf cli-id {
                                                type uint32;
                                                mandatory true;
                                                description "client id";
                                        }
                                        container duid {
                                                description "Reads the DUID";
                                                uses dhcpv6-types:duid;
                                        }
                                        list cli-ia {
                                        key iaid;
                                        description "client IA";
                                        leaf ia-type {
                                                type string;
                                                mandatory true;
                                                description "IA type, IA_NA or IA_TA";
                                        }
                                        leaf             uint32
            |  +--rw ia-na-options
            |  +--ro lease-state
            |     +--ro ia-na-address?        inet:ipv6-address
            |     +--ro preferred-lifetime?
            |     |       dhcpv6-common:timer-value-seconds32
            |     +--ro valid-lifetime?
            |     |       dhcpv6-common:timer-value-seconds32
            |     +--ro lease-t1?
            |     |       dhcpv6-common:timer-value-seconds32
            |     +--ro lease-t2?
            |     |       dhcpv6-common:timer-value-seconds32
            |     +--ro allocation-time?      yang:date-and-time
            |     +--ro last-renew-rebind?    yang:date-and-time
            |     +--ro server-duid?          binary
            +--rw ia-ta* [iaid]
            |  +--rw iaid {
                                                type uint32;
                                                mandatory true;
                                                description "IAID";
                                        }
                                        leaf-list cli-addr {
                                                type inet:ipv6-address;
                                                description "client addr";
                                        }
                                }

                                        list cli-iapd {
                                                key iaid;
                                                description "client IAPD";
                                                leaf             uint32
            |  +--rw ia-ta-options
            |  +--ro lease-state
            |     +--ro ia-ta-address?        inet:ipv6-address
            |     +--ro preferred-lifetime?
            |     |       dhcpv6-common:timer-value-seconds32
            |     +--ro valid-lifetime?
            |     |       dhcpv6-common:timer-value-seconds32
            |     +--ro allocation-time?      yang:date-and-time
            |     +--ro last-renew-rebind?    yang:date-and-time
            |     +--ro server-duid?          binary
            +--rw ia-pd* [iaid]
            |  +--rw iaid             uint32
            |  +--rw ia-pd-options
            |  +--ro lease-state
            |     +--ro ia-pd-prefix?         inet:ipv6-prefix
            |     +--ro preferred-lifetime?
            |     |       dhcpv6-common:timer-value-seconds32
            |     +--ro valid-lifetime?
            |     |       dhcpv6-common:timer-value-seconds32
            |     +--ro lease-t1?
            |     |       dhcpv6-common:timer-value-seconds32
            |     +--ro lease-t2?
            |     |       dhcpv6-common:timer-value-seconds32
            |     +--ro allocation-time?      yang:date-and-time
            |     +--ro last-renew-rebind?    yang:date-and-time
            |     +--ro server-duid?          binary
            +--ro solicit-count?                       uint32
            +--ro advertise-count?                     uint32
            +--ro request-count?                       uint32
            +--ro confirm-count?                       uint32
            +--ro renew-count?                         uint32
            +--ro rebind-count?                        uint32
            +--ro reply-count?                         uint32
            +--rw release-count?                       uint32
            +--ro decline-count?                       uint32
            +--ro reconfigure-count?                   uint32
            +--ro information-request-count?           uint32

      notifications:
        +---n invalid-ia-detected
        |  +--ro iaid {
                                                        type uint32;
                                                        mandatory true;
                                                        description "IAID";
                                                }
                                                leaf-list cli-prefix {
                                                        type inet:ipv6-prefix;
                                                        description "client ipv6 prefix";
                                                }
                                                leaf-list cli-prefix-len {
                                                        type uint8;
                                                        description "client prefix length";
                                                }
                                        }
                        }
                }

                                        }
                        }

        container packet-stats {
                description "A container presents the packet statistics related to
                        the           uint32
        |  +--ro description?   string
        +---n retransmission-failed
        |  +--ro failure-type    enumeration
        +---n unsuccessful-status-code
        |  +--ro status-code    uint16
        |  +--ro server-duid    binary
        +---n server-duid-changed
           +--ro new-server-duid         binary
           +--ro previous-server-duid    binary
           +--ro lease-ia-na?
           |       -> /dhcpv6-client/client-if/ia-na/iaid
           +--ro lease-ia-ta?
           |       -> /dhcpv6-client/client-if/ia-ta/iaid
           +--ro lease-ia-pd?
                   -> /dhcpv6-client/client-if/ia-pd/iaid

                Figure 3: DHCPv6 server.";
          leaf solicit-count {
                                                type uint32;
                                                mandatory true;
                                                description "solicit counter";
          }
          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 reply-count {
                                                type uint32;
                                                mandatory true;
                                                description "reply 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";
          }
        }
        }
        }

        /* Client Data Model Structure

   Description of important nodes:

   *  dhcpv6-node-type: The different functional DHCPv6 elements each
      have their relevant identities.

   * Notifications
        */

        notification notifications {
          description "dhcpv6 server notification module";

    container dhcpv6-server-event {
        description "dhcpv6 server event";  dhcpv6-client: This container address-pool-running-out {
        description "raised when holds the address pool client's DHCPv6 specific
      configuration.

   *  client-if: As a client may have multiple interfaces requesting
      configuration over DHCP, they are configured in a list.  The if-
      name leaf is going the key and is an interface-ref to
                run out.  A threshold for utilization ratio of the pool has
                been applicable
      interface defined in the server feature so that it will notify the
                administrator when the utilization ratio reaches by the
                threshold, and such threshold is 'ietf-interfaces' YANG module.

   *  client-duid: Each DHCP client must have a settable parameter";
        leaf total-address-count {
                type uint64;
                mandatory true;
                description "count DUID (DHCP Unique
      Identifier) to identify itself to clients.  A DUID consists of total addresses in the pool";
        }
        leaf max-address-count { a
      two-octet type uint64;
                mandatory true;
                description "maximum count of addresses that can be allocated
                        in the pool. This value may be less field and an arbitrary length (of no more than count of total
                        addresses";
        }
        leaf allocated-address-conut {
                type uint64;
                mandatory true;
                description "count
      128-bytes) content field.  Currently there are four defined types
      of allocated addresses DUIDs in the pool";
        }
                    container duid {
                        description "server duid";
                        uses dhcpv6-types:duid;
                    }
        leaf serv-name {
                type string;
                description "server name";
        }
        leaf pool-name {
                type string;
                mandatory true;
                description "pool name";
        }
        }
                container pd-pool-running-out {
        description "raised when the address/prefix pool [RFC8415]: DUID-LLT, DUID-EN, DUID-LL, and DUID-UUID.
      DUID-Unknown is going to
                run out.  A threshold used for utilization ratio arbitrary DUID formats which do not
      follow any of the pool has
                been these defined in the server feature so types. 'active-duid' is a read-only
      field that it will notify the
                administrator when the utilization ratio reaches client's current DUID can be retrieved from.  The
      DUID definitions are imported from the
                threshold, and such threshold 'ietf-dhcpv6-common.yang'
      module.  DUID is configured under the 'client-if' to allow a settable parameter";
                        leaf max-pd-space-utilization {
                type threshold;
                mandatory true;
                description "maximum pd space utilization";
                }
                        leaf pd-space-utilization {
                                type threshold;
                                mandatory true;
                                description "current pd space utilization";
                        }
        container duid {
                description "Sets
      client to have different DUIDs for each interface if required.

   *  ia-na, ia-ta, ia-pd: Contains configuration nodes relevant for
      requesting one or more of each of the DUID";
                uses dhcpv6-types:duid;
        }
        leaf serv-name {
                type string;
                description "server name";
        }
        leaf pool-name {
                type string;
                mandatory true;
                description "pool name";
        }
            }
            container invalid-client-detected {
                description "raised lease types.  Also contains
      read only nodes related to active leases.

   Information about notifications:

   *  invalid-ia-detected: Raised when the server has found a identity association of the
      client which can be regarded as a potential attacker. Some description
                could also proved to be included.";
        container duid {
                description "Sets invalid.  Possible condition includes
      duplicated address, illegal address, etc.

   *  retransmission-failed: Raised when the DUID";
                uses dhcpv6-types:duid;
        }
        leaf description {
                type string;
                description "description of retransmission mechanism
      defined in [RFC8415] is failed.

   *  failed-status-turn-up: Raised when the event";
                }
            }
          }
        }
}
<CODE ENDS>

3.2. client receives a message
      includes an unsuccessful Status Code option.

3.  DHCPv6 Relay YANG Model

3.1.  DHCPv6 Server YANG Model

   This module imports typedefs from [RFC6991], [RFC7223].

<CODE BEGINS> file "ietf-dhcpv6-relay.yang" [RFC8343].

   module ietf-dhcpv6-relay ietf-dhcpv6-server {
     yang-version 1.1;
     namespace "urn:ietf:params:xml:ns:yang:ietf-dhcpv6-relay"; "urn:ietf:params:xml:ns:yang:ietf-dhcpv6-server";
     prefix "dhcpv6-relay"; "dhcpv6-server";

     import ietf-inet-types {
       prefix inet;
     }
     import ietf-dhcpv6-options {
    prefix dhcpv6-options;
  }
  import ietf-dhcpv6-types ietf-yang-types {
       prefix dhcpv6-types; yang;
     }
     import ietf-interfaces ietf-dhcpv6-common {
       prefix if; dhcpv6-common;
     }

     organization
    "IETF DHC (Dynamic Host Configuration) Working group"; "DHC WG";
     contact
       "cuiyong@tsinghua.edu.cn
       lh.sunlinh@gmail.com
       ian.farrer@telekom.de
       sladjana.zechlin@telekom.de
     hezihao9512@gmail.com";
       hezihao9512@gmail.com
       godfryd@isc.org";

     description "This model defines is a YANG data model that can be
     used module for the configuration
       and management of DHCPv6 servers.

       Copyright (c) 2018 IETF Trust and the persons identified as
       authors of the code.  All rights reserved.

       Redistribution and use in source and binary forms, with or
       without modification, is permitted pursuant to, and subject
       to the license terms contained in, the Simplified BSD License
       set forth in Section 4.c of the IETF Trust's Legal Provisions
       Relating to configure and manage a DHCPv6 relay."; IETF Documents
       (http://trustee.ietf.org/license-info).

       This version of this YANG module is part of RFC 8513; see
       the RFC itself for full legal notices.";

     revision 2018-09-04 {
       description "";
       reference "I-D: draft-ietf-dhc-dhcpv6-yang";
     }

     revision 2018-03-04 {
       description "Resolved most issues on the DHC official
         github";
       reference "I-D: draft-ietf-dhc-dhcpv6-yang";
     }

     revision 2017-12-22 {
       description "Resolve most issues on Ian's github.";
       reference "I-D: draft-ietf-dhc-dhcpv6-yang";

     }

     revision 2017-11-24 {
       description
      "First version of the separated relay specific
       YANG model.";
    reference
      "I-D: draft-ietf-dhc-dhcpv6-yang";
  }

  /*
   * Data Nodes
   */

  container relay {
    presence
      "Enables the relay";
    description
      "DHCPv6 relay portion";

    container relay-config {
      description
        "This container contains the configuration data
        of the relay.";
      container relay-attributes {
        description
          "A container describes some basic attributes of the relay
           agent including some relay agent specific options data that
           need to be configured previously.
           Such options include Remote-Id option and Subscriber-Id
           option.";
        leaf name {
          type string;
          description
            "Relay agent name";
        }
        leaf description {
          type string;
          description
            "Textual description of the relay agent";
        }
        leaf-list dest-addrs {
          type inet:ipv6-address;
          description
            "Each DHCPv6 relay agent may be configured with a list
             of destination addresses.
             This node defines such a list of IPv6 addresses that
             may include unicast addresses, multicast addresses or
             other addresses.";
        }
        list subscribers {
          key subscriber;
          description
            "Subscribers";
          leaf subscriber {
            type uint8;
            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";
          }
        }
        uses dhcpv6-types:vendor-infor;
      }

      container rsoo-option-sets {
        description
         "DHCPv6 relay agent could provide some information that would
          be useful to DHCPv6 client.
          Since relay agent cannot provide options directly to the
          client, RSOO-enabled options are defined to propose options
          for the server to send to the client.
          This container models such RSOO-enabled options.";
        reference
          "RFC6422";
        list option-set {
          key option-set-id;
          description
            "This list under the 'rsoo-option-sets' container is similar
             to the that defined in server module.
             It allows the relay to implement several sets "First version of RSOO-enabled
             options for different interfaces.
             The list only includes the EAP Re-authentication Protocol
             (ERP) Local Domain Name DHCPv6 Option defined in RFC6440,
             since it is the only one RSOO-enabled options accepted by
             IANA so far.";
          leaf option-set-id separated server specific
         YANG model.";
       reference "I-D: draft-ietf-dhc-dhcpv6-yang";
     }

     /*
      * Typedef
      */

     identity server {
            type uint32;
       base "dhcpv6-common:dhcpv6-node";
       description "Option sed id"; "DHCPv6 server.";
     }
          uses dhcpv6-options:relay-supplied-option-definitions;

     leaf dhcpv6-node-type {
       description "Type for a DHCPv6 server";
       type identityref {
         base "dhcpv6-server:server";
       }
     }

      list relay-if

     feature prefix-delegation {
        // if - This should reference an entry in ietf-interfaces
        key if-name;
       description
        "A relay agent may have several interfaces, we should provide
         a way to configure and manage parameters on "Enable if the interface-level.
         A list server implements prefix delegation.";
     }

     grouping resource-config {
       description "Nodes that describes specific interfaces and their corresponding
         parameters is employed to fulfill the configuration. Here we use
         a string called 'if-name' as are reused by multiple levels
         in the key of list.";
        leaf if-name DHCPv6 server's addressing hierarchy.";
       leaf-list option-set-id {
         type if:interface-ref;
          mandatory true;
          description
            "Interface name";
        }
        leaf interface-id leafref {
          type string;
           path "/dhcpv6-server/option-sets/option-set/option-set-id";
         }
         description
            "Interface id"; "The ID field of relevant option-set
           to be provisioned to clients of this network-range.";
       }

        /*
       leaf enable valid-lifetime {
         type boolean; dhcpv6-common:timer-value-seconds32;
         mandatory true;
         description "whether this interface is enabled"; "Valid lifetime for the IA.";
       }
        */
       leaf ipv6-address renew-time {
         type inet:ipv6-address; dhcpv6-common:timer-value-seconds32;
         mandatory true;
         description
            "IPv6 address for this interface"; "Renew (T1) time.";
       }
       leaf rsoo-option-set-id rebind-time {
         type leafref {
            path "/relay/relay-config/rsoo-option-sets/option-set/option-set-id";
          } dhcpv6-common:timer-value-seconds32;
         mandatory true;
         description "Configured Relay Supplied Option set"; "Rebind (T2) time.";
       }

        list next-entity {
          key dest-addr;
          description
            "This node defines a list that is used to describe the
             next hop entity of this relay distinguished by their
             addresses.";
       leaf dest-addr preferred-lifetime {
         type inet:ipv6-address; dhcpv6-common:timer-value-seconds32;
         mandatory true;
         description
              "Destination addr"; "Preferred lifetime for the IA";
       }
       leaf available rapid-commit {
         type boolean;
         mandatory true;
         description
              "Whether "A value of 1 specifies that the next entity is available or not"; pool supports
           client-server exchanges involving two messages.";
       }
     }

     grouping lease-information {
       leaf multicast total-address-count {
         type boolean; uint64;
         mandatory true;
         description
              "Whether "count of total addresses in the address is multicast or not"; pool";
       }
       leaf server allocated-address-count {
         type boolean; uint64;
         mandatory true;
         description
              "Whether "count of allocated addresses in the next entity is a server";
          }
        }
      } pool";
       }

    container relay-state {
      config "false";
      description
        "State data of relay";
       list relay-if binding-info {
         key if-name; client-duid;
         description
        "A relay agent may have several interfaces, we should provide
         a way to configure and manage parameters on the interface-level.
         A list "Records binding information for each client that describes specific interfaces and their corresponding
         parameters is employed to fulfill the configuration. Here we use
         a string called 'if-name' as the key of list.";
           has previously been allocated IPv6 addresses.";
         leaf if-name{
          type string;
          mandatory true; client-duid {
           description
            "Interface name"; "Client DUID.";
           type binary;
         }
         list pd-route iaid {
          // if - need to look at if/how we model these. If they are
          // going to be modeled, then they should be ro state
          // entries (we're not trying to configure routes here)
           key pd-route-id; iaid;
           description "pd route"; "Clients IAID.";
           leaf pd-route-id iaid {
             type uint8; uint32;
             mandatory true;
             description
              "PD route id"; "IAID";
           }
           leaf requesting-router-id allocation-time {
            type uint32;
            mandatory true;
             description
              "Requesting router id"; "Time and date that the lease was made.";
             type yang:date-and-time;

           }
           leaf delegating-router-id last-renew-rebind {
            type uint32;
            mandatory true;
             description
              "Delegating router id"; "Time of the last successful renew or rebind.";
             type yang:date-and-time;
           }
           leaf next-router preferred-lifetime {
            type inet:ipv6-address;
            mandatory true;
             description
              "Next router"; "The preferred lifetime expressed in units
               of seconds.";
             type dhcpv6-common:timer-value-seconds32;
           }
           leaf last-router valid-lifetime {
            type inet:ipv6-address;
            mandatory true;
             description
              "Previous router";
          } "The valid lifetime for the leased prefix
               expressed in units of seconds.";
             type dhcpv6-common:timer-value-seconds32;
           }
        list next-entity
           leaf lease-t1 {
          key dest-addr;
             description "This node defines a list that is used "The time interval after which the client
               should contact the server from which the addresses
               in the IA_NA were obtained to
            describe extend the next hop entity lifetimes
               of this relay agent.
            Different entities are distinguished by their
            addresses."; the addresses assigned to the IA_PD.";
             type dhcpv6-common:timer-value-seconds32;
           }
           leaf dest-addr lease-t2 {
             description "The time interval after which the client
               should contact any available server to extend
               the lifetimes of the addresses assigned to the IA_PD.";
             type inet:ipv6-address;
            mandatory true;
            description "destination addr"; dhcpv6-common:timer-value-seconds32;
           }
          container packet-stats
         }
       }
     }

     grouping message-stats {
       description "packet statistics"; "Counters for DHCPv6 messages.";
       leaf solicit-rvd-count solicit-count {
         config "false";
         type uint32;
              mandatory true;
         description "solicit received counter"; "Number of Solicit (1) messages received.";
       }
       leaf request-rvd-count advertise-count {
         config "false";
         type uint32;
              mandatory true;
         description "request received counter"; "Number of Advertise (2) messages sent.";
       }
       leaf renew-rvd-count request-count {
         config "false";
         type uint32;
              mandatory true;
         description "renew received counter"; "Number of Request (3) messages received.";

       }
       leaf rebind-rvd-count confirm-count {
         config "false";
         type uint32;
              mandatory true;
         description "rebind received counter"; "Number of Confirm (4) messages received.";
       }
       leaf decline-rvd-count renew-count {
         config "false";
         type uint32;
              mandatory true;
         description "decline received counter"; "Number of Renew (5) messages received.";
       }
       leaf release-rvd-count rebind-count {
         config "false";
         type uint32;
              mandatory true;
         description "release received counter"; "Number of Rebind (6) messages received.";
       }
       leaf info-req-rvd-count reply-count {
         config "false";
         type uint32;
              mandatory true;
         description "information request counter"; "Number of Reply (7) messages sent.";
       }
       leaf relay-for-rvd-count release-count {
         type uint32;
              mandatory true;
         description "relay forward received counter"; "Number of Release (8) messages received.";
       }
       leaf relay-rep-rvd-count decline-count {
         config "false";
         type uint32;
              mandatory true;
         description "relay reply received counter"; "Number of Decline (9) messages received.";
       }
       leaf packet-to-cli-count reconfigure-count {
         config "false";
         type uint32;
              mandatory true;
         description "packet to client counter"; "Number of Reconfigure (10) messages sent.";
       }
       leaf adver-sent-count information-request-count {
         config "false";
         type uint32;
              mandatory true;
         description "advertisement sent counter"; "Number of Information-request (11) messages
           received.";
       }
            leaf confirm-sent-count
     }

     /*
      * Data Nodes
      */
     container dhcpv6-server {
       container server-duid {
              type uint32;
              mandatory true;
         description "confirm sent counter"; "DUID of the server.";
         uses dhcpv6-common:duid;
       }
            leaf reply-sent-count
       container vendor-config {
              type uint32;
              mandatory true;
         description "reply sent counter"; "This container provides a location for augmenting
           vendor or implementation specific configuration nodes.";
       }
            leaf reconfig-sent-count
       container option-sets {
              type uint32;
              mandatory true;
         description "reconfigure sent counter";
            } "A server may allow different option sets
           to be configured for clients matching specific parameters
           such as topological location or client type. The 'option-set'
           list is a set of options and their contents that
           will be returned to clients.";
         list option-set {
           key option-set-id;
           description "YANG definitions for DHCPv6 options are
             contained in separate YANG modules and augmented to this
             container as required.";
           leaf relay-for-sent-count option-set-id {
             type uint32;
              mandatory true;
             description "relay forward sent counter"; "Option set identifier.";
           }
           leaf relay-rep-sent-count description {
             type uint32;
              mandatory true; string;
             description "relay reply sent counter"; "An optional field for storing additional
               information relevant to the option set.";
           }
         }
       }

       container class-selector {
         description "DHCPv6 servers use a 'class-selector' function
           in order to identify and classify incoming client messages
           so that they can be given the correct configuration.
           The mechanisms used for implementing this function vary
           greatly between different implementations such that they are
           not possible to include in this module. This container
           provides a location for server implementors to augment their
           own class-selector YANG.";
       }

       container relay-stats network-ranges {
        config "false";
         description
          "Relay statistics";
        leaf cli-packet-rvd-count "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.";
         uses resource-config;
         list network-range {
          type uint32;
          mandatory true;
           key network-range-id;
           description
            "Client packet received counter";
        } "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 relay-for-rvd-count network-range-id {
             type uint32;
             mandatory true;
             description
            "Relay forward received counter"; "Equivalent to subnet ID";
           }
           leaf relay-rep-rvd-count network-description {
             type uint32; string;
             mandatory true;
             description
            "Relay reply received counter"; "Description of the network range.";
           }
           leaf packet-to-cli-count network-prefix {
             type uint32; inet:ipv6-prefix;
             mandatory true;
             description
            "Packet to client counter"; "Network prefix";
           }
        leaf relay-for-sent-count
           uses resource-config;
           container address-pools {
          type uint32;
          mandatory true;
             description
            "Relay forward sent counter";
        }
        leaf relay-rep-sent-count
               "A container that describes the DHCPv6 server's
               address pools.";
             list address-pool {
          type uint32;
          mandatory true;
               key pool-id;
               description
            "Relay reply sent counter";
        } "A DHCPv6 server can be configured with
                 several address pools. This list defines such address
                 pools which are distinguished by the key called
                 'pool-id'.";
               leaf discarded-packet-count pool-id {
                 type uint32;
                 mandatory true;
                 description
            "Discarded packet counter";

        }
      }
    } "Pool ID";
               }

  /*
   * Notifications
   */

  notification notifications {
    description "DHCPv6 relay notification module";
    container dhcpv6-relay-event {
      description
        "DHCPv6 relay event";
      container topo-changed {
        description
        "Raised when the topology of the relay agent is changed.";
               leaf relay-if-name pool-prefix {
                 type string; inet:ipv6-prefix;
                 mandatory true;
                 description
            "Relay interface name"; "Pool prefix";
               }
               leaf first-hop start-address {
                 type boolean; inet:ipv6-address-no-zone;
                 mandatory true;
                 description
            "First hop"; "Start address";
               }
               leaf last-entity-addr end-address {
                 type inet:ipv6-address; inet:ipv6-address-no-zone;
                 mandatory true;
                 description
            "Last entity "End address";
               }
      }
    }
  }
}
<CODE ENDS>

3.3.  DHCPv6 Client YANG Model

   This module imports typedefs from [RFC6991], [RFC7223].

<CODE BEGINS> file "ietf-dhcpv6-client.yang"
module ietf-dhcpv6-client {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-dhcpv6-client";
  prefix "dhcpv6-client";

  import ietf-dhcpv6-options {
    prefix dhcpv6-options;
  }
  import ietf-dhcpv6-types {
    prefix dhcpv6-types;
  }
  import ietf-interfaces
               leaf max-address-count {
    prefix if;
  }

  organization "DHC WG";
  contact
   "cuiyong@tsinghua.edu.cn
    wangh13@mails.tsinghua.edu.cn
    lh.sunlinh@gmail.com
    ian.farrer@telekom.de
    sladjana.zechlin@telekom.de
    hezihao9512@gmail.com  ";
                 type dhcpv6-common:threshold;
                 mandatory true;
                 description "This model defines a YANG data model "Maximum count of addresses that can
                   be
    used to configure and manage a DHCPv6 client.";

  revision 2018-09-04 {
    description "";
    reference "I-D: draft-ietf-dhc-dhcpv6-yang"; allocated in this pool. This value may be
                   less than count of total addresses.";
               }

  revision 2018-03-04
               uses resource-config;
               container host-reservations {
                 description "Resolved most issues on "Configuration for host reservations
                   in the DHC official
    github";
    reference "I-D: draft-ietf-dhc-dhcpv6-yang";
  }

  revision 2017-12-22 address pool.";
                 list host-reservation {
    description "Resolve most issues on Ian's github.";
    reference "I-D: draft-ietf-dhc-dhcpv6-yang";
  }

  revision 2017-11-24
                   key reserved-addr;
                   leaf client-duid {
                     type binary;
                     description "First version of the separated client specific
        YANG model.";
      reference "I-D: draft-ietf-dhc-dhcpv6-yang"; "Client DUID.";
                   }

  /*
   * Data Nodes
   */

  container client
                   leaf reserved-addr {
    presence "Enables the client";
                     type inet:ipv6-address;
                     description "dhcpv6 client portion";

    container client-config "reserved addr";
                   }
                   list prefix-reservation {
                     key reserv-prefix-id;
                     description "configuration tree of client";
      container duid "reserved prefix reservation";
                     leaf reserv-prefix-id {
                       type uint32;
                       mandatory true;
                       description "Sets the DUID";
        uses dhcpv6-types:duid; "reserved prefix id";
                     }
      list client-if
                     leaf reserv-prefix {
        key if-name;
                       type inet:ipv6-prefix;
                       mandatory true;
                       description "A client may have several interfaces, it is more reasonable to
          configure and manage parameters on the interface-level. The list defines
          specific client interfaces and their data. Different interfaces are
          distinguished by the key which is a configurable string value."; "reserved prefix";
                     }
                     leaf if-name reserv-prefix-len {
                       type if:interface-ref; uint8;
                       mandatory true;
                       description "interface name"; "reserved prefix length";

                     }
                   }
                   uses resource-config;
                 }
               }
               list active-leases {
                 description "Holds state for active client leases.";
                 config false;
                 key leased-address;
                 leaf leased-address {
                   type inet:ipv6-address;
                 }
                 uses lease-information;
               }
             }
           }
           container prefix-pools {
             description "Defines IPv6 prefix pools to be delegated
               to clients.";
             if-feature prefix-delegation;
             list prefix-pool {
               key pool-id;
               description "A server can be configured with multiple
                 prefix pools.";
               leaf cli-id pool-id {
                 type uint32;
                 mandatory true;
                 description "client id"; "Unique identifier for the pool.";
               }

        /*
               leaf description prefix {
                 type string; inet:ipv6-prefix;
                 mandatory true;
                 description "description of the client interface"; "IPv6 prefix";
               }
        */
               leaf pd-function prefix-length {
                 type boolean; uint8;
                 mandatory true;
                 description "Whether the client can act as a requesting router
            to request "Length of prefixes using prefix delegation ([RFC3633])."; that will be delegated
                   to clients.";
               }
               leaf rapid-commit max-pd-space-utilization {
                 type boolean; dhcpv6-common:threshold;
                 mandatory true;
                 description "'true' indicates a client can initiate a Solicit-Reply message
            exchange by adding a Rapid Commit option in Solicit message. 'false' means
            the client is not allowed to add a Rapid Commit option to request
            addresses "Maximum utilization of PD space
                   in a two-message exchange pattern."; this pool";
               }

        /*
               uses resource-config;
               container mo-tab host-reservations {
                 description "The management tab label indicates the operation mode of the
            DHCPv6 client.
            'm'=1 and 'o'=1 indicate the client will use DHCPv6 to  obtain all the configuration
            data.
            'm'=1 and 'o'=0 are a meaningless combination.
            'm'=0 and 'o'=1 indicate the client will use stateless DHCPv6 to obtain configuration
            data apart from addresses/prefixes data.
            'm'=0 and 'o'=0 represent the client will not use DHCPv6 but use SLAAC to
            achieve configuration.";

            // if - not sure about the intended use here as it seems
            // to be redefining what will be received "Configuration for host reservations
                   in the PIO. Is
            // the intention to be whether they PIO options will be
            // obeyed as received or overridden? prefix pool.";
                 list prefix-reservation {
                   description "reserved prefix reservation";
                   key reserved-prefix;
                   leaf m-tab client-duid {
                     type boolean; binary;
                     description "Client DUID.";
                   }
                   leaf reserved-prefix {
                     type inet:ipv6-prefix;
                     mandatory true;
                     description "m tab"; "reserved prefix";
                   }
                   leaf o-tab reserv-prefix-len {
                     type boolean; uint8;
                     mandatory true;
                     description "o tab"; "reserved prefix length";
                   }
                 }
                 uses resource-config;
                 list active-leases {
                   description "Holds state for active client leases.";
                   config false;
                   key leased-prefix;
                   leaf leased-prefix{
                     type inet:ipv6-prefix;
                   }
                   uses lease-information;
                 }
               }
             }
           }
        */

        container client-configured-options {
          description "client configured options";
           uses dhcpv6-options:client-option-definitions; message-stats;
         }
       }
     }

    container client-state {
      config "false";
      description "state tree of client";
      container if-other-params

     /*
      * Notifications
      */

     notification address-pool-running-out {
       description "A client can obtain extra configuration
          data other than "Notification sent when the address and prefix information through
          DHCPv6. This container describes such data pool is going to
         run out. A threshold for utilization ratio of the pool has
         been defined in the client
          was configured. The potential configuration data may
          include DNS server addresses, SIP server domain names, etc.";
        uses dhcpv6-options:server-option-definitions;
      }
     container packet-stats {
        config "false";
        description "A container records
          all feature so that it will notify the packet status information
          of
         administrator when the utilization ratio reaches the
         threshold, and such threshold is a specific interface."; settable parameter";

       leaf solicit-count total-address-count {
         type uint32; uint64;
         mandatory true;
         description "solicit counter"; "Count of total addresses in the pool";
       }
       leaf request-count max-address-count {
         type uint32; uint64;
         mandatory true;
         description "request counter"; "Maximum count of addresses that can be allocated
           in the pool. This value may be less than count of total
           addresses";
       }
       leaf renew-count allocated-address-count {
         type uint32; uint64;
         mandatory true;
         description "renew counter"; "Count of allocated addresses in the pool";
       }
       leaf rebind-count pool-id {
         type uint32;
         mandatory true;
         description "rebind counter"; "Pool ID";
       }
        leaf decline-count
     }

     notification pd-pool-running-out {
          type uint32;
          mandatory true;
       description "decline counter";
        } "Notification sent when the address/prefix 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 release-count max-pd-space-utilization {
         type uint32; dhcpv6-common:threshold;
         mandatory true;
         description "release counter"; "Maximum PD space utilization";
       }
       leaf info-req-count pd-space-utilization {
         type uint32; dhcpv6-common:threshold;
         mandatory true;
         description "information request counter"; "Current PD space utilization";
       }
       leaf advertise-count pool-id {
         type uint32;
         mandatory true;
         description "advertise counter"; "Pool ID";
       }
        leaf confirm-count
     }
     notification invalid-client-detected {
          type uint32;
          mandatory true;
       description "confirm counter";
        } "Notification sent when the server has found a client
         which can be regarded as a potential attacker. Some description
         could also be included.";
       leaf reply-count duid {
          type uint32;
          mandatory true;
         description "reply counter"; "Client's DUID";
         type binary;
       }
       leaf reconfigure-count description {
         type uint32;
          mandatory true; string;
         description "reconfigure counter";
        }
      } "Description of the event";
       }
     }

  /*
   * Notifications
   */

  notification notifications {
    description "dhcpv6 client

     notification module";
    container dhcpv6-client-event {
      description "dhcpv6 client event";

      container ia-lease-event decline-received {
       description "raised "Notification sent when the client was allocated
          a new IA from the server or it renew/rebind/release
          its current IA"; has received
         DECLINE message from a client.";
       leaf event-type {
          type enumeration {
            enum "allocation" duid {
         description "allocate"; "Client's DUID";
         type binary;
       }
            enum "rebind"
       leaf-list addresses {
         type inet:ipv6-address;
         description "rebind"; "List of suspicious addresses";
       }
            enum "renew" {
              description "renew";
     }
            enum "release"

     notification non-success-code-sent {
       description "release";
            }

          } "Notification sent when the server responded
         to a client with non-success status code.";
       leaf status-code {
         type uint16;
         mandatory true;
         description "event type"; "Status code returned to a client";
       }
        container
       leaf duid {
         description "Sets the "Client's DUID";
          uses dhcpv6-types:duid;
         type binary;
       }
        leaf iaid
     }
   }

3.2.  DHCPv6 Relay YANG Model

   This module imports typedefs from [RFC6991], [RFC8343].

   module ietf-dhcpv6-relay {
          type uint32;
          mandatory true;
          description "IAID";
     yang-version 1.1;
     namespace "urn:ietf:params:xml:ns:yang:ietf-dhcpv6-relay";
     prefix "dhcpv6-relay";

     import ietf-inet-types {
       prefix inet;
     }
        leaf serv-name
     import ietf-yang-types {
          type string;
          description "server name";
       prefix yang;
     }
        leaf
     import ietf-dhcpv6-common {
       prefix dhcpv6-common;
     }
     import ietf-interfaces {
       prefix if;
     }

     organization
       "IETF DHC (Dynamic Host Configuration) Working group";

     contact
       "cuiyong@tsinghua.edu.cn
       lh.sunlinh@gmail.com
       ian.farrer@telekom.de
       sladjana.zechlin@telekom.de
       hezihao9512@gmail.com
       godfryd@isc.org";

     description
       "This model defines a YANG data model that can be
       used to configure and manage a DHCPv6 relay.

       Copyright (c) 2018 IETF Trust and the persons identified as
       authors of the code.  All rights reserved.

       Redistribution and use in source and binary forms, with or
       without modification, is permitted pursuant to, and subject
       to the license terms contained in, the Simplified BSD License
       set forth in Section 4.c of the IETF Trust's Legal Provisions
       Relating to IETF Documents
       (http://trustee.ietf.org/license-info).

       This version of this YANG module is part of RFC 8513; see
       the RFC itself for full legal notices.";

     revision 2019-09-20 {
          type string;
       description "description of event";
        } "";
       reference "I-D: draft-ietf-dhc-dhcpv6-yang-10";
     }

      container invalid-ia-detected

     revision 2018-03-04 {
       description "raised when the identity association of "Resolved most issues on the
          client can be proved to be invalid.  Possible condition
          includes duplicated address, illegal address, etc.";
        container duid DHC official
         github";
       reference "I-D: draft-ietf-dhc-dhcpv6-yang";
     }

     revision 2017-12-22 {
       description "Sets the DUID";
          uses dhcpv6-types:duid;
         "Resolve most issues on Ians Github.";
       reference
         "I-D: draft-ietf-dhc-dhcpv6-yang";
     }
        leaf cli-duid

     revision 2017-11-24 {
          type uint32;
          mandatory true;
       description "duid
         "First version of client"; the separated relay specific
         YANG model.";
       reference
         "I-D: draft-ietf-dhc-dhcpv6-yang";
     }
        leaf iaid

     identity relay {
          type uint32;
          mandatory true;
       base "dhcpv6-common:dhcpv6-node";
       description "IAID"; "DHCPv6 relay agent.";
     }

     leaf serv-name dhcpv6-node-type {
          type string;
       description "server name"; "Type for a DHCPv6 relay";
       type identityref {
         base "dhcpv6-relay:relay";
       }
        leaf description
     }

     feature prefix-delegation {
          type string;
       description "description of "Enable if the event";

        } relay functions as a delegating router
         for prefix delegation.";
     }

      container retransmission-failed

     grouping pd-lease-state {
       description "raised when "State data for the retransmission mechanism defined
          in [RFC3315] is failed.";
        container duid relay";
       list pd-leases {
         config false;
         key ia-pd-prefix;
         description "Sets the DUID";
          uses dhcpv6-types:duid;
        } "Information about an active IA_PD prefix
           delegation.";

         leaf description {
          type enumeration {
            enum "MRC failed" ia-pd-prefix {
           description "MRC failed"; "Prefix that is delegated.";
           type inet:ipv6-prefix;
         }
            enum "MRD failed"
         leaf last-renew {
           description "MRD failed";
            }
          }
          mandatory true;
          description "description "Time of failure";
        }
      }

      container failed-status-turn-up {
        description "raised when the client receives a message includes
          an unsuccessful Status Code option.";
        container duid {
          description "Sets last successful refresh or renew
             of the DUID";
          uses dhcpv6-types:duid;
        }
        leaf status-code { delegated prefix.";
           type enumeration {
            enum "1" {
              description "UnspecFail"; yang:date-and-time;
         }
            enum "2"
         leaf client-peer-address {
           description "NoAddrAvail"; "Peer-address of the client.";
           type inet:ipv6-address;
         }
            enum "3"
         leaf client-duid {
           description "NoBinding"; "DUID of the client.";
           type binary;
         }
            enum "4"
         leaf server-duid {
           description "NotOnLink"; "DUID of the delegating server.";
           type binary;
         }
            enum "5" {
              description "UseMulticast";
       }
     }
          mandatory true;

     grouping message-statistics {
       description "employed status code";
        }
      }

    }
  }
}
<CODE ENDS>

3.4. "Contains counters for DHCPv6 Options YANG Model

   This module imports typedefs from [RFC6991], [RFC7223].

<CODE BEGINS> file "ietf-dhcpv6-options.yang"
module ietf-dhcpv6-options {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-dhcpv6-options";
  prefix "dhcpv6-options";

  import ietf-inet-types messages.";
       leaf solicit-received-count {
    prefix inet;
         config "false";
         type uint32;
         description "Number of Solicit (1) messages received.";
       }
  import ietf-yang-types
       leaf advertise-sent-count {
    prefix yang;
         config "false";
         type uint32;
         description "Number of Advertise (2) messages sent.";
       }
  import ietf-dhcpv6-types
       leaf request-received-count {
    prefix dhcpv6-types;
  }

  organization "DHC WG";
  contact
   "cuiyong@tsinghua.edu.cn
    wangh13@mails.tsinghua.edu.cn
    lh.sunlinh@gmail.com
    ian.farrer@telekom.de
    sladjana.zechlin@telekom.de
    hezihao9512@gmail.com";
         config "false";
         type uint32;
         description "This model defines a YANG data model that can be
    used to configure DHCPv6 options.";

  revision 2018-09-04 "Number of Request (3) messages received.";
       }
       leaf confirm-received-count {
         config "false";
         type uint32;
         description "";
    reference "I-D: draft-ietf-dhc-dhcpv6-yang"; "Number of Confirm (4) messages received.";
       }
  revision 2018-03-04
       leaf renew-received-count {
         config "false";
         type uint32;
         description "Resolved most issues on the DHC official
    github";
    reference "I-D: draft-ietf-dhc-dhcpv6-yang"; "Number of Renew (5) messages received.";
       }

  revision 2017-12-22
       leaf rebind-received-count {
         config "false";
         type uint32;
         description "Resolve most issues on Ian's github.";
          reference "I-D: draft-ietf-dhc-dhcpv6-yang"; "Number of Rebind (6) messages received.";
       }

  revision 2017-11-24
       leaf reply-sent-count {
         config "false";
         type uint32;
         description "First version "Number of the separated DHCPv6 options
      YANG model.";
    reference "I-D:draft-ietf-dhc-dhcpv6-yang"; Reply (7) messages received.";
       }

  /*
   * Features
   */

  //  features for server options
        feature server-unicast-op
       leaf release-received-count {
         config "false";
         type uint32;
         description "Support for Server Unicast option"; "Number of Release (8) messages sent.";
       }
        feature sip-server-domain-name-list-op
       leaf decline-received-count {
         config "false";
         type uint32;
         description "Support for SIP Server Domain Name List option"; "Number of Decline (9) messages sent.";
       }
        feature sip-server-address-list-op
       leaf reconfigure-sent-count {
         config "false";
         type uint32;
         description "Support for SIP Server Address List option"; "Number of Reconfigure (10) messages sent.";
       }
  feature dns-servers-op
       leaf information-request-received-count {
         config "false";
         type uint32;
         description "Support for DNS Servers Option"; "Number of Information-request (11) messages
           received.";
       }
        feature domain-searchlist-op
       leaf unknown-message-received-count {
         config "false";
         type uint32;
         description "Support for Domain Search List Option";
           "Number of messages of unknown type that have been received."
   ;
       }
        feature nis-config-op
       leaf unknown-message-sent-count {
         config "false";
         type uint32;
         description "Support for Network Information Service (NIS)
                        Servers option";
           "Number of messages of unknown type that have been sent.";
       }
        feature nis-plus-config-op
       leaf discarded-message-count {
         config "false";
         type uint32;
         description "Support
           "Number of messages that have been discarded for Network Information Service V2 (NIS+)
                        Servers option"; any reason."
   ;
       }
        feature nis-domain-name-op
     }

     grouping global-statistics {
       leaf relay-forward-sent-count {
         config "false";
         type uint32;
         description "Support for Network Information Service (NIS)
                        Domain Name option"; "Number of Relay-forward (12) messages sent.";
       }
        feature nis-plus-domain-name-op
       leaf relay-forward-received-count {
         config "false";
         type uint32;
         description "Support for Network Information Service V2 (NIS+)
                        Server option"; "Number of Relay-forward (12) messages received.";
       }
        feature sntp-server-op
       leaf relay-reply-received-count {
         config "false";
         type uint32;
         description "Support for Simple Network Protocol Configuration
                        (SNTP) Servers option"; "Number of Relay-reply (13) messages received.";
       }
        feature info-refresh-time-op
       leaf relay-forward-unknown-sent-count {
         config "false";
         type uint32;
         description "Support for Information Refresh Time option"; "Number of Relay-forward (12) messages containing
           a message of unknown type sent.";
       }
        feature client-fqdn-op
       leaf relay-forward-unknown-received-count {
         config "false";
         type uint32;
         description "Support for Client FQDN option"; "Number of Relay-forward (12) messages containing
           a message of unknown type received.";
       }
        feature posix-timezone-op
       leaf discarded-message-count {
         config "false";
         type uint32;
         description "Support "Number of messages that have been discarded
           for New POIX Timezone option"; any reason.";
       }
        feature tzdb-timezone-op
     }

     /*
      * Data Nodes
      */

     container dhcpv6-relay {
       description "Support for New TZDB Timezone option";
         "This container contains the configuration data of the relay.";
       list relay-if {
         key if-name;
         leaf if-name {
           type if:interface-ref;
         }
        feature ntp-server-op
         leaf-list destination-addresses {
           type inet:ipv6-address;
           description "Support "Each DHCPv6 relay agent may be configured with
             a list of destination addresses for Network Time Protocol (NTP)
                        Server option"; relayed messages.
             The list may include unicast addresses, multicast addresses
             or other addresses.";
         }
        feature boot-file-url-op
         leaf link-address {
           description "Support for Boot File URL option"; "An address that may be used by the server
             to identify the link on which the client is located.";
           type binary {
             length "0..16";
           }
        feature boot-file-param-op
         }
         container relay-options {
           description "Support "Definitions for Boot File Parameters option"; DHCPv6 options that can be sent
             by the relay are augmented to this location from other YANG
             modules as required.";
         }
        feature aftr-name-op
         uses message-statistics;
         container prefix-delegation {
           description "Support "Controls and holds state information for Address Family Transition
                        Router (AFTR) option"; prefix
             delegation.";
           presence "Enables prefix delegation for this interface.";
           if-feature prefix-delegation;
           uses pd-lease-state;
         }
        feature kbr-default-name-op
       }
       uses global-statistics;
     }

     /*
      * Notifications
      */

     notification relay-event {
       description "Support for Kerberos Default Name
                        Option";
        }
        feature kbr-kdc-op
         "DHCPv6 relay event";
       container topology-change {
         description "Support "Raised if the entry for Kerberos KDC option"; and interface with DHCPv6
           related configuration or state is removed
           from if:interface-refs.";
         leaf relay-if-name {
           description "Name of the interface that has been removed.";
           type leafref {
             path "/dhcpv6-relay/relay-if/if-name";
           }
         }
        feature sol-max-rt-op
         leaf last-ipv6-addr {
           type inet:ipv6-address;
           description "Support for SOL_MAX_RT option"; "Last IPv6 address configured on the interface.";
         }
        feature inf-max-rt-op {
                description "Support for INF_MAX_RT option";
       }
        feature addr-selection-op {
                description "Support for Address Selection option";
     }
        feature pcp-server-op {
                description "Support for Port Control Protocol (PCP)
                        option";
   }
        feature s46-rule-op

3.3.  DHCPv6 Client YANG Model

   This module imports typedefs from [RFC6991], [RFC8343].

   module ietf-dhcpv6-client {
                description "Support for S46 Rule option";
     yang-version 1.1;
     namespace "urn:ietf:params:xml:ns:yang:ietf-dhcpv6-client";
     prefix "dhcpv6-client";

     import ietf-inet-types {
       prefix inet;
     }
        feature s46-br-op
     import ietf-yang-types {
                description "Support for S46 Border Relay (BR) option";
       prefix yang;
     }
        feature s46-dmr-op
     import ietf-dhcpv6-common {
                description "Support for S46 Default Mapping Rule
                        (DMR) option";
       prefix dhcpv6-common;
     }
        feature s46-v4-v6-binding-op
     import ietf-interfaces {
       prefix if;
     }

     organization "DHC WG";
     contact
       "cuiyong@tsinghua.edu.cn
       wangh13@mails.tsinghua.edu.cn
       lh.sunlinh@gmail.com
       ian.farrer@telekom.de
       sladjana.zechlin@telekom.de
       hezihao9512@gmail.com
       godfryd@isc.org";

     description "Support "This is a YANG data module for S46 IPv4/IPv6 Address
                        Bind option";
        }

        // features the configuration
       and management of DHCPv6 clients.

       Copyright (c) 2018 IETF Trust and the persons identified as
       authors of the code.  All rights reserved.

       Redistribution and use in source and binary forms, with or
       without modification, is permitted pursuant to, and subject
       to the license terms contained in, the Simplified BSD License
       set forth in Section 4.c of the IETF Trust's Legal Provisions
       Relating to IETF Documents
       (http://trustee.ietf.org/license-info).

       This version of this YANG module is part of RFC 8513; see
       the RFC itself for relay-supplied options
        feature erp-local-domain-name-op full legal notices.";

     revision 2019-09-20 {
       description "Support for ERP Local Domain Name option"; "";
       reference "I-D: draft-ietf-dhc-dhcpv6-yang-10";
     }

        // features for client options
        feature option-request-op

     revision 2018-09-04 {
       description "Support for Option Request option"; "";
       reference "I-D: draft-ietf-dhc-dhcpv6-yang";
     }
        feature rapid-commit-op

     revision 2018-03-04 {
       description "Support for Rapid Commit option"; "Resolved most issues on the DHC official github";
       reference "I-D: draft-ietf-dhc-dhcpv6-yang";
     }
        feature user-class-op

     revision 2017-12-22 {
       description "Support for User Class option"; "Resolve most issues on Ian's Github.";
       reference "I-D: draft-ietf-dhc-dhcpv6-yang";
     }
        feature vendor-class-op

     revision 2017-11-24 {
       description "Support for Vendor Class option"; "First version of the separated client specific
         YANG model.";
       reference "I-D: draft-ietf-dhc-dhcpv6-yang";
     }
        feature client-arch-type-op

     identity client {
       base "dhcpv6-common:dhcpv6-node";
       description "Support for Client System Architecture
                        Type option"; "DHCPv6 client.";
     }
        feature client-network-interface-identifier-op

     leaf dhcpv6-node-type {
       description "Support "Type for Client Network Interface
                        Identifier option"; a DHCPv6 client";
       type identityref {
         base "dhcpv6-client:client";
       }
        feature kbr-principal-name-op
     }

     /*
      * Groupings
      */

     grouping message-statistics {
       description "Support "Counters for Kerberos Principal
                        Name option";
        }
        feature kbr-realm-name-op DHCPv6 messages.";
       leaf solicit-count {
         config "false";
         type uint32;
         description "Support Kerberos Realm Name option"; "Number of Solicit (1) messages sent.";
       }
        feature client-link-layer-addr-op
       leaf advertise-count {
         config "false";
         type uint32;
         description "Support for Client Link-Layer Address
                        Option"; "Number of Advertise (2) messages received.";
       }

        // features for custom options
        feature operator-op-ipv6-address
       leaf request-count {
         config "false";
         type uint32;
         description "Support for Option with IPv6 Addresses"; "Number of Request (3) messages sent.";
       }
        feature operator-op-single-flag
       leaf confirm-count {
         config "false";
         type uint32;
         description "Support for Option with Single Flag"; "Number of Confirm (4) messages sent.";
       }
        feature operator-op-ipv6-prefix
       leaf renew-count {
         config "false";
         type uint32;
         description "Support for Option with IPv6 Prefix"; "Number of Renew (5) messages sent.";
       }
        feature operator-op-int32
       leaf rebind-count {
         config "false";
         type uint32;
         description "Support for Option with 32-bit
                        Integer Value"; "Number of Rebind (6) messages sent.";
       }
        feature operator-op-int16
       leaf reply-count {
         config "false";
         type uint32;
         description "Support for Option with 16-bit Integer Value"; "Number of Reply (7) messages received.";
       }
        feature operator-op-int8
       leaf release-count {
         type uint32;
         description "Support for Option with 8-bit Integer Value"; "Number of Release (8) messages sent.";
       }
        feature operator-op-uri
       leaf decline-count {
         config "false";
         type uint32;
         description "Support for Option with URI"; "Number of Decline (9) messages sent.";
       }
        feature operator-op-textstring
       leaf reconfigure-count {
         config "false";
         type uint32;
         description "Support for Option with Text String"; "Number of Reconfigure (10) messages received.";
       }
        feature operator-op-var-data
       leaf information-request-count {
         config "false";
         type uint32;
         description "Support for Option with Variable-Length Data"; "Number of Information-request (11) messages
           sent.";
       }
        feature operator-op-dns-wire {
                description "Support for Option with DNS Wire
                        Format Domain Name List";
     }

     /*
      * Groupings Data Nodes
      */

  grouping server-option-definitions

     container dhcpv6-client {
       description "Contains definitions for options configured on "DHCPv6 client configuration and state.";
       list client-if {
         key if-name;
         description "The list of interfaces that the
      DHCPv6 server which client will be supplied
           requesting DHCPv6 configuration for.";
         leaf if-name {
           type if:interface-ref;
           mandatory true;
           description "Reference to clients."; the interface entry that
             the requested configuration is relevant to.";
         }
         uses dhcpv6-common:duid;
         container server-unicast-option client-configured-options {
      if-feature server-unicast-op;
      presence "Enable
           description "Definitions for DHCPv6 options that can be be
             sent by the client are augmented to this option"; location from
             other YANG modules as required.";
         }
         list ia-na {
           key iaid;
           description "OPTION_UNICAST (12) Server Unicast Option"; "Configuration relevant for an IA_NA.";
           reference "RFC3315: "RFC8415: Dynamic Host Configuration Protocol
             for IPv6 (DHCPv6)"; (DHCPv6).";
           leaf server-address iaid {
             type inet:ipv6-address; uint32;
             description "server ipv6 address";
      } "The unique identifier for this IA_NA.";
           }
           container sip-server-domain-name-list-option ia-na-options {
      if-feature sip-server-domain-name-list-op;
      presence "Enable this option";
             description "OPTION_SIP_SERVER_D (21) SIP Servers Domain Name List";
      reference "RFC3319: Dynamic Host Configuration Protocol
        (DHCPv6) Options "An augmenation point for Session Initiation Protocol (SIP) Servers"; additional options
               that the client will send in the IA_NA-options field
               of OPTION_IA_NA options.";
           }
           container lease-state {
             config "false";
             description "Information about the active IA_NA lease.";
             leaf sip-serv-domain-name ia-na-address {
        type string;
        mandatory true;
               description "sip server domain name";
      } "Address that is currently leased.";
               type inet:ipv6-address;
             }

    container sip-server-address-list-option
             leaf preferred-lifetime {
      if-feature sip-server-address-list-op;
      presence "Enable this option";
               description "OPTION_SIP_SERVER_A (22) SIP Servers IPv6 Address List";
      reference "RFC3319: Dynamic Host Configuration Protocol (DHCPv6)
        Options "The preferred lifetime for Session Initiation Protocol (SIP) Servers";
      list sip-server the leased
                 address expressed in units of seconds.";
               type dhcpv6-common:timer-value-seconds32;
             }
             leaf valid-lifetime {
        key sip-serv-id;
               description "sip server info"; "The valid lifetime for the leased address
                 expressed in units of seconds.";
               type dhcpv6-common:timer-value-seconds32;
             }
             leaf sip-serv-id lease-t1 {
          type uint8;
          mandatory true;
               description "sip "The time interval after which the client
                 should contact the server id"; from which the addresses
                 in the IA_NA were obtained to extend the lifetimes
                 of the addresses assigned to the IA_NA.";
               type dhcpv6-common:timer-value-seconds32;
             }
             leaf sip-serv-addr lease-t2 {
          type inet:ipv6-address;
          mandatory true;
               description "sip "The time interval after which the client
                 should contact any available server addr";
        }
      } to extend
                 the lifetimes of the addresses assigned to the IA_NA.";
               type dhcpv6-common:timer-value-seconds32;
             }

    container dns-servers-option {
      if-feature dns-servers-op;
      presence "Enable this option";
      description "OPTION_DNS_SERVERS (23) DNS recursive Name Server option";
      reference "RFC3646: DNS Configuration options for Dynamic Host Configuration
        Protocol for IPv6 (DHCPv6)";
      list dns-server
             leaf allocation-time {
        key dns-serv-id;
               description "dns server info"; "Time and date that the address was first
                 leased.";
               type yang:date-and-time;
             }
             leaf dns-serv-id last-renew-rebind {
          type uint8;
          mandatory true;
               description "DNS server list entry ID."; "Time of the last successful renew or rebind
                 of the leased address.";

               type yang:date-and-time;
             }
             leaf dns-serv-addr server-duid {
               description "DUID of the leasing server.";
               type inet:ipv6-address;
          mandatory true;
          description "DNS server address."; binary;
             }
           }
         }

    container domain-searchlist-option
         list ia-ta {
      if-feature domain-searchlist-op;
      presence "Enable this option";
           key iaid;
           description "OPTION_DOMAIN_LIST (24) Domain Search List Option";
      reference "RFC3646: DNS Configuration options "Configuration relevant for an IA_TA.";
           reference "RFC8415: Dynamic Host Configuration Protocol for
             IPv6 (DHCPv6)";
      list domain-searchlist {
        key domain-searchlist-id;
        description "dns server info"; (DHCPv6).";
             leaf domain-searchlist-id iaid {
               type uint8;
          mandatory true; uint32;
               description "Domain seachlist entry ID."; "The unique identifier for this IA_TA.";
             }
        leaf domain-search-list-entry
           container ia-ta-options {
          type string;
          mandatory true;
             description "Domain search list entry.";
        }
      } "An augmenation point for additional options
               that the client will send in the IA_TA-options field
               of OPTION_IA_TA options.";
           }
           container nis-config-option lease-state {
      if-feature nis-config-op;
      presence "Enable this option";
             config "false";
             description "OPTION_NIS_SERVERS (27) Network Information Service (NIS)
        Servers Option.";
      reference "RFC3898: Network Information Service (NIS) Configuration
        Options for Dynamic Host Configuration Protocol for IPv6 (DHCPv6)";
      list nis-server "Information about an active IA_TA lease.";
             leaf ia-ta-address {
        key nis-serv-id;
               description "nis server info"; "Address that is currently leased.";
               type inet:ipv6-address;
             }
             leaf nis-serv-id preferred-lifetime {
               description "The preferred lifetime for the leased
                 address expressed in units of seconds.";
               type uint8;
          mandatory true; dhcpv6-common:timer-value-seconds32;
             }
             leaf valid-lifetime {
               description "nis server id"; "The valid lifetime for the leased address
                 expressed in units of seconds.";
               type dhcpv6-common:timer-value-seconds32;
             }
             leaf nis-serv-addr allocation-time {
               description "Time and date that the address was first
                 leased.";
               type inet:ipv6-address;
          mandatory true; yang:date-and-time;
             }
             leaf last-renew-rebind {
               description "nis server addr"; "Time of the last successful renew or rebind
                 of the address.";
               type yang:date-and-time;

             }
             leaf server-duid {
               description "DUID of the leasing server.";
               type binary;
             }
           }
         }

    container nis-plus-config-option
         list ia-pd {
      if-feature nis-plus-config-op;
      presence "Enable this option";
      description "OPTION_NISP_SERVERS (28): Network Information Service V2
        (NIS+) Servers Option.";
           key iaid;
           reference "RFC3989: Network Information Service (NIS) Configuration
        Options for "RFC8415: Dynamic Host Configuration Protocol for
             IPv6 (DHCPv6)";
      list nis-plus-server {
        key nis-plus-serv-id; (DHCPv6).";
           description "NIS+ server information."; "Configuration relevant for an IA_PD.";
           leaf nis-plus-serv-id iaid {
             type uint8;
          mandatory true; uint32;
             description "nisp server id"; "The unique identifier for this IA_PD.";
           }
        leaf nis-plus-serv-addr
           container ia-pd-options {
          type inet:ipv6-address;
          mandatory true;
             description "nisp server addr";
        }
      } "An augmenation point for additional options
               that the client will send in the IA_PD-options field
               of OPTION_IA_TA options.";
           }
           container nis-domain-name-option lease-state {
      if-feature nis-domain-name-op;
      presence "Enable this option";
             config "false";
             description "OPTION_NIS_DOMAIN_NAME (29) Network Information
        Service (NIS) Domain Name Option";
      reference "RFC3989: Network Information Service (NIS)
        Configuration Options for Dynamic Host Configuration Protocol "Information about an active IA_PD delegated
               prefix.";
             leaf ia-pd-prefix {
               description "Delegated prefix that is currently leased.";
               type inet:ipv6-prefix;
             }
             leaf preferred-lifetime {
               description "The preferred lifetime for IPv6 (DHCPv6)"; the leased prefix
                 expressed in units of seconds.";
               type dhcpv6-common:timer-value-seconds32;
             }
             leaf nis-domain-name valid-lifetime {
               description "The valid lifetime for the leased prefix
                 expressed in units of seconds.";
               type string; dhcpv6-common:timer-value-seconds32;
             }
             leaf lease-t1 {
               description "The Network Information Service (NIS) Domain Name
          option is used by time interval after which the client
                 should contact the server from which the addresses
                 in the IA_NA were obtained to convey client's NIS Domain Name
          info extend the lifetimes
                 of the addresses assigned to the client.";
      } IA_PD.";
               type dhcpv6-common:timer-value-seconds32;
             }

    container nis-plus-domain-name-option {
      if-feature nis-plus-domain-name-op;
      presence "Enable this option";
      description "OPTION_NISP_DOMAIN_NAME (30) Network Information
        Service V2 (NIS+) Domain Name Option";
      reference "RFC3989: Network Information Service (NIS)
        Configuration Options for Dynamic Host Configuration Protocol
        for IPv6 (DHCPv6)";
             leaf nis-plus-domain-name lease-t2 {
        type string;
               description "The Network Information Service V2 (NIS+) Domain Name
        option is used by time interval after which the client
                 should contact any available server to convey client's NIS+ Domain Name
        info extend
                 the lifetimes of the addresses assigned to the client.";
      } IA_PD.";
               type dhcpv6-common:timer-value-seconds32;
             }

    container sntp-server-option {
      if-feature sntp-server-op;
      presence "Enable this option";
      description "OPTION_SNTP_SERVERS (31) Simple Network Time Protocol
        (SNTP) Servers Option";
      reference "RFC4075: Simple Network Time Protocol (SNTP) Configuration
        Option for DHCPv6";
      list sntp-server
             leaf allocation-time {
        key sntp-serv-id;
               description "sntp server info"; "Time and date that the prefix was first
                 leased.";
               type yang:date-and-time;
             }
             leaf sntp-serv-id last-renew-rebind {
          type uint8;
          mandatory true;
               description "sntp server id"; "Time of the last successful renew or rebind
                 of the delegated prefix.";
               type yang:date-and-time;
             }
             leaf sntp-serv-addr server-duid {
          type inet:ipv6-address;
          mandatory true;
               description "sntp server addr"; "DUID of the delegating server.";
               type binary;
             }
           }
         }

    container info-refresh-time-option {
      if-feature info-refresh-time-op;
      presence "Enable this option";
      description "OPTION_INFORMATION_REFRESH_TIME (32) Information Refresh
        Time option.";
      reference "RFC4242: Information Refresh Time Option for Dynamic Host
        Configuration Protocol for IPv6 (DHCPv6";
      leaf info-refresh-time {
        type yang:timeticks;
        mandatory true;
        description "The refresh time.";
         uses message-statistics;
       }
     }

    container client-fqdn-option

     /*
      * Notifications
      */

     notification invalid-ia-detected {
      if-feature client-fqdn-op;
      presence "Enable this option";
       description "OPTION_CLIENT_FQDN (39) DHCPv6 Client FQDN Option";
      reference "RFC4704: The Dynamic Host Configuration Protocol for IPv6
        (DHCPv6) Client Fully Qualified Domain Name (FQDN) Option"; "Notification sent when the identity association
         of the client can be proved to be invalid. Possible conditions
         include a duplicate or otherwise illegal address.";
       leaf server-initiate-update iaid {
         type boolean; uint32;
         mandatory true;
         description "server initiate"; "IAID";
       }
       leaf client-initiate-update {
        type boolean;
        mandatory true; description "client initiate";
      }
      leaf modify-name-from-cli {
         type boolean;
        mandatory true; string;
         description "modify by client"; "Description of the event.";
       }
     }

    container posix-timezone-option

     notification retransmission-failed {
      if-feature posix-timezone-op;
      presence "Enable this option";
       description "OPTION_NEW_POSIX_TIMEZONE (41) Posix Timezone option";
      reference "RFC4833: Timezone Options for DHCP"; "Notification sent when the retransmission mechanism
         defined in [RFC8415] is unsucessful.";
       leaf tz-posix failure-type {
         type string;
        mandatory true; enumeration {
           enum "MRC-exceeded" {
             description "TZ Posix IEEE 1003.1 String";
      } "Maximum retransmission count exceeded.";
           }

    container tzdb-timezone-option
           enum "MRD-exceeded" {
      if-feature tzdb-timezone-op;
      presence "Enable this option";
             description "OPTION_NEW_TZDB_TIMEZONE (42) Timezone Database option";
      reference "RFC4822: Timezone Options for DHCP";
      leaf tz-database {
        type string; "Maximum retransmission duration exceeded.";
           }
         }
         mandatory true;
         description "Reference to "Description of the TZ Database"; failure.";
       }
     }

    container ntp-server-option {
      //This option looks like it needs work to correctly model the
      //option as defined in the RFC.

      // Zihao - Re-modeled so it only contains one time source suboption

      if-feature ntp-server-op;
      presence "Enable this option";
      description "OPTION_NTP_SERVER (56) NTP Server Option for DHCPv6";
      reference "RFC5908: Network Time Protocol (NTP) Server Option for
        DHCPv6";
      list ntp-server

     notification unsuccessful-status-code {
        key ntp-serv-id;
       description "ntp server info"; "Notification sent when the client receives a message
         that includes an unsuccessful Status Code option.";
       leaf ntp-serv-id status-code {
         type uint8; uint16;
         mandatory true;
         description "NTP server id";
        }
        choice ntp-time-source-suboption {
                description "Select "Unsuccessful status code recevied by a NTP time source suboption.";
                case server-address {
                leaf-list ntp-serv-addr-suboption {
                  type inet:ipv6-address;
                  description "NTP server addr";
              } client.";
       }
                case server-multicast-address {
                        leaf-list ntp-serv-mul-addr-suboption
       leaf server-duid {

              type inet:ipv6-address;
         description "NTP "DUID of the server multicast addr";
            }
                }
                case server-fqdn {
                        leaf-list ntp-serv-fqdn-suboption { sending the unsuccessful
           error code.";
         mandatory true;
         type string;
              description "NTP server fqdn";
            }
                }
        } binary;
       }
     }

        container boot-file-url-option

     notification server-duid-changed {
                if-feature boot-file-url-op;
                presence "Enable this option";
       description "OPT_BOOTFILE_URL (59) Boot File URL Option";
                reference "RFC5970: DHCPv6 Options for Network Boot";
                list boot-file "Notification sent when the client receives a lease
         from a server with different DUID to the one currently stored
         by the client.";
       leaf new-server-duid {
                        key boot-file-id;
         description "boot file info"; "DUID of the new server.";
         mandatory true;
         type binary;
       }
       leaf boot-file-id previous-server-duid {
                                type uint8;
         description "DUID of the previous server.";
         mandatory true;
                                description "boot file id";
         type binary;
       }
        leaf-list suitable-arch-type
       leaf lease-ia-na {
          type uint16;
         description "architecture type"; "Reference to the IA_NA lease.";
         type leafref {
           path "/dhcpv6-client/client-if/ia-na/iaid";
         }
        leaf-list suitable-net-if
       }
       leaf lease-ia-ta {
                type uint32;
         description "network interface"; "Reference to the IA_TA lease.";
         type leafref {
           path "/dhcpv6-client/client-if/ia-ta/iaid";
         }
       }
       leaf boot-file-url lease-ia-pd {
                                type string;
                                mandatory true;
         description "url for boot file"; "Reference to the IA_PD lease.";
         type leafref {
           path "/dhcpv6-client/client-if/ia-pd/iaid";
         }
       }
     }

        container boot-file-param-option {
                if-feature boot-file-param-op;
                presence "Enable this option";
                description "OPT_BOOTFILE_PARAM (60) Boot File Parameters Option";
                reference "RFC5970:
   }

3.4.  DHCPv6 RFC8415 Options for Network Boot";

      list boot-file-params YANG Model

   This module imports typedefs from [RFC6991].

   module ietf-dhcpv6-options-rfc8415 {
        key param-id;
        description "boot file parameters";
        leaf param-id
     yang-version 1.1;
     namespace "urn:ietf:params:xml:ns:yang:ietf-dhcpv6-options-8415";
     prefix "rfc8415";

     import ietf-inet-types {
          type uint8;
          mandatory true;
          description "parameter id";
       prefix inet;
     }
        leaf parameter

     import ietf-dhcpv6-common {
          type string;
          mandatory true;
          description "parameter value";
       prefix dhcpv6-common;
     }

     import ietf-dhcpv6-server {
       prefix dhcpv6-server;
     }

     import ietf-dhcpv6-relay {
       prefix dhcpv6-relay;
     }

    container aftr-name-option

     import ietf-dhcpv6-client {
      if-feature aftr-name-op;
      presence "Enable this option";
       prefix dhcpv6-client;
     }

     organization "DHC WG";
     contact
       "cuiyong@tsinghua.edu.cn
       wangh13@mails.tsinghua.edu.cn
       lh.sunlinh@gmail.com
       ian.farrer@telekom.de
       sladjana.zechlin@telekom.de
       hezihao9512@gmail.com";

     description "OPTION_AFTR_NAME (64) AFTR-Name "This YANG module contains DHCPv6 Option";
      reference "RFC6334: Dynamic Host Configuration Protocol for IPv6
        (DHCPv6) Option for Dual-Stack Lite";
      leaf tunnel-endpoint-name options defined
       in RFC8415 that can be used by DHCPv6 clients, relays
       and servers.";

     revision 2019-06-07 {
        type string;
        mandatory true;
       description "aftr name";
      }
    }

    container kbr-default-name-option { "Major reworking to only contain RFC8415 options.
         if-feature kbr-default-name-op;
        presence "Enable this option";
        description "OPTION_KRB_DEFAULT_REALM_NAME (77) Kerberos Default Realm Name Option";
        reference "RFC6784: Kerberos Options for DHCPv6";
      leaf default-realm-name {
        type string;
        mandatory true;
        description "default realm name";
      } each option removed. Removed groupings
         of features by device or combination of devices. Added ";
       reference "I-D: draft-ietf-dhc-dhcpv6-yang";
     }

    container kbr-kdc-option

     revision 2018-09-04 {
        if-feature kbr-kdc-op;
        presence "Enable this option";
       description "OPTION_KRB_KDC (78) Kerberos KDB Option"; "";
       reference "RFC6784: Kerberos Options for DHCPv6";
      list kdc-info {
        key kdc-id;
        description "kdc info";
        leaf kdc-id {
          type uint8;
          mandatory true;
          description "kdc id"; "I-D: draft-ietf-dhc-dhcpv6-yang";
     }
        leaf priority

     revision 2018-03-04 {
          type uint16;
          mandatory true;
       description "priority"; "Resolved most issues on the DHC official
         github";
       reference "I-D: draft-ietf-dhc-dhcpv6-yang";
     }
        leaf weight

     revision 2017-12-22 {
          type uint16;
          mandatory true;
       description "weight"; "Resolve most issues on Ian's github.";
       reference "I-D: draft-ietf-dhc-dhcpv6-yang";
     }
        leaf transport-type {
          type uint8;
          mandatory true;

     revision 2017-11-24 {
       description "transport type"; "First version of the separated DHCPv6 options
         YANG model.";
       reference "I-D:draft-ietf-dhc-dhcpv6-yang";
     }
        leaf port-number

     /*
      * Features

     /*
      * Groupings
      */
     grouping option-iaaddr-option {
          type uint16;
          mandatory true;
       description "port number";
        } "OPTION_IAADDR (5) IA Address Option.";
       reference "RFC8415: Dynamic Host Configuration Protocol for IPv6
         (DHCPv6)";

       leaf kdc-ipv6-addr IPv6-address {
         type inet:ipv6-address;
          mandatory true;
         description "kdc ipv6 addr"; "An IPv6 address.  A client MUST NOT form
           an iplicit prefix with a length other than 128
           for this address.";
       }
       leaf realm-name preferred-lifetime {
         type string;
          mandatory true;
          description "realm name";
        }
      }
    }

    container sol-max-rt-option {
      if-feature sol-max-rt-op;
      presence "Enable this option"; uint32;
         description "OPTION_SOL_MAX_RT (82) sol max rt option";
      reference "RFC7083: Modification to Default Values "The preferred lifetime for the address
           in the option, expressed in units of
        SOL_MAX_RT and INF_MAX_RT"; seconds.";
       }
       leaf sol-max-rt-value valid-lifetime {
         type yang:timeticks;
          mandatory true; uint32;
         description "sol max rt value";
        } "The preferred lifetime for the address
           in the option, expressed in units of seconds.";
       }
       container inf-max-rt-option iaaddr-options {
      if-feature inf-max-rt-op;
      presence "Enable this option";
         description "OPTION_INF_MAX_RT (83) inf max rt option";
      reference "RFC7083: Modification "Definitions for DHCPv6 options that can be be sent
           by the client are augmented to Default Values of
        SOL_MAX_RT and INF_MAX_RT";
      leaf inf-max-rt-value {
        type yang:timeticks;
        mandatory true;
        description "inf max rt value"; this location from other YANG
           modules as required.";
       }
     }

     grouping option-request-option-group {
       container addr-selection-option option-request-option {
      if-feature addr-selection-op;
      presence "Enable this option";
         description "OPTION_ADDRSEL (84) and OPTION_ADDRSEL_TABLE (85)";
      reference "RFC7078: Distributing Address Selection Policy Using
        DHCPv6";
      // if - Needs checking "OPTION_ORO (6) Option Request Option. A client
           MUST include an Option Request option in a Solicit, Request,
           Renew, Rebind, or Information-request message to see if this matches inform
           the RFC - there
      // are two server about options here.
      // Zihao - I think this matches RFC7078
      leaf a-bit-set the client wants the server to send
           to the client.";
         reference "RFC8415: Dynamic Host Configuration Protocol for
           IPv6 (DHCPv6)";
         leaf-list oro-option {
        type boolean;
        mandatory true;
           description "a bit"; "List of options that the client is requesting,
             identified by option code";
           type uint16 {
             range "17 | 21..24 | 27..36 | 39..42 | 49..52 | 54..60 |
               62..65 | 69..78";
           }
         }
       }
      leaf p-bit-set {
        type boolean;
        mandatory true;
        description "p bit";
     }
      list policy-table

     grouping preference-option-group {
       container preference-option {
        key policy-id;
         description "policy table"; "OPTION_PREFERENCE (7) Preference Option";
         reference "RFC8415: Dynamic Host Configuration Protocol for
           IPv6 (DHCPv6)";

         leaf policy-id pref-value {
           type uint8;
          mandatory true;
           description "policy id"; "The preference value for the server
             in this message. A 1-octet unsigned integer.";
         }
       }
     }

     grouping auth-option-group {
       container auth-option {
         description "OPTION_AUTH (11) Authentication Option";
         reference "RFC8415: Dynamic Host Configuration Protocol
           for IPv6 (DHCPv6)";
         leaf label protocol {
           type uint8;
          mandatory true;
           description "label"; "The authentication protocol used
             in this Authentication option.";
         }
         leaf precedence algorithm {
           type uint8;
          mandatory true;
           description "precedence"; "The algorithm used in the authentication
             protocol.";
         }
         leaf prefix-len rdm {
           type uint8;
          mandatory true;
           description "prefix length"; "The replay detection method used
             in this Authentication option.";
         }
         leaf prefix replay-detection {
           type inet:ipv6-prefix;
          mandatory true;
          description "prefix";
        }
      }
    }

    container pcp-server-option {
      if-feature pcp-server-op;
      presence "Enable this option"; uint64;
           description "OPTION_V6_PCP_SERVER (86) pcp server option";
      reference "RFC7291: DHCP Options "The replay detection information for the Port Control
        Protocol (PCP)";
      list pcp-server {
        key pcp-serv-id;
        description "pcp server info";
        leaf pcp-serv-id {
          type uint8;
          mandatory true;
          description "pcp server id"; RDM.";
         }
         leaf pcp-serv-addr auth-information {
           type inet:ipv6-address;
          mandatory true; string;
           description "pcp server addr"; "The authentication information, as specified
             by the protocol and algorithm used in this Authentication
             option.";
         }
       }
     }

     grouping server-unicast-option-group {
       container s46-rule-option server-unicast-option {
      if-feature s46-rule-op;
      presence "Enable this option";
         description "OPTION_S46_RULE (89) S46 rule option"; "OPTION_UNICAST (12) Server Unicast Option";
         reference "RFC7598: DHCPv6 Options for "RFC8415: Dynamic Host Configuration of
        Softwire Address and Port-Mapped Clients";
      list s46-rule {
        key rule-id;
        description "s46 rule";
        leaf rule-id {
          type uint8;
          mandatory true;
          description "rule id";
        } Protocol for
           IPv6 (DHCPv6)";
         leaf rule-type server-address {
           type enumeration {
            enum "BMR" {
              description "BMR";
            }
            enum "FMR" { inet:ipv6-address;
           description "FMR"; "The 128-bit address to which the client
             should send messages delivered using unicast.";
         }
       }
          mandatory true;
          description "rule type";
     }
        leaf prefix4-len

     grouping status-code-option-group {
          type uint8;
          mandatory true;
          description "ipv4 prefix length";
        }
        leaf ipv4-prefix
       container status-code-option {
          type inet:ipv4-prefix;
          mandatory true;
         description "ipv4 prefix";
        } "OPTION_STATUS_CODE (13) Status Code Option.";
         reference "RFC8415: Dynamic Host Configuration Protocol
           for IPv6 (DHCPv6)";
         leaf prefix6-len status-code {
           type uint8;
          mandatory true; uint16;
           description "ipv6 prefix length"; "The numeric code for the status encoded
             in this option. See the Status Codes registry at
             <https://www.iana.org/assignments/dhcpv6-parameters>
             for the current list of status codes.";
         }
         leaf ipv6-prefix status-message {
           type inet:ipv6-prefix;
          mandatory true; string;
           description "ipv6 prefix"; "A UTF-8 encoded text string suitable
             for display to an end user. MUST NOT be null-terminated.";
         }
        uses dhcpv6-types:portset-param;
       }
     }

     grouping rapid-commit-option-group {
       container s46-br-option rapid-commit-option {
      if-feature s46-br-op;
         presence "Enable sending of this option";
         description "OPTION_S46_BR (90) S46 BR Option"; "OPTION_RAPID_COMMIT (14) Rapid Commit Option.
           The presence node is used to enable the option.";
         reference "RFC7598: DHCPv6 Options "RFC8415: Dynamic Host Configuration Protocol for
           IPv6 (DHCPv6)";
       }
     }

     grouping user-class-option-group {
       container user-class-option {
         description "OPTION_USER_CLASS (15) User Class Option";
         reference "RFC8415: Dynamic Host Configuration of
        Softwire Address and Port-Mapped Clients"; Protocol
           for IPv6 (DHCPv6)";
         list br user-class-data {
           key br-id; user-class-datum-id;
           min-elements 1;
           description "br info"; "The user classes of which the client
             is a member.";
           leaf br-id user-class-datum-id {
             type uint8;
          mandatory true;
             description "br id"; "User class datum ID";
           }
           leaf br-ipv6-addr user-class-datum {
             type inet:ipv6-address;
          mandatory true; string;
             description "br ipv6 addr"; "Opaque field representing a User Class
               of which the client is a member.";
           }
         }
       }
     }

     grouping vendor-class-option-group {
       container s46-dmr-option vendor-class-option {
      if-feature s46-dmr-op;
      presence "Enable this option";
         description "OPTION_S46_DMR (91) S46 DMR "OPTION_VENDOR_CLASS (16) Vendor Class Option";
         reference "RFC7598: DHCPv6 Options for "RFC8415: Dynamic Host Configuration of
        Softwire Address and Port-Mapped Clients"; Protocol
           for IPv6 (DHCPv6)";
         list dmr vendor-class-option-instances {
           key dmr-id; enterprise-number;
           description "dmr info"; "The vendor class option allows for multiple
             instances in a single message. Each list entry defines
             the contents of an instance of the option.";
           leaf dmr-id enterprise-number {
             type uint8;
          mandatory true; uint32;
             description "dmr id"; "The vendor's registered Enterprise Number
               as maintained by IANA.";
           }
           list vendor-class {
             key vendor-class-datum-id;
             description "The vendor classes of which the client
               is a member.";
             leaf dmr-prefix-len vendor-class-datum-id {
               type uint8;
          mandatory true;
               description "dmr prefix length"; "Vendor class datum ID";
             }
             leaf dmr-ipv6-prefix vendor-class-datum {
               type inet:ipv6-prefix;
          mandatory true; string;
               description "dmr ipv6 prefix"; "Opaque field representing a vendor class
                 of which the client is a member.";
             }
           }
         }
       }
     }

     grouping vendor-specific-information-option-group {
       container s46-v4-v6-binding-option vendor-specific-information-option {
      if-feature s46-v4-v6-binding-op;
      presence "Enable this option";
         description "OPTION_S46_V4V6BIND (92) S46 IPv4/IPv6 Address
        Binding option"; "OPTION_VENDOR_OPTS (17) Vendor-specific
           Information Option";

         reference "RFC7598: DHCPv6 Options for "RFC8415: Dynamic Host Configuration of
        Softwire Address and Port-Mapped Clients"; Protocol
           for IPv6 (DHCPv6)";
         list ce vendor-specific-information-option-instances {
           key ce-id; enterprise-number;
           description "ce info"; "The vendor specific information option allows
             for multiple instances in a single message. Each list entry
             defines the contents of an instance of the option.";
           leaf ce-id enterprise-number {
             type uint8;
          mandatory true; uint32;
             description "ce id"; "The vendor's registered Enterprise Number,
               as maintained by IANA.";
           }
        leaf ipv4-addr
           list vendor-option-data {
          type inet:ipv4-address;
          mandatory true;
             key sub-option-code;
             description "ce ipv4 addr";
        } "Vendor options, interpreted by vendor-specific
               client/server functions.";
             leaf bind-prefix6-len sub-option-code {
               type uint8;
          mandatory true;
          description "bind ipv6 prefix
            length"; uint16;
               description "The code for the sub-option.";
             }
             leaf bind-ipv6-prefix sub-option-data {
               type inet:ipv6-address;
          mandatory true; string;
               description "bind ipv6 prefix"; "The data area for the sub-option.";
             }
           }
        uses dhcpv6-types:portset-param;
         }
       }
     }
  //if - NB - The list of options needs to be updated.

     grouping relay-supplied-option-definitions interface-id-option-group {
    // if - The structure here needs to be checked and probably reworked.
    description "OPTION_RSOO (66) Relay-Supplied Options option";
    reference "RFC6422: Relay-Supplied DHCP Options";
       container erp-local-domain-name-option interface-id-option {
      if-feature erp-local-domain-name-op;
      presence "Enable this option";
         description "OPTION_ERP_LOCAL_DOMAIN_NAME (65) DHCPv6 ERP Local
        Domain Name "OPTION_INTERFACE_ID (18) Interface-Id Option";
         reference "RFC6440: The EAP Re-authentication "RFC8415: Dynamic Host Configuration Protocol (ERP)
        Local Domain Name DHCPv6 Option";
      list erp-for-client {
        key cli-id;
        description "erp for client";
           IPv6 (DHCPv6)";
         leaf cli-id interface-id {
           type uint32;
          mandatory true; string;
           description "client id"; "An opaque value of arbitrary length generated
             by the relay agent to identify one of the relay agent's
             interfaces.";
         }
       }
     }

     grouping reconfigure-message-option-group {
       container duid reconfigure-message-option {
         description "Sets the DUID";
          // uses duid;
          // if - Maybe DUID definition needs to be moved to this module.
          uses dhcpv6-types:duid;
        } "OPTION_RECONF_MSG (19) Reconfigure Message
           Option.";
         reference "RFC8415: Dynamic Host Configuration Protocol
           for IPv6 (DHCPv6)";
         leaf erp-name msg-type {
           type string;
          mandatory true; uint8;
           description "erp name";
        } "5 for Renew message, 6 for Rebind message,
             11 for Information-request message.";
         }
       }
     }

     grouping client-option-definitions reconfigure-accept-option-group {
       container reconfigure-accept-option {
         presence "Enable sending of this option";
         description "Contains definitions for options configured on "OPTION_RECONF_ACCEPT (20)  Rapid Commit Option.
           A client uses the Reconfigure Accept option to announce
           to the server whether the
      DHCPv6 client which will be sent is willing to accept
           Reconfigure messages, and a server uses this option to tell
           the server.";

    list new-or-standard-cli-option {
      key option-code;
      description "new client whether or standard not to accept Reconfigure messages.
           In the absence of this option, the default behavior is that
           the client option";
      leaf option-code is unwilling to accept Reconfigure messages.
           The presence node is used to enable the option.";
         reference "RFC8415: Dynamic Host Configuration Protocol
           for IPv6 (DHCPv6)";
       }
     }

     grouping option-iaprefix-option {
        type uint16;
        mandatory true;
       description "option code";
      } "OPTION_IAPREFIX (26) IA Address Option.";
       reference "RFC8415: Dynamic Host Configuration Protocol for IPv6
         (DHCPv6)";
       leaf option-name preferred-lifetime {
         type string;
        mandatory true; uint32;
         description "option name"; "The preferred lifetime for the prefix
           in the option, expressed in units of seconds.";
       }
       leaf option-description valid-lifetime {
         type string;
        mandatory true; uint32;
         description "description "The preferred lifetime for the prefix
           in the option, expressed in units of client
          option"; seconds.";
       }
       leaf option-reference IPv6-prefix {
         type string; inet:ipv6-prefix;
         description "the reference of option"; "The IPv6 prefix delegated to the client.";
       }
      leaf option-value
       container iaprefix-options {
        type string;
        mandatory true;
         description "the option value"; "Definitions for DHCPv6 options that can be
           sent by the client are augmented to this location from other
           YANG modules as required.";
       }

     }

     grouping info-refresh-time-option-group {
       container option-request-option info-refresh-time-option {
      if-feature option-request-op;
      presence "Enable this option";
         description "OPTION_ORO (6) Option Request Option"; "OPTION_INFORMATION_REFRESH_TIME (32)
           Information Refresh Time option.";
         reference "RFC3315: "RFC8415: Dynamic Host Configuration Protocol for
           IPv6 (DHCPv6)";
      list oro-option {
        key option-code;
        description "oro option";
         leaf option-code info-refresh-time {
           type uint16;
          mandatory true; dhcpv6-common:timer-value-seconds32;
           description "option code"; "Time duration relative to the current time,
             expressed in units of seconds.";
         }
        leaf
       }
     }

     grouping sol-max-rt-option-group {
       container sol-max-rt-option {
         description "OPTION_SOL_MAX_RT (82) sol max rt option";
         reference "RFC8415: Dynamic Host Configuration Protocol for
           IPv6 (DHCPv6)";
         leaf sol-max-rt-value {
           type string;
          mandatory true; dhcpv6-common:timer-value-seconds32;
           description "description of oro
            options"; "sol max rt value";
         }
       }
     }

     grouping inf-max-rt-option-group {
       container user-class-option inf-max-rt-option {
      if-feature user-class-op;
      presence "Enable this option";
         description "OPTION_USER_CLASS (15) User Class Option"; "OPTION_INF_MAX_RT (83) inf max rt option";
         reference "RFC3315: "RFC8415: Dynamic Host Configuration Protocol for
           IPv6 (DHCPv6)";
      list user-class
         leaf inf-max-rt-value {
           type dhcpv6-common:timer-value-seconds32;
           description "inf max rt value";
         }
       }
     }

     augment "/dhcpv6-server:dhcpv6-server/dhcpv6-server:option-sets/dhc
   pv6-server:option-set" {
       when "../../../dhcpv6-server:dhcpv6-node-type='dhcpv6-server:serv
   er'";
       uses preference-option-group;
       uses auth-option-group;
       uses server-unicast-option-group;
       uses status-code-option-group;
       uses rapid-commit-option-group;
       uses vendor-specific-information-option-group;
       uses reconfigure-message-option-group;
       uses reconfigure-accept-option-group;
       uses info-refresh-time-option-group;
       uses sol-max-rt-option-group;
       uses inf-max-rt-option-group;
     }
     augment "/dhcpv6-relay:dhcpv6-relay/dhcpv6-relay:relay-if/dhcpv6-re
   lay:relay-options" {
       when "../../../dhcpv6-relay:dhcpv6-node-type='dhcpv6-relay:relay'
   ";
       uses auth-option-group;
       uses status-code-option-group;
       uses interface-id-option-group;
     }
     augment "/dhcpv6-client:dhcpv6-client/dhcpv6-client:client-if/dhcpv
   6-client:client-configured-options" {
       when "../../../dhcpv6-client:dhcpv6-node-type='dhcpv6-client:clie
   nt'";
       uses option-request-option-group;
       uses status-code-option-group;
       uses rapid-commit-option-group;
       uses user-class-option-group;
       uses vendor-class-option-group;
       uses vendor-specific-information-option-group;
       uses reconfigure-accept-option-group;
     }
   }

3.5.  DHCPv6 Common YANG Model

   This module imports typedefs from [RFC6991].

   module ietf-dhcpv6-common {
     yang-version 1.1;
     namespace "urn:ietf:params:xml:ns:yang:ietf-dhcpv6-common";
     prefix "dhcpv6-common";

     import ietf-inet-types {
       prefix inet;
     }
     import ietf-yang-types {
       prefix yang;
     }

     organization "DHC WG";
     contact
       "yong@csnet1.cs.tsinghua.edu.cn
       lh.sunlinh@gmail.com
       ian.farrer@telekom.de
       sladjana.zechlin@telekom.de
       hezihao9512@gmail.com";

     description "This model defines a YANG data model that can be
       used to define some commonly used DHCPv6 types";

     revision 2018-09-04 {
       description "";
       reference "I-D: draft-ietf-dhc-dhcpv6-yang";
     }

     revision 2018-01-30 {
       description "Initial revision";
       reference "I-D: draft-ietf-dhc-dhcpv6-yang";
     }

     typedef threshold {
        key user-class-id;
        description "user class";
        leaf user-class-id
       type union {
         type uint8;
          mandatory true;
          description "user class id";
        }
        leaf user-class-data uint16 {
           range 0..100;
         }
         type string;
          mandatory true; enumeration {
           enum "disabled" {
             description "The information contained in the data area
            of this option is contained in one or more opaque
            fields that represent the user class or classes of
            which the client is a member. "; "No threshold";
           }
         }
       }

    container vendor-class-option {
      if-feature vendor-class-op;
      presence "Enable this option";
       description "OPTION_VENDOR_CLASS (16) Vendor Class Option";
      reference "RFC3315: Dynamic Host Configuration Protocol
        for IPv6 (DHCPv6)";
      leaf enterprise-number "Threshold value in percent";
     }

     typedef timer-value-seconds32 {
       type uint32;
        mandatory true; uint32 {
         range "1..4294967295";
       }
       units "seconds";
       description "enterprise number";
         "Timer value type, in seconds (32-bit range).";
     }
      list vendor-class

     identity dhcpv6-node {
          key vendor-class-id;
       description "vendor class";
        leaf vendor-class-id { "Abstract base type uint8;
          mandatory true;
          description "vendor class id"; for DHCPv6 functional nodes";
     }
        leaf vendor-class-data

     /*
      * Grouping
      */

     grouping duid {
          type string;
          mandatory true;
       description "The vendor-class-data is composed of "Each server and client has only one DUID (DHCP
         Unique Identifier). The DUID here identifies a series of
            separate items, each of which describes some characteristic
            of the client's hardware configuration. Examples unique DHCPv6
         server for clients. DUID consists of
            vendor-class-data instances might include the version a two-octet type field
         and an arbitrary length (no more than 128 bytes) content field.
         Currently there are four defined types of the
            operating system the client is running or the amount DUIDs in RFC3315
         and RFC6355 - DUID-LLT, DUID-EN, DUID-LL and DUID-UUID.
         DUID-Uknown represents those unconventional DUIDs.";
       reference "RFC3315: Section 9 and RFC6355: Section 4";
       leaf type-code {
         type uint16;
         default 65535;
         description "Type code of memory
            installed on the client.";
        }
      } this DUID";
       }

    container client-fqdn-option
       choice duid-type {
      if-feature client-fqdn-op;
      presence "Enable this option";
         default duid-unknown;
         description "OPTION_CLIENT_FQDN (39) The Dynamic Host
        Configuration Protocol "Selects the format for IPv6 (DHCPv6) Client Fully
        Qualified Domain Name (FQDN) Option"; the DUID.";
         case duid-llt {
           description "DUID Based on Link-layer Address Plus Time
             (Type 1 - DUID-LLT)";
           reference "RFC4704: The Dynamic Host Configuration Protocol
        for IPv6 (DHCPv6) Client Fully Qualified Domain Name (FQDN)
        Option"; "RFC3315 Section 9.2";
           leaf fqdn duid-llt-hardware-type {
             type string;
        mandatory true; uint16;
             description "fqdn"; "Hardware type as assigned by IANA (RFC826).";
           }
           leaf server-initiate-update duid-llt-time {
             type boolean;
        mandatory true; yang:timeticks;
             description "whether server initiate"; "The time value is the time that the DUID is
               generated represented in seconds since midnight (UTC),
               January 1, 2000, modulo 2^32.";
           }
           leaf client-initiate-update duid-llt-link-layer-address {
             type boolean;
        mandatory true; yang:mac-address;
             description "whether client initiate"; "Link-layer address as described in RFC2464";
           }
         }

    container client-arch-type-option
         case duid-en {
      if-feature client-arch-type-op;
      presence "Enable this option";
           description "OPTION_CLIENT_ARCH_TYPE (61) Client System
        Architecture Type Option"; "DUID Assigned by Vendor Based on Enterprise
             Number (Type 2 - DUID-EN)";
           reference "RFC5970: DHCPv6 Options for Network Boot";
      list architecture-types {
        key type-id;
        description "architecture types"; "RFC3315 Section 9.3";
           leaf type-id duid-en-enterprise-number {
             type uint16;
          mandatory true; uint32;
             description "type id"; "Vendor's registered Private Enterprise Number
               as maintained by IANA";
           }
           leaf most-preferred duid-en-identifier {
             type boolean;
          mandatory true; string;
             description "most preferred flag";
        } "Indentifier, unique to the device that is
               using it";
           }
         }

    container client-network-interface-identifier-option
         case duid-ll {
      if-feature client-network-interface-identifier-op;
      presence "Enable this option";
           description "OPTION_NII (62) Client Network Interface
          Identifier Option"; "DUID Based on Link-layer Address
             (Type 3 - DUID-LL)";
           reference "RFC5970: DHCPv6 Options for Network Boot"; "RFC3315 Section 9.4";
           leaf type duid-ll-hardware-type {
             type uint8;
        mandatory true; uint16;
             description "type";
      }
      leaf major { "Hardware type uint8;
        mandatory true;
        description "major"; as assigned by IANA (RFC826).";
           }
           leaf minor duid-ll-link-layer-address {
             type uint8;
        mandatory true; yang:mac-address;
             description "minor"; "Link-layer address as described in RFC2464";
           }
         }

    container kbr-principal-name-option
         case duid-uuid {
      if-feature kbr-principal-name-op;
      presence "Enable this option";
           description "OPTION_KRB_PRINCIPAL_NAME (75) Kerberos
        Principal Name Option"; "DUID Based on Universally Unique Identifier
             (Type 4 - DUID-UUID)";
           reference "RFC6784: Kerberos Options for DHCPv6";
      list principle-name {
          key principle-name-id;
          description "principle name";
          leaf principle-name-id {
                  type uint8;
                  mandatory true;
                  description "principle name id";
          } "RFC6335 Defination of the UUID-Based Unique
             Identifier";
           leaf name-type uuid {
             type int32;
                  mandatory true; yang:uuid;
             description "This field specifies "A Universally Unique IDentifier in the type of name that follows."; string
               representation defined in RFC 4122. The canonical
               representation uses lowercase characters";
           }
         }
         case duid-unknown {
           description "DUID based on free raw bytes";
           leaf name-string data {
             type string;
                  mandatory true; binary;
             description "This field encodes a sequence of components that form
                          a name, each component encoded "The bits to be used as a KerberoString"; the identifier";
           }
         }
       }
       leaf active-duid {
         config "false";
         description "The DUID which is currently in use";
         type binary;
       }
     }

     // TODO: is it used anywhere? if not should it be removed?
     grouping portset-parameters {
       description "portset parameters";
       container kbr-realm-name-option port-parameter {
        if-feature kbr-realm-name-op;
        presence "Enable this option";
         description "OPTION_KRB_REALM_NAME (76) Kerberos Realm Name Option";
        reference "RFC6784: Kerberos Options for DHCPv6"; "port parameter";
         leaf realm-name offset {
           type string; uint8;
           mandatory true;
           description "realm name";
        }
    }

    container client-link-layer-addr-option {
      if-feature client-link-layer-addr-op;
      presence "Enable this option";
      description "OPTION_CLIENT_LINKLAYER_ADDR (79) DHCPv6 Client
        Link-Layer Address Option";
      reference "RFC6939: Client Link-Layer Address Option "offset in
        DHCPv6"; a port set";
         }
         leaf link-layer-type psid-len {
           type uint16; uint8;
           mandatory true;
           description "Client link-layer address type. The link-layer
          type MUST be "length of a valid hardware type assigned by the IANA,
          as described in [RFC0826]"; psid";
         }
         leaf link-layer-addr psid {
           type string; uint16;
           mandatory true;
           description "Client link-layer address"; "psid value";
         }
       }
     }

  grouping custom-option-definitions {
    description "operator customized options";

    container operator-option-ipv6-address {
      if-feature operator-op-ipv6-address;
      presence "Enable
   }

4.  Security Considerations (TBD)

   TBD

5.  IANA Considerations (TBD)

   This document registers the following YANG modules in the "YANG
   Module Names" registry [RFC6020].

   name:           ietf-dhcpv6
   namespace:      urn:ietf:params:xml:ns:yang:ietf-dhcpv6-common
   prefix:         dhcpv6
   reference:      TBD

   name:           ietf-dhcpv6
   namespace:      urn:ietf:params:xml:ns:yang:ietf-dhcpv6-server
   prefix:         dhcpv6
   reference:      TBD

   name:           ietf-dhcpv6
   namespace:      urn:ietf:params:xml:ns:yang:ietf-dhcpv6-client
   prefix:         dhcpv6
   reference:      TBD

   name:           ietf-dhcpv6
   namespace:      urn:ietf:params:xml:ns:yang:ietf-dhcpv6-relay
   prefix:         dhcpv6
   reference:      TBD

   name:           ietf-dhcpv6
   namespace:
                   urn:ietf:params:xml:ns:yang:ietf-dhcpv6-options-
                   rfc8415
   prefix:         dhcpv6
   reference:      TBD

6.  Acknowledgments

   The authors would like to thank Qi Sun, Lishan Li, Sladjana Zoric,
   Tomek Mrugalski, Marcin Siodelski, Bernie Volz and Bing Liu for their
   valuable comments and contributions to this work.

7.  Contributors

   The following individuals contributed to this option";
      description "operator ipv6 address option";
      reference "RFC7227: Guidelines effort:
     Hao Wang
     Tsinghua University
     Beijing 100084
     P.R.China
     Phone: +86-10-6278-5822
     Email: wangh13@mails.tsinghua.edu.cn

     Ted Lemon
     Nomium, Inc
     950 Charter St.
     Redwood City, CA 94043
     USA
     Email: Ted.Lemon@nomium.com

     Bernie Volz
     Cisco Systems, Inc.
     1414 Massachusetts Ave
     Boxborough, MA 01719
     USA
     Email: volz@cisco.com

8.  References

8.1.  Normative References

   [RFC2119]  Bradner, S., "Key words for Creating New use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119,
              DOI 10.17487/RFC2119, March 1997,
              <https://www.rfc-editor.org/info/rfc2119>.

   [RFC6355]  Narten, T. and J. Johnson, "Definition of the UUID-Based
              DHCPv6 Options";
      list operator-ipv6-addr {
        key operator-ipv6-addr-id;
        description "operator ipv6 address info";
        leaf operator-ipv6-addr-id {
          type uint8;
          mandatory true;
          description "operator ipv6 address id";
        }
        leaf operator-ipv6-addr {
          type inet:ipv6-address;
          mandatory true;
          description "operator ipv6 address id";
        }
      }
    }

    container operator-option-single-flag {
      if-feature operator-op-single-flag;
      presence "Enable this option";
      description "operator single flag";
      reference "RFC7227: Guidelines Unique Identifier (DUID-UUID)", RFC 6355,
              DOI 10.17487/RFC6355, August 2011,
              <https://www.rfc-editor.org/info/rfc6355>.

   [RFC6020]  Bjorklund, M., Ed., "YANG - A Data Modeling Language for Creating New DHCPv6
        Options";
      list flag {
        key flag-id;
        description "operator single flag info";
        leaf flag-id {
          type uint8;
          mandatory true;
          description "operator single flag id";
        }
        leaf flag-value{
          type boolean;
          mandatory true;
          description "operator single flag value";
        }
      }
    }

    container operator-option-ipv6-prefix {
      if-feature operator-op-ipv6-prefix;
      presence "Enable this option";
      description "operator ipv6 prefix option";
      reference "RFC7227: Guidelines
              the Network Configuration Protocol (NETCONF)", RFC 6020,
              DOI 10.17487/RFC6020, October 2010,
              <https://www.rfc-editor.org/info/rfc6020>.

   [RFC6991]  Schoenwaelder, J., Ed., "Common YANG Data Types",
              RFC 6991, DOI 10.17487/RFC6991, July 2013,
              <https://www.rfc-editor.org/info/rfc6991>.

   [RFC7950]  Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language",
              RFC 7950, DOI 10.17487/RFC7950, August 2016,
              <https://www.rfc-editor.org/info/rfc7950>.

   [RFC8174]  Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
              2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
              May 2017, <https://www.rfc-editor.org/info/rfc8174>.

   [RFC8340]  Bjorklund, M. and L. Berger, Ed., "YANG Tree Diagrams",
              BCP 215, RFC 8340, DOI 10.17487/RFC8340, March 2018,
              <https://www.rfc-editor.org/info/rfc8340>.

   [RFC8342]  Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K.,
              and R. Wilton, "Network Management Datastore Architecture
              (NMDA)", RFC 8342, DOI 10.17487/RFC8342, March 2018,
              <https://www.rfc-editor.org/info/rfc8342>.

   [RFC8343]  Bjorklund, M., "A YANG Data Model for Creating New DHCPv6
        Options";
      list operator-ipv6-prefix {
        key operator-ipv6-prefix-id;
        description "operator ipv6 prefix info";
        leaf operator-ipv6-prefix-id {
          type uint8;
          mandatory true;
          description "operator ipv6 prefix id";
        }
        leaf operator-ipv6-prefix6-len {
          type uint8;
          mandatory true;
          description "operator ipv6 prefix length";
        }
        leaf operator-ipv6-prefix {
          type inet:ipv6-prefix;
          mandatory true;
          description "operator ipv6 prefix";
        }
      }
    }

    container operator-option-int32 {
      if-feature operator-op-int32;
      presence "Enable this option";
      description "operator integer 32 option";
      reference "RFC7227: Guidelines Interface
              Management", RFC 8343, DOI 10.17487/RFC8343, March 2018,
              <https://www.rfc-editor.org/info/rfc8343>.

   [RFC8415]  Mrugalski, T., Siodelski, M., Volz, B., Yourtchenko, A.,
              Richardson, M., Jiang, S., Lemon, T., and T. Winters,
              "Dynamic Host Configuration Protocol for Creating New DHCPv6
        Options";
      list int32val {
        key int32val-id;
        description "operator integer 32 info";
        leaf int32val-id {
          type uint8;
          mandatory true;
          description "operator integer 32 id";
        }
        leaf int32val {
          type uint32;
          mandatory true;
          description "operator integer 32 value";
        }
      }
    }

    container operator-option-int16 {
      if-feature operator-op-int16;
      presence "Enable this option";
      description "operator integer 16 option";
      reference "RFC7227: Guidelines IPv6 (DHCPv6)",
              RFC 8415, DOI 10.17487/RFC8415, November 2018,
              <https://www.rfc-editor.org/info/rfc8415>.

8.2.  Informative References

   [RFC3319]  Schulzrinne, H. and B. Volz, "Dynamic Host Configuration
              Protocol (DHCPv6) Options for Creating Session Initiation Protocol
              (SIP) Servers", RFC 3319, DOI 10.17487/RFC3319, July 2003,
              <https://www.rfc-editor.org/info/rfc3319>.

Appendix A.  Example of Adding New DHCPv6
        Options";
      list int16val {
        key int16val-id;
        description "operator integer 16 info";
        leaf int16val-id {
          type uint8;
          mandatory true;
          description "operator integer 16 id";
        }
        leaf int16val {
          type uint16;
          mandatory true;
          description "operator integer 16 value";
        }

      }
    }

    container operator-option-int8 {
      if-feature operator-op-int8;
      presence "Enable this option";
      description "operator integer 8 option";
      reference "RFC7227: Guidelines for Creating New Option Definitions

   The following section provides a example of how the DHCPv6
        Options";
      list int8val {
        key int8val-id;
        description "operator integer 8 info";
        leaf int8val-id {
          type uint8;
          mandatory true;
          description "operator integer 8 id";
        }
        leaf int8val {
          type uint8;
          mandatory true;
          description "operator integer 8 value";
        }
      }
    }

    container operator-option-uri {
      if-feature operator-op-uri;
      presence "Enable this option";
      description "operator uri option";
      reference "RFC7227: Guidelines option
   definitions can be extended for additional option.  It is expected
   that additional specficication documents will be published in the
   future for this.

   The example YANG models OPTION_SIP_SERVER_D (21) and
   OPTION_SIP_SERVER_D (21) defined in [RFC3319].  The overall structure
   is as follows:

   *  A separate grouping is used for Creating New DHCPv6 Options";
      list uri{
        key uri-id;
        description "operator uri info";
        leaf uri-id {
          type uint8;
          mandatory true;
          description "operator uri id";
        }
        leaf uri {
          type string;
          mandatory true;
          description "operator uri value";
        }
      }
    }

    container operator-option-textstring {
      if-feature operator-op-textstring;
      presence "Enable this option"; each option.

   *  The name of the option is taken from the registered IANA name for
      the option, with an '-option' suffix added.

   *  The description "operator itext string option"; field is taken from the relevant option code name
      and number.

   *  The reference "RFC7227: Guidelines for Creating New section is the number and name of the RFC in which
      the DHCPv6 Options"; option is defined.

   *  The remaining fields match the fields in the DHCP option.  They
      are in the same order as defined in the DHCP option.  Whereever
      possilbe, the format that is defined for the DHCP field should be
      matched by the relevant YANG type.

   *  Fields which can have multiple entries or instances are defined
      using list textstring{
        key textstring-id;
        description "operator text string info";
        leaf textstring-id or leaf-list nodes.

   Below the groupings for option definitions, augment statements are
   used to add the option definitions for use in the relevant DHCP
   element's module (server, relay and/or client).  If an option is
   relevant to more than one element type, then an augment statement for
   each element is used.

   module example-dhcpv6-options-rfc3319 {
          type uint8;
          mandatory true;
          description "operator text string id";
        }
        leaf textstring
     yang-version 1.1;
     namespace "urn:ietf:params:xml:ns:yang:example-dhcpv6-options-rfc33
   19";
     prefix "rfc3319";

     import ietf-inet-types {
          type string;
          mandatory true;
          description "operator text string value";
        }
      }
       prefix inet;
     }

    container operator-option-var-data

     import ietf-dhcpv6-server {
      if-feature operator-op-var-data;
      presence "Enable this option";
       prefix dhcpv6-server;

     }

     organization "DHC WG";
     contact
       "ian.farrer@telekom.de
       godfryd@isc.org";

     description "operator variable length data option";
      reference "RFC7227: Guidelines for Creating New "This YANG module contains DHCPv6 Options";
      list int32val {
        key var-data-id;
        description "operator invariable length data info";
        leaf var-data-id options defined
       in RFC3319 that can be used by DHCPv6 servers.";

     revision 2019-10-18 {
          type uint8;
          mandatory true;
       description "operator variable length id"; "Initial version.";
       reference "I-D: draft-ietf-dhc-dhcpv6-yang";
     }

     /*
      * Groupings
      */
     grouping sip-server-domain-name-list-option-group {
       container sip-server-domain-name-list-option {
         description "OPTION_SIP_SERVER_D (21) SIP Servers Domain Name
           List";
         reference "RFC3319: Dynamic Host Configuration Protocol
           (DHCPv6) Options for Session Initiation Protocol (SIP)
           Servers";
         leaf var-data sip-serv-domain-name {
           type binary;
          mandatory true; inet:domain-name;
           description "operator variable length value"; "sip server domain name";
         }
       }
     }

     grouping sip-server-address-list-option-group {
       container operator-option-dns-wire sip-server-address-list-option {
      if-feature operator-op-dns-wire;
      presence "Enable this option";
         description "operator dns wire format domain name list option"; "OPTION_SIP_SERVER_A (22) SIP Servers IPv6 Address
           List";
         reference "RFC7227: Guidelines "RFC3319: Dynamic Host Configuration Protocol
           (DHCPv6) Options for Creating New DHCPv6
        Options"; Session Initiation Protocol (SIP)
           Servers";
         list operator-option-dns-wire sip-server {
           key operator-option-dns-wire-id; sip-serv-id;
           description "operator dns wire format "sip server info";
           leaf operator-option-dns-wire-id sip-serv-id {
             type uint8;
          mandatory true;
             description "operator dns wire format "sip server id";
           }
           leaf operator-option-dns-wire{ sip-serv-addr {
             type binary;
          mandatory true; inet:ipv6-address;
             description "operator dns wire format value"; "sip server addr";
           }
         }
       }
     }

     augment "/dhcpv6-server:dhcpv6-server/dhcpv6-server:option-sets/dhc
   pv6-server:option-set" {
       when "../../../dhcpv6-server:dhcpv6-node-type='dhcpv6-server:serv
   er'";
       uses sip-server-domain-name-list-option-group;
       uses sip-server-address-list-option-group;
     }
   }

<CODE ENDS>

3.5.  DHCPv6 Types YANG Model

Appendix B.  Example Vendor Specific Server Configuration Module

   This section shows how to extend the server YANG module imports typedefs from [RFC6991].

<CODE BEGINS> file "ietf-dhcpv6-types.yang" defined in
   this document for vendor specific configuration nodes, e.g.,
   configuring a database for storing leases.

   The example module defines additional server attributes such as name
   and description.  Storage for leases is configured using a lease-
   storage container.  It allows storing leases in one of three options:
   memory (memfile), MySQL and PosgreSQL.  For each case, the necessary
   configuration parameters are provided.

   At the end there is an augment statment which adds the vendor
   specific configuration defined in "dhcpv6-server-config:config" under
   "/dhcpv6-server:config/dhcpv6-server:vendor-config" mountpoint.

   module ietf-dhcpv6-types example-dhcpv6-server-config {
     yang-version 1.1;
     namespace "urn:ietf:params:xml:ns:yang:ietf-dhcpv6-types"; "urn:ietf:params:xml:ns:yang:example-dhcpv6-server-config
   ";
     prefix "dhcpv6-types"; "dhcpv6-server-config";

     import ietf-inet-types {
       prefix inet;
     }
     import ietf-yang-types {
       prefix yang;
     }
     import ietf-interfaces {
       prefix if;
     }
     import ietf-dhcpv6-common {
       prefix dhcpv6-common;

     }
     import ietf-dhcpv6-server {
       prefix dhcpv6-server;
     }

     organization "DHC WG";
     contact
       "cuiyong@tsinghua.edu.cn
       lh.sunlinh@gmail.com
       ian.farrer@telekom.de
       sladjana.zechlin@telekom.de
       hezihao9512@gmail.com";

     description "This model defines a YANG data model that can be
       used to define some commonly used configure and manage a DHCPv6 types";

  revision 2018-09-04 {
    description "";
    reference "I-D: draft-ietf-dhc-dhcpv6-yang";
  }

  revision 2018-01-30 {
    description "Initial revision";
    reference "I-D: draft-ietf-dhc-dhcpv6-yang";
  }

  /*
  * Grouping
  */
  grouping vendor-infor {
    description "Vendor information.";
    container vendor-info {
      description "";
      leaf ent-num {
        type uint32;
        mandatory true;
        description "enterprise number";
      }
      leaf-list data server.";

     revision 2019-06-04 {
        type string;
       description "specific vendor info";
      }
    } "";
       reference "I-D: draft-ietf-dhc-dhcpv6-yang";
     }

     /*
      * Configuration data
      */
     grouping duid config {
       description
      "Each server and client has only one DUID (DHCP Unique Identifier).
      The DUID here identifies "Parameters necessary for the configuration
         of a unique DHCPv6 server for clients. DUID
      consists server";
       container serv-attributes {
         description
           "This container contains basic attributes of a two-octet type field DHCPv6 server
           such as IPv6 address, server name  and an arbitrary length (no more
      than 128 bytes) content field. Currently there are four defined types so on. Some optional
           functions that can be provided  by the server is also
           included.";
         container duid {
           description "Sets the DUID of DUIDs in RFC3315 and RFC6355 - DUID-LLT, DUID-EN, DUID-LL and
      DUID-UUID. DUID-Unknown represents those unconventional DUIDs.";
    reference "RFC3315: Section 9 and RFC6355: Section 4"; server";
           uses dhcpv6-common:duid;
         }
         leaf type-code name {
           type uint16;
      default 65535; string;
           description "Type code "Name of this DUID"; the DHCpv6 server";
         }
    choice duid-type {
    default duid-unknown;
         leaf description "Selects the format for the DUID.";
      case duid-llt {
           type string;
           description "DUID Based on Link-layer Address Plus Time
          (Type 1 - DUID-LLT)";

        reference "RFC3315 Section 9.2";
        leaf duid-llt-hardware-type "Description of the DHCPv6 server";
         }
         leaf-list ipv6-address {
           type uint16; inet:ipv6-address;
           description "Hardware type as assigned by IANA (RFC826)."; "List of IPv6 address(es) the server will ";

         }
        leaf duid-llt-time
         leaf-list interfaces-config {
           // Note - this should probably be references to
           // entries in the ietf-interfaces model
           type yang:timeticks; if:interface-ref;
           description "The time "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 time that server to listen on a unicast address with a specific
             interface, he can use the DUID is
          generated represented in seconds since midnight (UTC),
          January 1, 2000, modulo 2^32."; format like 'eth1/2001:db8::1'.";
         }
        leaf duid-llt-link-layer-addr
         container lease-storage {
          type yang:mac-address;
           description "Link-layer address as described in RFC2464";
        }
      }
      case duid-en "Indicates how the server stores the lease";
           choice storage-type {
             description "DUID Assigned by Vendor Based on Enterprise Number
          (Type 2 - DUID-EN)";
        reference "RFC3315 Section 9.3";
        leaf duid-en-enterprise-number { "the type uint32;
          description "Vendor's registered Private Enterprise Number as
            maintained by IANA";
        } of lease storage";
             // leaf duid-en-identifier persist {
             //            type string; boolean;
             //            mandatory true;
             //            description "Identifier, unique "controls whether the new leases
   and updates to existing leases are
             //            written to the device that is
          using it";
        } file";
             // }
             case duid-ll memfile {
               description "DUID Based on Link-layer Address (Type 3 - DUID-LL)";
          reference "RFC3315 Section 9.4"; "Configuration for storing leases information
                 in a CSV file.";

               leaf duid-ll-hardware-type memfile-name {
                 type uint16; string;
                 description "Hardware type as assigned by IANA (RFC826)."; "Specifies an absolute location
                   of the lease file in which new leases and lease
                   updates are recorded.";
               }

               leaf duid-ll-link-layer-addr memfile-lfc-interval {
                 type yang:mac-address; uint64;
                 description "Link-layer address as described "Specifies the interval in RFC2464"; seconds,
                   at which the server will perform a lease file cleanup
                   (LFC).";
               }
             }
             case duid-uuid mysql {
        description "DUID Based on Universally Unique Identifier
          (Type 4 - DUID-UUID)";
        reference "RFC6335 Definition of the UUID-Based Unique Identifier";
               leaf uuid mysql-name {
                 type yang:uuid;
          description "A Universally Unique IDentifier in the string
            representation defined in RFC 4122. The canonical
            representation uses lowercase characters";
        }
      }
      case duid-unknown {
        description "DUID based on free raw bytes"; string;
                 description "Name of the database.";
               }
               leaf data mysql-host {
                 type binary; string;
                 description "The bits "If the database is located on a different
                   system to be used as the identifier";
        }
      }
    } DHCPv6 server, the database host name
                   must also be specified.";
               }

  grouping portset-param
               leaf mysql-user {
                 type string;
                 description "portset parameters";
    container port-parameter "User name of the account under which
                   the server will access the database.";
               }
               leaf mysql-password {
                 type string;
                 description "port parameter"; "Password of the account under which
                   the server will access the database";
               }
               leaf offset mysql-port {
                 type uint8;
        mandatory true;
                 description "offset in "If the database is located on a different
                   system, the port set"; number may be specified";
               }
               leaf psid-len mysql-lfc-interval {
                 type uint8;
        mandatory true; uint64;
                 description "length of "Specifies the interval in seconds,
                   at which the server will perform a psid"; lease file cleanup
                   (LFC)";
               }
               leaf psid mysql-connect-timeout {
                 type uint16;
        mandatory true;
        description "psid value";
      }
    }
  }

  grouping iaid { uint64;
                 description "IA "If the database is located on a construct through which a server and different
                   system, a
        client longer interval can identify, group, and manage a set of related IPv6
        addresses. The key of the list is a 4-byte number IAID defined
        in [RFC3315].";
    list identity-association be specified";
               }
             }
             case postgresql {
      config "false";
      description "IA";
               leaf iaid postgresql-name {
                 type uint32;
        mandatory true; string;
                 description "IAID"; "Name of the database.";
               }
               leaf ia-type postgresql-host {
                 type string;
        mandatory true;
                 description "IA type"; "If the database is located on a different
                   system to the DHCPv6 server, the database host name
                   must also be specified.";
               }
      leaf-list ipv6-addr
               leaf postgresql-user {
                 type inet:ipv6-address; string;
                 description "ipv6 address"; "User name of the account under which
                   the server will access the database";
               }
      leaf-list ipv6-prefix
               leaf postgresql-password {
                 type inet:ipv6-prefix; string;
                 description "ipv6 prefix"; "Password of the account under which
                   the server will access the database";
               }
      leaf-list prefix-length
               leaf postgresql-port {
                 type uint8;
                 description "ipv6 prefix length"; "If the database is located on a different
                   system, the port number may be specified";
               }
               leaf t1-time postgresql-lfc-interval {
                 type yang:timeticks;
        mandatory true; uint64;
                 description "t1 time"; "Specifies the interval in seconds,
                   at which the server will perform a lease file cleanup
                   (LFC)";
               }
               leaf t2-time postgresql-connect-timeout {
                 type yang:timeticks;
        mandatory true; uint64;
                 description "t2 time"; "If the database is located on a different
                   system, a longer interval can be specified";
               }
             }
             case cassandra {
               leaf preferred-lifetime cassandra-name {
                 type yang:timeticks;
        mandatory true; string;
                 description "preferred lifetime"; "Name of the database";
               }
               leaf valid-lifetime cassandra-contact-points {
                 type yang:timeticks;
        mandatory true; string;
                 description "valid lifetime";
      }
    }
  }
}
<CODE ENDS>
4.  Security Considerations (TBD)

   TBD

5.  IANA Considerations (TBD)

   This document registers the following YANG modules in the "YANG
   Module Names" registry [RFC6020].

   name:           ietf-dhcpv6
   namespace:      urn:ietf:params:xml:ns:yang:ietf-dhcpv6
   prefix:         dhcpv6
   reference:      TBD

6.  Acknowledgments

   The authors would like to thank Qi Sun, Lishan Li, Sladjana Zoric,
   Tomek Mrugalski, Marcin Siodelski, Bernie Volz and Bing Liu for their
   valuable comments and contributions to this work.

7.  Contributors

   The following individuals contributed to this effort:
     Hao Wang
     Tsinghua University
     Beijing 100084
     P.R.China
     Phone: +86-10-6278-5822
     Email: wangh13@mails.tsinghua.edu.cn

     Ted Lemon
     Nomium, Inc
     950 Charter St.
     Redwood City, CA 94043
     USA
     Email: Ted.Lemon@nomium.com

     Bernie Volz
     Cisco Systems, Inc.
     1414 Massachusetts Ave
     Boxborough, MA 01719
     USA
     Email: volz@cisco.com

8.  References

8.1.  Normative References

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119,
              DOI 10.17487/RFC2119, March 1997,
              <https://www.rfc-editor.org/info/rfc2119>.

   [RFC3315]  Droms, R., Ed., Bound, J., Volz, B., Lemon, T., Perkins,
              C., and M. Carney, "Dynamic Host Configuration Protocol
              for IPv6 (DHCPv6)", RFC 3315, DOI 10.17487/RFC3315, July
              2003, <https://www.rfc-editor.org/info/rfc3315>.

   [RFC3633]  Troan, O. and R. Droms, "IPv6 Prefix Options for Dynamic
              Host Configuration Protocol (DHCP) version 6", RFC 3633,
              DOI 10.17487/RFC3633, December 2003,
              <https://www.rfc-editor.org/info/rfc3633>.

   [RFC6020]  Bjorklund, M., Ed., "YANG - A Data Modeling Language for "Cassandra takes a list of comma separated
                   IP addresses to contact the Network Configuration Protocol (NETCONF)", RFC 6020,
              DOI 10.17487/RFC6020, October 2010,
              <https://www.rfc-editor.org/info/rfc6020>.

   [RFC6087]  Bierman, A., "Guidelines for Authors and Reviewers cluster";
               }
               leaf cassandra-user {
                 type string;
                 description "User name of YANG
              Data Model Documents", RFC 6087, DOI 10.17487/RFC6087,
              January 2011, <https://www.rfc-editor.org/info/rfc6087>.

   [RFC6355]  Narten, T. and J. Johnson, "Definition the account under which
                   the server will access the database";
               }
               leaf cassandra-password {
                 type string;
                 description "Password of the UUID-Based
              DHCPv6 Unique Identifier (DUID-UUID)", RFC 6355,
              DOI 10.17487/RFC6355, August 2011,
              <https://www.rfc-editor.org/info/rfc6355>.

   [RFC6991]  Schoenwaelder, J., Ed., "Common YANG Data Types",
              RFC 6991, DOI 10.17487/RFC6991, July 2013,
              <https://www.rfc-editor.org/info/rfc6991>.

   [RFC7223]  Bjorklund, M., "A YANG Data Model for Interface
              Management", RFC 7223, DOI 10.17487/RFC7223, May 2014,
              <https://www.rfc-editor.org/info/rfc7223>.

8.2.  Informative References

   [I-D.ietf-netmod-yang-tree-diagrams]
              Bjorklund, M. and L. Berger, "YANG Tree Diagrams", draft-
              ietf-netmod-yang-tree-diagrams-06 (work in progress),
              February 2018.

   [RFC3319]  Schulzrinne, H. account under which
                   the server will access the database";
               }
               leaf cassandra-lfc-interval {
                 type uint64;
                 description "Specifies the interval in seconds,
                   at which the server will perform a lease file cleanup
                   (LFC)";
               }
               leaf cassandra-connect-timeout {
                 type uint64;
                 description "If the database is located on a different
                   system, a longer interval can be specified";
               }
             }
           }
         }
         uses dhcpv6-common:vendor-infor;
       }

     }

     augment "/dhcpv6-server:config/dhcpv6-server:vendor-config" {
       uses dhcpv6-server-config:config;
     }
   }

Appendix C.  Example definition of class selector configuration

   The module "example-dhcpv6-class-selector" provides an example of how
   vendor specific class selector configuration can be modeled and B. Volz, "Dynamic Host Configuration
              Protocol (DHCPv6) Options for Session Initiation Protocol
              (SIP) Servers", RFC 3319, DOI 10.17487/RFC3319, July 2003,
              <https://www.rfc-editor.org/info/rfc3319>.

   [RFC3646]  Droms, R., Ed., "DNS Configuration options for Dynamic
              Host Configuration Protocol for IPv6 (DHCPv6)", RFC 3646,
              DOI 10.17487/RFC3646, December 2003,
              <https://www.rfc-editor.org/info/rfc3646>.

   [RFC3898]  Kalusivalingam, V., "Network Information Service (NIS)
              Configuration Options for Dynamic Host Configuration
              Protocol for IPv6 (DHCPv6)", RFC 3898,
              DOI 10.17487/RFC3898, October 2004,
              <https://www.rfc-editor.org/info/rfc3898>.

   [RFC4075]  Kalusivalingam, V., "Simple Network Time Protocol (SNTP)
              Configuration Option for DHCPv6", RFC 4075,
              DOI 10.17487/RFC4075, May 2005,
              <https://www.rfc-editor.org/info/rfc4075>.

   [RFC4242]  Venaas, S., Chown, T.,
   integrated with the ietf-dhcpv6-server module defined in this
   document.

   The example module defines "client-class-names" with associated
   matching rules.  A client can be classified based on "client id",
   "interface-id" (ingress inteface of the client's messages), packets
   source or destination address, relay link address, relay link
   interface-id and B. Volz, "Information Refresh
              Time Option for Dynamic Host Configuration Protocol for
              IPv6 (DHCPv6)", RFC 4242, DOI 10.17487/RFC4242, November
              2005, <https://www.rfc-editor.org/info/rfc4242>.

   [RFC4704]  Volz, B., "The Dynamic Host Configuration Protocol more.  Actually there is endless methods for
              IPv6 (DHCPv6) Client Fully Qualified Domain Name (FQDN)
              Option", RFC 4704, DOI 10.17487/RFC4704, October 2006,
              <https://www.rfc-editor.org/info/rfc4704>.

   [RFC4833]  Lear, E. and P. Eggert, "Timezone Options
   classifying clients.  So this standard does not try to provide full
   specificiation for DHCP",
              RFC 4833, DOI 10.17487/RFC4833, April 2007,
              <https://www.rfc-editor.org/info/rfc4833>.

   [RFC5908]  Gayraud, R. class selection, it only shows an example how it
   can be defined.

   At the end of the example augment statements are used to add the
   defind class selector rules into the overall DHCPv6 addressing
   heirarchy.  This is done in two main parts:

   *  The augmented class-selector configuration in the main DHCPv6
      Server configuration.

   *  client-class leafrefs augmented to "network-range", "address-pool"
      and B. Lourdelet, "Network Time Protocol (NTP) "pd-pool", pointing to the "client-class-name" that is
      required.

   The mechanism is as follows: class is associated to client based on
   rules and then client is allowed to get address(es)/prefix(es) from
   given network-range/pool if the class name matches.

   module example-dhcpv6-class-selector {
     yang-version 1.1;
     namespace "urn:ietf:params:xml:ns:yang:example-dhcpv6-class-selecto
   r";
     prefix "dhcpv6-class-selector";

     import ietf-inet-types {
       prefix inet;
     }
     import ietf-interfaces {
       prefix if;
     }
     import ietf-dhcpv6-common {
       prefix dhcpv6-common;
     }
     import ietf-dhcpv6-server {
       prefix dhcpv6-server;
     }

     organization "DHC WG";
     contact
       "yong@csnet1.cs.tsinghua.edu.cn
       lh.sunlinh@gmail.com
       ian.farrer@telekom.de
       sladjana.zechlin@telekom.de
       hezihao9512@gmail.com";

     description "This model defines a YANG data model that can be
       used to define client class selector for DHCPv6 Server Option model.";

     revision 2019-06-13 {
       description "";
       reference "I-D: draft-ietf-dhc-dhcpv6-yang";
     }

     grouping client-class-id {
       description "Defintions for DHCPv6", RFC 5908, DOI 10.17487/RFC5908,
              June 2010, <https://www.rfc-editor.org/info/rfc5908>.

   [RFC5970]  Huth, T., Freimann, J., Zimmer, V., and D. Thaler, "DHCPv6
              Options client classification for Network Boot", RFC 5970, DOI 10.17487/RFC5970,
              September 2010, <https://www.rfc-editor.org/info/rfc5970>.

   [RFC6334]  Hankins, D.
         authorization and T. Mrugalski, "Dynamic Host Configuration
              Protocol assignment purposes.";

       leaf client-class-name {
         type string;
         description "Unique Identifier for IPv6 (DHCPv6) Option client class identification
           list entries.";
       }

       choice id-type {
         description "Definitions for different client identifier
           types.";
         mandatory true;
         case client-id-id {
           description "Client class selection based on a string literal
             client identifier.";
           leaf client-id {
             description "String literal client identifier.";
             mandatory true;
             type string;
           }
         }
         case received-interface-id {
           description "Client class selection based on the incoming
             interface of the DHCPv6 message.";
           leaf received-interface {
             description "Reference to the interface entry
               for Dual-Stack Lite",
              RFC 6334, DOI 10.17487/RFC6334, August 2011,
              <https://www.rfc-editor.org/info/rfc6334>.

   [RFC6422]  Lemon, T. and Q. Wu, "Relay-Supplied DHCP Options",
              RFC 6422, DOI 10.17487/RFC6422, December 2011,
              <https://www.rfc-editor.org/info/rfc6422>.

   [RFC6440]  Zorn, G., Wu, Q., and Y. Wang, "The EAP Re-authentication
              Protocol (ERP) Local Domain Name the incoming DHCPv6 Option", RFC 6440,
              DOI 10.17487/RFC6440, December 2011,
              <https://www.rfc-editor.org/info/rfc6440>.

   [RFC6784]  Sakane, S. and M. Ishiyama, "Kerberos Options message.";
             type if:interface-ref;
           }
         }
         case packet-source-address-id {
           description "Client class selection based on the source
             address of the DHCPv6 message.";
           leaf packet-source-address {
             description "Source address of the DHCPv6 message.";
             mandatory true;
             type inet:ipv6-address;
           }
         }
         case packet-destination-address-id {
           description "Client class selection based on the destination
             address of the DHCPv6 message.";
           leaf packet-destination-address {
             description "Destination address of the DHCPv6 message.";
             mandatory true;
             type inet:ipv6-address;
           }
         }
         case relay-link-address-id {
           description "Client class selection based on the prefix
             of the link-address field in the relay agent message
             header.";
           leaf relay-link-address {
             description "Prefix of the link-address field in the relay
               agent message header.";
             mandatory true;
             type inet:ipv6-prefix;
           }

         }
         case relay-peer-address-id {
           description "Client class selection based on the value of the
             peer-address field in the relay agent message header.";
           leaf relay-peer-address {
             description "Prefix of the peer-address field
               in the relay agent message header.";
             mandatory true;
             type inet:ipv6-prefix;
           }
         }
         case relay-interface-id {
           description "Client class selection based on the incoming
             interface-id option.";
           leaf relay-interface {
             description "Reference to the interface entry
               for DHCPv6",
              RFC 6784, DOI 10.17487/RFC6784, November 2012,
              <https://www.rfc-editor.org/info/rfc6784>.

   [RFC6939]  Halwasia, G., Bhandari, S., the incoming DHCPv6 message.";
             type string;
           }
         }
         case user-class-option-id {
           description "Client class selection based on the value of the
             OPTION_USER_CLASS(15) and W. Dec, its user-class-data field.";
           leaf user-class-data {
             description "Value of the enterprise-number field.";
             mandatory true;
             type string;
           }
         }
         case vendor-class-present-id {
           description "Client class selection based on the presence of
             OPTION_VENDOR_CLASS(16) in the received message.";
           leaf vendor-class-present {
             description "Presence of OPTION_VENDOR_CLASS(16)
               in the received message.";
             mandatory true;
             type boolean;
           }
         }
         case vendor-class-option-enterprise-number-id {
           description "Client Link-Layer
              Address Option class selection based on the value of the
             enterprise-number field in DHCPv6", RFC 6939, DOI 10.17487/RFC6939,
              May 2013, <https://www.rfc-editor.org/info/rfc6939>.

   [RFC7078]  Matsumoto, A., Fujisaki, T., and T. Chown, "Distributing
              Address Selection Policy Using DHCPv6", RFC 7078,
              DOI 10.17487/RFC7078, January 2014,
              <https://www.rfc-editor.org/info/rfc7078>.

   [RFC7083]  Droms, R., "Modification to Default Values OPTION_VENDOR_CLASS(16).";
           leaf vendor-class-option-enterprise-number {
             description "Value of SOL_MAX_RT
              and INF_MAX_RT", RFC 7083, DOI 10.17487/RFC7083, November
              2013, <https://www.rfc-editor.org/info/rfc7083>.

   [RFC7227]  Hankins, D., Mrugalski, T., Siodelski, M., Jiang, S., and
              S. Krishnan, "Guidelines the enterprise-number field.";
             mandatory true;
             type uint32;
           }
         }
         case vendor-class-option-data-id {
           description "Client class selection based on the value
             of a data field within a vendor-class-data entry
             for Creating New DHCPv6 Options",
              BCP 187, RFC 7227, DOI 10.17487/RFC7227, May 2014,
              <https://www.rfc-editor.org/info/rfc7227>.

   [RFC7291]  Boucadair, M., Penno, R., and D. Wing, "DHCP Options a matching enterprise-number field
             in OPTION_VENDOR_CLASS(16).";
           container vendor-class-option-data {
             leaf vendor-class-option-enterprise-number {
               description "Value of the enterprise-number field
                 for matching the Port Control Protocol (PCP)", RFC 7291,
              DOI 10.17487/RFC7291, July 2014,
              <https://www.rfc-editor.org/info/rfc7291>.

   [RFC7598]  Mrugalski, T., Troan, O., Farrer, I., Perreault, S., Dec,
              W., Bao, C., Yeh, L., and X. Deng, "DHCPv6 Options data contents.";
               mandatory true;
               type uint32;
             }
             leaf vendor-class-data {
               description "Vendor class data to match.";
               mandatory true;
               type string;
             }
           }
         }
         case remote-id {
           description "Client class selection based on the value
             of Remote-ID .";
           container remote-id {
             leaf vendor-class-option-enterprise-number {
               description "Value of the enterprise-number field
                 for
              Configuration matching the data contents.";
               mandatory true;
               type uint32;
             }
             leaf remote-id {
               description "Remote-ID data to match.";
               mandatory true;
               type string;
             }
           }
         }
         case client-duid-id {
           description "Client class selection based on the value
             of Softwire Address and Port-Mapped
              Clients", RFC 7598, DOI 10.17487/RFC7598, July 2015,
              <https://www.rfc-editor.org/info/rfc7598>. the received client DUID.";
           uses dhcpv6-common:duid;
         }
       }
     }

     /* Augmentations of dhcpv6 server */

     augment "/dhcpv6-server:config/dhcpv6-server:class-selector" {
       container client-classes {
         list class {
           description "List of the client class identifiers applicable
             to clients served by this address pool";
           key client-class-name;
           uses dhcpv6-class-selector:client-class-id;
         }
       }
     }

     augment "/dhcpv6-server:config/dhcpv6-server:network-ranges/dhcpv6-
   server:network-range" {
       leaf-list client-class {
         type leafref {
           path "/dhcpv6-server:config/dhcpv6-server:class-selector/clie
   nt-classes/class/client-class-name";
         }
       }
     }
     augment "/dhcpv6-server:config/dhcpv6-server:network-ranges/dhcpv6-
   server:network-range/dhcpv6-server:address-pools/dhcpv6-server:addres
   s-pool" {
       leaf-list client-class {
         type leafref {
           path "/dhcpv6-server:config/dhcpv6-server:class-selector/clie
   nt-classes/class/client-class-name";
         }
       }
     }
     augment "/dhcpv6-server:config/dhcpv6-server:network-ranges/dhcpv6-
   server:network-range/dhcpv6-server:pd-pools/dhcpv6-server:pd-pool" {
       leaf-list client-class {
         type leafref {
           path "/dhcpv6-server:config/dhcpv6-server:class-selector/clie
   nt-classes/class/client-class-name";
         }
       }
     }

   }

Authors' Addresses

   Yong Cui
   Tsinghua University
   Beijing  100084
   P.R.China

   Phone: +86-10-6260-3059
   Email: cuiyong@tsinghua.edu.cn

   Linhui Sun
   Tsinghua University
   Beijing  100084
   P.R.China

   Phone: +86-10-6278-5822
   Email: lh.sunlinh@gmail.com

   Ian Farrer
   Deutsche Telekom AG
   CTO-ATI, Landgrabenweg 151
   Bonn, NRW
   53227 Bonn
   Germany

   Email: ian.farrer@telekom.de

   Sladjana Zechlin
   Deutsche Telekom AG
   CTO-IPT, Landgrabenweg 151
   Bonn, NRW
   53227 Bonn
   Germany

   Email: sladjana.zechlin@telekom.de

   Zihao He
   Tsinghua University
   Beijing  100084
   P.R.China

   Phone: +86-10-6278-5822
   Email: hezihao9512@gmail.com

   Michal Nowikowski
   Internet Systems Consortium
   Gdansk
   Poland

   Email: godfryd@isc.org