{
"$schema": "https://json-schema.org/draft/2019-09/schema",
- "$id": "urn:cps:org.onap.cps:data-updated-event-schema:v1",
+ "$id": "urn:cps:org.onap.cps:data-updated-event-schema:v2",
"$ref": "#/definitions/CpsDataUpdatedEvent",
"type",
"content"
],
- "additionalProperties": false
+ "additionalProperties": true
},
"Content": {
"description": "The name of CPS Core anchor the data is attached to.",
"type": "string"
},
+ "operation": {
+ "description": "The operation on the data",
+ "type": "string",
+ "enum": ["CREATE", "UPDATE", "DELETE"]
+ },
"data": {
"$ref": "#/definitions/Data"
}
"observedTimestamp",
"dataspaceName",
"schemaSetName",
- "anchorName",
- "data"
+ "anchorName"
],
- "additionalProperties": false
+ "additionalProperties": true
},
"Data": {
# ============LICENSE_START=======================================================
-# Copyright (c) 2021 Bell Canada.
+# Copyright (c) 2021-2022 Bell Canada.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
required: true
schema:
type: string
+ example: my-anchor
- $ref: '#/components/parameters/observedTimestampAfter'
- $ref: '#/components/parameters/simplePayloadFilter'
- $ref: '#/components/parameters/pointInTime'
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
+ example:
+ status: 400
+ message: Bad request error message
+ details: Bad request error details
Unauthorized:
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
+ example:
+ status: 401
+ message: Unauthorized error message
+ details: Unauthorized error details
Forbidden:
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
+ example:
+ status: 403
+ message: Forbidden error message
+ details: Forbidden error details
schemas:
AnchorDetails:
type: object
observedTimestamp:
type: string
example: '2021-03-21T00:00:00.000-0000'
+ operation:
+ type: string
+ enum: [CREATE, UPDATE, DELETE]
+ example: UPDATE
dataspace:
type: string
example: 'my-dataspace'
.. Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
..
-.. Copyright (C) 2021 Bell Canada
+.. Copyright (C) 2021-2022 Bell Canada
.. Modifications Copyright (C) 2021 Nordix Foundation
=======================
Docker. Refer to `README.md <https://github.com/onap/cps-cps-temporal/blob/master/README.md>`_
and `docker-compose.yml <https://github.com/onap/cps-cps-temporal/blob/master/docker-compose.yml>`_
files for more details.
+
+Upgrade
+=======
+
+**Cps data-updated-event schema v2**
+
+Cps data-updated-event schema v2 used in Jakarta is backward compatible with data-updated-event schema v1 used in Istanbul.
+
+It means that consumers using the schema v2 can process events generated by producers using the schema v2 or v1.
+
+This implies that cps temporal (consumer) must be upgraded from Istanbul to Jakarta at the same time or before cps core (producer) is upgraded from Istanbul to Jakarta.
\ No newline at end of file
.. Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
..
-.. Copyright (C) 2021 Bell Canada
+.. Copyright (C) 2021-2022 Bell Canada
=====================
CPS Temporal Modeling
Data manipulated by both CPS Core and CPS Temporal to represent a Data Updated
Event is a JSON structure that is defined by following Json Schema:
-* :download:`cps-data-updated-event-schema.json <../_static/event-schema/cps-data-updated-event-schema-v1.json>`
+* :download:`cps-data-updated-event-schema.json <../_static/event-schema/cps-data-updated-event-schema.json>`
And following is an example of an event compliant with this schema:
.. code:: json
{
- "schema": "urn:cps:org.onap.cps:data-updated-event-schema:v1",
+ "schema": "urn:cps:org.onap.cps:data-updated-event-schema:v2",
"id": "38aa6cc6-264d-4ede-b534-18f5c1f403ea",
"source": "urn:cps:org.onap.cps",
"type": "org.onap.cps.data-updated-event",
"content": {
"observedTimestamp": "2021-06-09T13:00:00.123-0400",
+ "operation": "UPDATE",
"dataspaceName": "my-dataspace",
"schemaSetName": "my-schema-set",
"anchorName": "my-anchor",
}
}
+Event versions
+==============
+
+The following table lists the data-updated-event schema evolution over releases :
+
+ +-----------+------------+-------------------------+---------------------+
+ | Version | Release | Compatibility Type | Upgrade First |
+ | | | (with previous version) | |
+ +===========+============+=========================+=====================+
+ | v1 | Istanbul | n/a | Any order |
+ +-----------+------------+-------------------------+---------------------+
+ | v2 | Jakarta | Backward | Consumer (Temporal) |
+ +-----------+------------+-------------------------+---------------------+
+
+**Compatibility Types**
+
+Several compatibility types exist when an event schema definition is evolving from one release to the next one:
+
+- Backward compatibility means that consumers using the new schema can read data produced with the previous schema.
+- Forward compatibility means that data produced with a new schema can be read by consumers using the previous schema.
+- Full compatibility means that schemas are both backward and forward compatible: old data can be read with the new schema, and new data can also be read with the previous schema.
\ No newline at end of file
# ============LICENSE_START=======================================================
-# Copyright (c) 2021 Bell Canada.
+# Copyright (c) 2021-2022 Bell Canada.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
schema:
$ref: '#/components/schemas/ErrorMessage'
example:
- status: 400 BAD_REQUEST
+ status: 400
message: Bad request error message
details: Bad request error details
Unauthorized:
observedTimestamp:
type: string
example: '2021-03-21T00:00:00.000-0000'
+ operation:
+ type: string
+ enum: [CREATE, UPDATE, DELETE]
+ example: UPDATE
dataspace:
type: string
example: 'my-dataspace'
/*
* ============LICENSE_START=======================================================
- * Copyright (c) 2021 Bell Canada.
+ * Copyright (c) 2021-2022 Bell Canada.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.onap.cps.temporal.controller.utils.DateTimeUtility
import com.fasterxml.jackson.databind.ObjectMapper
+import org.onap.cps.temporal.domain.Operation
+
import java.time.OffsetDateTime
import org.onap.cps.temporal.controller.rest.model.AnchorDetails
import org.onap.cps.temporal.controller.rest.model.AnchorDetailsMapperImpl
return NetworkData.builder().dataspace(myDataspace)
.schemaSet(mySchemaset).anchor(myAnchor).payload('{"message" : "Hello World"}')
.observedTimestamp(OffsetDateTime.now())
+ .operation(Operation.CREATE)
.createdTimestamp(OffsetDateTime.now()).build()
}
anchorDetails.setAnchor(networkData.getAnchor())
anchorDetails.setSchemaSet(networkData.getSchemaSet())
anchorDetails.setObservedTimestamp(DateTimeUtility.toString(networkData.getObservedTimestamp()))
+ anchorDetails.setOperation(AnchorDetails.OperationEnum.valueOf(networkData.getOperation().toString()))
anchorDetails.setData(networkData.getPayload())
return anchorDetails
}
/*
* ============LICENSE_START=======================================================
- * Copyright (c) 2021 Bell Canada.
+ * Copyright (c) 2021-2022 Bell Canada.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.cps.temporal.repository
import org.onap.cps.temporal.domain.NetworkData
+import org.onap.cps.temporal.domain.Operation
import org.onap.cps.temporal.domain.SearchCriteria
import org.onap.cps.temporal.repository.containers.TimescaleContainer
import org.springframework.beans.factory.annotation.Autowired
assert data.getObservedTimestamp().isAfter(observedAfter) || data.getObservedTimestamp().isEqual(observedAfter)
assert data.getAnchor() == queryAnchorName
assert data.getDataspace() == queryDataspaceName
+ assert data.getOperation() != null
}
}
assert data.getCreatedTimestamp().isBefore(createdBefore) || data.getCreatedTimestamp().isEqual(createdBefore)
assert data.getAnchor() == queryAnchorName
assert data.getDataspace() == queryDataspaceName
+ assert data.getOperation() != null
}
}