<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM 'rfc2629.dtd' [

      <!ENTITY rfc3095 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.3095.xml'>
      <!ENTITY rfc5225 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.5225.xml'>
      <!ENTITY rfc4997 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.4997.xml'>
      <!ENTITY rfc6282 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.6282.xml'>
      <!ENTITY rfc4944 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.4944.xml'>
      <!ENTITY rfc7252 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.7252.xml'>
      <!ENTITY rfc1332 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.1332.xml'>

      <!ENTITY gapAna PUBLIC '' 'http://xml2rfc.ietf.org/public/rfc/bibxml-ids/reference.I-D.draft-minaburo-lp-wan-gap-analysis-01.xml'>
      <!ENTITY schc PUBLIC '' 'http://xml2rfc.ietf.org/public/rfc/bibxml-ids/reference.I-D.draft-toutain-6lpwa-ipv6-static-context-hc-00.xml'>
      <!ENTITY noResp PUBLIC '' 'http://xml2rfc.ietf.org/public/rfc/bibxml-ids/reference.I-D.draft-tcs-coap-no-response-option-16.xml'>
      <!ENTITY yangACL PUBLIC '' 'http://xml2rfc.ietf.org/public/rfc/bibxml-ids/reference.I-D.draft-ietf-netmod-acl-model-07.xml'>
      <!ENTITY corecool PUBLIC '' 'http://xml2rfc.ietf.org/public/rfc/bibxml-ids/reference.I-D.veillette-core-cool.xml'>
      
]>

<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes" ?>
<?rfc strict="yes" ?>
<?rfc compact="yes" ?>
<rfc category="info" docName="draft-toutain-lpwan-yang-static-context-hc-00" ipr="trust200902">
  <front>
    <title abbrev="LPWAN SCHC YANG moodule"> YANG module for LPWAN Static Context Header Compression (SCHC)</title>


<author fullname="Ana Minaburo" initials="A." surname="Minaburo">
<organization>Acklio</organization>

   <address>
    <postal>
    <street>2bis rue de la Chataigneraie</street>


    <city>35510 Cesson-Sevigne Cedex</city>

    <country>France</country>
    </postal>

    <email>ana@ackl.io</email>
  </address>
</author>


    <author fullname="Laurent Toutain" initials="L." surname="Toutain">
      <organization>Institut MINES TELECOM ; TELECOM Bretagne</organization>

      <address>
        <postal>
          <street>2 rue de la Chataigneraie</street>

          <street>CS 17607</street>

          <city>35576 Cesson-Sevigne Cedex</city>

          <country>France</country>
        </postal>

        <email>Laurent.Toutain@telecom-bretagne.eu</email>
      </address>
    </author>

    <date month="July" year="2016" />

    <!--    <workgroup>v6ops Working Group </workgroup> -->

    <abstract>
    <t>
    This document describes a yang model for Static Context Header Compression. A generic module is defined, that can be applied for any headers. A specific model for the IPv6 UDP protocol stack is also proposed. 
    </t>
    </abstract>
  </front>

<middle>

<section anchor="Introduction" title="Introduction">

