e5f7caed3b059ce6e1d65c08520efe0e665aab7d
[dcaegen2/platform.git] / oti / event-handler / OTI-API.md
1 # ONAP Topology Interface (OTI) Handler API
2 *Version 1.0.0*
3
4 ---
5 <a name="toc"></a>
6 ## Contents
7
8 * Overview
9 * Managing OTI Handler
10   - [GET /healthcheck](#healthcheck)
11   - [GET /shutdown](#shutdown)
12 * Triggering notifications to microservices
13   - [POST /events](#events-post)
14 * Queries for information from Consul KVs
15   - [GET /policies](#policies)
16   - [GET /service_component](#service_component)
17   - [GET /service_component_all](#service_component_all)
18 * Queries for OTI events from OTI database
19   - [GET /oti_docker_events](#oti_docker_events)
20   - [GET /oti_k8s_events](#oti_k8s_events)
21   - [GET /dti_docker_events](#dti_docker_events)
22   - [GET /dti_k8s_events](#dti_k8s_events)  
23 ---
24 <a name="overview"></a>
25 ## Overview
26 This document describes OTI Handler's HTTPS API for:
27 1. accepting events from OTI to reconfigure microservices.
28 1. sending reconfig notifications to microservices.
29 1. retrieving service component information from Consul.
30
31 ---
32 <a name="manage"></a>
33 ## Managing OTI Handler
34
35 ---
36 <a name="healthcheck">healthcheck</a>
37 ### GET /healthcheck
38
39 #### Description
40 Get health status of OTI Handler service
41
42 #### Parameters
43 None
44
45 #### Responses
46 |HTTP Code|Description|Schema|
47 |---|---|---|
48 |**200**|Success|[HealthCheckResponse](#healthcheckresponse)|
49
50 <a name="healthcheckresponse"></a>
51 ##### HealthCheckResponse
52 OTI Handler returns a JSON object containing current health check information.
53
54 Example JSON response, formatted:
55 ```
56 {
57     "now": "2019-10-19 18:30:34.987514",
58     "packages": "N/A",
59     "python": "3.6.0 (default, Oct 10 2019, 02:49:49) [GCC 4.9.2]",
60     "service_instance_UUID": "0cf593cd-83d4-4cdc-b8bb-a33f8edc28f4",
61     "service_name": "oti_handler",
62     "service_version": "3.6.0",
63     "started": "2019-10-18 18:50:10.209063",
64     "stats": {
65         "oti_handler": {
66             "ave_timer_millisecs": 207.0,
67             "call_count": 5,
68             "error_count": 0,
69             "last_error": "None",
70             "last_success": "2019-10-18 19:25:36.604613",
71             "longest_timer_millisecs": 348
72         }
73     },
74     "uptime": "23:40:24.778451"
75 }
76 ```
77
78 ---
79 <a name="shutdown"></a>
80 ### GET /shutdown
81
82 #### Description
83 Shutdown and restart OTI Handler
84
85 #### Parameters
86 None
87
88 #### Responses
89 |HTTP Code|Description|Schema|
90 |---|---|---|
91 |**200**|Success|string|
92
93 OTI Handler returns a string acknowledging the shutdown request.
94
95 Example response:
96 ```
97 goodbye! shutdown requested 2019-10-19 18:34:22.642045
98 ```
99
100
101 ---
102 <a name="notifications"></a>
103 ## Triggering notifications to microservices
104 ---
105 <a name="events-post"></a>
106 ### POST /events?**notify**=n
107
108 #### Description
109 (For OTI to) Submit a OTI Event to OTI Handler
110
111 **/events** is
112 for OTI to signal add, update, delete of a VNF instance or to signal an entire site activation/deactivation.
113 OTI POSTs an Event when the VNF in question needs monitoring by DCAE monitoring services.
114 The OTI Event includes information that identifies the type of VNF, the specific VNF instance,
115 the location where the VNF is running, the type of operation, and
116 additional information that may be useful for setting up the DCAE monitoring services.
117
118 #### Parameters
119 |Type|Name|Description|Schema|Default|
120 |---|---|---|---|---|
121 |Body|**dcae_event**  <br>*required*|JSON event from OTI that must contain<br>at least the few fields identified below.|[DCAEEvent](#dcaeevent)||
122 |query component|**notify**  <br>*optional*|When set to "n", oti handler will **not** notify components of this OTI Event<br> and only persist the event into OTI postgreSQL database.|string|y|
123
124 <a name="dcaeevent"></a>
125 ##### DCAEEvent
126 OTI Handler uses the following fields of the OTI Event JSON object to identify which monitoring services to reconfigure:
127
128 |Name|Description|Schema|
129 |---|---|---|
130 |**dcae_service_action**  <br>*required*|Indicates the action to be taken by a DCAE service [deploy, modify or remove a VNF instance monitoring].<br>Valid values are: "add", "update", "delete", "notify". <br>Docker hosted microservices will continue to be signaled with "deploy" or "undeploy action".<br> A "notify" action for kubernetes hosted collector services can signal all the services to be activated or deactivated.|string|
131 |**dcae_target_name**  <br>*required*|The name of the unique VNF Instance monitored by DCAE services.|string|
132 |**dcae_target_type**  <br>*required*|The VNF Type of the VNF Instance monitored by a DCAE service.|string|
133 |**dcae_service_location**  <br>*optional*|CLLI location.  Not provided or "" infers all locations.|string|
134
135 Any additional fields of the OTI Event are ignored by OTI Handler and are passed over to the collector services.
136 The entire OTI Event object is saved in OTI handler application database, for Config Binding Service to provide to the monitoring services.
137
138 #### Responses
139 |HTTP Code|Description|Schema|
140 |---|---|---|
141 |**200**|Accepted.  Any errors will be noted in the JSON object response.|[DCAEEventResponse](#dcaeeventresponse)|
142
143 <a name="dcaeeventresponse"></a>
144 ##### DCAEEventResponse
145 OTI Handler returns a JSON object containing results of running each affected service component's dti reconfig script in case of docker containers and the HTTP response acknowledgement from kubernetes pods.
146 If the object is empty or only contains an ERROR, then no collector component's reconfig script was run.
147
148 |Name|Description|Schema|
149 |---|---|---|
150 |**\<service_component_name\>**  <br>*optional*,<br>*can be multiple*|Identification of a component's docker container<br>and results of running its reconfig script.<br>One for each service notified about this event.|string|
151 |**ERROR**  <br>*optional*|An error not specific to any one **\<service_component_name\>**.|string|
152
153 Examples of JSON responses, formatted:
154 ```
155 {
156     "0b231f372c6f42a89817a097549f4af5_green-eggs-and-ham": "ran /opt/app/reconfigure.py in container 9a9045657e097a4e41b077d10a0c8b2e860a9993e90e1c2a6997b03c2287d86f on zldcmtn23adcc1-platform-dockerhost-1 that was deployed by policy-test-terry node green_eggs_and_ham_docker_container, got: reconfigured\n",
157     "add6bcffdf16488cb961ac88605243a6_green-eggs-and-ham": "ran /opt/app/reconfigure.py in container dab026db7c33081f89b0de54a5a8ed1eed4bcf6bac783a1f657c3018a24f522e on zldcmtn23adcc1-platform-dockerhost-1 that was deployed by app_reconfigurable_tes node green_eggs_and_ham_docker_container, got: rpc error: code = 13 desc = invalid header field value \"oci runtime error: exec failed: container_linux.go:247: starting container process caused \\\"exec: \\\\\\\"/opt/app/reconfigure.py\\\\\\\": stat /opt/app/reconfigure.py: no such file or directory\\\"\\n\"\r\n",
158     "DTIHandler": {
159         "deploymentIds": [
160             "43b77ab2-7341-4929-ba27-ea91d00b253c"
161         ],
162         "requestId": "ab88d651-fa83-4342-9579-d383c1f29373"
163     }
164 }
165
166 {
167     "zldcdyh1bdce1d13-vcc-clicollector-cli-p1-v12": "ran add in k8s deployment sts-zldcdyh1bdce1d13-vcc-clicollector-cli-p1-v12 in namespace com-my-dcae-collgrp1-dev that was deployed by dcae_vcc-clicollector-cli
168 -p1-k8_2002_vp663p_1120v7 node vcc-clicollector-cli-p1_vcc-clicollector-cli-p1, got: {u'KubeServicePort': u'9999', u'KubeNamespace': u'com-my-dcae-collgrp1-dev', u'KubeServiceName': u'zldcdyh1bdce1d13-vcc-clicoll
169 ector-cli-p1-v12', u'KubeClusterFqdn': u'32.68.210.134', u'KubeProxyFqdn': u'dcae-kcdthp-site1-edge-d13.test.idns.cip.my.com', u'KubePod': u'sts-zldcdyh1bdce1d13-vcc-clicollector-cli-p1-v12-1'}"
170 }
171
172 {
173     "zldcdyh1bdce1d13-ovl-mib": "ran UPDATE to k8s pod ID sts-zldcdyh1bdce1d13-ovl-mib-0 in namespace com-my-dcae-poller-dev that was deployed in cluster 32.68.210.134, got: {u'KubeServicePort': u'9999', u'KubeNa
174 mespace': u'com-my-dcae-poller-dev', u'KubeServiceName': u'zldcdyh1bdce1d13-ovl-mib', u'KubeClusterFqdn': u'32.68.210.134', u'KubeProxyFqdn': u'dcae-kcdthp-site1-dyh1b-edge-d13.test.idns.cip.my.com', u'KubePod'
175 : u'sts-zldcdyh1bdce1d13-ovl-mib-0'}"
176 }
177
178 ```
179
180
181 ---
182 <a name="info-queries"></a>
183 ## Queries for information from Consul KVs
184
185 ---
186 <a name="dti"></a>
187 ### GET /dti/**\<service_name\>**?**vnf_type**=\<vnf_type\>;**vnf_id**=\<vnf_id\>;**service_location**=\<service_location\>
188
189 #### Description
190 Retrieve current (latest, not undeployed) OTI Events
191
192 #### Parameters
193 |Type|Name|Description|Schema|Default|
194 |---|---|---|---|---|
195 |path segment|**\<service_name\>**  <br>*optional*|The service component name assigned by dockerplugin to the component<br>that is unique to the cloudify node instance and used in its Consul key(s).|string||
196 |query component|**vnf_type**  <br>*optional*|Allows multiple values separated by commas.  <br>Gets OTI events for these **\<vnf_type\>(s)**.|string||
197 |query component|**vnf_id**  <br>*optional*|Requires **vnf_type** also.  Gets OTI event for this **\<vnf_id\>**.|string||
198 |query component|**service_location**  <br>*optional*|Allows multiple values separated by commas.<br>Filters OTI events with dcae_service_location in **\<service_location\>**.<br>Overrides locations defined in Consul for the **\<service_name\>**.|string|locations from Consul|
199
200 #### Responses
201 |HTTP Code|Description|Schema|
202 |---|---|---|
203 |**200**|Success|[DTIResponse](#dtiresponse)|
204
205 <a name="dtiresponse"></a>
206 ##### OTIResponse
207 OTI Handler returns a JSON object of OTI event(s).
208 - If one **vnf_type** and **vnf_id** are both specified, then object returned will be just the one OTI event.
209 - If one **vnf_type** is specified but not **vnf_id**, then OTI events will be keyed by **\<vnf_id\>**.
210 - Otherwise the OTI events will be keyed by **\<vnf_type\>**, sub-keyed by **\<vnf_id\>**.
211
212 Example JSON response, formatted:
213 ```
214 {
215     "anot-her": {
216         "another01ems003": {
217             "aai_additional_info": {},
218             "dcae_generic-vnf_model-version-id": "1",
219             "dcae_service-instance_model-version-id": "1",
220             "dcae_service_action": "deploy",
221             "dcae_service_location": "LSLEILAA",
222             "dcae_snmp_community_string": "my_first_community",
223             "dcae_snmp_version": "2c",
224             "dcae_target_collection": "true",
225             "dcae_target_collection_ip": "107.239.85.3",
226             "dcae_target_in-maint": "false",
227             "dcae_target_is-closed-loop-disabled": "false",
228             "dcae_target_name": "another01ems003",
229             "dcae_target_prov-status": "PROV",
230             "dcae_target_type": "anot-her",
231             "event": {}
232         },
233         "another01ems044": {
234             "aai_additional_info": {},
235             "dcae_generic-vnf_model-version-id": "1",
236             "dcae_service-instance_model-version-id": "1",
237             "dcae_service_action": "deploy",
238             "dcae_service_location": "LSLEILAA",
239             "dcae_snmp_community_string": "my_first_community",
240             "dcae_snmp_version": "2c",
241             "dcae_target_collection": "true",
242             "dcae_target_collection_ip": "107.239.85.44",
243             "dcae_target_in-maint": "false",
244             "dcae_target_is-closed-loop-disabled": "false",
245             "dcae_target_name": "another01ems044",
246             "dcae_target_prov-status": "PROV",
247             "dcae_target_type": "anot-her",
248             "event": {}
249         }
250     }
251 }
252 ```
253
254 ---
255 <a name="policies"></a>
256 ### GET /policies/**\<service_name\>**?**policy_id**=\<policy_id\>
257
258 #### Description
259 Retrieve policy or policies for a service component instance
260
261 #### Parameters
262 |Type|Name|Description|Schema|Default|
263 |---|---|---|---|---|
264 |path segment|**\<service_name\>**  <br>*required*|The service component name assigned by dockerplugin to the component<br>that is unique to the cloudify node instance and used in its Consul key(s).|string||
265 |query component|**policy_id**  <br>*optional*|Returns only the policy for this one **\<policy_id\>**.|string||
266
267 #### Responses
268 |HTTP Code|Description|Schema|
269 |---|---|---|
270 |**200**|Success|[PoliciesResponse](#policiesresponse)|
271
272 <a name="policiesresponse"></a>
273 ##### PoliciesResponse
274 OTI Handler returns a JSON object containing policy bodies for the **\<service_name\>** component.
275 - If **policy_id** is specified, then object returned will be just the one policy body.
276 - If **policy_id** is not specified, then object will contain all policy bodies for **\<service_name\>**, keyed by **\<policy_id\>**.
277
278 Example JSON response, formatted:
279 ```
280 {
281     "DCAE_FTL3B.Config_Green_Collectors": {
282         "config": {
283             "conflicting_key": "green_collectors_wins",
284             "package_type": "plastic",
285             "polling_frequency": "30m",
286             "power_source": "lemmings"
287         },
288         "matchingConditions": {
289             "ConfigName": "Green_Collectors",
290             "testName": "dcae",
291             "ONAPName": "dcae"
292         },
293         "policyConfigMessage": "Config Retrieved! ",
294         "policyConfigStatus": "CONFIG_RETRIEVED",
295         "policyName": "DCAE_FTL3B.Config_Green_Collectors.1.xml",
296         "policyVersion": "1",
297         "property": null,
298         "responseAttributes": {},
299         "type": "JSON"
300     },
301     "DCAE_FTL3B.Config_Green_Eggs_and_Ham_specific": {
302         "config": {
303             "bacon": "soft, not crispy",
304             "bread": "pumpernickel",
305             "conflicting_key": "green_eggs_and_ham_are_better",
306             "dcae_target_type": [
307                 "pnga-xxx",
308                 "pcrf-oam",
309                 "vhss-ems",
310                 "anot-her",
311                 "new-type"
312             ],
313             "egg_color": "green",
314             "preparation": "scrambled"
315         },
316         "matchingConditions": {
317             "ConfigName": "Green_Eggs_and_Ham_specific",
318             "testName": "dcae",
319             "ONAPName": "dcae"
320         },
321         "policyConfigMessage": "Config Retrieved! ",
322         "policyConfigStatus": "CONFIG_RETRIEVED",
323         "policyName": "DCAE_FTL3B.Config_Green_Eggs_and_Ham_specific.5.xml",
324         "policyVersion": "5",
325         "property": null,
326         "responseAttributes": {},
327         "type": "JSON"
328     },
329     "DCAE_FTL3B.Config_In_Service": {
330         "config": {
331             "conflicting_key": "in_service_trumps!",
332             "in_service": true
333         },
334         "matchingConditions": {
335             "ConfigName": "In_Service",
336             "testName": "dcae",
337             "ONAPName": "dcae"
338         },
339         "policyConfigMessage": "Config Retrieved! ",
340         "policyConfigStatus": "CONFIG_RETRIEVED",
341         "policyName": "DCAE_FTL3B.Config_In_Service.1.xml",
342         "policyVersion": "1",
343         "property": null,
344         "responseAttributes": {},
345         "type": "JSON"
346     }
347 }
348 ```
349
350 ---
351 <a name="service_component"></a>
352 ### GET /service_component/**\<service_name\>**
353
354 #### Description
355 Retrieve fully-bound configuration for a service component instance.
356
357 *Note:  Response is the same as what Config Binding Service returns.*
358
359 #### Parameters
360 |Type|Name|Description|Schema|Default|
361 |---|---|---|---|---|
362 |path segment|**\<service_name\>**  <br>*required*|The service component name assigned by dockerplugin to the component<br>that is unique to the cloudify node instance and used in its Consul key(s).|string||
363
364 #### Responses
365 |HTTP Code|Description|Schema|
366 |---|---|---|
367 |**200**|Success|[ServictestonentResponse](#servictestonentresponse)|
368
369 <a name="servictestonentresponse"></a>
370 ##### ServictestonentResponse
371 OTI Handler returns a JSON object containing the install-time value of the service component node's
372 application_config property from the Cloudify deployment,
373 with any templating resolved from the current values of Consul dmaap and rel keys.
374
375 Example JSON response, formatted:
376 ```
377 {
378     "dcae_target_type": [
379         "pnga-xxx"
380     ]
381 }
382 ```
383
384 ---
385 <a name="oti_k8s_events"></a>
386 ### GET /oti_k8s_events?pod=\<pod name\>&cluster=\<k8s cluster\>&namespace=\<k8s namespace\>
387
388 #### Description
389 Retrieve oti events list associated with a specific kubernetes pod.
390
391 *Note:Config Binding Service calls this API to fetch pod specific data*
392 1. *OTI events are queried from application database (not from consul)*
393 1. *events are associated with a specific k8s pod and the k8s location CLLI*
394
395 #### Parameters
396 |Type|Name|Description|Schema|Default|
397 |---|---|---|---|---|
398 |query component|**pod** <br>*required*|pod ID of the kubernetes StatefulSet for this collector service|String||
399 |query component|**cluster** <br>*required*|cluster FQDN of the kubernetes StatefulSet for this collector service|String||
400 |query component|**namespace** <br>*required*|namespace of the kubernetes StatefulSet for this collector service|String||
401
402 #### Responses
403 |HTTP Code|Description|Schema|
404 |---|---|---|
405 |**200**|Success|[OtiEventsResponse](#otieventsresponse)|
406
407 <a name="otieventsresponse"></a>
408 ##### OtiEventsResponse
409 OTI Handler Service returns a JSON object with VNF Types as first-level keys, and<br>VNF Instance IDs as second-level keys with value of its latest OTI Event.
410
411
412 Example JSON response
413
414 ```
415 {
416         "ctsf": {
417                 "dpa2actsf12345": {
418                         "dcae_service_location": "LSLEILAA",
419                         "dcae_service_type": "vUSP - vCTS",
420                         "dcae_target_type": "ctsf",
421                         "dcae_service_action": "add",
422                         "dcae_target_name": "dpa2actsf12345",
423                         "dcae_target_is-closed-loop-disabled": "false",
424                         "dcae_target_collection_ip": "32.67.11.99",
425                         "dcae_target_collection": "true",
426                         "dcae_target_prov-status": "PROV",
427                         "dcae_snmp_version": "",
428                         "dcae_target_service-description": "VIRTUAL USP",
429                         "dcae_snmp_community_string": "",
430                         "dcae_target_cloud-region-id": "dpa2a",
431                         "dcae_target_cloud-region-version": "aic3.0",
432                         "event": {}
433                 },
434                 "dpa2actsf4421": {
435                         "dcae_service_location": "LSLEILAA",
436                         "dcae_service_type": "vUSP - vCTS",
437                         "dcae_target_type": "ctsf",
438                         "dcae_service_action": "add",
439                         "dcae_target_name": "dpa2actsf4421",
440                         "dcae_target_is-closed-loop-disabled": "false",
441                         "dcae_target_collection_ip": "32.67.11.99",
442                         "dcae_target_collection": "true",
443                         "dcae_target_prov-status": "PROV",
444                         "dcae_snmp_version": "",
445                         "dcae_target_service-description": "VIRTUAL USP",
446                         "nodeType": "ctsf",
447                         "description": "CTS metrics",
448                         "nodeSubtype": "",
449                         "serviceType": "VIRTUAL USP",
450                         "priority": 1,
451                         "subType": "camel",
452                         "vnfType": "ctsf",
453                         "taskId": "PVUVUALUCTSCTS1080",
454                         "collectionType": "FOI",
455                         "protocol": "sftp",
456                         "collectionInterval": "300"
457                 }
458         }
459 }
460 ```
461
462 ---
463 <a name="oti_docker_events"></a>
464 ### GET /oti_docker_events?service=\<service name\>&location=\<location CLLI\>
465
466 #### Description
467 Retrieve oti events list associated with a docker hosted service or k8s service.
468
469 *Note:Config Binding Service calls this API to fetch OTI events associated with a docker container*
470 1. *OTI events are queried from application database (not from consul)*
471 1. *events are associated with a specific docker container or all k8s pods related to the service,<br> further filtered by the input location CLLI*
472
473 #### Parameters
474 |Type|Name|Description|Schema|Default|
475 |---|---|---|---|---|
476 |query component|**service** <br>*required*|service compnent name|String||
477 |query component|**location** <br>*optional*|location CLLI associated with the docker host or k8s cluster|String||
478
479 #### Responses
480 |HTTP Code|Description|Schema|
481 |---|---|---|
482 |**200**|Success|[OtiEventsResponse](#otieventsresponse)|
483
484 <a name="otieventsresponse"></a>
485 ##### OtiEventsResponse
486 OTI Handler Service returns a JSON object with VNF Types as first-level keys, and<br>VNF Instance IDs as second-level keys with value of its latest OTI Event.
487
488
489 Example JSON response
490
491 ```
492 {
493         "ctsf": {
494                 "dpa2actsf12345": {
495                         "dcae_service_location": "LSLEILAA",
496                         "dcae_service_type": "vUSP - vCTS",
497                         "dcae_target_type": "ctsf",
498                         "dcae_service_action": "add",
499                         "dcae_target_name": "dpa2actsf12345",
500                         "dcae_target_is-closed-loop-disabled": "false",
501                         "dcae_target_collection_ip": "32.67.11.99",
502                         "dcae_target_collection": "true",
503                         "dcae_target_prov-status": "PROV",
504                         "dcae_snmp_version": "",
505                         "dcae_target_service-description": "VIRTUAL USP",
506                         "dcae_snmp_community_string": "",
507                         "dcae_target_cloud-region-id": "dpa2a",
508                         "dcae_target_cloud-region-version": "aic3.0",
509                         "event": {}
510                 },
511                 "dpa2actsf4421": {
512                         "dcae_service_location": "LSLEILAA",
513                         "dcae_service_type": "vUSP - vCTS",
514                         "dcae_target_type": "ctsf",
515                         "dcae_service_action": "add",
516                         "dcae_target_name": "dpa2actsf4421",
517                         "dcae_target_is-closed-loop-disabled": "false",
518                         "dcae_target_collection_ip": "32.67.11.99",
519                         "dcae_target_collection": "true",
520                         "dcae_target_prov-status": "PROV",
521                         "dcae_snmp_version": "",
522                         "dcae_target_service-description": "VIRTUAL USP",
523                         "nodeType": "ctsf",
524                         "description": "CTS metrics",
525                         "nodeSubtype": "",
526                         "serviceType": "VIRTUAL USP",
527                         "priority": 1,
528                         "subType": "camel",
529                         "vnfType": "ctsf",
530                         "taskId": "PVUVUALUCTSCTS1080",
531                         "collectionType": "FOI",
532                         "protocol": "sftp",
533                         "collectionInterval": "300"
534                 }
535         }
536 }
537 ```
538
539 ---
540 <a name="dti_k8_events"></a>
541 ### GET /dti_k8_events?pod=\<pod name\>&cluster=\<k8s cluster\>&namespace=\<k8s namespace\>
542
543 #### Description
544 Retrieve dti events list associated with a specific kubernetes pod.
545
546 *Note:Config Binding Service calls this API to fetch pod specific data*
547 1. *OTI events are queried from application database (not from consul)*
548 1. *events are associated with a specific k8s pod and the k8s location CLLI*
549
550 #### Parameters
551 |Type|Name|Description|Schema|Default|
552 |---|---|---|---|---|
553 |query component|**pod** <br>*required*|pod ID of the kubernetes StatefulSet for this collector service|String||
554 |query component|**cluster** <br>*required*|cluster FQDN of the kubernetes StatefulSet for this collector service|String||
555 |query component|**namespace** <br>*required*|namespace of the kubernetes StatefulSet for this collector service|String||
556
557 #### Responses
558 |HTTP Code|Description|Schema|
559 |---|---|---|
560 |**200**|Success|[DtiEventsResponse](#dtieventsresponse)|
561
562 <a name="dtieventsresponse"></a>
563 ##### DtiEventsResponse
564 OTI Handler Service returns a JSON object with VNF Types as first-level keys, and<br>VNF Instance IDs as second-level keys with value of its latest OTI Event.
565
566
567 Example JSON response
568
569 ```
570 {
571         "ctsf": {
572                 "dpa2actsf12345": {
573                         "dcae_service_location": "LSLEILAA",
574                         "dcae_service_type": "vUSP - vCTS",
575                         "dcae_target_type": "ctsf",
576                         "dcae_service_action": "add",
577                         "dcae_target_name": "dpa2actsf12345",
578                         "dcae_target_is-closed-loop-disabled": "false",
579                         "dcae_target_collection_ip": "32.67.11.99",
580                         "dcae_target_collection": "true",
581                         "dcae_target_prov-status": "PROV",
582                         "dcae_snmp_version": "",
583                         "dcae_target_service-description": "VIRTUAL USP",
584                         "dcae_snmp_community_string": "",
585                         "dcae_target_cloud-region-id": "dpa2a",
586                         "dcae_target_cloud-region-version": "aic3.0",
587                         "event": {}
588                 },
589                 "dpa2actsf4421": {
590                         "dcae_service_location": "LSLEILAA",
591                         "dcae_service_type": "vUSP - vCTS",
592                         "dcae_target_type": "ctsf",
593                         "dcae_service_action": "add",
594                         "dcae_target_name": "dpa2actsf4421",
595                         "dcae_target_is-closed-loop-disabled": "false",
596                         "dcae_target_collection_ip": "32.67.11.99",
597                         "dcae_target_collection": "true",
598                         "dcae_target_prov-status": "PROV",
599                         "dcae_snmp_version": "",
600                         "dcae_target_service-description": "VIRTUAL USP",
601                         "nodeType": "ctsf",
602                         "description": "CTS metrics",
603                         "nodeSubtype": "",
604                         "serviceType": "VIRTUAL USP",
605                         "priority": 1,
606                         "subType": "camel",
607                         "vnfType": "ctsf",
608                         "taskId": "PVUVUALUCTSCTS1080",
609                         "collectionType": "FOI",
610                         "protocol": "sftp",
611                         "collectionInterval": "300"
612                 }
613         }
614 }
615 ```
616
617 ---
618 <a name="dti_docker_events"></a>
619 ### GET /dti_docker_events?service=\<service name\>&location=\<location CLLI\>
620
621 #### Description
622 Retrieve dti events list associated with a docker hosted service or k8s service.
623
624 *Note:Config Binding Service calls this API to fetch OTI events associated with a docker container*
625 1. *OTI events are queried from application database (not from consul)*
626 1. *events are associated with a specific docker container or all k8s pods related to the service,<br> further filtered by the input location CLLI*
627
628 #### Parameters
629 |Type|Name|Description|Schema|Default|
630 |---|---|---|---|---|
631 |query component|**service** <br>*required*|service compnent name|String||
632 |query component|**location** <br>*optional*|location CLLI associated with the docker host or k8s cluster|String||
633
634 #### Responses
635 |HTTP Code|Description|Schema|
636 |---|---|---|
637 |**200**|Success|[DtiEventsResponse](#dtieventsresponse)|
638
639 <a name="dtieventsresponse"></a>
640 ##### DtiEventsResponse
641 OTI Handler Service returns a JSON object with VNF Types as first-level keys, and<br>VNF Instance IDs as second-level keys with value of its latest OTI Event.
642
643
644 Example JSON response
645
646 ```
647 {
648         "ctsf": {
649                 "dpa2actsf12345": {
650                         "dcae_service_location": "LSLEILAA",
651                         "dcae_service_type": "vUSP - vCTS",
652                         "dcae_target_type": "ctsf",
653                         "dcae_service_action": "add",
654                         "dcae_target_name": "dpa2actsf12345",
655                         "dcae_target_is-closed-loop-disabled": "false",
656                         "dcae_target_collection_ip": "32.67.11.99",
657                         "dcae_target_collection": "true",
658                         "dcae_target_prov-status": "PROV",
659                         "dcae_snmp_version": "",
660                         "dcae_target_service-description": "VIRTUAL USP",
661                         "dcae_snmp_community_string": "",
662                         "dcae_target_cloud-region-id": "dpa2a",
663                         "dcae_target_cloud-region-version": "aic3.0",
664                         "event": {}
665                 },
666                 "dpa2actsf4421": {
667                         "dcae_service_location": "LSLEILAA",
668                         "dcae_service_type": "vUSP - vCTS",
669                         "dcae_target_type": "ctsf",
670                         "dcae_service_action": "add",
671                         "dcae_target_name": "dpa2actsf4421",
672                         "dcae_target_is-closed-loop-disabled": "false",
673                         "dcae_target_collection_ip": "32.67.11.99",
674                         "dcae_target_collection": "true",
675                         "dcae_target_prov-status": "PROV",
676                         "dcae_snmp_version": "",
677                         "dcae_target_service-description": "VIRTUAL USP",
678                         "nodeType": "ctsf",
679                         "description": "CTS metrics",
680                         "nodeSubtype": "",
681                         "serviceType": "VIRTUAL USP",
682                         "priority": 1,
683                         "subType": "camel",
684                         "vnfType": "ctsf",
685                         "taskId": "PVUVUALUCTSCTS1080",
686                         "collectionType": "FOI",
687                         "protocol": "sftp",
688                         "collectionInterval": "300"
689                 }
690         }
691 }
692 ```
693
694 <a name="service_component_all"></a>
695 ### GET /service_component_all/**\<service_name\>**?**service_location**=\<service_location\>;**policy_ids**=n
696
697 #### Description
698 Retrieve all available information for a service component instance (config, dti, and policies).
699
700 *Note:  Response differs from what prior Config Binding Service returned in that:*
701 1. *OTI events come from history (e.g., before a collector service component instance was deployed and are not lost if redeployed).*
702 1. *Can specify locations for OTI events to retrieve (e.g., for filtering, or for alternate sites).*
703 1. *Policies items is an object indexed by policy_id rather than a list (unless you specify **policy_ids**=n).*
704
705 #### Parameters
706 |Type|Name|Description|Schema|Default|
707 |---|---|---|---|---|
708 |path segment|**\<service_name\>**  <br>*required*|The service component name assigned by dockerplugin or k8splugin to the component<br>that is unique to the cloudify node instance and used in its Consul key(s).|string||
709 |query component|**service_location**  <br>*optional*|Allows multiple values separated by commas.<br>Filters OTI events with dcae_service_location in **\<service_location\>**.<br>Overrides locations defined in Consul for the **\<service_name\>**.|string|locations from Consul|
710 |query component|**policy_ids**  <br>*optional*|When "n", formats policies items as a list without policy_ids rather than as an object indexed by policy_id.|string|y|
711
712 #### Responses
713 |HTTP Code|Description|Schema|
714 |---|---|---|
715 |**200**|Success|[ServictestonentAllResponse](#servictestonentallresponse)|
716
717 <a name="servictestonentallresponse"></a>
718 ##### ServictestonentAllResponse
719 OTI Handler returns a JSON object containing all information for the component from Consul:
720
721 |Name|Description|Schema|
722 |---|---|---|
723 |**config**  <br>*required*|The install-time value of the service component node's application_config property<br>from the Cloudify deployment, with any templating resolved<br>from the current values of Consul dmaap and rel keys.|object|
724 |**dti**  <br>*optional*|A JSON object with VNF Types as first-level keys, and<br>VNF Instance IDs as second-level keys with value of its latest OTI Event.|object|
725 |**policies**  <br>*optional*|A JSON object with "event" and "items" first-level keys, and<br>policy_ids as second-level keys under "items"<br>(or if **policy_ids**=n then just a list without policy_ids)<br>with value of the complete policy body from Policy Manager.|object|
726
727 Example JSON response, formatted:
728 ```
729 {
730     "config": {
731         "dcae_target_type": [
732             "pnga-xxx"
733         ]
734     },
735     "dti": {
736         "anot-her": {
737             "another01ems003": {
738                 "aai_additional_info": {},
739                 "dcae_generic-vnf_model-version-id": "1",
740                 "dcae_service-instance_model-version-id": "1",
741                 "dcae_service_action": "deploy",
742                 "dcae_service_location": "LSLEILAA",
743                 "dcae_snmp_community_string": "my_first_community",
744                 "dcae_snmp_version": "2c",
745                 "dcae_target_collection": "true",
746                 "dcae_target_collection_ip": "107.239.85.3",
747                 "dcae_target_in-maint": "false",
748                 "dcae_target_is-closed-loop-disabled": "false",
749                 "dcae_target_name": "another01ems003",
750                 "dcae_target_prov-status": "PROV",
751                 "dcae_target_type": "anot-her",
752                 "event": {}
753             },
754             "another01ems044": {
755                 "aai_additional_info": {},
756                 "dcae_generic-vnf_model-version-id": "1",
757                 "dcae_service-instance_model-version-id": "1",
758                 "dcae_service_action": "deploy",
759                 "dcae_service_location": "LSLEILAA",
760                 "dcae_snmp_community_string": "my_first_community",
761                 "dcae_snmp_version": "2c",
762                 "dcae_target_collection": "true",
763                 "dcae_target_collection_ip": "107.239.85.44",
764                 "dcae_target_in-maint": "false",
765                 "dcae_target_is-closed-loop-disabled": "false",
766                 "dcae_target_name": "another01ems044",
767                 "dcae_target_prov-status": "PROV",
768                 "dcae_target_type": "anot-her",
769                 "event": {}
770             }
771         }
772     },
773     "policies": {
774         "event": {
775             "action": "updated",
776             "policies_count": 3,
777             "timestamp": "2018-07-16T15:11:44.845Z",
778             "update_id": "e6102aab-3079-435a-ae0d-0397a2cb3c4d"
779         },
780         "items": {
781             "DCAE_FTL3B.Config_Green_Collectors": {
782                 "config": {
783                     "conflicting_key": "green_collectors_wins",
784                     "package_type": "plastic",
785                     "polling_frequency": "30m",
786                     "power_source": "lemmings"
787                 },
788                 "matchingConditions": {
789                     "ConfigName": "Green_Collectors",
790                     "testName": "dcae",
791                     "ONAPName": "dcae"
792                 },
793                 "policyConfigMessage": "Config Retrieved! ",
794                 "policyConfigStatus": "CONFIG_RETRIEVED",
795                 "policyName": "DCAE_FTL3B.Config_Green_Collectors.1.xml",
796                 "policyVersion": "1",
797                 "property": null,
798                 "responseAttributes": {},
799                 "type": "JSON"
800             },
801             "DCAE_FTL3B.Config_Green_Eggs_and_Ham_specific": {
802                 "config": {
803                     "bacon": "soft, not crispy",
804                     "bread": "pumpernickel",
805                     "conflicting_key": "green_eggs_and_ham_are_better",
806                     "dcae_target_type": [
807                         "pnga-xxx",
808                         "pcrf-oam",
809                         "vhss-ems",
810                         "anot-her",
811                         "new-type"
812                     ],
813                     "egg_color": "green",
814                     "preparation": "scrambled"
815                 },
816                 "matchingConditions": {
817                     "ConfigName": "Green_Eggs_and_Ham_specific",
818                     "testName": "dcae",
819                     "ONAPName": "dcae"
820                 },
821                 "policyConfigMessage": "Config Retrieved! ",
822                 "policyConfigStatus": "CONFIG_RETRIEVED",
823                 "policyName": "DCAE_FTL3B.Config_Green_Eggs_and_Ham_specific.5.xml",
824                 "policyVersion": "5",
825                 "property": null,
826                 "responseAttributes": {},
827                 "type": "JSON"
828             },
829             "DCAE_FTL3B.Config_In_Service": {
830                 "config": {
831                     "conflicting_key": "in_service_trumps!",
832                     "in_service": true
833                 },
834                 "matchingConditions": {
835                     "ConfigName": "In_Service",
836                     "testName": "dcae",
837                     "ONAPName": "dcae"
838                 },
839                 "policyConfigMessage": "Config Retrieved! ",
840                 "policyConfigStatus": "CONFIG_RETRIEVED",
841                 "policyName": "DCAE_FTL3B.Config_In_Service.1.xml",
842                 "policyVersion": "1",
843                 "property": null,
844                 "responseAttributes": {},
845                 "type": "JSON"
846             }
847         }
848     }
849 }
850 ```