idnits 2.17.1 draft-vanderstok-core-yang-lwm2m-00.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- == It seems as if not all pages are separated by form feeds - found 0 form feeds but 21 pages Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 262 has weird spacing: '...ntifier uin...' == Line 490 has weird spacing: '... config false...' == Line 635 has weird spacing: '... config fals...' == Line 793 has weird spacing: '... config false...' == Line 939 has weird spacing: '... action reset...' == The document doesn't use any RFC 2119 keywords, yet seems to have RFC 2119 boilerplate text. -- The document date (October 27, 2016) is 2736 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) ** Obsolete normative reference: RFC 7049 (Obsoleted by RFC 8949) == Outdated reference: A later version (-11) exists of draft-vanderstok-core-comi-09 == Outdated reference: A later version (-20) exists of draft-ietf-core-yang-cbor-02 == Outdated reference: A later version (-18) exists of draft-ietf-netconf-restconf-17 Summary: 2 errors (**), 0 flaws (~~), 11 warnings (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 CoRE P. van der Stok, Ed. 3 Internet-Draft consultant 4 Intended status: Standards Track J. Jimenez 5 Expires: April 30, 2017 Ericsson 6 October 27, 2016 8 Mapping from LWM2M model to CoMI YANG model 9 draft-vanderstok-core-yang-lwm2m-00 11 Abstract 13 This document defines a set of rules to convert a LWM2M xml-based 14 device specification to a YANG MODULE. The invocation of the server 15 executing the converted YANG code makes use of CoMI. The mapping 16 from the original LWM2M URI to the corresponding CoMI URI is 17 presented. 19 Note 21 Discussion and suggestions for improvement are requested, and should 22 be sent to roll@ietf.org. 24 Status of This Memo 26 This Internet-Draft is submitted in full conformance with the 27 provisions of BCP 78 and BCP 79. 29 Internet-Drafts are working documents of the Internet Engineering 30 Task Force (IETF). Note that other groups may also distribute 31 working documents as Internet-Drafts. The list of current Internet- 32 Drafts is at http://datatracker.ietf.org/drafts/current/. 34 Internet-Drafts are draft documents valid for a maximum of six months 35 and may be updated, replaced, or obsoleted by other documents at any 36 time. It is inappropriate to use Internet-Drafts as reference 37 material or to cite them other than as "work in progress." 39 This Internet-Draft will expire on April 30, 2017. 41 Copyright Notice 43 Copyright (c) 2016 IETF Trust and the persons identified as the 44 document authors. All rights reserved. 46 This document is subject to BCP 78 and the IETF Trust's Legal 47 Provisions Relating to IETF Documents 48 (http://trustee.ietf.org/license-info) in effect on the date of 49 publication of this document. Please review these documents 50 carefully, as they describe your rights and restrictions with respect 51 to this document. Code Components extracted from this document must 52 include Simplified BSD License text as described in Section 4.e of 53 the Trust Legal Provisions and are provided without warranty as 54 described in the Simplified BSD License. 56 Table of Contents 58 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 59 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 60 1.1.1. Tree Diagrams . . . . . . . . . . . . . . . . . . . . 3 61 2. Conversion rules LWM2M to YANG . . . . . . . . . . . . . . . 4 62 3. URI convention . . . . . . . . . . . . . . . . . . . . . . . 7 63 4. observation and notification . . . . . . . . . . . . . . . . 8 64 5. Payload format . . . . . . . . . . . . . . . . . . . . . . . 8 65 6. YANG extensions to LWM2M . . . . . . . . . . . . . . . . . . 8 66 7. Security considerations . . . . . . . . . . . . . . . . . . . 8 67 8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 8 68 9. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 8 69 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 9 70 10.1. Normative References . . . . . . . . . . . . . . . . . . 9 71 10.2. Informative References . . . . . . . . . . . . . . . . . 9 72 Appendix A. YANG identifiers as IDnumbers . . . . . . . . . . . 10 73 Appendix B. YANG identifiers as resource names . . . . . . . . . 13 74 Appendix C. YANG identifiers as additional leaf . . . . . . . . 16 75 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 21 77 1. Introduction 79 Standardization organizations define interfaces hosted by processors 80 to manipulate the connected equipment. Examples of such 81 standardization organizations are BACnet, KNX, ZigBee, oBIX, OMA/ 82 IPSO, and many others. These organizations plan to move to resource 83 based interfaces. The data models proposed by these organizations 84 are hierarchical models that can be specified in XML and describe 85 classes with attributes and operations that can be instantiated to 86 objects. An example is the OMA LWM2M (see [OMNA]) Object model, that 87 standardizes eight numbered object types for device management. IPSO 88 (see [IPSO]) expands those objects to handle applications. This 89 document describes rules to translate xml specifications of the 90 LWM2M/IPSO organizations to YANG [RFC7950], and the invocation of the 91 YANG based server according to the CoAP Management Interface (CoMI) 92 specification [I-D.vanderstok-core-comi]. 94 1.1. Terminology 96 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 97 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 98 document are to be interpreted as described in [RFC2119]. 100 The following terms are defined in [RFC6241] and are not redefined 101 here: 103 o client 105 o configuration data 107 o server 109 o state data 111 The following terms are defined in [RFC7950] and are not redefined 112 here: 114 o data model 116 o data node 118 The terminology for describing YANG data models is found in 119 [RFC7950]. 121 1.1.1. Tree Diagrams 123 A simplified graphical representation of the data model is used in 124 the YANG modules specified in this document. The meaning of the 125 symbols in these diagrams is as follows: 127 Brackets "[" and "]" enclose list keys. 129 Abbreviations before data node names: "rw" means configuration 130 data (read-write) and "ro" state data (read-only). 132 Symbols after data node names: "?" means an optional node, "!" 133 means a presence container, and "*" denotes a list and leaf-list. 135 Parentheses enclose choice and case nodes, and case nodes are also 136 marked with a colon (":"). 138 Ellipsis ("...") stands for contents of subtrees that are not 139 shown. 141 2. Conversion rules LWM2M to YANG 143 LWM2M objects are typed, where each type is identified with a number. 144 The object provides one or more instances which are numbered. An 145 instance is composed of resources, also identified with numbers. An 146 instance on a host can be accessed with the example URI: 147 coap+lwm2m://example.com/object/instance/resource, where resource, 148 instance and object are numbers, specified by the LWM2M 149 specification. 151 When using YANG, the object identifiers, followed by the resource 152 identifier, are YANG strings instead of numbers. The format of the 153 instance identifier depends on the YANG model that is chosen to 154 specify LWM2M objects. 156 For an automatic translation from the XML LWM2M specification to a 157 YANG specification, the following rules apply for access, optional, 158 units, and range specifications: 160 o The optional/mandatory aspect of the LWM2M resource is covered by 161 the leaf's mandatory "false/true" statement of YANG as specified 162 in section 7.6.5 of [RFC7950]. The YANG statement "mandatory = 163 TRUE" means that(given the right conditions) the leaf must exist. 165 o The R,W access aspects of a data item are translated using the 166 YANG "config" statement as specified in section 7.21.1 of 167 [RFC7950]. If "config" is "true", the Data nodes are part of 168 configuration datastores, resulting in RW access. If "config" is 169 "false", the data nodes are not part of configuration datastores, 170 resulting in R access. YANG does not provide facilities to 171 specify W access only. 173 o When the YANG RPC is specified, E access is meant. In section 174 7.14 of [RFC7950] RPCs are modelled for NETCONF using YANG input 175 and output parameters. When input parameters are added, EW access 176 is meant; when output parameters are added, ER access is meant and 177 with both input and output parameters ERW access is meant. 179 o The YANG ACTION is specified in section 7.15 of [RFC7950]. 180 Contrary to RPC, ACTION statement is associated with a data node. 181 The data node has E access. Input leafs of the data node have W 182 access, and output leafs have R access. 184 o To specify the range of a data resource the YANG range statement, 185 specified in section 9.2.4 of [RFC7950], is used. 187 o YANG range can be used in a straightforward fashion for items of 188 type integer. The range of decimal64, used for float, is less 189 straightforward. The possible ranges are restricted by the 190 fraction-digits which specifies the size of the fraction part of 191 the float (see section 9.3.4. of [RFC7950]. 193 o The YANG units statement, specified in section 7.3.3 of [RFC7950], 194 is used to express the units. 196 o The attributes of the YANG leaf need to be presented in the order: 197 "type", possibly qualified with "range", "units", "config", 198 "mandatory", and finally "Description". 200 o In the presented YANG specification the LWM2M resources are 201 specified as leafs of a YANG list. 203 YANG lists may contain key leafs which uniquely identify an instance 204 in a list. By specifying a key leaf (for example called "instance") 205 that contains the list instance number, the YANG list instance can be 206 uniquely referenced by the instance number. Accordingly, OMA objects 207 are modelled as YANG lists. The value of the "instance" leaf in the 208 list is equal to the instance number of the OMA object. The 209 numbering of the instances does not need to be consecutive. The OMA 210 resources are the other leafs of the YANG list. 212 Choices need to be made how to represent the numbered object ID, and 213 resource ID as YANG identifiers. YANG identifiers are strings and 214 cannot be represented by numbers. 216 The YANG identifier strings need to be mapped to numbered 217 identifiers. The appendices show 3 ways to represent the LWM2M 218 device ID and resource ID in the YANG specification. 220 o In Appendix A, Yang Identifiers are modelled as strings that start 221 with string "ID" followed by the identifier number (see module 222 humidityID). 224 o In Appendix B, Yang Identifiers of objects and resources are 225 modelled as strings that are equivalent to the OMA object- and 226 resource- name (see module humidityNM). 228 o In Appendix C, the OMA device is modelled as a YANG container 229 composed of an identifier and a list of instances. The list is 230 composed of an instance number and a set of resource containers. 231 The resource container is composed of the pair (attribute 232 identifier number, IPSO resource specification)(see module 233 humidityLF). 235 Below the tree diagrams (see Section 1.1.1 for an explanation of the 236 syntax) of the three valid YANG modules are shown. 238 module: ietf-yang-humidityID 239 +--ro ID3304* [instance] 240 +--ro instance uint16 241 +--ro ID5700 decimal64 242 +--ro ID5701? string 243 +--ro ID5601? decimal64 244 +--ro ID5602? decimal64 245 +--ro ID5603? decimal64 246 +--ro ID5604? decimal64 247 +---x ID5605 249 module: ietf-yang-humidityNM 250 +--ro IPSO-humidity* [instance] 251 +--ro instance uint16 252 +--ro Sensor_Value decimal64 253 +--ro Units? string 254 +--ro Min_Measured_Value? decimal64 255 +--ro Max_Measured_Value? decimal64 256 +--ro Min_Range_Value? decimal64 257 +--ro Max_Range_Value? decimal64 258 +---x Reset_Min_and_Max_measured_values 260 module: ietf-yang-humidityLF 261 +--rw IPSO-humidity 262 +--ro identifier uint16 263 +--ro resources* [instance] 264 +--ro instance uint16 265 +--ro Sensor_Value 266 | +--ro identifier? uint16 267 | +--ro content decimal64 268 +--ro Units 269 | +--ro identifier? uint16 270 | +--ro content? string 271 +--ro Min_Measured_Value 272 | +--ro identifier? uint16 273 | +--ro content? decimal64 274 +--ro Max_Measured_Value 275 | +--ro identifier? uint16 276 | +--ro content? decimal64 277 +--ro Min_Range_Value 278 | +--ro identifier? uint16 279 | +--ro content? decimal64 280 +--ro Max_Range_Value 281 | +--ro identifier? uint16 282 | +--ro content? decimal64 283 +--ro Reset_Min_and_Max_measured_values 284 +--ro identifier? uint16 285 +---x reset 287 Module humidityLF of Appendix C is the most complex one and is not 288 recommended. Module humidityID of Appendix A works but is a bit 289 forced approach and lacks the resource name. Module humidityNM of 290 Appendix B is the most natural approach where the YANG identifiers 291 are equal to the device (type) and resource names. 293 CoMI [I-D.vanderstok-core-comi] uses a conversion from names to 294 numbers to reduce the request URI size, and the payload of the server 295 requests and answers. The LWM2M organization specifies both the 296 names and the numbers of the devices and resources. The number of 297 the resource is not unique and for the CoMI identifier the resource 298 number needs to be prefixed by the device number to be unique. 300 3. URI convention 302 The invocation URI of a LWM2M resource looks like: 304 coap+lwm2M://example.com/object/instance/resource 306 In this section it is assumed that the YANG mapping of the module 307 humidityNM of Appendix B is used. 309 When YANG is used, the LWM2M resource invocation can follow the 310 RESTCONF convention using http, or the CoMI convention using CoAP. 312 When using RESTCONF (see section 3.5.3 of [I-D.ietf-netconf-restconf] 313 the invocation of object with instance = number will look like: 315 http://example.com/object/instance=number/resource 317 In the case of CoMI the object/resource numbers are used, and not the 318 names, to reduce the payload size. The instance is specified in a 319 query parameter. Consequently, the LWM2M resource on a server 320 executing a YANG specification, is accessed according to the CoMI 321 specification with: 323 coap://example.com/identifier?k=number 325 The identifier is a composition of the object number and the resource 326 number. Assume that n is smallest number for which 327 10**(n+1)/resource >= 1. The value of the identifier = 328 (object*10**n)+resource. 330 Assume that the IPSO-humidity/Sensor_Value 3304/5700 numbers are 331 composed to the numeric identifier 33045700. According to [RFC4648], 332 the identifier is represented in base64 which leads to B-DzE. The 333 URI for the CoMI invocation of instance 0 of IPSO-humidity/ 334 Sensor_value will look like: 336 coap://example.com/B-DzE?k=0 338 For LWM2M objects with only one instance, the k=0 can be omitted. 340 4. observation and notification 342 An LWM2M server uses "observe" to receive notification from the 343 server. This remains unchanged with YANG servers and CoMI. 345 5. Payload format 347 The payload of the request and the response follows the payload 348 format specified for CoMI. The content format is CBOR [RFC7049]. 349 The YANG objects are returned as maps containing (identifier, value) 350 pairs. Where the identifier is the numeric identifier discussed in 351 Section 3. and the value is of the type specified by the YANG 352 specification of the server. The CBOR encoding of the YANG types is 353 specified in [I-D.ietf-core-yang-cbor]. 355 6. YANG extensions to LWM2M 357 By adding keys leafs to a list object, YANG allows additionally the 358 selection of instances by the contents of the key leafs. 360 The FETCH method of CoAP makes it possible to request multiple 361 resource instances in one request. 363 The notification statement of YANG encourages a more flexible 364 specification of notifications. 366 7. Security considerations 368 To be filled in 370 8. Acknowledgements 372 We are grateful to 374 9. Changelog 376 NO changes from nothing to version 00 378 10. References 380 10.1. Normative References 382 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 383 Requirement Levels", BCP 14, RFC 2119, 384 DOI 10.17487/RFC2119, March 1997, 385 . 387 [RFC7950] Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language", 388 RFC 7950, DOI 10.17487/RFC7950, August 2016, 389 . 391 [RFC6241] Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed., 392 and A. Bierman, Ed., "Network Configuration Protocol 393 (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, June 2011, 394 . 396 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 397 Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006, 398 . 400 [RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object 401 Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, 402 October 2013, . 404 [I-D.vanderstok-core-comi] 405 Stok, P. and A. Bierman, "CoAP Management Interface", 406 draft-vanderstok-core-comi-09 (work in progress), March 407 2016. 409 [I-D.ietf-core-yang-cbor] 410 Veillette, M., Pelov, A., Somaraju, A., Turner, R., and A. 411 Minaburo, "CBOR Encoding of Data Modeled with YANG", 412 draft-ietf-core-yang-cbor-02 (work in progress), July 413 2016. 415 10.2. Informative References 417 [I-D.ietf-netconf-restconf] 418 Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF 419 Protocol", draft-ietf-netconf-restconf-17 (work in 420 progress), September 2016. 422 [OMNA] "Open Mobile Naming Authority (OMNA)", Web 423 http://http://technical.openmobilealliance.org/Technical/ 424 technical-information/omna. 426 [IPSO] "IP for Smart Objects (IPSO)", 427 Web http://ipso-alliance.github.io/pub/. 429 Appendix A. YANG identifiers as IDnumbers 431 Yang Identifiers are modelled as string that starts with ID followed 432 by the identifier number. The device object is modelled as a list 433 that contains multiple instances. 435 file "ietf-humidityID@2016-07-25.yang" 436 module ietf-humidityID{ 438 yang-version 1.1; // needed for action 440 namespace 441 "urn:ietf:params:xml:ns:yang:ietf-humidityID"; 443 prefix humid; 445 organization 446 "IPSO"; 448 contact 449 "WG Web: http://tools.ietf.org/wg/core/ 450 WG List: mailto:core@ietf.org 452 WG Chair: Carsten Bormann 453 mailto:cabo@tzi.org 455 WG Chair: Jaime Jimenez 456 mailto:jaime.jimenez@ericsson.com 458 Editor: Peter van der Stok 459 mailto:consultancy@vanderstok.org 461 Editor: Jaime Jimenez 462 mailto:jaime.jimenez@ericsson.com"; 464 description 465 "This module contains information about the operation of the 466 IPSO LWM2M humidity sensor with ID 3304. 468 Copyright (c) 2016 IETF Trust and the persons identified as 469 authors of the code. All rights reserved. 471 Redistribution and use in source and binary forms, with or 472 without modification, is permitted pursuant to, and subject 473 to the license terms contained in, the Simplified BSD License 474 set forth in Section 4.c of the IETF Trust's Legal Provisions 475 Relating to IETF Documents 476 (http://trustee.ietf.org/license-info). 478 This version of this YANG module is part of RFC XXXX; see 479 the RFC itself for full legal notices."; 481 revision "2016-07-25" { 482 description "Initial revision."; 483 reference 484 "I-D:draft-vanderstok-core-yang-lwm2m: YANG language applied 485 to the LWM2M IPSO humidity sensor specification"; 486 } 488 list ID3304 { 489 key instance; 490 config false; // should be same for key leaf 491 description 492 "IPSO humidity: The humidity sensor is composed of 493 a set of instances"; 494 leaf instance { 495 type uint16{ 496 range "0..1"; // only one instance zero (0) 497 } 498 config false; // R access 499 mandatory "true"; 500 description 501 "the number of the humidity sensor instance"; 502 } 503 leaf ID5700 { 504 type decimal64{ // YANG has no float 505 fraction-digits 2; 506 range "10.0 .. 66.6";} 507 config false; // R access 508 mandatory "true"; 509 description 510 "Sensor Value: Last or Current Measured Value 511 from the Sensor"; 512 } 513 leaf ID5701 { 514 type string; 515 units "Defined by 'Units' resource"; 516 config false; // R access 517 description 518 "Units: Measurement unit definition 519 e.g. 'Cel' for temperature in Celsius"; 520 } 521 leaf ID5601 { 522 type decimal64{ // YANG has no float 523 fraction-digits 2; 524 range "10.0 .. 66.6";} 525 units "Defined by 'Units' resource"; 526 config false; // R access 527 description 528 "Min Measured Value: The minimum value measured 529 by the sensor since power ON or reset"; 530 } 531 leaf ID5602 { 532 type decimal64{ // YANG has no float 533 fraction-digits 2; 534 range "10.0 .. 66.6";} 535 units "Defined by 'Units' resource"; 536 config false; // R access 537 description 538 "Max Measured Value: The maximum value measured 539 by the sensor since power ON or reset"; 540 } 541 leaf ID5603 { 542 type decimal64{ // YANG has no float 543 fraction-digits 2; 544 range "10.0 .. 66.6";} 545 units "Defined by 'Units' resource"; 546 config false; // R access 547 description 548 "Min Range Value: The minimum value that 549 can be measured by the sensor"; 550 } 551 leaf ID5604 { 552 type decimal64{ // YANG has no float 553 fraction-digits 2; 554 range "10.0 .. 66.6";} 555 units "Defined by 'Units' resource"; 556 config false; // R access 557 description 558 "Max Range Value: The maximum value that 559 can be measured by the sensor"; 560 } 561 action ID5605 { 562 //E access: this is an RPC 563 // without input and output parameters 564 description 565 "Reset Min and Max measured values: Reset the 566 Min and Max measured values to current value"; 567 } 568 } // list ID3304 569 } // module ietf-yang-humidity 570 572 Appendix B. YANG identifiers as resource names 574 Yang Identifiers are modelled as strings that represent the resource 575 name. The device object is modelled as a list with multiple 576 instances. 578 file "ietf-humidityNM@2016-07-25.yang" 580 module ietf-humidityNM{ 582 yang-version 1.1; // needed for action 584 namespace 585 "urn:ietf:params:xml:ns:yang:ietf-humidityNM"; 587 prefix humid; 589 organization 590 "IPSO"; 592 contact 593 "WG Web: http://tools.ietf.org/wg/core/ 594 WG List: mailto:core@ietf.org 596 WG Chair: Carsten Bormann 597 mailto:cabo@tzi.org 599 WG Chair: Jaime Jimenez 600 mailto:jaime.jimenez@ericsson.com 602 Editor: Peter van der Stok 603 mailto:consultancy@vanderstok.org 605 Editor: Jaime Jimenez 606 mailto:jaime.jimenez@ericsson.com"; 608 description 609 "This module contains information about the 610 operation of the IPSO LWM2M humidity sensor with ID 3304. 612 Copyright (c) 2016 IETF Trust and the persons identified as 613 authors of the code. All rights reserved. 615 Redistribution and use in source and binary forms, with or 616 without modification, is permitted pursuant to, and subject 617 to the license terms contained in, the Simplified BSD License 618 set forth in Section 4.c of the IETF Trust's Legal Provisions 619 Relating to IETF Documents 620 (http://trustee.ietf.org/license-info). 622 This version of this YANG module is part of RFC XXXX; see 623 the RFC itself for full legal notices."; 625 revision "2016-07-25" { 626 description "Initial revision."; 627 reference 628 "I-D:draft-vanderstok-core-yang-lwm2m: 629 YANG language applied to the LWM2M IPSO humidity sensor 630 specification"; 631 } 633 list IPSO-humidity { 634 key instance; 635 config false; // should be same as key leaf 636 description 637 "3304: The humidity sensor is composed of 638 a set of instances"; 639 leaf instance { 640 type uint16{ 641 range "0..1"; // only one instance zero (0) 642 } 643 config false; // R access 644 mandatory "true"; 645 description 646 "the number of the humidity sensor instance"; 647 } 648 leaf Sensor_Value { 649 type decimal64{ // YANG has no float 650 fraction-digits 2; 651 range "10.0 .. 66.6";} 652 units "Defined by 'Units' resource"; 653 config false; // R access 654 mandatory "true"; 655 description 656 "5700: Last or Current Measured Value 657 from the Sensor"; 658 } 659 leaf Units { 660 type string; 661 units "Defined by 'Units' resource"; 662 config false; // R access 663 description 664 "5701: Measurement unit definition 665 e.g. 'Cel' for temperature in Celsius"; 666 } 667 leaf Min_Measured_Value { 668 type decimal64{ // YANG has no float 669 fraction-digits 2; 670 range "10.0 .. 66.6";} 671 units "Defined by 'Units' resource"; 672 config false; // R access 673 description 674 "5601: The minimum value measured by 675 the sensor since power ON or reset"; 676 } 677 leaf Max_Measured_Value { 678 type decimal64{ // YANG has no float 679 fraction-digits 2; 680 range "10.0 .. 66.6";} 681 units "Defined by 'Units' resource"; 682 config false; // R access 683 description 684 "5602: The maximum value measured 685 by the sensor since power ON or reset"; 686 } 687 leaf Min_Range_Value { 688 type decimal64{ // YANG has no float 689 fraction-digits 2; 690 range "10.0 .. 66.6";} 691 units "Defined by 'Units' resource"; 692 config false; // R access 693 description 694 "5603: The minimum value that can be measured 695 by the sensor"; 696 } 697 leaf Max_Range_Value{ 698 type decimal64{ // YANG has no float 699 fraction-digits 2; 700 range "10.0 .. 66.6";} 701 units "Defined by 'Units' resource"; 702 config false; // R access 703 description 704 "5604: The maximum value that can be measured 705 by the sensor"; 706 } 707 action Reset_Min_and_Max_measured_values { 708 // E access: this is an RPC 709 // without input and output parameter 710 description 711 "5605: Reset the Min and Max measured values 712 to current value"; 713 } // rpc 714 } // list ID3304 715 } // module ietf-yang-humidity 717 719 Appendix C. YANG identifiers as additional leaf 721 The device object is modelled as a container composed of an 722 identifier and a list of instances. The list instance is composed of 723 an instance number and a set of resource containers. The resource 724 container is composed of the pair (attribute identifier number, IPSO 725 resource specification). 727 file "ietf-humidityLF@2016-07-25.yang" 729 module ietf-humidityLF{ 731 yang-version 1.1; // needed for rpc 733 namespace 734 "urn:ietf:params:xml:ns:yang:ietf-humidityLF"; 736 prefix humid; 738 organization 739 "IPSO"; 741 contact 742 "WG Web: http://tools.ietf.org/wg/core/ 743 WG List: mailto:core@ietf.org 745 WG Chair: Carsten Bormann 746 mailto:cabo@tzi.org 748 WG Chair: Jaime Jimenez 749 mailto:jaime.jimenez@ericsson.com 751 Editor: Peter van der Stok 752 mailto:consultancy@vanderstok.org 754 Editor: Jaime Jimenez 755 mailto:jaime.jimenez@ericsson.com"; 756 description 757 "This module contains information about the 758 operation of the IPSO LWM2M humidity sensor with ID 3304. 760 Copyright (c) 2016 IETF Trust and the persons identified as 761 authors of the code. All rights reserved. 763 Redistribution and use in source and binary forms, with or 764 without modification, is permitted pursuant to, and subject 765 to the license terms contained in, the Simplified BSD License 766 set forth in Section 4.c of the IETF Trust's Legal Provisions 767 Relating to IETF Documents 768 (http://trustee.ietf.org/license-info). 770 This version of this YANG module is part of RFC XXXX; 771 see the RFC itself for full legal notices."; 773 revision "2016-07-25" { 774 description "Initial revision."; 775 reference 776 "I-D:draft-vanderstok-core-yang-lwm2m: 777 YANG language applied to the LWM2M IPSO humidity sensor 778 specification"; 779 } 781 container IPSO-humidity{ 782 description 783 "Device separated in identifier and list"; 784 leaf identifier{ 785 type uint16; // fixed to 3304 786 config false; 787 mandatory "true"; 788 description 789 "the LWM2M identification number of the device"; 790 } 791 list resources { 792 key instance; 793 config false; // should be same as key leaf 794 description 795 "3304: The humidity sensor is composed of 796 a set of instances"; 797 leaf instance { 798 type uint16{ 799 range "0..1"; // only one instance zero (0) 800 } 801 config false; // R access 802 mandatory "true"; 803 description 804 "the number of the humidity sensor instance"; 805 } // instance number 806 container Sensor_Value { 807 description 808 "Resource separated in identifier and content"; 809 leaf identifier{ 810 type uint16; // fixed to 5700 811 config false; // R access 812 description 813 "identifier should contain the value 5700"; 814 } 815 leaf content{ 816 type decimal64{ // YANG has no float 817 fraction-digits 2; 818 range "10.0 .. 66.6";} 819 units "Defined by 'Units' resource"; 820 config false; // R access 821 mandatory "true"; 822 description 823 "5700: Last or Current Measured Value 824 from the Sensor"; 825 } // content 826 } // container 827 container Units { 828 description 829 "Resource separated in identifier and content"; 830 leaf identifier{ 831 type uint16; // fixed to 5701 832 config false; // R access 833 description 834 "identifier should contain the value 5701"; 835 } 836 leaf content{ 837 type string; 838 units "Defined by 'Units' resource"; 839 config false; // R access 840 description 841 "5701: Measurement unit definition 842 e.g. 'Cel' for temperature in Celsius"; 843 } // content 844 } // container 845 container Min_Measured_Value { 846 description 847 "Resource separated in identifier and content"; 848 leaf identifier{ 849 type uint16; // fixed to 5601 850 config false; // R access 851 description 852 "identifier should contain the value 5601"; 853 } // identifier 854 leaf content{ 855 type decimal64{ // YANG has no float 856 fraction-digits 2; 857 range "10.0 .. 66.6";} 858 units "Defined by 'Units' resource"; 859 config false; // R access 860 description 861 "5601: The minimum value measured by the 862 sensor since power ON or reset"; 863 } // content 864 } 865 container Max_Measured_Value { 866 description 867 "Resource separated in identifier and content"; 868 leaf identifier{ 869 type uint16; // fixed to 5602 870 config false; // R access 871 description 872 "identifier should contain the value 5602"; 873 } 874 leaf content{ 875 type decimal64{ // YANG has no float 876 fraction-digits 2; 877 range "10.0 .. 66.6";} 878 units "Defined by 'Units' resource"; 879 config false; // R access 880 description 881 "5602: The maximum value measured by 882 the sensor since power ON or reset"; 883 } // content 884 } // container 885 container Min_Range_Value { 886 description 887 "Resource separated in identifier and content"; 888 leaf identifier{ 889 type uint16; // fixed to 5603 890 config false; // R access 891 description 892 "identifier should contain the value 5603"; 893 } // identifier 894 leaf content{ 895 type decimal64{ // YANG has no float 896 fraction-digits 2; 897 range "10.0 .. 66.6";} 898 units "Defined by 'Units' resource"; 899 config false; // R access 900 description 901 "5603: The minimum value that can be measured 902 by the sensor"; 903 } // content 904 } // container 905 container Max_Range_Value{ 906 description 907 "Resource separated in identifier and content"; 908 leaf identifier{ 909 type uint16; // fixed to 5604 910 config false; // R access 911 description 912 "identifier should contain the value 5604"; 913 } // identifier 914 leaf content{ 915 type decimal64{ // YANG has no float 916 fraction-digits 2; 917 range "10.0 .. 66.6";} 918 units "Defined by 'Units' resource"; 919 config false; // R access 920 description 921 "5604: The maximum value that can be measured 922 by the sensor"; 923 } // content 924 } 925 container Reset_Min_and_Max_measured_values { 926 description 927 "Resource separated in identifier and action"; 928 leaf identifier{ 929 type uint16; // fixed to 5605 930 config false; // R access 931 description 932 "identifier should contain the value 5605"; 933 } 934 action reset{ 935 // E access: this is an RPC without input and output parameters 936 description 937 "5605: Reset the Min and Max measured values to 938 current value"; 939 } // action reset 940 } // container Reset_min_and_max 941 } // list resources 942 } // container IPSO-humidity (3304) 943 } // module ietf-yang-humidity 945 947 Authors' Addresses 949 Peter van der Stok (editor) 950 consultant 952 Phone: +31-492474673 (Netherlands), +33-966015248 (France) 953 Email: consultancy@vanderstok.org 954 URI: www.vanderstok.org 956 Jaime Jimenez 957 Ericsson 958 Hirsalantie 11 959 Jorvas 02420 960 Finland 962 Phone: +358-442992827(Finland) 963 Email: jaime.jimenez@ericsson.com