<t>
<xref target="I-D.toutain-6lpwa-ipv6-static-context-hc"/> defines a compression technique for LPWA network based on static context. The context is known by both ends.  A context contains an ordered list of rules (cf. <xref target="Fig-ctxt"/>). Each rule is a vector of entries. Each entry is composed of a field descriptor, a prescribed matching value, a matching rule for the compression side, a matching rule for the decompression side and a compression/decompression action function.
<figure anchor="Fig-ctxt"
title="Context in LC"><artwork><![CDATA[
            
            
            +---------------------------------------------------------------------+
            |                      Rule N                                         |
       +---------------------------------------------------------------------+    |
       |                    Rule i                                           |    |
+---------------------------------------------------------------------+      |    |
|                    Rule 1                                           |      |    |
|   +---------+-------+------------+--------------+-----------------+ |      |    |
|   | Field 1 | Value |match. comp.| match decomp | Action function | |      |    | 
|   +---------+-------+------------+--------------+-----------------+ |      |    |
|   | Field 2 | Value |match. comp.| match decomp | Action function | |      |    | 
|   +---------+-------+------------+--------------+-----------------+ |      |    |
|   | ...     | ...   |...         | ...          | ...             | |      |    | 
|   +---------+-------+------------+--------------+-----------------+ |      |----+
|   | Field N | Value |match. comp.| match decomp | Action function | |      |   
|   +---------+-------+------------+--------------+-----------------+ |------+
|                                                                     |
+---------------------------------------------------------------------+
               
]]></artwork></figure>
</t>
</section>
<section title="YANG types">
<section title="Value field">
<t>
A value may be associated for each field in a rule. The value's type depends of the field. It can be an integer, a prefix, a string, or any other type carried by the field. The LPWA-types regroups all the possibles values. <xref target="Fig-values-types"/> gives its definition.

<figure anchor="Fig-values-types"
title="Value types"><artwork><![CDATA[
            
	typedef LPWA-types {
		type union {
			type uint8;
			type uint16;
			type uint32;
			type uint64;
			type inet:ipv6-prefix; // better use int64, more comptact ?
			type string; 
		}
	}
 
               
]]></artwork></figure>

Note that as defined in <xref target="I-D.toutain-6lpwa-ipv6-static-context-hc"/>, ESprefix and LCprefix can be of inet:ipv6-prefix type, but this type derives from ASCII characters, a binary representation such as uint64 will be more compact. 
</t>
</section>

