Async External Schema and related Read the doc
[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 Async events are triggered when a valid topic has been detected in a passthrough operation.
15
16 :download:`NCMP request response event schema <schemas/ncmp-async-request-response-event-schema-v1.json>`
17
18 Event header
19 ^^^^^^^^^^^^^
20
21 .. code-block:: json
22
23     {
24         "eventId"               : "001",
25         "eventCorrelationId"    : "cps-001",
26         "eventTime"             : "2022-09-28T12:24:21.003+0000",
27         "eventTarget"           : "test-topic",
28         "eventType"             : "org.onap.cps.ncmp.event.model.DmiAsyncRequestResponseEvent",
29         "eventSchema"           : "urn:cps:org.onap.cps.ncmp.event.model.DmiAsyncRequestResponseEvent:v1",
30         "forwarded-Event"       : { ... }
31     }
32
33 Forwarded-Event Payload
34 ^^^^^^^^^^^^^^^^^^^^^^^
35
36 .. code-block:: json
37
38     "Forwarded-Event": {
39         "eventId"               : "002",
40         "eventCorrelationId"    : "cps-001",
41         "eventTime"             : "2022-09-28T12:24:18.340+0000",
42         "eventTarget"           : "test-topic",
43         "eventType"             : "org.onap.cps.ncmp.event.model.DmiAsyncRequestResponseEvent",
44         "eventSchema"           : "urn:cps:org.onap.cps.ncmp.event.model.DmiAsyncRequestResponseEvent:v1",
45         "eventSource"           : "org.onap.cps.ncmp.dmi",
46         "response-data-schema"  : "urn:cps:org.onap.cps.ncmp.event.model.DmiAsyncRequestResponseEvent:v1",
47         "response-status"       : "OK",
48         "response-code"         : "200",
49         "response-data"         : { ... }
50     }
51
52
53 Lifecycle Management (LCM) Event
54 ================================
55
56
57 Overview
58 --------
59 LCM events for CM Handles are published when a CM Handle is created, deleted or another change in the cm handle state occurs.
60
61   **3 possible event types:**
62
63   * Create
64   * Update
65   * Delete
66
67 LCM Event Schema
68 ----------------
69 The current published LCM event is based on the following schema:
70
71 :download:`Life cycle management event schema <schemas/lcm-event-schema-v1.json>`
72
73 LCM Event structure
74 -------------------
75
76 Events header
77 ^^^^^^^^^^^^^
78 *Event header prototype for all event types*
79
80 .. code-block:: json
81
82   {
83       "eventId"                : "00001",
84       "eventCorrelationId      : "cmhandle-001",
85       "eventTime"              : "2021-11-16T16:42:25-04:00",
86       "eventSource"            : "org.onap.ncmp",
87       "eventType"              : "org.onap.ncmp.cmhandle-lcm-event.create",
88       "eventSchema"            : "org.onap.ncmp:cmhandle-lcm-event",
89       "eventSchemaVersion"         : "1.0"
90       "event": ....
91   }
92
93 Events payload
94 ^^^^^^^^^^^^^^
95 Event payload varies based on the type of event.
96
97 **CREATE**
98
99 Event payload for this event contains the properties of the new cm handle created.
100
101 *Create event payload prototype*
102
103 .. code-block:: json
104
105   "event": {
106          "cmHandleId" : "cmhandle-001",
107          "newValues" : {
108              "cmHandleState"  : "ADVISED",
109              "dataSyncEnabled" : "TRUE",
110              "cmhandleProperties" : [
111                           "prop1" : "val1",
112                           "prop2" : "val2"
113                 ]
114             }
115        }
116    }
117
118
119 **UPDATE**
120
121 Event payload for this event contains the difference in state and properties of the cm handle.
122
123 *Update event payload prototype*
124
125 .. code-block:: json
126
127   "event": {
128          "cmHandleId" : "cmhandle-001",
129          "oldValues" : {
130                  "cmHandleState"  : "ADVISED",
131                  "dataSyncEnabled" : "FALSE",
132                  "cmhandleProperties" : [
133                           "prop1" : "val1",
134                           "prop2" : "val2",
135               }
136           "newValues" : {
137              "cmHandleState"  : "READY",
138              "dataSyncEnabled" : "TRUE",
139              "cmhandleProperties" : [
140                           "prop1" : "updatedval1",
141                           "prop2" : "updatedval2"
142                    ]
143             }
144        }
145    }
146
147
148 **DELETE**
149
150 Event payload for this event contains the identifier of the deleted cm handle.
151
152 *Delete event payload prototype*
153
154 .. code-block:: json
155
156   "event": {
157          "cmHandleId" : "cmhandle-001",
158    }
159
160