From 8bf33437774bd7120bb68a22d0106adcc3a1718d Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Tue, 8 Aug 2017 02:49:33 -0700 Subject: Rework Pom and Dockerfile Rework the pom & swagger config + Remove license plugin in pom and license files + Rework the dockerfile (support all clamp versions now) + Introduce the version.properties Change-Id: Ia823e00309d651ca40ef12beeae02fb01d8a80a9 Issue-Id: CLAMP-1 Signed-off-by: Determe, Sebastien (sd378r) --- README.md | 151 +++++---- extra/docker/clamp/clamp.env | 2 +- pom.xml | 486 +++++++++++------------------ src/licenses/clamp_apache_v2/header.txt | 13 - src/licenses/clamp_apache_v2/license.txt | 19 -- src/licenses/licenses.properties | 1 - src/main/docker/Dockerfile | 49 ++- src/main/resources/clds-version.properties | 23 ++ version.properties | 29 +- 9 files changed, 350 insertions(+), 423 deletions(-) delete mode 100644 src/licenses/clamp_apache_v2/header.txt delete mode 100644 src/licenses/clamp_apache_v2/license.txt delete mode 100644 src/licenses/licenses.properties create mode 100644 src/main/resources/clds-version.properties diff --git a/README.md b/README.md index 5aa5cc0a9..4fe12ff23 100644 --- a/README.md +++ b/README.md @@ -1,61 +1,90 @@ -# Summary - -CLAMP is a platform for designing and managing control loops. It is used to design a closed loop, configure it with specific parameters for a particular network service, then deploying and undeploying it. Once deployed, the user can also update the loop with new parameters during runtime, as well as suspending and restarting it. - -It interacts with other systems to deploy and execute the closed loop. For example, it pushes the control loop design to the SDC catalog, associating it with the VF resource. It requests from DCAE the instantiation of microservices to manage the closed loop flow. Further, it creates and updates multiple policies in the Policy Engine that define the closed loop flow. - -The ONAP CLAMP platform abstracts the details of these systems under the concept of a control loop model. The design of a control loop and its management is represented by a workflow in which all relevant system interactions take place. This is essential for a self-service model of creating and managing control loops, where no low-level user interaction with other components is required. - -At a higher level, CLAMP is about supporting and managing the broad operational life cycle of VNFs/VMs and ultimately ONAP components itself. It will offer the ability to design, test, deploy and update control loop automation - both closed and open. Automating these functions would represent a significant saving on operational costs compared to traditional methods. - -# Developer Contact -Owner: ONAP CLAMP Dev team -Mailing List : onap-discuss@lists.onap.org -Add the following prefix to Subject on the mailing list : [CLAMP] -See here to subscribe : https://wiki.onap.org/display/DW/Mailing+Lists - -# Wiki -https://wiki.onap.org/display/DW/CLAMP+Project - -# Build -Jenkins Job: ${jenkins-joblink} - -CLAMP UI: ${cockpit-link} - -Logs: ${elk-link} - -# Docker image - -## Building -You can use the following command to build the clamp docker image: -``` -mvn clean install -P docker -``` - -## Deployement -Currently, the clamp docker image can be deployed with small configuration needs. Though, you might need to make small adjustments to the configuration. As clamp is spring based, you can use the SPRING_APPLICATION_JSON environment variable to update its parameters. - -### Databases -There are two needed datasource for Clamp. By default, both will try to connect to the localhost server using the credentials available in the example SQL files. If you need to change the default database host and/or credentials, you can do it by using the following json as SPRING_APPLICATION_JSON environment variable : -```json -{"spring": - { - "datasource": {"url":"jdbc:mysql://anotherDB.onap.org:3306/camunda?autoReconnect=true", "username": "admin", "password": "admin"}, - "cldsdatasource": {"url":"jdbc:mysql://anotherDB.onap.org:3306/clds?autoReconnect=true", "username": "admin", "password": "admin"} - } -} - -``` - -### Docker-compose - -A [docker-compose example file](extra/docker/clamp/docker-compose.yml) can be found under the [extra/docker/clamp/ folder](extra/docker/). - -Once the image has been built and is available locally, you can use the `docker-compose up` command to deploy a prepopullated database and a clamp instance available on [http://localhost:8080/designer/index.html](http://localhost:8080/designer/index.html). - - -### Logs - -Clamp uses logback framework to generate logs. The logback.xml file cand be found under the [src/main/resources/ folder](src/main/resources). - -With the default log settings, all logs will be generated into console and into root.log file under the Clamp root folder. The root.log file is not allowed to be appended, thus restarting the clamp will result in cleaning of the old log files. +# Summary + +CLAMP is a platform for designing and managing control loops. It is used to design a closed loop, configure it with specific parameters for a particular network service, then deploying and undeploying it. Once deployed, the user can also update the loop with new parameters during runtime, as well as suspending and restarting it. + +It interacts with other systems to deploy and execute the closed loop. For example, it pushes the control loop design to the SDC catalog, associating it with the VF resource. It requests from DCAE the instantiation of microservices to manage the closed loop flow. Further, it creates and updates multiple policies in the Policy Engine that define the closed loop flow. + +The ONAP CLAMP platform abstracts the details of these systems under the concept of a control loop model. The design of a control loop and its management is represented by a workflow in which all relevant system interactions take place. This is essential for a self-service model of creating and managing control loops, where no low-level user interaction with other components is required. + +At a higher level, CLAMP is about supporting and managing the broad operational life cycle of VNFs/VMs and ultimately ONAP components itself. It will offer the ability to design, test, deploy and update control loop automation - both closed and open. Automating these functions would represent a significant saving on operational costs compared to traditional methods. + +# Developer Contact +Owner: ONAP CLAMP Dev team +Mailing List : onap-discuss@lists.onap.org +Add the following prefix to Subject on the mailing list : [CLAMP] +See here to subscribe : https://wiki.onap.org/display/DW/Mailing+Lists + +# Wiki +https://wiki.onap.org/display/DW/CLAMP+Project + +# Build +Jenkins Job: ${jenkins-joblink} + +CLAMP UI: ${cockpit-link} + +Logs: ${elk-link} + +# Docker image + +## Building +You can use the following command to build the clamp docker image: +``` +mvn clean install -P docker +``` + +## Deployment +Currently, the clamp docker image can be deployed with small configuration needs. Though, you might need to make small adjustments to the configuration. As clamp is spring based, you can use the SPRING_APPLICATION_JSON environment variable to update its parameters. + +### Databases +There are two needed datasource for Clamp. By default, both will try to connect to the localhost server using the credentials available in the example SQL files. If you need to change the default database host and/or credentials, you can do it by using the following json as SPRING_APPLICATION_JSON environment variable : + +```json +{ + "spring.datasource.camunda.url": "jdbc:mysql://anotherDB.onap.org:3306/camundabpm?verifyServerCertificate=false&useSSL=false&requireSSL=false&autoReconnect=true", + "spring.datasource.camunda.username": "admin", + "spring.datasource.camunda.password": "password", + "spring.datasource.cldsdb.url": "jdbc:mysql://anotherDB.onap.org:3306/cldsdb4?verifyServerCertificate=false&useSSL=false&requireSSL=false&autoReconnect=true", + "spring.datasource.cldsdb.username": "admin", + "spring.datasource.cldsdb.password": "password" +} +``` + +OR + +```json +{ + "spring": + { + "datasource": + { + "camunda": + { + "url": "jdbc:mysql://anotherDB.onap.org:3306/camundabpm?verifyServerCertificate=false&useSSL=false&requireSSL=false&autoReconnect=true", + "username": "admin", + "password": "password" + }, + + "cldsdb": + { + "url": "jdbc:mysql://anotherDB.onap.org:3306/cldsdb4?verifyServerCertificate=false&useSSL=false&requireSSL=false&autoReconnect=true", + "username": "admin", + "password": "password" + } + } + } +} + +``` + +### Docker-compose + +A [docker-compose example file](extra/docker/clamp/docker-compose.yml) can be found under the [extra/docker/clamp/ folder](extra/docker/). + +Once the image has been built and is available locally, you can use the `docker-compose up` command to deploy a prepopullated database and a clamp instance available on [http://localhost:8080/designer/index.html](http://localhost:8080/designer/index.html). + + +### Logs + +Clamp uses logback framework to generate logs. The logback.xml file cand be found under the [src/main/resources/ folder](src/main/resources). + +With the default log settings, all logs will be generated into console and into root.log file under the Clamp root folder. The root.log file is not allowed to be appended, thus restarting the clamp will result in cleaning of the old log files. diff --git a/extra/docker/clamp/clamp.env b/extra/docker/clamp/clamp.env index c38d29b08..842afd63c 100644 --- a/extra/docker/clamp/clamp.env +++ b/extra/docker/clamp/clamp.env @@ -1 +1 @@ -SPRING_APPLICATION_JSON={"spring": {"datasource": {"url":"jdbc:mysql://db:3306/camundabpm?autoReconnect=true"}, "cldsdatasource": {"url":"jdbc:mysql://db:3306/cldsdb4?autoReconnect=true"}}} +SPRING_APPLICATION_JSON={"spring.datasource.camunda.url":"jdbc:mysql://db:3306/camundabpm?verifyServerCertificate=false&useSSL=false&requireSSL=false&autoReconnect=true","spring.datasource.cldsdb.url":"jdbc:mysql://db:3306/cldsdb4?verifyServerCertificate=false&useSSL=false&requireSSL=false&autoReconnect=true"} \ No newline at end of file diff --git a/pom.xml b/pom.xml index b853ccf30..e76cbf383 100644 --- a/pom.xml +++ b/pom.xml @@ -4,35 +4,39 @@ 4.0.0 org.onap.clamp clds - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT ONAP CLAMP - - org.onap.oparent - oparent - 1.0.0-SNAPSHOT - - + + This project build the ONAP CLAMP JAR that contains AJSC + CLAMP code. + + By Default "mvn clean install" command will execute also the unit tests + and the integration tests. The integration tests require a docker engine running. + + If you want to skip the intergation test you can by doing: + "mvn clean install -DskipITs=true" + + For Spring it's possible to specify the application.properties location + "mvn clean install -Dspring.config.location=classpath:application-test.properties" + + The application.properties contains the location of the CLAMP parameters files: + clds-policy-config.properties and clds-reference.properties + + 1.8 1.8 UTF-8 - 3306 + UTF-8 + + 3306 0.0.3-oss git-server - ${basedir}/target/classes/META-INF/resources/icd - service.json - org.onap.clamp.clds.service.rs 1.8 - local - ajsc-svc-account - com.att.ajsc - 2.2.11 6.1.0.6-oss 6.2.0.6-oss 6.1.0.3-oss - UTF-8 - UTF-8 + java jacoco ${project.build.directory}/surefire-reports @@ -77,16 +81,6 @@ Maven 2 repository 2 http://repo2.maven.org/maven2/ - - JBOSS - JBoss Repository - http://repository.jboss.org/nexus/content/groups/public-jboss/ - - - jboss-deprecated-repository - JBoss Deprecated Maven Repository - https://repository.jboss.org/nexus/content/repositories/deprecated/ - ecomp-releases ONAP Release Repository @@ -101,8 +95,12 @@ ecomp-snapshots ONAP Snapshot Repository ${nexusproxy}/${snapshotNexusPath} - true - false + + true + + + false + spring-repo @@ -110,31 +108,12 @@ https://artifacts.alfresco.com/nexus/content/repositories/public/ - soapUI - http://www.soapui.org/repository/maven2/ - SoapUI plugin + repository.jboss.org-public + JBoss.org Maven repository + https://repository.jboss.org/nexus/content/groups/public - - This project build the ONAP CLAMP JAR that contains AJSC + CLAMP code. - - By Default "mvn clean install" command will execute also the unit tests - and the integration tests. The integration tests require a docker engine running. - - If you want to skip the intergation test you can by doing: - "mvn clean install -DskipITs=true" - - For Spring it's possible to specify the application.properties location - "mvn clean install -Dspring.config.location=classpath:application-test.properties" - - The application.properties contains the location of the CLAMP parameters files: - clds-policy-config.properties and clds-reference.properties - - The licenses and headers can be generated by using this maven command: - mvn license:update-file-header license:update-project-license - - @@ -149,11 +128,26 @@ - - org.apache.commons - commons-vfs2 - 2.0 - + + + com.googlecode.json-simple + json-simple + 1.1 + + + org.apache.commons + commons-vfs2 + 2.0 + + + + org.springframework.security + spring-security-test + + test + + + com.att.ajsc @@ -170,9 +164,9 @@ spring-boot-starter-actuator - org.springframework.boot - spring-boot-starter-security - + org.springframework.boot + spring-boot-starter-security + org.springframework.boot spring-boot-starter-test @@ -332,6 +326,10 @@ apache-log4j-extras log4j + + jackson-databind + com.fasterxml.jackson.core + @@ -354,29 +352,33 @@ - org.onap.policy.engine - ControlloopPolicy - 1.1.0-SNAPSHOT - - - log4j - log4j - - - org.slf4j - slf4j-log4j12 - - - apache-log4j-extras - log4j - - - + org.onap.policy.engine + ControlloopPolicy + 1.1.0-SNAPSHOT + + + log4j + log4j + + + org.slf4j + slf4j-log4j12 + + + apache-log4j-extras + log4j + + + + + com.fasterxml.jackson.core + jackson-databind + 2.6.3 + com.fasterxml.jackson.dataformat jackson-dataformat-yaml - 2.6.3 @@ -403,41 +405,22 @@ + clamp + - - src/test/resources - - **/* - - true - + + src/test/resources + + **/* + + true + src/main/resources true - - target/generated-sources/license - - third-party-licenses.txt - - - - target/generated-resources/licenses - - *.* - - third-party-licenses - - - ${project.basedir}/etc - ${project.build.directory}/etc - true - - **/* - - src/main/docker @@ -453,116 +436,80 @@ true - - - - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - - ${projectTag} - ${scm.commit.message} - - - - com.github.kongchen - swagger-maven-plugin - 3.1.3 - - - - ${icd.package} - / - - ${project.artifactId} Service - ${project.version} - - ${swagger.directory} - - - - - - compile - - generate - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - com.github.kongchen - swagger-maven-plugin - 3.1.3 - - generate - - - - - - - - - - - - + + + - - org.apache.maven.plugins - maven-jar-plugin - 3.0.2 - - - jar-with-only-classes - package - - jar - - - classes - - META-INF/resources/designer/** - META-INF/resources/icd/** - META-INF/resources/index.html - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.0.0 - - - - attach-artifact - - package - - - - ${project.build.directory}/clds-${project.version}-classes.jar - jar - classes - - - - - - + + org.apache.maven.plugins + maven-jar-plugin + 3.0.2 + + + jar-with-only-classes + package + + jar + + + classes + + org/** + + + + + + + com.github.kongchen + swagger-maven-plugin + 3.1.5 + + + compile + + generate + + + + + + org.onap.clamp.clds.service + + / + + ${project.artifactId} Service + ${project.version} + + ${project.build.directory}/classes/META-INF/resources/icd + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.0.0 + + + + attach-artifact + + package + + + + ${project.build.directory}/clamp-classes.jar + jar + classes + + + + + + org.springframework.boot @@ -577,16 +524,6 @@ - - maven-release-plugin - - - org.apache.maven.scm - maven-scm-provider-gitexe - 1.9 - - - org.apache.maven.plugins maven-gpg-plugin @@ -616,37 +553,12 @@ ${skip.staging.artifacts} - - com.github.kongchen - swagger-maven-plugin - - - - org.onap.clamp.clds.service.rs - //rest - - ${project.artifactId} Service - ${project.version} - - ${swagger.directory} - - - - - - compile - - generate - - - - com.spotify docker-maven-plugin 0.4.11 - ${docker.push.registry}/onap/clamp + onap/clamp src/main/docker docker-hub @@ -665,6 +577,11 @@ ${project.build.directory} etc/config/** + + / + ${project.build.directory} + etc/keystore/** + @@ -682,19 +599,6 @@ - - tag-image - package - - tag - - - onap/clamp - ${docker.push.registry}/onap/clamp - true - ${skip.docker.tag} - - push-image deploy @@ -702,6 +606,7 @@ push + onap/clamp ${skip.docker.push} @@ -826,45 +731,26 @@ + + + merge + + post-integration-test + + + + ${project.build.directory}/coverage-reports + + *.exec + + + + ${project.build.directory}/jacoco-dev.exec + + - - - org.codehaus.mojo - license-maven-plugin - 1.12 - - false - ONAP CLAMP - true - true - true - - ============LICENSE_START======================================================= - - ================================================================================ - AT&T Intellectual Property. All rights - reserved. - 2017 - true - - clamp_apache_v2 - ${project.baseUri}/src/licenses - - - **/*.properties - **/icd/** - **/designer/lib/** - **/*.json - **/*.yaml - **/*.yml - **/licenses/** - - - - - org.codehaus.mojo diff --git a/src/licenses/clamp_apache_v2/header.txt b/src/licenses/clamp_apache_v2/header.txt deleted file mode 100644 index 578ee1a93..000000000 --- a/src/licenses/clamp_apache_v2/header.txt +++ /dev/null @@ -1,13 +0,0 @@ -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============================================ -=================================================================== \ No newline at end of file diff --git a/src/licenses/clamp_apache_v2/license.txt b/src/licenses/clamp_apache_v2/license.txt deleted file mode 100644 index f7306e6b0..000000000 --- a/src/licenses/clamp_apache_v2/license.txt +++ /dev/null @@ -1,19 +0,0 @@ -============LICENSE_START========================================== -=================================================================== -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. \ No newline at end of file diff --git a/src/licenses/licenses.properties b/src/licenses/licenses.properties deleted file mode 100644 index 7add1a477..000000000 --- a/src/licenses/licenses.properties +++ /dev/null @@ -1 +0,0 @@ -clamp_apache_v2=Clamp License diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile index 6b3e272d3..115949bb7 100644 --- a/src/main/docker/Dockerfile +++ b/src/main/docker/Dockerfile @@ -1,25 +1,24 @@ -FROM ubuntu:16.04 - -MAINTAINER "The Onap Team" -LABEL Description="This image contains an updated ubuntu 16.04 with the openjdk installed" Version="16.04-8" - -ARG http_proxy -ARG https_proxy -ENV HTTP_PROXY=$http_proxy -ENV HTTPS_PROXY=$https_proxy -ENV http_proxy=$HTTP_PROXY -ENV https_proxy=$HTTPS_PROXY - -RUN test -n "$http_proxy" && echo "Acquire::Proxy \"http://$http_proxy\";" > /etc/apt/apt.conf.d/02proxy || true && \ - apt-get update && \ - apt-get -y dist-upgrade && \ - apt-get install -y openjdk-8-jre-headless - -ADD clds-1.0.0-SNAPSHOT.jar /opt/clamp/app.jar -VOLUME /etc -ADD /etc/ /etc/ -ADD startService.sh /opt/clamp/startService.sh -RUN chmod 700 /opt/clamp/startService.sh - -WORKDIR /opt/clamp/ -ENTRYPOINT ./startService.sh +FROM ubuntu:16.04 + +MAINTAINER "The Onap Team" +LABEL Description="This immage contains an updated ubuntu 16.04 with the openjdk installed" Version="16.04-8" + +ARG http_proxy +ARG https_proxy +ENV HTTP_PROXY=$http_proxy +ENV HTTPS_PROXY=$https_proxy +ENV http_proxy=$HTTP_PROXY +ENV https_proxy=$HTTPS_PROXY + +RUN test -n "$http_proxy" && echo "Acquire::Proxy \"http://$http_proxy\";" > /etc/apt/apt.conf.d/02proxy || true && \ + apt-get update && \ + apt-get -y dist-upgrade && \ + apt-get install -y openjdk-8-jre-headless + +ADD clamp.jar /opt/clamp/app.jar +VOLUME /etc +ADD startService.sh /opt/clamp/startService.sh +RUN chmod 700 /opt/clamp/startService.sh + +WORKDIR /opt/clamp/ +ENTRYPOINT ./startService.sh diff --git a/src/main/resources/clds-version.properties b/src/main/resources/clds-version.properties new file mode 100644 index 000000000..8576692b8 --- /dev/null +++ b/src/main/resources/clds-version.properties @@ -0,0 +1,23 @@ +### +# ============LICENSE_START======================================================= +# ONAP CLAMP +# ================================================================================ +# 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============================================ +# =================================================================== +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +### +clds.version=${project.version} \ No newline at end of file diff --git a/version.properties b/version.properties index 479e5c8f9..b65593127 100644 --- a/version.properties +++ b/version.properties @@ -1,10 +1,33 @@ +### +# ============LICENSE_START======================================================= +# ONAP CLAMP +# ================================================================================ +# 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============================================ +# =================================================================== +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +### + # Versioning variables # Note that these variables cannot be structured (e.g. : version.release or version.snapshot etc... ) # because they are used in Jenkins, whose plug-in doesn't support -major=I -minor=N -patch=S +major=1 +minor=0 +patch=1 base_version=${major}.${minor}.${patch} -- cgit 1.2.3-korg