idnits 2.17.1 draft-ietf-core-resource-directory-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: ---------------------------------------------------------------------------- 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 (June 03, 2013) is 3978 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-14 -- 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: December 05, 2013 Ericsson 6 C. Bormann 7 Universitaet Bremen TZI 8 June 03, 2013 10 CoRE Resource Directory 11 draft-ietf-core-resource-directory-00 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 December 05, 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 . . . . . . . . . . . . . . . . . . . . . . . . 2 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 . . . . . . . . . 5 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 . . . . . . . . . . . . . . . . . . . . . . . . . 14 73 6. Group Function Set . . . . . . . . . . . . . . . . . . . . . 15 74 6.1. Register a Group . . . . . . . . . . . . . . . . . . . . 15 75 6.2. Group Removal . . . . . . . . . . . . . . . . . . . . . . 17 76 7. RD Lookup Function Set . . . . . . . . . . . . . . . . . . . 18 77 8. New Link-Format Attributes . . . . . . . . . . . . . . . . . 22 78 8.1. Resource Instance 'ins' attribute . . . . . . . . . . . . 23 79 8.2. Export 'exp' attribute . . . . . . . . . . . . . . . . . 23 80 9. Security Considerations . . . . . . . . . . . . . . . . . . . 23 81 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 24 82 11. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 24 83 12. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 24 84 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 25 85 13.1. Normative References . . . . . . . . . . . . . . . . . . 25 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 register, 115 maintain, lookup and remove resource descriptions. Furthermore, new 116 link attributes useful in conjunction with a Resource Directory are 117 defined. Although the examples in this document show the use of 118 these interfaces with CoAP [I-D.ietf-core-coap], they may be applied 119 in an equivalent manner to HTTP [RFC2616]. 121 2. Terminology 123 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 124 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 125 document are to be interpreted as described in [RFC2119]. The term 126 "byte" is used in its now customary sense as a synonym for "octet". 128 This specification requires readers to be familiar with all the terms 129 and concepts that are discussed in [RFC5988] and [RFC6690]. Readers 130 should also be familiar with the terms and concepts discussed in 131 [I-D.ietf-core-coap]. The URI Template format is used to describe 132 the REST interfaces defined in this specification [RFC6570]. This 133 specification makes use of the following additional terminology: 135 Resource Directory 136 An web entity that stores information about web resources and 137 implements the REST interfaces defined in this specification for 138 registration and lookup of those resources. 140 Domain 141 In the context of a Resource Directory, a domain is a logical 142 grouping of endpoints. This specification assumes that the list 143 of Domains supported by an RD is pre-configured by that RD. 145 Group 146 In the context of a Resource Directory, a group is a logical 147 grouping of endpoints for the purpose of group communications. 148 All groups within a domain are unique. 150 Endpoint 151 An endpoint (EP) is a term used to describe a web server or client 152 in [I-D.ietf-core-coap]. In the context of this specification an 153 endpoint is used to describe a web server that registers resources 154 to the Resource Directory. An endpoint is identified by its 155 endpoint name, which is included during registration, and is 156 unique within the associated domain of the registration. 158 3. Architecture and Use Cases 160 The resource directory architecture is shown in Figure 1. A Resource 161 Directory (RD) is used as a repository for Web Links [RFC5988] about 162 resources hosted on other web servers, which are called endpoints 163 (EP). An endpoint is a web server associated with an IP address and 164 port, thus a physical node may host one or more endpoints. The RD 165 implements a set of REST interfaces for endpoints to register and 166 maintain sets of Web Links (called resource directory entries), for 167 the RD to validate entries, and for clients to lookup resources from 168 the RD. Endpoints themselves can also act as clients. An RD can be 169 logically segmented by the use of Domains. The domain an endpoint is 170 associated with can be defined by the RD or configured by an outside 171 entity. 173 Endpoints are assumed to proactively register and maintain resource 174 directory entries on the RD, which are soft state and need to be 175 periodically refreshed. An endpoint is provided with interfaces to 176 register, update and remove a resource directory entry. Furthermore, 177 a mechanism to discover a RD using the CoRE Link Format is defined. 178 It is also possible for an RD to proactively discover Web Links from 179 endpoints and add them as resource directory entries, or to validate 180 existing resource directory entries. A lookup interface for 181 discovering any of the Web Links held in the RD is provided using the 182 CoRE Link Format. 184 Registration Lookup 185 +----+ | | 186 | EP |---- | | 187 +----+ ---- | | 188 --|- +------+ | 189 +----+ | ----| | | +--------+ 190 | EP | ---------|-----| RD |----|-----| Client | 191 +----+ | ----| | | +--------+ 192 --|- +------+ | 193 +----+ ---- | | 194 | EP |---- | | 195 +----+ 197 Figure 1: The resource directory architecture. 199 3.1. Use Case: Cellular M2M 201 Over the last few years, mobile operators around the world have 202 focused on development of M2M solutions in order to expand the 203 business to the new type of users, i.e. machines. The machines are 204 connected directly to a mobile network using appropriate embedded air 205 interface (GSM/GPRS, WCDMA, LTE) or via a gateway providing short and 206 wide range wireless interfaces. From the system design point of 207 view, the ambition is to design horizontal solutions that can enable 208 utilization of machines in different applications depending on their 209 current availability and capabilities as well as application 210 requirements, thus avoiding silo like solutions. One of the crucial 211 enablers of such design is the ability to discover resources 212 (machines - endpoints) capable of providing required information at a 213 given time or acting on instructions from the end users. 215 In a typical scenario, during a boot-up procedure (and periodically 216 afterwards), the machines (endpoints) register with a Resource 217 Directory (for example EPs installed on vehicles enabling tracking of 218 their position for the fleet management purposes and monitoring 219 environment parameters) hosted by the mobile operator or somewhere 220 else in the network, periodically a description of its own 221 capabilities. Due to the usual network configuration of mobile 222 networks, the EPs attached to the mobile network do not have routable 223 addresses. Therefore, a remote server is usually used to provide 224 proxy access to the EPs. The address of each (proxy) endpoint on 225 this server is included in the resource description stored in the RD. 226 The users, for example mobile applications for environment 227 monitoring, contact the RD, look-up the endpoints capable of 228 providing information about the environment using appropriate set of 229 link parameters, obtain information on how to contact them (URLs of 230 the proxy server) and then initiate interaction to obtain information 231 that is finally processed, displayed on the screen and usually stored 232 in a database. Similarly, fleet management systems provide the 233 appropriate link parameters to the RD to look-up for EPs deployed on 234 the vehicles the application is responsible for. 236 3.2. Use Case: Home and Building Automation 237 Home and commercial building automation systems can benefit from the 238 use of M2M web services. The use of CoRE in home automation across 239 multiple subnets is described in [I-D.brandt-coap-subnet-discovery] 240 and in commercial building automation in [I-D.vanderstok-core-bc]. 241 The discovery requirements of these applications are demanding. Home 242 automation usually relies on run-time discovery to commission the 243 system, whereas in building automation a combination of professional 244 commissioning and run-time discovery is used. Both home and building 245 automation involve peer-to-peer interactions between endpoints, and 246 involve battery-powered sleeping devices. 248 The exporting of resource information to other discovery systems is 249 also important in these automation applications. In home automation 250 there is a need to interact with other consumer electronics, which 251 may already support DNS-SD, and in building automation larger 252 resource directories or DNS-SD covering multiple buildings. 254 4. Simple Directory Discovery 256 Not all endpoints hosting resources are expected to know how to 257 implement the Resource Directory Function Set and thus explicitly 258 register with a Resource Directory (or other such directory server). 259 Instead, simple endpoints can implement the generic Simple Directory 260 Discovery approach described in this section. An RD implementing 261 this specification MUST implement Simple Directory Discovery. 262 However, there may be security reasons why this form of directory 263 discovery would be disabled. 265 This approach requires that the endpoint makes available the hosted 266 resources that it wants to be discovered, as links on its /.well- 267 known/core interface as specified in [RFC6690]. 269 The endpoint then finds one or more IP addresses of the directory 270 server it wants to know about its resources as described in 271 Section 4.1. 273 An endpoint that wants to make itself discoverable occasionally sends 274 a POST request to the /.well-known/core URI of any candidate 275 directory server that it finds. The body of the POST request is 276 either 278 o empty, in which case the directory server is encouraged by this 279 POST request to perform GET requests at the requesting server's 280 default discovery URI. 282 or 283 o a non-empty link-format document, which indicates the specific 284 services that the requesting server wants to make known to the 285 directory server. 287 The directory server integrates the information it received this way 288 into its resource directory. It MAY make the information available 289 to further directories, if it can ensure that a loop does not form. 290 The protocol used between directories to ensure loop-free operation 291 is outside the scope of this document. 293 The following example shows an endpoint using simple resource 294 discovery, by simply sending a POST with its links in the body to a 295 directory. 297 EP RD 298 | | 299 | -- POST /.well-known/core "..." ---> | 300 | | 301 | | 302 | <---- 2.01 Created ------------------------- | 303 | | 305 4.1. Finding a Directory Server 307 Endpoints that want to contact a directory server can obtain 308 candidate IP addresses for such servers in a number of ways. 310 In a 6LoWPAN, good candidates can be taken from: 312 o specific static configuration (e.g., anycast addresses), if any, 314 o the ABRO option of 6LoWPAN-ND [RFC6775], 316 o other ND options that happen to point to servers (such as RDNSS), 318 o DHCPv6 options that might be defined later. 320 In networks with more inexpensive use of multicast, the candidate IP 321 address may be a well-known multicast address, i.e. directory 322 servers are found by simply sending POST requests to that well-known 323 multicast address (details TBD). 325 As some of these sources are just (more or less educated) guesses, 326 endpoints MUST make use of any error messages to very strictly rate- 327 limit requests to candidate IP addresses that don't work out. E.g., 328 an ICMP Destination Unreachable message (and, in particular, the port 329 unreachable code for this message) may indicate the lack of a CoAP 330 server on the candidate host, or a CoAP error response code such as 331 4.05 "Method Not Allowed" may indicate unwillingness of a CoAP server 332 to act as a directory server. 334 5. Resource Directory Function Set 336 This section defines the REST interfaces between an RD and endpoint 337 servers, which is called the Resource Directory Function Set. 338 Although the examples throughout this section assume use of CoAP 339 [I-D.ietf-core-coap], these REST interfaces can also be realized 340 using HTTP [RFC2616]. An RD implementing this specification MUST 341 support the discovery, registration, update, and removal interfaces 342 defined in this section and MAY support the validation interface. 343 For the purpose of validation, an endpoint implementing this 344 specification SHOULD support ETag validation on /.well-known/core 345 (which is very straightforward for static /.well-known/core link 346 documents). 348 Resource directory entries are designed to be easily exported to 349 other discovery mechanisms such as DNS-SD. For that reason, 350 parameters that would meaningfully be mapped to DNS are limited to a 351 maximum length of 63 bytes. 353 5.1. Discovery 355 Before an endpoint can make use of an RD, it must first know the RD's 356 IP address, port and the path of its RD Function Set. There can be 357 several mechanisms for discovering the RD including assuming a 358 default location (e.g. on an Edge Router in a LoWPAN), by assigning 359 an anycast address to the RD, using DHCP, or by discovering the RD 360 using the CoRE Link Format (also see Section 4.1). This section 361 defines discovery of the RD using the well-known interface of the 362 CoRE Link Format [RFC6690] as the required mechanism. It is however 363 expected that RDs will also be discoverable via other methods 364 depending on the deployment. 366 Discovery is performed by sending either a multicast or unicast GET 367 request to /.well-known/core and including a Resource Type (rt) 368 parameter [RFC6690] with the value "core.rd" in the query string. 369 Likewise, a Resource Type parameter value of "core.rd-lookup" is used 370 to discover the RD Lookup Function Set. Upon success, the response 371 will contain a payload with a link format entry for each RD 372 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", "core.rd-group" 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: 4.00 "Bad Request" is returned in case of a malformed 405 request for a unicast request. 407 Failure: No error response to a multicast request. 409 The following example shows an endpoint discovering an RD using this 410 interface, thus learning that the base RD resource is at /rd. Note 411 that it is up to the RD to choose its base RD resource, although it 412 is recommended to use the base paths specified here where possible. 414 EP RD 415 | | 416 | ----- GET /.well-known/core?rt=core.rd* ------> | 417 | | 418 | | 419 | <---- 2.05 Content "; rt="core.rd" ------ | 420 | | 422 Req: GET coap://[ff02::1]/.well-known/core?rt=core.rd* 424 Res: 2.05 Content 425 ;rt="core.rd", 426 ;rt="core.rd-lookup", 427 ;rt="core.rd-group" 429 5.2. Registration 431 After discovering the location of an RD Function Set, an endpoint MAY 432 register its resources using the registration interface. This 433 interface accepts a POST from an endpoint containing the list of 434 resources to be added to the directory as the message payload in the 435 CoRE Link Format along with query string parameters indicating the 436 name of the endpoint, its domain and the lifetime of the 437 registration. All parameters except the endpoint name are optional. 438 It is expected that other specifications MAY define further 439 parameters (it is to be determined if a registry of parameters is 440 needed for this purpose). The RD then creates a new resource or 441 updates an existing resource in the RD and returns its location. An 442 endpoint MUST use that location when refreshing registrations using 443 this interface. Endpoint resources in the RD are kept active for the 444 period indicated by the lifetime parameter. The endpoint is 445 responsible for refreshing the entry within this period using either 446 the registration or update interface. The registration interface 447 MUST be implemented to be idempotent, so that registering twice with 448 the same endpoint parameter does not create multiple RD entries. 450 The registration request interface is specified as follows: 452 Interaction: EP -> RD 454 Method: POST 456 URI Template: /{+rd}{?ep,d,et,lt,con} 458 URI Template Variables: 460 RD Function Set path (mandatory). This is the path of the RD 461 Function Set. An RD SHOULD use the value "rd" for this 462 variable whenever possible. 464 Endpoint (mandatory). The endpoint identifier or name of the 465 registering node, unique within that domain. The maximum 466 length of this parameter is 63 bytes. 468 Domain (optional). The domain to which this endpoint belongs. 469 The maximum length of this parameter is 63 bytes. Optional. 470 When this parameter is elided, the RD MAY associate the 471 endpoint with a configured default domain. 473 Endpoint Type (optional). The semantic type of the endpoint. 474 The maximum length of this parameter is 63 bytes. Optional. 476 Lifetime (optional). Lifetime of the registration in seconds. 477 Range of 60-4294967295. If no lifetime is included, a default 478 value of 86400 (24 hours) SHOULD be assumed. 480 Context (optional). This parameter sets the scheme, address 481 and port at which this server is available in the form scheme:/ 482 /host:port. Optional. In the absence of this parameter the 483 scheme of the protocol, source IP address and source port of 484 the register request are assumed. 486 Content-Type: application/link-format 488 The following response codes are defined for this interface: 490 Success: 2.01 "Created". The Location header MUST be included with 491 the new resource entry for the endpoint. This Location MUST be a 492 stable identifier generated by the RD as it is used for all 493 subsequent operations on this registration (update, delete). 495 Failure: 4.00 "Bad Request". Malformed request. 497 Failure: 5.03 "Service Unavailable". Service could not perform the 498 operation. 500 The following example shows an endpoint with the name "node1" 501 registering two resources to an RD using this interface. The 502 resulting location /rd/4521 is just an example of an RD generated 503 location. 505 EP RD 506 | | 507 | --- POST /rd?ep=node1 " | 508 | | 509 | | 510 | <-- 2.01 Created Location: /rd/4521 ---------- | 511 | | 513 Req: POST coap://rd.example.com/rd?ep=node1 514 Payload: 515 ;ct=41;rt="temperature-c";if="sensor", 516 ;ct=41;rt="light-lux";if="sensor" 518 Res: 2.01 Created 519 Location: /rd/4521 521 5.3. Update 523 The update interface is used by an endpoint to refresh or update its 524 registration with an RD. To use the interface, the endpoint sends a 525 PUT request to the resource returned in the Location option in the 526 response to the first registration. An update MAY contain 527 registration parameters if there have been changes since the last 528 registration or update. Parameters that have not changed SHOULD NOT 529 be included in an update. Upon receiving an update request, the RD 530 resets the timeout for that endpoint and stores the values of the 531 parameters included in the update (if any). 533 The update request interface is specified as follows: 535 Interaction: EP -> RD 537 Method: PUT 539 URI Template: /{+location}{?et,lt,con} 541 URI Template Variables: 543 This is the Location path returned by the RD as a result of a 544 successful registration. 546 Endpoint Type (optional). The semantic type of the endpoint. 547 The maximum length of this parameter is 63 btyes. Optional. 549 Lifetime (optional). Lifetime of the registration in seconds. 550 Range of 60-4294967295. If no lifetime is included, a default 551 value of 86400 (24 hours) SHOULD be assumed. 553 Context (optional). This parameter sets the scheme, address 554 and port at which this server is available in the form scheme:/ 555 /host:port. Optional. In the absence of this parameter the 556 scheme of the protocol, source IP address and source port used 557 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 599 Path: /.well-known/core 601 Parameters: None 603 ETag: The ETag option MUST be included 605 The following responses codes are defined for this interface: 607 Success: 2.03 "Valid" in case the ETag matches 609 Success: 2.05 "Content" in case the ETag does not match, the 610 response MUST include the most recent resource representation 611 (application/link-format) and its corresponding ETag. 613 Failure: 4.00 "Bad Request". Malformed request. 615 The following examples shows a successful validation. 617 EP RD 618 | | 619 | <--- GET /.well-known/core ETag: 0x40 -------- | 620 | | 621 | | 622 | --- 2.03 Valid -----------------------------> | 623 | | 625 Req: GET /.well-known/core 626 ETag: 0x40 628 Res: 2.03 Valid 630 5.5. Removal 632 Although RD entries have soft state and will eventually timeout after 633 their lifetime, an endpoint SHOULD explicitly remove its entry from 634 the RD if it knows it will no longer be available (for example on 635 shut-down). This is accomplished using a removal interface on the RD 636 by performing a DELETE on the endpoint resource. 638 The removal request interface is specified as follows: 640 Interaction: EP -> RD 642 Method: DELETE 643 URI Template: /{+location} 645 URI Template Variables: 647 This is the Location path returned by the RD as a result of a 648 successful registration. 650 The following responses codes are defined for this interface: 652 Success: 2.02 "Deleted" upon successful deletion 654 Failure: 4.00 "Bad Request". Malformed request. 656 Failure: 5.03 "Service Unavailable". Service could not perform the 657 operation. 659 The following examples shows successful removal of the endpoint from 660 the RD. 662 EP RD 663 | | 664 | --- DELETE /rd/4521 ------------------------> | 665 | | 666 | | 667 | <-- 2.02 Deleted ---------------------------- | 668 | | 670 Req: DELETE /rd/4521 672 Res: 2.02 Deleted 674 6. Group Function Set 676 This section defines a function set for the creation of groups of 677 endpoints for the purpose of managing and looking up endpoints for 678 group operations. The group function set is similar to the resource 679 directory function set, in that a group may be created or removed. 680 However unlike an endpoint entry, a group entry consists of a list of 681 endpoints and does not have a lifetime associated with it. In order 682 to make use of multicast requests with CoAP, a group MAY have a 683 multicast address associated with it. 685 6.1. Register a Group 686 In order to create a group, a management entity used to configure 687 groups, makes a request to the RD indicating the name of the group to 688 create (or update), the optional domain the group belongs to, and the 689 optional multicast address of the group. The registration message 690 includes the list of endpoints that belong to that group. If an 691 endpoint has already registered with the RD, the RD attempts to use 692 the context of the endpoint from its RD endpoint entry. If the 693 client registering the group knows the endpoint has already 694 registered, then it MAY send a blank target URI for that endpoint 695 link when registering the group. 697 The registration request interface is specified as follows: 699 Interaction: Manager -> RD 701 Method: POST 703 URI Template: /{+rd-group}{?gp,d,con} 705 URI Template Variables: 707 RD Group Function Set path (mandatory). This is the path of 708 the RD Group Function Set. An RD SHOULD use the value "rd- 709 group" for this variable whenever possible. 711 Group Name (mandatory). The name of the group to be created or 712 replaced, unique within that domain. The maximum length of 713 this parameter is 63 bytes. 715 Domain (optional). The domain to which this group belongs. 716 The maximum length of this parameter is 63 bytes. Optional. 717 When this parameter is elided, the RD MAY associate the 718 endpoint with a configured default domain. 720 Context (optional). This parameter is used to set the IP 721 multicast address at which this server is available in the form 722 scheme://multicast-address:port. Optional. In the absence of 723 this parameter no multicast address is configured. 725 Content-Type: application/link-format 727 The following response codes are defined for this interface: 729 Success: 2.01 "Created". The Location header MUST be included with 730 the new group entry. This Location MUST be a stable identifier 731 generated by the RD as it is used for delete operations on this 732 registration. 734 Failure: 4.00 "Bad Request". Malformed request. 736 Failure: 5.03 "Service Unavailable". Service could not perform the 737 operation. 739 The following example shows a group with the name "lights" 740 registering two endpoints to an RD using this interface. The 741 resulting location /rd-group/12 is just an example of an RD generated 742 group location. 744 EP RD 745 | | 746 | - POST /rd-group?gp=lights "<>;ep=node1..." --> | 747 | | 748 | | 749 | <---- 2.01 Created Location: /rd-group/12 ---- | 750 | | 752 Req: POST coap://rd.example.com/rd-group?gp=lights 753 Payload: 754 <>;ep="node1", 755 <>;ep="node2" 757 Res: 2.01 Created 758 Location: /rd-group/12 760 6.2. Group Removal 762 A group can be removed simply by sending a removal message to the 763 location returned when registering the group. Removing a group MUST 764 NOT remove the endpoints of the group from the RD. 766 The removal request interface is specified as follows: 768 Interaction: Manager -> RD 770 Method: DELETE 772 URI Template: /{+location} 774 URI Template Variables: 776 This is the Location path returned by the RD as a result of a 777 successful group registration. 779 The following responses codes are defined for this interface: 781 Success: 2.02 "Deleted" upon successful deletion 783 Failure: 4.00 "Bad Request". Malformed request. 785 Failure: 5.03 "Service Unavailable". Service could not perform the 786 operation. 788 The following examples shows successful removal of the group from the 789 RD. 791 EP RD 792 | | 793 | --- DELETE /rd-group/412 -------------------> | 794 | | 795 | | 796 | <-- 2.02 Deleted ---------------------------- | 797 | | 799 Req: DELETE /rd-group/12 801 Res: 2.02 Deleted 803 7. RD Lookup Function Set 805 In order for an RD to be used for discovering resources registered 806 with it, a lookup interface can be provided using this function set. 807 This lookup interface is defined as a default, and it is assumed that 808 RDs may also support lookups to return resource descriptions in 809 alternative formats (e.g. Atom or HTML Link) or using more advanced 810 interfaces (e.g. supporting context or semantic based lookup). 812 This function set allows lookups for domains, groups, endpoints and 813 resources using attributes defined in the RD Function Set and for use 814 with the CoRE Link Format. The result of a lookup request is the 815 list of links (if any) in CoRE Link Format corresponding to the type 816 of lookup. The target of these links SHOULD be the actual location 817 of the domain, endpoint or resource, but MAY be an intermediate proxy 818 e.g. in the case of an HTTP lookup interface for CoAP endpoints. 819 Multiple query parameters MAY be included in a lookup, all included 820 parameters MUST match for a resource to be returned. The character 821 '*' MAY be included at the end of a parameter value as a wildcard 822 operator. 824 The lookup interface is specified as follows: 826 Interaction: Client -> RD 828 Method: GET 830 URI Template: /{+rd-lookup-base}/{lookup- 831 type}{?d,ep,gp,et,rt,page,count,resource-param} 833 Parameters: 835 rd-lookup-base := RD Lookup Function Set path (mandatory). This 836 is the path of the RD Lookup Function Set. An RD SHOULD use 837 the value "rd-lookup" for this variable whenever possible. 839 lookup-type := ("d", "ep", "res", "gp") (mandatory) This 840 variable is used to select the kind of lookup to perform 841 (domain, endpoint or resource). 843 ep := Endpoint (optional). Used for endpoint, group and 844 resource lookups. 846 d := Domain (optional). Used for domain, group, endpoint and 847 resource lookups. 849 page := Page (optional). Parameter can not be used without the 850 count parameter. Results are returned from result set in 851 pages that contains 'count' results starting from index 852 (page * count). 854 count := Count (optional). Number of results is limited to this 855 parameter value. If the parameter is not present, then an 856 RD implementation specific default value SHOULD be used. 858 rt := Resource type (optional). Used for group, endpoint and 859 resource lookups. 861 rt := Endpoint type (optional). Used for group, endpoint and 862 resource lookups. 864 resource-param := Link attribute parameters (optional). Any 865 link attribute as defined in Section 4.1 of [RFC6690], used 866 for resource lookups. 868 The following responses codes are defined for this interface: 870 Success: 2.05 "Content" with an application/link-format payload 871 containing a matching entries for the lookup. 873 Failure: 4.04 "Not Found" in case no matching entry is found for a 874 unicast request. 876 Failure: No error response to a multicast request. 878 Failure: 4.00 "Bad Request". Malformed request. 880 Failure: 5.03 "Service Unavailable". Service could not perform the 881 operation. 883 The following example shows a client performing a resource lookup: 885 Client RD 886 | | 887 | ----- GET /rd-lookup/res?rt=temperature -----------------> | 888 | | 889 | | 890 | <-- 2.05 Content ";rt="temperature" ---- | 891 | | 893 Req: GET /rd-lookup/res?rt=temperature 895 Res: 2.05 Content 896 898 The following example shows a client performing an endpoint lookup: 900 Client RD 901 | | 902 | ----- GET /rd-lookup/ep?et=power-node --------------------> | 903 | | 904 | | 905 | <-- 2.05 Content ";ep="node5" ----------- | 906 | | 908 Req: GET /rd-lookup/ep?et=power-node 909 Res: 2.05 Content 910 ;ep="node5", 911 ;ep="node7" 913 The following example shows a client performing a domain lookup: 915 Client RD 916 | | 917 | ----- GET /rd-lookup/d ----------------------------------> | 918 | | 919 | | 920 | <-- 2.05 Content ";d=domain1,;d=domain2 --------- | 921 | | 923 Req: GET /rd-lookup/d 925 Res: 2.05 Content 926 ;d="domain1", 927 ;d="domain2" 929 The following example shows a client performing a group lookup for 930 all groups: 932 Client RD 933 | | 934 | ----- GET /rd-lookup/gp ---------------------------------> | 935 | | 936 | | 937 | <-- 2.05 Content ;gp="lights1";d="domain1" -- | 938 | | 940 Req: GET /rd-lookup/gp 942 Res: 2.05 Content 943 ;gp="lights1";d="domain1" 944 The following example shows a client performing a lookup for all 945 endpoints in a particular group: 947 Client RD 948 | | 949 | ----- GET GET /rd-lookup/ep?gp=lights1-------------------> | 950 | | 951 | | 952 | <-- 2.05 Content ";d=domain1,;d=domain2 --------- | 953 | | 955 Req: GET /rd-lookup/ep?gp=lights1 957 Res: 2.05 Content 958 ;ep="node1", 959 ;ep="node2", 961 The following example shows a client performing a lookup for all 962 groups an endpoint belongs to: 964 Client RD 965 | | 966 | ----- GET /rd-lookup/gp?ep=node1 ------------------------> | 967 | | 968 | | 969 | <-- 2.05 Content ";d=domain1,;d=domain2 --------- | 970 | | 972 Req: GET /rd-lookup/gp?ep=node1 974 Res: 2.05 Content 975 ;gp="lights1";ep="node1", 977 8. New Link-Format Attributes 978 When using the CoRE Link Format to describe resources being 979 discovered by or posted to a resource directory service, additional 980 information about those resources is useful. This specification 981 defines the following new attributes for use in the CoRE Link Format 982 [RFC6690]: 984 link-extension = ( "ins" "=" quoted-string ) ; Max 63 bytes 985 link-extension = ( "exp" ) 987 8.1. Resource Instance 'ins' attribute 989 The Resource Instance "ins" attribute is an identifier for this 990 resource, which makes it possible to distinguish from other similar 991 resources. This attribute is similar in use to the "Instance" 992 portion of a DNS-SD record, and SHOULD be unique across resources 993 with the same Resource Type attribute in the domain it is used. A 994 Resource Instance might be a descriptive string like "Ceiling Light, 995 Room 3", a short ID like "AF39" or a unique UUID or iNumber. This 996 attribute is used by a Resource Directory to distinguish between 997 multiple instances of the same resource type within a system. 999 This attribute MUST be no more than 63 bytes in length. The resource 1000 identifier attribute MUST NOT appear more than once in a link 1001 description. 1003 8.2. Export 'exp' attribute 1005 The Export "exp" attribute is used as a flag to indicate that a link 1006 description MAY be exported by a resource directory to external 1007 directories. 1009 The CoRE Link Format is used for many purposes between CoAP 1010 endpoints. Some are useful mainly locally, for example checking the 1011 observability of a resource before accessing it, determining the size 1012 of a resource, or traversing dynamic resource structures. However, 1013 other links are very useful to be exported to other directories, for 1014 example the entry point resource to a functional service. 1016 9. Security Considerations 1018 This document needs the same security considerations as described in 1019 Section 7 of [RFC5988] and Section 6 of [RFC6690]. The /.well-known/ 1020 core resource may be protected e.g. using DTLS when hosted on a CoAP 1021 server as described in [I-D.ietf-core-coap]. 1023 Access control SHOULD be performed separately for the RD Function Set 1024 and the RD Lookup Function Set, as different endpoints may be 1025 authorized to register with an RD from those authorized to lookup 1026 endpoints from the RD. Such access control SHOULD be performed in as 1027 fine-grained a level as possible. For example access control for 1028 lookups could be performed either at the domain, endpoint or resource 1029 level. 1031 10. IANA Considerations 1033 "core.rd", "core.rd-group" and "core.rd-lookup" resource types need 1034 to be registered with the resource type registry defined by 1035 [RFC6690]. 1037 The "exp" attribute needs to be registered when a future Web Linking 1038 attribute is created. 1040 11. Acknowledgments 1042 Szymon Sasin, Kerry Lynn, Esko Dijk, Peter van der Stok, Anders 1043 Brandt, Matthieu Vial, Sampo Ukkola and Linyi Tian have provided 1044 helpful comments, discussions and ideas to improve and shape this 1045 document. The authors would also like to thank their collagues from 1046 the EU FP7 SENSEI project, where many of the resource directory 1047 concepts were originally developed. 1049 12. Changelog 1051 Changes from -05 to WG Document -00: 1053 o Updated the version and date. 1055 Changes from -04 to -05: 1057 o Restricted Update to parameter updates. 1059 o Added pagination support for the Lookup interface. 1061 o Minor editing, bug fixes and reference updates. 1063 o Added group support. 1065 o Changed rt to et for the registration and update interface. 1067 Changes from -03 to -04: 1069 o Added the ins= parameter back for the DNS-SD mapping. 1071 o Integrated the Simple Directory Discovery from Carsten. 1073 o Editorial improvements. 1075 o Fixed the use of ETags. 1077 Changes from -02 to -03: 1079 o Changed the endpoint name back to a single registration 1080 parameter ep= and removed the h= and ins= parameters. 1082 o Updated REST interface descriptions to use RFC6570 URI Template 1083 format. 1085 o Introduced an improved RD Lookup design as its own function set. 1087 o Improved the security considerations section. 1089 o Made the POST registration interface idempotent by requiring the 1090 ep= paramter to be present. 1092 Changes from -01 to -02: 1094 o Added a terminology section. 1096 o Changed the inclusing of an ETag in registration or update to a 1097 MAY. 1099 o Added the concept of an RD Domain and a registration parameter 1100 for it. 1102 o Recommended the Location returned from a registration to be 1103 stable, allowing for endpoint and Domain information to be changed 1104 during updates. 1106 o Changed the lookup interface to accept endpoint and Domain as 1107 query string parameters to control the scope of a lookup. 1109 13. References 1111 13.1. Normative References 1113 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1114 Requirement Levels", BCP 14, RFC 2119, March 1997. 1116 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, October 2010. 1118 [RFC6570] Gregorio, J., Fielding, R., Hadley, M., Nottingham, M., 1119 and D. Orchard, "URI Template", RFC 6570, March 2012. 1121 [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link 1122 Format", RFC 6690, August 2012. 1124 13.2. Informative References 1126 [I-D.brandt-coap-subnet-discovery] 1127 Brandt, A., "Discovery of CoAP servers across subnets", 1128 draft-brandt-coap-subnet-discovery-00 (work in progress), 1129 March 2011. 1131 [I-D.ietf-core-coap] 1132 Shelby, Z., Hartke, K., and C. Bormann, "Constrained 1133 Application Protocol (CoAP)", draft-ietf-core-coap-14 1134 (work in progress), March 2013. 1136 [I-D.vanderstok-core-bc] 1137 Stok, P. and K. Lynn, "CoAP Utilization for Building 1138 Control", draft-vanderstok-core-bc-05 (work in progress), 1139 October 2011. 1141 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 1142 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 1143 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 1145 [RFC6775] Shelby, Z., Chakrabarti, S., Nordmark, E., and C. Bormann, 1146 "Neighbor Discovery Optimization for IPv6 over Low-Power 1147 Wireless Personal Area Networks (6LoWPANs)", RFC 6775, 1148 November 2012. 1150 Authors' Addresses 1152 Zach Shelby 1153 Sensinode 1154 Kidekuja 2 1155 Vuokatti 88600 1156 FINLAND 1158 Phone: +358407796297 1159 Email: zach@sensinode.com 1161 Srdjan Krco 1162 Ericsson 1164 Email: srdjan.krco@ericsson.com 1165 Carsten Bormann 1166 Universitaet Bremen TZI 1167 Postfach 330440 1168 Bremen D-28359 1169 Germany 1171 Phone: +49-421-218-63921 1172 Email: cabo@tzi.org