<section title="Matching operator">
<t>
A matching operator is used to check the field value stored in the rule against the value contained in the header field. If there is no matching the rule is not selected.  Two instances of matching operator are defined to allow the rule selection from informations contained either the compressed or uncompressed header. 
<xref target="I-D.toutain-6lpwa-ipv6-static-context-hc"/> defines three operators:
<list style="symbols">
<t>equal: the rule's value must be equal to the packet header value for a specific field.</t>
<t>lsb(L): this operator compare the most significant bits. The operator takes one argument representing the length of  least significant bit part, which will be ignored during the matching but sent if the rule matches. </t>
<t>ignore: there is no check for this field.</t>
</list>
<figure anchor="Fig-operator-types"
title="Matching operators"><artwork><![CDATA[
            
	grouping matching-operator {
		leaf operator {
			type enumeration {
			enum operator-equal;
			enum operator-lsb;
			enum operator-ignore;
			}
		}
		choice operator-lsb {
			leaf lsb-length {
				type LPWA-types;
			}
		}
		
               
]]></artwork></figure>

<xref target="Fig-operator-types"/> represents the matching operator type definition. 
	
</t>
</section>

<section title="action function">
<t>
<xref target="I-D.toutain-6lpwa-ipv6-static-context-hc"/> defines some actions functions. Action functions tell how to compress and inversely how to decompress the field. 
They are defined in <xref target="Fig-action-types"/>

<figure anchor="Fig-action-types"
title="Action functions"><artwork><![CDATA[
            
    typedef LPWA-action-functions {
       type enumeration {
             enum elided;   
             enum send-value;
             enum compute-IPv6-length;
             enum compute-UDP-length;
             enum compute-UDP-checksum;
             enum ESiid-DID;
             enum LAiid-DID;
       }
    }

]]></artwork></figure>
</t>

</section>

</section>

<section title="Generic rule definition">
<t>
 Each rule's row is defined by several leaves, composed of:
 <list style="symbols">
 <t>a field name that can be used for debugging purpose, </t>
 <t>a field position which will be used as a key, </t>
 <t>a field value containing the value that will be compared,</t>
 <t>two matching operators for rule selection: one for compression and the other for decompression,</t>
 <t>an action function to compress/uncompress the field.</t>
 </list>
 
 <xref target="Fig-field-description"/> defines the format.
 
<figure anchor="Fig-field-description"
title="Action functions"><artwork><![CDATA[
            
	grouping field-context {
		leaf field-name {
			type string;
		}
		leaf field-pos {
			type int8;
		}
		leaf field-value {
			type LPWA-types; 
		}	
		container field-compression-match {
			uses matching-operator;
		}
		container field-decompression-match {
			uses matching-operator;
		}
		leaf action-function {
			type LPWA-action-functions;
		}	
	}	


]]></artwork></figure>
</t>
</section>
<section title="Yang static context model">
<t>
This lead to the generic rule definition, represented <xref target="Fig-generic-rule-tree"/>. 

<figure anchor="Fig-generic-rule-tree"
title="Generic module tree"><artwork><![CDATA[
            
   +--rw generic-rules
   |  +--rw context-name?    string
   |  +--rw context-rules* [rule-id]
   |     +--rw rule-name?     string
   |     +--rw rule-id        int8
   |     +--rw rule-fields* [field-pos]
   |        +--rw field-name?                  string
   |        +--rw field-pos                    int8
   |        +--rw field-value?                 LPWA-types
   |        +--rw field-compression-match
   |        |  +--rw operator?     enumeration
   |        |  +--rw (operator-lsb)?
   |        |     +--:(lsb-length)
   |        |        +--rw lsb-length?   LPWA-types
   |        +--rw field-decompression-match
   |        |  +--rw operator?     enumeration
   |        |  +--rw (operator-lsb)?
   |        |     +--:(lsb-length)
   |        |        +--rw lsb-length?   LPWA-types
   |        +--rw action-function?             LPWA-action-functions


]]></artwork></figure>

A context is defined by a set of rules identified through a rule-id. Each rule contains a set of field definitions identified through a field position. <xref target="Fig-generic-rule-yang"/> gives the yang definition of this module.


<figure anchor="Fig-generic-rule-yang"
title="Yang definition of the generic module"><artwork><![CDATA[
            
 	container generic-rules {
		leaf context-name {
			type string;
		}
		list context-rules {
		    key rule-id;
		    
			leaf rule-name {
				type string;
			}
			leaf rule-id {
				type int8;
			}
			list rule-fields {
			    key field-pos;
				uses field-context;
			}
		}
	
	}
	
]]></artwork></figure>

Specific modules can be defined based on the same principle. <xref target="Fig-IPv6-udp-rule-yang"/> represents the module defined in <xref target="I-D.toutain-6lpwa-ipv6-static-context-hc"/>.


<figure anchor="Fig-IPv6-udp-rule-yang"
title="Yang definition of the IPv6 UDP compression"><artwork><![CDATA[
            
	container IPv6-UDP-rules {
		leaf context-name {
			type string;
		}
		list context-rules {
		    key rule-id;
		    
			leaf rule-name {
				type string;
			}
			leaf rule-id {
				type int8;
			}
			container shim-id {
				uses field-context {
					refine field-name {
						default "shim identifier";
					}
					refine field-pos {
						default 0;
					}
					refine field-value {
						default 0;
					}
				}	
			}
			container ES-device-id {
				uses field-context {
					refine field-name {
						default "End System device identifier";
					}
					refine field-pos {
						default 1;
					}
					refine field-value {
						default 0;
					}
				}	
			}
			container ipv6-version {
				uses field-context {
					refine field-name {
						default "IPv6 Version";
					}
					refine field-pos {
						default 2;
					}
					refine field-value {
						default 6;
					}
				}	
			}
			container ipv6-diffserv {
				uses field-context {
					refine field-name {
						default "IPv6 Diffserv";
					}
					refine field-pos {
						default 3;
					}
					refine field-value {
						default 0;
					}
				}	
			}
			container ipv6-flow-label {
				uses field-context {
					refine field-name {
						default "IPv6 Flow Label";
					}
					refine field-pos {
						default 4;
					}
					refine field-value {
						default 0;
					}
				}	
			}
			container ipv6-length {
				uses field-context {
					refine field-name {
						default "IPv6 length";
					}
					refine field-pos {
						default 5;
					}
				}	
			}
			container ipv6-next-header {
				uses field-context {
					refine field-name {
						default "IPv6 next header";
					}
					refine field-pos {
						default 6;
					}
					refine field-value {
						default 17;
					}
				}
			}
			container ipv6-hop-limit {
				uses field-context {
					refine field-name {
						default "IPv6 Hop Limit";
					}
					refine field-pos {
						default 7;
					}
					refine field-value {
						default 17;
					}
				}
			}
			container ipv6-ES-prefix {
				uses field-context {
					refine field-name {
						default "IPv6 ES Prefix";
					}
					refine field-pos {
						default 8;
					}
				}
			}
			container ipv6-ES-iid {
				uses field-context {
					refine field-name {
						default "IPv6 ES Interface ID";
					}
					refine field-pos {
						default 9;
					}
				}
			}
			container ipv6-LC-prefix {
				uses field-context {
					refine field-name {
						default "IPv6 LC Prefix";
					}
					refine field-pos {
						default 10;
					}
				}
			}
			container ipv6-LC-iid {
				uses field-context {
					refine field-name {
						default "IPv6 LC Interface ID";
					}
					refine field-pos {
						default 11;
					}
				}
			}			
			
			container udp-ES-port {
				uses field-context {
					refine field-name {
						default "UDP ES port";
					}
					refine field-pos {
						default 12;
					}
				}
			}			
			container udp-LC-port {
				uses field-context {
					refine field-name {
						default "UDP LC port";
					}
					refine field-pos {
						default 13;
					}
				}
			}				
			
		}
	
	}
	
]]></artwork></figure>

Each field is specifically defined with some default values. 

</t>
</section>



<section title="Use of COMI/CoOL">
<t>
COMI/CoOL <xref target="I-D.veillette-core-cool"/> defines a management function set adapted to constrained networks. In the generic format, the keys to access a field (referenced as field-SID) are the rule-id and the field-pos. Therefore to modify one value for a specific rule and a specific field, a iPATCH will be used as defined in <xref target="Fig-iPATCH"/>

<figure anchor="Fig-iPATCH"
title="Yang definition of the IPv6 UDP compression"><artwork><![CDATA[
          
iPATCH /c Content-Format(application/cool-value-pairs+cbor)
[
  [field-SID, rule-id, field-pos], value
]  

]]></artwork></figure>

For a specific context, only the rule-id has to be specified in the iPATH methods since each field has its own sid value.
</t>
</section>

<section title="Acknowledgement">
<t>The authors would like to thank Michel Veillette, Alexander Pelov, Antoni Markovski for their help on COMI/CoOL and Yang.
</t>
</section>


</middle>
<back>

    <references title="Normative References">

	  &schc; 
	  &corecool; 
  
    </references>

   <section anchor="chap-full-model" title="Yang Model">
     <t>
<figure anchor="Fig-full-model"
title="Yang definition of the IPv6 UDP compression"><artwork><![CDATA[
          
     
 module LPWA-compression {

	namespace "http://ackl.io/compression";

	
	prefix "lpwa";

	import ietf-inet-types {
			prefix inet;
	}
	
	description 
		"Data model to compress headers on 6LPWA";
		
	revision 2016-06-01 {
		description "This module describes the context store in End-System (LC) and LPWA Compressor (LC). ";
	}

	typedef LPWA-types {
		type union {
			type uint8;
			type uint16;
			type uint32;
			type uint64;
			type inet:ipv6-prefix; // better use int64, more comptact ?
			type string; 
		}
	}
	
	typedef LPWA-action-functions {
		type enumeration {
         enum elided;   
         enum send-value;
         enum compute-IPv6-length;
         enum compute-UDP-length;
         enum compute-UDP-checksum;
         enum ESiid-DID;
         enum LAiid-DID;
		}
	}
	
	grouping matching-operator {
		leaf operator {
			type enumeration {
			enum operator-equal;
			enum operator-lsb;
			enum operator-ignore;
			}
		}
		choice operator-lsb {
			leaf lsb-length {
				type LPWA-types;
			}
		}
		
	}

	grouping field-context {
		leaf field-name {
			type string;
		}
		leaf field-pos {
			type int8;
		}
		leaf field-value {
			type LPWA-types; 
		}	
		container field-compression-match {
			uses matching-operator;
		}
		container field-decompression-match {
			uses matching-operator;
		}
		leaf action-function {
			type LPWA-action-functions;
		}	
	}	

	container generic-rules {
		leaf context-name {
			type string;
		}
		list context-rules {
		    key rule-id;
		    
			leaf rule-name {
				type string;
			}
			leaf rule-id {
				type int8;
			}
			list rule-fields {
			    key field-pos;
				uses field-context;
			}
		}
	
	}

	container IPv6-UDP-rules {
		leaf context-name {
			type string;
		}
		list context-rules {
		    key rule-id;
		    
			leaf rule-name {
				type string;
			}
			leaf rule-id {
				type int8;
			}
			container shim-id {
				uses field-context {
					refine field-name {
						default "shim identifier";
					}
					refine field-pos {
						default 0;
					}
					refine field-value {
						default 0;
					}
				}	
			}
			container ES-device-id {
				uses field-context {
					refine field-name {
						default "End System device identifier";
					}
					refine field-pos {
						default 1;
					}
					refine field-value {
						default 0;
					}
				}	
			}
			container ipv6-version {
				uses field-context {
					refine field-name {
						default "IPv6 Version";
					}
					refine field-pos {
						default 2;
					}
					refine field-value {
						default 6;
					}
				}	
			}
			container ipv6-diffserv {
				uses field-context {
					refine field-name {
						default "IPv6 Diffserv";
					}
					refine field-pos {
						default 3;
					}
					refine field-value {
						default 0;
					}
				}	
			}
			container ipv6-flow-label {
				uses field-context {
					refine field-name {
						default "IPv6 Flow Label";
					}
					refine field-pos {
						default 4;
					}
					refine field-value {
						default 0;
					}
				}	
			}
			container ipv6-length {
				uses field-context {
					refine field-name {
						default "IPv6 length";
					}
					refine field-pos {
						default 5;
					}
				}	
			}
			container ipv6-next-header {
				uses field-context {
					refine field-name {
						default "IPv6 next header";
					}
					refine field-pos {
						default 6;
					}
					refine field-value {
						default 17;
					}
				}
			}
			container ipv6-hop-limit {
				uses field-context {
					refine field-name {
						default "IPv6 Hop Limit";
					}
					refine field-pos {
						default 7;
					}
					refine field-value {
						default 17;
					}
				}
			}
			container ipv6-ES-prefix {
				uses field-context {
					refine field-name {
						default "IPv6 ES Prefix";
					}
					refine field-pos {
						default 8;
					}
				}
			}
			container ipv6-ES-iid {
				uses field-context {
					refine field-name {
						default "IPv6 ES Interface ID";
					}
					refine field-pos {
						default 9;
					}
				}
			}
			container ipv6-LC-prefix {
				uses field-context {
					refine field-name {
						default "IPv6 LC Prefix";
					}
					refine field-pos {
						default 10;
					}
				}
			}
			container ipv6-LC-iid {
				uses field-context {
					refine field-name {
						default "IPv6 LC Interface ID";
					}
					refine field-pos {
						default 11;
					}
				}
			}			
			
			container udp-ES-port {
				uses field-context {
					refine field-name {
						default "UDP ES port";
					}
					refine field-pos {
						default 12;
					}
				}
			}			
			container udp-LC-port {
				uses field-context {
					refine field-name {
						default "UDP LC port";
					}
					refine field-pos {
						default 13;
					}
				}
			}				
			
		}
	
	}
}    
]]></artwork></figure>

     </t>
   </section>


</back>

</rfc>
