blob: 6ab6a17876db038c56c09dcfa63d76b92dafdb2b [file] [log] [blame]
PrakashH3bcb00f2019-01-22 08:19:43 +00001.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2.. http://creativecommons.org/licenses/by/4.0
3
PrakashH3bcb00f2019-01-22 08:19:43 +00004Build and Setup procedure
5=========================
6
7ONAP Repository
8---------------
9
10Use the below repository for Heartbeat Microservice.
11
12 https://gerrit.onap.org/r/#/admin/projects/dcaegen2/services/heartbeat
13
14POD 25 access
15-------------
16
17To run heartbeat Micro Service in development environment, POD25
18access is required. Please get the access and install Openvpn.
19
20Connect to POD25 setup using Openvpn and the credentials obtained.
21
22Docker build procedure
23----------------------
24
25Clone the code using below command
PrakashH1e19c182019-01-22 11:24:06 +000026
27::
PrakashH3bcb00f2019-01-22 08:19:43 +000028 git clone https://gerrit.onap.org/r/dcaegen2/services/heartbeat
29
30give executable permission to mvn-phase-script.sh if not there
31already
PrakashH3bcb00f2019-01-22 08:19:43 +000032
PrakashH1e19c182019-01-22 11:24:06 +000033::
PrakashH3bcb00f2019-01-22 08:19:43 +000034 chmod +x mvn-phase-script.sh
35
36**Setting up the postgres DB, group/consumer IDs, CBS download and
37CBS polling. The following environment variables are to be set.**
38
39 For postgres and CBS download, the environment setting file to be
40 passed while running the Docker. The file would contain following
41 parameters. The sample values are shown for reference.
42
43 ::
44 pg_ipAddress=10.0.4.1
45 pg_portNum=5432
46 pg_userName=postgres
47 pg_passwd=abc
48 #Below parameters for CBS download
49 SERVICE_NAME=mvp-dcaegen2-heartbeat-static
50 CONSUL_HOST=10.12.6.50
51 HOSTNAME=mvp-dcaegen2-heartbeat-static
52 #Below parameter for heartbeat worker process to receive message
53 groupID=group1
54 consumerID=1
55
56 If the postgres parameters are not there in environment setting file,
57 then it takes the values from miss_htbt_service/config/hbproperties.yaml
58 file. Make sure that postgres running in the machine where pg_ipAddress
59 parameter is mentioned.
60
61 Run below netstat command to check postgres port number and IP address are fine.
62
PrakashH1e19c182019-01-22 11:24:06 +000063::
64
PrakashH3bcb00f2019-01-22 08:19:43 +000065 netstat -ant
66
67 If CBS parameters are not there in the environment setting file, then
68 local config file (etc/config.json) is considered as a default
69 configuration file.
70
71 For CBS polling CBS_polling_allowed & CBS_polling_interval to be set
72 appropriately in miss_htbt_service/config/hbproperties.yaml file
73
74 The sample values in miss_htbt_service/config/hbproperties.yaml file
75 are as follows
PrakashH1e19c182019-01-22 11:24:06 +000076
77::
PrakashH3bcb00f2019-01-22 08:19:43 +000078
79 pg_ipAddress: 10.0.4.1
80 pg_portNum: 5432
81 pg_userName: postgres
82 pg_passwd: postgres
83 pg_dbName: hb_vnf
84 CBS_polling_allowed: True
85 CBS_polling_interval: 300
86
87 PS: Change the groupID and consumerID in the environment accordingly
88 for each HB instance so that HB worker process receive the HB event
89 correctly. Usually groupID remains the same for all instance of HB
90 where as consumerID would be changed for each instance of HB Micro
91 service. If groupID and consumerID is not provided, then it takes
92 DefaultGroup and 1 respectively.
93
94**Setting CBS configuration parameters using the consule KV URL.**
95
96 The sample consul KV is as below.
97 ::
98 http://10.12.6.50:8500/ui/#/dc1/kv/mvp-dcaegen2-heartbeat-static
99
100 Go to the above link and click on KEY/VALUE tab
101
102 Click on mvp-dcaegen2-heartbeat-static
103
104 Copy the configuration in the box provided and click on update.
105
106 The sample configuration is as below
107
108 .. code-block:: json
109
110 {
111 "heartbeat_config": {
112 "vnfs": [{
113 "eventName": "Heartbeat_S",
114 "heartbeatcountmissed": 3,
115 "heartbeatinterval": 60,
116 "closedLoopControlName": "ControlLoopEvent1",
117 "policyVersion": "1.0.0.5",
118 "policyName": "vFireWall",
119 "policyScope": "resource=sampleResource,type=sampletype,CLName=sampleCLName",
120 "target_type": "VM",
121 "target": "genVnfName",
122 "version": "2.0"
123 },
124 {
125 "eventName": "Heartbeat_vFW",
126 "heartbeatcountmissed": 3,
127 "heartbeatinterval": 60,
128 "closedLoopControlName": "ControlLoopEvent1",
129 "policyVersion": "1.0.0.5",
130 "policyName": "vFireWall",
131 "policyScope": "resource=sampleResource,type=sampletype,CLName=sampleCLName",
132 "target_type": "VNF",
133 "target": "genVnfName",
134 "version": "2.0"
135 }
136 ]
137 },
138
139 "streams_publishes": {
140 "ves_heartbeat": {
141 "dmaap_info": {
142 "topic_url": "http://10.12.5.252:3904/events/unauthenticated.DCAE_CL_OUTPUT/"
143 },
144 "type": "message_router"
145 }
146 },
147 "streams_subscribes": {
148 "ves_heartbeat": {
149 "dmaap_info": {
150 "topic_url": "http://10.12.5.252:3904/events/unauthenticated.SEC_HEARTBEAT_INPUT/"
151 },
152 "type": "message_router"
153 }
154 }
155 }
156
157**Build the Docker using below command with a image name**
158
PrakashH1e19c182019-01-22 11:24:06 +0000159::
PrakashH3bcb00f2019-01-22 08:19:43 +0000160
161 sudo Docker build --no-cache --network=host -f ./Dockerfile -t
162 heartbeat.test1:latest .
163
164 To check whether image is built or not, run below command
165
PrakashH1e19c182019-01-22 11:24:06 +0000166::
PrakashH3bcb00f2019-01-22 08:19:43 +0000167 sudo Docker images |grep heartbeat.test1
168
169**Run the Docker using below command which uses the environment file
170mentioned in the above section.**
171
PrakashH1e19c182019-01-22 11:24:06 +0000172::
PrakashH3bcb00f2019-01-22 08:19:43 +0000173 sudo Docker run -d --name hb1 --env-file env.list
174 heartbeat.test1:latest
175
176 To check the logs, run below command
177
PrakashH1e19c182019-01-22 11:24:06 +0000178::
PrakashH3bcb00f2019-01-22 08:19:43 +0000179 sudo Docker logs -f hb1
180
181**To stop the Docker run**
182
183 Get the Docker container ID from below command
184
PrakashH1e19c182019-01-22 11:24:06 +0000185::
PrakashH3bcb00f2019-01-22 08:19:43 +0000186
187 sudo Docker ps -a \| grep heartbeat.test1
188
189 Run below commands to stop the Docker run
190
PrakashH1e19c182019-01-22 11:24:06 +0000191::
PrakashH3bcb00f2019-01-22 08:19:43 +0000192
193 sudo Docker stop <Docker container ID)
194 sudo Docker rm -f hb1
195
196**Initiate the maven build**
197
198 To run the maven build, execute any one of them.
199
PrakashH1e19c182019-01-22 11:24:06 +0000200::
PrakashH3bcb00f2019-01-22 08:19:43 +0000201 sudo mvn -s settings.xml deploy
202 OR
203 sudo mvn -s settings.xml -X deploy
204
205 If there is a libxml-xpath related issue, then install the
206 libxml-xpath as below. If the issue is something else, follow the
207 link given as part of the build failure.
PrakashH1e19c182019-01-22 11:24:06 +0000208
209::
PrakashH3bcb00f2019-01-22 08:19:43 +0000210 sudo apt install libxml-xpath-perl