From 2e0b65a1c3f59b4c15f283af33d2b6a677fa178f Mon Sep 17 00:00:00 2001 From: demx8as6 Date: Tue, 19 Nov 2019 14:16:43 +0100 Subject: [PATCH] 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 --- distribution/nonrtric-o1-controller/README.md | 3 + distribution/nonrtric-o1-controller/pom.xml | 202 +++++++++++++++++++++ .../src/main/docker/Dockerfile | 27 +++ .../src/main/scripts/TagVersion.groovy | 41 +++++ .../nonrtric-o1-controller/src/main/yaml/.env | 24 +++ .../src/main/yaml/docker-compose.yml | 54 ++++++ distribution/pom.xml | 32 ++++ 7 files changed, 383 insertions(+) create mode 100644 distribution/nonrtric-o1-controller/README.md create mode 100644 distribution/nonrtric-o1-controller/pom.xml create mode 100644 distribution/nonrtric-o1-controller/src/main/docker/Dockerfile create mode 100644 distribution/nonrtric-o1-controller/src/main/scripts/TagVersion.groovy create mode 100644 distribution/nonrtric-o1-controller/src/main/yaml/.env create mode 100644 distribution/nonrtric-o1-controller/src/main/yaml/docker-compose.yml create mode 100644 distribution/pom.xml 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 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + odlparent-lite + 1.4.3 + + + + org.o-ran-sc.oam.distribution + nonrtric-o1-controller + 0.6.3-SNAPSHOT + pom + + sdnc-distribution :: sdnc :: nonrtric-o1-controller + Creates nonrtric-o1-controller from ONAP SDNC + + O-RAN-SC/OAM + + + + 1.7.5-STAGING-latest + + nexus3.onap.org:10001/onap/sdnc-image:${image.version} + o-ran-sc/nonrtric-o1-controller + ${project.version} + ${maven.build.timestamp} + ${project.version} + ${https_proxy} + yyyyMMdd'T'HHmmss'Z' + opt/opendaylight + deploy + true + 93C4A3FD7BB9C367 + + + mvn:org.onap.ccsdk.features.sdnr.wt/sdnr-wt-feature-aggregator/${project.version}/xml/features + ${sdnr.wt.repo} + + odl-mdsal-all,odl-mdsal-apidocs,odl-daexim-all + odl-netconf-topology,odl-netconf-connector,sdnr-wt-feature-aggregator + ${odl.boot.features.odl} + + + + + + + org.apache.maven.wagon + wagon-http-lightweight + 2.2 + + + + + org.codehaus.groovy.maven + gmaven-plugin + 1.0 + + + validate + + execute + + + ${basedir}/src/main/scripts/TagVersion.groovy + + + + + + maven-resources-plugin + 2.6 + + + copy-dockerfile + + copy-resources + + validate + + ${basedir}/target/docker-stage + + + src/main/docker + + Dockerfile + + true + + + + + + copy-scripts + + copy-resources + + validate + + ${basedir}/target/docker-stage/opt/onap/sdnc/bin + + + src/main/scripts + + *.sh + + true + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack features + generate-sources + + unpack-dependencies + + + ${basedir}/target/docker-stage + true + false + true + true + + + + + + + + + + + + + + + + + + + + + + + + + io.fabric8 + docker-maven-plugin + 0.31.0 + false + + + + ${image.name} + + try + ${basedir}/target/docker-stage + + + ${project.docker.latestminortag.version} + ${project.docker.latestfulltag.version} + ${project.docker.latesttagtimestamp.version} + ${image.version} + + + + + + + + generate-images + package + + build + + + + + push-images + ${docker.push.phase} + + build + push + + + + + + + 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 @@ + + + + 4.0.0 + + org.o-ran-sc.oam + nonrtric-o1 + 1.0.0-SNAPSHOT + pom + + nonrtric-o1 + + nonrtric-o1-controller + + -- 2.16.6