Merge "config for 5.0.0 policy-handler new PDP API"
[dcaegen2/deployments.git] / archive / heat / register.sh
1 #!/bin/bash
2
3 #############################################################################
4 #
5 # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #        http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 #############################################################################
19
20
21
22 # We now register services that are not handled by Registrator
23 # minimum platform components
24 HOSTNAME_CONSUL="consul"
25 SRVCNAME_CONSUL="consul"
26 HOSTNAME_CM="cloudify-manager"
27 SRVCNAME_CM="cloudify_manager"
28 HOSTNAME_CBS="config-binding-service"
29 SRVCNAME_CBS="config_binding_service"
30
31 # R3 MVP service components
32 HOSTNAME_MVP_VES="mvp-dcaegen2-collectors-ves"
33 SRVCNAME_MVP_VES="mvp-dcaegen2-collectors-ves"
34 HOSTNAME_MVP_TCA="mvp-dcaegen2-analytics-tca"
35 SRVCNAME_MVP_TCA="mvp-dcaegen2-analytics-tca"
36 HOSTNAME_MVP_HR="mvp-dcaegen2-analytics-holmes-rule-management"
37 SRVCNAME_MVP_HR="mvp-dcaegen2-analytics-holmes-rule-management"
38 HOSTNAME_MVP_HE="mvp-dcaegen2-analytics-holmes-engine-management"
39 SRVCNAME_MVP_HE="mvp-dcaegen2-analytics-holmes-engine-management"
40
41 # R3 PLUS service components
42 HOSTNAME_STATIC_SNMPTRAP="static-dcaegen2-collectors-snmptrap"
43 SRVCNAME_STATIC_SNMPTRAP="static-dcaegen2-collectors-snmptrap"
44 HOSTNAME_STATIC_MAPPER="static-dcaegen2-services-mapper"
45 SRVCNAME_STATIC_MAPPER="static-dcaegen2-services-mapper"
46 HOSTNAME_STATIC_HEARTBEAT="static-dcaegen2-services-heartbeat"
47 SRVCNAME_STATIC_HEARTBEAT="static-dcaegen2-services-heartbeat"
48 HOSTNAME_STATIC_PRH="static-dcaegen2-services-prh"
49 SRVCNAME_STATIC_PRH="static-dcaegen2-services-prh"
50 HOSTNAME_STATIC_HVVES="static-dcaegen2-collectors-hvves"
51 SRVCNAME_STATIC_HVVES="static-dcaegen2-collectors-hvves"
52 HOSTNAME_STATIC_DFC="static-dcaegen2-collectors-datafile"
53 SRVCNAME_STATIC_DFC="static-dcaegen2-collectors-datafile"
54
55
56 # registering docker host
57 SVC_NAME="dockerhost"
58 SVC_IP="$(cat /opt/config/dcae_float_ip.txt)"
59 REGREQ="
60 {
61   \"Name\" : \"${SVC_NAME}\",
62   \"ID\" : \"${SVC_NAME}\",
63   \"Address\": \"${SVC_IP}\",
64   \"Port\": 2376,
65   \"Check\" : {
66     \"Name\" : \"${SVC_NAME}_health\",
67     \"Interval\" : \"15s\",
68     \"HTTP\" : \"http://${SVC_IP}:2376/containers/registrator/json\",
69     \"Status\" : \"passing\"
70   }
71 }
72 "
73 curl -v -X PUT -H 'Content-Type: application/json' \
74 --data-binary "$REGREQ" \
75 "http://${HOSTNAME_CONSUL}:8500/v1/agent/service/register"
76
77 #Add KV for dockerplugin login
78 REGREQ="
79 [
80         {
81                 \"username\": \"docker\",
82                 \"password\": \"docker\",
83                 \"registry\": \"nexus3.onap.org:10001\"
84         }
85 ]
86 "
87 curl -v -X PUT -H 'Content-Type: application/json' \
88 --data-binary "$REGREQ" \
89 "http://${HOSTNAME_CONSUL}:8500/v1/kv/docker_plugin/docker_logins"
90
91
92 # registering deployment handler
93 SVC_NAME="deployment_handler"
94 SVC_IP="$(cat /opt/config/dcae_ip_addr.txt)"
95 REGREQ="
96 {
97   \"Name\" : \"${SVC_NAME}\",
98   \"ID\" : \"${SVC_NAME}\",
99   \"Address\": \"${SVC_IP}\",
100   \"Port\": 8188,
101   \"Check\" : {
102     \"Name\" : \"${SVC_NAME}_health\",
103     \"Interval\" : \"15s\",
104     \"HTTP\" : \"https://${SVC_IP}:8188/\",
105     \"tls_skip_verify\": true,
106     \"Status\" : \"passing\"
107   }
108 }
109 "
110 curl -v -X PUT -H 'Content-Type: application/json' \
111 --data-binary \
112 "$REGREQ" "http://${HOSTNAME_CONSUL}:8500/v1/agent/service/register"
113
114
115 # registering Holmes services
116 SVC_NAME="${SRVCNAME_MVP_HR}"
117 SVC_IP="$(cat /opt/config/dcae_ip_addr.txt)"
118 REGREQ="
119 {
120   \"Name\" : \"${SVC_NAME}\",
121   \"ID\" : \"${SVC_NAME}\",
122   \"Address\": \"${SVC_IP}\",
123   \"Port\": 9101,
124   \"Check\" : {
125     \"Name\" : \"${SVC_NAME}_health\",
126     \"Interval\" : \"15s\",
127     \"HTTP\" : \"https://${SVC_IP}:9101/api/holmes-rule-mgmt/v1/healthcheck\",
128     \"tls_skip_verify\": true,
129     \"Status\" : \"passing\"
130   }
131 }
132 "
133 curl -v -X PUT -H 'Content-Type: application/json' \
134 --data-binary \
135 "$REGREQ" "http://${HOSTNAME_CONSUL}:8500/v1/agent/service/register"
136
137
138 SVC_NAME="${SRVCNAME_MVP_HE}"
139 SVC_IP="$(cat /opt/config/dcae_ip_addr.txt)"
140 REGREQ="
141 {
142   \"Name\" : \"${SVC_NAME}\",
143   \"ID\" : \"${SVC_NAME}\",
144   \"Address\": \"${SVC_IP}\",
145   \"Port\": 9102,
146   \"Check\" : {
147     \"Name\" : \"${SVC_NAME}_health\",
148     \"Interval\" : \"15s\",
149     \"HTTP\" : \"https://${SVC_IP}:9102/api/holmes-engine-mgmt/v1/healthcheck\",
150     \"tls_skip_verify\": true,
151     \"Status\" : \"passing\"
152   }
153 }
154 "
155 curl -v -X PUT -H 'Content-Type: application/json' \
156 --data-binary "$REGREQ" \
157 "http://${HOSTNAME_CONSUL}:8500/v1/agent/service/register"
158
159
160
161 # now push KVs
162 # generated with https://www.browserling.com/tools/json-escape
163 # config binding service
164 REGKV="
165 {}
166 "
167 curl -v -X PUT -H "Content-Type: application/json" \
168 --data "${REGKV}" \
169 http://${HOSTNAME_CONSUL}:8500/v1/kv/config_binding_service
170 # checked
171
172
173
174 # inventory
175 REGKV='
176 {
177   "database": {
178     "checkConnectionWhileIdle": false,
179     "driverClass": "org.postgresql.Driver",
180     "evictionInterval": "10s",
181     "initialSize": 2,
182     "maxSize": 8,
183     "maxWaitForConnection": "1s",
184     "minIdleTime": "1 minute",
185     "minSize": 2,
186     "password": "inventorypwd",
187     "properties": {
188       "charSet": "UTF-8"},
189       "url": "jdbc:postgresql://pgInventory:5432/postgres",
190       "user": "inventory",
191       "validationQuery": "/* MyService Health Check */ SELECT 1"
192     },
193     "databusControllerConnection": {
194       "host": "databus-controller-hostname",
195       "mechId": null,
196       "password": null,
197       "port": 8443,
198       "required": false},
199       "httpClient": {
200         "connectionTimeout": "5000milliseconds",
201         "gzipEnabled": false,
202         "gzipEnabledForRequests": false,
203         "maxThreads": 128,
204         "minThreads": 1,
205         "timeout": "5000milliseconds"
206       }
207     }
208   }
209 }'
210 curl -v -X PUT -H "Content-Type: application/json" \
211 --data "${REGKV}" \
212 http://${HOSTNAME_CONSUL}:8500/v1/kv/inventory
213 # checked
214
215
216 # policy handler
217 REGKV='
218 {
219   "policy_handler": {
220     "deploy_handler": {
221         "target_entity": "deployment_handler",
222         "tls_ca_mode": "do_not_verify",
223         "max_msg_length_mb": 5,
224         "url" : "https://{{ dcae_ip_addr }}:8188",
225         "tls_ca_mode" : "cert_directory",
226         "query": {
227           "cfy_tenant_name": "default_tenant"
228         }
229     },
230     "thread_pool_size": 4,
231     "policy_retry_count": 5,
232     "pool_connections": 20,
233     "policy_retry_sleep": 5,
234     "catch_up": {
235       "interval": 1200
236     },
237     "reconfigure": {
238       "interval": 600
239     },
240     "policy_engine": {
241       "path_decision": "/decision/v1",
242       "path_api": "/pdp/api/",
243       "path_notifications" : "/pdp/notifications",
244       "tls_ca_mode" : "cert_directory",
245       "tls_wss_ca_mode" : "cert_directory",
246       "headers": {
247         "Environment": "TEST",
248         "ClientAuth": "cHl0aG9uOnRlc3Q=",
249         "Content-Type": "application/json",
250         "Accept": "application/json",
251         "Authorization": "Basic dGVzdHBkcDphbHBoYTEyMw=="
252       },
253       "url": "https://{{ policy_ip_addr }}:8081",
254       "target_entity": "policy_engine"
255     }
256   }
257 }'
258 curl -v -X PUT -H "Content-Type: application/json" \
259 --data "${REGKV}" \
260 "http://${HOSTNAME_CONSUL}:8500/v1/kv/policy_handler"
261
262
263 # service change handler
264 REGKV='
265 {
266   "asdcDistributionClient": {
267     "asdcAddress": "{{ sdc_ip_addr }}:8443",
268     "asdcUri": "https://{{ sdc_ip_addr }}:8443",
269     "msgBusAddress": "{{ mr_ip_addr }}",
270     "user": "dcae",
271     "password": "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U",
272     "pollingInterval": 20,
273     "pollingTimeout": 20,
274     "consumerGroup": "dcae",
275     "consumerId": "dcae-sch",
276     "environmentName": "AUTO",
277     "keyStorePath": null,
278     "keyStorePassword": null,
279     "activateServerTLSAuth": false,
280     "useHttpsWithDmaap": false,
281     "isFilterInEmptyResources": false
282   },
283   "dcaeInventoryClient": {
284     "uri": "http://inventory:8080"
285   }
286 }'
287 curl -v -X PUT -H "Content-Type: application/json" \
288 --data "${REGKV}" \
289 "http://${HOSTNAME_CONSUL}:8500/v1/kv/service-change-handler"
290
291
292 # deployment handler
293 REGKV='
294 {
295   "logLevel": "DEBUG",
296   "cloudify": {
297     "protocol": "http"
298   },
299   "inventory": {
300     "protocol": "http"
301   }
302 }'
303 curl -v -X PUT -H "Content-Type: application/json" \
304 --data "${REGKV}" \
305 "http://${HOSTNAME_CONSUL}:8500/v1/kv/deployment_handler"
306
307
308 # ves
309 MR_IP="$(cat /opt/config/mr_ip_addr.txt)"
310 REGKV='
311 {
312   "event.transform.flag": "0",
313   "tomcat.maxthreads": "200",
314   "collector.schema.checkflag": "1",
315   "collector.dmaap.streamid": "fault=ves_fault|syslog=ves_syslog|heartbeat=ves_heartbeat|measurementsForVfScaling=ves_measurement|mobileFlow=ves_mobileflow|other=ves_other|stateChange=ves_statechange|thresholdCrossingAlert=ves_thresholdCrossingAlert|voiceQuality=ves_voicequality|sipSignaling=ves_sipsignaling",
316   "collector.service.port": "8080",
317   "collector.schema.file": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.1.json\"}",
318   "collector.keystore.passwordfile": "/opt/app/VESCollector/etc/passwordfile",
319   "collector.inputQueue.maxPending": "8096",
320   "streams_publishes": {
321     "ves_measurement": {
322       "type": "message_router",
323       "dmaap_info": {
324         "topic_url": "http://{{ mr_ip_addr }}:3904/events/unauthenticated.VES_MEASUREMENT_OUTPUT/"
325       }
326     },
327     "ves_fault": {
328       "type": "message_router",
329       "dmaap_info": {
330         "topic_url": "http://{{ mr_ip_addr }}:3904/events/unauthenticated.SEC_FAULT_OUTPUT/"
331       }
332     }
333   },
334   "collector.service.secure.port": "8443",
335   "header.authflag": "0",
336   "collector.keystore.file.location": "/opt/app/VESCollector/etc/keystore",
337   "collector.keystore.alias": "dynamically generated",
338   "services_calls": [],
339   "header.authlist": "userid1,base64encodepwd1|userid2,base64encodepwd2"
340 }'
341 curl -v -X PUT -H "Content-Type: application/json" \
342 --data "${REGKV}" \
343 "http://${HOSTNAME_CONSUL}:8500/v1/kv/mvp-dcaegen2-collectors-ves"
344
345
346 # holmes rule management
347 MSB_IP="$(cat /opt/config/msb_ip_addr.txt)"
348 REGKV="
349 {
350   \"streams_subscribes\": {},
351   \"msb.hostname\": \"${MSB_IP_ADDR}\",
352   \"msb.uri\": \"/api/microservices/v1/services\",
353   \"streams_publishes\": {},
354   \"holmes.default.rule.volte.scenario1\": \"ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b\$\$\$package org.onap.holmes.droolsRule;\\n\\nimport org.onap.holmes.common.dmaap.DmaapService;\\nimport org.onap.holmes.common.api.stat.VesAlarm;\\nimport org.onap.holmes.common.aai.CorrelationUtil;\\nimport org.onap.holmes.common.dmaap.entity.PolicyMsg;\\nimport org.onap.holmes.common.dropwizard.ioc.utils.ServiceLocatorHolder;\\nimport org.onap.holmes.common.utils.DroolsLog;\\n \\n\\nrule \\\"Relation_analysis_Rule\\\"\\nsalience 200\\nno-loop true\\n    when\\n        \$root : VesAlarm(alarmIsCleared == 0,\\n            \$sourceId: sourceId, sourceId != null && !sourceId.equals(\\\"\\\"),\\n\\t\\t\\t\$sourceName: sourceName, sourceName \!= null \&\& \!sourceName.equals(\\\"\\\"),\\n\\t\\t\\t\$startEpochMicrosec: startEpochMicrosec,\\n            eventName in (\\\"Fault_MultiCloud_VMFailure\\\"),\\n            \$eventId: eventId)\\n        \$child : VesAlarm( eventId \!= $eventId, parentId == null,\\n            CorrelationUtil.getInstance().isTopologicallyRelated(sourceId, \$sourceId, \$sourceName),\\n            eventName in (\\\"Fault_MME_eNodeB out of service alarm\\\"),\\n            startEpochMicrosec \< \$startEpochMicrosec + 60000 \&\& startEpochMicrosec \> \$startEpochMicrosec - 60000 )\\n    then\\n\\t\\tDroolsLog.printInfo(\\\"===========================================================\\\");\\n\\t\\tDroolsLog.printInfo(\\\"Relation_analysis_Rule: rootId=\\\" + \$root.getEventId() + \\\", childId=\\\" + \$child.getEventId());\\n\\t\\t\$child.setParentId(\$root.getEventId());\\n\\t\\tupdate(\$child);\\n\\t\\t\\nend\\n\\nrule \\\"root_has_child_handle_Rule\\\"\\nsalience 150\\nno-loop true\\n\\twhen\\n\\t\\t\$root : VesAlarm(alarmIsCleared == 0, rootFlag == 0, \$eventId: eventId)\\n\\t\\t\$child : VesAlarm(eventId \!= $eventId, parentId == $eventId)\\n\\tthen\\n\\t\\tDroolsLog.printInfo(\\\"===========================================================\\\");\\n\\t\\tDroolsLog.printInfo(\\\"root_has_child_handle_Rule: rootId=\\\" + \$root.getEventId() + \\\", childId=\\\" + $child.getEventId());\\n\\t\\tDmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);\\n\\t\\tPolicyMsg policyMsg = dmaapService.getPolicyMsg(\$root, \$child, \\\"org.onap.holmes.droolsRule\\\");\\n        dmaapService.publishPolicyMsg(policyMsg, \\\"unauthenticated.DCAE_CL_OUTPUT\\\");\\n\\t\\t\$root.setRootFlag(1);\\n\\t\\tupdate(\$root);\\nend\\n\\nrule \\\"root_no_child_handle_Rule\\\"\\nsalience 100\\nno-loop true\\n    when\\n        \$root : VesAlarm(alarmIsCleared == 0, rootFlag == 0,\\n            sourceId \!= null \&\& \!sourceId.equals(\\\"\\\"),\\n\\t\\t\\tsourceName \!= null \&\& \!sourceName.equals(\\\"\\\"),\\n            eventName in (\\\"Fault_MultiCloud_VMFailure\\\"))\\n    then\\n\\t\\tDroolsLog.printInfo(\\\"===========================================================\\\");\\n\\t\\tDroolsLog.printInfo(\\\"root_no_child_handle_Rule: rootId=\\\" + \$root.getEventId());\\n\\t\\tDmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);\\n\\t\\tPolicyMsg policyMsg = dmaapService.getPolicyMsg(\$root, null, \\\"org.onap.holmes.droolsRule\\\");\\n        dmaapService.publishPolicyMsg(policyMsg, \\\"unauthenticated.DCAE_CL_OUTPUT\\\");\\n\\t\\t$root.setRootFlag(1);\\n\\t\\tupdate(\$root);\\nend\\n\\nrule \\\"root_cleared_handle_Rule\\\"\\nsalience 100\\nno-loop true\\n    when\\n        \$root : VesAlarm(alarmIsCleared == 1, rootFlag == 1)\\n    then\\n\\t\\tDroolsLog.printInfo(\\\"===========================================================\\\");\\n\\t\\tDroolsLog.printInfo(\\\"root_cleared_handle_Rule: rootId=\\\" + \$root.getEventId());\\n\\t\\tDmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);\\n\\t\\tPolicyMsg policyMsg = dmaapService.getPolicyMsg(\$root, null, \\\"org.onap.holmes.droolsRule\\\");\\n        dmaapService.publishPolicyMsg(policyMsg, \\\"unauthenticated.DCAE_CL_OUTPUT\\\");\\n\\t\\tretract(\$root);\\nend\\n\\nrule \\\"child_handle_Rule\\\"\\nsalience 100\\nno-loop true\\n    when\\n        \$child : VesAlarm(alarmIsCleared == 1, rootFlag == 0)\\n    then\\n\\t\\tDroolsLog.printInfo(\\\"===========================================================\\\");\\n\\t\\tDroolsLog.printInfo(\\\"child_handle_Rule: childId=\\\" + \$child.getEventId());\\n\\t\\tretract(\$child);\\nend\",
355   \"services_calls\": {}
356 }"
357
358
359
360 REGKV='
361 {
362   "streams_subscribes": {},
363   "msb.hostname": "{{ msb_ip_addr }}",
364   "msb.uri": "/api/microservices/v1/services",
365   "streams_publishes": {},
366   "holmes.default.rule.volte.scenario1": "ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b$$$package org.onap.holmes.droolsRule;\n\nimport org.onap.holmes.common.dmaap.DmaapService;\nimport org.onap.holmes.common.api.stat.VesAlarm;\nimport org.onap.holmes.common.aai.CorrelationUtil;\nimport org.onap.holmes.common.dmaap.entity.PolicyMsg;\nimport org.onap.holmes.common.dropwizard.ioc.utils.ServiceLocatorHolder;\nimport org.onap.holmes.common.utils.DroolsLog;\n \n\nrule \"Relation_analysis_Rule\"\nsalience 200\nno-loop true\n    when\n        $root : VesAlarm(alarmIsCleared == 0,\n            $sourceId: sourceId, sourceId != null && !sourceId.equals(\"\"),\n\t\t\t$sourceName: sourceName, sourceName != null && !sourceName.equals(\"\"),\n\t\t\t$startEpochMicrosec: startEpochMicrosec,\n            eventName in (\"Fault_MultiCloud_VMFailure\"),\n            $eventId: eventId)\n        $child : VesAlarm( eventId != $eventId, parentId == null,\n            CorrelationUtil.getInstance().isTopologicallyRelated(sourceId, $sourceId, $sourceName),\n            eventName in (\"Fault_MME_eNodeB out of service alarm\"),\n            startEpochMicrosec < $startEpochMicrosec + 60000 && startEpochMicrosec > $startEpochMicrosec - 60000 )\n    then\n\t\tDroolsLog.printInfo(\"===========================================================\");\n\t\tDroolsLog.printInfo(\"Relation_analysis_Rule: rootId=\" + $root.getEventId() + \", childId=\" + $child.getEventId());\n\t\t$child.setParentId($root.getEventId());\n\t\tupdate($child);\n\t\t\nend\n\nrule \"root_has_child_handle_Rule\"\nsalience 150\nno-loop true\n\twhen\n\t\t$root : VesAlarm(alarmIsCleared == 0, rootFlag == 0, $eventId: eventId)\n\t\t$child : VesAlarm(eventId != $eventId, parentId == $eventId)\n\tthen\n\t\tDroolsLog.printInfo(\"===========================================================\");\n\t\tDroolsLog.printInfo(\"root_has_child_handle_Rule: rootId=\" + $root.getEventId() + \", childId=\" + $child.getEventId());\n\t\tDmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);\n\t\tPolicyMsg policyMsg = dmaapService.getPolicyMsg($root, $child, \"org.onap.holmes.droolsRule\");\n        dmaapService.publishPolicyMsg(policyMsg, \"unauthenticated.DCAE_CL_OUTPUT\");\n\t\t$root.setRootFlag(1);\n\t\tupdate($root);\nend\n\nrule \"root_no_child_handle_Rule\"\nsalience 100\nno-loop true\n    when\n        $root : VesAlarm(alarmIsCleared == 0, rootFlag == 0,\n            sourceId != null && !sourceId.equals(\"\"),\n\t\t\tsourceName != null && !sourceName.equals(\"\"),\n            eventName in (\"Fault_MultiCloud_VMFailure\"))\n    then\n\t\tDroolsLog.printInfo(\"===========================================================\");\n\t\tDroolsLog.printInfo(\"root_no_child_handle_Rule: rootId=\" + $root.getEventId());\n\t\tDmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);\n\t\tPolicyMsg policyMsg = dmaapService.getPolicyMsg($root, null, \"org.onap.holmes.droolsRule\");\n        dmaapService.publishPolicyMsg(policyMsg, \"unauthenticated.DCAE_CL_OUTPUT\");\n\t\t$root.setRootFlag(1);\n\t\tupdate($root);\nend\n\nrule \"root_cleared_handle_Rule\"\nsalience 100\nno-loop true\n    when\n        $root : VesAlarm(alarmIsCleared == 1, rootFlag == 1)\n    then\n\t\tDroolsLog.printInfo(\"===========================================================\");\n\t\tDroolsLog.printInfo(\"root_cleared_handle_Rule: rootId=\" + $root.getEventId());\n\t\tDmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);\n\t\tPolicyMsg policyMsg = dmaapService.getPolicyMsg($root, null, \"org.onap.holmes.droolsRule\");\n        dmaapService.publishPolicyMsg(policyMsg, \"unauthenticated.DCAE_CL_OUTPUT\");\n\t\tretract($root);\nend\n\nrule \"child_handle_Rule\"\nsalience 100\nno-loop true\n    when\n        $child : VesAlarm(alarmIsCleared == 1, rootFlag == 0)\n    then\n\t\tDroolsLog.printInfo(\"===========================================================\");\n\t\tDroolsLog.printInfo(\"child_handle_Rule: childId=\" + $child.getEventId());\n\t\tretract($child);\nend",
367   "services_calls": {}
368 }'
369 curl -v -X PUT -H "Content-Type: application/json" \
370 --data "${REGKV}" \
371 "http://${HOSTNAME_CONSUL}:8500/v1/kv/mvp-dcae-analytics-holmes-rule-management"
372
373
374
375 # Holmes engine management
376 REGKV='
377 {
378   "msb.hostname": "10.0.14.1",
379   "services_calls": {},
380   "msb.uri": "/api/microservices/v1/services",
381   "streams_publishes": {
382     "dcae_cl_out": {
383       "type": "message_router",
384       "dmaap_info": {
385         "topic_url": "http://{{ mr_ip_addr }}:3904/events/unauthenticated.DCAE_CL_OUTPUT"
386       }
387     }
388   },
389   "streams_subscribes": {
390     "ves_fault": {
391       "type": "message_router",
392       "dmaap_info": {
393         "topic_url": "http://{{ mr_ip_addr }}:3904/events/unauthenticated.SEC_FAULT_OUTPUT"
394       }
395     }
396   }
397 }'
398 curl -v -X PUT -H "Content-Type: application/json" \
399 --data "${REGKV}" \
400 "http://${HOSTNAME_CONSUL}:8500/v1/kv/mvp-dcae-analytics-holmes-engine-management"
401
402
403 #curl  http://localhost:8500/v1/kv/config_binding_service |jq .[0].Value |sed -e 's/\"//g' |base64 --decode
404
405
406
407 # TCA
408 REGKV='
409 {
410   "thresholdCalculatorFlowletInstances": "2",
411   "tcaVESMessageStatusTableTTLSeconds": "86400",
412   "tcaVESMessageStatusTableName": "TCAVESMessageStatusTable",
413   "tcaVESAlertsTableTTLSeconds": "1728000",
414   "tcaVESAlertsTableName": "TCAVESAlertsTable",
415   "tcaSubscriberOutputStreamName": "TCASubscriberOutputStream",
416   "tcaAlertsAbatementTableTTLSeconds": "1728000",
417   "tcaAlertsAbatementTableName": "TCAAlertsAbatementTable",
418   "streams_subscribes": {},
419   "streams_publishes": {},
420   "services_calls": {},
421   "appName": "dcae-tca",
422   "appDescription": "DCAE Analytics Threshold Crossing Alert Application"
423 }'
424 curl -v -X PUT -H "Content-Type: application/json" \
425 --data "${REGKV}" \
426 "http://${HOSTNAME_CONSUL}:8500/v1/kv/mvp-dcaegen2-analytics-tca"
427
428
429 # TCA pref
430 REGKV='{
431   "tca_policy": "{\"domain\":\"measurementsForVfScaling\",\"metricsPerEventName\":[{\"eventName\":\"vFirewallBroadcastPackets\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"LESS_OR_EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ONSET\"},{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":700,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"vLoadBalancer\",\"controlLoopSchemaType\":\"VM\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"Measurement_vGMUX\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ABATED\"},{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"GREATER\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]}]}",
432   "subscriberTopicName": "unauthenticated.VES_MEASUREMENT_OUTPUT",
433   "subscriberTimeoutMS": "-1",
434   "subscriberProtocol": "http",
435   "subscriberPollingInterval": "30000",
436   "subscriberMessageLimit": "-1",
437   "subscriberHostPort": "3904",
438   "subscriberHostName":"{{ mr_ip_addr }}",
439   "subscriberContentType": "application/json",
440   "subscriberConsumerId": "c12",
441   "subscriberConsumerGroup": "OpenDCAE-c12",
442   "publisherTopicName": "unauthenticated.DCAE_CL_OUTPUT",
443   "publisherProtocol": "http",
444   "publisherPollingInterval": "20000",
445   "publisherMaxRecoveryQueueSize": "100000",
446   "publisherMaxBatchSize": "1",
447   "publisherHostPort": "3904",
448   "publisherHostName": "{{ mr_ip_addr }}",
449   "publisherContentType": "application/json",
450   "enableAlertCEFFormat": "false",
451   "enableAAIEnrichment": true,
452   "aaiVNFEnrichmentAPIPath": "/aai/v11/network/generic-vnfs/generic-vnf",
453   "aaiVMEnrichmentAPIPath": "/aai/v11/search/nodes-query",
454   "aaiEnrichmentUserPassword": "DCAE",
455   "aaiEnrichmentUserName": "DCAE",
456   "aaiEnrichmentProtocol": "https",
457   "aaiEnrichmentPortNumber": "8443",
458   "aaiEnrichmentIgnoreSSLCertificateErrors": "true",
459   "aaiEnrichmentHost":"{{ aai1_ip_addr }}",
460   "enableRedisCaching":false
461 }'
462 curl -v -X PUT -H "Content-Type: application/json" \
463 --data "${REGKV}" \
464 "http://${HOSTNAME_CONSUL}:8500/v1/kv/mvp-dcaegen2-analytics-tca:preferences"
465
466
467
468 # SNMP Trap Collector
469 SERVICENAME="${SRVCNAME_STATIC_SNMPTRAP}"
470 REGKV='{
471   "files": {
472     "roll_frequency": "day",
473     "data_dir": "data",
474     "arriving_traps_log": "snmptrapd_arriving_traps.log",
475     "minimum_severity_to_log": 2,
476     "traps_stats_log": "snmptrapd_stats.csv",
477     "perm_status_file": "snmptrapd_status.log",
478     "pid_dir": "tmp",
479     "eelf_audit": "audit.log",
480     "log_dir": "logs",
481     "eelf_metrics": "metrics.log",
482     "eelf_base_dir": "/opt/app/snmptrap/logs",
483     "runtime_base_dir": "/opt/app/snmptrap",
484     "eelf_error": "error.log",
485     "eelf_debug": "debug.log",
486     "snmptrapd_diag": "snmptrapd_prog_diag.log"
487   },
488   "publisher": {
489     "http_milliseconds_between_retries": 750,
490     "max_milliseconds_between_publishes": 10000,
491     "max_traps_between_publishes": 10,
492     "http_retries": 3,
493     "http_primary_publisher": "true",
494     "http_milliseconds_timeout": 1500,
495     "http_peer_publisher": "unavailable"
496   },
497   "snmptrapd": {
498     "version": "1.4.0",
499     "title": "Collector for receiving SNMP traps and publishing to DMAAP/MR"
500   },
501   "cache": {
502     "dns_cache_ttl_seconds": 60
503   },
504   "sw_interval_in_seconds": 60,
505   "streams_publishes": {
506     "sec_fault_unsecure": {
507       "type": "message_router",
508       "dmaap_info": {
509         "topic_url": "http://{{ mr_ip_addr }}:3904/events/unauthenticated.ONAP-COLLECTOR-SNMPTRAP"
510       }
511     }
512   },
513   "StormWatchPolicy": "",
514   "services_calls": {},
515   "protocols": {
516     "ipv4_interface": "0.0.0.0",
517     "ipv4_port": 6162,
518     "ipv6_interface": "::1",
519     "ipv6_port": 6162
520   }
521 }'
522 curl -v -X PUT -H "Content-Type: application/json" \
523 --data "${REGKV}" \
524 "http://${HOSTNAME_CONSUL}:8500/v1/kv/${SERVICENAME}"
525
526
527
528 # hv-ves collector
529 SERVICENAME="${SRVCNAME_STATIC_HVVES}"
530 REGKV='{
531   "dmaap.kafkaBootstrapServers": "{{ mr_ip_addr }}:9092",
532   "collector.routing": {
533     "fromDomain": "HVMEAS",
534     "toTopic": "HV_VES_MEASUREMENTS"
535   }
536 }'
537 curl -v -X PUT -H "Content-Type: application/json" \
538 --data "${REGKV}" \
539 "http://${HOSTNAME_CONSUL}:8500/v1/kv/${SERVICENAME}"
540
541
542 # data file collector
543 SERVICENAME="${SRVCNAME_STATIC_DFC}"
544  REGKV='{
545   "dmaap.dmaapConsumerConfiguration.dmaapHostName": "{{ mr_ip_addr }}",
546   "dmaap.dmaapConsumerConfiguration.dmaapPortNumber": 2222,
547   "dmaap.dmaapConsumerConfiguration.dmaapTopicName": "/events/unauthenticated.VES_NOTIFICATION_OUTPUT",
548   "dmaap.dmaapConsumerConfiguration.dmaapProtocol": "http",
549   "dmaap.dmaapConsumerConfiguration.dmaapUserName": "",
550   "dmaap.dmaapConsumerConfiguration.dmaapUserPassword": "",
551   "dmaap.dmaapConsumerConfiguration.dmaapContentType": "application/json",
552   "dmaap.dmaapConsumerConfiguration.consumerId": "C12",
553   "dmaap.dmaapConsumerConfiguration.consumerGroup": "OpenDcae-c12",
554   "dmaap.dmaapConsumerConfiguration.timeoutMs": -1,
555   "dmaap.dmaapConsumerConfiguration.messageLimit": 1,
556   "dmaap.dmaapProducerConfiguration.dmaapHostName": "{{ mr_ip_addr }}",
557   "dmaap.dmaapProducerConfiguration.dmaapPortNumber": 3907,
558   "dmaap.dmaapProducerConfiguration.dmaapTopicName": "publish",
559   "dmaap.dmaapProducerConfiguration.dmaapProtocol": "https",
560   "dmaap.dmaapProducerConfiguration.dmaapUserName": "dradmin",
561   "dmaap.dmaapProducerConfiguration.dmaapUserPassword": "dradmin",
562   "dmaap.dmaapProducerConfiguration.dmaapContentType": "application/octet-stream",
563   "ftp.ftpesConfiguration.keyCert": "config/ftpKey.jks",
564   "ftp.ftpesConfiguration.keyPassword": "secret",
565   "ftp.ftpesConfiguration.trustedCA": "config/cacerts",
566   "ftp.ftpesConfiguration.trustedCAPassword": "secret"
567  }'
568 curl -v -X PUT -H "Content-Type: application/json" \
569 --data "${REGKV}" \
570 "http://${HOSTNAME_CONSUL}:8500/v1/kv/${SERVICENAME}"
571
572
573 # PNF Registration Handler
574 SERVICENAME="${SRVCNAME_STATIC_PRH}"
575 REGKV='{
576   "dmaap.dmaapProducerConfiguration.dmaapTopicName": "/events/unauthenticated.PNF_READY",
577   "dmaap.dmaapConsumerConfiguration.dmaapHostName": "{{ mr_ip_addr }}",
578   "aai.aaiClientConfiguration.aaiPnfPath": "/network/pnfs/pnf",
579   "aai.aaiClientConfiguration.aaiUserPassword": "AAI",
580   "dmaap.dmaapConsumerConfiguration.dmaapUserName": "admin",
581   "aai.aaiClientConfiguration.aaiBasePath": "/aai/v12",
582   "dmaap.dmaapConsumerConfiguration.timeoutMs": -1,
583   "dmaap.dmaapProducerConfiguration.dmaapPortNumber": 3904,
584   "aai.aaiClientConfiguration.aaiHost": "{{ aai1_ip_addr }}",
585   "dmaap.dmaapConsumerConfiguration.dmaapUserPassword": "admin",
586   "dmaap.dmaapProducerConfiguration.dmaapProtocol": "http",
587   "aai.aaiClientConfiguration.aaiIgnoreSslCertificateErrors": true,
588   "dmaap.dmaapProducerConfiguration.dmaapContentType": "application/json",
589   "dmaap.dmaapConsumerConfiguration.dmaapTopicName": "/events/unauthenticated.VES_PNFREG_OUTPUT",
590   "dmaap.dmaapConsumerConfiguration.dmaapPortNumber": 3904,
591   "dmaap.dmaapConsumerConfiguration.dmaapContentType": "application/json",
592   "dmaap.dmaapConsumerConfiguration.messageLimit": -1,
593   "dmaap.dmaapConsumerConfiguration.dmaapProtocol": "http",
594   "aai.aaiClientConfiguration.aaiUserName": "AAI",
595   "dmaap.dmaapConsumerConfiguration.consumerId": "c12",
596   "dmaap.dmaapProducerConfiguration.dmaapHostName": "{{ mr_ip_addr }}",
597   "aai.aaiClientConfiguration.aaiHostPortNumber": 8443,
598   "dmaap.dmaapConsumerConfiguration.consumerGroup": "OpenDCAE-c12",
599   "aai.aaiClientConfiguration.aaiProtocol": "https",
600   "dmaap.dmaapProducerConfiguration.dmaapUserName": "admin",
601   "dmaap.dmaapProducerConfiguration.dmaapUserPassword": "admin"
602 }'
603 curl -v -X PUT -H "Content-Type: application/json" \
604 --data "${REGKV}" \
605 "http://${HOSTNAME_CONSUL}:8500/v1/kv/${SERVICENAME}"