dce1a30feb6da7133ee9a9cdbf9749b0540d7cd9
[cps.git] / docs / cps-events.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. Copyright (C) 2022 Nordix Foundation
4
5 .. DO NOT CHANGE THIS LABEL FOR RELEASE NOTES - EVEN THOUGH IT GIVES A WARNING
6 .. _cpsEvents:
7
8 CPS Events
9 ##########
10
11 CPS-NCMP
12 ********
13
14 Lifecycle Management (LCM) Event
15 ================================
16
17
18 Overview
19 --------
20 LCM events for CM Handles are published when a CM Handle is created, deleted or another change in the cm handle state occurs.
21
22   **3 possible event types:**
23
24   * Create
25   * Update
26   * Delete
27
28 LCM Event Schema
29 ----------------
30 The current published LCM event is based on the following schema:
31
32 :download:`Life cycle management event schema <schemas/lcm-event-schema-v1.json>`
33
34 LCM Event structure
35 -------------------
36
37 Events header
38 ^^^^^^^^^^^^^
39 *Event header prototype for all event types*
40
41 .. code-block:: json
42
43   {
44       "eventId"                : "00001",
45       "eventCorrelationId      : "cmhandle-001",
46       "eventTime"              : "2021-11-16T16:42:25-04:00",
47       "eventSource"            : "org.onap.ncmp",
48       "eventType"              : "org.onap.ncmp.cmhandle-lcm-event.create",
49       "eventSchema"            : "org.onap.ncmp:cmhandle-lcm-event",
50       "eventSchemaVersion"         : "1.0"
51       "event": ....
52   }
53
54 Events payload
55 ^^^^^^^^^^^^^^
56 Event payload varies based on the type of event.
57
58 **CREATE**
59
60 Event payload for this event contains the properties of the new cm handle created.
61
62 *Create event payload prototype*
63
64 .. code-block:: json
65
66   "event": {
67          "cmHandleId" : "cmhandle-001",
68          "newValues" : {
69              "cmHandleState"  : "ADVISED",
70              "dataSyncEnabled" : "TRUE",
71              "cmhandleProperties" : [
72                           "prop1" : "val1",
73                           "prop2" : "val2"
74                 ]
75             }
76        }
77    }
78
79
80 **UPDATE**
81
82 Event payload for this event contains the difference in state and properties of the cm handle.
83
84 *Update event payload prototype*
85
86 .. code-block:: json
87
88   "event": {
89          "cmHandleId" : "cmhandle-001",
90          "oldValues" : {
91                  "cmHandleState"  : "ADVISED",
92                  "dataSyncEnabled" : "FALSE",
93                  "cmhandleProperties" : [
94                           "prop1" : "val1",
95                           "prop2" : "val2",
96               }
97           "newValues" : {
98              "cmHandleState"  : "READY",
99              "dataSyncEnabled" : "TRUE",
100              "cmhandleProperties" : [
101                           "prop1" : "updatedval1",
102                           "prop2" : "updatedval2"
103                    ]
104             }
105        }
106    }
107
108
109 **DELETE**
110
111 Event payload for this event contains the identifier of the deleted cm handle.
112
113 *Delete event payload prototype*
114
115 .. code-block:: json
116
117   "event": {
118          "cmHandleId" : "cmhandle-001",
119    }
120
121