<?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. -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!-- One method to get references from the online citation libraries.
     There has to be one entity for each item to be referenced. 
     An alternate method (rfc include) is described in the references. -->
<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC8174 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml">
<!--<!ENTITY RFC2629 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2629.xml">-->
<!--<!ENTITY RFC3552 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3552.xml">-->
<!ENTITY RFC6241 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6241.xml">
<!ENTITY RFC6242 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6242.xml">
<!ENTITY RFC6536 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6536.xml">
<!ENTITY RFC6020 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6020.xml">
<!ENTITY RFC7950 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7950.xml">
<!ENTITY RFC7224 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7224.xml">
<!ENTITY RFC8343 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8343.xml">
<!ENTITY RFC8340 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8340.xml">
]>
<?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. -->
<!-- Below are generally applicable Processing Instructions (PIs) that most I-Ds might want to use.
     (Here they are set differently than their defaults in xml2rfc v1.32) -->
<?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="4"?>
<!-- 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-ietf-netmod-sub-intf-vlan-model-05" ipr="trust200902">
    <!-- category values: std, bcp, info, exp, and historic
     ipr values: full3667, noModification3667, noDerivatives3667
     you can add the attributes updates="NNNN" and obsoletes="NNNN" 
     they will automatically be output with "(if approved)" -->
    <!-- ***** FRONT MATTER ***** -->
    <front>
        <!-- The abbreviated title is used in the page header - it is only necessary if the 
         full title is longer than 39 characters -->
        <title abbrev="Sub-interface VLAN YANG">Sub-interface VLAN YANG Data Models</title>
        <!-- add 'role="editor"' below for the editors if appropriate -->
        <!-- Another author who claims to be an editor -->
      <author fullname="Robert Wilton" initials="R.G." role="editor" surname="Wilton">
        <organization>Cisco Systems</organization>
        <address>
          <email>rwilton@cisco.com</email>
        </address>
      </author>
      <author fullname="David Ball" initials="D" surname="Ball">
        <organization>Cisco Systems</organization>
        <address>
          <email>daviball@cisco.com</email>
        </address>
      </author>
      <author fullname="Tapraj Singh" initials="T" surname="Singh">
       <organization>Cisco Systems</organization>
       <address>
         <email>tapsingh@cisco.com</email>
       </address>
      </author>
      <author fullname="Selvakumar Sivaraj" initials="S" surname="Sivaraj">
        <organization>Juniper Networks</organization>
        <address>
          <email>ssivaraj@juniper.net</email>
        </address>
      </author>
        <!-- uri and facsimile elements may also be added -->
      <date month="March" year="2019"/>
        <!-- If the month and year are both specified and are the current ones, xml2rfc will fill 
         in the current day for you. If only the current year is specified, xml2rfc will fill 
	 in the current day and month for you. If the year is not the current one, it is 
	 necessary to specify at least a month (xml2rfc assumes day="1" if not specified for the 
	 purpose of calculating the expiry date).  With drafts it is normally sufficient to 
	 specify just the year. -->
        <!-- Meta-data Declarations -->
      <area>General</area>
      <workgroup>Internet Engineering Task Force</workgroup>
        <!-- WG name at the upperleft corner of the doc,
         IETF is fine for individual submissions.  
	 If this element is not present, the default is "Network Working Group",
         which is used by the RFC Editor as a nod to the history of the IETF. -->
      <keyword>template</keyword>
        <!-- Keywords will be incorporated into HTML output
         files in a meta tag but they have no effect on text or nroff
         output. If you submit your draft to the RFC Editor, the
         keywords will be used for the search engine. -->
      <abstract>
        <t>This document defines YANG modules to add support for classifying
        traffic received on interfaces as Ethernet/VLAN framed packets to
        sub-interfaces based on the fields available in the Ethernet/VLAN frame
        headers. These modules allow configuration of Layer 3 and Layer 2
        sub-interfaces (e.g. attachment circuits) that can interoperate with
        IETF based forwarding protocols; such as IP and L3VPN services; or L2VPN
        services like VPWS, VPLS, and EVPN.  The sub-interfaces also
        interoperate with VLAN tagged traffic orginating from an IEEE 802.1Q
        compliant bridge.</t>
        <t>The model differs from an IEEE 802.1Q bridge model in that the
        configuration is interface/sub-interface based as opposed to being based
        on membership of an 802.1Q VLAN bridge.</t>
	<t>The YANG data models in this document conforms to the Network
	Management Datastore Architecture (NMDA) defined in RFC 8342.</t>
        </abstract>
    </front>
    <middle>
      <section title="Introduction">
        <t>This document defines two YANG <xref target="RFC7950"/> modules that
        augment the encapsulation choice YANG element defined in <xref
        target="I-D.ietf-netmod-intf-ext-yang">Interface Extensions YANG</xref>
        and the generic interfaces data model defined in <xref
        target="RFC8343"/>.  The two modules provide configuration nodes to
        support classification of Ethernet/VLAN traffic to sub-interfaces, that
        can have interface based feature and service configuration applied to
        them.</t>
        <t>The purpose of these models is to allow IETF defined forwarding
        protocols, such as IPv6 <xref target="RFC2460"/>, Ethernet Pseudo Wires
        <xref target="RFC4448"/> and VPLS <xref target="RFC4761"/> <xref
        target="RFC4762"/> to be configurable via YANG when interoperating with
        VLAN tagged traffic received from an IEEE 802.1Q compliant bridge.</t>
        <t>In the case of layer 2 Ethernet services, the flexible encapsulation
        module also supports flexible rewriting of the VLAN tags contained the
        in frame header.</t>
        <t>For reference, a comparison between the sub-interface based YANG
        model documented in this draft and an IEEE 802.1Q bridge model is
        described in <xref target="comparison"/>.</t>
        <t>In summary, the YANG modules defined in this internet draft are:
          <list>
            <t>if-l3-vlan.yang - Defines the model for basic classification of
            VLAN tagged traffic to L3 transport services</t>
            <t>flexible-encapsulation.yang - Defines the model for flexible
            classification of Ethernet/VLAN traffic to L2 transport services</t>
          </list>
        </t>
            <!--      <section title="Requirements Language">

      </section>-->
        <section title="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 BCP
          14 <xref target="RFC2119">RFC 2119</xref> <xref target="RFC8174">RFC
          8174</xref> when, and only when, they appear in all capitals, as shown
          here.</t>
          <t>Sub-interface: A sub-interface is a small augmentation of a regular
          interface in the standard YANG module for Interface Management that
          represents a subset of the traffic handled by its parent interface. As
          such, it supports both configuration and operational data using any
          other YANG models that augment or reference interfaces in the normal
          way.  It is defined in <xref
          target="I-D.ietf-netmod-intf-ext-yang">Interface Extensions
          YANG</xref>.</t>
        </section>
        <section title="Tree Diagrams">
	   <t>Tree diagrams used in this document follow the notation defined in
	   <xref target="RFC8340"/>.</t>
        </section>
      </section>
      <section title="Objectives">
       <t>The primary aim of the YANG modules contained in this draft is to
       provide the core model that is required to implement VLAN transport
       services on router based devices that is fully compatible with IEEE
       802.1Q compliant bridges.</t>
       <t>A secondary aim is for the modules to be structured in such a way that
       they can be cleanly extended in future.</t>
       <section title="Interoperability with IEEE 802.1Q compliant bridges">
         <t>The modules defined in this document are designed to fully
         interoperate with IEEE 802.1Q compliant bridges.  In particular, the
         models are restricted to only matching, adding, or rewriting the 802.1Q
         VLAN tags in frames in ways that are compatible with IEEE 802.1Q
         compliant bridges.</t>
       </section>
     </section>
     <section title="L3 Interface VLAN Model">
       <t>The L3 Interface VLAN model provides appropriate leaves for
       termination of an 802.1Q VLAN tagged segment to a sub-interface based L3
       service.  It allows for termination of traffic with up to two 802.1Q VLAN
       tags.</t>
       <figure>
         <preamble>The "if-l3-vlan" YANG module has the following structure:</preamble>
         <artwork>
                    <![CDATA[
module: ietf-if-l3-vlan
  augment /if:interfaces/if:interface/if-cmn:encapsulation/
                                                 if-cmn:encaps-type:
    +--:(dot1q-vlan)
       +--rw dot1q-vlan
          +--rw outer-tag
          |  +--rw tag-type    dot1q-tag-type
          |  +--rw vlan-id     vlanid
          +--rw second-tag!
             +--rw tag-type    dot1q-tag-type
             +--rw vlan-id     vlanid
            ]]>
          </artwork>
        </figure>
      </section>
      <section title="Flexible Encapsulation Model">
        <t>The Flexible Encapsulation model is designed to allow for the
        flexible provisioning of layer 2 services. It provides the capability to
        classify Ethernet/VLAN frames received on an Ethernet trunk interface to
        sub-interfaces based on the fields available in the layer 2
        headers. Once classified to sub-interfaces, it provides the capability
        to selectively modify fields within the layer 2 headers before the frame
        is handed off to the appropriate forwarding code for further
        handling.</t>
        <t>The model supports a common core set of layer 2 header matches based
        on the 802.1Q tag type and VLAN Ids contained within the header up to a
        tag stack depth of two tags.</t>
        <t>The model supports flexible rewrites of the layer 2 frame header for
        data frames as they are processed on the interface. It defines a set of
        standard tag manipulations that allow for the insertion, removal, or
        rewrite of one or two 802.1Q VLAN tags. The expectation is that
        manipulations are generally implemented in a symmetrical fashion,
        i.e. if a manipulation is performed on ingress traffic on an interface
        then the reverse manipulation is always performed on egress traffic out
        of the same interface. However, the model also allows for asymmetrical
        rewrites, which may be required to implement some forwarding models
        (such as E-Tree).</t>
        <t>The final aim for the model design is for it to be cleanly extensible
        to add in additional match and rewrite criteria of the layer 2 header,
        such as matching on the source or destination MAC address, PCP or DEI
        fields in the 802.1Q tags, or the EtherType of the frame payload.
        Rewrites can also be extended to allow for modification of other fields
        within the layer 2 frame header.</t>
        <figure>
         <preamble>The "flexible-encapsulation" YANG module has the following
         structure:</preamble>
         <artwork>
                    <![CDATA[
module: ietf-flexible-encapsulation
  augment /if:interfaces/if:interface/if-cmn:encapsulation/
                                                  if-cmn:encaps-type:
    +--:(flexible)
       +--rw flexible
          +--rw match
          |  +--rw (match-type)
          |     +--:(default)
          |     |  +--rw default?                 empty
          |     +--:(untagged)
          |     |  +--rw untagged?                empty
          |     +--:(dot1q-priority-tagged)
          |     |  +--rw dot1q-priority-tagged
          |     |     +--rw tag-type    dot1q-types:dot1q-tag-type
          |     +--:(dot1q-vlan-tagged)
          |        +--rw dot1q-vlan-tagged
          |           +--rw outer-tag
          |           |  +--rw tag-type    dot1q-tag-type
          |           |  +--rw vlan-id     union
          |           +--rw second-tag!
          |           |  +--rw tag-type    dot1q-tag-type
          |           |  +--rw vlan-id     union
          |           +--rw match-exact-tags?   empty
          +--rw rewrite {flexible-rewrites}?
          |  +--rw (direction)?
          |     +--:(symmetrical)
          |     |  +--rw symmetrical
          |     |     +--rw dot1q-tag-rewrite {dot1q-tag-rewrites}?
          |     |        +--rw pop-tags?    uint8
          |     |        +--rw push-tags!
          |     |           +--rw outer-tag
          |     |           |  +--rw tag-type    dot1q-tag-type
          |     |           |  +--rw vlan-id     vlanid
          |     |           +--rw second-tag!
          |     |              +--rw tag-type    dot1q-tag-type
          |     |              +--rw vlan-id     vlanid
          |     +--:(asymmetrical) {asymmetric-rewrites}?
          |        +--rw ingress
          |        |  +--rw dot1q-tag-rewrite {dot1q-tag-rewrites}?
          |        |     +--rw pop-tags?    uint8
          |        |     +--rw push-tags!
          |        |        +--rw outer-tag
          |        |        |  +--rw tag-type    dot1q-tag-type
          |        |        |  +--rw vlan-id     vlanid
          |        |        +--rw second-tag!
          |        |           +--rw tag-type    dot1q-tag-type
          |        |           +--rw vlan-id     vlanid
          |        +--rw egress
          |           +--rw dot1q-tag-rewrite {dot1q-tag-rewrites}?
          |              +--rw pop-tags?    uint8
          |              +--rw push-tags!
          |                 +--rw outer-tag
          |                 |  +--rw tag-type    dot1q-tag-type
          |                 |  +--rw vlan-id     vlanid
          |                 +--rw second-tag!
          |                    +--rw tag-type    dot1q-tag-type
          |                    +--rw vlan-id     vlanid
          +--rw local-traffic-default-encaps!
             +--rw outer-tag
             |  +--rw tag-type    dot1q-tag-type
             |  +--rw vlan-id     vlanid
             +--rw second-tag!
                +--rw tag-type    dot1q-tag-type
                +--rw vlan-id     vlanid
            ]]>
          </artwork>
        </figure>
      </section>
      <section title="L3 Interface VLAN YANG Module">
       <t>This YANG module augments the encapsultion container defined in <xref
       target="I-D.ietf-netmod-intf-ext-yang">Interface Extensions YANG</xref>.</t>
       <figure>
         <artwork>
                    <![CDATA[
<CODE BEGINS> file "ietf-if-l3-vlan@2019-03-05.yang"
module ietf-if-l3-vlan {
  yang-version 1.1;

  namespace "urn:ietf:params:xml:ns:yang:ietf-if-l3-vlan";

  prefix if-l3-vlan;

  import ietf-interfaces {
    prefix if;
  }

  import iana-if-type {
    prefix ianaift;
  }

  import ieee802-dot1q-types {
    prefix dot1q-types;
  }

  import ietf-interfaces-common {
    prefix if-cmn;
  }

  organization
    "IETF NETMOD (NETCONF Data Modeling Language) Working Group";

  contact
    "WG Web:   <http://tools.ietf.org/wg/netmod/>
     WG List:  <mailto:netmod@ietf.org>

     WG Chair: Lou Berger
               <mailto:lberger@labn.net>

     WG Chair: Joel Jaeggli
               <mailto:joelja@gmail.com>

     WG Chair: Kent Watsen
               <mailto:kwatsen@juniper.net>

     Editor:   Robert Wilton
               <mailto:rwilton@cisco.com>";

  description
    "This YANG module models L3 VLAN sub-interfaces";

  revision 2019-03-05 {
    description "Latest draft revision";

    reference
      "Internet-Draft draft-ietf-netmod-sub-intf-vlan-model-05";
  }

  /*
   * Add support for the 802.1Q VLAN encapsulation syntax on layer 3
   * terminated VLAN sub-interfaces.
   */
  augment "/if:interfaces/if:interface/if-cmn:encapsulation/" +
          "if-cmn:encaps-type" {
    when
        "derived-from-or-self(../if:type,
                              'ianaift:ethernetCsmacd') or
         derived-from-or-self(../if:type,
                              'ianaift:ieee8023adLag') or
         derived-from-or-self(../if:type,
                              'if-cmn:ethSubInterface')" {
      description
        "Applies only to Ethernet-like interfaces and
         sub-interfaces";
    }

    description
      "Augment the generic interface encapsulation with an
       basic 802.1Q VLAN encapsulation for sub-interfaces.";

    /*
     * Matches a single VLAN Id, or a pair of VLAN Ids to classify
     * traffic into an L3 service.
     */
    case dot1q-vlan {
      container dot1q-vlan {
        must
          'count(../../if-cmn:forwarding-mode) = 0 or ' +
          'derived-from-or-self(../../if-cmn:forwarding-mode,' +
                                '"if-cmn:layer-3-forwarding")' {
            error-message
              "If the interface forwarding-mode leaf is set then it
               must be set to an identity that derives from
               layer-3-forwarding";

            description
              "The forwarding-mode leaf on an interface can
               optionally be used to enforce consistency of
               configuration";
          }


        description
          "Match VLAN tagged frames with specific VLAN Ids";
        container outer-tag {
          must
            'tag-type = "dot1q-types:s-vlan" or ' +
            'tag-type = "dot1q-types:c-vlan"' {

            error-message
                "Only C-VLAN and S-VLAN tags can be matched";

            description
            "For IEEE 802.1Q interoperability, only C-VLAN and
                 S-VLAN tags can be matched";
          }

          description
            "Classifies traffic using the outermost VLAN tag on the
             frame.";

          uses dot1q-types:dot1q-tag-classifier-grouping;
        }

        container second-tag {
          must
            '../outer-tag/tag-type = "dot1q-types:s-vlan" and ' +
            'tag-type = "dot1q-types:c-vlan"' {

            error-message
              "When matching two tags, the outermost tag must be
               specified and of S-VLAN type and the second outermost
               tag must be of C-VLAN tag type";

            description
              "For IEEE 802.1Q interoperability, when matching two
               tags, it is required that the outermost tag exists and
               is an S-VLAN, and the second outermost tag is a
               C-VLAN";
          }

          presence "Also classify on the second outermost VLAN tag";

          description
            "Classifies traffic using the second outermost VLAN tag
             on the frame.";

          uses dot1q-types:dot1q-tag-classifier-grouping;
        }
      }
    }
  }
}
<CODE ENDS>
            ]]>
          </artwork>
        </figure>
      </section>
      <section title="Flexible Encapsulation YANG Module">
        <t>This YANG module augments the encapsultion container defined in <xref
        target="I-D.ietf-netmod-intf-ext-yang">Interface Extensions
        YANG</xref>. </t>
	<t> This YANG module also augments the interface container defined in
	<xref target="RFC8343"/>.</t>
        <figure>
          <artwork>
                    <![CDATA[
<CODE BEGINS> file "ietf-flexible-encapsulation@2019-03-05.yang"
module ietf-flexible-encapsulation {
  yang-version 1.1;
  namespace
    "urn:ietf:params:xml:ns:yang:ietf-flexible-encapsulation";

  prefix flex;

  import ietf-interfaces {
    prefix if;
  }

  import iana-if-type {
    prefix ianaift;
  }

  import ietf-interfaces-common {
    prefix if-cmn;
  }

  import ieee802-dot1q-types {
    prefix dot1q-types;
  }

  organization
    "IETF NETMOD (NETCONF Data Modeling Language) Working Group";

  contact
    "WG Web:   <http://tools.ietf.org/wg/netmod/>
     WG List:  <mailto:netmod@ietf.org>

     WG Chair: Lou Berger
               <mailto:lberger@labn.net>

     WG Chair: Joel Jaeggli
               <mailto:joelja@gmail.com>

     WG Chair: Kent Watsen
               <mailto:kwatsen@juniper.net>

     Editor:   Robert Wilton
               <mailto:rwilton@cisco.com>";

  description
    "This YANG module describes interface configuration for flexible
     VLAN matches and rewrites.";

  revision 2019-03-05 {
    description "Latest draft revision";

    reference
      "Internet-Draft draft-ietf-netmod-sub-intf-vlan-model-05";
  }

  feature flexible-rewrites {
    description
      "This feature indicates whether the network element supports
        specifying flexible rewrite operations";
  }

  feature asymmetric-rewrites {
    description
      "This feature indicates whether the network element supports
       specifying different rewrite operations for the ingress
       rewrite operation and egress rewrite operation.";
  }

  feature dot1q-tag-rewrites {
    description
      "This feature indicates whether the network element supports
       the flexible rewrite functionality specifying flexible 802.1Q
       tag rewrites";
  }

  /*
   * flexible-match grouping.
   *
   * This grouping represents a flexible match.
   *
   * The rules for a flexible match are:
   *     1. default, untagged, priority tag, or a stack of tags.
   *   - Each tag in the stack of tags matches:
   *      1. tag type (802.1Q or 802.1ad) +
   *      2. tag value:
   *        i. single tag
   *        ii. set of tag ranges/values.
   *        iii. "any" keyword
   */
  grouping flexible-match {
    description "Flexible match";
    choice match-type {
      mandatory true;
      description "Provides a choice of how the frames may be
                   matched";

      case default {
        description "Default match";
        leaf default {
          type empty;
          description
            "Default match.  Matches all traffic not matched to any
             other peer sub-interface by a more specific
             encapsulation.";
        } // leaf default
      } // case default

      case untagged {
        description "Match untagged Ethernet frames only";
        leaf untagged {
          type empty;
          description
            "Untagged match.  Matches all untagged traffic.";
        } // leaf untagged
      } // case untagged

      case dot1q-priority-tagged {
        description
          "Match 802.1Q priority tagged Ethernet frames only";

        container dot1q-priority-tagged {
          description "802.1Q priority tag match";
          leaf tag-type {
            type dot1q-types:dot1q-tag-type;
            mandatory true;
            description "The 802.1Q tag type of matched priority
                         tagged packets";
          }
        }
      }

      case dot1q-vlan-tagged {
        container dot1q-vlan-tagged {
          description "Matches VLAN tagged frames";          
          
          container outer-tag {
            must
              'tag-type = "dot1q-types:s-vlan" or ' +
              'tag-type = "dot1q-types:c-vlan"' {

              error-message
                "Only C-VLAN and S-VLAN tags can be matched";

              description
                "For IEEE 802.1Q interoperability, only C-VLAN and
                 S-VLAN tags can be matched";
            }

            description
              "Classifies traffic using the outermost VLAN tag on the
               frame.";

            uses
              'dot1q-types:'+
              'dot1q-tag-ranges-or-any-classifier-grouping';
          }

          container second-tag {
            must
              '../outer-tag/tag-type = "dot1q-types:s-vlan" and ' +
              'tag-type = "dot1q-types:c-vlan"' {

              error-message
                "When matching two tags, the outermost tag must be
                 specified and of S-VLAN type and the second
                 outermost tag must be of C-VLAN tag type";

              description
                "For IEEE 802.1Q interoperability, when matching two
                 tags, it is required that the outermost tag exists
                 and is an S-VLAN, and the second outermost tag is a
                 C-VLAN";
            }

            presence "Also classify on the second VLAN tag";

            description
              "Classifies traffic using the second outermost VLAN tag
               on the frame.";

            uses
              'dot1q-types:'+
              'dot1q-tag-ranges-or-any-classifier-grouping';
          }

          leaf match-exact-tags {
            type empty;
            description
              "If set, indicates that all 802.1Q VLAN tags in the
               Ethernet frame header must be explicitly matched, i.e.
               the EtherType following the matched tags must not be a
               802.1Q tag EtherType.  If unset then extra 802.1Q VLAN
               tags are allowed.";
          }
        }
      }
    } // encaps-type
  }

  /*
   * Grouping for tag-rewrite that can be expressed either
   * symmetrically, or in the ingress and/or egress directions
   * independently.
   */
  grouping dot1q-tag-rewrite {
    description "Flexible rewrite";
    leaf pop-tags {
      type uint8 {
        range 1..2;
      }
      description "The number of tags to pop (or translate if used in
                   conjunction with push-tags)";
    }

    container push-tags {
      presence
        "802.1Q tags are pushed or translated";
      description "The 802.1Q tags to push (or translate if used in
                   conjunction with pop-tags)";

      container outer-tag {
        must
          'tag-type = "dot1q-types:s-vlan" or ' +
          'tag-type = "dot1q-types:c-vlan"' {

          error-message
            "Only C-VLAN and S-VLAN tags can be pushed";

          description
            "For IEEE 802.1Q interoperability, only C-VLAN and S-VLAN
             tags can be pushed";
        }

        description
          "The outermost VLAN tag to push onto the frame.";
        uses dot1q-types:dot1q-tag-classifier-grouping;
      }

      container second-tag {
        must
          '../outer-tag/tag-type = "dot1q-types:s-vlan" and ' +
          'tag-type = "dot1q-types:c-vlan"' {

          error-message
            "When pushing/rewriting two tags, the outermost tag must
             be specified and of S-VLAN type and the second outermost
             tag must be of C-VLAN tag type";

          description
            "For IEEE 802.1Q interoperability, when pushing two tags,
             it is required that the outermost tag exists and is an
             S-VLAN, and the second outermost tag is a C-VLAN";
        }

        presence
          "In addition to the first tag, also push/rewrite a second
           VLAN tag.";

        description
          "The second outermost VLAN tag to push onto the frame.";

        uses dot1q-types:dot1q-tag-classifier-grouping;
      }
    }
  }

  /*
   * Grouping for all flexible rewrites of fields in the L2 header.
   *
   * This currently only includes flexible tag rewrites, but is
   * designed to be extensible to cover rewrites of other fields in
   * the L2 header if required.
   */
  grouping flexible-rewrite {
    description "Flexible rewrite";

    /*
     * Tag rewrite.
     *
     * All tag rewrites are formed using a combination of pop-tags
     * and push-tags operations.
     */
    container dot1q-tag-rewrite {
      if-feature dot1q-tag-rewrites;
      description "Tag rewrite.  Translate operations are expressed
                   as a combination of tag push and pop operations.";
      uses dot1q-tag-rewrite;
    }
  }
  augment "/if:interfaces/if:interface/if-cmn:encapsulation/" +
          "if-cmn:encaps-type" {
    when
        "derived-from-or-self(../if:type,
                              'ianaift:ethernetCsmacd') or
         derived-from-or-self(../if:type,
                              'ianaift:ieee8023adLag') or
         derived-from-or-self(../if:type,
                              'if-cmn:ethSubInterface')" {
      description
        "Applies only to Ethernet-like interfaces and
         sub-interfaces";
    }
    description
      "Add flexible match and rewrite for VLAN sub-interfaces";

    /*
     * A flexible encapsulation allows for the matching of ranges and
     * sets of VLAN Ids.  The structure is also designed to be
     * extended to allow for matching/rewriting other fields within
     * the L2 frame header if required.
     */
    case flexible {
      description "Flexible encapsulation and rewrite";
      container flexible {
          must
            'count(../../if-cmn:forwarding-mode) = 0 or ' +
            'derived-from-or-self(../../if-cmn:forwarding-mode,' +
                                 '"if-cmn:layer-2-forwarding")' {
            error-message
              "If the interface forwarding-mode leaf is set then it
               must be set to an identity that derives from
               layer-2-forwarding";

            description
              "The forwarding-mode leaf on an interface can
               optionally be used to enforce consistency of
               configuration";
          }

        description "Flexible encapsulation and rewrite";

        container match {
          description
            "The match used to classify frames to this interface";
          uses flexible-match;
        }

        container rewrite {
          if-feature flexible-rewrites;
          description "L2 frame rewrite operations";
          choice direction {
            description
              "Whether the rewrite policy is symmetrical or
               asymmetrical";
            case symmetrical {
              container symmetrical {
                uses flexible-rewrite;
                description
                  "Symmetrical rewrite.  Expressed in the ingress
                   direction, but the reverse operation is applied to
                   egress traffic";
              }
            }

            /*
             * Allow asymmetrical rewrites to be specified.
             */
            case asymmetrical {
              if-feature asymmetric-rewrites;
              description "Asymmetrical rewrite";
              container ingress {
                uses flexible-rewrite;
                description "Ingress rewrite";
              }
              container egress {
                uses flexible-rewrite;
                description "Egress rewrite";
              }
            }
          }
        }

        /*
         * For encapsulations that match a range of VLANs (or Any),
         * allow configuration to specify the default 802.1Q VLAN tag
         * values to use for any traffic that is locally sourced from
         * an interface on the device.
         */
        container local-traffic-default-encaps {
          presence
            "A local traffic default encapsulation has been
             specified";
          description
            "The 802.1Q VLAN tags to use by default for locally
             sourced traffic";

          container outer-tag {
            must
              'tag-type = "dot1q-types:s-vlan" or ' +
              'tag-type = "dot1q-types:c-vlan"' {

              error-message
                "Only C-VLAN and S-VLAN tags can be matched";

              description
                "For IEEE 802.1Q interoperability, only C-VLAN and
                 S-VLAN tags can be matched";
            }

            description
              "The outermost VLAN tag for locally sourced traffic";

            uses dot1q-types:dot1q-tag-classifier-grouping;
          }

          container second-tag {
            must
              '../outer-tag/tag-type = "dot1q-types:s-vlan" and ' +
               'tag-type = "dot1q-types:c-vlan"' {

            error-message
              "When specifying two tags, the outermost tag must be
               specified and of S-VLAN type and the second outermost
               tag must be of C-VLAN tag type";

            description
              "For IEEE 802.1Q interoperability, when specifying two
               tags, it is required that the outermost tag exists and
               is an S-VLAN, and the second outermost tag is a
               C-VLAN";
            }

            presence
              "Indicates existence of a second outermost VLAN tag.";

            description
              "The second outermost VLAN tag for locally sourced
               traffic";

            uses dot1q-types:dot1q-tag-classifier-grouping;
          }
        }
      }
    }
  }
}
<CODE ENDS>
            ]]>
          </artwork>
        </figure>
      </section>
      <section anchor="Examples" title="Examples">
        <t>The following sections give examples of configuring a sub-interface
        supporting L3 forwarding, and also a sub-interface being used in
        conjunction with the IETF L2VPN YANG model <xref
        target="I-D.ietf-bess-l2vpn-yang"/>.</t>
        <section title="Layer 3 sub-interfaces with IPv6">
          <t>This example illustrates a layer 3 sub-interface configured to
          match traffic with a S-VLAN tag of 10, and C-VLAN tag of 20.</t>
          <figure>
            <artwork>
                        <![CDATA[
<?xml version="1.0" encoding="utf-8"?>
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <interfaces 
  xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"
  xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type"
  xmlns:dot1q-types="urn:ieee:std:802.1Q:yang:ieee802-dot1q-types"
  xmlns:if-cmn="urn:ietf:params:xml:ns:yang:ietf-interfaces-common">
    <interface>
      <name>eth0</name>
      <type>ianaift:ethernetCsmacd</type>
    </interface>
    <interface>
      <name>eth0.1</name>
      <type>ianaift:l2vlan</type>
      <if-cmn:parent-interface>eth0</if-cmn:parent-interface>
      <if-cmn:encapsulation>
        <dot1q-vlan
         xmlns="urn:ietf:params:xml:ns:yang:ietf-if-l3-vlan">
          <outer-tag>
            <tag-type>dot1q-types:s-vlan</tag-type>
            <vlan-id>10</vlan-id>
          </outer-tag>
          <second-tag>
            <tag-type>dot1q-types:c-vlan</tag-type>
            <vlan-id>20</vlan-id>
          </second-tag>
        </dot1q-vlan>
      </if-cmn:encapsulation>
      <ipv6 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
        <forwarding>true</forwarding>
        <address>
          <ip>2001:db8::10</ip>
          <prefix-length>32</prefix-length>
        </address>
      </ipv6>
    </interface>
    <interface>
      <name>eth0.2</name>
      <type>ianaift:l2vlan</type>
      <if-cmn:parent-interface>eth0</if-cmn:parent-interface>
      <if-cmn:encapsulation>
        <dot1q-vlan
         xmlns="urn:ietf:params:xml:ns:yang:ietf-if-l3-vlan">
          <outer-tag>
            <tag-type>dot1q-types:s-vlan</tag-type>
            <vlan-id>11</vlan-id>
          </outer-tag>
        </dot1q-vlan>
      </if-cmn:encapsulation>
      <ipv6 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
        <forwarding>true</forwarding>
        <address>
          <ip>2001:db8::11</ip>
          <prefix-length>32</prefix-length>
        </address>
      </ipv6>
    </interface>
  </interfaces>
</config>
            ]]>
              </artwork>
            </figure>
          </section>
          <section title="Layer 2 sub-interfaces with L2VPN">
            <t>This example illustrates a layer 2 sub-interface 'eth0.3'
            configured to match traffic with a S-VLAN tag of 10, and C-VLAN tag
            of 21; and both tags removed before the traffic is passed off to the
            L2VPN service.</t>
            <t>It also illustrates another sub-interface 'eth1.0' under a
            separate physical interface configured to match traffic with a
            C-VLAN of 50, and the tag removed before traffic is given to any
            service.  Sub-interface 'eth1.0' is not currently bound to any
            service and hence traffic classifed to that sub-interface is
            dropped.</t>
            <figure>
              <artwork>
                        <![CDATA[
<?xml version="1.0" encoding="utf-8"?>
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <interfaces 
  xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"
  xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type"
  xmlns:dot1q-types="urn:ieee:std:802.1Q:yang:ieee802-dot1q-types"
  xmlns:if-cmn="urn:ietf:params:xml:ns:yang:ietf-interfaces-common">
    <interface>
      <name>eth0</name>
      <type>ianaift:ethernetCsmacd</type>
    </interface>
    <interface>
      <name>eth0.3</name>
      <type>ianaift:l2vlan</type>
      <if-cmn:parent-interface>eth0</if-cmn:parent-interface>
      <if-cmn:encapsulation>
        <flexible
    xmlns="urn:ietf:params:xml:ns:yang:ietf-flexible-encapsulation">
          <match>
            <dot1q-vlan-tagged>
              <outer-tag>
                <tag-type>dot1q-types:s-vlan</tag-type>
                <vlan-id>10</vlan-id>
              </outer-tag>
              <second-tag>
                <tag-type>dot1q-types:c-vlan</tag-type>
                <vlan-id>21</vlan-id>
              </second-tag>
            </dot1q-vlan-tagged>
          </match>
          <rewrite>
            <symmetrical>
              <dot1q-tag-rewrite>
                <pop-tags>2</pop-tags>
              </dot1q-tag-rewrite>
            </symmetrical>
          </rewrite>
        </flexible>
      </if-cmn:encapsulation>
    </interface>
    <interface>
      <name>eth1</name>
      <type>ianaift:ethernetCsmacd</type>
    </interface>
    <interface>
      <name>eth1.0</name>
      <type>ianaift:l2vlan</type>
      <if-cmn:parent-interface>eth0</if-cmn:parent-interface>
      <if-cmn:encapsulation>
        <flexible
    xmlns="urn:ietf:params:xml:ns:yang:ietf-flexible-encapsulation">
          <match>
            <dot1q-vlan-tagged>
              <outer-tag>
                <tag-type>dot1q-types:c-vlan</tag-type>
                <vlan-id>50</vlan-id>
              </outer-tag>
            </dot1q-vlan-tagged>
          </match>
          <rewrite>
            <symmetrical>
              <dot1q-tag-rewrite>
                <pop-tags>1</pop-tags>
              </dot1q-tag-rewrite>
            </symmetrical>
          </rewrite>
        </flexible>
      </if-cmn:encapsulation>
    </interface>
  </interfaces>
  <network-instances
      xmlns="urn:ietf:params:xml:ns:yang:ietf-network-instance">
    <network-instance
     xmlns:l2vpn="urn:ietf:params:xml:ns:yang:ietf-l2vpn">   
      <name>p2p-l2-1</name>
      <description>Point to point L2 service</description>
      <l2vpn:type>l2vpn:vpws-instance-type</l2vpn:type>
      <l2vpn:signaling-type>
        l2vpn:ldp-signaling
      </l2vpn:signaling-type>
      <endpoint xmlns="urn:ietf:params:xml:ns:yang:ietf-l2vpn">
        <name>local</name>
        <ac>
          <name>eth0.3</name>
        </ac>
      </endpoint>
      <endpoint xmlns="urn:ietf:params:xml:ns:yang:ietf-l2vpn">
        <name>remote</name>
        <pw>
          <name>pw1</name>
        </pw>
      </endpoint>
      <vsi-root>
      </vsi-root>
    </network-instance>
  </network-instances>
  <pseudowires
      xmlns="urn:ietf:params:xml:ns:yang:ietf-pseudowires">
    <pseudowire>
      <name>pw1</name>
      <configured-pw>
        <peer-ip>2001:db8::50></peer-ip>
        <pw-id>100</pw-id>
      </configured-pw>
    </pseudowire>
  </pseudowires>
</config>
            ]]>
            </artwork>
          </figure>
        </section>
      </section>
        <!-- This PI places the pagebreak correctly (before the section title) in the text output. -->
      <?rfc needLines="8" ?>
      <section anchor="Acknowledgements" title="Acknowledgements">
        <t>The authors would particularly like to thank John Messenger, Glenn
        Parsons, and Dan Romascanu for their help progressing this draft.</t>
        <t>The authors would also like to thank Alex Campbell, Eric Gray, Giles
        Heron, Marc Holness, Iftekhar Hussain, Neil Ketley, William Lupton, John
        Messenger, Glenn Parsons, Ludwig Pauwels, Joseph White, Vladimir
        Vassilev, and members of the IEEE 802.1 WG for their helpful reviews and
        feedback on this draft.</t>
      </section>
      <section title="ChangeLog">
	<t>XXX, RFC Editor, please delete this change log before publication.</t>
        <section title="WG version -05">
          <t>
	    <list style="symbols">
              <t>Incorporate feedback from IEEE 802.1 WG, John Messenger in
              particular.</t>
	      <t>Adding must contraints to ensure outer tags are always matched
	      to C-VLAN and S-VLAN tags.</t>
	      <t>Fixed bug where second tag could be matched without outer tag,
	      and where tags must not be specified.</t>
            </list>
          </t>                
        </section>
        <section title="WG version -04">
          <t>
	    <list style="symbols">
              <t>Added examples</t>
            </list>
          </t>                
        </section>
        <section title="WG version -03">
          <t>
            <list style="symbols">
              <t>Fix namespace bug in XPath identity references, removed
              extraneous 'dot1q-tag' containers.</t>
            </list>
          </t>                
        </section>
        <section title="WG version -02">
          <t>
            <list style="symbols">
              <t>Use explicit containers for outer and inner tags rather than
              lists.</t>
            </list>
          </t>                
        </section>
        <section title="WG version -01">
          <t>
            <list style="symbols">
              <t>Tweaked the abstract.</t>
              <t>Removed unnecessary feature for the L3 sub-interface
              module.</t>
              <t>Update the 802.1Qcp type references.</t>
              <t>Remove extra tag container for L3 sub-interfaces YANG.</t>
            </list>
          </t>                
        </section>
        <section title="Version -04">
          <t>
            <list style="symbols">
              <t>IEEE 802.1 specific types have been removed from the draft.
              These are now referenced from the 802.1Qcp draft YANG modules.</t>
              <t>Fixed errors in the xpath expressions.</t>
            </list>
          </t>                
        </section>
        <section title="Version -03">
          <t>
            <list style="symbols">
              <t>Incorporates feedback received from presenting to the IEEE
              802.1 WG.</t>
              <t>Updates the modules for double tag matches/rewrites to restrict
              the outer tag type to S-VLAN and inner tag type to C-VLAN.</t>
              <t>Updates the introduction to indicate primary use case is for
              IETF forwarding protocols.</t>
              <t>Updates the objectives to make IEEE 802.1Q bridge
              interoperability a key objective.</t>
            </list>
          </t>                
        </section>
      </section>
        <!-- Possibly a 'Contributors' section ... -->
      <section anchor="IANA" title="IANA Considerations">
        <t>This document defines two new YANG module and the authors
        politely request that IANA assigns unique names to the YANG module files
        contained within this draft, and also appropriate URIs in the "IETF XML
        Registry".</t>
            <!--      <t>All drafts are required to have an IANA considerations section (see
      <xref target="I-D.narten-iana-considerations-rfc2434bis">the update of
      RFC 2434</xref> for a guide). If the draft does not require IANA to do
      anything, the section contains an explicit statement that this is the
      case (as above). If there are no requirements for IANA, the section will
      be removed during conversion into an RFC by the RFC Editor.</t>-->
      </section>
      <section anchor="Security" title="Security Considerations">
        <t>The YANG module defined in this memo is designed to be accessed via
        the NETCONF protocol <xref target="RFC6241">RFC 6241</xref>. The lowest
        NETCONF layer is the secure transport layer and the mandatory to
        implement secure transport is SSH <xref target="RFC6242">RFC
        6242</xref>.  The NETCONF access control model <xref
        target="RFC6536">RFC 6536</xref> provides the means to restrict access
        for particular NETCONF users to a pre-configured subset of all available
        NETCONF protocol operations and content.</t><t>There are a number of
        data nodes defined in this YANG module which are
        writable/creatable/deletable (i.e. config true, which is the default).
        These data nodes may be considered sensitive or vulnerable in some
        network environments.  Write operations (e.g. edit-config) to these data
        nodes without proper protection can have a negative effect on network
        operations.  These are the subtrees and data nodes and their
        sensitivity/vulnerability:</t>
        <section title="if-l3-vlan.yang">
          <t>The nodes in the if-l3-vlan YANG module are concerned with matching
          particular frames received on the network device to connect them to a
          layer 3 forwarding instance, and as such adding/modifying/deleting
          these nodes has a high risk of causing traffic to be lost because it
          is not being classified correctly, or is being classified to a
          separate sub-interface. The nodes, all under the subtree
          /interfaces/interface/encapsulation/dot1q-vlan, that are sensitive to
          this are:
          <list style="symbols">
            <t>outer-tag/tag-type</t>
            <t>outer-tag/vlan-id</t>
            <t>second-tag/tag-type</t>
            <t>second-tag/vlan-id</t>
          </list>
          </t>
        </section>
        <section title="flexible-encapsulation.yang">
          <t>There are many nodes in the flexible-encapsulation YANG module that
          are concerned with matching particular frames received on the network
          device, and as such adding/modifying/deleting these nodes has a high
          risk of causing traffic to be lost because it is not being classified
          correctly, or is being classified to a separate sub-interface. The
          nodes, all under the subtree
          /interfaces/interface/encapsulation/flexible/match, that are sensitive
          to this are:
          <list style="symbols">
            <t>default</t>
            <t>untagged</t>
            <t>dot1q-priority-tagged</t>
            <t>dot1q-priority-tagged/tag-type</t>
            <t>dot1q-vlan-tagged/outer-tag/vlan-type</t>
            <t>dot1q-vlan-tagged/outer-tag/vlan-id</t>
            <t>dot1q-vlan-tagged/second-tag/vlan-type</t>
          <t>dot1q-vlan-tagged/second-tag/vlan-id</t> </list></t>

	  <t>There are also many modes in the flexible-encapsulation YANG module
	  that are concerned with rewriting the fields in the L2 header for
	  particular frames received on the network device, and as such
	  adding/modifying/deleting these nodes has a high risk of causing
	  traffic to be dropped or incorrectly processed on peer network
	  devices, or it could cause layer 2 tunnels to go down due to a
	  mismatch in negotiated MTU. The nodes, all under the subtree
	  /interfaces/interface/encapsulation/flexible/rewrite, that are
	  sensitive to this are:
          <list style="symbols">
            <t>symmetrical/dot1q-tag-rewrite/pop-tags</t>
            <t>symmetrical/dot1q-tag-rewrite/push-tags/outer-tag/tag-type</t>
            <t>symmetrical/dot1q-tag-rewrite/push-tags/outer-tag/vlan-id</t>
            <t>symmetrical/dot1q-tag-rewrite/push-tags/second-tag/tag-type</t>
            <t>symmetrical/dot1q-tag-rewrite/push-tags/second-tag/vlan-id</t>
            <t>asymmetrical/ingress/dot1q-tag-rewrite/pop-tags</t>
            <t>asymmetrical/ingress/dot1q-tag-rewrite/push-tags/outer-tag/tag-type</t>
            <t>asymmetrical/ingress/dot1q-tag-rewrite/push-tags/outer-tag/vlan-id</t>
            <t>asymmetrical/ingress/dot1q-tag-rewrite/push-tags/second-tag/tag-type</t>
            <t>asymmetrical/ingress/dot1q-tag-rewrite/push-tags/second-tag/vlan-id</t>
            <t>asymmetrical/egress/dot1q-tag-rewrite/pop-tags</t>
            <t>asymmetrical/egress/dot1q-tag-rewrite/push-tags/outer-tag/tag-type</t>
            <t>asymmetrical/egress/dot1q-tag-rewrite/push-tags/outer-tag/vlan-id</t>
            <t>asymmetrical/egress/dot1q-tag-rewrite/push-tags/second-tag/tag-type</t>
            <t>asymmetrical/egress/dot1q-tag-rewrite/push-tags/second-tag/vlan-id</t>
          </list>
          </t><t>Nodes in the flexible-encapsulation YANG module that are
          concerned with the VLAN tags to use for traffic sourced from the
          network element could cause protocol sessions (such as CFM) to fail if
          they are added, modified or deleted. The nodes, all under the subtree
          /interfaces/interface/flexible-encapsulation/local-traffic-default-encaps
          that are sensitive to this are:
          <list style="symbols">
            <t>outer-tag/vlan-type</t>
            <t>outer-tag/vlan-id</t>
            <t>second-tag/vlan-type</t>
            <t>second-tag/vlan-id</t>
          </list>
        </t>
        </section>
      </section>
    </middle>
    <!--  *****BACK MATTER ***** -->
    <back>
        <!-- References split into informative and normative -->
        <!-- There are 2 ways to insert reference entries from the citation libraries:
     1. define an ENTITY at the top, and use "ampersand character"RFC2629; here (as shown)
     2. simply use a PI "less than character"?rfc include="reference.RFC.2119.xml"?> here
        (for I-Ds: include="reference.I-D.narten-iana-considerations-rfc2434bis.xml")

     Both are cited textually in the same manner: by using xref elements.
     If you use the PI option, xml2rfc will, by default, try to find included files in the same
     directory as the including file. You can also define the XML_LIBRARY environment variable
     with a value containing a set of directories to search.  These can be either in the local
     filing system or remote ones accessed by http (http://domain/dir/... ).-->
        <references title="Normative References">
            <!--?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml"?-->

      &RFC7950;
      &RFC2119;
      &RFC8174;
      &RFC8343;
      &RFC7224;
            <?rfc include="reference.I-D.ietf-netmod-intf-ext-yang.xml"?>

        </references>
        <references title="Informative References">
            <!-- Here we use entities that we defined at the beginning. -->
            <!-- &RFC2629;
      &RFC3552; -->
      &RFC6241;
      &RFC6242;
      &RFC6536;
      &RFC8340;
            <?rfc include="reference.RFC.2460.xml"?>
            <?rfc include="reference.RFC.4448.xml"?>
            <?rfc include="reference.RFC.4761.xml"?>
            <?rfc include="reference.RFC.4762.xml"?>
            <?rfc include="reference.I-D.ietf-bess-l2vpn-yang.xml"?>


            <reference anchor="dot1Qcp">
                <front>
                    <title>IEEE 802.1Qcp-2018 Bridges and Bridged Networks - Amendment: YANG Data Model</title>
                    <author initials="M" surname="Holness">
                        <organization>IEEE 802.1 WG</organization>
                    </author>
                    <date year="2018" />
                </front>
            </reference>

            <!--&I-D.narten-iana-considerations-rfc2434bis;-->

            <!-- A reference written by by an organization not a person. -->

            <!--      <reference anchor="DOMINATION"
                 target="http://www.example.com/dominator.html">
        <front>
          <title>Ultimate Plan for Taking Over the World</title>

          <author>
            <organization>Mad Dominators, Inc.</organization>
          </author>

          <date year="1984" />
        </front>
      </reference>-->
        </references>
        <section title="Comparison with the IEEE 802.1Q Configuration Model" anchor="comparison">
          <t>In addition to the sub-interface based YANG model proposed here,
          the IEEE 802.1Q working group has developed a YANG model for the
          configuration of 802.1Q VLANs.  This raises the valid question as to
          whether the models overlap and whether it is necessary or beneficial
          to have two different models for superficially similar constructs.
          This section aims to answer that question by summarizing and comparing
          the two models.</t>
          <section title="Sub-interface based configuration model overview">
            <t>The key features of the sub-interface based configuration model
            can be summarized as:
            <list style="symbols">
              <t>The model is primarily designed to enable layer 2 and layer 3
              services on Ethernet interfaces that can be defined in a very
              flexible way to meet the varied requirements of service
              providers.</t>
	      <t>Traffic is classified from an Ethernet-like interface to
	      sub-interfaces based on fields in the layer 2 header. This is
	      often based on VLAN Ids contained in the frame, but the model is
	      extensible to other arbitrary fields in the frame header.</t>
	      <t>Sub-interfaces are just a type of if:interface and hence
	      support any feature configuration YANG models that can be applied
	      generally to interfaces. For example, QoS or ACL models that
	      reference if:interface can be applied to the sub-interfaces, or
	      the sub-interface can be used as an Access Circuit in L2VPN or
	      L3VPN models that reference if:interface.</t>
	      <t>In the sub-interface based configuration model, the
	      classification of traffic arriving on an interface to a given
	      sub-interface, based on fields in the layer 2 header, is
	      completely independent of how the traffic is forwarded. The
	      sub-interface can be referenced (via references to if:interface)
	      by other models that specify how traffic is forwarded; thus
	      sub-interfaces can support multiple different forwarding
	      paradigms, including but not limited to: layer 3 (IPv4/IPv6),
	      layer 2 pseudowires (over MPLS or IP), VPLS instances, EVPN
	      instance.</t>
	      <t>The model is flexible in the scope of the VLAN Identifier
	      space.  I.e. by default VLAN Ids can be scoped locally to a single
	      Ethernet-like trunk interface, but the scope is determined by the
	      forwarding paradigm that is used.</t>
            </list>
            </t>
          </section>
          <section title="IEEE 802.1Q Bridge Configuration Model Overview">
            <t>The key features of the IEEE 802.1Q bridge configuration model
            can be summarized as:
            <list style="symbols">
              <t>Each VLAN bridge component has a set of Ethernet interfaces
              that are members of that bridge. Sub-interfaces are not used, nor
              required in the 802.1Q bridge model.</t>
	      <t>Within a VLAN bridge component, the VLAN tag in the packet is
	      used, along with the destination MAC address, to determine how to
	      forward the packet. Other forwarding paradigms are not supported
	      by the 802.1Q model.</t>
	      <t>Classification of traffic to a VLAN bridge component is based
	      only on the Ethernet interface that it arrived on.</t>
	      <t>VLAN Identifiers are scoped to a VLAN bridge component. Often
	      devices only support a single bridge component and hence VLANs are
	      scoped globally within the device.</t>
	      <t>Feature configuration is specified in the context of the
	      bridge, or particular VLANs on a bridge.</t>
            </list>
            </t>
          </section>
          <section title="Possible Overlap Between the Two Models">
            <t>Both models can be used for configuring similar basic layer 2
            forwarding topologies. The 802.1Q bridge configuration model is
            optimised for configuring Virtual LANs that span across enterprises
            and data centers.</t>
	    <t>The sub-interface model can also be used for configuring
	    equivalent Virtual LAN networks that span across enterprises and
	    data centers, but often requires more configuration to be able to
	    configure the equivalent constructs to the 802.1Q bridge model.</t>
	    <t>The sub-interface model really excels when implementing flexible
	    L2 and L3 services, where those services may be handled on the same
	    physical interface, and where the VLAN Identifier is being solely
	    used to identify the customer or service that is being provided
	    rather than a Virtual LAN.  The sub-interface model provides more
	    flexibility as to how traffic can be classified, how features can be
	    applied to traffic streams, and how the traffic is to be
	    forwarded.</t>
	    <t>Conversely, the 802.1Q bridge model can also be use to implement
	    L2 services in some scenarios, but only if the forwarding paradigm
	    being used to implement the service is the native Ethernet
	    forwarding specified in 802.1Q - other forwarding paradigms such as
	    pseudowires or VPLS are not supported. The 802.1Q bridge model does
	    not implement L3 services at all, although this can be partly
	    mitigated by using a virtual L3 interface construct that is a
	    separate logical Ethernet-like interface which is a member of the
	    bridge.</t>
	    <t>In conclusion, it is valid for both of these models to exist
	    since they have different deployment scenarios for which they are
	    optimized.  Devices may choose which of the models (or both) to
	    implement depending on what functionality the device is being
	    designed for.</t>
          </section>
        </section>
        <!--    <section anchor="app-additional" title="Additional Stuff">
      <t>This becomes an Appendix.</t>
    </section>-->
        <!-- Change Log

v00 2015-03-02  RGW   Initial version
                      -->
    </back>
</rfc>
