Internet-Draft | LPWAN SCHC YANG module | November 2021 |
Minaburo & Toutain | Expires 28 May 2022 | [Page] |
This document describes a YANG data model for the SCHC (Static Context Header Compression) compression and fragmentation rules.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 28 May 2022.¶
Copyright (c) 2021 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
SCHC is a compression and fragmentation mechanism for constrained networks defined in [RFC8724]. It is based on a static context shared by two entities at the boundary of the constrained network. [RFC8724] provides a non formal representation of the rules used either for compression/decompression (or C/D) or fragmentation/reassembly (or F/R). The goal of this document is to formalize the description of the rules to offer:¶
This document defines a YANG module to represent both compression and fragmentation rules, which leads to common representation for values for all the rules elements.¶
SCHC compression is generic, the main mechanism does not refer to a specific protocol. Any header field is abstracted through an ID, a position, a direction, and a value that can be a numerical value or a string. [RFC8724] and [RFC8824] specify fields for IPv6, UDP, CoAP and OSCORE.¶
SCHC fragmentation requires a set of common parameters that are included in a rule. These parameters are defined in [RFC8724].¶
[RFC8724] proposes a non formal representation of the compression rule. A compression context for a device is composed of a set of rules. Each rule contains information to describe a specific field in the header to be compressed.¶
+-----------------------------------------------------------------+ | Rule N | +-----------------------------------------------------------------+| | Rule i || +-----------------------------------------------------------------+|| | (FID) Rule 1 ||| |+-------+--+--+--+------------+-----------------+---------------+||| ||Field 1|FL|FP|DI|Target Value|Matching Operator|Comp/Decomp Act|||| |+-------+--+--+--+------------+-----------------+---------------+||| ||Field 2|FL|FP|DI|Target Value|Matching Operator|Comp/Decomp Act|||| |+-------+--+--+--+------------+-----------------+---------------+||| ||... |..|..|..| ... | ... | ... |||| |+-------+--+--+--+------------+-----------------+---------------+||/ ||Field N|FL|FP|DI|Target Value|Matching Operator|Comp/Decomp Act||| |+-------+--+--+--+------------+-----------------+---------------+|/ | | \-----------------------------------------------------------------/
Identifier used in the SCHC YANG Data Model are from the identityref statement to ensure to be globally unique and be easily augmented if needed. The principle to define a new type based on a group of identityref is the following:¶
The example (Figure 2) shows how an identityref is created for RCS algorithms used during SCHC fragmentation.¶
// -- RCS algorithm types identity rcs-algorithm-base-type { description "Identify which algorithm is used to compute RSC. The algorithm also defines the size if the RSC field."; } identity rcs-RFC8724 { base rcs-algorithm-base-type; description "CRC 32 defined as default RCS in RFC8724."; } typedef rcs-algorithm-type { type identityref { base rcs-algorithm-base-type; } description "type used in rules"; }
In the process of compression, the headers of the original packet are first parsed to create a list of fields. This list of fields is matched against the rules to find the appropriate rule and apply compression. [RFC8724] do not state how the field ID value can be constructed. In examples, identification is done through a string indexed by the protocol name (e.g. IPv6.version, CoAP.version,...).¶
The current YANG Data Model includes fields definitions found in [RFC8724], [RFC8824].¶
Using the YANG model, each field MUST be identified through a global YANG identityref. A YANG field ID for the protocol always derives from the fid-base-type. Then an identity for each protocol is specified using the naming convention fid-<<protocol name>>-base-type. All possible fields for this protocol MUST derive from the protocol identity. The naming convention is "fid" followed by the protocol name and the field name. If a field has to be divided into sub-fields, the field identity serves as a base.¶
The full field-id definition is found in Section 7. The example Figure 3 gives the first field ID definitions. A type is defined for IPv6 protocol, and each field is based on it. Note that the DiffServ bits derives from the Traffic Class identity.¶
identity fid-base-type { description "Field ID base type for all fields"; } identity fid-ipv6-base-type { base fid-base-type; description "Field IP base type for IPv6 headers described in RFC 8200"; } identity fid-ipv6-version { base fid-ipv6-base-type; description "IPv6 version field from RFC8200"; } identity fid-ipv6-trafficclass { base fid-ipv6-base-type; description "IPv6 Traffic Class field from RFC8200"; } identity fid-ipv6-trafficclass-ds { base fid-ipv6-trafficclass; description "IPv6 Traffic Class field from RFC8200, DiffServ field from RFC3168"; } ...
The type associated to this identity is fid-type (cf. Figure 4)¶
typedef fid-type { type identityref { base fid-base-type; } description "Field ID generic type."; }
Field length is either an integer giving the size of a field in bits or a specific function. [RFC8724] defines the "var" function which allows variable length fields in byte and [RFC8824] defines the "tkl" function for managing the CoAP Token length field.¶
The naming convention is "fl" followed by the function name.¶
identity fl-base-type { description "Used to extend field length functions."; } identity fl-variable { base fl-base-type; description "Residue length in Byte is sent as defined in for CoAP in RFC 8824 (cf. 5.3)."; } identity fl-token-length { base fl-base-type; description "Residue length in Byte is sent as defined in for CoAP in RFC 8824 (cf. 4.5)."; }
Field ID, field length function can be defined as an identityref as shown in Figure 5.¶
Therefore, the type for field length is a union between an integer giving in bits the size of the length and the identityref (cf. Figure 6).¶
typedef fl-type { type union { type int64; /* positive length in bits */ type identityref { /* function */ base fl-base-type; } } description "Field length either a positive integer giving the size in bits or a function defined through an identityref."; }
Field position is a positive integer which gives the position of a field, the default value is 1, and incremented at each repetition. value 0 indicates that the position is not important and is not considered during the rule selection process.¶
Field position is a positive integer. The type is an uint8.¶
The Direction Indicator (di) is used to tell if a field appears in both direction (Bi) or only uplink (Up) or Downlink (Dw).¶
identity di-base-type { description "Used to extend direction indicators."; } identity di-bidirectional { base di-base-type; description "Direction Indication of bi directionality in RFC 8724 (cf. 7.1)."; } identity di-up { base di-base-type; description "Direction Indication of upstream defined in RFC 8724 (cf. 7.1)."; } identity di-down { base di-base-type; description "Direction Indication of downstream defined in RFC 8724 (cf. 7.1)."; }
Figure 7 gives the identityref for Direction Indicators. The naming convention is "di" followed by the Direction Indicator name.¶
The type is "di-type" (cf. Figure 8).¶
typedef di-type { type identityref { base di-base-type; } description "Direction in LPWAN network, up when emitted by the device, down when received by the device, bi when emitted or received by the device."; }
The Target Value is a list of binary sequences of any length, aligned on the left. Figure 9 gives the definition of a single element of a Target Value. In the rule, this will be used as a list, with position as a key. The highest position value is used to compute the size of the index sent in residue for LSB CDA. The position allows to specify several values:¶
grouping tv-struct { description "Define the target value element. Always a binary type, strings must be converted to binary. field-id allows the conversion to the appropriate type."; leaf value { type binary; description "Target Value"; } leaf position { type uint16; description "If only one element position is 0, otherwise position is the the position in the matching list."; } }
Matching Operator (MO) is a function applied between a field value provided by the parsed header and the target value. [RFC8724] defines 4 MO as listed in Figure 10.¶
identity mo-base-type { description "Used to extend Matching Operators with SID values"; } identity mo-equal { base mo-base-type; description "Equal MO as defined RFC 8724 (cf. 7.3)"; } identity mo-ignore { base mo-base-type; description "Ignore MO as defined RFC 8724 (cf. 7.3)"; } identity mo-msb { base mo-base-type; description "MSB MO as defined RFC 8724 (cf. 7.3)"; } identity mo-match-mapping { base mo-base-type; description "match-mapping MO as defined RFC 8724 (cf. 7.3)"; }
The naming convention is "mo" followed by the MO name.¶
The type is "mo-type" (cf. Figure 11)¶
typedef mo-type { type identityref { base mo-base-type; } description "Matching Operator (MO) to compare fields values with target values"; }
They are viewed as a list of tv-struct.¶
Compression Decompression Action (CDA) identified the function to use either for compression or decompression. [RFC8724] defines 6 CDA.¶
Figure 13 gives some CDA definition, the full definition is in Section 7.¶
identity cda-base-type { description "Compression Decompression Actions."; } identity cda-not-sent { base cda-base-type; description "not-sent CDA as defines in RFC 8724 (cf. 7.4)."; } identity cda-value-sent { base cda-base-type; description "value-sent CDA as defines in RFC 8724 (cf. 7.4)."; } identity cda-lsb { base cda-base-type; description "LSB CDA as defines in RFC 8724 (cf. 7.4)."; } identity cda-mapping-sent { base cda-base-type; description "mapping-sent CDA as defines in RFC 8724 (cf. 7.4)."; } ....
The naming convention is "cda" followed by the CDA name.¶
typedef cda-type { type identityref { base cda-base-type; } description "Compression Decompression Action to compression or decompress a field."; }
Currently no CDA requires arguments, but the future some CDA may require several arguments. They are viewed as a list of target-values-type.¶
Fragmentation is optional in the data model and depends on the presence of the "fragmentation" feature.¶
Most of parameters for fragmentation are defined in Annex D of [RFC8724].¶
Since fragmentation rules work for a specific direction, they contain a mandatory direction. The type is the same as the one used in compression entries, but the use of bidirectional is forbidden.¶
[RFC8724] defines 3 fragmentation modes:¶
Figure 14 give the definition for identifiers from these three modes.¶
identity fragmentation-mode-base-type { description "fragmentation mode."; } identity fragmentation-mode-no-ack { base fragmentation-mode-base-type; description "No Ack of RFC 8724."; } identity fragmentation-mode-ack-always { base fragmentation-mode-base-type; description "Ack Always of RFC8724."; } identity fragmentation-mode-ack-on-error { base fragmentation-mode-base-type; description "Ack on Error of RFC8724."; } typedef fragmentation-mode-type { type identityref { base fragmentation-mode-base-type; } description "type used in rules"; }
The naming convention is "fragmentation-mode" followed by the fragmentation mode name.¶
A data fragment header, directly following the rule ID can be sent on the fragmentation direction. The direction is mandatory and must be up or down. bidirectional is forbidden. The SCHC header may be composed of (cf. Figure 15):¶
|-- SCHC Fragment Header ----| |-- T --|-M-|-- N --| +-- ... -+- ... -+---+- ... -+--------...-------+~~~~~~~~~~~~~~~~~~~~ | RuleID | DTag | W | FCN | Fragment Payload | padding (as needed) +-- ... -+- ... -+---+- ... -+--------...-------+~~~~~~~~~~~~~~~~~~~~
The last fragment of a datagram is sent with an RCS (Reassembly Check Sequence) field to detect residual transmission error and possible losses in the last window. [RFC8724] defines a single algorithm based on Ethernet CRC computation. The identity of the RCS algorithm is shown in Figure 16.¶
// -- RCS algorithm types identity rcs-algorithm-base-type { description "Identify which algorithm is used to compute RSC. The algorithm also defines the size if the RSC field."; } identity rcs-RFC8724 { base rcs-algorithm-base-type; description "CRC 32 defined as default RCS in RFC8724."; } typedef rcs-algorithm-type { type identityref { base rcs-algorithm-base-type; } description "type used in rules."; }
The naming convention is "rcs" followed by the algorithm name.¶
For Ack-on-Error mode, the All-1 fragment may just contain the RCS or can include a tile. The parameters defined in Figure 17 allows to define the behavior:¶
// -- All1 with data types identity all1-data-base-type { description "Type to define when to send an Acknowledgment message."; } identity all1-data-no { base all1-data-base-type; description "All1 contains no tiles."; } identity all1-data-yes { base all1-data-base-type; description "All1 MUST contain a tile."; } identity all1-data-sender-choice { base all1-data-base-type; description "Fragmentation process choose to send tiles or not in all1."; } typedef all1-data-type { type identityref { base all1-data-base-type; } description "Type used in rules."; }
The naming convention is "all1-data" followed by the behavior identifier.¶
A cknowledgment fragment header goes in the opposite direction of data. The header is composed of (see Figure 18):¶
NOTE: IN THE DATA MODEL THERE IS A max-window-size FIELD TO LIMIT THE BITMAP SIZE, BUT IS NO MORE IN RFC8724! DO WE KEEP IT?¶
|--- SCHC ACK Header ----| |-- T --|-M-| 1 | +-- ... -+- ... -+---+---+~~~~~~~~~~~~~~~~~~ | RuleID | DTag | W |C=1| padding as needed (success) +-- ... -+- ... -+---+---+~~~~~~~~~~~~~~~~~~ +-- ... -+- ... -+---+---+------ ... ------+~~~~~~~~~~~~~~~ | RuleID | DTag | W |C=0|Compressed Bitmap| pad. as needed (failure) +-- ... -+- ... -+---+---+------ ... ------+~~~~~~~~~~~~~~~
For Ack-on-Error, SCHC defined when acknowledgment can be sent. This can be at any time defined by the layer 2, at the end of a window (FCN All-0) or at the end of the fragment (FCN All-1). The following identifiers (cf. Figure 19) define the acknowledgment behavior.¶
// -- Ack behavior identity ack-behavior-base-type { description "Define when to send an Acknowledgment ."; } identity ack-behavior-after-All0 { base ack-behavior-base-type; description "Fragmentation expects Ack after sending All0 fragment."; } identity ack-behavior-after-All1 { base ack-behavior-base-type; description "Fragmentation expects Ack after sending All1 fragment."; } identity ack-behavior-always { base ack-behavior-base-type; description "Fragmentation expects Ack after sending every fragment."; } typedef ack-behavior-type { type identityref { base ack-behavior-base-type; } description "Type used in rules."; }
The naming convention is "ack-behavior" followed by the algorithm name.¶
The state machine requires some common values to handle fragmentation:¶
The data model includes two parameters needed for fragmentation:¶
A rule is either a C/D or an F/R rule. A rule is identified by the rule ID value and its associated length. The YANG grouping rule-id-type defines the structure used to represent a rule ID. Length of 0 is allowed to represent an implicit rule.¶
Three types of rules are defined in [RFC8724]:¶
grouping rule-id-type { leaf rule-id-value { type uint32; description "Rule ID value, this value must be unique combined with the length."; } leaf rule-id-length { type uint8 { range "0..32"; } description "Rule ID length in bits, value 0 is for implicit rules."; } description "A rule ID is composed of a value and a length in bit."; } // SCHC table for a specific device. container schc { list rule { key "rule-id-value rule-id-length"; uses rule-id-type; choice nature { case fragmentation { //if-feature "fragmentation"; uses fragmentation-content; } case compression { uses compression-content; } case no-compression { description "RFC8724 allows a rule for uncompressed headers."; } description "A rule is either for compression, no compression or fragmentation."; } description "Set of rules compression, no compression or fragmentation rules identified by their rule-id."; } description "a SCHC set of rules is composed of a list of rule which are either compression or fragmentation."; } }
To access to a specific rule, rule-id and its specific length is used as a key. The rule is either a compression or a fragmentation rule.¶
Each context can be identified though a version id.¶
A compression rule is composed of entries describing its processing (cf. Figure 21). An entry contains all the information defined in Figure 1 with the types defined above.¶
The compression rule described Figure 1 is defined by compression-content. It defines a list of compression-rule-entry, indexed by their field id, position and direction. The compression-rule-entry element represent a line of the table Figure 1. Their type reflects the identifier types defined in Section 2.1¶
Some controls are made on the values:¶
grouping compression-rule-entry { description "These entries defines a compression entry (i.e. a line) as defined in RFC 8724 and fragmentation parameters. +-------+--+--+--+------------+-----------------+---------------+ |Field 1|FL|FP|DI|Target Value|Matching Operator|Comp/Decomp Act| +-------+--+--+--+------------+-----------------+---------------+ An entry in a compression rule is composed of 7 elements: - Field ID: The header field to be compressed. The content is a YANG identifer. - Field Length : either a positive integer of a function defined as a YANF id. - Field Position: a positive (and possibly equal to 0) integer. - Direction Indicator: a YANG identifier giving the direction. - Target value: a value against which the header Field is compared. - Matching Operator: a YANG id giving the operation, paramters may be associated to that operator. - Comp./Decomp. Action: A YANG id giving the compression or decompression action, paramters may be associated to that action. "; leaf field-id { type schc:fid-type; mandatory true; description "Field ID, identify a field in the header with a YANG referenceid."; } leaf field-length { type schc:fl-type; mandatory true; description "Field Length in bit or through a function defined as a YANG referenceid."; } leaf field-position { type uint8; mandatory true; description "Field position in the header is a integer. If the field is not repeated in the header the value is 1, and incremented for each repetition of the field. Position 0 means that the position is not important and order may change when decompressed"; } leaf direction-indicator { type schc:di-type; mandatory true; description "Direction Indicator, a YANG referenceid to say if the packet is bidirectional, up or down"; } list target-value { key "position"; uses tv-struct; description "A list of value to compare with the header field value. If target value is a singleton, position must be 0. For matching-list, should be consecutive position values starting from 1."; } leaf matching-operator { type schc:mo-type; must "../target-value or derived-from-or-self(., 'mo-ignore')" { error-message "mo-equal, mo-msb and mo-match-mapping need target-value"; description "target-value is not required for mo-ignore"; } must "not (derived-from-or-self(., 'mo-msb')) or ../matching-operator-value" { error-message "mo-msb requires length value"; } mandatory true; description "MO: Matching Operator"; } list matching-operator-value { key "position"; uses tv-struct; description "Matching Operator Arguments, based on TV structure to allow several arguments. In RFC 8724, only MSB define a single argument: length in bits"; } leaf comp-decomp-action { type schc:cda-type; mandatory true; description "CDA: Compression Decompression Action."; } list comp-decomp-action-value { key "position"; uses tv-struct; description "CDA Arguments, based on TV structure to allow several arguments. In RFC 8724, no argument is defined for CDA."; } } grouping compression-content { list entry { key "field-id field-position direction-indicator"; uses compression-rule-entry; description "A compression rule is a list of rule entry describing each header field. An entry is identifed through a field-id, its position in the packet and its direction."; } description "Define a compression rule composed of a list of entries."; }
A Fragmentation rule is composed of entries describing the protocol behavior. Some on them are numerical entries, others are identifiers defined in Section 2.10.¶
The data model defines some relations between the entries:¶
grouping fragmentation-content { description "This grouping defines the fragmentation parameters for all the modes (No Ack, Ack Always and Ack on Error) specified in RFC 8724."; leaf l2-word-size { type uint8; default "8"; description "Size in bit of the layer 2 word"; } leaf direction { type schc:di-type; must "derived-from-or-self(., 'di-up') or derived-from-or-self(., 'di-down')" { error-message "direction for fragmentation rules are up or down."; } mandatory true; description "Should be up or down, bi directionnal is forbiden."; } leaf dtag-size { type uint8; default "0"; description "Size in bit of the DTag field (T variable from RFC8724)."; } leaf w-size { when "not(derived-from(../fragmentation-mode, 'fragmentation-mode-no-ack'))"; type uint8; description "Size in bit of the window field (M variable from RFC8724)."; } leaf fcn-size { type uint8; mandatory true; description "Size in bit of the FCN field (M variable from RFC8724)."; } leaf rcs-algorithm { type rcs-algorithm-type; default "schc:rcs-RFC8724"; description "Algoritm used for RCS"; } leaf maximum-window-size { type uint16; description "By default 2^wsize - 1"; } leaf retransmission-timer { type uint64 { range "1..max"; } description "Duration in seconds of the retransmission timer."; } leaf inactivity-timer { type uint64; description "Duration is seconds of the inactivity timer, 0 indicates the timer is disabled."; } leaf max-ack-requests { type uint8 { range "1..max"; } description "The maximum number of retries for a specific SCHC ACK."; } leaf maximum-packet-size { type uint16; default "1280"; description "When decompression is done, packet size must not strictly exceed this limit in Bytes."; } leaf fragmentation-mode { type schc:fragmentation-mode-type; mandatory true; description "which fragmentation mode is used (noAck, AckAlways, AckonError)"; } choice mode { case no-ack; case ack-always; case ack-on-error { leaf tile-size { when "derived-from(../fragmentation-mode, 'fragmentation-mode-ack-on-error')"; type uint8; description "Size in bit of tiles, if not specified or set to 0, tile fills the fragment."; } leaf tile-in-All1 { when "derived-from(../fragmentation-mode, 'fragmentation-mode-ack-on-error')"; type schc:all1-data-type; description "When true, sender and receiver except a tile in All-1 frag."; } leaf ack-behavior { when "derived-from(../fragmentation-mode, 'fragmentation-mode-ack-on-error')"; type schc:ack-behavior-type; description "Sender behavior to acknowledge, after All-0, All-1 or when the LPWAN allows it (Always)."; } } description "RFC 8724 defines 3 fragmentation modes."; } }¶
module: ietf-schc +--rw schc +--rw rule* [rule-id-value rule-id-length] +--rw rule-id-value uint32 +--rw rule-id-length uint8 +--rw (nature)? +--:(fragmentation) | +--rw l2-word-size? uint8 | +--rw direction schc:di-type | +--rw dtag-size? uint8 | +--rw w-size? uint8 | +--rw fcn-size uint8 | +--rw rcs-algorithm? rcs-algorithm-type | +--rw maximum-window-size? uint16 | +--rw retransmission-timer? uint64 | +--rw inactivity-timer? uint64 | +--rw max-ack-requests? uint8 | +--rw maximum-packet-size? uint16 | +--rw fragmentation-mode schc:fragmentation-mode-type | +--rw (mode)? | +--:(no-ack) | +--:(ack-always) | +--:(ack-on-error) | +--rw tile-size? uint8 | +--rw tile-in-All1? schc:all1-data-type | +--rw ack-behavior? schc:ack-behavior-type +--:(compression) | +--rw entry* [field-id field-position direction-indicator] | +--rw field-id schc:fid-type | +--rw field-length schc:fl-type | +--rw field-position uint8 | +--rw direction-indicator schc:di-type | +--rw target-value* [position] | | +--rw value? binary | | +--rw position uint16 | +--rw matching-operator schc:mo-type | +--rw matching-operator-value* [position] | | +--rw value? binary | | +--rw position uint16 | +--rw comp-decomp-action schc:cda-type | +--rw comp-decomp-action-value* [position] | +--rw value? binary | +--rw position uint16 +--:(no-compression)
This document has no request to IANA.¶
This document does not have any more Security consideration than the ones already raised on [RFC8724]¶
The authors would like to thank Dominique Barthel, Carsten Bormann, Alexander Pelov.¶
<code begins> file ietf-schc@2021-11-10.yang module ietf-schc { yang-version 1.1; namespace "urn:ietf:params:xml:ns:yang:ietf-schc"; prefix schc; organization "IETF IPv6 over Low Power Wide-Area Networks (lpwan) working group"; contact "WG Web: <https://datatracker.ietf.org/wg/lpwan/about/> WG List: <mailto:p-wan@ietf.org> Editor: Laurent Toutain <mailto:laurent.toutain@imt-atlantique.fr> Editor: Ana Minaburo <mailto:ana@ackl.io>"; description " Copyright (c) 2021 IETF Trust and the persons identified as authors of the code. All rights reserved. Redistribution and use in source and binary forms, with or without modification, is permitted pursuant to, and subject to the license terms contained in, the Simplified BSD License set forth in Section 4.c of the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info). This version of this YANG module is part of RFC XXXX (https://www.rfc-editor.org/info/rfcXXXX); see the RFC itself for full legal notices. 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 (RFC 2119) (RFC 8174) when, and only when, they appear in all capitals, as shown here. ***************************************************************** Generic Data model for Static Context Header Compression Rule for SCHC, based on RFC 8724 and RFC8824. Include compression, no compression and fragmentation rules. This module is a YANG model for SCHC rules (RFc 8724). RFC 8724 describes a rule in a abstract way through a table. |-----------------------------------------------------------------| | (FID) Rule 1 | |+-------+--+--+--+------------+-----------------+---------------+| ||Field 1|FL|FP|DI|Target Value|Matching Operator|Comp/Decomp Act|| |+-------+--+--+--+------------+-----------------+---------------+| ||Field 2|FL|FP|DI|Target Value|Matching Operator|Comp/Decomp Act|| |+-------+--+--+--+------------+-----------------+---------------+| ||... |..|..|..| ... | ... | ... || |+-------+--+--+--+------------+-----------------+---------------+| ||Field N|FL|FP|DI|Target Value|Matching Operator|Comp/Decomp Act|| +-------+--+--+--+------------+-----------------+---------------+|| |-----------------------------------------------------------------| This module proposes a global data model that can be used for rule exchanges or modification. It proposes both the data model format and the global identifiers used to describes some operations in fields. This data model applies both to compression and fragmentation."; revision 2021-11-10 { description "Initial version from RFC XXXX "; reference "RFC XXX: Data Model for Static Context Header Compression (SCHC)"; } feature fragmentation { description "Fragmentation is usually required only at the transportation level."; } // ------------------------- // Field ID type definition //-------------------------- // generic value TV definition identity fid-base-type { description "Field ID base type for all fields"; } identity fid-ipv6-base-type { base fid-base-type; description "Field IP base type for IPv6 headers described in RFC 8200"; } identity fid-ipv6-version { base fid-ipv6-base-type; description "IPv6 version field from RFC8200"; } identity fid-ipv6-trafficclass { base fid-ipv6-base-type; description "IPv6 Traffic Class field from RFC8200"; } identity fid-ipv6-trafficclass-ds { base fid-ipv6-trafficclass; description "IPv6 Traffic Class field from RFC8200, DiffServ field from RFC3168"; } identity fid-ipv6-trafficclass-ecn { base fid-ipv6-trafficclass; description "IPv6 Traffic Class field from RFC8200, ECN field from RFC3168"; } identity fid-ipv6-flowlabel { base fid-ipv6-base-type; description "IPv6 Flow Label field from RFC8200"; } identity fid-ipv6-payloadlength { base fid-ipv6-base-type; description "IPv6 Payload Length field from RFC8200"; } identity fid-ipv6-nextheader { base fid-ipv6-base-type; description "IPv6 Next Header field from RFC8200"; } identity fid-ipv6-hoplimit { base fid-ipv6-base-type; description "IPv6 Next Header field from RFC8200"; } identity fid-ipv6-devprefix { base fid-ipv6-base-type; description "correspond either to the source address or the desdination address prefix of RFC 8200. Depending if it is respectively a uplink or an downklink message."; } identity fid-ipv6-deviid { base fid-ipv6-base-type; description "correspond either to the source address or the desdination address prefix of RFC 8200. Depending if it is respectively a uplink or an downklink message."; } identity fid-ipv6-appprefix { base fid-ipv6-base-type; description "correspond either to the source address or the desdination address prefix of RFC 768. Depending if it is respectively a downlink or an uplink message."; } identity fid-ipv6-appiid { base fid-ipv6-base-type; description "correspond either to the source address or the desdination address prefix of RFC 768. Depending if it is respectively a downlink or an uplink message."; } identity fid-udp-base-type { base fid-base-type; description "Field IP base type for UDP headers described in RFC 768"; } identity fid-udp-dev-port { base fid-udp-base-type; description "UDP length from RFC 768"; } identity fid-udp-app-port { base fid-udp-base-type; description "UDP length from RFC 768"; } identity fid-udp-length { base fid-udp-base-type; description "UDP length from RFC 768"; } identity fid-udp-checksum { base fid-udp-base-type; description "UDP length from RFC 768"; } identity fid-coap-base-type { base fid-base-type; description "Field IP base type for UDP headers described in RFC 768"; } identity fid-coap-version { base fid-coap-base-type; description "CoAP version from RFC 7252"; } identity fid-coap-type { base fid-coap-base-type; description "CoAP type from RFC 7252"; } identity fid-coap-tkl { base fid-coap-base-type; description "CoAP token length from RFC 7252"; } identity fid-coap-code { base fid-coap-base-type; description "CoAP code from RFC 7252"; } identity fid-coap-code-class { base fid-coap-code; description "CoAP code class from RFC 7252"; } identity fid-coap-code-detail { base fid-coap-code; description "CoAP code detail from RFC 7252"; } identity fid-coap-mid { base fid-coap-base-type; description "CoAP message ID from RFC 7252"; } identity fid-coap-token { base fid-coap-base-type; description "CoAP token from RFC 7252"; } identity fid-coap-option-if-match { base fid-coap-base-type; description "CoAP option If-Match from RFC 7252"; } identity fid-coap-option-uri-host { base fid-coap-base-type; description "CoAP option URI-Host from RFC 7252"; } identity fid-coap-option-etag { base fid-coap-base-type; description "CoAP option Etag from RFC 7252"; } identity fid-coap-option-if-none-match { base fid-coap-base-type; description "CoAP option if-none-match from RFC 7252"; } identity fid-coap-option-observe { base fid-coap-base-type; description "CoAP option Observe from RFC 7641"; } identity fid-coap-option-uri-port { base fid-coap-base-type; description "CoAP option Uri-Port from RFC 7252"; } identity fid-coap-option-location-path { base fid-coap-base-type; description "CoAP option Location-Path from RFC 7252"; } identity fid-coap-option-uri-path { base fid-coap-base-type; description "CoAP option Uri-Path from RFC 7252"; } identity fid-coap-option-content-format { base fid-coap-base-type; description "CoAP option Content Format from RFC 7252"; } identity fid-coap-option-max-age { base fid-coap-base-type; description "CoAP option Max-Age from RFC 7252"; } identity fid-coap-option-uri-query { base fid-coap-base-type; description "CoAP option Uri-Query from RFC 7252"; } identity fid-coap-option-accept { base fid-coap-base-type; description "CoAP option Max-Age from RFC 7252"; } identity fid-coap-option-location-query { base fid-coap-base-type; description "CoAP option Location-Query from RFC 7252"; } identity fid-coap-option-block2 { base fid-coap-base-type; description "CoAP option Block2 from RFC 7959"; } identity fid-coap-option-block1 { base fid-coap-base-type; description "CoAP option Block1 from RFC 7959"; } identity fid-coap-option-size2 { base fid-coap-base-type; description "CoAP option size2 from RFC 7959"; } identity fid-coap-option-proxy-uri { base fid-coap-base-type; description "CoAP option Proxy-Uri from RFC 7252"; } identity fid-coap-option-proxy-scheme { base fid-coap-base-type; description "CoAP option Proxy-scheme from RFC 7252"; } identity fid-coap-option-size1 { base fid-coap-base-type; description "CoAP option Size1 from RFC 7252"; } identity fid-coap-option-no-response { base fid-coap-base-type; description "CoAP option No response from RFC 7967"; } identity fid-coap-option-oscore-flags { base fid-coap-base-type; description "CoAP option oscore flags (see draft schc coap, section 6.4)"; } identity fid-coap-option-oscore-piv { base fid-coap-base-type; description "CoAP option oscore flags (see draft schc coap, section 6.4)"; } identity fid-coap-option-oscore-kid { base fid-coap-base-type; description "CoAP option oscore flags (see draft schc coap, section 6.4)"; } identity fid-coap-option-oscore-kidctx { base fid-coap-base-type; description "CoAP option oscore flags (see draft schc coap, section 6.4)"; } //---------------------------------- // Field Length type definition //---------------------------------- identity fl-base-type { description "Used to extend field length functions."; } identity fl-variable { base fl-base-type; description "Residue length in Byte is sent as defined in for CoAP in RFC 8824 (cf. 5.3)."; } identity fl-token-length { base fl-base-type; description "Residue length in Byte is sent as defined in for CoAP in RFC 8824 (cf. 4.5)."; } //--------------------------------- // Direction Indicator type //--------------------------------- identity di-base-type { description "Used to extend direction indicators."; } identity di-bidirectional { base di-base-type; description "Direction Indication of bi directionality in RFC 8724 (cf. 7.1)."; } identity di-up { base di-base-type; description "Direction Indication of upstream defined in RFC 8724 (cf. 7.1)."; } identity di-down { base di-base-type; description "Direction Indication of downstream defined in RFC 8724 (cf. 7.1)."; } //---------------------------------- // Matching Operator type definition //---------------------------------- identity mo-base-type { description "Used to extend Matching Operators with SID values"; } identity mo-equal { base mo-base-type; description "Equal MO as defined RFC 8724 (cf. 7.3)"; } identity mo-ignore { base mo-base-type; description "Ignore MO as defined RFC 8724 (cf. 7.3)"; } identity mo-msb { base mo-base-type; description "MSB MO as defined RFC 8724 (cf. 7.3)"; } identity mo-match-mapping { base mo-base-type; description "match-mapping MO as defined RFC 8724 (cf. 7.3)"; } //------------------------------ // CDA type definition //------------------------------ identity cda-base-type { description "Compression Decompression Actions."; } identity cda-not-sent { base cda-base-type; description "not-sent CDA as defines in RFC 8724 (cf. 7.4)."; } identity cda-value-sent { base cda-base-type; description "value-sent CDA as defines in RFC 8724 (cf. 7.4)."; } identity cda-lsb { base cda-base-type; description "LSB CDA as defines in RFC 8724 (cf. 7.4)."; } identity cda-mapping-sent { base cda-base-type; description "mapping-sent CDA as defines in RFC 8724 (cf. 7.4)."; } identity cda-compute-length { base cda-base-type; description "compute-length CDA as defines in RFC 8724 (cf. 7.4)"; } identity cda-compute-checksum { base cda-base-type; description "compute-checksum CDA as defines in RFC 8724 (cf. 7.4)"; } identity cda-deviid { base cda-base-type; description "deviid CDA as defines in RFC 8724 (cf. 7.4)"; } identity cda-appiid { base cda-base-type; description "appiid CDA as defines in RFC 8724 (cf. 7.4)"; } // -- type definition typedef fid-type { type identityref { base fid-base-type; } description "Field ID generic type."; } typedef fl-type { type union { type int64; /* positive length in bits */ type identityref { /* function */ base fl-base-type; } } description "Field length either a positive integer giving the size in bits or a function defined through an identityref."; } typedef di-type { type identityref { base di-base-type; } description "Direction in LPWAN network, up when emitted by the device, down when received by the device, bi when emitted or received by the device."; } typedef mo-type { type identityref { base mo-base-type; } description "Matching Operator (MO) to compare fields values with target values"; } typedef cda-type { type identityref { base cda-base-type; } description "Compression Decompression Action to compression or decompress a field."; } // -- FRAGMENTATION TYPE // -- fragmentation modes identity fragmentation-mode-base-type { description "fragmentation mode."; } identity fragmentation-mode-no-ack { base fragmentation-mode-base-type; description "No Ack of RFC 8724."; } identity fragmentation-mode-ack-always { base fragmentation-mode-base-type; description "Ack Always of RFC8724."; } identity fragmentation-mode-ack-on-error { base fragmentation-mode-base-type; description "Ack on Error of RFC8724."; } typedef fragmentation-mode-type { type identityref { base fragmentation-mode-base-type; } description "type used in rules"; } // -- Ack behavior identity ack-behavior-base-type { description "Define when to send an Acknowledgment ."; } identity ack-behavior-after-All0 { base ack-behavior-base-type; description "Fragmentation expects Ack after sending All0 fragment."; } identity ack-behavior-after-All1 { base ack-behavior-base-type; description "Fragmentation expects Ack after sending All1 fragment."; } identity ack-behavior-always { base ack-behavior-base-type; description "Fragmentation expects Ack after sending every fragment."; } typedef ack-behavior-type { type identityref { base ack-behavior-base-type; } description "Type used in rules."; } // -- All1 with data types identity all1-data-base-type { description "Type to define when to send an Acknowledgment message."; } identity all1-data-no { base all1-data-base-type; description "All1 contains no tiles."; } identity all1-data-yes { base all1-data-base-type; description "All1 MUST contain a tile."; } identity all1-data-sender-choice { base all1-data-base-type; description "Fragmentation process choose to send tiles or not in all1."; } typedef all1-data-type { type identityref { base all1-data-base-type; } description "Type used in rules."; } // -- RCS algorithm types identity rcs-algorithm-base-type { description "Identify which algorithm is used to compute RSC. The algorithm also defines the size if the RSC field."; } identity rcs-RFC8724 { base rcs-algorithm-base-type; description "CRC 32 defined as default RCS in RFC8724."; } typedef rcs-algorithm-type { type identityref { base rcs-algorithm-base-type; } description "type used in rules."; } // -------- RULE ENTRY DEFINITION ------------ grouping tv-struct { description "Define the target value element. Always a binary type, strings must be converted to binary. field-id allows the conversion to the appropriate type."; leaf value { type binary; description "Target Value"; } leaf position { type uint16; description "If only one element position is 0, otherwise position is the the position in the matching list."; } } grouping compression-rule-entry { description "These entries defines a compression entry (i.e. a line) as defined in RFC 8724 and fragmentation parameters. +-------+--+--+--+------------+-----------------+---------------+ |Field 1|FL|FP|DI|Target Value|Matching Operator|Comp/Decomp Act| +-------+--+--+--+------------+-----------------+---------------+ An entry in a compression rule is composed of 7 elements: - Field ID: The header field to be compressed. The content is a YANG identifer. - Field Length : either a positive integer of a function defined as a YANF id. - Field Position: a positive (and possibly equal to 0) integer. - Direction Indicator: a YANG identifier giving the direction. - Target value: a value against which the header Field is compared. - Matching Operator: a YANG id giving the operation, paramters may be associated to that operator. - Comp./Decomp. Action: A YANG id giving the compression or decompression action, paramters may be associated to that action. "; leaf field-id { type schc:fid-type; mandatory true; description "Field ID, identify a field in the header with a YANG referenceid."; } leaf field-length { type schc:fl-type; mandatory true; description "Field Length in bit or through a function defined as a YANG referenceid."; } leaf field-position { type uint8; mandatory true; description "Field position in the header is a integer. If the field is not repeated in the header the value is 1, and incremented for each repetition of the field. Position 0 means that the position is not important and order may change when decompressed"; } leaf direction-indicator { type schc:di-type; mandatory true; description "Direction Indicator, a YANG referenceid to say if the packet is bidirectional, up or down"; } list target-value { key "position"; uses tv-struct; description "A list of value to compare with the header field value. If target value is a singleton, position must be 0. For matching-list, should be consecutive position values starting from 1."; } leaf matching-operator { type schc:mo-type; must "../target-value or derived-from-or-self(., 'mo-ignore')" { error-message "mo-equal, mo-msb and mo-match-mapping need target-value"; description "target-value is not required for mo-ignore"; } must "not (derived-from-or-self(., 'mo-msb')) or ../matching-operator-value" { error-message "mo-msb requires length value"; } mandatory true; description "MO: Matching Operator"; } list matching-operator-value { key "position"; uses tv-struct; description "Matching Operator Arguments, based on TV structure to allow several arguments. In RFC 8724, only MSB define a single argument: length in bits"; } leaf comp-decomp-action { type schc:cda-type; mandatory true; description "CDA: Compression Decompression Action."; } list comp-decomp-action-value { key "position"; uses tv-struct; description "CDA Arguments, based on TV structure to allow several arguments. In RFC 8724, no argument is defined for CDA."; } } grouping compression-content { list entry { key "field-id field-position direction-indicator"; uses compression-rule-entry; description "A compression rule is a list of rule entry describing each header field. An entry is identifed through a field-id, its position in the packet and its direction."; } description "Define a compression rule composed of a list of entries."; } grouping fragmentation-content { description "This grouping defines the fragmentation parameters for all the modes (No Ack, Ack Always and Ack on Error) specified in RFC 8724."; leaf l2-word-size { type uint8; default "8"; description "Size in bit of the layer 2 word"; } leaf direction { type schc:di-type; must "derived-from-or-self(., 'di-up') or derived-from-or-self(., 'di-down')" { error-message "direction for fragmentation rules are up or down."; } mandatory true; description "Should be up or down, bi directionnal is forbiden."; } leaf dtag-size { type uint8; default "0"; description "Size in bit of the DTag field (T variable from RFC8724)."; } leaf w-size { when "not(derived-from(../fragmentation-mode, 'fragmentation-mode-no-ack'))"; type uint8; description "Size in bit of the window field (M variable from RFC8724)."; } leaf fcn-size { type uint8; mandatory true; description "Size in bit of the FCN field (M variable from RFC8724)."; } leaf rcs-algorithm { type rcs-algorithm-type; default "schc:rcs-RFC8724"; description "Algoritm used for RCS"; } leaf maximum-window-size { type uint16; description "By default 2^wsize - 1"; } leaf retransmission-timer { type uint64 { range "1..max"; } description "Duration in seconds of the retransmission timer."; } leaf inactivity-timer { type uint64; description "Duration is seconds of the inactivity timer, 0 indicates the timer is disabled."; } leaf max-ack-requests { type uint8 { range "1..max"; } description "The maximum number of retries for a specific SCHC ACK."; } leaf maximum-packet-size { type uint16; default "1280"; description "When decompression is done, packet size must not strictly exceed this limit in Bytes."; } leaf fragmentation-mode { type schc:fragmentation-mode-type; mandatory true; description "which fragmentation mode is used (noAck, AckAlways, AckonError)"; } choice mode { case no-ack; case ack-always; case ack-on-error { leaf tile-size { when "derived-from(../fragmentation-mode, 'fragmentation-mode-ack-on-error')"; type uint8; description "Size in bit of tiles, if not specified or set to 0, tile fills the fragment."; } leaf tile-in-All1 { when "derived-from(../fragmentation-mode, 'fragmentation-mode-ack-on-error')"; type schc:all1-data-type; description "When true, sender and receiver except a tile in All-1 frag."; } leaf ack-behavior { when "derived-from(../fragmentation-mode, 'fragmentation-mode-ack-on-error')"; type schc:ack-behavior-type; description "Sender behavior to acknowledge, after All-0, All-1 or when the LPWAN allows it (Always)."; } } description "RFC 8724 defines 3 fragmentation modes."; } } // Define rule ID. Rule ID is composed of a RuleID value and a // Rule ID Length grouping rule-id-type { leaf rule-id-value { type uint32; description "Rule ID value, this value must be unique combined with the length."; } leaf rule-id-length { type uint8 { range "0..32"; } description "Rule ID length in bits, value 0 is for implicit rules."; } description "A rule ID is composed of a value and a length in bit."; } // SCHC table for a specific device. container schc { list rule { key "rule-id-value rule-id-length"; uses rule-id-type; choice nature { case fragmentation { //if-feature "fragmentation"; uses fragmentation-content; } case compression { uses compression-content; } case no-compression { description "RFC8724 allows a rule for uncompressed headers."; } description "A rule is either for compression, no compression or fragmentation."; } description "Set of rules compression, no compression or fragmentation rules identified by their rule-id."; } description "a SCHC set of rules is composed of a list of rule which are either compression or fragmentation."; } } <code ends>