diff options
-rw-r--r-- | Dockerfile | 27 | ||||
-rw-r--r-- | LICENSE.txt | 21 | ||||
-rw-r--r-- | README.md | 83 | ||||
-rw-r--r-- | misc/LocalKey | 27 | ||||
-rw-r--r-- | misc/PolicyEngineApi.properties.tmpl | 14 | ||||
-rw-r--r-- | misc/dmaapbc | 152 | ||||
-rw-r--r-- | misc/dmaapbc.properties.tmpl | 152 | ||||
-rw-r--r-- | misc/doaction | 43 | ||||
-rw-r--r-- | misc/havecert.tmpl | 11 | ||||
-rw-r--r-- | misc/log4j.properties.tmpl | 11 | ||||
-rw-r--r-- | misc/opensource.env | 99 | ||||
-rw-r--r-- | misc/policyLogger.properties | 24 | ||||
-rw-r--r-- | pom.xml | 248 | ||||
-rw-r--r-- | src/main/webapp/HelloJetty.html | 30 | ||||
-rw-r--r-- | src/main/webapp/WEB-INF/log4j.xml | 45 | ||||
-rw-r--r-- | src/main/webapp/WEB-INF/web.xml | 38 | ||||
-rw-r--r-- | src/main/webapp/index.jsp | 28 |
17 files changed, 1053 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6ae667e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM java:openjdk-8-jre +MAINTAINER Dominic Lunanuova +ENV insdir /opt/app/dmaapbc +RUN \ + mkdir -p ${insdir}/lib \ + && mkdir -p ${insdir}/etc \ + && mkdir -p ${insdir}/logs \ + && mkdir -p ${insdir}/www && mkdir -p ${insdir}/www/doc \ + && mkdir -p ${insdir}/config \ + && mkdir -p ${insdir}/misc \ + && mkdir -p ${insdir}/bin +WORKDIR ${insdir} +USER root +COPY target/buscontroller.jar ${insdir}/lib/ +COPY target/deps/*.jar ${insdir}/lib/ +# COPY src/main/resources/log4j.properties ${insdir}/etc/ +# COPY www/ ${insdir}/www/ +# COPY target/site/apidocs/ ${insdir}/www/doc/ +COPY misc/LocalKey ${insdir}/etc/ +COPY misc/opensource.env ${insdir}/misc/ +COPY misc/*.tmpl ${insdir}/misc/ +COPY misc/dmaapbc ${insdir}/bin/ +RUN chmod +x ${insdir}/bin/* +COPY misc/doaction ${insdir}/bin/ + +VOLUME ${insdir}/log +CMD ["./bin/dmaapbc", "deploy" ] diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..9df2b59 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +/* + * ============LICENSE_START========================================== + * org.onap.dcae + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * + */ diff --git a/README.md b/README.md new file mode 100644 index 0000000..5d118a0 --- /dev/null +++ b/README.md @@ -0,0 +1,83 @@ +DMaaP Bus Controller API +======================= + +Data Movement as a Platform (DMaaP) Bus Controller provides an API for other ONAP infrastructure components to provision DMaaP resources. +A typical DMaaP resource is a Data Router Feed or a Message Router Topic, and their associated publishers and subscribers. +Other infrastucture resources such as DR Nodes and MR Clusters are also provisioned through this API. + +### Build Instructions for a Continuous Integration environment using Jenkins + +When this component is included in a Continuous Integration environment, such as structured by the Linux Foundation, the artifacts can be created and deployed via Jenkins. The following maven targets are currently supported in the Build step: +``` +clean install +``` + + +### Build Instructions for external developers + +This project is organized as a mvn project for a jar package. +After cloning from this git repo: + +``` +mvn clean install +``` + + +### Docker Packaging + +We can utilize docker to build and register the buscontroller container in a local dev repository. +Note the Dockerfile follows ONAP convention of running app as root. + +``` +<following a successful build, assuming DOCKER_HOST is set appropriately for your environment> + +$ docker build -f ./Dockerfile . +``` + + +### ONAP deployment + +Details TBD. + +Prior to starting container, place environment specific vars in /tmp/docker-databus-controller.conf on the Docker host, +and map that file to /opt/app/config/conf. +Run the container which will run the dmaapbc deploy command, which will update the container runtime properties appropriately, and start the Bus Controller. + +For example, in ONAP Future Lab environment, /tmp/docker-databus-controller.conf looks like: +``` + +# DMaaP Bus Controller OpenSource environment vars +CONT_DOMAIN=demo.dmaap.onap.org +DMAAPBC_INSTANCE_NAME=ONAPfuture + +# The https port +# set to 0 if certificate is not ready +DMAAPBC_INT_HTTPS_PORT=0 + +DMAAPBC_KSTOREFILE=/opt/app/dcae-certificates +DMAAPBC_KSTOREPASS=foofoofoo +DMAAPBC_PVTKEYPASS=barbarbar + +DMAAPBC_PG_ENABLED=true +DMAAPBC_PGHOST=zldciad1vipstg00.simpledemo.openecomp.org +DMAAPBC_PGCRED=test234-ftl + +DMAAPBC_DRPROV_FQDN=zldciad1vidrps00.simpledemo.openecomp.org + +DMAAPBC_AAF_URL=https://aafapi.${CONT_DOMAIN}:8095/proxy/ + +DMAAPBC_TOPICMGR_USER=m99751@dmaapBC.openecomp.org +DMAAPBC_TOPICMGR_PWD=enc:zyRL9zbI0py3rJAjMS0dFOnYfEw_mJhO +DMAAPBC_ADMIN_USER=m99501@dcae.openecomp.org +DMAAPBC_ADMIN_PWD=enc:YEaHwOJrwhDY8a6usetlhbB9mEjUq9m + +DMAAPBC_PE_ENABLED=false +DMAAPBC_PE_AAF_ENV=TBD +``` +Then the following steps could be used to pull and run the Bus Controller. (onap-nexus is just an example) +``` +$ +$ docker pull ecomp-nexus:51212/dcae_dmaapbc:1.0.0 +$ docker run -d -p 18080:8080 -v /tmp/docker-databus-controller.conf:/opt/app/config/conf onap-nexus:51212/dmaap/buscontroller:1.0.0 +``` + diff --git a/misc/LocalKey b/misc/LocalKey new file mode 100644 index 0000000..38ede55 --- /dev/null +++ b/misc/LocalKey @@ -0,0 +1,27 @@ +7ntUvubggJ1h6AXwQENQScrnlqmLMno_583XufLsguAT11bnBk0DVLE2GtCZ0pNQzlR8I3PJ1_nZ +UEVQs1G_qZzV-MHQZvz54solEp8dNUVji4JUzP7WiPuJdvCX8vvGLc8-jOVzEJ2DAGmV3gNp60_F +jrKx7F7Dz-h94jWZ45rNn7-Re_BneSto6HiSj0DN_SKSNhE5z9Qf3tFyFLGIYmlQoxzbTYC38uN0 +FjAYuKz6W_pTLzyOjHNAagYwEjTUUU-ei-QA5pL20-oG3jSYGnj_V94kd8X5ncB1-nybUsy5OOvZ +huCxf9hSetn2fpIszkRcuFxaxiwubpmEWp2L_zovhcRI1OMFPIIK0IckRHD1a5CpFVzR7P5L7LQk +FErATsQkHsPS9BJN5wlj1EoIhA2uaELjXjmOqPQg76eyQqXXcMHRJTA6czbXPYfTQMQx1r2USC9o +HdoLT4-so7zARZidmYmvPPT9qvNisK6BF4M32K-_s6YyJspSEB1MscNPujsD7zczIsBct7BTRoeZ +CbtkskT_yFhQzdzdSMzFN_NJ7Yb9p3d1G4gSkj2rbA-BDybHHPij8k6-k-ipvi_T_LW9B_J8Jf5f +aRclZqVgwwSG-mUKUyk9bI3cVc-1P2ICUmr59EjuauDAtlMQL-hnTJUs1rUerh4Q7d4XgrNLjLHY +Oue8MEj24VSMl-f28DDIV1N6ODiBKDHUmdENsmlbqeNpzQxu7FoSbLu6gN6zDP8Jw4ck1NHEIv8H +ecUf-hBGdB0HINClaV9X2ycafWcmRY-NCzX65cp7a1Rpl1kCEW5u79LLN28aJeTzmriewhy87hJf +rAah8z3dHteIN1fuvRoGsFwZ4jKo6olFxcBOlpHQIW5JJ1roO1vQ2Dx_l-Foo7wV_AD127zCu7ci +lYodnAOocKbhAub4sf90P3D2NMKb20e5CQrBSchtIEaD3G7J-vL5xYydLuLu5WipOdZuq3VhSSZm +TZIR3Ya2QiZVokxKgH-N0gPDz-TimNV_MkUSCNsv2NxjBM7oPF3dzEHbHS5eue41_R4vqxFdTdva +o0ASTFkARmmnMFBx1a73jmcoBBx-i4el8Rce7RvFWn1PALOnRsIQPy_Pgx0OE9_6eHfOSvyxbyMM +0FwE5f77gO967tgc4LwqB1pzz2Uk7hfizLKNc6nrrgDxSb_9rDWwiE4rWw7WYcRKvRQ270lCH4FQ +ezrPacnnK3cKM5L6brOyhbhiL4MnNX714L0K8C6TQnIVisQCLHwif40G_DSEWxICQ5V2DMzFn3JT +PefaubHlqxRZVikNH71b_2ZRLEi84m5iUuy8Ir1s3W6xuyIdt-yKLnjgnLjOPPxTDC5G_xaXAAuM +SkSOjvPzOArMUUnwYk68jAxXS2tBT8JN6OnglN8dHC-P24tYzfs4B4tMYJ1ibz6BUsQ6nYxsRUak +4ZjRmo3UG0OFJbOY-f0ja6Q4pISe1IXmlM4Ly9QdCfeHyDV-7Fiud9V_zo92lpQwttwSpBvFoDYQ +oePdA0zmCx6GIX_8L9e8a03hUx4aUtZ8C3Kf0PzOWTcjrV7nGb99ctjmRtfGw5GPWudH6CI3WFK2 +5wFDhrQSbRhzV4iQalYVPJQ7LO4WEi4EsBTRSiz074UpvkMV3UfMGDlpXAAq5rEjj-d5WbHhzbs8 +MGKzZLTfUz9lP4CME9AOwto_ey1ly3H-yaEgCpnshm-CZoSqVDmuFYM0QR_NcrqmSQ9ZKJEF_wTa +TEAXNJ99CYE0ZLvU9FjgCqH1-q1zL7z3NLX1uFYazEZWGMZFPVD5XOcCtUlVyUz9KuAO9ARVyu5C +7kzo_AFePtnsA_JUvvkauo6RwO6qhLJjZuSjvmiSdOAohiXUalDFjWVW8CMfgLF4PbRDklsAcsiT +P0xUdyWJ5slu87f9PunXDwQZWNv6haTIhVX7bilCDpRPbTbmimmE_C2J7tgV2EvazD7o8V_jeu0g +cnIpzRnaPG9l-uy2UKoxOXI4CSymcJoyV2xxC0SF7Q5quAhf3UGAdQUeFtHwxZtYiAMXLs06
\ No newline at end of file diff --git a/misc/PolicyEngineApi.properties.tmpl b/misc/PolicyEngineApi.properties.tmpl new file mode 100644 index 0000000..b49f7e9 --- /dev/null +++ b/misc/PolicyEngineApi.properties.tmpl @@ -0,0 +1,14 @@ +cat <<!EOF +#PDP URLs to which will be used by the Policy Engine API to take Decisions. There are multiple to support redundancy. +#Format: PDP_URL{PriorityNumber} = URL, id, password. +PDP_URL1 = ${DMAAPBC_PDP1_URL:-https://host1.domain.notset.com:8081/pdp/} , ${DMAAPBC_PDP1_USER:-testpdp} , ${DMAAPBC_PDP1_PWD:-alpha123} +PDP_URL2 = ${DMAAPBC_PDP2_URL:-https://host2.domain.notset.com:8082/pdp/} , ${DMAAPBC_PDP2_USER:-testpdp} , ${DMAAPBC_PDP2_PWD:-alpha456} +PAP_URL = ${DMAAPBC_PAP_URL:-https://host3.domain.notset.com:9091/pap/} , ${DMAAPBC_PAP_USER:-testpap} , ${DMAAPBC_PAP_PWD:-alpha123} + + + +CLIENT_ID=${DMAAPBC_TOPICMGR_USER:-mechIdNotSet@namespaceNotSet} +ENVIRONMENT=${DMAAPBC_PE_AAF_ENV:-DEVL} + + +!EOF diff --git a/misc/dmaapbc b/misc/dmaapbc new file mode 100644 index 0000000..83fc8c2 --- /dev/null +++ b/misc/dmaapbc @@ -0,0 +1,152 @@ +#!/bin/bash + +umask 0022 +TZ=GMT0 +COMPONENT=dmaapbc +APP_ROOT=/opt/app/$COMPONENT +USER=root +export TZ +PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/java/jdk/jdk180/bin +export PATH +CLASSPATH=`echo $APP_ROOT/etc $APP_ROOT/lib/*.jar | tr ' ' ':'` +export CLASSPATH +CONTAINER_CONFIG=/opt/app/config/conf +MAIN=org.onap.dmaap.dbcapi.server.Main + + +pids() { + #set -x + ps -ef | grep java | grep $MAIN | sed -e 's/[^ ]* *//' -e 's/ .*//' + #set +x +} + +config() { + set -x + if [ ! -d $APP_ROOT ] + then + echo "Expected app root directory $APP_ROOT does not exist" + exit 1 + fi + if [ ! -f $CONTAINER_CONFIG ] + then + echo "Expected env file $CONTAINER_CONFIG not found" + exit 1 + fi + cd $APP_ROOT + source $CONTAINER_CONFIG + . misc/dmaapbc.properties.tmpl > etc/dmaapbc.properties + . misc/PolicyEngineApi.properties.tmpl > config/PolicyEngineApi.properties + set +x +} + +start() { + set -x + ID=`id -n -u` + GRP=`id -n -g` + if [ "$ID" != "$USER" ] + then + echo $COMPONENT must be started as user $USER not $ID + exit 1 + fi + if [ "$GRP" != "$USER" ] + then + echo $COMPONENT must be started as group $USER not $GRP + exit 1 + fi + cd $APP_ROOT + +# disable until we use certs +# if etc/havecert +# then + echo >/dev/null +# else +# echo No certificate file available. Cannot start +# exit 0 +# fi + PIDS=`pids` + if [ "$PIDS" != "" ] + then + echo $COMPONENT already running + exit 0 + fi + rm -f $APP_ROOT/etc/SHUTDOWN + + # JVM flags +#old line from Dockerfile...keep for reference only + FLAGS="-cp etc:lib/* -Dlog4j.configuration=etc/log4j.properties -Ddmaapbc.properties=etc/dmaapbc.properties -Dhttps.protocols=TLSv1.2 -Dhttps.cipherSuites=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" + nohup java $FLAGS $MAIN </dev/null >/dev/null 2>&1 & + sleep 5 + PIDS=`pids` + if [ "$PIDS" = "" ] + then + echo $COMPONENT startup failed + tail -100 $APP_ROOT/logs/dmaap*.log + else + echo $COMPONENT started + fi + set +x +} + +stop() { + ID=`id -n -u` + GRP=`id -n -g` + if [ "$ID" != "$USER" ] + then + echo $COMPONENT must be stopped as user $USER not $ID + exit 1 + fi + if [ "$GRP" != "$USER" ] + then + echo $COMPONENT must be stopped as group $USER not $GRP + exit 1 + fi + touch $APP_ROOT/etc/SHUTDOWN + PIDS=`pids` + if [ "$PIDS" != "" ] + then + sleep 5 + kill -9 $PIDS + sleep 5 + echo $COMPONENT stopped + else + echo $COMPONENT not running + fi +} + +status() { + PIDS=`pids` + if [ "$PIDS" != "" ] + then + echo $COMPONENT running + else + echo $COMPONENT not running + fi +} + +set -x +case "$1" in +'deploy') + config + start + wait + ;; +'start') + start + ;; +'stop') + stop + ;; +'restart') + stop + sleep 20 + start + ;; +'status') + status + ;; +*) + echo "Usage: $0 { start | stop | restart }" + exit 1 + ;; +esac +exit 0 diff --git a/misc/dmaapbc.properties.tmpl b/misc/dmaapbc.properties.tmpl new file mode 100644 index 0000000..9af0d7e --- /dev/null +++ b/misc/dmaapbc.properties.tmpl @@ -0,0 +1,152 @@ +cat <<!EOF +# +# Configuration parameters fixed at startup for the DMaaP Bus Controller +# +# +# URI to retrieve dynamic DR configuration +# +ProvisioningURI: ${DMAAPBC_INTURI:-/internal/prov} +# +# Allow http access to API +# +HttpAllowed: ${DMAAPBC_HTTPALLOWED:-true} +# +# The port number for http as seen within the server +# +IntHttpPort: ${DMAAPBC_INT_HTTP_PORT:-8080} +# +# The port number for https as seen within the server +# Set to 0 if no certificate is available yet... +# +IntHttpsPort: ${DMAAPBC_INT_HTTPS_PORT:-8443} +# +# The external port number for https taking port mapping into account +# +ExtHttpsPort: ${DMAAPBC_EXT_HTTPS_PORT:-443} +# +# The type of keystore for https +# +KeyStoreType: jks +# +# The path to the keystore for https +# +KeyStoreFile: ${DMAAPBC_KSTOREFILE:-etc/keystore} +# +# The password for the https keystore +# +KeyStorePassword: ${DMAAPBC_KSTOREPASS:-changeit} +# +# The password for the private key in the https keystore +# +KeyPassword: ${DMAAPBC_PVTKEYPASS:-changeit} +# +# The type of truststore for https +# +TrustStoreType: jks +# +# The path to the truststore for https +# +TrustStoreFile: ${DMAAPBC_TSTOREFILE} +# +# The password for the https truststore +# +TrustStorePassword: ${DMAAPBC_TSTOREPASS:-changeit} +# +# The path to the file used to trigger an orderly shutdown +# +QuiesceFile: etc/SHUTDOWN +# +# Enable postgress +# +UsePGSQL: ${DMAAPBC_PG_ENABLED:-true} +# +# The host for postgres access +# +DB.host: ${DMAAPBC_PGHOST:-HostNotSet} +# +# For postgres access +# +DB.cred: ${DMAAPBC_PGCRED:-ValueNotSet} +# +# Name of this environment +# +DmaapName: ${DMAAPBC_INSTANCE_NAME:-FTLIST} +# +# Name of DR prov server +# +DR.provhost: ${DMAAPBC_DRPROV_FQDN:-dcae-drps.domain.notset.com} +# +# The Role and credentials of the MirrorMaker Provisioner. This is used by DMaaP Bus Controller to pub to the provisioning topic +# Not part of 1701 +# +#MM.ProvRole: ${DMAAPBC_MMPROV_ROLE:-org.openecomp.dmaapBC.MMprov.prov} +#MM.ProvUserMechId: ${DMAAPBC_MMPROV_ID:-idNotSet@namespaceNotSet} +#MM.ProvUserPwd: ${DMAAPBC_MMPROV_PWD:-enc:fMxh-hzYZldbtyXumQq9aJU08SslhbM6mXtt} +# +# The Role of the MirrorMaker Agent. This is used by MM to sub to provisioning topic +# +MM.AgentRole: ${DMAAPBC_MMAGENT_ROLE:-org.openecomp.dmaapBC.MMagent.agent} +################# +# AAF Properties: +# +# regarding password encryption: +# In the dependencies that Maven retrieves (e.g., under dcae_dmaapbc/target/deps/ is a jar file cadi-core-version.jar. Generate the key file with: +# +# java \u2013jar wherever/cadi-core-*.jar keygen keyfilename +# chmod 400 keyfilename +# +# To encrypt a key: +# +# java \u2013jar wherever/cadi-core-*.jar digest password-to-encrypt keyfilename +# +# This will generate a string. Put \u201Cenc:\u201D on the front of the string, and put the result in this properties file. +# +# Location of the Codec Keyfile which is used to decrypt passwords in this properties file before they are passed to AAF +# +# REF: https://wiki.domain.notset.com/display/cadi/CADI+Deployment +# +CredentialCodecKeyfile: ${DMAAPBC_CODEC_KEYFILE:-etc/LocalKey} +# +# URL of AAF environment to use. +# +aaf.URL: ${DMAAPBC_AAF_URL:-https://authentication.simpledemo.openecomp.org:8095/proxy/} +# +# TopicMgr mechid@namespace +# +aaf.TopicMgrUser: ${DMAAPBC_TOPICMGR_USER:-idNotSet@namespaceNotSet} +# +# TopicMgr password +# +aaf.TopicMgrPassword: ${DMAAPBC_TOPICMGR_PWD:-enc:zyRL9zbI0py3rJAjMS0dFOnYfEw_mJhO} +# +# Bus Controller Namespace Admin mechid@namespace +# +aaf.AdminUser: ${DMAAPBC_ADMIN_USER:-idNotSet@namespaceNotSet} +# +# Bus Controller Namespace Admin password +# +aaf.AdminPassword: ${DMAAPBC_ADMIN_PWD:-enc:YEaHwOJrwhDY8a6usetlhbB9mEjUq9m} +# +# endof AAF Properties +################# +################# +# PolicyEngine Properties +# +# Flag to turn on/off Authentication +UsePE: ${DMAAPBC_PE_ENABLED:-false} +# +# Argument to decisionAttributes.put("AAF_ENVIRONMENT", X); +# where X is: TEST= UAT, PROD = PROD, DEVL = TEST +# +PeAafEnvironment: ${DMAAPBC_PE_AAF_ENV:-DEVL} +# +# Name of PolicyEngineApi properties file +PolicyEngineProperties: config/PolicyEngineApi.properties +# +# Namespace for URI values for API used to create AAF permissions +# e.g. if ApiNamespace is X.Y..dmaapBC.api then for URI /topics we create an AAF perm X.Y..dmaapBC.api.topics +ApiNamespace: org.openecomp.dmaapBC.api +# +# endof PolicyEngineProperties +################# +!EOF
\ No newline at end of file diff --git a/misc/doaction b/misc/doaction new file mode 100644 index 0000000..d3dd9b8 --- /dev/null +++ b/misc/doaction @@ -0,0 +1,43 @@ +#!/bin/bash + +cd /opt/app/dmaapbc/etc +for action in "$@" +do +case "$action" in +'backup') + cp log4j.properties log4j.properties.save 2>/dev/null + cp dmaapbc.properties dmaapbc.properties.save 2>/dev/null + cp havecert havecert.save 2>/dev/null + ;; +'stop') + /opt/app/platform/init.d/dmaapbc stop + ;; +'start') + /opt/app/platform/init.d/dmaapbc start || exit 1 + ;; +'config') + /bin/bash log4j.properties.tmpl >log4j.properties + /bin/bash dmaapbc.properties.tmpl >dmaapbc.properties + /bin/bash havecert.tmpl >havecert + /bin/bash PolicyEngineApi.properties.tmpl > ../config/PolicyEngineApi.properties + echo "$AFTSWM_ACTION_NEW_VERSION" >VERSION.dmaapbc + chmod +x havecert + rm -f /opt/app/platform/rc.d/K90dmaapbc /opt/app/platform/rc.d/S10dmaapbc + ln -s ../init.d/dmaapbc /opt/app/platform/rc.d/K90dmaapbc + ln -s ../init.d/dmaapbc /opt/app/platform/rc.d/S10dmaapbc + ;; +'restore') + cp log4j.properties.save log4j.properties 2>/dev/null + cp dmaapbc.properties.save dmaapbc.properties 2>/dev/null + cp havecert.save havecert 2>/dev/null + ;; +'clean') + rm -f log4j.properties dmaapbc.properties havecert log4j.properties.save dmaapbc.properties.save havecert.save SHUTDOWN redirections.dat VERSION.dmaapbc + rm -f /opt/app/platform/rc.d/K90dmaapbc /opt/app/platform/rc.d/S10dmaapbc + ;; +*) + exit 1 + ;; +esac +done +exit 0 diff --git a/misc/havecert.tmpl b/misc/havecert.tmpl new file mode 100644 index 0000000..00a0a34 --- /dev/null +++ b/misc/havecert.tmpl @@ -0,0 +1,11 @@ +#!/bin/bash +cat <<!EOF +TZ=GMT0 +cd /opt/app/dmaapbc; +if [ -f ${DMAAPBC_KSTOREFILE:-etc/keystore} ] +then + exit 0 +fi +echo `date '+%F %T,000'` WARN Certificate file "${DMAAPBC_KSTOREFILE:-etc/keystore}" is missing >>${DMAAPBC_LOGS:-logs}/dmaapbc.log +exit 1 +!EOF diff --git a/misc/log4j.properties.tmpl b/misc/log4j.properties.tmpl new file mode 100644 index 0000000..0b689f4 --- /dev/null +++ b/misc/log4j.properties.tmpl @@ -0,0 +1,11 @@ +cat <<!EOF +log4j.debug=FALSE +log4j.rootLogger=INFO,Root + +log4j.appender.Root=org.apache.log4j.DailyRollingFileAppender +log4j.appender.Root.file=${DMAAPBC_LOGS:-logs}/buscontroller.log +log4j.appender.Root.datePattern='.'yyyyMMdd +log4j.appender.Root.append=true +log4j.appender.Root.layout=org.apache.log4j.PatternLayout +log4j.appender.Root.layout.ConversionPattern=%d %p %F %L %t %m%n +!EOF diff --git a/misc/opensource.env b/misc/opensource.env new file mode 100644 index 0000000..71123fa --- /dev/null +++ b/misc/opensource.env @@ -0,0 +1,99 @@ +# +# The Controller domain +# +CONT_DOMAIN=simpledemo.onap.org +# +# The https port +# set to 0 if certificate is not ready +DMAAPBC_INT_HTTPS_PORT=0 + +# +# The path to the keystore for https +# +DMAAPBC_KSTOREFILE=/opt/app/dcae-certificates + +# The password for the https keystore +# +DMAAPBC_KSTOREPASS=foofoofoo +# +# The password for the private key in the https keystore +# +DMAAPBC_PVTKEYPASS=barbarbar +# +# Flag for whether we are using PG connection for persistence +# +DMAAPBC_PG_ENABLED=false +# +# The host for postgres access +# +DMAAPBC_PGHOST=zldciad1vipstg00.${CONT_DOMAIN} +# +# For postgres access +# +DMAAPBC_PGCRED=test234-ftl +# +# Name of this environment +# +DMAAPBC_INSTANCE_NAME=onap1 +# +# Name of DR prov server +# +DMAAPBC_DRPROV_FQDN=dcae-drps.${CONT_DOMAIN} + +################# +# AAF Properties: +# +# regarding password encryption: +# In the dependencies that Maven retrieves (e.g., under dcae_dmaapbc/target/deps/ is a jar file cadi-core-version.jar. Generate the key file with: +# +# java \u2013jar wherever/cadi-core-*.jar keygen keyfilename +# chmod 400 keyfilename +# +# To encrypt a key: +# +# java \u2013jar wherever/cadi-core-*.jar digest password-to-encrypt keyfilename +# +# This will generate a string. Put \u201Cenc:\u201D on the front of the string, and put the result in this properties file. +# +# Location of the Codec Keyfile which is used to decrypt passwords in this properties file before they are passed to AAF +# +# REF: https://wiki.domain.notset.com/display/cadi/CADI+Deployment +# +# URL of AAF environment to use. +# +DMAAPBC_AAF_URL=https://aafapi.${CONT_DOMAIN}:8095/proxy/ +# +# TopicMgr mechid@namespace +# +DMAAPBC_TOPICMGR_USER=m99751@dmaapBC.onap.org +# +# TopicMgr password +# +DMAAPBC_TOPICMGR_PWD=enc:zyRL9zbI0py3rJAjMS0dFOnYfEw_mJhO +# +# Bus Controller Namespace Admin mechid@namespace +# +DMAAPBC_ADMIN_USER=m99501@dcae.onap.org +# +# Bus Controller Namespace Admin password +# +DMAAPBC_ADMIN_PWD=enc:YEaHwOJrwhDY8a6usetlhbB9mEjUq9m + +# +# endof AAF Properties +################# + +################# +# PolicyEngine Properties + +# +# Flag to turn on/off Authentication +DMAAPBC_PE_ENABLED=false +# +# Argument to decisionAttributes.put("AAF_ENVIRONMENT", X); +# where X is: TEST= UAT, PROD = PROD, DEVL = TEST +# +DMAAPBC_PE_AAF_ENV=DEMO + +# endof PolicyEngineProperties +################# diff --git a/misc/policyLogger.properties b/misc/policyLogger.properties new file mode 100644 index 0000000..83190e0 --- /dev/null +++ b/misc/policyLogger.properties @@ -0,0 +1,24 @@ +################################### Set concurrentHashMap and timer info ####################### +#Timer initial delay and the delay between in milliseconds before task is to be execute. +timer.delay.time=1000 +#Timer scheduleAtFixedRate period - time in milliseconds between successive task executions. +check.interval= 30000 +#Longest time an event info can be stored in the concurrentHashMap for logging - in seconds. +event.expired.time=86400 +#Size of the concurrentHashMap which stores the event starting time, etc - when its size reaches this limit, the Timer gets executed +#to remove all expired records from this concurrentHashMap. +concurrentHashMap.limit=5000 +#Size of the concurrentHashMap - when its size drops to this point, stop the Timer +stop.check.point=2500 +################################### Set logging format ############################################# +# set EELF for EELF logging format, set LOG4J for using log4j, set SYSTEMOUT for using system.out.println +logger.type=EELF +#################################### Set level for EELF or SYSTEMOUT logging ################################## +# Set level for debug file. Set DEBUG to enable .info, .warn and .debug; set INFO for enable .info and .warn; set OFF to disable all +debugLogger.level=OFF +# Set level for metrics file. Set OFF to disable; set ON to enable +metricsLogger.level=ON +# Set level for error file. Set OFF to disable; set ON to enable +error.level=ON +# Set level for audit file. Set OFF to disable; set ON to enable +audit.level=ON @@ -0,0 +1,248 @@ +<?xml version="1.0"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.onap.dmaap.buscontroller</groupId> + <artifactId>buscontroller</artifactId> + <version>${artifact.version}</version> + <name>buscontroller</name> + <distributionManagement> + <repository> + <id>ecomp-releases</id> + <name>Open eCOMP Release Repository</name> + <url>${nexusproxy}/${releases.path}</url> + </repository> + <snapshotRepository> + <id>ecomp-snapshots</id> + <name>Open eCOMP Snapshot Repository</name> + <url>${nexusproxy}/${snapshots.path}</url> + </snapshotRepository> + <site> + <id>ecomp-site</id> + <url>dav:${nexusproxy}/content/sites/site/org/onap/dmaap/dbcapi/${project.artifactId}/${project.version}/</url> + </site> + </distributionManagement> + <pluginRepositories> + <pluginRepository> + <id>central</id> + <url>http://repo1.maven.org/maven2</url> + </pluginRepository> + </pluginRepositories> + <build> + <finalName>buscontroller</finalName> + + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.5.1</version> + <inherited>true</inherited> + <configuration> + <source>1.7</source> + <target>1.7</target> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-deploy-plugin</artifactId> + <version>2.8</version> <!-- This version supports the "deployAtEnd" parameter --> + <configuration> + <skip/> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-site-plugin</artifactId> + <version>3.6</version> + <dependencies> + <dependency> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-webdav-jackrabbit</artifactId> + <version>2.10</version> + </dependency> + </dependencies> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.10</version> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/deps</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>false</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + </configuration> + </execution> + </executions> + </plugin> + + + <plugin> + <groupId>org.sonatype.plugins</groupId> + <artifactId>nexus-staging-maven-plugin</artifactId> + <version>1.6.7</version> + <extensions>true</extensions> + <configuration> + <serverId>ecomp-staging</serverId> + <nexusUrl>${nexusproxy}</nexusUrl> + <stagingProfileId>176c31dfe190a</stagingProfileId> + </configuration> + </plugin> + + </plugins> + <pluginManagement> + <plugins> + <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <versionRange>[2.10,)</versionRange> + <goals> + <goal>copy-dependencies</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore/> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + <dependencyManagement> + <dependencies> + + <dependency> + <groupId>org.glassfish.jersey</groupId> + <artifactId>jersey-bom</artifactId> + <version>${jersey.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-core</artifactId> + <version>1.5.13</version> + </dependency> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-jersey2-jaxrs</artifactId> + <version>1.5.13</version> + </dependency> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-annotations</artifactId> + <version>1.5.13</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.containers</groupId> + <artifactId>jersey-container-servlet-core</artifactId> + <!-- use the following artifactId if you don't need servlet 2.x compatibility --> + <!-- artifactId>jersey-container-servlet</artifactId --> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-moxy</artifactId> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.17</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-server</artifactId> + <version>${jettyVersion}</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-servlet</artifactId> + <version>${jettyVersion}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-servlets</artifactId> + <version>${jettyVersion}</version> + <scope>compile</scope> + </dependency> + <!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple --> + <dependency> + <groupId>com.googlecode.json-simple</groupId> + <artifactId>json-simple</artifactId> + <version>1.1.1</version> + </dependency> + <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + <version>1.6</version> + </dependency> + <!-- https://mvnrepository.com/artifact/org.postgresql/postgresql --> + <dependency> + <groupId>org.postgresql</groupId> + <artifactId>postgresql</artifactId> + <version>9.4.1208.jre7</version> + </dependency> + <dependency> + <groupId>com.att.eelf</groupId> + <artifactId>eelf-core</artifactId> + <version>${eelf.version}</version> + </dependency> + <dependency> + <groupId>org.onap.dmaap.dbcapi</groupId> + <artifactId>dbcapi</artifactId> + <version>1.1.0-SNAPSHOT</version> + </dependency> + </dependencies> + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>2.10.4</version> + <configuration> + <failOnError>false</failOnError> + <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet> + <docletArtifact> + <groupId>org.umlgraph</groupId> + <artifactId>umlgraph</artifactId> + <version>5.6</version> + </docletArtifact> + <additionalparam>-views</additionalparam> + <useStandardDocletOptions>true</useStandardDocletOptions> + </configuration> + </plugin> + </plugins> + </reporting> + <properties> + <jersey.version>2.16</jersey.version> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <jettyVersion>9.3.7.v20160115</jettyVersion> + <eelf.version>0.0.1</eelf.version> + <artifact.version>1.0.0-SNAPSHOT</artifact.version> + <nexusproxy>https://nexus.onap.org</nexusproxy> + <snapshots.path>content/repositories/snapshots/</snapshots.path> + <releases.path>content/repositories/releases/</releases.path> + </properties> + <description>Packaging Platform (DMaaP) Bus Controller API as a Docker container. </description> +</project> diff --git a/src/main/webapp/HelloJetty.html b/src/main/webapp/HelloJetty.html new file mode 100644 index 0000000..4d61636 --- /dev/null +++ b/src/main/webapp/HelloJetty.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- + ============LICENSE_START======================================================= + OpenECOMP - org.openecomp.dmaapbc + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<html> +<head> +<meta charset="ISO-8859-1"> +<title>Index</title> +</head> +<body> +Hello Jetty! +</body> +</html> diff --git a/src/main/webapp/WEB-INF/log4j.xml b/src/main/webapp/WEB-INF/log4j.xml new file mode 100644 index 0000000..4e4d5e9 --- /dev/null +++ b/src/main/webapp/WEB-INF/log4j.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + OpenECOMP - org.openecomp.dmaapbc + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" > +<log4j:configuration> + <appender name="dmaapBC" class="org.apache.log4j.RollingFileAppender"> + <param name="File" value="dmaapBC.log"/> + <param name="MaxFileSize" value="1000KB"/> + <param name="MaxBackupIndex" value="3"/> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="[%d{HH:mm:ss:SSS}] - %-6p - %c.%M() - %m%n"/> + </layout> + </appender> + <appender name="media" class="org.apache.log4j.ConsoleAppender"> + <param name="Threshold" value="FATAL"/> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/> + </layout> + </appender> + <category name="org.openecomp.dcae.dmaapBC"> + <appender-ref ref="dmaapBC"/> + </category> + <root> + <priority value="all"/> + <appender-ref ref="media"/> + </root> +</log4j:configuration> diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..055fbf0 --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + OpenECOMP - org.openecomp.dmaapbc + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<!-- This web.xml file is not required when using Servlet 3.0 container, + see implementation details http://jersey.java.net/nonav/documentation/latest/jax-rs.html --> +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> + <servlet> + <servlet-name>Jersey Web Application</servlet-name> + <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class> + <init-param> + <param-name>jersey.config.server.provider.packages</param-name> + <param-value>org.openecomp.dmaapBC</param-value> + </init-param> + <load-on-startup>1</load-on-startup> + </servlet> + <servlet-mapping> + <servlet-name>Jersey Web Application</servlet-name> + <url-pattern>/webapi/*</url-pattern> + </servlet-mapping> +</web-app> diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp new file mode 100644 index 0000000..3c20e06 --- /dev/null +++ b/src/main/webapp/index.jsp @@ -0,0 +1,28 @@ +<%-- + ============LICENSE_START======================================================= + org.onap.dcae + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --%> + +<html> +<body> + <h2>Jersey RESTful Web Application!</h2> + <p><a href="webapi/dmaap">Jersey resource</a> + <p>Visit <a href="http://jersey.java.net">Project Jersey website</a> + for more information on Jersey! +</body> +</html> |