<?xml version="1.0"?>
<?xml-stylesheet href="docbook.xsl" type="text/xsl" ?>
<book xmlns="http://docbook.org/ns/docbook" version="5.0">
  <info>
    <title>Cloud Integration Specification</title>
    <titleabbrev>Cloud Integration</titleabbrev>
    <releaseinfo>25.12</releaseinfo>
    <author>
      <orgname>ONVIF™</orgname>
      <uri>www.onvif.org</uri>
    </author>
    <pubdate>December, 2025</pubdate>
    <mediaobject>
      <imageobject>
        <imagedata fileref="media/logo.png" contentwidth="60mm"/>
      </imageobject>
    </mediaobject>
    <copyright>
      <year>2008-2025</year>
      <holder>ONVIF™ All rights reserved.</holder>
    </copyright>
    <legalnotice>
      <para>Recipients of this document may copy, distribute, publish, or display this document so
        long as this copyright notice, license and disclaimer are retained with all copies of the
        document. No license is granted to modify this document.</para>
      <para>THIS DOCUMENT IS PROVIDED "AS IS," AND THE CORPORATION AND ITS MEMBERS AND THEIR
        AFFILIATES, MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
        LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
        NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THIS DOCUMENT ARE SUITABLE FOR ANY PURPOSE;
        OR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS,
        TRADEMARKS OR OTHER RIGHTS.</para>
      <para>IN NO EVENT WILL THE CORPORATION OR ITS MEMBERS OR THEIR AFFILIATES BE LIABLE FOR ANY
        DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, ARISING OUT OF OR
        RELATING TO ANY USE OR DISTRIBUTION OF THIS DOCUMENT, WHETHER OR NOT (1) THE CORPORATION,
        MEMBERS OR THEIR AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR (2)
        SUCH DAMAGES WERE REASONABLY FORESEEABLE, AND ARISING OUT OF OR RELATING TO ANY USE OR
        DISTRIBUTION OF THIS DOCUMENT.  THE FOREGOING DISCLAIMER AND LIMITATION ON LIABILITY DO NOT
        APPLY TO, INVALIDATE, OR LIMIT REPRESENTATIONS AND WARRANTIES MADE BY THE MEMBERS AND THEIR
        RESPECTIVE AFFILIATES TO THE CORPORATION AND OTHER MEMBERS IN CERTAIN WRITTEN POLICIES OF
        THE CORPORATION.</para>
    </legalnotice>
    <revhistory>
      <revision>
        <revnumber>25.06</revnumber>
        <date>Jun-2025</date>
        <author>
          <personname>Ottavio Campana</personname>
        </author>
        <revremark>First release</revremark>
      </revision>
      <revision>
        <revnumber>25.12</revnumber>
        <date>Dec-2025</date>
        <author>
          <personname>Ottavio Campana</personname>
        </author>
        <revremark>Add listing the available FW images for cloud firmware upgrade</revremark>
      </revision>

    </revhistory>
  </info>
  <chapter>
    <title>Scope </title>
    <para>This document defines the connection protocol for sharing cloud native devices between
      cloud-based clients.</para>
  </chapter>
  <chapter>
    <title>Normative references</title>
    <para>IETF RFC 2617 - HTTP Authentication: Basic and Digest Access Authentication</para>
    <para role="reference">&lt;<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://tools.ietf.org/html/rfc2617"></link>&gt; </para>
    <para>IETF RFC 6750 - The OAuth 2.0 Authorization Framework: Bearer Token Usage</para>
    <para role="reference">&lt;<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://tools.ietf.org/html/rfc6750"></link>&gt; </para>
    <para>IETF RFC 7616 - HTTP Digest Access Authentication</para>
    <para role="reference">&lt;<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://tools.ietf.org/html/rfc7616"></link>&gt; </para>
    <para>ONVIF Core Specification</para>
    <para role="reference">&lt;<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.onvif.org/onvif/specs/core/ONVIF-Core-Specification.pdf"></link>&gt;</para>
    <para>ONVIF Security Service Specification</para>
    <para role="reference">&lt;<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://www.onvif.org/specs/srv/media/ONVIF-Security-Service-Spec.pdf"></link>&gt;</para>
    <para>OpenAPI 3.1.0</para>
    <para role="reference">&lt;<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://spec.openapis.org/oas/v3.1.0"></link>&gt;</para>
  </chapter>
  <chapter>
    <title>Terms and Definitions</title>
    <section>
      <title>Definitions</title>
      <informaltable>
        <tgroup cols="2">
          <colspec colname="c1" colwidth="24*" />
          <colspec colname="c2" colwidth="76*" />
          <tbody valign="top">
            <row>
              <entry align="left">
                <para>
                  <emphasis role="bold">Device Sharing</emphasis>
                </para>
              </entry>
              <entry align="left">
                <para>The procedure, started by the owner of the device, to allow another Operational Cloud Service to connect to the device.</para>
              </entry>
            </row>
            <row>
              <entry align="left">
                <para>
                  <emphasis role="bold">Device Transfer</emphasis>
                </para>
              </entry>
              <entry align="left">
                <para>The procedure, started by the owner of the device, to allow another Operational Cloud Service to connect to the device. With device transfer, the original cloud service loses access.</para>
              </entry>
            </row>
            <row>
              <entry align="left">
                <para>
                  <emphasis role="bold">Operational Cloud Service</emphasis>
                </para>
              </entry>
              <entry align="left">
                <para>The cloud platform receiving access to the devices from a provisioning cloud service.</para>
              </entry>
            </row>
            <row>
              <entry align="left">
                <para>
                  <emphasis role="bold">Manufacturer Cloud Service</emphasis>
                </para>
              </entry>
              <entry align="left">
                <para>The initial cloud platform, provided by the device vendor, where the user can take ownership of the devices.</para>
              </entry>
            </row>
            <row>
              <entry align="left">
                <para>
                  <emphasis role="bold">Provisioning Cloud Service</emphasis>
                </para>
              </entry>
              <entry align="left">
                <para>The cloud platform currently managing the device and starts either device transfer or sharing.</para>
              </entry>
            </row>
            <row>
              <entry align="left">
                <para>
                  <emphasis role="bold">Share Token</emphasis>
                </para>
              </entry>
              <entry align="left">
                <para>A Token passed between a "Provisioning Cloud Service" and an "Operational Cloud Service" to prove that the "Provisioning Cloud Service" has access rights to the device.</para>
              </entry>
            </row>
            <row>
              <entry align="left">
                <para>
                  <emphasis role="bold">Uplink</emphasis>
                </para>
              </entry>
              <entry align="left">
                <para>The connection established by the local service to the remote client.</para>
              </entry>
            </row>
            <row>
              <entry align="left">
                <para>
                  <emphasis role="bold">Web Services</emphasis>
                </para>
              </entry>
              <entry align="left">
                <para>A web service is a software component or system that allows devices to communicate over the internet by exchanging data.</para>
              </entry>
            </row>
          </tbody>
        </tgroup>
      </informaltable>
    </section>
    <section>
      <title>Abbreviations</title>
      <informaltable>
        <tgroup cols="2">
          <colspec colname="c1" colwidth="24*" />
          <colspec colname="c2" colwidth="76*" />
          <tbody valign="top">
            <row>
              <entry valign="middle">JSON</entry>
              <entry valign="middle">JavaScript Object Notation</entry>
            </row>
            <row>
              <entry valign="middle">JWT</entry>
              <entry valign="middle">JSON Web Token</entry>
            </row>
            <row>
              <entry valign="middle">
                <para>MCS</para>
              </entry>
              <entry valign="middle">
                <para>Manufacturer Cloud Service</para>
              </entry>
            </row>
            <row>
              <entry valign="middle">
                <para>OCS</para>
              </entry>
              <entry valign="middle">
                <para>Operational Cloud Service</para>
              </entry>
            </row>
            <row>
              <entry valign="middle">
                <para>PCS</para>
              </entry>
              <entry valign="middle">
                <para>Provisioning Cloud Service</para>
              </entry>
            </row>
            <row>
              <entry valign="middle">
                <para>VMS</para>
              </entry>
              <entry valign="middle">
                <para>Video Management System</para>
              </entry>
            </row>
            <row>
              <entry valign="middle">YAML</entry>
              <entry valign="middle">Yet Another Markup Language.</entry>
            </row>
          </tbody>
        </tgroup>
      </informaltable>
    </section>
  </chapter>
  <chapter>
    <title>Overview</title>
    <para>On-boarding devices in cloud native Video Management Systems involves two major steps:</para>
    <itemizedlist>
      <listitem>
        <para>A device taken out of the box connects with its pre-programmed parameters to a Manufacturer Cloud Service (MCS), so that the user can take ownership of the device. Once the device is successfully claimed by the user, the MCS behaves as a Provisioning Cloud Service (PCS).</para>
      </listitem>
      <listitem>
        <para>The user can transfer the device from a PCS to an Operational Cloud Service (OCS), i.e. the cloud native VMS the user expects to use for his surveillance system.</para>
      </listitem>
    </itemizedlist>
    <para><emphasis role="bold">N.B.</emphasis> that at any time, a OCS may act as a PCS.</para>
    <para>The scope of this cloud service covers only the second step, i.e. device sharing or transferring between different cloud services. The procedure outlined in these specifications can be used to share or transfer a device from a MCS to an OCS during the initial setup, but also from an old PCS to a new OCS.</para>
    <para>Figure <xref xmlns:xlink="http://www.w3.org/1999/xlink" linkend="_Ref752965479"/>
      demonstrates the two phases. <emphasis role="bold">N.B.</emphasis> the grey rectangle visually
      identifies the scope of these specifications.</para>
    <figure xml:id="_Ref752965479">
      <title>Onboarding phases and ONVIF scope</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="media/CloudIntegration/onboarding_scope.svg" contentwidth="159.97mm" />
        </imageobject>
      </mediaobject>
    </figure>
    <para>If the original connection to the MCS is kept, it is possibile for the MCS to perform FW
      upgrade, upon request from the OCS. On the MCS, multiple versions of device FW images may be
      present for each model, so that the OCS can select the desired one. In case upgrading to the
      desired FW version will require multiple operations, the device and the MCS will perform
      them automatically, without the need for the OCS to know the required steps.</para>
    <para>Figure <xref xmlns:xlink="http://www.w3.org/1999/xlink" linkend="_Ref752965478"/> demonstrates the flow for cloud firmware upgrade.</para>
    <figure xml:id="_Ref752965478">
      <title>Cloud firmware upgrade</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="media/CloudIntegration/cloud_fw_upgrade.svg" contentwidth="159.97mm" />
        </imageobject>
      </mediaobject>
    </figure>
    <section>
      <title>Web Services </title>
      <para>Unlike for other services defined by ONVIF, in this document the term Web Services is
        the name of a standardized method of integrating applications using open, platform
        independent Web Services standards such as JSON, OpenAPI 3.1.0 and YAML over an IP network.
        JSON is used as the data description syntax, OpenAPI is used for message transfer and YAML
        is used for describing the services.</para>
      <figure xml:id="_Ref211940201">
        <title> OpenAPI based development principles</title>
        <mediaobject>
          <imageobject>
            <imagedata fileref="media/CloudIntegration/openapi_based_development_principles.svg"
              contentwidth="80mm"/>
          </imageobject>
        </mediaobject>
      </figure>
      <para>
        <xref linkend="_Ref211940201"/> gives an overview of the basic principles for development
        based on Web Services and OpenAPI. The service provider (MCS) implements the ONVIF service.
        The service is described using the YAML-based file. Then, the YAML file is used as the basis
        for the service requester (OCS) implementation/integration. Integration is simplified using
        code generating tools that generate platform specific code that can be used by the
        developers to integrate the Web Service.</para>
      <para>The Web Service provider and requester communicate using the OpenAPI message exchange
        protocol. OpenAPI is a lightweight messaging protocol used to encode the information in a
        Web Service request and in a response message before sending them over a network. OpenAPI
        messages are independent of any operating system or protocol and may be transported using a
        variety of Internet protocols. This ONVIF standard defines conformant transport protocols
        for the SOAP messages for the described Web Services.</para>
      <para>The Web Service overview section introduces into the general ONVIF service structure,
        the command definition syntax in the specification, error handling principles and the
        adopted Web Service security mechanisms.</para>
      </section>
      <section xml:id="_Ref208379139">
        <title>Security</title>
        <section>
          <title>Authentication</title>
          <para>The functions defined within this document do not require authehtication, since presenting
          a valid share token is a valid proof that the user was successfully authenticated by the
          MCS.</para>
        </section>
        <section>
          <title>Information protection</title>
          <para>The services defined in this standard, whenever consumed, shall be protected by
          using only HTTPS as transport, in order to protect the share token from interception and
          unauthorized use.</para>
        </section>
      </section>
    <section xml:id="_Ref208379149">
      <title>Format of the share token</title>
      <para>To start the device sharing operation, the OCS must provide a share token to the PCS, to
        prove it has the rights to access the camera. The way the OCS retrieves the share token is
        beyond the scope of this specification.</para>
      <para>The share token must be a JWT and must include the following claims:</para>
      <itemizedlist>
        <listitem>
          <para><emphasis>onvif:xaddr</emphasis>: The full URI where the PCS will be accepting the
            incoming requests from the OCS</para>
        </listitem>
        <listitem>
          <para><emphasis>onvif:sn</emphasis>: The serial number of the device.</para>
        </listitem>
        <listitem>
          <para><emphasis>onvif:model</emphasis>: The device model.</para>
        </listitem>
        <listitem>
          <para><emphasis>onvif:manufacturer</emphasis>: The manufacturer of the device.</para>
        </listitem>
      </itemizedlist>
      <para>The claims <emphasis>onvif:sn</emphasis>, <emphasis>onvif:model</emphasis> and
          <emphasis>onvif:manufacturer</emphasis> shall match the values returned by GetDeviceInformation
        of the Device service.</para>
      </section>
  </chapter>
  <chapter>
    <title>Device sharing</title>
    <section>
      <title>startDeviceSharing</title>
      <para>This operation triggers sharing a device with a new Operational Cloud Service.</para>
      <para>Once the information is sent to the camera, the camera will generate a public key
        associated to the assigned ClientID. The generated public key will be passed to the PCS, so
        that it will transfer it to the OCS with the deviceSharingCompleted function, so that it
        will be able to authenticate the device and let it retrieve the JWT meant to be used to
        authenticate the Uplink Service.</para>
      <variablelist role="op">
        <varlistentry>
          <term>request</term>
          <listitem>
            <para role="text">startDeviceSharing [startDeviceSharing]</para>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>response</term>
          <listitem>
            <para role="param">This is an empty message</para>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>faults</term>
          <listitem>
            <para role="text">400 - Invalid Argument Value</para>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>
    <section>
      <title>deviceSharingCompleted</title>
      <para>This operation notifies the new Operational Cloud Service that the camera was
        successfully configured.</para>
      <para>The public key shall be a base64 encoded DER-encoded PKCS#10 certification request.</para>
      <variablelist role="op">
        <varlistentry>
          <term>request</term>
          <listitem>
            <para role="text">deviceSharingCompleted [deviceSharingCompleted]</para>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>response</term>
          <listitem>
            <para>This is an empty message.</para>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>faults</term>
          <listitem>
            <para role="text">No command specific faults defined.</para>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>
  </chapter>
  <chapter>
    <title>Firmware upgrade</title>
    <section>
      <title>getAvailableFWImages</title>
      <para>This operation notifies the OCS of the available FW versions for a specific device model.
        It is mandatory that the value of the model parameter coincides with the model parameter of
        tds:GetDeviceInformationResponse.</para>
      <variablelist role="op">
        <varlistentry>
          <term>request</term>
          <listitem>
            <para role="text">model [string]</para>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>response</term>
          <listitem>
            <para role="param">An array of lists with all the FW versions available for the
              specified model</para>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>faults</term>
          <listitem>
            <para role="text">400 - Invalid Argument Value</para>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>
  </chapter>
  <appendix role="revhistory">
    <title>Revision History</title>
    <para />
  </appendix>
</book>
