<?xml version='1.0'?>   
    <!DOCTYPE rfc SYSTEM 'rfc2629.dtd' [ 
    	<!ENTITY rfc2629 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2629.xml'> 
		]>
<?rfc strict="yes"?>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="std" docName="draft-xiong-detnet-qos-yang-02"
     ipr="trust200902">
  <!-- ***** FRONT MATTER ***** -->
  <front>
    <title abbrev="DetNet QoS Yang">DetNet QoS Yang</title>

	 <author fullname="Quan Xiong" initials="Q" surname="Xiong">
      <organization>ZTE Corporation</organization>

      <address>
        <postal>
          <street>No.6 Huashi Park Rd</street>
          
          <city>Wuhan</city>
          
          <region>Hubei</region>
  
          <code>430223</code>

          <country>China</country>
        </postal>

        <phone>+86 27 83531060</phone>

        <email>xiong.quan@zte.com.cn</email>
      </address>
	  </author>
	  
	  <author fullname="Yufang Han" initials="Y" surname="Han">
	  <organization>ZTE Corporation</organization>
	  <address>
        <postal>
          <street>50 Software Avenue, YuHuaTai District</street>
          
          <city>Nanjing</city>
          
          <region>Jiangsu</region>
  
          <code>210012</code>

          <country>China</country>
        </postal>

        <phone>+86 15951984307</phone>

        <email>han.yufang1@zte.com.cn</email>
      </address>
    </author>
	
	<author fullname="Fengwei Qin" initials="F" surname="Qin">
      <organization>China Mobile</organization>

      <address>
        <postal>
          <street></street>
          
          <city>Beijing</city>
          
          <region></region>
  
          <code></code>

          <country>China</country>
        </postal>

        <phone></phone>

        <email>qinfengwei@chinamobile.com</email>
      </address>
    </author>
	
	<author fullname="Peng Liu" initials="P" surname="Liu">
      <organization>China Mobile</organization>

      <address>
        <postal>
          <street></street>
          
          <city>Beijing</city>
          
          <region></region>
  
          <code>100053</code>

          <country>China</country>
        </postal>

        <phone></phone>

        <email>liupengyjy@chinamobile.com</email>
      </address>
    </author>
	
    
	<date month="November" year="2019"/>	
    <area>route</area>
    <workgroup>DeNet WG</workgroup>
    <keyword>DetNet, QoS</keyword>
    <abstract>
	
	  <t> This document defines a YANG data model for Deterministic Networking (DetNet) 
	  Quality of Service (QoS) based on the Differentiated Services (DiffServ) model.</t>
 
    </abstract>
  </front>

  <!-- ***** MIDDLE MATTER ***** -->


  <middle>
    <section title="Introduction">
      <t>Deterministic Networking (DetNet) as defined in <xref target="RFC8655"></xref>, 
	  provides a capability to carry specified unicast or multicast data flows for 
	  real-time applications with extremely low data loss rates and bounded latency.
	  In the meanwhile, DetNet and non-DetNet packets are allowed to be transmitted in 
	  the same network and more than one DetNet flows which has different priorities 
	  may be forwarded through the DetNet domain. As discussed in <xref target="I-D.ietf-detnet-ip"></xref>
	  and <xref target="I-D.xiong-detnet-qos-policy"></xref>, the Differentiated Services (DiffServ) 
	  can be used to provide Quality of Service (QoS) for DetNet services.</t>
      
      <t> This document defines a YANG data model for DetNet QoS based on the DiffServ
	  model.</t>

     
    <section title= "Requirements Language"> 
      <t> The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
      document are to be interpreted as described in <xref target="RFC2119"></xref>.</t>
    </section>


    <section title= "Terminology">   
      <t>The terminology is defined as <xref target="RFC8655"></xref>, <xref target="RFC3270"></xref>,
	  <xref target="RFC2474"></xref> and <xref target="RFC2475"></xref>.</t>
    </section>
    </section>
	
	<section title= "DetNet DiffServ QoS Model">
	  <t>This document defines a YANG data module for DetNet DiffServ QoS Model as 
	  discussed in <xref target="I-D.xiong-detnet-qos-policy"></xref>.  In the ietf-detnet-qos module, 
	  this is performed as one of the DetNet QoS policy.</t>
	  
	  <section title= "DetNet QoS Tree Structure">
	  <t>DetNet DiffServ model is one type of the DetNet QoS policy and other policy
	  types can be defined in detnet-policy-type.</t>
	  
	  <t><xref target="I-D.xiong-detnet-qos-policy"></xref> specified two types of classifiers including 
	  BA (Behavior Aggregate) and MF (Multi-Field) classifiers in detnet-classifier-type. 
	  DetNet IP BA classifier selects packets based on the DiffServ Code Point (DSCP) 
	  and DetNet MPLS BA classifier is based on the MPLS Traffic Class (TC) field. 
	  DetNet IP MF classifier selects packets based on the value of a combination 
	  of source address, destination address, DSCP, protocol ID, source port and 
	  destination port numbers and DetNet MPLS MF classifier is based on the MPLS 
	  TC , service label (S-Label) field and forwarding labels (F-Labels) of the 
	  header.</t>
	  
	  <t><xref target="I-D.xiong-detnet-qos-policy"></xref> defined a DetNet (DN) Per Hop Behavior (PHB) 
	  for DetNet forward other than existing PHBs including AF,EF,CS,DF etc. The 
	  PHB class information description is as qos-phb-class shown.</t>
	  
	  <t><xref target="I-D.xiong-detnet-qos-policy"></xref> defined two new types of action for DetNet traffic
	  conditioning named order and scheduler action. Other actions including 
	  meter, shaper, dropper and marker as the detnet-action-type shown.</t>
	  
