Network Working Group R. Murray Internet-Draft B. Niven-Jenkins Intended status: Standards Track Velocix (Alcatel-Lucent) Expires:January 3,March 7, 2015July 2,September 3, 2014 CDNI Control Interface / Triggersdraft-ietf-cdni-control-triggers-03draft-ietf-cdni-control-triggers-04 Abstract This document describes the part of the CDNInterconnectInterconnection Control Interface that allows a CDN to trigger activity in an interconnected CDN that is configured to deliver content on its behalf. The upstream CDN can use this mechanism to request that the downstream CDN pre-positions metadata or content, or that itre-validateinvalidates orpurgepurges metadata or content. The upstream CDN can monitor the status of activity that it has triggered in the downstream CDN. Requirements Language The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119]. Status of This Memo This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at http://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." This Internet-Draft will expire onJanuary 3,March 7, 2015. Copyright Notice Copyright (c) 2014 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 4 2. Model for CDNI Triggers . . . . . . . . . . . . . . . . . . .54 2.1. Timing of Triggered Activity . . . . . . . . . . . . . .76 2.2. Trigger Results . . . . . . . . . . . . . . . . . . . . .76 3. Collections of Trigger Status Resources . . . . . . . . . . .76 4. CDNI TriggerinterfaceInterface . . . . . . . . . . . . . . . . . . .87 4.1. Creating Triggers . . . . . . . . . . . . . . . . . . . .98 4.2. Checking Status . . . . . . . . . . . . . . . . . . . . .1110 4.2.1. Polling Trigger Status Resource collections . . . . .1110 4.2.2. Polling Trigger Status Resources . . . . . . . . . .1110 4.3.DeletingCancelling Triggers . . . . . . . . . . . . . . . . . . .. 1110 4.4.Expiry of Trigger Status Resources . . . . . . . . . . . 12 4.5. Error Handling . . . . . . . . . . . . . . . . . . . . . 12 5. Properties ofDeleting Triggers . . . . . . . . . . . . . . . . . . .13 5.1. Properties. 11 4.5. Expiry of TriggerRequests . . . . . . . . . . . . . 13 5.1.1. Content URLs . . . . . . . . . . . . . . .Status Resources . . . . .14 5.2. Properties of Trigger Status Resources. . . . . . 12 4.6. Loop Detection and Prevention . . .15 5.3. Properties of ErrorDesc. . . . . . . . . . . 12 4.7. Error Handling . . . . . .16 5.4. Properties of Trigger Collections. . . . . . . . . . . .17 5.5. Trigger Resource Simple Data Type Descriptions. . . 13 4.8. Content URLs . .17 5.5.1. TriggerType. . . . . . . . . . . . . . . . . . . . 13 5. CI/T Object Properties and Encoding .17 5.5.2. TriggerStatus. . . . . . . . . . . . 14 5.1. CI/T Objects . . . . . . . .18 5.5.3. URLs. . . . . . . . . . . . . . 14 5.1.1. CI/T Commands . . . . . . . . . .18 5.5.4. AbsoluteTime. . . . . . . . . . 14 5.1.2. Trigger Status Resource . . . . . . . . . .18 5.5.5. ErrorCode. . . . . 15 5.1.3. Trigger Collection . . . . . . . . . . . . . . . . .18 6. JSON Encoding16 5.2. Properties of CI/T Objects . . . . . . . . . . . . . . . 17 5.2.1. Trigger Specification . . .19 6.1. JSON Encoding of Embedded Types . .. . . . . . . . . . .20 6.1.1. TriggerType. . 18 5.2.2. Trigger Type . . . . . . . . . . . . . . . . . . .20 6.1.2. TriggerStatus. 19 5.2.3. Trigger Status . . . . . . . . . . . . . . . . . . .20 6.1.3.19 5.2.4. PatternMatch . . . . . . . . . . . . . . . . . . . . 206.1.4. ErrorDesc . .5.2.5. Absolute Time . . . . . . . . . . . . . . . . . . . . 216.1.5. ErrorCode . . .5.2.6. Error Description . . . . . . . . . . . . . . . . . . 21 5.2.7. Error Code .22 6.2. MIME Media Types. . . . . . . . . . . . . . . . . . . . 227.6. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 227.1.6.1. Creating Triggers . . . . . . . . . . . . . . . . . . . . 237.1.1.6.1.1. Preposition . . . . . . . . . . . . . . . . . . . . . 237.1.2.6.1.2. Invalidate . . . . . . . . . . . . . . . . . . . . . 247.2.6.2. Examining Trigger Status . . . . . . . . . . . . . . . . 257.2.1.6.2.1. Collection of All Triggers . . . . . . . . . . . . . 257.2.2.6.2.2. Filtered Collections of Triggers . . . . . . . . . . 267.2.3.6.2.3. Trigger Status Resources . . . . . . . . . . . . . . 287.2.4.6.2.4. Polling for Change . . . . . . . . . . . . . . . . . 307.2.5. Cancelling or6.2.5. Removing a Trigger . . . . . . . . . . . . . . . . . 337.2.6.6.2.6. Error Reporting . . . . . . . . . . . . . . . . . . . 358.7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 368.1. CI/T MIME7.1. MediaTypes . .type registrations . . . . . . . . . . . . . . . . 369. Security Considerations7.1.1. CI/T Commands . . . . . . . . . . . . . . . . . . . . 369.1.7.1.2. CI/T Trigger Status Resource . . . . . . . . . . . . 37 7.1.3. CI/T Trigger Collection . . . . . . . . . . . . . . . 38 8. Security Considerations . . . . . . . . . . . . . . . . . . . 39 8.1. Authentication, Confidentiality, Integrity Protection . .36 9.2.39 8.2. Denial of Service . . . . . . . . . . . . . . . . . . . .37 10.39 9. Acknowledgements . . . . . . . . . . . . . . . . . . . . . .37 11.40 10. References . . . . . . . . . . . . . . . . . . . . . . . . .37 11.1.40 10.1. Normative References . . . . . . . . . . . . . . . . . .37 11.2.40 10.2. Informative References . . . . . . . . . . . . . . . . .3740 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . .3841 1. Introduction [RFC6707] introduces theProblemproblem scope for CDN Interconnection (CDNI) and lists the four categories of interfaces that may be used to compose a CDNI solution (Control, Metadata, Request Routing, Logging).[I-D.ietf-cdni-framework][RFC7336] expands on the information provided in [RFC6707] and describes each of the interfaces and the relationships between them in more detail. This document describes the "CI/T" interface, "CDNI Control interface / Triggers". It does not consider those parts of the control interface that relate to configuration, bootstrapping or authentication of CDN Interconnect interfaces.Requirements forSection 4 of [RFC7337] identifies the requirements specific to the CI interface, requirements applicable to the CI/T interface are CI-1 to CI-6. o Section 2 outlines the"High" and "Medium" priority requirementsmodel for theCI identified in sectionCI/T Interface at a high level. o Section 3 describes collections of Trigger Status Resources. o Section 4 defines the web service provided by the dCDN. o Section 5 lists properties of[I-D.ietf-cdni-requirements], reproduced hereCI/T Commands and Status Resources. o Section 6 contains example messages. 1.1. Terminology This document reuses the terminology defined in [RFC6707]. 2. Model forconvenience: CI-1 [HIGH] TheCDNIControl interface shall allowTriggers A trigger, sent from theUpstream CDNuCDN to the dCDN, is a requestthatfor theDownstream CDN, including downstream cascaded CDNs, delete an objectdCDN to do some work relating to data originating from the uCDN. The trigger can request action on either metadata orset of objects and/or its CDNIcontent, the following actions can be requested: o preposition - used to instruct the dCDN to fetch metadata from theCDN surrogates anduCDN, or content from anystorage. Onlyorigin including theobject(s) and CDNI metadata that pertainuCDN. o invalidate - used to instruct therequesting Upstream CDN are alloweddCDN tobe purged. CI-2 [MED] The CDNI Control interface should allow for multiple content items identified by a Content Collection IDrevalidate specific metadata or content before re-using it. o purge - used tobe purged using a single Content Purge action. CI-3 [MED] The CDNI Control interface should allowinstruct theUpstream CDNdCDN torequest that the Downstream CDN, including downstream cascaded CDNs, mark an objectdelete specific metadata orsetcontent. Multiple representations ofobjects and/or its CDNI metadata as "stale" and revalidate them before they are delivered again. CI-4 [HIGH] The CDNI Control interface shall allowan HTTP resource may share theDownstream CDNsame URL. Requests toreport on the completion of these actions (by itself,invalidate andincluding downstream cascaded CDNs, in a manner appropriate for the action (e.g. synchronously or asynchronously). The confirmation receipt should include a successpurge metadata orfailure indication. The failure indication along with the reason are used if the Downstream CDN cannot delete thecontentin its storage. CI-5 [MED]apply to all resource representations with matching URLs. TheCDNI ControlCI/T interfaceshould support initiation and controlis a web service offered by theUpstream CDNdCDN. It allows creation and deletion ofpre-positioned CDNI metadata acquisition by the Downstream CDN. CI-6 [MED] The CDNI Control interface should support initiationtriggers, andcontrol by the Upstream CDNtracking ofpre-positioned content acquisition by the Downstream CDN. o Section 2 outlinesthemodel fortriggered activity. When theCI/T Interface atdCDN accepts ahigh level. o Section 3 describes collectionstrigger it creates a resource describing status ofTrigger Resources. o Section 4 defines the web service provided bythedCDN. o Section 5 lists properties oftriggered activity, a TriggerRequests andStatusResources. o Section 6 definesResource. The uCDN can poll Trigger Status Resources to monitor progress. The dCDN maintains aJSON encoding forcollection of TriggerRequests andStatusResources. o Section 7 contains example messages. 1.1. Terminology This document reuses the terminology defined in [RFC6707]. 2. Model for CDNI Triggers A trigger, sent from the uCDN to the dCDN, is a request for dCDN to do some work relating to data originating from the uCDN. The trigger may request action on either metadata or content, the following actions can be requested: o preposition - used to instruct the dCDN to fetch metadata from the uCDN, or content from any origin including the uCDN. o invalidate - used to instruct the dCDN to revalidate specific metadata or content before re-using it. o purge - used to instruct the dCDN to delete specific metadata or content. The CI/T interface is a web service offered by the dCDN. It allows creation and deletion of triggers, and tracking of the triggered activity. When the dCDN accepts a trigger it creates a resource describing status of the triggered activity, a Trigger Status Resource. The uCDN MAY poll Trigger Status Resources to monitor progress. Requests to invalidate and purge metadata or content apply to all variants of that data with a given URI. The dCDN maintains a collection of Trigger Status ResourcesResources for each uCDN, each uCDN only has access to its own collection and the location of that collection is shared when CDN interconnection is established. To trigger activity in the dCDN, the uCDNwill POSTPOSTs a CI/T Command to the collection of Trigger Status Resources. If the dCDN accepts the trigger, it creates a new Trigger Status Resource and returns its location to the uCDN. To monitor progress, the uCDNMAYcan GET the Trigger Status Resource. Tocancel a trigger, or removerequest cancellation of a triggerfrom the collection once its activity has been completed,the uCDNMAYcan POST to the collection of Trigger Status Resources, or simply DELETE the Trigger Status Resource. In addition to the collection of all Trigger Status Resources for the uCDN,uCDN has access tothe dCDN can maintain filtered views of that collection. These filtered views are defined in Section 3 and include collections of active and completed triggers. These collections provide a mechanism for polling the status of multiple jobs. Figure 1 is an example showing the basic message flow used by the uCDN to trigger activity in the dCDN, and for the uCDN to discover the status of that activity. Only successful triggering is shown. Examples of the messages are given in Section7.6. uCDN dCDN | (1) POST http://dcdn.example.com/triggers/uCDN | [ ] --------------------------------------------------> [ ]--+ | [ ] | (2) | (3) HTTP 201 Response [ ]<-+ [ ] <-------------------------------------------------- [ ] | Loc: http://dcdn.example.com/triggers/uCDN/123 | | | . . . . . . . . . | | | (4) GET http://dcdn.example.com/triggers/uCDN/123 | [ ] --------------------------------------------------> [ ] | [ ] | (5) HTTP 200 Trigger Status Resource [ ] [ ] <-------------------------------------------------- [ ] | | | | Figure 1: Basic CDNI Message Flow for Triggers The steps in Figure 1 are: 1. The uCDN triggers action in the dCDN by posting a CI/T Command to a collection of Trigger Status Resources,"http://dcdn.example.com/triggers/ uCDN"."http://dcdn.example.com/triggers/uCDN". The URL of this was given to the uCDN when the trigger interface was established. 2. The dCDN authenticates the request, validates the trigger and if it accepts the request, creates a new Trigger Status Resource. 3. The dCDN responds to the uCDN with an HTTP 201 response status, and the location of the Trigger Status Resource. 4. The uCDNmaycan repeatedly poll the Trigger Status Resource in the dCDN. 5. The dCDN responds with the Trigger Status Resource, describing progress or results of the triggered activity. The remainder of this document describes the messages, Trigger Status Resources, and collections of Trigger Status Resources in more detail. 2.1. Timing of Triggered Activity Timing of the execution of triggered activity is under the dCDN's control, including its start-time and pacing of the activity in the network. Invalidate and purge triggers MUST be applied to all data acquired before the trigger was created in the dCDN. The dCDNmayMAY apply the triggers to data acquired after trigger creation. If the uCDN wishes to invalidate or purge content, then immediately pre-position replacement content at the same URLs, it SHOULD ensure the dCDN has completed the invalidate/purge before initiating the prepositioning. Otherwise, there is a risk that the dCDNmay pre-positionpre- positions the newcontentcontent, then immediatelyinvalidateinvalidates orpurgepurges it (as a result of the two uCDN requests running in parallel). 2.2. Trigger Results EachTrigger Request maytrigger can operate on multipledata items.metadata and content URLs. The trigger MUST NOT be reported as "complete"unlessuntil all actionscan behave been completedsuccessfully, otherwise it MUST be reported as "failed" or "processed".successfully. The reasons forfailurefailure, and URLs or Patternsaffectedaffected, SHOULD be enumerated in the Trigger Status Resource. For more detail, see section Section4.5.4.7. If a dCDN is also acting as a uCDN in a cascade, it MUST forward triggers to any downstream CDNs that may have data affected by the trigger. The trigger MUST NOT be reported ascomplete'complete' in a CDN until it iscomplete'complete' in all of its downstream CDNs. If a trigger is reported as 'processed' in any dCDN, intermediate CDNs MUST NOT report 'complete', instead they must also report 'processed'. A trigger MAY be reported asfailed'failed' as soon as it fails in a CDN or in any of its downstream CDNs. A cancelled trigger MUST be reported as 'cancelling' until it has been reported as 'cancelled', 'complete', or 'failed' by all dCDNs in a cascade. 3. Collections of Trigger Status Resources As described in Section 2, Trigger Status Resources exist in the dCDN to report the status of activity triggered by each uCDN. A collection of Trigger Status Resources is a resource that contains a reference to each Trigger Status Resource in that collection.To trigger activity in the dCDN, the uCDN createsThe dCDN MUST make anew Trigger Status Resource by posting to the dCDN'scollection of a uCDN's Trigger StatusResources. The URL of each Trigger Status Resource is generated by the dCDN when it accepts the trigger, and returnedResources available tothethat uCDN. Thisimmediately enablescollection includes all of the uCDNto check the status oftriggers thattrigger. Thehave been accepted by the dCDN, and have not yet been deleted by the uCDN, or expired and removed by the dCDNMUST present a different set of Trigger Status Resources to each interconnected uCDN.(as described in section Section 4.4). Trigger Status Resources belonging to a uCDN MUST NOT be visible to any otherclient.CDN. The dCDNmay,could, for example, achieve this by offering different collection URLs touCDNs,each uCDN, or by filtering the response based on the client uCDN.The dCDN resource representingTo trigger activity in a dCDN, or to cancel triggered activity, the uCDN POSTs a CI/T Command to the dCDN's collection ofallthe uCDN's Trigger StatusResources is accessible to the uCDN. This collection lists all of the uCDN triggers that have been accepted by the dCDN, and have not yet been deleted by the uCDN, or expired and removed by the dCDN (as described in section Section 4.3).Resources. In order to allow the uCDN to check the status of multiple jobs in a single request, the dCDN SHOULD also maintain collections representing filtered views of the collection of all Trigger Status Resources. If it implements these filtered collections, the dCDN MUST include links to them in the collection of all triggers. The filtered collections are: o Pending - Trigger Status Resources for triggers that have been accepted, but not yet acted upon. o Active - Trigger Status Resources for triggered activity that is currently being processed in the dCDN. o Complete - Trigger Status Resources representing activity that completedsuccessfully, orsuccessfully and 'processed' triggers for which no further status updates will be made by the dCDN. o Failed - Trigger Status Resources representing activity thatfailed.failed or was cancelled by the uCDN. 4. CDNI TriggerinterfaceInterface This section describes an interface to enable an upstream CDN to triggerdefined activitiesactivity in a downstream CDN.The interface is intended to be independent of the set of activities defined now, or that may be defined in future. CI/T is built on the principles of RESTful web services.Requests are made over HTTP, and the HTTP Method defines the operation the request would like to perform. The corresponding HTTP Response returns the status of the operation in the HTTP Status Code and returns the current representation of the resource (if appropriate) in the Response Body. HTTP Responses fromserversdCDNs implementing CI/T that contain a response body SHOULD include an ETag to enable validation of cached versions of returned resources.ServersAll dCDNs implementing CI/T MUST support the HTTP GET, HEAD, POST and DELETE methods as defined in [RFC7231]. The only representation specified in this document is JSON, [RFC7159]. The URL of the dCDN'scollectionscollection of all Trigger Status Resourcesneedneeds to be either discovered by, or configured in, the uCDN. The mechanism for discovery ofthose URLsthat URL is outside the scope of this document.Trigger RequestsCI/T Commands are POSTed to the dCDN's collection of all Trigger Status Resources. Ifthea command to create a new trigger is accepted by the dCDN, it creates a new Trigger Status Resource and returns its URI to the dCDN in an HTTP 201 response. The triggered activity can then be monitored by the uCDN using that resource and the collections described in Section 3. The URI of each Trigger Status Resource is returned to the uCDN when it is created. This means all Trigger Status Resources can be discovered, soCI/T serversdCDNs are free to assign whatever structure they desire to the URIs for CI/T resources.CI/T clientsTherefore uCDNs MUST NOT make any assumptions regarding the structure of CI/T URIs or the mapping between CI/T objects and their associated URIs.Therefore anyURIs present in the examplesbelowin this document are purely illustrative and are not intended to impose a definitive structure on CI/T interface implementations. The CI/T interface builds on top of HTTP, soCI/T serversdCDNs may make use of any HTTP feature when implementing the CI/T interface. For example, aCI/T server maydCDN SHOULD make use of HTTP's caching mechanisms to indicate that a requested response/representation has not been modified, reducing the uCDN's processing needed to determine whether the status of triggered activity has changed.This specification is neutral with regard to the transport below the HTTP layer.The dCDN MUST ensure that activity triggered by the uCDN only affects metadata or content originating from that uCDN.Since only one CDN can be authoritative for a given item of metadata or content, this requirement means there cannot be any "loops" in trigger requests between CDNs.4.1. Creating Triggers To create a new trigger, the uCDN makes an HTTP POST to theunfiltereddCDN's collection ofits triggers.all of the uCDN's Trigger Status Resources. The request body of that POST is aTrigger Request.CI/T Command with a "trigger", as described in Section 5.1.1. The dCDN validates and authenticates that request, if it is malformed or the uCDN does not have sufficient access rights itMAY reject the request immediately. In this case, itMUST either respond with an appropriate 4xx HTTP error code and a resource MUST NOT be created ondCDN.the dCDN, or create a 'failed' Trigger Status Resource containing an appropriate error description. If the request is accepted, the uCDN MUST create a new Trigger Status Resource. The HTTP response to the dCDN MUST have status code 201 and the URI of the Trigger Status Resource in the Location header field. The HTTP response SHOULD include the content of the newly created Trigger Status Resource, this is recommended particularly in cases where the trigger has completed immediately. Once a Trigger Status Resource has been created the dCDN MUST NOT re- use its location, even after that resource has been removed. The"request""trigger" property of the Trigger Status Resource contains theinformationTrigger Specification posted in the body of theTrigger Request.CI/T Command. Note that this need not be a byte-for-byte copy. For example, in the JSON representation the dCDN may re-serialise the information differently. If the dCDN is not able to track the execution of triggered activity, it MUST indicate thatindicate thatit has accepted the request but will not be providing further status updates. To do this, it sets the "status" of the Trigger Status Resource to "processed". In this case, CI/T processing should continue as for a "complete" request, so the Trigger Status Resource MUST be added to the dCDN's collection of Complete Triggers. The dCDN SHOULD also provide an estimated completion time for the request, by using the "etime" property of the Trigger Status Resource. This will allow the uCDN to schedule prepositioning after an earlier delete of the same URLs is expected to have finished. If the dCDN is able to track the execution of triggered activity, the trigger is queued by the dCDN for later action, the "status" property of the Trigger Status Resource MUST be "pending". Once trigger processing has started the "status" MUST be "active". Finally, once the triggered activity is complete, the trigger status MUST be set to "complete" or "failed". A trigger may result in no activity in the dCDN if, for example, it is an invalidate or purge request for data the dCDN has not yet acquired, or a prepopulate request for data it has already acquired and which is still valid. In this case, the "status" of the Trigger Status Resource MUST be "processed" or "complete", and the Trigger Status Resource MUST be added to the dCDN's collection of Complete Triggers. Once created, Trigger Status Resourcesmaycan be cancelled or deleted by theuCDNuCDN, but not modified. The dCDN MUST reject PUT and POST requests from the uCDN to Trigger Status Resourcesusingby responding with an appropriate HTTP statuscode 403.code. 4.2. Checking Status The uCDN has two ways to check progress of activity it has triggered in the dCDN, described inthe following sections.sections Section 4.2.1 and Section 4.2.2. To check for change in status of a resource or collection of resources without re-fetching the whole resource or collection, Entity Tags SHOULD beusedincluded by the dCDN for the uCDN to use as cache validators, as defined in [RFC7232]. The dCDN SHOULD use the cache control headers for responses to GETs for Trigger Status Resources and Collections to indicate the frequency at which it recommends the uCDN should poll for change. 4.2.1. Polling Trigger Status Resource collections The uCDN can fetch the collection of its Trigger Status Resources, or filtered views of that collection. This makes it possible to poll status of all triggered activity in a single request. If the dCDN moves a Trigger Status Resource from the Active to the Completed collection, the uCDNmay chose tocan fetch the result of that activity. When polling in this way, the uCDN SHOULD use HTTP Entity Tags to monitor for change, rather than repeatedly fetching the whole collection. 4.2.2. Polling Trigger Status Resources The uCDN has areference (URIURI provided by thedCDN)dCDN for each Trigger Status Resource it has created, it may fetch that resource at any time. ThisMAYcan be used to retrieve progress information, and to fetch the result of triggered activity.4.3. Deleting Triggers The uCDN MAY delete Trigger Status Resources at any time, usingWhen polling in this way, the uCDN SHOULD use HTTPDELETE method. Once deleted, the referencesEntity Tags toa Trigger Status Resource MUST be removed from all Trigger Status Resource collections. Subsequent requestsmonitor for change, rather than repeatedly fetching theresource MUST be handled as requiredTrigger Status Resource. 4.3. Cancelling Triggers The uCDN can request cancellation of a trigger byHTTP, and so will receive responses with status 404 or 410. IfPOSTing a"pending"Trigger "cancel" Command to the collection of all triggers. The uCDN should respond to that command appropriately, for example with HTTP status code 200 "OK" if the cancellation has been processed and the trigger is inactive, 202 "Accepted" if the command has been accepted but the trigger remains active, or 403 "Forbidden" if cancellation is not supported by the dCDN. If cancellation of a "pending" Trigger Status Resource isdeleted,accepted by the dCDN, the dCDN SHOULD NOT start processing of that activity.DeletingCancelling a "pending" trigger does not however guarantee thatit isnotstartedactivity is started, because the uCDN cannot control the timing of that activity. Processingmay,could, for example, start after theDELETEPOST is sent by the uCDN but beforethe DELETEthat request is processed by the dCDN. If cancellation of an "active" or "processed" Trigger Status Resource isdeleted,accepted by the dCDN, the dCDNMAYSHOULD stop processing the triggered activity. However, as withdeletioncancellation of a "pending" trigger, the dCDN does not guarantee this.DeletionIf the triggered activity cannot be stopped immediately, the trigger's status MUST be set to "cancelling" and the Trigger Status Resource remains in the collection of active triggers. If processing is stopped before normal completion, the trigger's status MUST be set to "cancelled" and included in the collection of failed triggers. Cancellation of a"complete", "processed""complete" or "failed" Trigger Status Resource requires no processing in thedCDN other than deletion of the resource.dCDN, its status MUST NOT be changed to "cancelled". 4.4.Expiry ofDeleting Triggers The uCDN can delete Trigger Status Resources at any time, using the HTTP DELETE method. ThedCDN MAY chooseeffect is similar toautomatically deletecancellation, but no Trigger StatusResources some time after they become "complete", "processed" or "failed". In this case, the dCDN will removeResource remains afterwards. Once deleted, theresource and respondreferences tosubsequent requests for it with HTTP status 404 or 410. If the dCDN performs this housekeeping, ita Trigger Status Resource MUSThave reported the length of time after which completedbe removed from all Trigger StatusResources become stale via a property ofResource collections. Subsequent requests to GET thecollection of alldeleted resource SHOULD fail. If a "pending" Trigger StatusResources. ItResource isrecommendeddeleted, the dCDN SHOULD NOT start processing of thatTrigger Status Resourcesactivity. Deleting a "pending" trigger does not however guarantee that it has not started because the uCDN cannot control the timing of that activity. Processing may, for example, start after the DELETE is sent by the uCDN but before that request is processed by the dCDN. If an "active" or "processed" Trigger Status Resource is deleted, the dCDN MAY stop processing the triggered activity. However, as with deletion of a "pending" trigger, the dCDN does not guarantee this. Deletion of a "complete" or "failed" Trigger Status Resource requires no processing in the dCDN other than deletion of the resource. 4.5. Expiry of Trigger Status Resources The dCDN can choose to automatically delete Trigger Status Resources some time after they become "complete", "processed", "failed" or "cancelled". In this case, the dCDN will remove the resource and respond to subsequent requests for it with an HTTP error. If the dCDN performs this housekeeping, it MUST have reported the length of time after which completed Trigger Status Resources will be deleted via a property of the collection of all Trigger Status Resources. It is recommended that Trigger Status Resources are not automatically deleted for at least 24 hours after they become "complete","processed""processed", "failed" or"failed"."cancelled". To ensure ithas accessis able to get the status of its completed and failed triggers, it is recommended that the uCDN's polling interval ishalfless than the time after which records for completed activity will beconsidered stale. 4.5. Error Handling Adeleted. 4.6. Loop Detection and Prevention Given three CDNs, A, B and C. If CDNs B and C delegate delivery of CDN A's content to each other, CDN A's triggers could be passed between CDNs B and C in a loop. More complex networks of CDNs could contain similar loops involving more hops. In order to prevent and detect such CI/Tserver may rejectloops, each CDN uses atrigger request using HTTP status codes. For example, 400 ifCDN Provider ID to uniquely identify itself. Each CDN MUST insert its CDN Provider ID into therequest iscdn-path key of every CI/T Command it originates or cascades. When receiving CI/T commands a dCDN MUST check the cdn-path and reject any CI/T Command which already contains its own CDN Provider ID in the cdn-path. Transit CDNs MUST check the cdn-path and not cascade the CI/T Command to dCDNs that are already listed in cdn-path. The CDN Provider Id consists of the characters AS followed by the CDN Provider's AS number, then a colon (':') and an additional qualifier that is used to guarantee uniqueness in case a particular AS has multiple independent CDNs deployed. For example "AS64496:0". If the RI interface described in [I-D.ietf-cdni-redirection] is implemented by the dCDN, the CI/T and RI interfaces SHOULD use the same CDN Provider Id. 4.7. Error Handling A dCDN can reject a CI/T Command using HTTP status codes. For example, 400 if the request is malformed, or 401 if theclientuCDN does not have permission to create triggers or it is trying to act on another CDN's data. If any part of the triggerrequestfails, the trigger SHOULD be reported as "failed" once its activity is complete or if no further errors will be reported. The "errors" property in the Trigger Status Resource will be used to enumerate which actions failed and the reasons for failure, andmaycan be present while the trigger is still "pending" or "active", if the trigger is still running for some URLs or Patterns in thetrigger request.Trigger Specification. Once a request has been accepted, processing errors are reported in the Trigger Status Resource using a list of"ErrorDesc".Error Descriptions. EachErrorDescError Description is used to report errors against one or more of the URLs or Patterns in thetrigger request.Trigger Specification. If a surrogate affected by a trigger is offline in the dCDN, or the dCDN is unable to pass atrigger requestCI/T Command on to any of its cascadeddCDNs; the dCDN SHOULD report an error if the request is abandoned. Otherwise, it SHOULD keep the trigger in state "pending" or "active" until it's acted upon or the uCDN chooses to cancel it. Or, ifdCDNs: o If the request isqueued andabandoned by thedCDN will not report further status,dCDN, the dCDNMAY report the trigger as "processed", in which case itSHOULDalso provide an estimated completion time. Note thatreport an error. o An "invalidate" trigger may be reported as "complete" when surrogates that may have the data are offline. In this case, surrogates MUST NOT use the affected data without first revalidating it when they are back online.This does not apply too "preposition"orand "purge"triggers. 5. Properties of Triggers 5.1. Properties of Trigger Requests Properties of Trigger Requeststriggers can be reported as "processed" if affected caches aredefined in the following subsections. Property: type Description: This property defines the type ofoffline and thetrigger. Type: TriggerType Mandatory: Yes Property: metadata.urls Description: The uCDN URL foractivity will complete when they return to service. o Otherwise, themetadatadCDN SHOULD keep the triggerapplies to. Type: URLs Mandatory: No, but at least one of 'metadata.*' or 'content.*' MUST be present and non-empty. Property: content.urls Description: URLs of content data the trigger applies to, see Section 5.1.1. Type: URLs Mandatory: No, but at least one of 'metadata.*' or 'content.*' MUST be present and non-empty. Property: content.ccid Description: The Content Collection IDentifier of data the trigger applies to. Type: List of strings Mandatory: No, but at least one of 'metadata.*'in state "pending" or'content.*' MUST be present and non-empty. Property: metadata.patterns Description: The metadata"active" until the triggerapplies to. Type: List of PatternMatch Mandatory: No, but at least one of 'metadata.*' or 'content.*' MUST be present and non-empty, and metadata.patterns MUST NOT be present if the TriggerTypeisPreposition. Property: content.patterns Description: The content data the trigger applies to. Type: List of PatternMatch Mandatory: No, but at least one of 'metadata.*'acted upon, or'content.*' MUST be present and non-empty, and content.patterns MUST NOT be present iftheTriggerType is Preposition. 5.1.1.uCDN chooses to cancel it. 4.8. Content URLs To refer to content in the dCDN, the uCDN MUST present URLs in the same formclients will use to access contentas inthat dCDN, after transformationthe metadata it supplied toremove any surrogate-specific parts of a 302-redirect URL form.the dCDN. By definition, it is always possible for the dCDN to locate content based on URLs in this form.IfTherefore, if content URLs are transformed by an intermediate CDN in a cascade, that intermediate CDN MUST transform URLs intrigger requestsCI/T commands it passes to its dCDN. When processingtrigger requests,Trigger Specifications, CDNs MUST ignore the URL scheme (http or https) in comparing URLs. For example, for an invalidate or purge trigger, content MUST be invalidated or purged regardless of the protocol clients use to request it.5.2.5. CI/T Object Propertiesofand Encoding CI/T Commands, Trigger Status ResourcesProperty: trigger Description: Theand Trigger Collections and their propertiesof trigger request that created this record. Type: TriggerRequest Mandatory: Yes Property: ctime Description: Time at whichare encoded using JSON, as defined in sections Section 5.1.1, Section 5.2.1, and Section 5.1.2. Names in JSON are case sensitive and therefore therequest was receivednames and literal values specified here MUST always use lower-case. Unrecognised name/value pairs in JSON objects SHOULD NOT be treated as an error by either the uCDN or dCDN.Time is5.1. CI/T Objects The top-level objects defined by the CI/T interface are described in this section. Each has an associated MIME Media Type. The encoding of values used by these objects is described in Section 5.2. 5.1.1. CI/T Commands CI/T Commands SHOULD use a MIME Media Type of application/ cdni.ci.TriggerCommand+json. A CI/T Command is encoded as a JSON object containing the following name/value pairs. Name: trigger Description: A specification of the trigger type, and a set of data to act upon. Value: A Trigger Specification, as defined in Section 5.2.1. Mandatory: No, but exactly one of "trigger" or "cancel" MUST be present in a CI/T Command. Name: cancel Description: The URLs of Trigger Status Resources for triggers that the uCDN wants to cancel. Value: A JSON array of URLs represented as JSON strings. Mandatory: No, but exactly one of "trigger" or "cancel" MUST be present in a CI/T Command. Name: cdn-path Description: The CDN Provider Identifiers of CDNs that have already accepted the CI/T Command. Value: A JSON array of JSON strings, where each string is a CDN Provider Identifier as defined in Section 4.6. Mandatory: Yes. 5.1.2. Trigger Status Resource Trigger Status Resources SHOULD use a MIME Media Type of application/ cdni.ci.TriggerStatus+json. A Trigger Status Resource is encoded as a JSON object containing the following name/value pairs. Name: trigger Description: The Trigger Specification that was used to create this Trigger Status Resource. Value: A Trigger Specification, as defined in Section 5.2.1. Mandatory: Yes Name: ctime Description: Time at which the CI/T Command was received by the dCDN. Time is determined by the dCDN, there is no requirement to synchronise clocks between interconnected CDNs.Type: AbsoluteTimeValue: Absolute Time, as defined in Section 5.2.5. Mandatory: YesProperty:Name: mtime Description: Time at which theresourceTrigger Status Resource was last modified. Time is determined by the dCDN, there is no requirement to synchronise clocks between interconnected CDNs.Type: AbsoluteTimeValue: Absolute Time, as defined in Section 5.2.5. Mandatory: YesProperty:Name: etime Description: Estimate of the time at which the dCDN expects to complete the activity. Time is determined by the dCDN, there is no requirement to synchronise clocks between interconnected CDNs.Type: AbsoluteTimeValue: Absolute Time, as defined in Section 5.2.5. Mandatory: NoProperty:Name: status Description: Current status of the triggered activity.Type: TriggerStatusValue: Trigger Status, as defined in Section 5.2.3. Mandatory: YesProperty:Name: errors Description:ListDescriptions of errors that have occurred while processing a Trigger Command. Value: A list ofErrorDesc.Error Descriptions, as defined in Section 5.2.6. Mandatory: No.5.3. Properties of ErrorDesc An ErrorDesc object is used to report failure for URLs and patterns in5.1.3. Trigger Collection Trigger Collections SHOULD use atrigger request. Property: error Type: ErrorCode. Mandatory: Yes. Property: metadata.urls, content.urls, metadata.patterns, content.patterns Description: Metadata and content references copied from the trigger request. Only those URLs and patterns to which the error applies shall be included in each property, but those URLs and patterns MUST be exactly as they appear in the request, the dCDN must not generalise the URLs. (For example, if the uCDN requests prepositioning of URLs "http://ucdn.example.com/a" and "http://ucdn.example.com/b", the dCDN must not generalise its error report to Pattern "http://ucdn.example.com/*"). Mandatory: At least oneMIME Media Type ofthese properties is mandatory in each ErrorDesc. Property: description Description:application/ cdni.ci.TriggerCollection+json. AString containingTrigger Collection is encoded as ahuman-readable description ofJSON object containing theerror. Mandatory: No. 5.4. Properties of Trigger Collections Property:following name/value pairs. Name: triggers Description: Links to Trigger Status Resources in the collection.Type: URLs.Value: A JSON array of URLs represented as JSON strings. Mandatory: YesProperty:Name: staleresourcetime Description: The length of time for which the dCDN guarantees to keep a completed Trigger Status Resource. After this time, the dCDNMAYSHOULD delete the resource and all references to it from collections.Type: Integer,Value: A JSON number, integer time in seconds. Mandatory: Yes, in the collection of all Trigger Status Resources if the dCDN deletes stale entries. If the property is present in the filtered collections, it MUST have the same value as in the collection of all Trigger Status Resources.5.5.Names: coll-all, coll-pending, coll-active, coll-complete, coll- failed Description: Link to a TriggerResource Simple Data Type Descriptions This section describes the simpler data types thatCollection. Value: A URL represented as a JSON string. Mandatory: Links to filtered collections areused for propertiesmandatory in the collection of all Trigger Statusresources. 5.5.1. TriggerType This type definesResources, if thetypedCDN implements the filtered collections. Otherwise, optional. Name: cdn-id Description: The CDN Provider Identifier ofaction being triggered, permitted actions are: o Preposition - a request forthedCDN to acquire metadata or content. o Invalidate - a request fordCDN. Value: A JSON string, thedCDN to invalidate metadata or content. After servicing this requestdCDN's CDN Provider Identifier, as defined in Section 4.6. Mandatory: Only in thedCDN will not usecollection of all Trigger Status Resources, if thespecified data without first re-validating it using, for example, an "If-None-Match" HTTP request. ThedCDNneed not erase the associated data. o Purge - a request for the dCDN to erase metadata or content. After servicingimplements therequest,filtered collections. Optional in thespecified data MUST NOT be held on dCDN. 5.5.2. TriggerStatusfiltered collections. 5.2. Properties of CI/T Objects Thistype describessection defines thecurrent status of a Trigger, possiblevaluesare: o Pending - the trigger has not yet been acted upon. o Active -that can appear in thetriggertop level objects described in Section 5.1, and their encodings. 5.2.1. Trigger Specification A Trigger Collection iscurrently being acted upon. o Complete -encoded as a JSON object containing thetriggered activity completed successfully. o Processed -following name/value pairs. An unrecognised name/value pair in thetrigger has been accepted and no further status update will be made (may be usedTrigger Specification object contained incases where completion cannota CI/T Command SHOULD beconfirmed). o Failed -preserved in thetriggered activity could not be completed. 5.5.3. URLs This type describes a setTrigger Specification ofreferences to metadata or content,any Trigger Status Resource itis simply a list of absolute URLs. 5.5.4. AbsoluteTime Times are expressed in seconds since the UNIX epoch. 5.5.5. ErrorCodecreates. Name: type Description: This property defines the typeis used by dCDN to report failuresof the trigger. Value: Trigger Type, as defined intrigger processing. o EMETA -Section 5.2.2. Mandatory: Yes Name: metadata.urls Description: The uCDN URLs of thedCDN was unable to acquiremetadatarequired to fulfil the request. o ECONTENT -thedCDN was unable to acquiretrigger applies to. Value: A JSON array of URLs represented as JSON strings. Mandatory: No, but at least one of 'metadata.*' or 'content.*' MUST be present and non-empty. Name: content.urls Description: URLs of content(preposition triggers only). o EPERM -theuCDN does not have permission totriggerthe requested activity (for example, the data is owned by another CDN). o EREJECT - the dCDN is not willing to fulfil the request (for example, a preposition request for content at a time when dCDN would not accept Request Routing requests from uCDN). o ECDN - An internal error in the dCDN or one of its downstream CDNs. 6.applies to, see Section 4.8. Value: A JSONEncodingarray ofObjects The encoding for a CI/T object is aURLs represented as JSONobject containing a dictionarystrings. Mandatory: No, but at least one of(key,value) pairs where the keys are the property names,'metadata.*' or 'content.*' MUST be present andthe values are the associated property values.non-empty. Name: content.ccid Description: ThekeysContent Collection Identifier of content thedictionary are the namestrigger applies to. The 'ccid' is a grouping ofthe properties associated with the object and are therefore dependent on the specific object being encoded (i.e. dependent on the MIME Media Typecontent, as defined by [I-D.ietf-cdni-metadata]. Value: A JSON array ofthe returned resource). Likewise, the values associated withstrings, where eachkey are dependent on the specific object being encoded (i.e. dependent on the MIME Media Typestring is a Content Collection Identifier. Mandatory: No, but at least one ofthe returned resource).'metadata.*' or 'content.*' MUST be present and non-empty. Name: metadata.patterns Description: The"trigger" property ofmetadata thetop leveltrigger applies to. Value: A JSONobject listsarray of Pattern Match, as defined in Section 5.2.4. Mandatory: No, but at least one of 'metadata.*' or 'content.*' MUST be present and non-empty, and metadata.patterns MUST NOT be present if therequested action. Key: triggerTriggerType is Preposition. Name: content.patterns Description:An object specifyingThe content data the triggertype and a set of data to act upon. Type:applies to. Value: A JSONobject. Mandatory: Yes. Object keysarray of Pattern Match, as defined inJSON are case sensitive and therefore any dictionary key defined by this document (for example the namesSection 5.2.4. Mandatory: No, but at least one ofCI/T object properties)'metadata.*' or 'content.*' MUSTalwaysberepresentedpresent and non-empty, and content.patterns MUST NOT be present if the TriggerType is Preposition. 5.2.2. Trigger Type Trigger Type is used inlowercase. In additiona Trigger Specification tothe propertiesdescribe trigger action. It MUST be one ofan object,the JSON strings in the followingadditional keys MAY be present. Key: base Description: Provides a prefixtable: +-------------+-----------------------------------------------------+ | JSON String | Description | +-------------+-----------------------------------------------------+ | preposition | A request forany relative URLs intheobject. This is similardCDN to acquire metadata or | | | content. | | invalidate | A request for theXML base tag [XML-BASE]. If absent, all URLs indCDN to invalidate metadata or | | | content. After servicing this request theremainder ofdCDN will | | | not use thedocument MUST be absolute URLs. Type: URI Mandatory: No Key: _links Description:specified data without first re- | | | validating it using, for example, an "If-None- | | | Match" HTTP request. Therelationships of this objectdCDN need not erase the | | | associated data. | | purge | A request for the dCDN toother addressable objects. Type: Array of Relationships. Mandatory: Yes 6.1. JSON Encoding of Embedded Types 6.1.1. TriggerType Key: type Description: One of "preposition", "invalidate"erase metadata or"purge". Type: string 6.1.2. TriggerStatus Key:| | | content. After servicing the request, the specified | | | data MUST NOT be held on the dCDN. | +-------------+-----------------------------------------------------+ 5.2.3. Trigger Status This describes the current statusDescription: Oneof"pending", "active", "failed", "complete" Type: string 6.1.3. PatternMatch A PatternMatch is encoded asa Trigger. It MUST be one of the JSONObject containingstrings in the following table: +------------+------------------------------------------------------+ | JSON | Description | | String | | +------------+------------------------------------------------------+ | pending | The trigger has not yet been acted upon. | | active | The trigger is currently being acted upon. | | complete | The triggered activity completed successfully. | | processed | The trigger has been accepted and no further status | | | update will be made (can be used in cases where | | | completion cannot be confirmed). | | failed | The triggered activity could not be completed. | | cancelling | The triggered activity is still in progress, but the | | | trigger has been cancelled by the uCDN. | | cancelled | The triggered activity was cancelled by the uCDN. | +------------+------------------------------------------------------+ 5.2.4. PatternMatch A Pattern Match consists of a string pattern tomatchmatch, and flags describing the type of match.Key:It is encoded as a JSON object with the following name/value pairs: Name: pattern Description: A pattern for string matching. Value: A JSON string representing the pattern. The pattern may contain the wildcards * and ?, where * matches any sequence of characters (including the empty string) and ? matches exactly one character. The three literals\"\" ,*"*" and?"?" MUST be escaped as\\, \*"\\", "\*" and\? Type: String"\?". Mandatory:Yes Key:Yes. Name: case-sensitive Description: Flag indicating whether or not case-sensitive matching should be used.Type: BooleanValue: One of the JSON values 'true' or 'false'. Mandatory: No, default is case-insensitive match.Key:Name: match-query-string Description: Flag indicating whether or not the query string should be included in the pattern match.Type: BooleanValue: One of the JSON values 'true' or 'false'. Mandatory: No, default is not to includequery.the query string in the pattern match. Example of case-sensitive prefix match against "http://www.example.com/trailers/": { "pattern": "http://www.example.com/trailers/*", "case-sensitive": true }6.1.4. ErrorDesc ErrorDesc5.2.5. Absolute Time A JSON number, seconds since the UNIX epoch. 5.2.6. Error Description An Error Description isencoded asused to report failure of aJSON object withTrigger Command, or in thefollowing keys: Key:activity it triggered. Name: errorType: ErrorCodeValue: Error Code, as defined in Section 5.2.7. Mandatory:Yes Keys:Yes. Names: metadata.urls,content.urls Type: Array of strings Mandatory: At least one of metadata.* or content.* MUST be present. Keys:content.urls, metadata.patterns, content.patternsType: ArrayDescription: Metadata and content references copied from the Trigger Specification. Only those URLs and patterns to which the error applies are included in each property, but those URLs and patterns MUST be exactly as they appear in the request, the dCDN MUST NOT generalise the URLs. (For example, if the uCDN requests prepositioning ofPatternMatchURLs "http://content.example.com/a" and "http://content.example.com/b", the dCDN must not generalise its error report to Pattern "http://content.example.com/*".) Value: A JSON array of JSON strings, where each string is copied from a 'content.*' or 'metadata.*' value in the corresponding Trigger Specification. Mandatory: At least one ofmetadata.* or content.* MUST be present. Key:these name/value pairs is mandatory in each Error Description object. Name: descriptionType: StringDescription: A human-readable description of the error. Value: A JSON string, the human-readable description. Mandatory: No.6.1.5. ErrorCode One of5.2.7. Error Code This type is used by thestrings "EMETA", "ECONTENT", "EPERM", "EREJECT" or "ECDN". 6.2. MIME Media Types Table 1 listsdCDN to report failures in trigger processing. +------------+------------------------------------------------------+ | Error Code | Description | +------------+------------------------------------------------------+ | emeta | The dCDN was unable to acquire metadata required to | | | fulfil the request. | | econtent | The dCDN was unable to acquire content (preposition | | | triggers only). | | eperm | The uCDN does not have permission to trigger theMIME Media Type for| | | requested activity (for example, thetrigger request, and each trigger object (resource) thatdata isretrievable throughowned | | | by another CDN). | | ereject | The dCDN is not willing to fulfil theCI/T interface. +-------------------+--------------------------------------------+request (for |Data Object|MIME Media Type|+-------------------+--------------------------------------------+example, a preposition request for content at a time | |TriggerRequest|application/cdni.ci.TriggerRequest+jsonwhen the dCDN would not accept Request Routing | |TriggerStatus|application/cdni.ci.TriggerStatus+jsonrequests from the uCDN). | |TriggerCollectionecdn |application/cdni.ci.TriggerCollection+jsonAn internal error in the dCDN or one of its |+-------------------+--------------------------------------------+ Table 1: MIME Media Types for CDNI Trigger resources 7.| | downstream CDNs. | | ecancelled | The uCDN cancelled the request. | +------------+------------------------------------------------------+ 6. Examples The following sections provide examples of different CI/T objects encoded as JSON.No authentication is shown in the following illustrative examples, it is anticipated that authentication mechanisms will be aligned with other CDNI Interfaces as and when those mechanisms are defined.Discovery of the triggers interface is out of scope of this document. In an implementation, all CI/T URLs are under the control of the dCDN. The uCDN MUST NOT attempt to ascribe any meaning to individual elements of the path. In examples in this section, thefollowing URLs areURL 'http://dcdn.example.com/ triggers' is used as the location of thecollections of triggers: o Collectioncollection of allTriggers belonging to one uCDN: http://dcdn.example.com/triggers o Filtered collections: Pending: http://dcdn.example.com/triggers/pending Active: http://dcdn.example.com/triggers/active Complete: http://dcdn.example.com/triggers/complete Failed: http://dcdn.example.com/triggers/failed 7.1.triggers, and the CDN Provider Id of uCDN is "AS64496:1". 6.1. Creating Triggers Examples of the uCDN triggering activity in the dCDN:7.1.1.6.1.1. Preposition An example of a preposition request, a POST to the "AllTriggers" collection. Note that "metadata.patterns" and "content.patterns" are not allowed in a prepositiontrigger request.Trigger Specification. REQUEST: POST /triggers HTTP/1.1 User-Agent: example-user-agent/0.1 Host: dcdn.example.com Accept: */* Content-Type:application/cdni.ci.TriggerRequest+jsonapplication/cdni.ci.TriggerCommand+json Content-Length:315347 { "trigger" : { "type": "preposition", "metadata.urls" : [ "http://metadata.example.com/a/b/c" ], "content.urls" : [ "http://www.example.com/a/b/c/1", "http://www.example.com/a/b/c/2", "http://www.example.com/a/b/c/3", "http://www.example.com/a/b/c/4" ]}}, "cdn-path" : [ "AS64496:1" ] } RESPONSE: HTTP/1.1 201 Created Date:Wed, 02 JulSun, 31 Aug 201418:57:1909:53:18 GMT Content-Length: 472 Content-Type: application/cdni.ci.TriggerStatus+json Location: http://dcdn.example.com/triggers/0 Server: example-server/0.1 { "ctime":1404327439,1409478798, "etime":1404327447,1409478806, "mtime":1404327439,1409478798, "status": "pending", "trigger": { "content.urls": [ "http://www.example.com/a/b/c/1", "http://www.example.com/a/b/c/2", "http://www.example.com/a/b/c/3", "http://www.example.com/a/b/c/4" ], "metadata.urls": [ "http://metadata.example.com/a/b/c" ], "type": "preposition" } }7.1.2.6.1.2. Invalidate An example of an invalidate request, another POST to the "AllTriggers" collection. This instructs the dCDN to re-validate the content at "http://www.example.com/a/index.html", as well as any metadata and content whose URLs are prefixed by "http://metadata.example.com/a/b/" and "http://www.example.com/a/b/" respectively, using case-insensitive matching. REQUEST: POST /triggers HTTP/1.1 User-Agent: example-user-agent/0.1 Host: dcdn.example.com Accept: */* Content-Type:application/cdni.ci.TriggerRequest+jsonapplication/cdni.ci.TriggerCommand+json Content-Length:352384 { "trigger" : { "type": "invalidate", "metadata.patterns" : [ { "pattern" : "http://metadata.example.com/a/b/*" } ], "content.urls" : [ "http://www.example.com/a/index.html" ], "content.patterns" : [ { "pattern" : "http://www.example.com/a/b/*", "case-sensitive" : true } ]}}, "cdn-path" : [ "AS64496:1" ] } RESPONSE: HTTP/1.1 201 Created Date:Wed, 02 JulSun, 31 Aug 201418:57:2009:53:19 GMT Content-Length: 551 Content-Type: application/cdni.ci.TriggerStatus+json Location: http://dcdn.example.com/triggers/1 Server: example-server/0.1 { "ctime":1404327440,1409478799, "etime":1404327448,1409478807, "mtime":1404327440,1409478799, "status": "pending", "trigger": { "content.patterns": [ { "case-sensitive": true, "pattern": "http://www.example.com/a/b/*" } ], "content.urls": [ "http://www.example.com/a/index.html" ], "metadata.patterns": [ { "pattern": "http://metadata.example.com/a/b/*" } ], "type": "invalidate" } }7.2.6.2. Examining Trigger Status Once triggers have been created, the uCDN can check their status as shown in these examples.7.2.1.6.2.1. Collection of All Triggers The uCDN can fetch the set of all the triggers it has created and which have not yet been deleted or removed as expired. After creation of the "preposition" and "invalidate" triggers shown above, this collection might look as follows: REQUEST: GET /triggers HTTP/1.1 User-Agent: example-user-agent/0.1 Host: dcdn.example.com Accept: */* RESPONSE: HTTP/1.1 200 OK Content-Length:153347 Expires:Wed, 02 JulSun, 31 Aug 201418:58:2009:54:19 GMT Server: example-server/0.1 Etag:"9179988753593038498""-6516741166528256414" Cache-Control: max-age=60 Date:Wed, 02 JulSun, 31 Aug 201418:57:2009:53:19 GMT Content-Type: application/cdni.ci.TriggerCollection+json { "cdn-id": "AS64496:0", "coll-active": "/triggers/active", "coll-complete": "/triggers/complete", "coll-failed": "/triggers/failed", "coll-pending": "/triggers/pending", "staleresourcetime": 86400, "triggers": [ "http://dcdn.example.com/triggers/0", "http://dcdn.example.com/triggers/1" ] }7.2.2.6.2.2. Filtered Collections of Triggers The filtered collections are also available to the uCDN. Before the dCDN starts processing the two triggers shown above, both will appear in the collection of Pending Triggers, for example:RREQUEST:REQUEST: GET /triggers/pending HTTP/1.1 User-Agent: example-user-agent/0.1 Host: dcdn.example.com Accept: */* RESPONSE: HTTP/1.1 200 OK Content-Length: 153 Expires:Wed, 02 JulSun, 31 Aug 201418:58:2009:54:19 GMT Server: example-server/0.1 Etag: "5012053611544832286" Cache-Control: max-age=60 Date:Wed, 02 JulSun, 31 Aug 201418:57:2009:53:19 GMT Content-Type: application/cdni.ci.TriggerCollection+json { "staleresourcetime": 86400, "triggers": [ "http://dcdn.example.com/triggers/0", "http://dcdn.example.com/triggers/1" ] } At this point, if no other triggers had been created, the other filtered views of the triggers would be empty. For example: REQUEST: GET /triggers/complete HTTP/1.1 User-Agent: example-user-agent/0.1 Host: dcdn.example.com Accept: */* RESPONSE: HTTP/1.1 200 OK Content-Length: 56 Expires:Wed, 02 JulSun, 31 Aug 201418:58:2009:54:19 GMT Server: example-server/0.1 Etag: "2986340333785000363" Cache-Control: max-age=60 Date:Wed, 02 JulSun, 31 Aug 201418:57:2009:53:19 GMT Content-Type: application/cdni.ci.TriggerCollection+json { "staleresourcetime": 86400, "triggers": [] }7.2.3.6.2.3. Trigger Status Resources The Trigger Status Resources can also be examined for detail about individual triggers. For example, for the "preposition" and "invalidate" triggers from previous examples: REQUEST: GET /triggers/0 HTTP/1.1 User-Agent: example-user-agent/0.1 Host: dcdn.example.com Accept: */* RESPONSE: HTTP/1.1 200 OK Content-Length: 472 Expires:Wed, 02 JulSun, 31 Aug 201418:58:2009:54:19 GMT Server: example-server/0.1 Etag:"-3651695664007658154""-4765587034697674779" Cache-Control: max-age=60 Date:Wed, 02 JulSun, 31 Aug 201418:57:2009:53:19 GMT Content-Type: application/cdni.ci.TriggerStatus+json { "ctime":1404327439,1409478798, "etime":1404327447,1409478806, "mtime":1404327439,1409478798, "status": "pending", "trigger": { "content.urls": [ "http://www.example.com/a/b/c/1", "http://www.example.com/a/b/c/2", "http://www.example.com/a/b/c/3", "http://www.example.com/a/b/c/4" ], "metadata.urls": [ "http://metadata.example.com/a/b/c" ], "type": "preposition" } } REQUEST: GET /triggers/1 HTTP/1.1 User-Agent: example-user-agent/0.1 Host: dcdn.example.com Accept: */* RESPONSE: HTTP/1.1 200 OK Content-Length: 551 Expires:Wed, 02 JulSun, 31 Aug 201418:58:2009:54:19 GMT Server: example-server/0.1 Etag:"-7664987687828084413""-7657333837290433420" Cache-Control: max-age=60 Date:Wed, 02 JulSun, 31 Aug 201418:57:2009:53:19 GMT Content-Type: application/cdni.ci.TriggerStatus+json { "ctime":1404327440,1409478799, "etime":1404327448,1409478807, "mtime":1404327440,1409478799, "status": "pending", "trigger": { "content.patterns": [ { "case-sensitive": true, "pattern": "http://www.example.com/a/b/*" } ], "content.urls": [ "http://www.example.com/a/index.html" ], "metadata.patterns": [ { "pattern": "http://metadata.example.com/a/b/*" } ], "type": "invalidate" } }7.2.4.6.2.4. Polling for Change The uCDNmaySHOULD use the Entity Tags of collections or resources when polling for change in status, as shown in the following examples: REQUEST: GET /triggers/pending HTTP/1.1 User-Agent: example-user-agent/0.1 Host: dcdn.example.com Accept: */* If-None-Match: "5012053611544832286" RESPONSE: HTTP/1.1 304 Not Modified Content-Length: 0 Expires:Wed, 02 JulSun, 31 Aug 201418:58:2009:54:19 GMT Server: example-server/0.1 Etag: "5012053611544832286" Cache-Control: max-age=60 Date:Wed, 02 JulSun, 31 Aug 201418:57:2009:53:19 GMT Content-Type: application/cdni.ci.TriggerCollection+json REQUEST: GET /triggers/0 HTTP/1.1 User-Agent: example-user-agent/0.1 Host: dcdn.example.com Accept: */* If-None-Match:"-3651695664007658154""-4765587034697674779" RESPONSE: HTTP/1.1 304 Not Modified Content-Length: 0 Expires:Wed, 02 JulSun, 31 Aug 201418:58:2009:54:19 GMT Server: example-server/0.1 Etag:"-3651695664007658154""-4765587034697674779" Cache-Control: max-age=60 Date:Wed, 02 JulSun, 31 Aug 201418:57:2009:53:19 GMT Content-Type: application/cdni.ci.TriggerStatus+json When the triggered activity is complete, the contents of the filtered collections will be updated, along with their Entity Tags. For example, when the two example triggers are complete, the collections of pending and complete triggersmaymight look like: REQUEST: GET /triggers/pending HTTP/1.1 User-Agent: example-user-agent/0.1 Host: dcdn.example.com Accept: */* RESPONSE: HTTP/1.1 200 OK Content-Length: 56 Expires:Wed, 02 JulSun, 31 Aug 201418:58:2409:54:29 GMT Server: example-server/0.1 Etag: "-4471185573414616962" Cache-Control: max-age=60 Date:Wed, 02 JulSun, 31 Aug 201418:57:2409:53:29 GMT Content-Type: application/cdni.ci.TriggerCollection+json { "staleresourcetime": 86400, "triggers": [] } REQUEST: GET /triggers/complete HTTP/1.1 User-Agent: example-user-agent/0.1 Host: dcdn.example.com Accept: */* RESPONSE: HTTP/1.1 200 OK Content-Length: 153 Expires:Wed, 02 JulSun, 31 Aug 201418:58:3109:54:30 GMT Server: example-server/0.1 Etag: "-1508172875796647067" Cache-Control: max-age=60 Date:Wed, 02 JulSun, 31 Aug 201418:57:3109:53:30 GMT Content-Type: application/cdni.ci.TriggerCollection+json { "staleresourcetime": 86400, "triggers": [ "http://dcdn.example.com/triggers/0", "http://dcdn.example.com/triggers/1" ] }7.2.5. Cancelling or6.2.5. Removing a Trigger To request the dCDN to cancel a Trigger, the uCDNmaycan delete the Trigger Resource. Itmaycan also delete completed and failed triggers to reduce the size of the collections. For example, to remove the "preposition" request from earlier examples: REQUEST: DELETE /triggers/0 HTTP/1.1 User-Agent: example-user-agent/0.1 Host: dcdn.example.com Accept: */* RESPONSE: HTTP/1.1 204 No Content Date:Wed, 02 JulSun, 31 Aug 201418:57:3109:53:30 GMT Content-Length: 0 Content-Type: text/html; charset=UTF-8 Server: example-server/0.1 This would, for example, cause the collection of completed triggers shown in the example above to be updated to: REQUEST: GET /triggers/complete HTTP/1.1 User-Agent: example-user-agent/0.1 Host: dcdn.example.com Accept: */* RESPONSE: HTTP/1.1 200 OK Content-Length: 106 Expires:Wed, 02 JulSun, 31 Aug 201418:58:3109:54:30 GMT Server: example-server/0.1 Etag: "-1842390246836476263" Cache-Control: max-age=60 Date:Wed, 02 JulSun, 31 Aug 201418:57:3109:53:30 GMT Content-Type: application/cdni.ci.TriggerCollection+json { "staleresourcetime": 86400, "triggers": [ "http://dcdn.example.com/triggers/1" ] }7.2.6.6.2.6. Error Reporting In this example the uCDN has requested prepositioning of "http://newsite.example.com/index.html", but the dCDN was unable to locate metadata for that site: REQUEST: GET /triggers/2 HTTP/1.1 User-Agent: example-user-agent/0.1 Host: dcdn.example.com Accept: */* RESPONSE: HTTP/1.1 200 OK Content-Length: 505 Expires:Wed, 02 JulSun, 31 Aug 201419:16:4809:54:38 GMT Server: example-server/0.1 Etag:"-6310233270471598826""-3893590191073700822" Cache-Control: max-age=60 Date:Wed, 02 JulSun, 31 Aug 201419:15:4809:53:38 GMT Content-Type: application/cdni.ci.TriggerStatus+json { "ctime":1404328544,1409478810, "errors": [ { "content.urls": [ "http://newsite.example.com/index.html" ], "description": "No HostIndex entry found fornewsite.example.com", "error": "EMETA" } ], "etime": 1404328552, "mtime": 1404328548, "status": "active", "trigger": { "content.urls": [ "http://newsite.example.com/index.html" ], "type": "preposition" } } 8. IANA Considerations 8.1.newsite.example.com", "error": "emeta" } ], "etime": 1409478818, "mtime": 1409478814, "status": "active", "trigger": { "content.urls": [ "http://newsite.example.com/index.html" ], "type": "preposition" } } 7. IANA Considerations 7.1. Media type registrations 7.1.1. CI/T Commands The MIME media type for CI/T Commands is application/ cdni.ci.TriggerCommand+json. Type Name: application Subtype name: cdni.ci.TriggerCommand+json Required parameters: N/A Optional parameters: N/A Encoding considerations: binary Security Considerations: See [RFCthis], Section 8 Interoperability Considerations: Described in [RFCthis] Published Specification: [RFCthis] Applications that use this media type: No known applications currently use this media type. Additional Information: Deprecated alias names for this type: N/A Magic number(s): N/A File Extensions: N/A Macintosh file type code(s): TEXT Person & email address to contact for further information: IESG <iesg@ietf.org> Intended Usage: COMMON Restrictions on usage: None Author: Rob Murray <rob.murray@alcatel-lucent.com> Change controller: IESG <iesg@ietf.org> Note: No "charset" parameter is defined for this registration because a charset parameter is not defined for application/json [RFC7159]. 7.1.2. CI/TMIME Media TypesTrigger Status Resource TheIANAMIME media type for CI/T Trigger Status Resources isrequestedapplication/ cdni.ci.TriggerStatus+json. Type Name: application Subtype name: cdni.ci.TriggerStatus+json Required parameters: N/A Optional parameters: N/A Encoding considerations: binary Security Considerations: See [RFCthis], Section 8 Interoperability Considerations: Described in [RFCthis] Published Specification: [RFCthis] Applications that use this media type: No known applications currently use this media type. Additional Information: Deprecated alias names for this type: N/A Magic number(s): N/A File Extensions: N/A Macintosh file type code(s): TEXT Person & email address toallocate the following MIME Media Types in thecontact for further information: IESG <iesg@ietf.org> Intended Usage: COMMON Restrictions on usage: None Author: Rob Murray <rob.murray@alcatel-lucent.com> Change controller: IESG <iesg@ietf.org> Note: No "charset" parameter is defined for this registration because a charset parameter is not defined for application/json [RFC7159]. 7.1.3. CI/T Trigger Collection The MIMEMedia Types registry: o application/cdni.ci.TriggerRequest o application/cdni.ci.TriggerStatus o application/cdni.ci.TriggerCollection Use of these typesmedia type for CI/T Trigger Collections isspecified inapplication/ cdni.ci.TriggerCollection+json. Type Name: application Subtype name: cdni.ci.TriggerCollection+json Required parameters: N/A Optional parameters: N/A Encoding considerations: binary Security Considerations: See [RFCthis], Section6.2 of the present document. 9.8 Interoperability Considerations: Described in [RFCthis] Published Specification: [RFCthis] Applications that use this media type: No known applications currently use this media type. Additional Information: Deprecated alias names for this type: N/A Magic number(s): N/A File Extensions: N/A Macintosh file type code(s): TEXT Person & email address to contact for further information: IESG <iesg@ietf.org> Intended Usage: COMMON Restrictions on usage: None Author: Rob Murray <rob.murray@alcatel-lucent.com> Change controller: IESG <iesg@ietf.org> Note: No "charset" parameter is defined for this registration because a charset parameter is not defined for application/json [RFC7159]. 8. Security Considerations9.1.8.1. Authentication, Confidentiality, Integrity Protection A CI/T dCDN server implementation MUST support TLS transport for HTTP (https) as per [RFC2818]. The use of TLS for transport of the CI/T interface allows the dCDN and the uCDN toauthenticate each other (to ensure they are receiving trigger requests from, or reporting status to, an authenticated CDN). HTTP requests that attempt to access or operate on CI/T data belonging to another CDN MUST be rejected using either HTTP "403 Forbidden" or "404 Not Found". (Note that in a "diamond" configuration, where one uCDN's content can be acquired via more than one directly-connected uCDN, it may not be possible for the dCDN to determine from which uCDN it acquired content. In this case, it MUST allow each upstream that may have been responsible for acquisition of that content to act upon it using trigger requests.) Trigger creation requests that attempt to operate on metadata or content not acquired from the uCDN making the request MUST be rejected. The rejection can either be signalled to dCDN using HTTP "403 Forbidden" or "404 Not Found",authenticate each other (to ensure they are receiving CI/T Commands from, ora Trigger Status Resource can be created withreporting status to, anErrorDesc value of EPERM for any affected URLs.authenticated CDN). In an environment where any such protection is required, TLS SHOULD be used for transport of the CI/T requests and responses, unless alternate methods are used for ensuring that only authorised clients are able to access their own data (such as setting up an IPsec tunnel between the two CDNs, or using a physically secured internal network between two CDNs that are owned by the same corporate entity). Both parties of the transaction (the uCDN and the dCDN) SHOULD use mutual authentication. ACI/TTLS implementation of CI/T MUST support the TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 cipher suite ([RFC5288]). An implementation of the CI/T Interface SHOULD prefer cipher suites which support perfect forward secrecy over cipher suites that don't.9.2.HTTP requests that attempt to access or operate on CI/T data belonging to another CDN MUST be rejected using, for example, HTTP "403 Forbidden" or "404 Not Found". Note that in a "diamond" configuration, where one uCDN's content can be acquired via more than one directly-connected uCDN, it may not be possible for the dCDN to determine from which uCDN it acquired content. In this case, the dCDN MUST allow each uCDN from which the content could have been acquired to act upon that content using CI/T Commands. 8.2. Denial of Service This document does not define a specific mechanism to protect against Denial of Service (DoS) attacks on the CI/T. However, CI/T endpoints can be protected against DoS attacks through the use of TLS transport and/or via mechanisms outside the scope of the CI/T interface, such as firewalling or use of Virtual Private Networks (VPNs).10.Depending on the implementation, triggered activity may consume significant processing and bandwidth in the dCDN. A malicious or faulty uCDN could use this to generate unnecessary load in the dCDN. The dCDN should consider mechanisms to avoid overload, for example by rate-limiting acceptance or processing of CI/T Commands, or batching up its processing. 9. Acknowledgements The authors thank Kevin Ma for hisongoinginput.11.10. References11.1.10.1. Normative References [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, January 2005. [RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data Interchange Format", RFC 7159, March 2014. [RFC7231] Fielding, R. and J. Reschke, "Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content", RFC 7231, June 2014. [RFC7232] Fielding, R. and J. Reschke, "Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests", RFC 7232, June 2014.11.2.10.2. Informative References[I-D.ietf-cdni-framework] Peterson, L., Davie, B., and R. Brandenburg, "Framework for CDN Interconnection", draft-ietf-cdni-framework-14 (work in progress), June 2014.[I-D.ietf-cdni-metadata] Niven-Jenkins, B., Murray, R.,Watson, G.,Caulfield, M., Leung, K., and K. Ma, "CDNInterconnectInterconnection Metadata",draft- ietf-cdni-metadata-06draft-ietf- cdni-metadata-07 (work in progress),FebruaryJuly 2014.[I-D.ietf-cdni-requirements] Leung, K.[I-D.ietf-cdni-redirection] Niven-Jenkins, B. andY. Lee, "Content Distribution Network Interconnection (CDNI) Requirements", draft-ietf-cdni- requirements-17R. Brandenburg, "Request Routing Redirection Interface for CDN Interconnection", draft- ietf-cdni-redirection-03 (work in progress),JanuaryAugust 2014. [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000.[RFC4287] Nottingham, M., Ed. and R. Sayre, Ed., "The Atom Syndication Format", RFC 4287, December 2005.[RFC5288] Salowey, J., Choudhury, A., and D. McGrew, "AES Galois Counter Mode (GCM) Cipher Suites for TLS", RFC 5288, August 2008. [RFC6707] Niven-Jenkins, B., Le Faucheur, F., and N. Bitar, "Content Distribution Network Interconnection (CDNI) Problem Statement", RFC 6707, September 2012.[XML-BASE] Marsh, J., Ed.[RFC7336] Peterson, L., Davie, B., and R.Tobin, Ed., "XML Base (Second Edition) - http://www.w3.org/TR/xmlbase/", January 2009.van Brandenburg, "Framework for Content Distribution Network Interconnection (CDNI)", RFC 7336, August 2014. [RFC7337] Leung, K. and Y. Lee, "Content Distribution Network Interconnection (CDNI) Requirements", RFC 7337, August 2014. Authors' Addresses Rob Murray Velocix (Alcatel-Lucent) 3 Ely Road Milton, Cambridge CB24 6DD UK Email: rmurray@velocix.com Ben Niven-Jenkins Velocix (Alcatel-Lucent) 3 Ely Road Milton, Cambridge CB24 6DD UK Email: ben@velocix.com