Update schema-service dep to 1.6.0
[aai/spike.git] / README.md
1 # Spike  Microservice
2
3 The Spike microservice consumes and processes the Champ graph data event stream
4 from which it generates events to be consumed by other components.
5
6 ## Public Interfaces
7
8 ### Stream output
9
10 Spike receives events from the Champ microservice regarding changes to the graph database.
11 Spike will buffer these events in an attempt to ensure proper chronological ordering,
12 and then output them onto a configurable queue.
13
14 The messages are in a similar format to Gizmo's async pipeline. Here are some examples:
15
16 #### Vertex
17 ##### Create Vertex
18
19    {
20       "header":{
21          "event-type":"update-notification",
22          "request-id":"8f9931a2-8002-4cb4-917b-a8c984932021",
23          "source-name":"SPIKE",
24          "timestamp":"20180807T153514Z"
25       },
26       "body":{
27          "transaction-id":"8f9931a2-8002-4cb4-917b-a8c984932021",
28          "vertex":{
29             "schema-version":"V14",
30             "type":"vserver",
31             "key":"541cf447-09f5-4484-a765-845e71aab1f2",
32             "properties":{
33                "aai-last-mod-ts":1533656090789,
34                "in-maint":false,
35                "aai-uuid":"541cf447-09f5-4484-a765-845e71aab1f2",
36                "vserver-name":"test-vserver",
37                "aai-created-ts":1533656090789,
38                "vserver-id":"VSER1",
39                "last-mod-source-of-truth":"Gizmo-Creator",
40                "vserver-name2":"alt-test-vserver",
41                "source-of-truth":"Gizmo-Creator",
42                "vserver-selflink":"http://1.2.3.4/moreInfo",
43                "is-closed-loop-disabled":false,
44                "aai-node-type":"vserver"
45             }
46          },
47          "operation":"CREATE",
48          "timestamp":1533656091474
49       }
50    }
51
52 ##### Update Vertex
53
54    {
55       "header":{
56          "event-type":"update-notification",
57          "request-id":"8f9931a2-8002-4cb4-917b-a8c984932021",
58          "source-name":"SPIKE",
59          "timestamp":"20180807T153514Z"
60       },
61       "body":{
62          "transaction-id":"8f9931a2-8002-4cb4-917b-a8c984932021",
63          "vertex":{
64             "schema-version":"V14",
65             "type":"vserver",
66             "key":"541cf447-09f5-4484-a765-845e71aab1f2",
67             "properties":{
68                "aai-last-mod-ts":1533656090789,
69                "in-maint":false,
70                "aai-uuid":"541cf447-09f5-4484-a765-845e71aab1f2",
71                "vserver-name":"test-vserver",
72                "aai-created-ts":1533656090789,
73                "vserver-id":"VSER1",
74                "last-mod-source-of-truth":"Gizmo-Creator",
75                "vserver-name2":"alt-test-vserver",
76                "source-of-truth":"Gizmo-Creator",
77                "vserver-selflink":"http://1.2.3.4/moreInfo",
78                "is-closed-loop-disabled":false,
79                "aai-node-type":"vserver"
80             }
81          },
82          "operation":"UPDATE",
83          "timestamp":1533656091474
84       }
85    }
86
87 ##### Delete Vertex
88
89    {
90       "header":{
91          "event-type":"update-notification",
92          "request-id":"8f9931a2-8002-4cb4-917b-a8c984932021",
93          "source-name":"SPIKE",
94          "timestamp":"20180807T153514Z"
95       },
96       "body":{
97          "transaction-id":"8f9931a2-8002-4cb4-917b-a8c984932021",
98          "vertex":{
99             "schema-version":"V14",
100             "type":"vserver",
101             "key":"541cf447-09f5-4484-a765-845e71aab1f2",
102             "properties":{
103                "aai-last-mod-ts":1533656090789,
104                "in-maint":false,
105                "aai-uuid":"541cf447-09f5-4484-a765-845e71aab1f2",
106                "vserver-name":"test-vserver",
107                "aai-created-ts":1533656090789,
108                "vserver-id":"VSER1",
109                "last-mod-source-of-truth":"Gizmo-Creator",
110                "vserver-name2":"alt-test-vserver",
111                "source-of-truth":"Gizmo-Creator",
112                "vserver-selflink":"http://1.2.3.4/moreInfo",
113                "is-closed-loop-disabled":false,
114                "aai-node-type":"vserver"
115             }
116          },
117          "operation":"DELETE",
118          "timestamp":1533656091474
119       }
120    }
121
122 #### Relationship
123 ##### Create Relationship
124
125    {
126       "header":{
127          "event-type":"update-notification",
128          "request-id":"1f2eced7-8300-4e72-966d-f345027c987a",
129          "source-name":"SPIKE",
130          "timestamp":"20180807T153514Z"
131       },
132       "body":{
133          "transaction-id":"1f2eced7-8300-4e72-966d-f345027c987a",
134          "relationship":{
135             "source":{
136                "type":"vserver",
137                "key":"ed76551f-f47f-47f9-a23d-052634446e76"
138             },
139             "schema-version":"v14",
140             "type":"tosca.relationships.HostedOn",
141             "key":"cd5b98fd-9028-4211-af02-0bc839f9a47b",
142             "properties":{
143                "prevent-delete":"IN",
144                "SVC-INFRA":"OUT",
145                "delete-other-v":"NONE",
146                "contains-other-v":"NONE"
147             },
148             "target":{
149                "type":"pserver",
150                "key":"981c0494-c742-4d75-851c-8194bbbd8a96"
151             }
152          },
153          "operation":"CREATE",
154          "timestamp":1533656086207
155       }
156    }
157
158 ##### Update Relationship
159
160    {
161       "header":{
162          "event-type":"update-notification",
163          "request-id":"1f2eced7-8300-4e72-966d-f345027c987a",
164          "source-name":"SPIKE",
165          "timestamp":"20180807T153514Z"
166       },
167       "body":{
168          "transaction-id":"1f2eced7-8300-4e72-966d-f345027c987a",
169          "relationship":{
170             "source":{
171                "type":"vserver",
172                "key":"ed76551f-f47f-47f9-a23d-052634446e76"
173             },
174             "schema-version":"v14",
175             "type":"tosca.relationships.HostedOn",
176             "key":"cd5b98fd-9028-4211-af02-0bc839f9a47b",
177             "properties":{
178                "prevent-delete":"IN",
179                "SVC-INFRA":"OUT",
180                "delete-other-v":"NONE",
181                "contains-other-v":"NONE"
182             },
183             "target":{
184                "type":"pserver",
185                "key":"981c0494-c742-4d75-851c-8194bbbd8a96"
186             }
187          },
188          "operation":"UPDATE",
189          "timestamp":1533656086207
190       }
191    }
192
193 ##### Delete Relationship
194
195    {
196       "header":{
197          "event-type":"update-notification",
198          "request-id":"1f2eced7-8300-4e72-966d-f345027c987a",
199          "source-name":"SPIKE",
200          "timestamp":"20180807T153514Z"
201       },
202       "body":{
203          "transaction-id":"1f2eced7-8300-4e72-966d-f345027c987a",
204          "relationship":{
205             "source":{
206                "type":"vserver",
207                "key":"ed76551f-f47f-47f9-a23d-052634446e76"
208             },
209             "schema-version":"v14",
210             "type":"tosca.relationships.HostedOn",
211             "key":"cd5b98fd-9028-4211-af02-0bc839f9a47b",
212             "properties":{
213                "prevent-delete":"IN",
214                "SVC-INFRA":"OUT",
215                "delete-other-v":"NONE",
216                "contains-other-v":"NONE"
217             },
218             "target":{
219                "type":"pserver",
220                "key":"981c0494-c742-4d75-851c-8194bbbd8a96"
221             }
222          },
223          "operation":"DELETE",
224          "timestamp":1533656086207
225       }
226    }
227
228 #### Transactions
229
230 Champ, and therefore Spike, will publish separate events for each operation done within a transaction.
231 Operations from the same transaction can be identified via the database-transaction-id field.
232
233 ##### Transaction example
234
235 The following three events were created in a single bulk request from Gizmo. Note the database-transaction-id.
236
237 [
238    {
239       "header":{
240          "event-type":"update-notification",
241          "request-id":"9fc953af-bb41-4cfe-b522-dc6a9d1b5830",
242          "source-name":"SPIKE",
243          "timestamp":"20180807T162714Z"
244       },
245       "body":{
246          "transaction-id":"9fc953af-bb41-4cfe-b522-dc6a9d1b5830",
247          "vertex":{
248             "schema-version":"V14",
249             "type":"vserver",
250             "key":"9c649f2b-7500-4b35-abb8-d51008fb28fe",
251             "properties":{
252                "aai-last-mod-ts":1533659209321,
253                "in-maint":false,
254                "aai-uuid":"9c649f2b-7500-4b35-abb8-d51008fb28fe",
255                "vserver-name":"test-vserver",
256                "aai-created-ts":1533659209321,
257                "vserver-id":"VSER1",
258                "last-mod-source-of-truth":"test1",
259                "vserver-name2":"alt-test-vserver",
260                "source-of-truth":"test1",
261                "vserver-selflink":"http://1.2.3.4/moreInfo",
262                "is-closed-loop-disabled":false
263             }
264          },
265          "database-transaction-id":"d8607c70-e5d6-44d4-bc6e-d8f7af419378",
266          "operation":"CREATE",
267          "timestamp":1533659209324
268       }
269    },
270    {
271       "header":{
272          "event-type":"update-notification",
273          "request-id":"6f7db331-a0b9-4194-917c-7f24124b5d46",
274          "source-name":"SPIKE",
275          "timestamp":"20180807T162714Z"
276       },
277       "body":{
278          "transaction-id":"6f7db331-a0b9-4194-917c-7f24124b5d46",
279          "vertex":{
280             "schema-version":"V14",
281             "type":"pserver",
282             "key":"ecec281a-c0c0-47af-8ec8-019753edc28c",
283             "properties":{
284                "ptnii-equip-name":"e-name",
285                "aai-last-mod-ts":1533659209637,
286                "equip-type":"server",
287                "equip-vendor":"HP",
288                "fqdn":"myhost.onap.net",
289                "purpose":"my-purpose",
290                "aai-created-ts":1533659209637,
291                "ipv4-oam-address":"1.2.3.4",
292                "source-of-truth":"test1",
293                "hostname":"steve-host2",
294                "equip-model":"DL380p-nd",
295                "in-maint":false,
296                "aai-uuid":"ecec281a-c0c0-47af-8ec8-019753edc28c",
297                "last-mod-source-of-truth":"test1"
298             }
299          },
300          "database-transaction-id":"d8607c70-e5d6-44d4-bc6e-d8f7af419378",
301          "operation":"CREATE",
302          "timestamp":1533659209645
303       }
304    },
305    {
306       "header":{
307          "event-type":"update-notification",
308          "request-id":"54f0f573-eb22-4ce2-b51b-4af0904c9782",
309          "source-name":"SPIKE",
310          "timestamp":"20180807T162714Z"
311       },
312       "body":{
313          "transaction-id":"54f0f573-eb22-4ce2-b51b-4af0904c9782",
314          "database-transaction-id":"d8607c70-e5d6-44d4-bc6e-d8f7af419378",
315          "relationship":{
316             "source":{
317                "type":"vserver",
318                "key":"9c649f2b-7500-4b35-abb8-d51008fb28fe"
319             },
320             "schema-version":"v14",
321             "type":"tosca.relationships.HostedOn",
322             "key":"410cb65a-1b46-4d23-a5b4-9f57bdc918c1",
323             "properties":{
324                "prevent-delete":"IN",
325                "SVC-INFRA":"OUT",
326                "delete-other-v":"NONE",
327                "contains-other-v":"NONE"
328             },
329             "target":{
330                "type":"pserver",
331                "key":"ecec281a-c0c0-47af-8ec8-019753edc28c"
332             }
333          },
334          "operation":"CREATE",
335          "timestamp":1533659210721
336       }
337    }
338 ]
339
340 ### Echo Service
341 The Spike micro service supports the standard echo service to allow it
342 to be 'pinged' to verify that the service is up and responding.
343
344 The echo service is reachable via the following REST end point:
345
346     https://<host>:9518/services/spike/v1/echo-service/echo