diff options
author | Hector Anapan <ha076r@att.com> | 2017-08-30 00:08:53 -0400 |
---|---|---|
committer | Hector Anapan <ha076r@att.com> | 2017-08-30 00:14:22 -0400 |
commit | 96d258ab43fa73cd9fc1ae5a32d3d9d07828b3a2 (patch) | |
tree | 93c597091f746febda4c79361cbac1ffe011b817 | |
parent | 8005572fcc71984775f99f6897bedd6c868584e8 (diff) |
Adding required DB table for LCM functionality
1) Added the DB hostnames to map to the MySQL container's docker IP in APP-C Container's /etc/hosts, then 2) added installAppcDb.sh to create the "appcctl" database and its "transactions" table (in appcctl.dump) since it is needed to complete the LCM functionality, then 3) added some properties in appc.properties since they were used in local testing, but need to double check if they are absolutely necessary
Change-Id: I7be65412ea4a87f7295adc9b6a69fe7ad917d62c
Signed-off-by: Hector Anapan <ha076r@att.com>
Issue: [APPC-122]
Signed-off-by: Hector Anapan <ha076r@att.com>
-rw-r--r-- | installation/appc/pom.xml | 15 | ||||
-rw-r--r-- | installation/appc/src/main/docker/Dockerfile | 4 | ||||
-rw-r--r-- | installation/appc/src/main/resources/appcctl.dump | 27 | ||||
-rw-r--r-- | installation/appc/src/main/scripts/installAppcDb.sh | 43 | ||||
-rw-r--r-- | installation/appc/src/main/scripts/startODL.sh | 15 | ||||
-rw-r--r-- | installation/src/main/properties/appc.properties | 10 |
6 files changed, 99 insertions, 15 deletions
diff --git a/installation/appc/pom.xml b/installation/appc/pom.xml index 8addab1..cedded3 100644 --- a/installation/appc/pom.xml +++ b/installation/appc/pom.xml @@ -75,15 +75,14 @@ </configuration> </execution> - <!-- Commented tags in case / when appc needs to add .dump mysql files or keystore files --> - <!--<execution> + <execution> <id>copy-data</id> <goals> <goal>copy-resources</goal> </goals> <phase>validate</phase> <configuration> - <outputDirectory>${basedir}/target/docker-stage/opt/openecomp/sdnc/data</outputDirectory> + <outputDirectory>${basedir}/target/docker-stage/opt/openecomp/appc/data</outputDirectory> <resources> <resource> <directory>src/main/resources</directory> @@ -94,7 +93,7 @@ </resource> </resources> </configuration> - </execution>--> + </execution> <execution> <id>copy-keystores</id> @@ -314,16 +313,14 @@ </configuration> </execution> - <!-- Two commented execution tags below in case / when appc needs - to add .dump mysql files or keystore files --> - <!-- <execution> + <execution> <id>copy-data</id> <goals> <goal>copy-resources</goal> </goals> <phase>validate</phase> <configuration> - <outputDirectory>${basedir}/target/docker-stage/opt/openecomp/sdnc/data</outputDirectory> + <outputDirectory>${basedir}/target/docker-stage/opt/openecomp/appc/data</outputDirectory> <resources> <resource> <directory>src/main/resources</directory> @@ -334,7 +331,7 @@ </resource> </resources> </configuration> - </execution> --> + </execution> <execution> <id>copy-keystores</id> diff --git a/installation/appc/src/main/docker/Dockerfile b/installation/appc/src/main/docker/Dockerfile index cad24d5..4cbe30e 100644 --- a/installation/appc/src/main/docker/Dockerfile +++ b/installation/appc/src/main/docker/Dockerfile @@ -1,4 +1,4 @@ -# Base ubuntu with added packages needed for open ecomp +# Base ubuntu with added packages needed for ONAP FROM openecomp/sdnc-image:1.1.2-SNAPSHOT-STAGING-170625-122013 MAINTAINER APP-C Team (appc@lists.openecomp.org) @@ -9,5 +9,5 @@ ENV APPC_CONFIG_DIR /opt/openecomp/appc/data/properties COPY opt /opt RUN ln -s /opt/openecomp/appc /opt/appc -#Expose port 8181 for ODL REST calls +# Expose port 8181 for ODL REST calls EXPOSE 8181 diff --git a/installation/appc/src/main/resources/appcctl.dump b/installation/appc/src/main/resources/appcctl.dump new file mode 100644 index 0000000..261f5c3 --- /dev/null +++ b/installation/appc/src/main/resources/appcctl.dump @@ -0,0 +1,27 @@ +-- +-- Table structure for table `transactions` for appcctl db +-- + +DROP TABLE IF EXISTS `transactions`; +CREATE TABLE `transactions` ( + `TIMESTAMP` + varchar(32) NOT NULL, + `REQUEST_ID` + varchar(256) DEFAULT NULL, + `START_TIME` + varchar(32) DEFAULT NULL, + `END_TIME` + varchar(32) DEFAULT NULL, + `TARGET_ID` + varchar(256) DEFAULT NULL, + `TARGET_TYPE` + varchar(256) DEFAULT NULL, + `SUB_COMPONENT` + varchar(256) DEFAULT NULL, + `OPERATION` + varchar(256) DEFAULT NULL, + `RESULT_CODE` + varchar(256) DEFAULT NULL, + `DESCRIPTION` + text +) ENGINE = InnoDB DEFAULT CHARSET = latin1;
\ No newline at end of file diff --git a/installation/appc/src/main/scripts/installAppcDb.sh b/installation/appc/src/main/scripts/installAppcDb.sh new file mode 100644 index 0000000..bd9b893 --- /dev/null +++ b/installation/appc/src/main/scripts/installAppcDb.sh @@ -0,0 +1,43 @@ +### +# ============LICENSE_START======================================================= +# APPC +# ================================================================================ +# 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========================================================= +### + +SDNC_HOME=${SDNC_HOME:-/opt/openecomp/sdnc} +APPC_HOME=${APPC_HOME:-/opt/openecomp/appc} +MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0} + +APPC_DB_USER=${APPC_DB_USER:-appcctl} +APPC_DB_PASSWD=${APPC_DB_PASSWD:-appcctl} +APPC_DB_DATABASE=${SDN_DB_DATABASE:-appcctl} + + +# Create tablespace and user account +mysql -h dbhost -u root -p${MYSQL_PASSWD} mysql <<-END +CREATE DATABASE ${APPC_DB_DATABASE}; +CREATE USER '${APPC_DB_USER}'@'localhost' IDENTIFIED BY '${APPC_DB_PASSWD}'; +CREATE USER '${APPC_DB_USER}'@'%' IDENTIFIED BY '${APPC_DB_PASSWD}'; +GRANT ALL PRIVILEGES ON ${APPC_DB_DATABASE}.* TO '${APPC_DB_USER}'@'localhost' WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON ${APPC_DB_DATABASE}.* TO '${APPC_DB_USER}'@'%' WITH GRANT OPTION; +commit; +END + +if [ -f ${APPC_HOME}/data/appcctl.dump ] +then + mysql -h dbhost -u root -p${MYSQL_PASSWD} appcctl < ${APPC_HOME}/data/appcctl.dump +fi diff --git a/installation/appc/src/main/scripts/startODL.sh b/installation/appc/src/main/scripts/startODL.sh index fd02e15..1996cb9 100644 --- a/installation/appc/src/main/scripts/startODL.sh +++ b/installation/appc/src/main/scripts/startODL.sh @@ -21,7 +21,10 @@ # ECOMP is a trademark and service mark of AT&T Intellectual Property. ### -# Install SDN-C & APP-C platform components if not already installed and start container +# +# This script takes care of installing the SDN-C & APP-C platform components +# if not already installed, and starts the APP-C Docker Container +# ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} ODL_ADMIN_PASSWORD=${ODL_ADMIN_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U} @@ -43,7 +46,6 @@ if [ -z "$DMAAP_TOPIC_ENV" ] echo "DMAAP_TOPIC_ENV shell variable exists and it's $DMAAP_TOPIC_ENV" fi - echo "Adding a value to property appc.asdc.env in appc.properties for appc-asdc-listener feature" echo "" >> $APPC_HOME/data/properties/appc.properties echo "appc.asdc.env=$DMAAP_TOPIC_ENV" >> $APPC_HOME/data/properties/appc.properties @@ -52,6 +54,13 @@ echo "" >> $APPC_HOME/data/properties/appc.properties # +# Add the DB hostnames in /etc/hosts (IP address is the MySQL DB IP) +# +RUN echo "172.19.0.2 dbhost sdnctldb01 sdnctldb02" >> /etc/hosts + + + +# # Wait for database to init properly # echo "Waiting for mysql" @@ -66,6 +75,8 @@ if [ ! -f ${SDNC_HOME}/.installed ] then echo "Installing SDN-C database" ${SDNC_HOME}/bin/installSdncDb.sh + echo "Installing APP-C database" + ${APPC_HOME}/bin/installAppcDb.sh echo "Starting OpenDaylight" ${ODL_HOME}/bin/start echo "Waiting ${SLEEP_TIME} seconds for OpenDaylight to initialize" diff --git a/installation/src/main/properties/appc.properties b/installation/src/main/properties/appc.properties index aa6ba61..27c215b 100644 --- a/installation/src/main/properties/appc.properties +++ b/installation/src/main/properties/appc.properties @@ -40,8 +40,14 @@ appc.service.logic.module.name=APPC appc.topology.dg.method=topology-operation-all appc.topology.dg.version=2.0.0 +# TEMP - Properties that might be needed to make the AAI-APPC connection +org.openecomp.appc.db.url.appcctl=jdbc:mysql://dbhost:3306/appcctl +org.openecomp.appc.db.user.appcctl=appcctl +org.openecomp.appc.db.pass.appcctl=appcctl - +org.openecomp.appc.db.url.sdnctl=jdbc:mysql://dbhost:3306/sdnctl +org.openecomp.appc.db.user.sdnctl=sdnctl +org.openecomp.appc.db.pass.sdnctl=gamma ### ### @@ -112,7 +118,7 @@ DCAE.dmaap.appc.username=test DCAE.dmaap.appc.password=test DCAE.dmaap.event.pool.members=10.0.11.1:3904 -#OAM Listener +# OAM Listener appc.OAM.disabled=true appc.OAM.provider.url=http://localhost:8181/restconf/operations/appc-oam appc.OAM.poolMembers=10.0.11.1:3904 |