<?xml version="1.0" encoding="US-ASCII"?>
<!-- This template is for creating an Internet Draft using xml2rfc,
     which is available here: http://xml.resource.org. -->
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs), 
     please see http://xml.resource.org/authoring/README.html. -->
<?rfc strict="yes" ?>
<!-- give errors regarding ID-nits and DTD validation -->
<!-- control the table of contents (ToC) -->
<?rfc toc="yes"?>
<!-- generate a ToC -->
<?rfc tocdepth="3"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<!-- control references -->
<?rfc symrefs="yes"?>
<!-- use symbolic references tags, i.e, [RFC2119] instead of [1] -->
<?rfc sortrefs="yes" ?>
<!-- sort the reference entries alphabetically -->
<!-- control vertical white space 
     (using these PIs as follows is recommended by the RFC Editor) -->
<?rfc compact="yes" ?>
<!-- do not start each main section on a new page -->
<?rfc subcompact="no" ?>
<!-- keep one blank line between list items -->
<!-- end of list of popular I-D processing instructions -->
<rfc category="std" docName="draft-shen-l2tpext-l2tpv3-yang-model-01"
     ipr="trust200902">
  <front>
    <title abbrev="draft-shen-l2tpext-l2tpv3-yang-model-01">A YANG Data Model
    for L2TPv3 Tunnel</title>

    <author fullname="Haoxing Shen" initials="H." surname="Shen">
      <organization>Huawei Technologies</organization>

      <address>
        <postal>
          <street>Huawei Nanjing R&amp;D Center</street>

          <city>101 Software Avenue, Yuhua District, Nanjing, Jiangsu,
          210012</city>

          <country>P.R. China</country>
        </postal>

        <email>shenhaoxing@huawei.com</email>
      </address>
    </author>

    <author fullname="Bing Liu" initials="B." surname="Liu, Ed.">
      <organization>Huawei Technologies</organization>

      <address>
        <postal>
          <street>Q14, Huawei Campus, No.156 Beiqing Road</street>

          <city>Hai-Dian District, Beijing, 100095</city>

          <country>P.R. China</country>
        </postal>

        <email>leo.liubing@huawei.com</email>
      </address>
    </author>

    <author fullname="David Bannister" initials="D." surname="Bannister">
      <organization>T-Systems</organization>

      <address>
        <postal>
          <street/>

          <city/>

          <country/>
        </postal>

        <email>David.Bannister@t-systems.com</email>
      </address>
    </author>

    <author fullname="Mikael Abrahamsson" initials="M." surname="Abrahamsson">
      <organization>T-Systems</organization>

      <address>
        <postal>
          <street/>

          <city>Stockholm</city>

          <country>Sweden</country>
        </postal>

        <email>mikael.abrahamsson@t-systems.se</email>
      </address>
    </author>

    <date day="15" month="December" year="2015"/>

    <area>Internet Area</area>

    <workgroup>Internet Engineering Task Force</workgroup>

    <keyword>L2TPv3, YANG</keyword>

    <abstract>
      <t>This document defines a YANG data model for managing L2TPv3
      tunnels.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>This document defines a YANG <xref target="RFC6020"/> <xref
      target="RFC6021"/> data model for L2TPv3 tunnels.</t>
    </section>

    <section title="Requirements Language and Terminology">
      <t>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 <xref
      target="RFC2119"/> when they appear in ALL CAPS. When these words are
      not in ALL CAPS (such as "should" or "Should"), they have their usual
      English meanings, and are not to be interpreted as <xref
      target="RFC2119"/> key words.</t>

      <t>Terminology:<list style="symbols">
          <t>L2TPv3: Layer Two Tunneling Protocol - Version 3 <xref
          target="RFC3931"/></t>
        </list></t>
    </section>

    <section title="L2TPv3 YANG Model Overview">
      <t>The L2TPv3 YANG model mainly includes two objects. One
      (l2tpv3CtrlInstances) is for the L2TPv3 control plane configuration. The
      other one (l2tpv3TunnelInstances) is for managing the tunnels.</t>

      <t>The overall structure of the model is dicpicted as the following.</t>

      <t><figure>
          <artwork><![CDATA[module: ietf-l2tpv3
   
   +--rw l2tpv3CtrlInstances
   |  +--rw l2tpv3CtrlInstance* [ctrlName]
   |     +-- rw ctrlName                     string   
   |     +-- rw hostName                     string
   |     +-- rw routerID                     uint16
   |     +-- rw rcvWinSize?                  uint16
   |     +-- rw helloInterval?               uint16
   |     +-- rw digestType?                  enum   
   |     +-- rw authenNonce?                 password       
   +--rw l2tpv3TunnelInstances
      +--rw l2tpv3TunnelInstance* [tunnelName]
         +-- rw tunnelName                string
         +-- rw sourceIfName              if:interface-ref
         +-- rw sourceIP                  inet:ip-address
         +-- rw destIP                    inet:ip-address
         +-- rw tunnelType                           enum 
         |     +-- rw static:   
         |     |   +-- rw localSessionId?            uint32
         |     |   +-- rw remoteSessionId?           uint32
         |     |   +-- rw localCookieAutoMode?       enum
         |     |   |   +-- rw authNone:
         |     |   |   +-- rw authPlain:
         |     |   |   +-- rw localCookieLength   enum
         |     |   |   +-- rw localHighCookie     hexBinary
         |     |   |   +-- rw localLowCookie      hexBinary
         |     |   |   +-- rw authCipher:
         |     |   |       +--rw localCookieCipher   password
         |     |   +-- rw remoteCookieAutoMode?      enum
         |     |       +-- rw authNone:
         |     |       +-- rw authPlain:
         |     |       +--rw remoteCookieLength enum
         |     |       +--rw remoteHighCookie   hexBinary
         |     |       +--rw remoteLowCookie    hexBinary
         |     |       +-- rw authCipher:
         |     |           +--rw remoteCookieCipher password
         |     +-- rw auto:   
         |           +-- rw ctrlName            string
         |           +-- rw encapType           enum
         +-- ro sendPacket                 uint64
         +-- ro sendByte                   uint64
         +-- ro rcvPacket                  uint64
         +-- ro receiveByte                uint64
         +-- ro recvDropPacket             uint64
         +-- ro cookieMisDropPacket        uint64
         +-- ro state                      enum]]></artwork>
        </figure></t>

      <t/>

      <section title="l2tpv3CtrlInstance">
        <t>The l2tpv3CtrlInstance container is a template used for configuring
        the control plane of L2TPv3 tunnels. The leaves under the container
        are the parameters of the control signaling datagram processing.</t>

        <t>One l2tpv3CtrlInstance could be binding to a specific
        l2tpv3TunnelInstances through the key "ctrlName" defined in auto mode
        of the tunnel. One l2tpv3CtrlInstance could also be shared among
        multiple l2tpv3TunnelInstances.</t>
      </section>

      <section title="l2tpv3TunnelInstances">
        <t>This container is to manage the L2TPv3 tunnels. Two tunnel modes
        are supported: one is static tunnel, the other is automatic
        tunnel.</t>

        <t>The basic information of a tunnle contains following elements:<list
            style="symbols">
            <t>tunnelName: the identifier of the tunnel</t>

            <t>sourceIfName: the identifier of the loopback interface which is
            corresponding with the Persudo-Wire interface of the tunnel</t>

            <t>sourceIP: the IPv4/IPv6 address of the tunnel starting
            point</t>

            <t>destIP: the IPv4/IPv6 address of the tunnel ending point</t>
          </list></t>

        <t>The tunnelType node is to distinguish statically configured tunnels
        and dynamically configured tunnels. For static tunnels, the relevant
        session and cookie information is included. For dynamic tunnels, only
        the corresponding control instance is referenced as a key there.</t>

        <t>At the end, some stastic elements were defined to represent the
        running state of the tunnels.</t>
      </section>
    </section>

    <section title="L2TPv3 YANG Module">
      <t>&lt;CODE BEGINS&gt;<figure>
          <artwork><![CDATA[<CODE BEGINS> file "ietf-l2tpv3@2015-12-15.yang"
module ietf-l2tpv3 {
        namespace "urn:ietf:params:xml:ns:yang:ietf-l2tpv3";
        prefix "l2tpv3";

    import ietf-interfaces {
        prefix if;
    }
/*
    import ietf-yang-types {
        prefix yang;
    }
*/
    import ietf-inet-types {
        prefix inet;
    }
        organization "ietf l2tpv3 working group";
        contact "shenhaoxing@huawei.com
                 leo.liubing@huawei.com";
        description "The module for implementing l2tpv3 protocol";
        revision 2015-12-15 {description "version-01, minor grammar revision to pass pyang compiler";}

        typedef hexBinary {
                type string {
                        length "1..127";
                        pattern "0[xX][0-9a-fA-F]+";
                }
        }

        typedef password {
                type string {
                        length "1..127";
                }
        }        
        
        container l2tpv3CtrlInstances {

                list l2tpv3CtrlInstance {

                        key "ctrlName";
                        min-elements "0";
                         
 
                         leaf ctrlName {
                                config "true";
                                type "string"{
                                        length "1..19";
                                }
                        }
                        leaf hostName {
                                config "true";
                                type "string";
                                mandatory "true";
                        }
                        leaf routerID {
                                config "true";
                                type "uint16";
                                mandatory "true";
                        }
                        leaf rcvWinSize {
                                config "true";
                                type "uint16";
                        }
                        leaf helloInterval {
                                config "true";
                                type "uint16";
                        }
                        leaf digestType{
                                config "true";
                                                type enumeration {
                                                        enum "HMAC_MD5";
                                                        enum "HMAC_SHA_1";
                                                }
                        }        
                        leaf authenNonce{
                                config "true";
                                type password {
                                        length "1..16";
                                }
                        }                                
                }

        }        
        container l2tpv3TunnelInstance {

                list l2tpv3TunnelInstance {

                        key "tunnelName";
                        min-elements "0";
                         
 
                         leaf tunnelName {
                                config "true";
                                type "string"{
                                        length "1..19";
                                }
                        }
                        leaf sourceIfName {
                                config "true";
                type if:interface-ref;
                description
                "Interface name as defined by ietf-interfaces";

                        }
                        leaf sourceIP {
                                config "true";
                                mandatory "true";
                                type inet:ip-address;
                        }
                        leaf destIP {
                                config "true";
                                mandatory "true";
                                type inet:ip-address;
                        }
                        leaf tnlType {
                                        config "true";
                                        mandatory "true";
                                        type enumeration {
                                                enum "static";
                                                enum "auto";
                                        }
                        }
                    choice tunnelType {
                                mandatory "true";
                                
                        case static{
                                    when "tnlType = 'static'";
                                        leaf localSessionId {
                                                config "true";
                                                default "4294967295";
                                                type uint32 {
                                                        range "1..4294967295";
                                                }
                                        }
                                        leaf remoteSessionId {
                                                config "true";
                                                default "4294967295";
                                                type uint32 {
                                                        range "1..4294967295";
                                                }
                                        }                                
                                        leaf localCookieAutoMode {
                                                config "true";
                                                mandatory "true";
                                                type enumeration {
                                                        enum "authNone";
                                                        enum "authPlain";
                                                        enum "authCipher";
                                                }
                                        }
                        
                                        choice localCookieMode {
                                    default authNone;
                                    config true;
                                                case authNone {
                                                when "localCookieAutoMode = 'authNone'";

                                                }
                                                case authPlain {
                                                when "localCookieAutoMode = 'authPlain'";
                                                        leaf localCookieLength {
                                                                config "true";
                                                                default "4";
                                                                type enumeration {
                                                                        enum "4";
                                                                        enum "8";
                                                                }
                                                        }
                                                        leaf localHighCookie {
                                                                config "true";
                                                                type "hexBinary"{
                                                                    length "3..6";
                                                                }
                                                        }
                                                        leaf localLowCookie {
                                                                config "true";
                                                                type "hexBinary"{
                                                                    length "3..6";
                                                                }
                                                        }                        
                                                }
                                                case authCipher {
                                                when "localCookieAutoMode = 'authCipher'";
                                                        leaf localCookieCipher {
                                                                config "true";
                                                                type password {
                                                                        length "1..8";
                                                                }
                                                        }   
                                                }
                                        }
                                        leaf remoteCookieAutoMode {
                                                config "true";
                                                mandatory "true";
                                                type enumeration {
                                                        enum "authNone";
                                                        enum "authPlain";
                                                        enum "authCipher";
                                                }
                                        }        
                                        choice remoteCookieMode {
                                                default authNone;
                                                config true;
                                                case authNone {
                        when "remoteCookieAutoMode = 'authNone'";
                                                }
                                                case authPlain {
                                                when "remoteCookieAutoMode = 'authPlain'";
                                                        leaf remoteCookieLength {
                                                                config "true";
                                                                default "4";
                                                                type enumeration {
                                                                        enum "4";
                                                                        enum "8";
                                                                }
                                                        }
                                                        leaf remoteHighCookie {
                                                                config "true";
                                                                type "hexBinary"{
                                                                    length "3..6";
                                                                }
                                                        }
                                                        leaf remoteLowCookie {
                                                                config "true";
                                                                type "hexBinary"{
                                                                    length "3..6";
                                                                }
                                                        }                        
                                                }
                                                case authCipher {
                                                when "remoteCookieAutoMode = 'authCipher'";
                                                        leaf remoteCookieCipher {
                                                                config "true";
                                                                type password {
                                                                        length "1..8";
                                                                }
                                                        }   
                                                }
                                        }                                        
                }
                        case auto{
                    when "tnlType = 'auto'";
                                        leaf ctrlName {
                                                config "true";
                                                type string{
                                                        length "1..19";
                                                }
                                                mandatory "true";
                                        }
                                        leaf encapType {
                                                config "true";
                                                mandatory "true";
                                                type enumeration
                                                {
                                                        enum "HDLC";
                                                        enum "Ethernet";
                                                        enum "VLAN";
                                                        enum "ATM";
                                                }
                                        }
                        
                
                            }   
                    }                                  
                        

                        leaf sendPacket {
                                config "false";
                                type "uint64";
                        }
                        leaf sendByte {
                                config "false";
                                type "uint64";
                        }
                        leaf rcvPacket {
                                config "false";
                                type "uint64";
                        }
                        leaf receiveByte {
                                config "false";
                                type "uint64";
                        }
                        leaf recvDropPacket {
                                config "false";
                                type "uint64";
                        }
                        leaf cookieMisDropPacket {
                                config "false";
                                type "uint64";
                        }
                        leaf state {
                                config "false";
                                type enumeration {
                                        enum "down" {
                                                value "0";
                                                description "down:";
                                        }
                                        enum "up" {
                                                value "1";
                                                description "up:";
                                        }
                                }
                        }
                }
        }
}

<CODE ENDS>
]]></artwork>
        </figure></t>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>TBD.</t>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <t>This draft does not request any IANA action.</t>
    </section>

    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>Gang Yan made significant contribution to design the YANG model.
      Valuable comment was received from Xianping Zhang to improve the
      draft.</t>

      <t>This document was produced using the xml2rfc tool <xref
      target="RFC2629"/>.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include='reference.RFC.2119'?>

      <?rfc include='reference.RFC.2629'?>

      <?rfc include='reference.RFC.3931'?>

      <?rfc include='reference.RFC.6020'?>

      <?rfc include='reference.RFC.6021'?>
    </references>
  </back>
</rfc>
