o1-netconf-controller
Code to create a docker image for the o1-controller based on onap CCSDK/SDNC
Change-Id: I853b678e31a3866c52c7adb04b48f9021b2cafee
Signed-off-by: demx8as6 <martin.skorupski@highstreet-technologies.com>
diff --git a/distribution/nonrtric-o1-controller/README.md b/distribution/nonrtric-o1-controller/README.md
new file mode 100644
index 0000000..c416175
--- /dev/null
+++ b/distribution/nonrtric-o1-controller/README.md
@@ -0,0 +1,3 @@
+## Distribution
+
+ This directory contains OAM related software artifacts realted to the packaging and distributing code.
\ No newline at end of file
diff --git a/distribution/nonrtric-o1-controller/pom.xml b/distribution/nonrtric-o1-controller/pom.xml
new file mode 100644
index 0000000..428f80f
--- /dev/null
+++ b/distribution/nonrtric-o1-controller/pom.xml
@@ -0,0 +1,202 @@
+<?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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>odlparent-lite</artifactId>
+ <version>1.4.3</version>
+ <relativePath />
+ </parent>
+
+ <groupId>org.o-ran-sc.oam.distribution</groupId>
+ <artifactId>nonrtric-o1-controller</artifactId>
+ <version>0.6.3-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>sdnc-distribution :: sdnc :: nonrtric-o1-controller</name>
+ <description>Creates nonrtric-o1-controller from ONAP SDNC</description>
+ <organization>
+ <name>O-RAN-SC/OAM</name>
+ </organization>
+
+ <properties>
+ <image.version>1.7.5-STAGING-latest</image.version>
+ <!-- <base.image.repo>nexus3.onap.org:10001/onap/sdnc-image:${image.version}</base.image.repo> -->
+ <base.image.repo>nexus3.onap.org:10001/onap/sdnc-image:${image.version}</base.image.repo>
+ <image.name>o-ran-sc/nonrtric-o1-controller</image.name>
+ <ccsdk.project.version>${project.version}</ccsdk.project.version>
+ <ccsdk.build.timestamp>${maven.build.timestamp}</ccsdk.build.timestamp>
+ <ccsdk.features.version>${project.version}</ccsdk.features.version>
+ <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
+ <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
+ <opendaylight.root>opt/opendaylight</opendaylight.root>
+ <docker.push.phase>deploy</docker.push.phase>
+ <docker.verbose>true</docker.verbose>
+ <ansible.gpg.key>93C4A3FD7BB9C367</ansible.gpg.key>
+
+ <!-- odl.repolist.features and odl.boot.features.all are used by dockerfile. Contains all repos and features to start -->
+ <sdnr.wt.repo>mvn:org.onap.ccsdk.features.sdnr.wt/sdnr-wt-feature-aggregator/${project.version}/xml/features</sdnr.wt.repo>
+ <odl.repolist.features>${sdnr.wt.repo}</odl.repolist.features>
+
+ <odl.boot.features.odl>odl-mdsal-all,odl-mdsal-apidocs,odl-daexim-all</odl.boot.features.odl>
+ <ccsdk.odl.features>odl-netconf-topology,odl-netconf-connector,sdnr-wt-feature-aggregator</ccsdk.odl.features>
+ <odl.boot.features.all>${odl.boot.features.odl}</odl.boot.features.all>
+ </properties>
+
+ <build>
+ <extensions>
+ <extension>
+ <!-- this extension is required by wagon in order to pass the proxy -->
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-http-lightweight</artifactId>
+ <version>2.2</version>
+ </extension>
+ </extensions>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.groovy.maven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>${basedir}/src/main/scripts/TagVersion.groovy</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/bin</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/scripts</directory>
+ <includes>
+ <include>*.sh</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack features</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
+ <excludeTransitive>true</excludeTransitive>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ </configuration>
+ </execution>
+<!-- <execution> -->
+<!-- <id>unpack dgs</id> -->
+<!-- <phase>generate-sources</phase> -->
+<!-- <goals> -->
+<!-- <goal>unpack</goal> -->
+<!-- </goals> -->
+<!-- <configuration> -->
+<!-- <outputDirectory>${basedir}/target/docker-stage/opt/onap/ccsdk</outputDirectory> -->
+<!-- <artifactItems> -->
+<!-- <artifactItem> -->
+<!-- <groupId>${project.groupId}</groupId> -->
+<!-- <artifactId>platform-logic-installer</artifactId> -->
+<!-- <version>${project.version}</version> -->
+<!-- <type>zip</type> -->
+<!-- </artifactItem> -->
+<!-- </artifactItems> -->
+<!-- </configuration> -->
+<!-- </execution> -->
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.31.0</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.docker.latestminortag.version}</tag>
+ <tag>${project.docker.latestfulltag.version}</tag>
+ <tag>${project.docker.latesttagtimestamp.version}</tag>
+ <tag>${image.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>${docker.push.phase}</phase>
+ <goals>
+ <goal>build</goal>
+ <goal>push</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </project>
diff --git a/distribution/nonrtric-o1-controller/src/main/docker/Dockerfile b/distribution/nonrtric-o1-controller/src/main/docker/Dockerfile
new file mode 100644
index 0000000..a25d578
--- /dev/null
+++ b/distribution/nonrtric-o1-controller/src/main/docker/Dockerfile
@@ -0,0 +1,27 @@
+################################################################################
+# Copyright 2019 highstreet technologies and others
+#
+# 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.
+#
+FROM ${base.image.repo}
+
+ENV ODL_HOME /opt/opendaylight
+ENV FEATURES_SDNR system/org/onap/ccsdk/features/sdnr
+ENV SDNRWT=true
+
+# root user actions
+USER root
+RUN rm $ODL_HOME/data/idmlight.db.mv.db
+#back to user odl
+USER odl
+
diff --git a/distribution/nonrtric-o1-controller/src/main/scripts/TagVersion.groovy b/distribution/nonrtric-o1-controller/src/main/scripts/TagVersion.groovy
new file mode 100644
index 0000000..68a8b78
--- /dev/null
+++ b/distribution/nonrtric-o1-controller/src/main/scripts/TagVersion.groovy
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CCSDK
+ * ================================================================================
+ * 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============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.ccsdk.distribution
+
+
+def versionArray;
+if ( project.properties['ccsdk.project.version'] != null ) {
+ versionArray = project.properties['ccsdk.project.version'].split('\\.');
+}
+
+if ( project.properties['ccsdk.project.version'].endsWith("-SNAPSHOT") ) {
+ patchArray = versionArray[2].split('-');
+ project.properties['project.docker.latestminortag.version']=versionArray[0] + '.' + versionArray[1] + "-SNAPSHOT-latest";
+ project.properties['project.docker.latestfulltag.version']=versionArray[0] + '.' + versionArray[1] + '.' + patchArray[0] + "-SNAPSHOT-latest";
+ project.properties['project.docker.latesttagtimestamp.version']=versionArray[0] + '.' + versionArray[1] + '.' + patchArray[0] + "-SNAPSHOT-"+project.properties['ccsdk.build.timestamp'];
+} else {
+ project.properties['project.docker.latestminortag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
+ project.properties['project.docker.latestfulltag.version']=versionArray[0] + '.' + versionArray[1] + '.' + versionArray[2] + "-STAGING-latest";
+ project.properties['project.docker.latesttagtimestamp.version']=versionArray[0] + '.' + versionArray[1] + '.' + versionArray[2] + "-STAGING-"+project.properties['ccsdk.build.timestamp'];
+}
diff --git a/distribution/nonrtric-o1-controller/src/main/yaml/.env b/distribution/nonrtric-o1-controller/src/main/yaml/.env
new file mode 100644
index 0000000..f141094
--- /dev/null
+++ b/distribution/nonrtric-o1-controller/src/main/yaml/.env
@@ -0,0 +1,24 @@
+################################################################################
+# Copyright 2019 highstreet technologies and others
+#
+# 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.
+#
+
+NEXUS_DOCKER_REPO=nexus3.o-ran-sc.org:10001/
+DOCKER_IMAGE_NAME=o-ran-sc/nonrtric-o1-controller
+DOCKER_IMAGE_TAG=1.7.5-STAGING-latest
+PORTPREFIX=
+ENABLE_ODL_CLUSTER=false
+REPLICAS=0
+ODL_HOME=/opt/opendaylight
+LOCAL_NONRTRIC_MOUNT=/var/tmp/
diff --git a/distribution/nonrtric-o1-controller/src/main/yaml/docker-compose.yml b/distribution/nonrtric-o1-controller/src/main/yaml/docker-compose.yml
new file mode 100644
index 0000000..c0de8ad
--- /dev/null
+++ b/distribution/nonrtric-o1-controller/src/main/yaml/docker-compose.yml
@@ -0,0 +1,54 @@
+################################################################################
+# Copyright 2019 highstreet technologies and others
+#
+# 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.
+#
+version: "3.3"
+
+services:
+ nonrt-o1:
+ image: ${NEXUS_DOCKER_REPO}${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}
+ depends_on:
+ - sdnctldb01
+ container_name: nonrt_o1_controller
+ ports:
+ - "${PORTPREFIX}8181:8181"
+ links:
+ - sdnctldb01:dbhost
+ environment:
+ - SDNC_CONFIG_DIR=/opt/onap/ccsdk/data/properties
+ - ENABLE_ODL_CLUSTER=${ENABLE_ODL_CLUSTER}
+ - CCSDK_REPLICAS=${REPLICAS}
+ - DOMAIN=""
+ volumes:
+ - ${LOCAL_NONRTRIC_MOUNT}/nrtric-o1/logs:${ODL_HOME}/data/log
+ logging:
+ driver: "json-file"
+ options:
+ max-size: "30m"
+ max-file: "5"
+
+ sdnctldb01:
+ image: mysql/mysql-server:5.6
+ container_name: nonrt_o1_db
+ ports:
+ - "3306"
+ environment:
+ - MYSQL_ROOT_PASSWORD=openECOMP1.0
+ - MYSQL_ROOT_HOST=%
+ logging:
+ driver: "json-file"
+ options:
+ max-size: "30m"
+ max-file: "5"
+
\ No newline at end of file
diff --git a/distribution/pom.xml b/distribution/pom.xml
new file mode 100644
index 0000000..eefca7c
--- /dev/null
+++ b/distribution/pom.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+################################################################################
+# Copyright 2019 highstreet technologies and others
+#
+# 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.
+#
+-->
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.o-ran-sc.oam</groupId>
+ <artifactId>nonrtric-o1</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>nonrtric-o1</name>
+ <modules>
+ <module>nonrtric-o1-controller</module>
+ </modules>
+</project>