<figure  align="center">
<artwork align="center"><![CDATA[ 
module: ietf-detnet-qos
  +--rw detnet-qos-policies
     +--rw detnet-policy-template* [detnet-policy-name]
        +--rw detnet-policy-name            string
        +--rw detnet-policy-type?           detnet-policy-type
        +--rw detnet-classifier-template* [detnet-classifier-name]
           +--rw detnet-classifier-name    string
           +--rw detnet-classifier-type?   detnet-classifier-type
           +--rw (classifier-type)?
           |  +--:(ba)
           |  |  +--rw (encapsulation-type)?
           |  |     +--:(MPLS)
           |  |     |  +--rw mpls-ba* [tc-value]
           |  |     |     +--rw phb-class?   qos-phb-class
           |  |     |     +--rw tc-value     uint8
           |  |     +--:(IP)
           |  |        +--rw ip-ba* [dscp-value]
           |  |           +--rw phb-class?    qos-phb-class
           |  |           +--rw dscp-value    uint8
           |  +--:(mf)
           |     +--rw (tunnel-type)?
           |        +--:(MPLS)
           |        |  +--rw mpls-mf* [tc-value]
           |        |     +--rw phb-class?   qos-phb-class
           |        |     +--rw tc-value     uint8
           |        |     +--rw s-label?     uint32
           |        |     +--rw f-labels* [f-label-id]
           |        |        +--rw f-label-id    uint32
           |        +--:(IPv4)
           |        |  +--rw ipv4-mf* [dscp-value]
           |        |     +--rw phb-class?                  qos-phb-class
           |        |     +--rw dscp-value                  uint8
           |        |     +--rw ipv4-source-address?        inet:ipv4-address
           |        |     +--rw ipv4-destination-address?   inet:ipv4-address
           |        |     +--rw protocol-ID?                uint8
           |        |     +--rw source-port-numbers?        inet:port-number
           |        |     +--rw destination-port-numbers?   inet:port-number
           |        +--:(IPv6)
           |           +--rw ipv6-mf* [dscp-value]
           |              +--rw phb-class?                  qos-phb-class
           |              +--rw dscp-value                  uint8
           |              +--rw ipv6-source-address?        inet:ipv6-address
           |              +--rw ipv6-destination-address?   inet:ipv6-address
           |              +--rw protocol-ID?                uint8
           |              +--rw source-port-numbers?        inet:port-number
           |              +--rw destination-port-numbers?   inet:port-number
           |              +--rw flow-label?                 inet:ipv6-flow-label
           +--rw detnet-action* [detnet-action-type]
              +--rw detnet-action-type    detnet-action-type
              +--rw (actions)?
                 +--:(meter)
                 +--:(marker)
                 +--:(shaper)
                 +--:(dropper)
                 +--:(order)
                 +--:(scheduler)
]]></artwork>
<postamble></postamble>
       </figure>

	  </section>
	  
	  <section title= "DetNet QoS Module">
		  
