Internet-Draft | LPWAN SCHC YANG module | May 2022 |
Minaburo & Toutain | Expires 7 November 2022 | [Page] |
- Workgroup:
- lpwan Working Group
- Internet-Draft:
- draft-ietf-lpwan-schc-yang-data-model-08
- Published:
- Intended Status:
- Standards Track
- Expires:
Data Model for Static Context Header Compression (SCHC)
Abstract
This document describes a YANG data model for the SCHC (Static Context Header Compression) compression and fragmentation rules.¶
Status of This Memo
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 7 November 2022.¶
Copyright Notice
Copyright (c) 2022 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.¶
1. Introduction
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:¶
- the same definition on both ends, even if the internal representation is different.¶
- an update of the other end to set up some specific values (e.g. IPv6 prefix, Destination address,...)¶
- ...¶
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.¶
2. SCHC rules
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:¶
- the same definition on both ends, even if the internal representation is different.¶
- an update of the other end to set up some specific values (e.g. IPv6 prefix, Destination address,...)¶
- ...¶
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].¶
The YANG model allows to select the compression or the fragmentation using the feature command.¶
2.1. Compression Rules
[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.¶
2.2. Identifier generation
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:¶
- define a main identity ending with the keyword base-type.¶
- derive all the identities used in the Data Model from this base type.¶
- create a typedef from this base type.¶
The example (Figure 3) shows how an identityref is created for RCS algorithms used during SCHC fragmentation.¶
2.3. Field Identifier
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] does not state how the field ID value is 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 4 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.¶
The type associated to this identity is fid-type (cf. Figure 5)¶
2.4. Field length
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 (whose length is expressed in bytes) and [RFC8824] defines the "tkl" function for managing the CoAP Token length field.¶
The naming convention is "fl" followed by the function name.¶
The field length function can be defined as an identityref as shown in Figure 6.¶
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 7).¶
2.5. Field position
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.¶
2.6. Direction Indicator
The Direction Indicator (di) is used to tell if a field appears in both direction (Bi) or only uplink (Up) or Downlink (Dw).¶
Figure 8 gives the identityref for Direction Indicators. The naming convention is "di" followed by the Direction Indicator name.¶
The type is "di-type" (cf. Figure 9).¶
2.7. Target Value
The Target Value is a list of binary sequences of any length, aligned to the left. Figure 10 shows the definition of a single element of a Target Value. In the rule, the structure 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 the match-mapping CDA. The position allows to specify several values:¶
- For Equal and LSB, Target Value contains a single element. Therefore, the position is set to 0.¶
- For match-mapping, Target Value can contain several elements. Position values must start from 1 and MUST be contiguous.¶
2.8. Matching Operator
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 11.¶
The naming convention is "mo" followed by the MO name.¶
The type is "mo-type" (cf. Figure 12)¶
2.8.1. Matching Operator arguments
They are viewed as a list, built with a tv-struct (see chapter Section 2.7).¶
2.9. Compression Decompression Actions
Compression Decompression Action (CDA) identifies the function to use for compression or decompression. [RFC8724] defines 6 CDA.¶
Figure 14 shows some CDA definition, the full definition is in Section 7.¶
The naming convention is "cda" followed by the CDA name.¶
2.9.1. Compression Decompression Action arguments
Currently no CDA requires arguments, but in the future some CDA may require one or several arguments. They are viewed as a list, of target-value type.¶
2.10. Fragmentation rule
Fragmentation is optional in the data model and depends on the presence of the "fragmentation" feature.¶
Most of the fragmentation parameters are listed in Annex D of [RFC8724].¶
Since fragmentation rules work for a specific direction, they MUST contain a mandatory direction indicator. The type is the same as the one used in compression entries, but bidirectional MUST NOT be used.¶
2.10.1. Fragmentation mode
[RFC8724] defines 3 fragmentation modes:¶
- No Ack: this mode is unidirectionnal, no acknowledgment is sent back.¶
- Ack Always: each fragmentation window must be explicitly acknowledged before going to the next.¶
- Ack on Error: A window is acknowledged only when the receiver detects some missing fragments.¶
Figure 15 shows the definition for identifiers from these three modes.¶
The naming convention is "fragmentation-mode" followed by the fragmentation mode name.¶
2.10.2. Fragmentation Header
A data fragment header, starting with the rule ID can be sent on the fragmentation direction. The SCHC header may be composed of (cf. Figure 16):¶
- a Datagram Tag (Dtag) identifying the datagram being fragmented if the fragmentation applies concurrently on several datagrams. This field in optional and its length is defined by the rule.¶
- a Window (W) used in Ack-Always and Ack-on-Error modes. In Ack-Always, its size is 1. In Ack-on-Error, it depends on the rule. This field is not needed in No-Ack mode.¶
- a Fragment Compressed Number (FCN) indicating the fragment/tile position on the window. This field is mandatory on all modes defined in [RFC8724], its size is defined by the rule.¶
2.10.3. Last fragment format
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 17.¶
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 18 allows to define the behavior:¶
- all1-data-no: the last fragment contains no data, just the RCS¶
- all1-data-yes: the last fragment includes a single tile and the RCS¶
- all1-data-sender-choice: the last fragment may or may not contain a single tile. The receiver can detect if a tile is present.¶
The naming convention is "all1-data" followed by the behavior identifier.¶
2.10.4. Acknowledgment behavior
The acknowledgment fragment header goes in the opposite direction of data. The header is composed of (see Figure 19):¶
- a Dtag (if present).¶
- a mandatory window as in the data fragment.¶
- a C bit giving the status of RCS validation. In case of failure, a bitmap follows, indicating the received tile.¶
For Ack-on-Error, SCHC defines when an 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 as a response to receiving the last fragment (FCN All-1). The following identifiers (cf. Figure 20) define the acknowledgment behavior.¶
The naming convention is "ack-behavior" followed by the algorithm name.¶
2.10.5. Fragmentation Parameters
The state machine requires some common values to handle fragmentation:¶
- retransmission-timer expresses, in seconds, the duration before sending an ack request (cf. section 8.2.2.4. of [RFC8724]). If specified, value must be higher or equal to 1.¶
- inactivity-timer expresses, in seconds, the duration before aborting a fragmentation session (cf. section 8.2.2.4. of [RFC8724]). The value 0 explicitly indicates that this timer is disabled.¶
- max-ack-requests expresses the number of attempts before aborting (cf. section 8.2.2.4. of [RFC8724]).¶
- maximum-packet-size rexpresses, in bytes, the larger packet size that can be reassembled.¶
2.10.6. Layer 2 parameters
The data model includes two parameters needed for fragmentation:¶
- l2-word-size: [RFC8724] base fragmentation on a layer 2 word which can be of any length. The default value is 8 and correspond to the default value for byte aligned layer 2. A value of 1 will indicate that there is no alignment and no need for padding.¶
- maximum-packet-size: defines the maximum size of a uncompressed datagram. By default, the value is set to 1280 bytes.¶
3. Rule definition
A rule is idenfied by a unique rule identifier (rule ID) comprising both a Rule ID value and a Rule ID length. The YANG grouping rule-id-type defines the structure used to represent a rule ID. A length of 0 is allowed to represent an implicit rule.¶
Three types of rules are defined in [RFC8724]:¶
- Compression: a compression rule is associated with the rule ID.¶
- No compression: this identifies the default rule used to send a packet in extenso when no compression rule was found (see [RFC8724] section 6).¶
- Fragmentation: fragmentation parameters are associated with the rule ID. Fragmentation is optional and feature "fragmentation" should be set.¶
To access a specific rule, the rule ID length and value are used as a key. The rule is either a compression or a fragmentation rule.¶
3.1. Compression rule
A compression rule is composed of entries describing its processing (cf. Figure 22). An entry contains all the information defined in Figure 2 with the types defined above.¶
The compression rule described Figure 2 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 2. Their type reflects the identifier types defined in Section 2.1¶
Some checks are performed on the values:¶
- target value must be present for MO different from ignore.¶
- when MSB MO is specified, the matching-operator-value must be present¶
3.2. Fragmentation rule
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 definition of a Fragmentation rule is divided into three sub-parts:¶
- parameters such as the fragmentation-mode, the l2-word-size and the direction. Since Fragmentation rules are always defined for a specific direction, the value must be either di-up or di-down (di-bidirectional is not allowed).¶
- parameters defining the Fragmentation header format (dtag-size, w-size, fcn-size and rcs-algorithm).¶
- Protocol parameters for timers (inactivity-timer, retransmission-timer) or behavior (maximum-packet-size, max-interleaved-frames, max-ack-requests). If these parameters are specific to a single fragmentation mode, they are grouped in a structure dedicated to that Fragmentation mode. If some parameters can be found in several modes, typically ACK-Always and ACK-on-Error, they are defined in a common part and a when statement indicates which modes are allowed.¶
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 fragmentation-mode { type schc:fragmentation-mode-type; mandatory true; description "which fragmentation mode is used (noAck, AckAlways, AckonError)"; } leaf l2-word-size { type uint8; default "8"; description "Size, in bits, 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, bidirectionnal is forbiden."; } // SCHC Frag header format leaf dtag-size { type uint8; default "0"; description "Size, in bits, of the DTag field (T variable from RFC8724)."; } leaf w-size { when "derived-from(../fragmentation-mode, 'fragmentation-mode-ack-on-error') or derived-from(../fragmentation-mode, 'fragmentation-mode-ack-always') "; type uint8; description "Size, in bits, of the window field (M variable from RFC8724)."; } leaf fcn-size { type uint8; mandatory true; description "Size, in bits, of the FCN field (N variable from RFC8724)."; } leaf rcs-algorithm { type rcs-algorithm-type; default "schc:rcs-RFC8724"; description "Algorithm used for RCS. The algorithm specifies the RCS size"; } // SCHC fragmentation protocol parameters leaf maximum-packet-size { type uint16; default "1280"; description "When decompression is done, packet size must not strictly exceed this limit, expressed in bytes."; } leaf window-size { type uint16; description "By default, if not specified 2^w-size - 1. Should not exceed this value. Possible FCN values are between 0 and window-size - 1."; } leaf max-interleaved-frames { type uint8; default "1"; description "Maximum of simultaneously fragmented frames. Maximum value is 2^dtag-size. All DTAG values can be used, but at most max-interleaved-frames must be active at any time."; } leaf inactivity-timer { type uint64; description "Duration is seconds of the inactivity timer, 0 indicates that the timer is disabled."; } leaf retransmission-timer { when "derived-from(../fragmentation-mode, 'fragmentation-mode-ack-on-error') or derived-from(../fragmentation-mode, 'fragmentation-mode-ack-always') "; type uint64 { range "1..max"; } description "Duration in seconds of the retransmission timer."; } leaf max-ack-requests { when "derived-from(../fragmentation-mode, 'fragmentation-mode-ack-on-error') or derived-from(../fragmentation-mode, 'fragmentation-mode-ack-always') "; type uint8 { range "1..max"; } description "The maximum number of retries for a specific SCHC ACK."; } 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 bits, of tiles. If not specified or set to 0, tiles fill the fragment."; } leaf tile-in-All1 { when "derived-from(../fragmentation-mode, 'fragmentation-mode-ack-on-error')"; type schc:all1-data-type; description "Defines whether the sender and receiver expect a tile in All-1 fragments or not, or if it is left to the sender's choice."; } 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."; } } description "RFC 8724 defines 3 fragmentation modes."; } }¶
4. IANA Considerations
This document has no request to IANA.¶
5. Security considerations
This document does not have any more Security consideration than the ones already raised in [RFC8724] and [RFC8824].¶
6. Acknowledgements
The authors would like to thank Dominique Barthel, Carsten Bormann, Alexander Pelov.¶
8. Normative References
- [RFC8724]
- Minaburo, A., Toutain, L., Gomez, C., Barthel, D., and JC. Zuniga, "SCHC: Generic Framework for Static Context Header Compression and Fragmentation", RFC 8724, DOI 10.17487/RFC8724, , <https://www.rfc-editor.org/info/rfc8724>.
- [RFC8824]
- Minaburo, A., Toutain, L., and R. Andreasen, "Static Context Header Compression (SCHC) for the Constrained Application Protocol (CoAP)", RFC 8824, DOI 10.17487/RFC8824, , <https://www.rfc-editor.org/info/rfc8824>.