diff options
-rw-r--r-- | heat/R2MVP/docker-compose-1.yaml | 33 | ||||
-rw-r--r-- | heat/R2MVP/docker-compose-2.yaml (renamed from heat/R2MVP/docker-compose.yaml) | 54 | ||||
-rw-r--r-- | tca-cdap-container/Dockerfile | 9 | ||||
-rw-r--r-- | tca-cdap-container/README.txt | 5 | ||||
-rwxr-xr-x | tca-cdap-container/get-tca.sh | 7 | ||||
-rw-r--r-- | tca-cdap-container/host.aliases | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | tca-cdap-container/restart.sh | 63 | ||||
-rw-r--r-- | tca-cdap-container/tca_app_config.json | 2 | ||||
-rw-r--r-- | tca-cdap-container/tca_app_preferences.json | 24 |
9 files changed, 115 insertions, 83 deletions
diff --git a/heat/R2MVP/docker-compose-1.yaml b/heat/R2MVP/docker-compose-1.yaml new file mode 100644 index 0000000..6d5ed67 --- /dev/null +++ b/heat/R2MVP/docker-compose-1.yaml @@ -0,0 +1,33 @@ +version: '2.1' +services: + db: + image: postgres:9.5 + container_name: "db" + hostname: "db" + ports: + - "5432:5432" + environment: + - POSTGRES_USER=holmes + - POSTGRES_PASSWORD=holmespwd + + consul: + image: consul:0.8.3 + container_name: "consul" + hostname: "consul" + ports: + - "8400:8400" + - "8500:8500" + - "8600:8600" + command: "agent -server -bootstrap-expect 1 -client 0.0.0.0" + + config_binding_service: + image: {{ nexus_docker_repo }}/onap/org.onap.dcaegen2.platform.configbinding:v1.2.0 + container_name: "config_binding_service" + hostname: "config_binding_service" + environment: + - CONSUL_HOST="consul" + ports: + - "10000:10000" + depends_on: + - consul + diff --git a/heat/R2MVP/docker-compose.yaml b/heat/R2MVP/docker-compose-2.yaml index 5413a5d..57bdd3f 100644 --- a/heat/R2MVP/docker-compose.yaml +++ b/heat/R2MVP/docker-compose-2.yaml @@ -1,34 +1,5 @@ -version: '2' +version: '2.1' services: - db: - image: postgres:9.5 - container_name: "db" - hostname: "db" - ports: - - "5432:5432" - environment: - POSTGRES_USER: "holmes" - POSTGRES_PASSWORD: "holmespwd" - - consul: - image: consul:0.8.3 - container_name: "consul" - hostname: "consul" - ports: - - "8400:8400" - - "8500:8500" - - "8600:8600" - command: "-server -bootstrap-expect 1" - - config_binding_service: - image: {{ nexus_docker_repo }}/onap/org.onap.dcaegen2.platform.configbinding:v1.2.0 - container_name: "config_binding_service" - hostname: "config_binding_service" - environment: - - CONSUL_HOST: consul - expose: - - "10000:10000" - ves: image: {{ nexus_docker_repo }}/onap/org.onap.dcaegen2.collectors.ves.vescollector:1.2.0 container_name: "ves" @@ -40,7 +11,7 @@ services: - CONFIG_BINDING_SERVICE=config_binding_service - SERVICE_NAME=ves - HOSTNAME=ves - expose: + ports: - "8080:8080" - "8443:8443" @@ -50,20 +21,27 @@ services: hostname: tca environment: - DMAAPHOST={{ mr_ip_addr }} + - DMAAPPORT=3904 + - DMAAPPUBTOPIC=unauthenticated.TCA_EVENT_OUTPUT + - DMAAPSUBTOPIC=unauthenticated.SEC_MEASUREMENT_OUTPUT + - AAIHOST={{ aai1_ip_addr }} + - AAIPORT=8443 - CONSUL_HOST=consul - CONSUL_PORT=8500 - CBS_HOST=cbs - CBS_PORT=10000 - SERVICE_NAME=tca - CONFIG_BINDING_SERVICE=config_binding_service - expose: + # set the parameter below to enable REDIS caching. + #- REDISHOSTPORT=redis-cluster:6379 + ports: - "11011:11011" - "11015:11015" holmes-engine: image: {{ nexus_docker_repo }}/onap/holmes/engine-management:latest - conatiner_name: he - host_name: he + container_name: he + hostname: he environment: - URL_JDBC=db:5432 - JDBC_USERNAME=holmes @@ -72,13 +50,13 @@ services: - CONSUL_HOST=consul - CONSUL_PORT=8500 - HOSTNAME=he - expose: + ports: - "9102:9102" holmes-rule: image: {{ nexus_docker_repo }}/onap/holmes/rule-management:latest - conatiner_name: hr - host_name: hr + container_name: hr + hostname: hr environment: - URL_JDBC=db:5432 - JDBC_USERNAME=holmes @@ -87,5 +65,5 @@ services: - CONSUL_HOST=consul - CONSUL_PORT=8500 - HOSTNAME=hr - expose: + ports: - "9101:9101" diff --git a/tca-cdap-container/Dockerfile b/tca-cdap-container/Dockerfile index 2e4f8ca..158c95a 100644 --- a/tca-cdap-container/Dockerfile +++ b/tca-cdap-container/Dockerfile @@ -17,18 +17,17 @@ FROM caskdata/cdap-standalone:4.1.2 RUN apt-get update -RUN apt-get install -y netcat jq wget +RUN apt-get install -y netcat jq wget vim iputils-ping COPY get-tca.sh /opt/tca/get-tca.sh RUN /opt/tca/get-tca.sh COPY tca_app_config.json /opt/tca/tca_app_config.json COPY tca_app_preferences.json /opt/tca/tca_app_preferences.json COPY restart.sh /opt/tca/restart.sh -COPY host.aliases /etc/host.aliases - -RUN echo "export HOSTALIASES=/etc/host.aliases" >> /etc/profile RUN chmod 755 /opt/tca/restart.sh -ENV HOSTALIASES /etc/host.aliases +#COPY host.aliases /etc/host.aliases +#RUN echo "export HOSTALIASES=/etc/host.aliases" >> /etc/profile +#ENV HOSTALIASES /etc/host.aliases EXPOSE 11011 EXPOSE 11015 diff --git a/tca-cdap-container/README.txt b/tca-cdap-container/README.txt new file mode 100644 index 0000000..62a7a09 --- /dev/null +++ b/tca-cdap-container/README.txt @@ -0,0 +1,5 @@ +Note: + +Although typically Java jar artifacts have SNAPSHOT version as a.b.c-SNAPSHOT, internally CDAP +identifies the application as a.b.c.SNAPSHOT. Thus, in app_config JSON we must refer to the +application as a.b.c.SNAPSHOT. Otherwise we will have artifact not found error" diff --git a/tca-cdap-container/get-tca.sh b/tca-cdap-container/get-tca.sh index 2a9cf62..66038b1 100755 --- a/tca-cdap-container/get-tca.sh +++ b/tca-cdap-container/get-tca.sh @@ -1,16 +1,17 @@ #!/bin/bash +ARTIFACTPATH=${1:-/opt/tca/} PROTO='https' NEXUSREPO='nexus.onap.org' REPO='snapshots' GROUPID='org.onap.dcaegen2.analytics.tca' -ARTIFACTID='dcae-analytics-tca' +ARTIFACTID='dcae-analytics-cdap-tca' VERSION='2.2.0-SNAPSHOT' URL="${PROTO}://${NEXUSREPO}/service/local/repositories/${REPO}/content/${GROUPID//.//}/${ARTIFACTID}/${VERSION}/maven-metadata.xml" VT=$(wget --no-check-certificate -O- $URL | grep -m 1 \<value\> | sed -e 's/<value>\(.*\)<\/value>/\1/' | sed -e 's/ //g') URL="${PROTO}://${NEXUSREPO}/service/local/repositories/${REPO}/content/${GROUPID//.//}/${ARTIFACTID}/${VERSION}/${ARTIFACTID}-${VT}.jar" -#wget --no-check-certificate "${URL}" -O "/opt/tca/${ARTIFACTID}-${VERSION%-SNAPSHOT}.jar" -wget --no-check-certificate "${URL}" -O "${ARTIFACTID}-${VERSION%-SNAPSHOT}.jar" +#wget --no-check-certificate "${URL}" -O "${ARTIFACTPATH}${ARTIFACTID}-${VERSION%-SNAPSHOT}.jar" +wget --no-check-certificate "${URL}" -O "${ARTIFACTPATH}${ARTIFACTID}.${VERSION}.jar" diff --git a/tca-cdap-container/host.aliases b/tca-cdap-container/host.aliases deleted file mode 100644 index 6b0b785..0000000 --- a/tca-cdap-container/host.aliases +++ /dev/null @@ -1 +0,0 @@ -consul consul-server.onap-consul.svc.cluster.local diff --git a/tca-cdap-container/restart.sh b/tca-cdap-container/restart.sh index c9c1d56..bc15cac 100644..100755 --- a/tca-cdap-container/restart.sh +++ b/tca-cdap-container/restart.sh @@ -23,9 +23,9 @@ TCA_NAMESPACE='cdap_tca_hi_lo' TCA_APPNAME='dcae-tca' TCA_ARTIFACT='dcae-analytics-cdap-tca' -TCA_ARTIFACT_VERSION='2.2.0' +TCA_ARTIFACT_VERSION='2.2.0-SNAPSHOT' TCA_FILE_PATH='/opt/tca' -TCA_JAR="${TCA_FILE_PATH}/${TCA_ARTIFACT}-${TCA_ARTIFACT_VERSION}.jar" +TCA_JAR="${TCA_FILE_PATH}/${TCA_ARTIFACT}.${TCA_ARTIFACT_VERSION}.jar" TCA_APP_CONF="${TCA_FILE_PATH}/tca_app_config.json" TCA_CONF="${TCA_FILE_PATH}/tca_config.json" TCA_PREF="${TCA_FILE_PATH}/tca_app_preferences.json" @@ -36,10 +36,39 @@ TCA_PREF_TEMP='/tmp/tca_preferences.json' TCA_PATH_APP="${CDAP_HOST}:${CDAP_PORT}/v3/namespaces/${TCA_NAMESPACE}/apps/${TCA_APPNAME}" TCA_PATH_ARTIFACT="${CDAP_HOST}:${CDAP_PORT}/v3/namespaces/${TCA_NAMESPACE}/artifacts" -if [ -z "$CONSUL_HOST" ]; then CONSUL_HOST='consul'; fi -if [ -z "$CONSUL_PORT" ]; then CONSUL_PORT='8500'; fi -if [ -z "$CONFIG_BINDING_SERVICE" ]; then CONFIG_BINDING_SERVICE='config_binding_service'; fi +CONSUL_HOST=${CONSU_HOST:-consul} +CONSUL_PORT=${CONSU_PORT:-8500} +CONFIG_BINDING_SERVICE=${CONFIG_BINDING_SERVICE:-config_binding_service} + +CBS_SERVICE_NAME=${CONFIG_BINDING_SERVICE} + +CBS_HOST=$(curl -s "${CONSUL_HOST}:${CONSUL_PORT}/v1/catalog/service/${CBS_SERVICE_NAME}" |jq .[0].ServiceAddress |sed -e 's/\"//g') +CBS_PORT=$(curl -s "${CONSUL_HOST}:${CONSUL_PORT}/v1/catalog/service/${CBS_SERVICE_NAME}" |jq .[0].ServicePort |sed -e 's/\"//g') +CBS_HOST=${CBS_HOST:-config_binding_service} +CBS_PORT=${CBS_PORT:-10000} + +MY_NAME=${SERVICE_NAME:-tca} + +echo "TCA environment: I am ${MY_NAME}, consul at ${CONSUL_HOST}:${CONSUL_PORT}, CBS at ${CBS_HOST}:${CBS_PORT}, service name ${CBS_SERVICE_NAME}" + + +echo "Generting preference file" +sed -i 's/{{DMAAPHOST}}/'"${DMAAPHOST}"'/g' ${TCA_PREF} +sed -i 's/{{DMAAPPORT}}/'"${DMAAPPORT}"'/g' ${TCA_PREF} +sed -i 's/{{DMAAPPUBTOPIC}}/'"${DMAAPPUBTOPIC}"'/g' ${TCA_PREF} +sed -i 's/{{DMAAPSUBTOPIC}}/'"${DMAAPSUBTOPIC}"'/g' ${TCA_PREF} +sed -i 's/{{DMAAPSUBGROUP}}/OpenDCAEc12/g' ${TCA_PREF} +sed -i 's/{{DMAAPSUBID}}/c12/g' ${TCA_PREF} +sed -i 's/{{AAIHOST}}/'"${AAIHOST}"'/g' ${TCA_PREF} +sed -i 's/{{AAIPORT}}/'"${AAIPORT}"'/g' ${TCA_PREF} +if [ -z $REDISHOSTPORT ]; then + sed -i 's/{{REDISHOSTPORT}}/NONE/g' ${TCA_PREF} + sed -i 's/{{REDISCACHING}}/false/g' ${TCA_PREF} +else + sed -i 's/{{REDISHOSTPORT}}/'"${REDISHOSTPORT}"'/g' ${TCA_PREF} + sed -i 's/{{REDISCACHING}}/true/g' ${TCA_PREF} +fi function tca_stop { # stop programs @@ -55,20 +84,20 @@ function tca_stop { function tca_load_artifact { echo - echo "Loading artifact ..." + echo "Loading artifact ${TCA_JAR} to http://${TCA_PATH_ARTIFACT}/${TCA_ARTIFACT}..." curl -s -X POST --data-binary @"${TCA_JAR}" "http://${TCA_PATH_ARTIFACT}/${TCA_ARTIFACT}" echo } function tca_load_conf { echo - echo "Loading configuration ..." + echo "Loading configuration ${TCA_APP_CONF} to http://${TCA_PATH_APP}" curl -s -X PUT -d @${TCA_APP_CONF} http://${TCA_PATH_APP} echo # load preferences echo - echo "Loading preferences ..." + echo "Loading preferences ${TCA_PREF} to http://${TCA_PATH_APP}/preferences" curl -s -X PUT -d @${TCA_PREF} http://${TCA_PATH_APP}/preferences echo } @@ -76,13 +105,13 @@ function tca_load_conf { function tca_delete { echo - echo "Deleting application dcae-tca ..." + echo "Deleting application dcae-tca http://${TCA_PATH_APP}" curl -s -X DELETE http://${TCA_PATH_APP} echo # delete artifact echo - echo "Deleting artifact dcae-analytics-cdap-tca version ${TCA_ARTIFACT_VERSION} ..." + echo "Deleting artifact http://${TCA_PATH_ARTIFACT}/${TCA_ARTIFACT}/versions/${TCA_ARTIFACT_VERSION} ..." curl -s -X DELETE "http://${TCA_PATH_ARTIFACT}/${TCA_ARTIFACT}/versions/${TCA_ARTIFACT_VERSION}" echo } @@ -112,24 +141,12 @@ function tca_status { function tca_poll_policy { - #CBS_HOST=$(curl -s "${CONSUL_HOST}:${CONSUL_PORT}/v1/catalog/service/${CBS_SERVICE_NAME}" |jq .[0].ServiceAddress |sed -e 's/\"//g') - #CBS_PORT=$(curl -s "${CONSUL_HOST}:${CONSUL_PORT}/v1/catalog/service/${CBS_SERVICE_NAME}" |jq .[0].ServicePort |sed -e 's/\"//g') - - CBS_HOST='bd-service-dcaegen2-platform-cbs.default' - CBS_PORT='10000' - if [ -z "${CBS_HOST}" ] || [ -z "${CBS_PORT}" ]; then - echo 'CBS HOST or PORT not defined' - return - fi - - MY_NAME=${SERVICE_NAME:-tca} - #MY_NAME=$(hostname |rev |cut -f 3- -d '-' |rev) URL1="${CBS_HOST}:${CBS_PORT}/service_component/${MY_NAME}" URL2="$URL1:preferences" - echo "Retrieving configuration file at ${URL1}" + echo "tca_poll_policy: Retrieving configuration file at ${URL1}" curl -s "$URL1" | jq . --sort-keys > "${TCA_CONF_TEMP}" echo "Retrieving preferences file at ${URL1}" curl -s "$URL2" | jq . --sort-keys > "${TCA_PREF_TEMP}" diff --git a/tca-cdap-container/tca_app_config.json b/tca-cdap-container/tca_app_config.json index b3a66cc..d6adcb7 100644 --- a/tca-cdap-container/tca_app_config.json +++ b/tca-cdap-container/tca_app_config.json @@ -2,7 +2,7 @@ "artifact": { "name": "dcae-analytics-cdap-tca", "scope": "user", - "version": "2.2.0" + "version": "2.2.0.SNAPSHOT" }, "config": { "appDescription": "DCAE Analytics Threshold Crossing Alert Application", diff --git a/tca-cdap-container/tca_app_preferences.json b/tca-cdap-container/tca_app_preferences.json index 4ca1a44..76fa8c2 100644 --- a/tca-cdap-container/tca_app_preferences.json +++ b/tca-cdap-container/tca_app_preferences.json @@ -1,7 +1,7 @@ { - "aaiEnrichmentHost": "10.0.1.1", + "aaiEnrichmentHost": "{{AAIHOST}}", "aaiEnrichmentIgnoreSSLCertificateErrors": "true", - "aaiEnrichmentPortNumber": "8443", + "aaiEnrichmentPortNumber": "{{AAIPORT}}", "aaiEnrichmentProtocol": "https", "aaiEnrichmentUserName": "DCAE", "aaiEnrichmentUserPassword": "DCAE", @@ -9,25 +9,25 @@ "aaiVNFEnrichmentAPIPath": "/aai/v11/network/generic-vnfs/generic-vnf", "enableAAIEnrichment": "false", "enableAlertCEFFormat": "false", - "enableRedisCaching": "false", - "redisHosts": "redis-cluster:6379", + "enableRedisCaching": "{{REDISCACHING}}", + "redisHosts": "{{REDISHOSTPORT}}", "publisherContentType": "application/json", - "publisherHostName": "dmaap.onap-message-router", - "publisherHostPort": "3904", + "publisherHostName": "{{DMAAPHOST}}", + "publisherHostPort": "{{DMAAPPORT}}", "publisherMaxBatchSize": "1", "publisherMaxRecoveryQueueSize": "100000", "publisherPollingInterval": "20000", "publisherProtocol": "http", - "publisherTopicName": "unauthenticated.TCA_EVENT_OUTPUT", - "subscriberConsumerGroup": "OpenDCAE-c12", - "subscriberConsumerId": "c12", + "publisherTopicName": "{{DMAAPPUBTOPIC}}", + "subscriberConsumerGroup": "{{DMAAPSUBGROUP}}", + "subscriberConsumerId": "{{DMAAPSUBID}}", "subscriberContentType": "application/json", - "subscriberHostName": "dmaap.onap-message-router", - "subscriberHostPort": "3904", + "subscriberHostName": "{{DMAAPHOST}}", + "subscriberHostPort": "{{DMAAPPORT}}", "subscriberMessageLimit": "-1", "subscriberPollingInterval": "30000", "subscriberProtocol": "http", "subscriberTimeoutMS": "-1", - "subscriberTopicName": "unauthenticated.SEC_MEASUREMENT_OUTPUT", + "subscriberTopicName": "{{DMAAPSUBTOPIC}}", "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\"}]}]}" } |