idnits 2.17.1 draft-shelby-core-resource-directory-05.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: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (February 25, 2013) is 4040 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 5988 (Obsoleted by RFC 8288) == Outdated reference: A later version (-18) exists of draft-ietf-core-coap-13 -- Obsolete informational reference (is this intentional?): RFC 2616 (Obsoleted by RFC 7230, RFC 7231, RFC 7232, RFC 7233, RFC 7234, RFC 7235) Summary: 1 error (**), 0 flaws (~~), 2 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 CoRE Z. Shelby 3 Internet-Draft Sensinode 4 Intended status: Standards Track S. Krco 5 Expires: August 29, 2013 Ericsson 6 C. Bormann 7 Universitaet Bremen TZI 8 February 25, 2013 10 CoRE Resource Directory 11 draft-shelby-core-resource-directory-05 13 Abstract 15 In many M2M applications, direct discovery of resources is not 16 practical due to sleeping nodes, disperse networks, or networks where 17 multicast traffic is inefficient. These problems can be solved by 18 employing an entity called a Resource Directory (RD), which hosts 19 descriptions of resources held on other servers, allowing lookups to 20 be performed for those resources. This document specifies the web 21 interfaces that a Resource Directory supports in order for web 22 servers to discover the RD and to register, maintain, lookup and 23 remove resources descriptions. Furthermore, new link attributes 24 useful in conjunction with an RD are defined. 26 Status of this Memo 28 This Internet-Draft is submitted in full conformance with the 29 provisions of BCP 78 and BCP 79. 31 Internet-Drafts are working documents of the Internet Engineering 32 Task Force (IETF). Note that other groups may also distribute 33 working documents as Internet-Drafts. The list of current Internet- 34 Drafts is at http://datatracker.ietf.org/drafts/current/. 36 Internet-Drafts are draft documents valid for a maximum of six months 37 and may be updated, replaced, or obsoleted by other documents at any 38 time. It is inappropriate to use Internet-Drafts as reference 39 material or to cite them other than as "work in progress." 41 This Internet-Draft will expire on August 29, 2013. 43 Copyright Notice 45 Copyright (c) 2013 IETF Trust and the persons identified as the 46 document authors. All rights reserved. 48 This document is subject to BCP 78 and the IETF Trust's Legal 49 Provisions Relating to IETF Documents 50 (http://trustee.ietf.org/license-info) in effect on the date of 51 publication of this document. Please review these documents 52 carefully, as they describe your rights and restrictions with respect 53 to this document. Code Components extracted from this document must 54 include Simplified BSD License text as described in Section 4.e of 55 the Trust Legal Provisions and are provided without warranty as 56 described in the Simplified BSD License. 58 Table of Contents 60 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 61 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3 62 3. Architecture and Use Cases . . . . . . . . . . . . . . . . . . 4 63 3.1. Use Case: Cellular M2M . . . . . . . . . . . . . . . . . . 5 64 3.2. Use Case: Home and Building Automation . . . . . . . . . . 6 65 4. Simple Directory Discovery . . . . . . . . . . . . . . . . . . 6 66 4.1. Finding a Directory Server . . . . . . . . . . . . . . . . 7 67 5. Resource Directory Function Set . . . . . . . . . . . . . . . 8 68 5.1. Discovery . . . . . . . . . . . . . . . . . . . . . . . . 8 69 5.2. Registration . . . . . . . . . . . . . . . . . . . . . . . 10 70 5.3. Update . . . . . . . . . . . . . . . . . . . . . . . . . . 12 71 5.4. Validation . . . . . . . . . . . . . . . . . . . . . . . . 13 72 5.5. Removal . . . . . . . . . . . . . . . . . . . . . . . . . 15 73 6. Group Function Set . . . . . . . . . . . . . . . . . . . . . . 16 74 6.1. Register a Group . . . . . . . . . . . . . . . . . . . . . 16 75 6.2. Group Removal . . . . . . . . . . . . . . . . . . . . . . 17 76 7. RD Lookup Function Set . . . . . . . . . . . . . . . . . . . . 18 77 8. New Link-Format Attributes . . . . . . . . . . . . . . . . . . 23 78 8.1. Resource Instance 'ins' attribute . . . . . . . . . . . . 23 79 8.2. Export 'exp' attribute . . . . . . . . . . . . . . . . . . 23 80 9. Security Considerations . . . . . . . . . . . . . . . . . . . 24 81 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 24 82 11. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 24 83 12. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 24 84 13. References . . . . . . . . . . . . . . . . . . . . . . . . . . 26 85 13.1. Normative References . . . . . . . . . . . . . . . . . . . 26 86 13.2. Informative References . . . . . . . . . . . . . . . . . . 26 87 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 26 89 1. Introduction 91 The Constrained RESTful Environments (CoRE) work aims at realizing 92 the REST architecture in a suitable form for the most constrained 93 nodes (e.g. 8-bit microcontrollers with limited RAM and ROM) and 94 networks (e.g. 6LoWPAN). CoRE is aimed at machine-to-machine (M2M) 95 applications such as smart energy and building automation. 97 The discovery of resources offered by a constrained server is very 98 important in machine-to-machine applications where there are no 99 humans in the loop and static interfaces result in fragility. The 100 discovery of resources provided by an HTTP Web Server is typically 101 called Web Linking [RFC5988]. The use of Web Linking for the 102 description and discovery of resources hosted by constrained web 103 servers is specified by the CoRE Link Format [RFC6690]. This 104 specification however only describes how to discover resources from 105 the web server that hosts them by requesting /.well-known/core. In 106 many M2M scenarios, direct discovery of resources is not practical 107 due to sleeping nodes, disperse networks, or networks where multicast 108 traffic is inefficient. These problems can be solved by employing an 109 entity called a Resource Directory (RD), which hosts descriptions of 110 resources held on other servers, allowing lookups to be performed for 111 those resources. 113 This document specifies the web interfaces that a Resource Directory 114 supports in order for web servers to discover the RD and to 115 registrer, maintain, lookup and remove resource descriptions. 116 Furthermore, new link attributes useful in conjunction with a 117 Resource Directory are defined. Although the examples in this 118 document show the use of these interfaces with CoAP 119 [I-D.ietf-core-coap], they may be applied in an equivalent manner to 120 HTTP [RFC2616]. 122 2. Terminology 124 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 125 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 126 document are to be interpreted as described in [RFC2119]. The term 127 "byte" is used in its now customary sense as a synonym for "octet". 129 This specification requires readers to be familiar with all the terms 130 and concepts that are discussed in [RFC5988] and [RFC6690]. Readers 131 should also be familiar with the terms and concepts discussed in 132 [I-D.ietf-core-coap]. The URI Template format is used to describe 133 the REST interfaces defined in this specification [RFC6570]. This 134 specification makes use of the following additional terminology: 136 Resource Directory 137 An web entity that stores information about web resources and 138 implements the REST interfaces defined in this specification for 139 registration and lookup of those resources. 141 Domain 142 In the context of a Resource Directory, a domain is a logical 143 grouping of endpoints. All endpoint within a domain MUST be 144 unique. This specification assumes that the list of Domains 145 supported by an RD is pre-configured by that RD. 147 Group 148 In the context of a Resource Directory, a group is a logical 149 grouping of endpoints for the purpose of group communications. 150 All groups within a domain MUST be unique. 152 Endpoint 153 An endpoint (EP) is a term used to describe a web server or client 154 in [I-D.ietf-core-coap]. In the context of this specification an 155 endpoint is used to describe a web server that registers resources 156 to the Resource Directory. An endpoint is identified by its 157 endpoint name, which is included during registration, and MUST be 158 unique within the associated domain of the registration. 160 3. Architecture and Use Cases 162 The resource directory architecture is shown in Figure 1. A Resource 163 Directory (RD) is used as a repository for Web Links [RFC5988] about 164 resources hosted on other web servers, which are called endpoints 165 (EP). An endpoint is a web server associated with a port, thus a 166 physical node may host one or more endpoints. The RD implements a 167 set of REST interfaces for endpoints to register and maintain sets of 168 Web Links (called resource directory entries), for the RD to validate 169 entries, and for clients to lookup resources from the RD. Endpoints 170 themselves can also act as clients. An RD can be logically segmented 171 by the use of Domains. The domain an endpoint is associated with can 172 be defined by the RD or configured by an outside entity. 174 Endpoints are assumed to proactively register and maintain resource 175 directory entries on the RD, which are soft state and need to be 176 periodially refreshed. An endpoint is provided with interfaces to 177 register, update and remove a resource directory entry. Furthermore, 178 a mechanism to discover a RD using the CoRE Link Format is defined. 179 It is also possible for an RD to proactively discover Web Links from 180 endpoints and add them as resource directory entries, or to validate 181 existing resource directory entries. A lookup interface for 182 discovering any of the Web Links held in the RD is provided using the 183 CoRE Link Format. 185 Registration Lookup 186 +----+ | | 187 | EP |---- | | 188 +----+ ---- | | 189 --|- +------+ | 190 +----+ | ----| | | +--------+ 191 | EP | ---------|-----| RD |----|-----| Client | 192 +----+ | ----| | | +--------+ 193 --|- +------+ | 194 +----+ ---- | | 195 | EP |---- | | 196 +----+ 198 Figure 1: The resource directory architecture. 200 3.1. Use Case: Cellular M2M 202 Over the last few years, mobile operators around the world have 203 focused on development of M2M solutions in order to expand the 204 business to the new type of users, i.e. machines. The machines are 205 connected directly to a mobile network using appropriate embedded air 206 interface (GSM/GPRS, WCDMA, LTE) or via a gateway providing short and 207 wide range wireless interfaces. From the system design point of 208 view, the ambition is to design horizontal solutions that can enable 209 utilization of machines in different applications depending on their 210 current availability and capabilities as well as application 211 requirements, thus avoiding silo like solutions. One of the crucial 212 enablers of such design is the ability to discover resources 213 (machines - endpoints) capable of providing required information at a 214 given time or acting on instructions from the end users. 216 In a typical scenario, during a boot-up procedure (and periodically 217 afterwards), the machines (endpoints) register with a Resource 218 Directory (for example EPs installed on vehicles enabling tracking of 219 their position for the fleet management purposes and monitoring 220 environment parameters) hosted by the mobile operator or somewhere 221 else in the network, submiting a description of own capabilities. 222 Due to the usual network configuration of mobile networks, the EPs 223 attached to the mobile network do not have routable addresses. 224 Therefore, a remote server is usually used to provide proxy access to 225 the EPs. The address of each (proxy) endpoint on this server is 226 included in the resource description stored in the RD. The users, 227 for example mobile applications for environment monitoring, contact 228 the RD, look-up the endpoints capable of providing information about 229 the environment using appropriate set of tags, obtain information on 230 how to contact them (URLs of the proxy server) and then initate 231 interaction to obtain information that is finally processed, 232 displayed on the screen and usually stored in a database. Similarly, 233 fleet management systems provide a set of credentials along with the 234 appropriate tags to the RD to look-up for EPs deployed on the 235 vehicles the application is responsible for. 237 3.2. Use Case: Home and Building Automation 239 Home and commercial building automation systems can benefit from the 240 use of M2M web services. The use of CoRE in home automation across 241 multiple subnets is described in [I-D.brandt-coap-subnet-discovery] 242 and in commercial building automation in [I-D.vanderstok-core-bc]. 243 The discovery requirements of these applications are demanding. Home 244 automation usually relies on run-time discovery to commision the 245 system, whereas in building automation a combination of professional 246 commissioning and run-time discovery is used. Both home and building 247 automation involve peer-to-peer interactions between endpoints, and 248 involve battery-powered sleeping devices. 250 The exporting of resource information to other discovery systems is 251 also important in these automation applications. In home automation 252 there is a need to interact with other consumer electronics, which 253 may already support DNS-SD, and in building automation larger 254 resource directories or DNS-SD covering multiple buildings. 256 4. Simple Directory Discovery 258 Not all endpoints hosting resources are expected to know how to 259 implement the Resource Directory Function Set and thus explicitly 260 register with a Resource Directory (or other such directory server). 261 Instead, simple endpoints can implement the generic Simple Directory 262 Discovery approach described in this section. An RD implementing 263 this specification MUST implement Simple Directory Discovery. 264 However, there may be security reasons why this form of directory 265 discovery would be disabled. 267 This approach requires that the endpoint makes the hosted resources 268 that it wants discovered available as links on its /.well-known/core 269 interface as specified in [RFC6690]. 271 The endpoint then finds one or more IP addresses of the directory 272 server it wants to know about its resources as described in 273 Section 4.1. 275 An endpoint that wants to make itself discoverable occasionally sends 276 a POST request to the /.well-known/core URI of any candidate 277 directory server that it finds. The body of the POST request is 278 either 280 o empty, in which case the directory server is encouraged by this 281 POST request to perform GET requests at the requesting server's 282 default discovery URI. 284 or 286 o a link-format document, which indicates the specific services that 287 the requesting server wants to make known to the directory server. 289 The directory server integrates the information it received this way 290 into its resource directory. It MAY make the information available 291 to further directories, if it can ensure that a loop does not form. 292 The protocol used between directories to ensure loop-free operation 293 is outside the scope of this document. 295 The following example shows an endpoint using simple resource 296 discovery, by simply sending a POST with its links in the body to a 297 directory. 299 EP RD 300 | | 301 | -- POST /.well-known/core "..." ---> | 302 | | 303 | | 304 | <---- 2.01 Created ------------------------- | 305 | | 307 4.1. Finding a Directory Server 309 Endpoints that want to contact a directory server can obtain 310 candidate IP addresses for such servers in a number of ways. 312 In a 6LoWPAN, good candidates can be taken from: 314 o specific static configuration (e.g., anycast addresses), if any, 316 o the ABRO option of 6LoWPAN-ND [RFC6775], 318 o other ND options that happen to point to servers (such as RDNSS), 319 o DHCPv6 options that might be defined later. 321 In networks with more inexpensive use of multicast, the candidate IP 322 address may be a well-known multicast address, i.e. directory servers 323 are found by simply sending POST requests to that well-known 324 multicast address (details TBD). 326 As some of these sources are just (more or less educated) guesses, 327 endpoints MUST make use of any error messages to very strictly rate- 328 limit requests to candidate IP addresses that don't work out. E.g., 329 an ICMP Destination Unreachable message (and, in particular, the port 330 unreachable code for this message) may indicate the lack of a CoAP 331 server on the candidate host, or a CoAP error response code such as 332 4.05 "Method Not Allowed" may indicate unwillingness of a CoAP server 333 to act as a directory server. 335 5. Resource Directory Function Set 337 This section defines the REST interfaces between an RD and endpoint 338 servers, which is called the Resource Directory Function Set. 339 Although the examples throughout this section assume use of CoAP 340 [I-D.ietf-core-coap], these REST interfaces can also be realized 341 using HTTP [RFC2616]. An RD implementing this specification MUST 342 support the discovery, registration, update, and removal interfaces 343 defined in this section and MAY support the validation interface. 344 For the purpose of validation, an endpoint implementing this 345 specification SHOULD support ETag validation on /.well-known/core 346 (which is very straightforward for static /.well-known/core link 347 documents). 349 Resource directory entries are designed to be easily exported to 350 other discovery mechanisms such as DNS-SD. For that reason, 351 parameters that would meaningfully be mapped to DNS are limited to a 352 maximum length of 63 bytes. 354 5.1. Discovery 356 Before an endpoint can make use of an RD, it must first know the RD's 357 IP address, port and the path of its RD Function Set. There can be 358 several mechanisms for discovering the RD including assuming a 359 default location (e.g. on an Edge Router in a LoWPAN), by assigning 360 an anycast address to the RD, using DHCP, or by discovering the RD 361 using the CoRE Link Format (also see Section 4.1). This section 362 defines discovery of the RD using the well-known interface of the 363 CoRE Link Format [RFC6690] as the required mechanism. It is however 364 expected that RDs will also be discoverable via other methods 365 depending on the deployment. 367 Discovery is performed by sending either a multicast or unicast GET 368 request to /.well-known/core and including a Resource Type (rt) 369 parameter [RFC6690] with the value "core.rd" in the query string. 370 Likewise, a Resource Type parameter value of "core.rd-lookup" is used 371 to discover the RD Lookup Function Set. Upon success, the response 372 will contain a payload with a link format entry for each RD 373 discovered, with the URL indicating the root resource of the RD. 374 When performing multicast discovery, the multicast IP address used 375 will depend on the scope required and the multicast capabilities of 376 the network. 378 An RD implementation of this specification MUST support query 379 filtering for the rt parameter as defined in [RFC6690]. 381 The discovery request interface is specified as follows: 383 Interaction: EP -> RD 385 Method: GET 387 URI Template: /.well-known/core{?rt} 389 URI Template Variables: 391 rt := Resource Type (optional). MAY contain the value 392 "core.rd", "core.rd-lookup" or "core.rd*" 394 Content-Type: application/link-format (if any) 396 The following response codes are defined for this interface: 398 Success: 2.05 "Content" with an application/link-format payload 399 containing a matching entry for the RD resource. 401 Failure: 4.04 "Not Found" is returned in case no matching entry is 402 found for a unicast request. 404 Failure: No error response to a multicast request. 406 Failure: 4.00 "Bad Request" 408 The following example shows an endpoint discovering an RD using this 409 interface, thus learning that the base RD resource is at /rd. Note 410 that it is up to the RD to choose its base RD resource, although it 411 is recommended to use default locations where possible. 413 EP RD 414 | | 415 | ----- GET /.well-known/core?rt=core.rd* ------> | 416 | | 417 | | 418 | <---- 2.05 Content "; rt="core.rd" ------ | 419 | | 421 Req: GET coap://[ff02::1]/.well-known/core?rt=core.rd* 423 Res: 2.05 Content 424 ;rt="core.rd", 425 ;rt="core.rd-lookup", 426 ;rt="core.rd-group" 428 5.2. Registration 430 After discovering the location of an RD Function Set, an endpoint MAY 431 register its resources using the registration interface. This 432 interface accepts a POST from an endpoint containing the list of 433 resources to be added to the directory as the message payload in the 434 CoRE Link Format along with query string parameters indicating the 435 name of the endpoint, its domain and the lifetime of the 436 registration. All parameters except the endpoint name are optional. 437 It is expected that other specifications MAY define further 438 parameters (it is to be determined if a registry of parameters is 439 needed for this purpose). The RD then creates a new resource or 440 updates an existing resource in the RD and returns its location. An 441 endpoint MUST use that location when refreshing registrations using 442 this interface. Endpoint resources in the RD are kept active for the 443 period indicated by the lifetime parameter. The endpoint is 444 responsible for refreshing the entry within this period using either 445 the registration or update interface. The registration interface 446 MUST be implemented to be idempotent, so that registering twice with 447 the same endpoint parameter does not create multiple RD entries. 449 The registration request interface is specified as follows: 451 Interaction: EP -> RD 453 Method: POST 454 URI Template: /{+rd}{?ep,d,et,lt,con} 456 URI Template Variables: 458 rd := RD Function Set path (mandatory). This is the path of the 459 RD Function Set. An RD SHOULD use the value "rd" for this 460 variable whenever possible. 462 ep := Endpoint (mandatory). The endpoint identifier or name of 463 the registering node, unique within that domain. The maximum 464 length of this parameter is 63 bytes. 466 d := Domain (optional). The domain to which this endpoint 467 belongs. The maximum length of this parameter is 63 bytes. 468 Optional. When this parameter is elided, the RD MAY associate 469 the endpoint with a configured default domain. 471 et := Endpoint Type (optional). The semantic type of the 472 endpoint. The maximum length of this parameter is 63 bytes. 473 Optional. 475 lt := Lifetime (optional). Lifetime of the registration in 476 seconds. Range of 60-4294967295. If no lifetime is included, 477 a default value of 86400 (24 hours) SHOULD be assumed. 479 con := Context (optional). This parameter sets the scheme, 480 address and port at which this server is available in the form 481 scheme://host:port. Optional. In the absence of this 482 parameter the scheme of the protocol, source IP address and 483 source port of the register request are assumed. 485 Content-Type: application/link-format 487 The following response codes are defined for this interface: 489 Success: 2.01 "Created". The Location header MUST be included with 490 the new resource entry for the endpoint. This Location MUST be a 491 stable identifier generated by the RD as it is used for all 492 subsequent operations on this registration (update, delete). 494 Failure: 4.00 "Bad Request". Malformed request. 496 Failure: 5.03 "Service Unavailable". Service could not perform the 497 operation. 499 The following example shows an endpoint with the name "node1" 500 registering two resources to an RD using this interface. The 501 resulting location /rd/4521 is just an example of an RD generated 502 location. 504 EP RD 505 | | 506 | --- POST /rd?ep=node1 " | 507 | | 508 | | 509 | <-- 2.01 Created Location: /rd/4521 ---------- | 510 | | 512 Req: POST coap://rd.example.com/rd?ep=node1 513 Payload: 514 ;ct=41;rt="temperature-c";if="sensor", 515 ;ct=41;rt="light-lux";if="sensor" 517 Res: 2.01 Created 518 Location: /rd/4521 520 5.3. Update 522 The update interface is used by an endpoint to refresh or update its 523 registration with an RD. To use the interface, the endpoint sends a 524 PUT request to the resource returned in the Location option in the 525 response to the first registration. An update MAY contain 526 registration parameters if there have been changes since the last 527 registration or update. Parameters that have not changed SHOULD NOT 528 be included in an update. Upon receiving an update request, the RD 529 resets the timeout for that endpoint and stores the values of the 530 parameters included in the update (if any). 532 The update request interface is specified as follows: 534 Interaction: EP -> RD 536 Method: PUT 538 URI Template: /{+location}{?et,lt,con} 540 URI Template Variables: 542 location := This is the Location path returned by the RD as a 543 result of a successful registration. 545 et := Endpoint Type (optional). The semantic type of the 546 endpoint. The maximum length of this parameter is 63 btyes. 547 Optional. 549 lt := Lifetime (optional). Lifetime of the registration in 550 seconds. Range of 60-4294967295. If no lifetime is included, 551 a default value of 86400 (24 hours) SHOULD be assumed. 553 con := Context (optional). This parameter sets the scheme, 554 address and port at which this server is available in the form 555 scheme://host:port. Optional. In the absence of this 556 parameter the scheme of the protocol, source IP address and 557 source port used to register are assumed. 559 Content-Type: None 561 The following response codes are defined for this interface: 563 Success: 2.04 "Changed" in the update was successfully processed. 565 Failure: 4.00 "Bad Request". Malformed request. 567 Failure: 5.03 "Service Unavailable". Service could not perform the 568 operation. 570 The following example shows an endpoint updating a new set of 571 resources to an RD using this interface. 573 EP RD 574 | | 575 | --- PUT /rd/4521 --------------------------> | 576 | | 577 | | 578 | <-- 2.04 Changed ---------------------------- | 579 | | 581 Req: PUT /rd/4521 583 Res: 2.04 Changed 585 5.4. Validation 587 In some cases, an RD may want to validate that it has the latest 588 version of an endpoint's resources. This can be performed with a GET 589 on the well-known interface of the CoRE Link Format including the 590 latest ETag stored for that endpoint. For the purpose of validation, 591 an endpoint implementing this specification SHOULD support ETag 592 validation on /.well-known/core. 594 The validation request interface is specified as follows: 596 Interaction: RD -> EP 598 Method: GET 600 Path: /.well-known/core 602 Parameters: None 604 ETag: The ETag option MUST be included 606 The following responses codes are defined for this interface: 608 Success: 2.03 "Valid" in case the ETag matches 610 Success: 2.05 "Content" in case the ETag does not match, the 611 response MUST include the most recent resource representation 612 (application/link-format) and its corresponding ETag. 614 Failure: 4.00 "Bad Request". Malformed request. 616 The following examples shows a successful validation. 618 EP RD 619 | | 620 | <--- GET /.well-known/core ETag: 0x40 -------- | 621 | | 622 | | 623 | --- 2.03 Valid -----------------------------> | 624 | | 626 Req: GET /.well-known/core 627 ETag: 0x40 629 Res: 2.03 Valid 631 5.5. Removal 633 Although RD entries have soft state and will eventually timeout after 634 their lifetime, an endpoint SHOULD explicitly remove its entry from 635 the RD if it knows it will no longer be available (for example on 636 shut-down). This is accomplished using a removal interface on the RD 637 by performing a DELETE on the endpoint resource. 639 The removal request interface is specified as follows: 641 Interaction: EP -> RD 643 Method: DELETE 645 URI Template: /{+location} 647 URI Template Variables: 649 location := This is the Location path returned by the RD as a 650 result of a successful registration. 652 The following responses codes are defined for this interface: 654 Success: 2.02 "Deleted" upon successful deletion 656 Failure: 4.00 "Bad Request". Malformed request. 658 Failure: 5.03 "Service Unavailable". Service could not perform the 659 operation. 661 The following examples shows successful removal of the endpoint from 662 the RD. 664 EP RD 665 | | 666 | --- DELETE /rd/4521 ------------------------> | 667 | | 668 | | 669 | <-- 2.02 Deleted ---------------------------- | 670 | | 672 Req: DELETE /rd/4521 674 Res: 2.02 Deleted 676 6. Group Function Set 678 This section defines a function set for the creation of groups of 679 endpoints for the purpose of managing and looking up endpoints for 680 group operations. The group function set is similar to the resource 681 directory function set, in that a group may be created or removed. 682 However unlike an endpoint entry, a group entry consists of a list of 683 endpoints and does not have a lifetime associated with it. In order 684 to make use of multicast requests with CoAP, a group MAY have a 685 multicast address associated with it. 687 6.1. Register a Group 689 In order to create a group, a management entity used to configure 690 groups, makes a request to the RD indicating the name of the group to 691 create (or update), the optional domain the group belongs to, and the 692 optional multicast address of the group. The registration message 693 includes the list of endpoints that belong to that group. If an 694 endpoint has already registered with the RD, the RD attempts to use 695 the context of the endpoint from its RD endpoint entry. If the 696 client registering the group knows the endpoint has already 697 registered, then it MAY send a blank target URI for that endpoint 698 link when registering the group. 700 The registration request interface is specified as follows: 702 Interaction: Manager -> RD 704 Method: POST 706 URI Template: /{+rd-group}{?gp,d,con} 708 URI Template Variables: 710 rd-group := RD Group Function Set path (mandatory). This is the 711 path of the RD Group Function Set. An RD SHOULD use the value 712 "rd-group" for this variable whenever possible. 714 gp := Group Name (mandatory). The name of the group to be 715 created or replaced, unique within that domain. The maximum 716 length of this parameter is 63 bytes. 718 d := Domain (optional). The domain to which this group belongs. 719 The maximum length of this parameter is 63 bytes. Optional. 720 When this parameter is elided, the RD MAY associate the 721 endpoint with a configured default domain. 723 con := Context (optional). This parameter is used to set the IP 724 multicast address at which this server is available in the form 725 scheme://multicast-address:port. Optional. In the absence of 726 this parameter no multicast address is configured. 728 Content-Type: application/link-format 730 The following response codes are defined for this interface: 732 Success: 2.01 "Created". The Location header MUST be included with 733 the new group entry. This Location MUST be a stable identifier 734 generated by the RD as it is used for delete operations on this 735 registration. 737 Failure: 4.00 "Bad Request". Malformed request. 739 Failure: 5.03 "Service Unavailable". Service could not perform the 740 operation. 742 The following example shows a group with the name "lights" 743 registering two endpoints to an RD using this interface. The 744 resulting location /rd-group/12 is just an example of an RD generated 745 group location. 747 EP RD 748 | | 749 | - POST /rd-group?gp=lights "<>;ep=node1..." --> | 750 | | 751 | | 752 | <---- 2.01 Created Location: /rd-group/12 ---- | 753 | | 755 Req: POST coap://rd.example.com/rd-group?gp=lights 756 Payload: 757 <>;ep="node1", 758 <>;ep="node2" 760 Res: 2.01 Created 761 Location: /rd-group/12 763 6.2. Group Removal 765 A group can be removed simply by sending a removal message to the 766 location returned when registering the group. Removing a group MUST 767 NOT remove the endpoints of the group from the RD. 769 The removal request interface is specified as follows: 771 Interaction: Manager -> RD 773 Method: DELETE 775 URI Template: /{+location} 777 URI Template Variables: 779 location := This is the Location path returned by the RD as a 780 result of a successful group registration. 782 The following responses codes are defined for this interface: 784 Success: 2.02 "Deleted" upon successful deletion 786 Failure: 4.00 "Bad Request". Malformed request. 788 Failure: 5.03 "Service Unavailable". Service could not perform the 789 operation. 791 The following examples shows successful removal of the group from the 792 RD. 794 EP RD 795 | | 796 | --- DELETE /rd-group/412 -------------------> | 797 | | 798 | | 799 | <-- 2.02 Deleted ---------------------------- | 800 | | 802 Req: DELETE /rd-group/12 804 Res: 2.02 Deleted 806 7. RD Lookup Function Set 808 In order for an RD to be used for discovering resources registered 809 with it, a lookup interface can be provided using this function set. 810 This lookup interface is defined as a default, and it is assumed that 811 RDs may also support lookups to return resource descriptions in 812 alternative formats (e.g. Atom or HTML Link) or using more advanced 813 interfaces (e.g. supporting context or semantic based lookup). 815 This function set allows lookups for domains, groups, endpoints and 816 resources using attributes defined in the RD Function Set and for use 817 with the CoRE Link Format. The result of a lookup request is the 818 list of links (if any) in CoRE Link Format corresponding to the type 819 of lookup. The target of these links SHOULD be the actual location 820 of the domain, endpoint or resource, but MAY be an intermediate proxy 821 e.g. in the case of an HTTP lookup interface for CoAP endpoints. 822 Multiple query parameters MAY be included in a lookup, all included 823 parameters MUST match for a resource to be returned. The character 824 '*' MAY be included at the end of a parameter value as a wildcard 825 operator. 827 The lookup interface is specified as follows: 829 Interaction: Client -> RD 831 Method: GET 833 URI Template: /{+rd-lookup-base}/ 834 {lookup-type}{?d,ep,gp,et,rt,page,count,resource-param} 836 Parameters: 838 rd-lookup-base := RD Lookup Function Set path (mandatory). This 839 is the path of the RD Lookup Function Set. An RD SHOULD use the 840 value "rd-lookup" for this variable whenever possible. 842 lookup-type := ("d", "ep", "res", "gp") (mandatory) This 843 variable is used to select the kind of lookup to perform 844 (domain, endpoint or resource). 846 ep := Endpoint (optional). Used for endpoint, group and 847 resource lookups. 849 d := Domain (optional). Used for domain, group, endpoint and 850 resource lookups. 852 page := Page (optional). Parameter can not be used without the 853 count parameter. Results are returned from result set in pages 854 that contains 'count' results starting from index (page * 855 count). 857 count := Count (optional). Number of results is limited to this 858 parameter value. If the parameter is not present, then an RD 859 implementation specific default value SHOULD be used. 861 rt := Resource type (optional). Used for group, endpoint and 862 resource lookups. 864 rt := Endpoint type (optional). Used for group, endpoint and 865 resource lookups. 867 resource-param := Link attribute parameters (optional). Any 868 link attribute as defined in Section 4.1 of [RFC6690], used for 869 resource lookups. 871 The following responses codes are defined for this interface: 873 Success: 2.05 "Content" with an application/link-format payload 874 containing a matching entries for the lookup. 876 Failure: 4.04 "Not Found" in case no matching entry is found for a 877 unicast request. 879 Failure: No error response to a multicast request. 881 Failure: 4.00 "Bad Request". Malformed request. 883 Failure: 5.03 "Service Unavailable". Service could not perform the 884 operation. 886 The following example shows a client performing a resource lookup: 888 Client RD 889 | | 890 | ----- GET /rd-lookup/res?rt=temperature -----------------> | 891 | | 892 | | 893 | <-- 2.05 Content ";rt="temperature" ---- | 894 | | 896 Req: GET /rd-lookup/res?rt=temperature 898 Res: 2.05 Content 899 901 The following example shows a client performing an endpoint lookup: 903 Client RD 904 | | 905 | ----- GET /rd-lookup/ep?et=power-node --------------------> | 906 | | 907 | | 908 | <-- 2.05 Content ";ep="node5" ----------- | 909 | | 911 Req: GET /rd-lookup/ep?et=power-node 913 Res: 2.05 Content 914 ;ep="node5", 915 ;ep="node7" 917 The following example shows a client performing a domain lookup: 919 Client RD 920 | | 921 | ----- GET /rd-lookup/d ----------------------------------> | 922 | | 923 | | 924 | <-- 2.05 Content ";d=domain1,;d=domain2 --------- | 925 | | 927 Req: GET /rd-lookup/d 929 Res: 2.05 Content 930 ;d="domain1", 931 ;d="domain2" 933 The following example shows a client performing a group lookup for 934 all groups: 936 Client RD 937 | | 938 | ----- GET /rd-lookup/gp ---------------------------------> | 939 | | 940 | | 941 | <-- 2.05 Content ;gp="lights1";d="domain1" -- | 942 | | 944 Req: GET /rd-lookup/gp 946 Res: 2.05 Content 947 ;gp="lights1";d="domain1" 949 The following example shows a client performing a lookup for all 950 endpoints in a particular group: 952 Client RD 953 | | 954 | ----- GET GET /rd-lookup/ep?gp=lights1-------------------> | 955 | | 956 | | 957 | <-- 2.05 Content ";d=domain1,;d=domain2 --------- | 958 | | 960 Req: GET /rd-lookup/ep?gp=lights1 962 Res: 2.05 Content 963 ;ep="node1", 964 ;ep="node2", 966 The following example shows a client performing a lookup for all 967 groups an endpoint belongs to: 969 Client RD 970 | | 971 | ----- GET /rd-lookup/gp?ep=node1 ------------------------> | 972 | | 973 | | 974 | <-- 2.05 Content ";d=domain1,;d=domain2 --------- | 975 | | 977 Req: GET /rd-lookup/gp?ep=node1 979 Res: 2.05 Content 980 ;gp="lights1";ep="node1", 982 8. New Link-Format Attributes 984 When using the CoRE Link Format to describe resources being 985 discovered by or posted to a resource directory service, additional 986 information about those resources is useful. This specification 987 defines the following new attributes for use in the CoRE Link Format 988 [RFC6690]: 990 link-extension = ( "ins" "=" quoted-string ) ; Max 63 bytes 991 link-extension = ( "exp" ) 993 8.1. Resource Instance 'ins' attribute 995 The Resource Instance "ins" attribute is an identifier for this 996 resource, which makes it possible to distinguish from other similar 997 resources. This attribute is similar in use to the "Instance" 998 portion of a DNS-SD record, and SHOULD be unique across resources 999 with the same Resource Type attribute in the domain it is used. A 1000 Resource Instance might be a descriptive string like "Ceiling Light, 1001 Room 3", a short ID like "AF39" or a unique UUID or iNumber. This 1002 attribute is used by a Resource Directory to distinguish between 1003 multiple instances of the same resource type within a system. 1005 This attribute MUST be no more than 63 bytes in length. The resource 1006 identifier attribute MUST NOT appear more than once in a link 1007 description. 1009 8.2. Export 'exp' attribute 1011 The Export "exp" attribute is used as a flag to indicate that a link 1012 description MAY be exported by a resource directory to external 1013 directories. 1015 The CoRE Link Format is used for many purposes between CoAP 1016 endpoints. Some are useful mainly locally, for example checking the 1017 observability of a resource before accessing it, determining the size 1018 of a resource, or traversing dynamic resource structures. However, 1019 other links are very useful to be exported to other directories, for 1020 example the entry point resource to a functional service. 1022 9. Security Considerations 1024 This document needs the same security considerations as described in 1025 Section 7 of [RFC5988] and Section 6 of [RFC6690]. The /.well-known/ 1026 core resource may be protected e.g. using DTLS when hosted on a CoAP 1027 server as described in [I-D.ietf-core-coap]. 1029 Access control SHOULD be performed separately for the RD Function Set 1030 and the RD Lookup Function Set, as different endpoints may be 1031 authorized to register with an RD from those authorized to lookup 1032 endpoints from the RD. Such access control SHOULD be performed in as 1033 fine-grained a level as possible. For example access control for 1034 lookups could be performed either at the domain, endpoint or resource 1035 level. 1037 10. IANA Considerations 1039 "core.rd", "core.rd-group" and "core.rd-lookup" resource types need 1040 to be registered with the resource type registry defined by 1041 [RFC6690]. 1043 The "exp" attribute needs to be registered when a future Web Linking 1044 attribute is created. 1046 11. Acknowledgments 1048 Szymon Sasin, Kerry Lynn, Esko Dijk, Peter van der Stok, Anders 1049 Brandt, Matthieu Vial, Sampo Ukkola and Linyi Tian have provided 1050 helpful comments, discussions and ideas to improve and shape this 1051 document. The authors would also like to thank their collagues from 1052 the EU FP7 SENSEI project, where many of the resource directory 1053 concepts were originally developed. 1055 12. Changelog 1057 Changes from -04 to -05: 1059 o Restricted Update to parameter updates. 1061 o Added pagination support for the Lookup interface. 1063 o Minor editing, bug fixes and reference updates. 1065 o Added group support. 1067 o Changed rt= to et= for the registration & update interface 1069 Changes from -03 to -04: 1071 o Added the ins= parameter back for the DNS-SD mapping. 1073 o Integrated the Simple Directory Discovery from Carsten. 1075 o Editorial improvements. 1077 o Fixed the use of ETags. 1079 Changes from -02 to -03: 1081 o Changed the endpoint name back to a single registration 1082 parameter ep= and removed the h= and ins= parameters. 1084 o Updated REST interface descriptions to use RFC6570 URI Template 1085 format. 1087 o Introduced an improved RD Lookup design as its own function set. 1089 o Improved the security considerations section. 1091 o Made the POST registration interface idempotent by requiring the 1092 ep= paramter to be present. 1094 Changes from -01 to -02: 1096 o Added a terminology section. 1098 o Changed the inclusing of an ETag in registration or update to a 1099 MAY. 1101 o Added the concept of an RD Domain and a registration parameter 1102 for it. 1104 o Recommended the Location returned from a registration to be 1105 stable, allowing for endpoint and Domain information to be changed 1106 during updates. 1108 o Changed the lookup interface to accept endpoint and Domain as 1109 query string parameters to control the scope of a lookup. 1111 13. References 1112 13.1. Normative References 1114 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1115 Requirement Levels", BCP 14, RFC 2119, March 1997. 1117 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, October 2010. 1119 [RFC6570] Gregorio, J., Fielding, R., Hadley, M., Nottingham, M., 1120 and D. Orchard, "URI Template", RFC 6570, March 2012. 1122 [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link 1123 Format", RFC 6690, August 2012. 1125 13.2. Informative References 1127 [I-D.brandt-coap-subnet-discovery] 1128 Brandt, A., "Discovery of CoAP servers across subnets", 1129 draft-brandt-coap-subnet-discovery-00 (work in progress), 1130 March 2011. 1132 [I-D.ietf-core-coap] 1133 Shelby, Z., Hartke, K., Bormann, C., and B. Frank, 1134 "Constrained Application Protocol (CoAP)", 1135 draft-ietf-core-coap-13 (work in progress), December 2012. 1137 [I-D.vanderstok-core-bc] 1138 Stok, P. and K. Lynn, "CoAP Utilization for Building 1139 Control", draft-vanderstok-core-bc-05 (work in progress), 1140 October 2011. 1142 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 1143 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 1144 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 1146 [RFC6775] Shelby, Z., Chakrabarti, S., Nordmark, E., and C. Bormann, 1147 "Neighbor Discovery Optimization for IPv6 over Low-Power 1148 Wireless Personal Area Networks (6LoWPANs)", RFC 6775, 1149 November 2012. 1151 Authors' Addresses 1153 Zach Shelby 1154 Sensinode 1155 Kidekuja 2 1156 Vuokatti 88600 1157 FINLAND 1159 Phone: +358407796297 1160 Email: zach@sensinode.com 1162 Srdjan Krco 1163 Ericsson 1165 Phone: 1166 Email: srdjan.krco@ericsson.com 1168 Carsten Bormann 1169 Universitaet Bremen TZI 1170 Postfach 330440 1171 Bremen D-28359 1172 Germany 1174 Phone: +49-421-218-63921 1175 Fax: +49-421-218-7000 1176 Email: cabo@tzi.org