Add dmaap listener docker container 47/22047/1
authorDan Timoney <dtimoney@att.com>
Fri, 3 Nov 2017 17:27:01 +0000 (13:27 -0400)
committerDan Timoney <dtimoney@att.com>
Fri, 3 Nov 2017 17:27:01 +0000 (13:27 -0400)
Add docker container for DMAAP listener

Change-Id: I1e8504d4181223027a90112ec2dc24afcec7b058
Issue-ID: SDNC-165
Signed-off-by: Dan Timoney <dtimoney@att.com>
Former-commit-id: 761e1086b0b2113d7c3dc794069d435054e7d1cf

installation/dmaap-listener/pom.xml [new file with mode: 0644]
installation/dmaap-listener/src/main/docker/Dockerfile [new file with mode: 0644]
installation/dmaap-listener/src/main/properties/dblib.properties [new file with mode: 0644]
installation/dmaap-listener/src/main/properties/dhcpalert.properties [new file with mode: 0755]
installation/dmaap-listener/src/main/properties/dmaap-listener.preferredRoute.txt [new file with mode: 0755]
installation/dmaap-listener/src/main/properties/dmaap-listener.properties [new file with mode: 0755]
installation/dmaap-listener/src/main/properties/log4j.properties [new file with mode: 0644]
installation/dmaap-listener/src/main/scripts/start-dmaap-listener.sh [new file with mode: 0644]
installation/src/main/yaml/docker-compose.yml