<figure  align="center">
<artwork align="center"><![CDATA[ 
<CODE BEGINS> file "detnet-diffserv-qos@2018-10-13.yang"
module ietf-detnet-qos {
     yang-version 1;
     namespace "urn:ietf:params:xml:ns:yang:ietf-detnet-qos";
     prefix detnet-qos;
	 
	 import ietf-inet-types{
       prefix "inet";
     }

     organization "IETF DetNet Working Group";
	 contact
       "WG Web:   <http://tools.ietf.org/wg/detnet/>
        WG List:  <mailto: detnet@ietf.org>
        WG Chair: Lou Berger
                  <mailto:lberger@labn.net>
                  Janos Farkas
                  <janos.farkas@ericsson.com>
        Editor:   Quan Xiong
                  <mailto:xiong.quan@zte.com.cn>
        Editor:   Yufang Han
                  <mailto:han.yufang1@zte.com.cn>";

     description
       "This YANG module describes the Deterministic Networking (DetNet) 
	   Quality of Service (QoS) based on the Differentiated Services (DiffServ) 
	   model.";

     revision "2018-10-13" {
       description "initial revision";
       reference "RFC XXXX: draft-xiong-detnet-qos-yang-01";
     }

    typedef qos-phb-class {
     type enumeration {
      enum df {
        value 1 ;
        description "Default Forwarding for Best effort";
      }
      enum af1 {
        value 2 ;
        description "Assured forwarding class 1";
      }
      enum af2 {
        value 3 ;
        description "Assured forwarding class 2";
      }
      enum af3 {
        value 4 ;
        description "Assured forwarding class 3";
      }
      enum af4 {
        value 5 ;
        description "Assured forwarding class 4";
      }
      enum ef {
        value 6 ;
        description "Expedited forward";
      }
	  enum cs6 {
        value 7 ;
        description "Internetwork control service class";
      }
      enum cs7 {
        value 8 ;
        description "Network control service class";
      }
      enum dn {
        value 9 ;
        description "DetNet forward";
      }
     }
	 description
         "The PHB class including AF,EF,CS,DF,DN";
    }
   
    typedef detnet-policy-type {
	  type enumeration {
	    enum diffserv {
	      value 1 ;
		  description "DiffServ Policy";
	    }
	  }
	  description
         "The DetNet policy type.";
    }
	
    typedef detnet-classifier-type {
	  type enumeration {
	    enum ba {
	      value 1 ;
		  description "DiffServ BA Classifier";
	    }
		enum mf {
	      value 2 ;
		  description "DiffServ MF Classifier";
	    }
	  }
	  description
         "The DetNet classifier type including BA and MF.";
    }
	
	typedef detnet-action-type {
	  type enumeration {
	    enum meter {
	      value 1 ;
		  description "DiffServ meter Action";
	    }
	    enum shaper {
	      value 2 ;
		  description "DiffServ shaper Action";
	    }
		enum dropper {
	      value 3 ;
		  description "DiffServ dropper Action";
	    }
		enum marker {
	      value 4 ;
		  description "DiffServ marker Action";
	    }
		enum order {
	      value 5 ;
		  description "DiffServ order Action";
	    }
		enum scheduler {
	      value 6 ;
		  description "DiffServ scheduler Action";
	    }
	  }
	  description
         "The DetNet classifier type including BA and MF.";
	}
	
	grouping mpls-tc {
        description "MPLS TC Information";
        leaf phb-class {
		    type qos-phb-class;
            description "Specify phb class of PHB info, support [a"
            + "f1,af2,af3,af4,be,ef,cs6,cs7,dn]";
        }
        leaf tc-value {
            type uint8 {
                range 0..7 {
                description "MPLS-TC value, support [0-7]";
                }
            }
            mandatory true ;
			description "MPLS-TC value, support [0-7]";
	    }
    }
	
	grouping ip-dscp {
        description "IP DSCP Information";
        leaf phb-class {
		    type qos-phb-class ;
            description "Specify server class of PHB info, support [a"
            + "f1,af2,af3,af4,be,ef,cs6,cs7,dn]";
        }
        leaf dscp-value {
            type uint8 {
                range 0..63 {
                description "IPv4/IPv6 DSCP value, support [0-63]";
                }
            }
            mandatory true ;
			description "IPv4/IPv6 DSCP value, support [0-63]";
	    }
    }

    grouping mpls-header-info {
        description "MPLS TC Information";
        leaf phb-class {
		    type qos-phb-class ;
            description "Specify phb class of PHB info, support [a"
            + "f1,af2,af3,af4,be,ef,cs6,cs7,dn]";
        }
        leaf tc-value {
            type uint8 {
                range 0..7 {
                description "MPLS-TC value, support [0-7]";
                }
            }
            mandatory true ;
			description "MPLS-TC value, support [0-7]";
	    }
		leaf s-label {
		    type uint32;
		    description "DetNet Flow ID value, support classifier MF";
		}
		list f-labels {
            key "f-label-id";
			description "DetNet forwarding label id, support classifier MF";
			leaf f-label-id {
			    type uint32;
				description "DetNet forwarding label value, support classifier MF";
			}
		}
    }
	
	grouping ipv4-header-info {
        description "IP DSCP Information";
        leaf phb-class {
		    type qos-phb-class ;
            description "Specify server class of PHB info, support [a"
            + "f1,af2,af3,af4,be,ef,cs6,cs7,dn]";
        }
        leaf dscp-value {
            type uint8 {
                range 0..63 {
                description "IPv4/IPv6 DSCP value, support [0-63]";
                }
            }
            mandatory true ;
			description "IPv4/IPv6 DSCP value, support [0-63]";
	    }
		leaf ipv4-source-address {
			type inet:ipv4-address;
		    description "source address value, support classifier MF";
		}
		leaf ipv4-destination-address {
			type inet:ipv4-address;
		    description "destination address value, support classifier MF";
		}
		leaf protocol-ID {
		    type uint8;
		    description "protocol ID, support classifier MF";
		}
		leaf source-port-numbers {
		    type inet:port-number;
		    description "source port numbers, support classifier MF";
		}
		leaf destination-port-numbers {
		    type inet:port-number;
		    description "destination port numbers, support classifier MF";
		}
    }
	
	grouping ipv6-header-info {
        description "IPv6 DSCP Information";
        leaf phb-class {
		    type qos-phb-class ;
            description "Specify server class of PHB info, support [a"
            + "f1,af2,af3,af4,be,ef,cs6,cs7,dn]";
        }
        leaf dscp-value {
            type uint8 {
                range 0..63 {
                description "IPv4/IPv6 DSCP value, support [0-63]";
                }
            }
            mandatory true ;
			description "IPv4/IPv6 DSCP value, support [0-63]";
	    }
		leaf ipv6-source-address {
			type inet:ipv6-address;
		    description "source address value, support classifier MF";
		}
		leaf ipv6-destination-address {
			type inet:ipv6-address;
		    description "destination address value, support classifier MF";
		}
		leaf protocol-ID {
		    type uint8;
		    description "protocol ID, support classifier MF";
		}
		leaf source-port-numbers {
		    type inet:port-number;
		    description "source port numbers, support classifier MF";
		}
		leaf destination-port-numbers {
		    type inet:port-number;
		    description "destination port numbers, support classifier MF";
		}
		leaf flow-label {
             type inet:ipv6-flow-label;
             description
               "The flow label of the header.";
        }
    }

    grouping detnet-classifiers {
        description "Configure the DetNet classifiers";
        choice classifier-type {
            description "Choice of classifiers types";
			case ba {
			    description "BA classifier";
				choice encapsulation-type {
                  description "Tunnel type includes: IP, MPLS.";
                  case MPLS {
				    list mpls-ba {
                        key "tc-value";
					    description "MPLS-TC be mapped to PHB";
                        uses mpls-tc;
                    } 
                  }
                  case IP {				
                    list ip-ba {
                        key "dscp-value";
					    description "IPv4/IPv6 DSCP be mapped to PHB";
                        uses ip-dscp;
				    }
                  }
                }
			}
			case mf {
			    description "MF classifier";
				choice tunnel-type {
                  description
                     "Tunnel type includes: IPv4, IPv6, MPLS.";
                  case MPLS {
				    list mpls-mf {
                        key "tc-value";
					    description "MPLS-TC be mapped to PHB";
                        uses mpls-header-info;
                    } 
                  }	
                  case IPv4 {				  
                    list ipv4-mf {
                        key "dscp-value";
					    description "IPv4 DSCP be mapped to PHB";
                        uses ipv4-header-info;
					}
				  }
                  case IPv6 {				  
                    list ipv6-mf {
                        key "dscp-value";
					    description "IPv6 DSCP be mapped to PHB";
                        uses ipv6-header-info;
					}
				  }
                }			 
			}
        }					
    }

	grouping detnet-actions {
        description
          "DetNet Configuration about the actions";
        list detnet-action {
            key "detnet-action-type";
			description "DetNet actions, to be defined.";
            leaf detnet-action-type {
              type detnet-action-type;
			  description "DetNet action types";
            }
            choice actions {
              description "Choice of action types";
			  case meter {
			    description "meter action";
              }
			  case marker {
			    description "marker action";
              }
			  case shaper {
			    description "shaper action";
              }
			  case dropper {
			    description "dropper action";
              }
			  case order {
			    description "order action";
              }	
			  case scheduler {
			    description "scheduler action";
              }				  
            }
        }
    }
	
	container detnet-qos-policies {
        description "Configuration about DetNet QoS Policy";
        list detnet-policy-template { 
			key detnet-policy-name;
			description "DetNet policy template";
		    leaf detnet-policy-name {
			   type string;
			   description "DetNet policy name";
            }
            leaf detnet-policy-type { 
              type detnet-policy-type;
			  description "DetNet policy type";
            }
            list detnet-classifier-template { 
                key detnet-classifier-name;
				description "DetNet classifier template";
                leaf detnet-classifier-name {
                    type string;
					description "DetNet classifier name";
                }
				leaf detnet-classifier-type {
					type detnet-classifier-type;
					description "DetNet classifier type";
                }
		        uses detnet-classifiers;
				uses detnet-actions;
            }
	    }
	}
}
<CODE ENDS>  
]]></artwork>
<postamble></postamble>
       </figure>
	   
	</section>
    </section>


    <section anchor="Security" title="Security Considerations">
    <t>TBD.</t>
    </section>

    <section anchor="IANA" title="IANA Considerations">
    <t>TBD.</t>
    </section>
 
    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>TBD.</t>
    </section>
    
  </middle>

  <!--  *****BACK MATTER ***** -->

  <back>

    <references title="Informative References">
     <?rfc include='reference.RFC.2475'?>
     </references>
     
     <references title="Normative References">
     <?rfc include='reference.RFC.2119'?>
	  <?rfc include='reference.RFC.2474'?>
	  <?rfc include='reference.RFC.3270'?>
	  <?rfc include='reference.RFC.5462'?>
	  <?rfc include='reference.RFC.8655'?>
	  <?rfc include='reference.I-D.ietf-detnet-ip'?>
	  <?rfc include='reference.I-D.xiong-detnet-qos-policy'?>
	 </references>
      
    
 
  </back>
</rfc>
