PrakashH | 3bcb00f | 2019-01-22 08:19:43 +0000 | [diff] [blame] | 1 | .. This work is licensed under a Creative Commons Attribution 4.0 International License.
|
| 2 | .. http://creativecommons.org/licenses/by/4.0
|
| 3 |
|
PrakashH | 3bcb00f | 2019-01-22 08:19:43 +0000 | [diff] [blame] | 4 | Build and Setup procedure
|
| 5 | =========================
|
| 6 |
|
| 7 | ONAP Repository
|
| 8 | ---------------
|
| 9 |
|
| 10 | Use the below repository for Heartbeat Microservice.
|
| 11 |
|
| 12 | https://gerrit.onap.org/r/#/admin/projects/dcaegen2/services/heartbeat
|
| 13 |
|
| 14 | POD 25 access
|
| 15 | -------------
|
| 16 |
|
| 17 | To run heartbeat Micro Service in development environment, POD25
|
| 18 | access is required. Please get the access and install Openvpn.
|
| 19 |
|
| 20 | Connect to POD25 setup using Openvpn and the credentials obtained.
|
| 21 |
|
| 22 | Docker build procedure
|
| 23 | ----------------------
|
| 24 |
|
| 25 | Clone the code using below command
|
PrakashH | 1e19c18 | 2019-01-22 11:24:06 +0000 | [diff] [blame] | 26 |
|
| 27 | ::
|
PrakashH | 3bcb00f | 2019-01-22 08:19:43 +0000 | [diff] [blame] | 28 | git clone https://gerrit.onap.org/r/dcaegen2/services/heartbeat
|
| 29 |
|
| 30 | give executable permission to mvn-phase-script.sh if not there
|
| 31 | already
|
PrakashH | 3bcb00f | 2019-01-22 08:19:43 +0000 | [diff] [blame] | 32 |
|
PrakashH | 1e19c18 | 2019-01-22 11:24:06 +0000 | [diff] [blame] | 33 | ::
|
PrakashH | 3bcb00f | 2019-01-22 08:19:43 +0000 | [diff] [blame] | 34 | chmod +x mvn-phase-script.sh
|
| 35 |
|
| 36 | **Setting up the postgres DB, group/consumer IDs, CBS download and
|
| 37 | CBS 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 |
|
PrakashH | 1e19c18 | 2019-01-22 11:24:06 +0000 | [diff] [blame] | 63 | ::
|
| 64 |
|
PrakashH | 3bcb00f | 2019-01-22 08:19:43 +0000 | [diff] [blame] | 65 | 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
|
PrakashH | 1e19c18 | 2019-01-22 11:24:06 +0000 | [diff] [blame] | 76 |
|
| 77 | ::
|
PrakashH | 3bcb00f | 2019-01-22 08:19:43 +0000 | [diff] [blame] | 78 |
|
| 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 |
|
PrakashH | 1e19c18 | 2019-01-22 11:24:06 +0000 | [diff] [blame] | 159 | ::
|
PrakashH | 3bcb00f | 2019-01-22 08:19:43 +0000 | [diff] [blame] | 160 |
|
| 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 |
|
PrakashH | 1e19c18 | 2019-01-22 11:24:06 +0000 | [diff] [blame] | 166 | ::
|
PrakashH | 3bcb00f | 2019-01-22 08:19:43 +0000 | [diff] [blame] | 167 | sudo Docker images |grep heartbeat.test1
|
| 168 |
|
| 169 | **Run the Docker using below command which uses the environment file
|
| 170 | mentioned in the above section.**
|
| 171 |
|
PrakashH | 1e19c18 | 2019-01-22 11:24:06 +0000 | [diff] [blame] | 172 | ::
|
PrakashH | 3bcb00f | 2019-01-22 08:19:43 +0000 | [diff] [blame] | 173 | sudo Docker run -d --name hb1 --env-file env.list
|
| 174 | heartbeat.test1:latest
|
| 175 |
|
| 176 | To check the logs, run below command
|
| 177 |
|
PrakashH | 1e19c18 | 2019-01-22 11:24:06 +0000 | [diff] [blame] | 178 | ::
|
PrakashH | 3bcb00f | 2019-01-22 08:19:43 +0000 | [diff] [blame] | 179 | sudo Docker logs -f hb1
|
| 180 |
|
| 181 | **To stop the Docker run**
|
| 182 |
|
| 183 | Get the Docker container ID from below command
|
| 184 |
|
PrakashH | 1e19c18 | 2019-01-22 11:24:06 +0000 | [diff] [blame] | 185 | ::
|
PrakashH | 3bcb00f | 2019-01-22 08:19:43 +0000 | [diff] [blame] | 186 |
|
| 187 | sudo Docker ps -a \| grep heartbeat.test1
|
| 188 |
|
| 189 | Run below commands to stop the Docker run
|
| 190 |
|
PrakashH | 1e19c18 | 2019-01-22 11:24:06 +0000 | [diff] [blame] | 191 | ::
|
PrakashH | 3bcb00f | 2019-01-22 08:19:43 +0000 | [diff] [blame] | 192 |
|
| 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 |
|
PrakashH | 1e19c18 | 2019-01-22 11:24:06 +0000 | [diff] [blame] | 200 | ::
|
PrakashH | 3bcb00f | 2019-01-22 08:19:43 +0000 | [diff] [blame] | 201 | 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.
|
PrakashH | 1e19c18 | 2019-01-22 11:24:06 +0000 | [diff] [blame] | 208 |
|
| 209 | ::
|
PrakashH | 3bcb00f | 2019-01-22 08:19:43 +0000 | [diff] [blame] | 210 | sudo apt install libxml-xpath-perl
|