diff --git a/installation/dmaap-listener/pom.xml b/installation/dmaap-listener/pom.xml
new file mode 100644 (file)
index 0000000..9b58965
--- /dev/null
@@ -0,0 +1,245 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+
+    <parent>
+        <groupId>org.onap.sdnc.oam</groupId>
+        <artifactId>installation</artifactId>
+        <version>1.2.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>pom</packaging>
+    <artifactId>installation-dmaap-listener</artifactId>
+    <version>1.2.0-SNAPSHOT</version>
+
+    <name>Installation - dmaap-listener</name>
+    <description>Creates dmaap-listener Docker container</description>
+
+    <properties>
+        <image.name>onap/sdnc-dmaap-listener-image</image.name>
+        <sdnc.project.version>${project.version}</sdnc.project.version>
+        <ccsdk.project.version>0.1.0-SNAPSHOT</ccsdk.project.version>
+        <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
+    </properties>
+
+
+    <build>
+        <plugins>
+
+
+            <plugin>
+                <groupId>org.codehaus.groovy.maven</groupId>
+                <artifactId>gmaven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>execute</goal>
+                        </goals>
+                        <configuration>
+                            <source>
+                                println project.properties['sdnc.project.version'];
+                                def versionArray;
+                                if ( project.properties['sdnc.project.version'] != null ) {
+                                    versionArray = project.properties['sdnc.project.version'].split('\\.');
+                                }
+
+                                if (project.properties['sdnc.project.version'].endsWith("-SNAPSHOT"))
+                                {
+                                    project.properties['project.docker.latesttag.version']=versionArray[0]  + '.' + versionArray[1] + "-STAGING-latest";
+                                } else {
+                                    project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
+                                }
+
+                                println 'New Tag for docker:' +
+                                project.properties['project.docker.latesttag.version'];
+                            </source>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+
+
+            <plugin>
+                <artifactId>maven-resources-plugin</artifactId>
+                <version>2.6</version>
+                <executions>
+                    <execution>
+                        <id>copy-dockerfile</id>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals><!-- here the phase you need -->
+                        <phase>validate</phase>
+                        <configuration>
+                            <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>src/main/docker</directory>
+                                    <includes>
+                                        <include>Dockerfile</include>
+                                    </includes>
+                                    <filtering>true</filtering>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+
+                    <execution>
+                        <id>copy-scripts</id>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals><!-- here the phase you need -->
+                        <phase>validate</phase>
+                        <configuration>
+                            <outputDirectory>${basedir}/target/docker-stage/opt/onap/sdnc/dmaap-listener/bin</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>src/main/scripts</directory>
+                                    <includes>
+                                        <include>*.sh</include>
+                                    </includes>
+                                    <filtering>false</filtering>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+
+                    <execution>
+                        <id>copy-properties</id>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals><!-- here the phase you need -->
+                        <phase>validate</phase>
+                        <configuration>
+                            <outputDirectory>${basedir}/target/docker-stage/opt/onap/sdnc/data/properties</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>src/main/properties</directory>
+                                    <includes>
+                                        <include>*</include>
+                                    </includes>
+                                    <filtering>false</filtering>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>unpack</id>
+                        <goals>
+                            <goal>unpack</goal>
+                        </goals>
+                        <phase>initialize</phase>
+                        <configuration>
+                            <artifactItems>
+                              <artifactItem>
+                                <groupId>org.onap.ccsdk.sli.northbound</groupId>
+                                <artifactId>dmaap-listener</artifactId>
+                                <type>zip</type>
+                                <version>${ccsdk.project.version}</version>
+                              </artifactItem>
+                            </artifactItems>
+                            <outputDirectory>${basedir}/target/docker-stage/opt/onap/sdnc/dmaap-listener</outputDirectory>
+                            <excludes>bin/**,**/*-javadoc.jar,**/*-sources.jar</excludes>
+                            <overWriteReleases>true</overWriteReleases>
+                            <overWriteSnapshots>true</overWriteSnapshots>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <artifactId>exec-maven-plugin</artifactId>
+                <groupId>org.codehaus.mojo</groupId>
+                <version>1.5.0</version>
+                <executions>
+
+
+
+                    <execution>
+                        <id>change shell permissions</id>
+                        <phase>process-sources</phase>
+                        <goals>
+                            <goal>exec</goal>
+                        </goals>
+                        <configuration>
+                            <executable>/usr/bin/find</executable>
+                            <arguments>
+                                <argument>${basedir}/target/docker-stage/opt/onap/sdnc</argument>
+                                <argument>-name</argument>
+                                <argument>*.sh</argument>
+                                <argument>-exec</argument>
+                                <argument>chmod</argument>
+                                <argument>+x</argument>
+                                <argument>{}</argument>
+                                <argument>;</argument>
+                            </arguments>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+
+    </build>
+
+    <profiles>
+        <profile>
+            <id>docker</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>io.fabric8</groupId>
+                        <artifactId>docker-maven-plugin</artifactId>
+                        <version>0.16.5</version>
+                        <inherited>false</inherited>
+                        <configuration>
+                            <images>
+                                <image>
+                                    <name>${image.name}</name>
+                                    <build>
+                                        <cleanup>try</cleanup>
+                                        <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
+                                        <dockerFile>${basedir}/target/docker-stage/Dockerfile</dockerFile>
+                                        <tags>
+                                            <tag>${project.version}</tag>
+                                            <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
+                                            <tag>${project.docker.latesttag.version}</tag>
+                                        </tags>
+                                    </build>
+                                </image>
+                            </images>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <id>generate-images</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>build</goal>
+                                </goals>
+                            </execution>
+
+                            <execution>
+                                <id>push-images</id>
+                                <phase>deploy</phase>
+                                <goals>
+                                    <goal>build</goal>
+                                    <goal>push</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+    <organization>
+        <name>ONAP</name>
+    </organization>
+</project>
diff --git a/installation/dmaap-listener/src/main/docker/Dockerfile b/installation/dmaap-listener/src/main/docker/Dockerfile
new file mode 100644 (file)
index 0000000..49a70e4
--- /dev/null
@@ -0,0 +1,11 @@
+# Base ubuntu with added packages needed for open ecomp
+FROM onap/ccsdk-ubuntu-image:${ccsdk.distribution.version}
+MAINTAINER SDNC Team (onap-sdnc@lists.onap.org)
+ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
+ENV SDNC_CONFIG_DIR /opt/onap/sdnc/data/properties
+
+
+# copy deliverables to opt
+COPY opt /opt
+
+
diff --git a/installation/dmaap-listener/src/main/properties/dblib.properties b/installation/dmaap-listener/src/main/properties/dblib.properties
new file mode 100644 (file)
index 0000000..9506ac8
--- /dev/null
@@ -0,0 +1,38 @@
+###
+# ============LICENSE_START=======================================================
+# openECOMP : SDN-C
+# ================================================================================
+# 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=========================================================
+###
+
+# dblib.properrties
+org.onap.ccsdk.sli.dbtype=jdbc
+
+org.onap.ccsdk.sli.jdbc.hosts=sdnctldb01
+org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://dbhost:3306/sdnctl
+org.onap.ccsdk.sli.jdbc.driver=org.mariadb.jdbc.Driver
+org.onap.ccsdk.sli.jdbc.database=sdnctl
+org.onap.ccsdk.sli.jdbc.user=sdnctl
+org.onap.ccsdk.sli.jdbc.password=gamma
+org.onap.ccsdk.sli.jdbc.connection.name=sdnctldb01
+org.onap.ccsdk.sli.jdbc.connection.timeout=50
+org.onap.ccsdk.sli.jdbc.request.timeout=100
+org.onap.ccsdk.sli.jdbc.limit.init=10
+org.onap.ccsdk.sli.jdbc.limit.min=10
+org.onap.ccsdk.sli.jdbc.limit.max=20
+org.onap.dblib.connection.recovery=false
+
diff --git a/installation/dmaap-listener/src/main/properties/dhcpalert.properties b/installation/dmaap-listener/src/main/properties/dhcpalert.properties
new file mode 100755 (executable)
index 0000000..485972a
--- /dev/null
@@ -0,0 +1,35 @@
+TransportType=HTTPAAF
+Latitude =40.397443
+Longitude =-74.135602
+Version =1.0
+ServiceName =dmaap.onap.org/events
+Environment =DEV
+Partner =
+SubContextPath =/
+Protocol =http
+MethodType =GET
+username =sdnc
+password =Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
+contenttype =application/json
+authKey=VCisJnH4Zh772CLs:kcrM5mGlb7a0R+jlPN6gYUCKXrk=
+authDate=2016-05-10T13:13:50-0700
+host=dmaap.onap.org:3904
+topic=com.att.instar.edgeRouterStatusChange-v1
+group=sdnc_st
+id=sdnc_mtsnjv9sdma01
+timeout=15000
+limit=1000
+filter=
+AFT_DME2_EXCHANGE_REQUEST_HANDLERS=com.att.nsa.test.PreferredRouteRequestHandler
+AFT_DME2_EXCHANGE_REPLY_HANDLERS=com.att.nsa.test.PreferredRouteReplyHandler
+AFT_DME2_REQ_TRACE_ON=true
+AFT_ENVIRONMENT=AFTUAT
+AFT_DME2_EP_CONN_TIMEOUT=15000
+AFT_DME2_ROUNDTRIP_TIMEOUT_MS=240000
+AFT_DME2_EP_READ_TIMEOUT_MS=50000
+sessionstickinessrequired=NO
+DME2preferredRouterFilePath=/opt/sdnc/data/properties/dmaap-listener.preferredRoute.txt
+sdnc.odl.user=admin
+sdnc.odl.password=admin
+sdnc.odl.url-base=https://sdncodl.st.us.aic.cip.att.com:8443/restconf/operations
+
diff --git a/installation/dmaap-listener/src/main/properties/dmaap-listener.preferredRoute.txt b/installation/dmaap-listener/src/main/properties/dmaap-listener.preferredRoute.txt
new file mode 100755 (executable)
index 0000000..ddd4e86
--- /dev/null
@@ -0,0 +1 @@
+preferredRouteKey=MR1SBSFD_1
\ No newline at end of file
diff --git a/installation/dmaap-listener/src/main/properties/dmaap-listener.properties b/installation/dmaap-listener/src/main/properties/dmaap-listener.properties
new file mode 100755 (executable)
index 0000000..0879ac7
--- /dev/null
@@ -0,0 +1 @@
+subscriptions=org.onap.ccsdk.sli.northbound.dmaapclient.SdncFlatJsonDmaapConsumer:dhcpalert.properties
diff --git a/installation/dmaap-listener/src/main/properties/log4j.properties b/installation/dmaap-listener/src/main/properties/log4j.properties
new file mode 100644 (file)
index 0000000..3e9e896
--- /dev/null
@@ -0,0 +1,37 @@
+###
+# ============LICENSE_START=======================================================
+# openECOMP : SDN-C
+# ================================================================================
+# 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=========================================================
+###
+
+log4j.rootLogger=INFO,CONSOLE,LOGFILE
+
+# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=ERROR
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n
+
+# LOGFILE is set to be a File appender using a PatternLayout.
+log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender
+log4j.appender.LOGFILE.File=/opt/onap/sdnc/dmaap-listener/logs/dmaap-listener.log
+log4j.appender.LOGFILE.Append=true
+log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.LOGFILE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n
+log4j.appender.LOGFILE.MaxFileSize=10MB
+log4j.appender.LOGFILE.MaxBackupIndex=10
diff --git a/installation/dmaap-listener/src/main/scripts/start-dmaap-listener.sh b/installation/dmaap-listener/src/main/scripts/start-dmaap-listener.sh
new file mode 100644 (file)
index 0000000..06f1405
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+###
+# ============LICENSE_START=======================================================
+# ONAP : SDN-C
+# ================================================================================
+# 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=========================================================
+###
+
+PROPERTY_DIR=${PROPERTY_DIR:-/opt/onap/sdnc/data/properties}
+
+
+LISTENER=dmaap-listener
+
+DMAAPLISTENERROOT=${DMAAPLISTENERROOT:-/opt/onap/sdnc/dmaap-listener}
+JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-oracle}
+JAVA_OPTS=${JAVA_OPTS:--Dhttps.protocols=TLSv1.1,TLSv1.2}
+JAVA=${JAVA:-${JAVA_HOME}/bin/java}
+
+# Redirect output from script to $LISTENER.out
+if [ ! -d ${DMAAPLISTENERROOT}/logs ]
+then
+  mkdir ${DMAAPLISTENERROOT}/logs
+fi
+exec >> ${DMAAPLISTENERROOT}/logs/$LISTENER.out
+exec 2>&1
+
+for file in ${DMAAPLISTENERROOT}/lib/*.jar
+do
+  LISTENERCLASSPATH=$LISTENERCLASSPATH:$file
+done
+
+echo "Starting dmaap-listener"
+exec ${JAVA} ${JAVA_OPTS} -jar ${DMAAPLISTENERROOT}/lib/dmaap-listener*.jar -Dlog4j.configuration=file:${PROPERTY_DIR}/log4j.properties -cp ${LISTENERCLASSPATH}
+
+
+
index 43176ed..8928cbd 100644 (file)
@@ -119,3 +119,23 @@ services:
       options:
         max-size: "30m"
         max-file: "5"
+
+  dmaaplistener:
+    image: onap/sdnc-dmaap-listener-image:latest
+    depends_on:
+      - db
+    container_name:  sdnc_ueblistener_container
+    entrypoint: ["/opt/onap/sdnc/dmaap-listener/bin/start-dmaap-listener.sh" ]
+    links:
+      - db:dbhost
+      - db:sdnctldb01
+      - db:sdnctldb02
+      - sdnc:sdnhost
+    environment:
+      - SDNC_CONFIG_DIR=/opt/onap/sdnc/data/properties
+      - PROPERTY_DIR=/opt/onap/sdnc/data/properties
+    logging:
+      driver:   "json-file"
+      options:
+        max-size: "30m"
+        max-file: "5"