From: emaclee Date: Thu, 28 Jul 2022 05:52:39 +0000 (+0100) Subject: LCM events RTD X-Git-Tag: 3.1.0~58^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;ds=sidebyside;h=411219850b4866715c472dc1a64eaf61be795346;p=cps.git LCM events RTD Issue-ID: CPS-1165 Signed-off-by: emaclee Change-Id: Ib6743bc73b260b4345a1bedf0de2ef892a6b3c87 --- diff --git a/docs/cps-events.rst b/docs/cps-events.rst new file mode 100644 index 000000000..a28d4b052 --- /dev/null +++ b/docs/cps-events.rst @@ -0,0 +1,138 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. Copyright (C) 2022 Nordix Foundation + +.. DO NOT CHANGE THIS LABEL FOR RELEASE NOTES - EVEN THOUGH IT GIVES A WARNING +.. _cpsEvents: + +CPS Events +########## + +CPS Core +******** +.. + Cps core events yet to be written + + +CPS-NCMP +******** + +Lifecycle Management (LCM) Event +================================ + + +Overview +-------- +Lifecycle management events are published as cm handle state transitions from one state to another. + + +LCM events and state handler +---------------------------- +The LCM events are triggered under the state handler which has the following responsibilities: + +#. Updating and persisting cm handle state based on the target state of the cm handle + +#. Create and calls to publish the LCM event based on the cm handle state transition that occured + + **3 possible event types:** + + * Create + * Update + * Delete + + + +LCM Event Schema +---------------- +The current published LCM event is based on the following schema: + +:download:`Life cycle management event schema ` + +LCM Event structure +------------------- + +Events header +^^^^^^^^^^^^^ +*Event header prototype for all event types* + +.. code-block:: json + + { + "eventId" : "00001", + "eventCorrelationId : "cmhandle-001", + "eventTime" : "2021-11-16T16:42:25-04:00", + "eventSource" : "org.onap.ncmp", + "eventType" : "org.onap.ncmp.cmhandle-lcm-event.create", + "eventSchema" : "org.onap.ncmp:cmhandle-lcm-event", + "eventSchemaVersion" : "1.0" + "event": .... + } + +Events payload +^^^^^^^^^^^^^^ +Event payload varies based on the type of event. + +**CREATE** + +Event payload for this event contains the properties of the new cm handle created. + +*Create event payload prototype* + +.. code-block:: json + + "event": { + "cmHandleId" : "cmhandle-001", + "newValues" : { + "cmHandleState" : "ADVISED", + "dataSyncEnabled" : "TRUE", + "cmhandleProperties" : [ + "prop1" : "val1", + "prop2" : "val2" + ] + } + } + } + + +**UPDATE** + +Event payload for this event contains the difference in state and properties of the cm handle. + +*Update event payload prototype* + +.. code-block:: json + + "event": { + "cmHandleId" : "cmhandle-001", + "oldValues" : { + "cmHandleState" : "ADVISED", + "dataSyncEnabled" : "FALSE", + "cmhandleProperties" : [ + "prop1" : "val1", + "prop2" : "val2", + } + "newValues" : { + "cmHandleState" : "READY", + "dataSyncEnabled" : "TRUE", + "cmhandleProperties" : [ + "prop1" : "updatedval1", + "prop2" : "updatedval2" + ] + } + } + } + + +**DELETE** + +Event payload for this event contains the identifier of the deleted cm handle. + +*Delete event payload prototype* + +.. code-block:: json + + "event": { + "cmHandleId" : "cmhandle-001", + } + + diff --git a/docs/index.rst b/docs/index.rst index eaf36466f..df4ea9518 100755 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,6 +1,6 @@ .. This work is licensed under a Creative Commons Attribution 4.0 International License. .. http://creativecommons.org/licenses/by/4.0 -.. Copyright (C) 2021 Nordix Foundation +.. Copyright (C) 2021-2022 Nordix Foundation .. DO NOT CHANGE THIS LABEL FOR RELEASE NOTES - EVEN THOUGH IT GIVES A WARNING .. _master_index: @@ -22,6 +22,7 @@ CPS Core admin-guide.rst design.rst modeling.rst + cps-events.rst deployment.rst release-notes.rst diff --git a/docs/schemas/lcm-event-schema-v1.json b/docs/schemas/lcm-event-schema-v1.json new file mode 100644 index 000000000..97c0fbee2 --- /dev/null +++ b/docs/schemas/lcm-event-schema-v1.json @@ -0,0 +1,106 @@ +{ + + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "urn:cps:org.onap.ncmp.cmhandle.lcm-event:v1", + + "$ref": "#/definitions/LcmEvent", + + "definitions": { + + "Values": { + "description": "Values that represents the state of a cmHandle", + "type": "object", + "properties": { + "dataSyncEnabled":{ + "description": "Whether data sync enabled", + "type": "boolean" + }, + "cmHandleState": { + "description": "State of cmHandle", + "type": "string", + "enum": ["ADVISED", "READY", "LOCKED", "DELETING", "DELETED"] + }, + "cmHandleProperties": { + "description": "cmHandle properties", + "type": "object", + "default": null, + "existingJavaType": "java.util.List>", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + + "Event": { + "description": "The Payload of an event", + "type": "object", + "properties": { + "cmHandleId": { + "description": "cmHandle id", + "type": "string" + }, + "oldValues": { + "$ref": "#/definitions/Values" + }, + "newValues": { + "$ref": "#/definitions/Values" + } + }, + "required": [ + "cmHandleId" + ], + "additionalProperties": false + }, + + "LcmEvent": { + "description": "The payload for LCM event", + "type": "object", + "javaType" : "org.onap.ncmp.cmhandle.event.lcm.LcmEvent", + "properties": { + "eventId": { + "description": "The unique id identifying the event", + "type": "string" + }, + "eventCorrelationId": { + "description": "The id identifying the event", + "type": "string" + }, + "eventTime": { + "description": "The timestamp when original event occurred", + "type": "string" + }, + "eventSource": { + "description": "The source of the event", + "type": "string" + }, + "eventType": { + "description": "The type of the event", + "type": "string" + }, + "eventSchema": { + "description": "The schema that this event adheres to", + "type": "string" + }, + "eventSchemaVersion": { + "description": "The version of the schema that this event adheres to", + "type": "string" + }, + "event": { + "$ref": "#/definitions/Event" + } + }, + "required": [ + "eventId", + "eventCorrelationId", + "eventTime", + "eventSource", + "eventType", + "eventSchema", + "eventSchemaVersion", + "event" + ], + "additionalProperties": false + } + + } +}