diff options
29 files changed, 714 insertions, 134 deletions
diff --git a/aai-service/features/src/main/resources/features.xml b/aai-service/features/src/main/resources/features.xml deleted file mode 100644 index 97d352124..000000000 --- a/aai-service/features/src/main/resources/features.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ============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========================================================= - --> - - -<features name="sdnc-aai-service-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0"> - - <repository>mvn:org.opendaylight.mdsal/features-mdsal/${odl.mdsal.features.version}/xml/features</repository> - - <feature name='sdnc-aai-service' description="sdnc-aai-service" version='${project.version}'> - <!-- Most applications will have a dependency on the ODL MD-SAL Broker --> - <feature version="${odl.mdsal.version}">odl-mdsal-broker</feature> - <feature>sdnc-sli</feature> - <bundle>mvn:org.onap.ccsdk.sli.adaptors/aai-service-provider/${project.version}</bundle> - <bundle>mvn:com.sun.jersey/jersey-client/${jersey.client.version}</bundle> - <bundle>mvn:com.sun.jersey/jersey-core/${jersey.version}</bundle> - <bundle>mvn:org.apache.httpcomponents/httpcore-osgi/${apache.httpcomponents.core.version}</bundle> - <bundle>mvn:org.apache.httpcomponents/httpclient-osgi/${apache.httpcomponents.client.version}</bundle> - <bundle>mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version}</bundle> - <bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version}</bundle> - <bundle>mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version}</bundle> - <bundle>mvn:commons-lang/commons-lang/${commons.lang.version}</bundle> - <bundle>mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/${jackson.version}</bundle> - <!-- - <bundle>mvn:org.jvnet.jaxb2_commons/jaxb2-basics-runtime/${jvnet.jaxb2.version}</bundle> - --> - </feature> -</features> diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index a76d1c5b2..e07c3ecf5 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -15,7 +15,6 @@ <packaging>bundle</packaging> <name>ccsdk-sli-adaptors :: aai-service :: ${project.artifactId}</name> - <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> @@ -48,17 +47,18 @@ <dependency> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sli-common</artifactId> - <scope>compile</scope> + <scope>provided</scope> </dependency> <dependency> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sli-provider</artifactId> - <scope>compile</scope> + <scope>provided</scope> </dependency> <dependency> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>utils-provider</artifactId> <version>${ccsdk.sli.core.version}</version> + <scope>provided</scope> </dependency> <dependency> <groupId>org.osgi</groupId> diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 557584e40..00f92b5e7 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -57,26 +57,21 @@ <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </dependency> - <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> </dependency> - - <!-- Needed to run test cases --> <dependency> <groupId>org.glassfish.jersey.core</groupId> <artifactId>jersey-common</artifactId> <scope>test</scope> </dependency> - <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-jaxrs</artifactId> <scope>test</scope> </dependency> - <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> @@ -90,13 +85,13 @@ <dependency> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sli-common</artifactId> + <scope>provided</scope> </dependency> - <dependency> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sli-provider</artifactId> + <scope>provided</scope> </dependency> - <dependency> <groupId>org.osgi</groupId> <artifactId>org.osgi.core</artifactId> @@ -106,24 +101,10 @@ <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency> - - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - </dependency> - <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> </dependency> - - - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - - </dependencies> diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index 6b8e46d60..ef2757c0a 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -28,6 +28,7 @@ <version>${ccsdk.sli.core.version}</version> <type>xml</type> <classifier>features</classifier> + <scope>provided</scope> </dependency> <dependency> diff --git a/ansible-adapter/ansible-adapter-features/src/main/resources/features.xml b/ansible-adapter/ansible-adapter-features/src/main/resources/features.xml deleted file mode 100644 index 69d3b9b07..000000000 --- a/ansible-adapter/ansible-adapter-features/src/main/resources/features.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ============LICENSE_START======================================================= - ONAP : APPC - ================================================================================ - Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - ================================================================================ - Copyright (C) 2017 Amdocs - ============================================================================= - 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. - - ECOMP is a trademark and service mark of AT&T Intellectual Property. - ============LICENSE_END========================================================= - --> - - -<features name="appc-ansible-adapter-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0"> - - <repository>mvn:org.opendaylight.mdsal/features-mdsal/${odl.mdsal.features.version}/xml/features</repository> - - <feature name='appc-ansible-adapter' description="appc-ansible-adapter" version='${project.version}'> - <feature version="${odl.mdsal.version}">odl-mdsal-broker</feature> - <feature>sdnc-sli</feature> - <bundle dependency="true">mvn:org.onap.appc/appc-common/${project.version}</bundle> - <bundle>mvn:org.onap.appc/appc-ansible-adapter-bundle/${project.version}</bundle> - </feature> - -</features> diff --git a/artifacts/pom.xml b/artifacts/pom.xml index b08cfff08..0c3c4a287 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -73,6 +73,13 @@ </dependency> <dependency> <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>ccsdk-base-http</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>feature</classifier> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.adaptors</groupId> <artifactId>aai-service-provider</artifactId> <version>${project.version}</version> </dependency> @@ -141,6 +148,16 @@ <artifactId>sql-resource-installer</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>base-http-provider</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>base-http-installer</artifactId> + <version>${project.version}</version> + </dependency> </dependencies> </dependencyManagement> diff --git a/base/http/features/ccsdk-base-http/pom.xml b/base/http/features/ccsdk-base-http/pom.xml new file mode 100644 index 000000000..0e18c737e --- /dev/null +++ b/base/http/features/ccsdk-base-http/pom.xml @@ -0,0 +1,26 @@ +<?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>single-feature-parent</artifactId> + <version>1.3.2</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>ccsdk-base-http</artifactId> + <version>0.5.1-SNAPSHOT</version> + <packaging>feature</packaging> + + <name>ccsdk-sli-adaptors :: base-http :: ${project.artifactId}</name> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>base-http-provider</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> +</project> diff --git a/base/http/features/features-base-http/pom.xml b/base/http/features/features-base-http/pom.xml new file mode 100644 index 000000000..84004858c --- /dev/null +++ b/base/http/features/features-base-http/pom.xml @@ -0,0 +1,29 @@ +<?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>feature-repo-parent</artifactId> + <version>1.3.2</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>features-base-http</artifactId> + <version>0.5.1-SNAPSHOT</version> + <packaging>feature</packaging> + + <name>ccsdk-sli-adaptors :: base-http :: ${project.artifactId}</name> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>ccsdk-base-http</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>features</classifier> + </dependency> + + </dependencies> +</project> diff --git a/base/http/features/pom.xml b/base/http/features/pom.xml new file mode 100644 index 000000000..a9abe519e --- /dev/null +++ b/base/http/features/pom.xml @@ -0,0 +1,23 @@ +<?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.3.2</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>base-http-features</artifactId> + <version>0.5.1-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>ccsdk-sli-adaptors :: base-http :: ${project.artifactId}</name> + + <modules> + <module>ccsdk-base-http</module> + <module>features-base-http</module> + </modules> +</project> diff --git a/base/http/installer/pom.xml b/base/http/installer/pom.xml new file mode 100644 index 000000000..ac233cb4f --- /dev/null +++ b/base/http/installer/pom.xml @@ -0,0 +1,141 @@ +<?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.3.2</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>base-http-installer</artifactId> + <version>0.5.1-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>ccsdk-sli-adaptors :: base-http :: ${project.artifactId}</name> + + <properties> + <application.name>ccsdk-base-http</application.name> + <features.boot>${application.name}</features.boot> + <features.repositories>mvn:org.onap.ccsdk.sli.adaptors/${features.boot}/${project.version}/xml/features</features.repositories> + <include.transitive.dependencies>false</include.transitive.dependencies> + </properties> + + <dependencies> + + <dependency> + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>${application.name}</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>features</classifier> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>base-http-provider</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>maven-repo-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <attach>true</attach> + <finalName>stage/${application.name}-${project.version}</finalName> + <descriptors> + <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor> + </descriptors> + <appendAssemblyId>true</appendAssemblyId> + </configuration> + </execution> + <execution> + <id>installer-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <attach>true</attach> + <finalName>${application.name}-${project.version}-installer</finalName> + <descriptors> + <descriptor>src/assembly/assemble_installer_zip.xml</descriptor> + </descriptors> + <appendAssemblyId>false</appendAssemblyId> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <goals> + <goal>copy-dependencies</goal> + </goals> + <phase>prepare-package</phase> + <configuration> + <transitive>false</transitive> + <outputDirectory>${project.build.directory}/assembly/system</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + <useRepositoryLayout>true</useRepositoryLayout> + <addParentPoms>false</addParentPoms> + <copyPom>false</copyPom> + <includeArtifactIds>ccsdk-base-http,base-http-provider</includeArtifactIds> + <scope>provided</scope> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>copy-version</id> + <goals> + <goal>copy-resources</goal> + </goals><!-- here the phase you need --> + <phase>validate</phase> + <configuration> + <outputDirectory>${basedir}/target/stage</outputDirectory> + <resources> + <resource> + <directory>src/main/resources/scripts</directory> + <includes> + <include>install-feature.sh</include> + </includes> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + + </executions> + </plugin> + + </plugins> + </build> +</project> diff --git a/base/http/installer/src/assembly/assemble_installer_zip.xml b/base/http/installer/src/assembly/assemble_installer_zip.xml new file mode 100644 index 000000000..3bed4b5ef --- /dev/null +++ b/base/http/installer/src/assembly/assemble_installer_zip.xml @@ -0,0 +1,59 @@ +<!-- + ============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========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>installer_zip</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>755</fileMode> + <includes> + <include>*.sh</include> + </includes> + </fileSet> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>644</fileMode> + <excludes> + <exclude>*.sh</exclude> + </excludes> + </fileSet> + </fileSets> + + + +</assembly> diff --git a/base/http/installer/src/assembly/assemble_mvnrepo_zip.xml b/base/http/installer/src/assembly/assemble_mvnrepo_zip.xml new file mode 100644 index 000000000..35e79db18 --- /dev/null +++ b/base/http/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -0,0 +1,49 @@ +<!-- + ============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========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>repo</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/assembly/</directory> + <outputDirectory>.</outputDirectory> + <excludes> + </excludes> + </fileSet> + </fileSets> + + + +</assembly> diff --git a/base/http/installer/src/main/resources/scripts/install-feature.sh b/base/http/installer/src/main/resources/scripts/install-feature.sh new file mode 100644 index 000000000..6e3d4169d --- /dev/null +++ b/base/http/installer/src/main/resources/scripts/install-feature.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +### +# ============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========================================================= +### + +ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} +ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client} +INSTALLERDIR=$(dirname $0) + +REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip + +if [ -f ${REPOZIP} ] +then + unzip -nd ${ODL_HOME} ${REPOZIP} +else + echo "ERROR : repo zip ($REPOZIP) not found" + exit 1 +fi + +${ODL_KARAF_CLIENT} feature:repo-add ${features.repositories} +${ODL_KARAF_CLIENT} feature:install ${features.boot} diff --git a/base/http/pom.xml b/base/http/pom.xml new file mode 100644 index 000000000..368e3fb18 --- /dev/null +++ b/base/http/pom.xml @@ -0,0 +1,22 @@ +<?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.3.2</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.adaptors.base</groupId> + <artifactId>http</artifactId> + <version>0.5.1-SNAPSHOT</version> + <packaging>pom</packaging> + + <modules> + <module>provider</module> + <module>features</module> + <module>installer</module> + </modules> +</project> diff --git a/base/http/provider/pom.xml b/base/http/provider/pom.xml new file mode 100644 index 000000000..4cbe85c13 --- /dev/null +++ b/base/http/provider/pom.xml @@ -0,0 +1,36 @@ +<?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>binding-parent</artifactId> + <version>1.3.2</version> + <relativePath /> + </parent> + + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>base-http-provider</artifactId> + <version>0.5.1-SNAPSHOT</version> + <packaging>bundle</packaging> + + <dependencies> + <dependency> + <groupId>javax.ws.rs</groupId> + <artifactId>javax.ws.rs-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.core</groupId> + <artifactId>jersey-client</artifactId> + <version>${jersey.version}</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/base/http/provider/src/main/java/org/onap/ccsdk/sli/adaptors/base/http/AbstractHttpAdapter.java b/base/http/provider/src/main/java/org/onap/ccsdk/sli/adaptors/base/http/AbstractHttpAdapter.java new file mode 100644 index 000000000..fda4bafba --- /dev/null +++ b/base/http/provider/src/main/java/org/onap/ccsdk/sli/adaptors/base/http/AbstractHttpAdapter.java @@ -0,0 +1,109 @@ +package org.onap.ccsdk.sli.adaptors.base.http; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Properties; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLSession; +import javax.ws.rs.client.ClientBuilder; +import javax.xml.bind.DatatypeConverter; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public abstract class AbstractHttpAdapter { + protected static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR"; + private static final String SDNC_CONFIG_DIR_DEFAULT = "/opt/sdnc/data/properties"; + protected static final int DEFAULT_HTTP_CONNECT_TIMEOUT_MS = 60000; // 1 minute + protected static final int DEFAULT_HTTP_READ_TIMEOUT_MS = 1800000; // 30 minutes + protected ClientBuilder clientBuilder; + + private static final Logger logger = LoggerFactory.getLogger(AbstractHttpAdapter.class); + + public AbstractHttpAdapter() { + clientBuilder = ClientBuilder.newBuilder(); + setTimeouts(); + registerLoggingFilter(); + defaultHostNameVerifier(); + } + + private void defaultHostNameVerifier() { + clientBuilder.hostnameVerifier(new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }); + } + + protected abstract void registerLoggingFilter(); + + private void setTimeouts() { + Integer httpReadTimeout = readOptionalInteger("HTTP_READ_TIMEOUT_MS", DEFAULT_HTTP_READ_TIMEOUT_MS); + Integer httpConnectTimeout = readOptionalInteger("HTTP_CONNECT_TIMEOUT_MS", DEFAULT_HTTP_CONNECT_TIMEOUT_MS); + + // restore once we migrate to once we migrate to javax.ws.rs-api 2.1 + // clientBuilder.connectTimeout(30, TimeUnit.SECONDS); + // clientBuilder.readTimeout(30, TimeUnit.SECONDS); + + // Setting jersey specific properties is ugly, such behavior should be removed + // once we migrate to javax.ws.rs-api 2.1 + clientBuilder.property("jersey.config.client.readTimeout", httpReadTimeout); + clientBuilder.property("jersey.config.client.connectTimeout", httpConnectTimeout); + } + + public Properties getProperties(String propertiesFileName) throws FileNotFoundException, IOException { + // Check System property, then environment variable then default if null + String propDir = System.getProperty(SDNC_CONFIG_DIR); + if (propDir == null || propDir.length() < 1) { + propDir = System.getenv(SDNC_CONFIG_DIR); + } + if (propDir == null || propDir.length() < 1) { + propDir = SDNC_CONFIG_DIR_DEFAULT; + } + Properties properties = new Properties(); + // forward slash is checked to support path src/test/resources on windows machine + if (!propDir.endsWith(File.separator) && !propDir.endsWith("/")) { + propDir = propDir + File.separator; + } + String path = propDir + propertiesFileName; + properties.load(new FileInputStream(path)); + logger.trace("Initialized properties from ({}) properties ({})", path, properties); + return properties; + } + + protected void addBasicAuthCredentials(String username, String password) { + String basicAuthValue = getBasicAuthValue(username,password); + clientBuilder.register(new BasicAuthFilter(basicAuthValue)); + } + + protected String getBasicAuthValue(String userName, String password) { + String token = userName + ":" + password; + try { + return "BASIC " + DatatypeConverter.printBase64Binary(token.getBytes("UTF-8")); + } catch (Exception e) { + logger.error("getBasicAuthValue threw an exception, credentials will be null", e); + } + return null; + } + + public ClientBuilder getClientBuilder() { + return clientBuilder; + } + + private Integer readOptionalInteger(String propertyName, Integer defaultValue) { + String stringValue = System.getProperty(propertyName); + if (stringValue != null && stringValue.length() > 0) { + try { + return Integer.valueOf(stringValue); + } catch (NumberFormatException e) { + logger.warn("property " + propertyName + " had the value " + stringValue + " that could not be converted to an Integer, default " + defaultValue + " will be used instead", e); + } + } + return defaultValue; + } + +} diff --git a/base/http/provider/src/main/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilter.java b/base/http/provider/src/main/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilter.java new file mode 100644 index 000000000..48d996ef3 --- /dev/null +++ b/base/http/provider/src/main/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilter.java @@ -0,0 +1,24 @@ +package org.onap.ccsdk.sli.adaptors.base.http; + +import java.io.IOException; + +import javax.ws.rs.client.ClientRequestContext; +import javax.ws.rs.client.ClientRequestFilter; +import javax.ws.rs.core.MultivaluedMap; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class BasicAuthFilter implements ClientRequestFilter { + private final String basicAuthValue; + + + public BasicAuthFilter(String basicAuthValue) { + this.basicAuthValue = basicAuthValue; + } + + public void filter(ClientRequestContext requestContext) throws IOException { + MultivaluedMap<String, Object> headers = requestContext.getHeaders(); + headers.add("Authorization", basicAuthValue); + } +} diff --git a/base/http/provider/src/test/java/org/onap/ccsdk/sli/adaptors/base/http/AbstractHttpAdapterTest.java b/base/http/provider/src/test/java/org/onap/ccsdk/sli/adaptors/base/http/AbstractHttpAdapterTest.java new file mode 100644 index 000000000..ee2d223d3 --- /dev/null +++ b/base/http/provider/src/test/java/org/onap/ccsdk/sli/adaptors/base/http/AbstractHttpAdapterTest.java @@ -0,0 +1,47 @@ +package org.onap.ccsdk.sli.adaptors.base.http;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.Properties;
+import java.util.Set;
+
+import javax.ws.rs.client.Client;
+
+import org.junit.Test;
+
+public class AbstractHttpAdapterTest {
+
+ public class NonLoggingHttpAdapter extends AbstractHttpAdapter {
+ @Override
+ protected void registerLoggingFilter() {
+ // nonlogging, do nothing
+ }
+ }
+
+ @Test
+ public void checkTimeouts() throws Exception {
+ NonLoggingHttpAdapter adapter = new NonLoggingHttpAdapter();
+ Client client = adapter.getClientBuilder().build();
+ assertNotNull(client.getConfiguration().getProperty("jersey.config.client.readTimeout"));
+ assertNotNull(client.getConfiguration().getProperty("jersey.config.client.connectTimeout"));
+ }
+
+ @Test
+ public void propertiesTest() throws Exception {
+ System.setProperty(AbstractHttpAdapter.SDNC_CONFIG_DIR, "src/test/resources/");
+ NonLoggingHttpAdapter adapter = new NonLoggingHttpAdapter();
+ Properties props = adapter.getProperties("testprops.properties");
+ assertNotNull(props);
+ assertEquals("world", props.get("hello"));
+ }
+
+ @Test
+ public void basicAuthFilter() throws Exception {
+ NonLoggingHttpAdapter adapter = new NonLoggingHttpAdapter();
+ adapter.addBasicAuthCredentials("hello", "world");
+ Set<Object> objs = adapter.getClientBuilder().getConfiguration().getInstances();
+ assertEquals(BasicAuthFilter.class,objs.iterator().next().getClass());
+ }
+
+}
diff --git a/base/http/provider/src/test/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilterTest.java b/base/http/provider/src/test/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilterTest.java new file mode 100644 index 000000000..b9565ba67 --- /dev/null +++ b/base/http/provider/src/test/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilterTest.java @@ -0,0 +1,20 @@ +package org.onap.ccsdk.sli.adaptors.base.http; + +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; + +public class BasicAuthFilterTest { + + @Test + public void notNullParameters() throws Exception { + BasicAuthFilter myFilter = new BasicAuthFilter("helloworld"); + assertNotNull(myFilter); + } + + @Test + public void nullParameters() throws Exception { + BasicAuthFilter myFilter = new BasicAuthFilter(null); + assertNotNull(myFilter); + } +} diff --git a/base/http/provider/src/test/resources/testprops.properties b/base/http/provider/src/test/resources/testprops.properties new file mode 100644 index 000000000..3f602680e --- /dev/null +++ b/base/http/provider/src/test/resources/testprops.properties @@ -0,0 +1 @@ +hello = world
\ No newline at end of file diff --git a/base/pom.xml b/base/pom.xml new file mode 100644 index 000000000..eb18d160a --- /dev/null +++ b/base/pom.xml @@ -0,0 +1,21 @@ +<?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.ccsdk.parent</groupId> + <artifactId>odlparent-lite</artifactId> + <version>1.3.2</version> + <relativePath/> + </parent> + + <modelVersion>4.0.0</modelVersion> + <packaging>pom</packaging> + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>base-parent</artifactId> + <version>0.5.1-SNAPSHOT</version> + + <modules> + <module>http</module> + </modules> + +</project> diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index 082209701..47a431464 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -80,5 +80,12 @@ <type>xml</type> <classifier>features</classifier> </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>ccsdk-base-http</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>features</classifier> + </dependency> </dependencies> </project> diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index 60c45b95b..cbaee2570 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -29,8 +29,8 @@ <version>${ccsdk.sli.core.version}</version> <type>xml</type> <classifier>features</classifier> + <scope>provided</scope> </dependency> - <dependency> <groupId>${project.groupId}</groupId> <artifactId>mdsal-resource-provider</artifactId> diff --git a/message-router/publisher/provider/src/main/java/org/onap/ccsdk/sli/adaptors/messagerouter/publisher/provider/impl/PublisherApiImpl.java b/message-router/publisher/provider/src/main/java/org/onap/ccsdk/sli/adaptors/messagerouter/publisher/provider/impl/PublisherApiImpl.java index 58d0bc9f1..4efb77c5a 100755 --- a/message-router/publisher/provider/src/main/java/org/onap/ccsdk/sli/adaptors/messagerouter/publisher/provider/impl/PublisherApiImpl.java +++ b/message-router/publisher/provider/src/main/java/org/onap/ccsdk/sli/adaptors/messagerouter/publisher/provider/impl/PublisherApiImpl.java @@ -1,3 +1,25 @@ +/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
+ * ===========================================================================
+ * 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.sli.adaptors.messagerouter.publisher.provider.impl;
import java.io.BufferedReader;
@@ -16,8 +38,8 @@ import org.slf4j.LoggerFactory; public class PublisherApiImpl implements PublisherApi {
private static final Logger logger = LoggerFactory.getLogger(PublisherApiImpl.class);
- protected final Integer DEFAULT_CONNECT_TIMEOUT = 30000; // will be treated as 30 seconds
- protected final Integer DEFAULT_READ_TIMEOUT = 180000; // will be treated as 3 minutes
+ protected static final Integer DEFAULT_CONNECT_TIMEOUT = 30000; // will be treated as 30 seconds
+ protected static final Integer DEFAULT_READ_TIMEOUT = 180000; // will be treated as 3 minutes
private String authorizationString;
protected Integer connectTimeout;
protected Integer readTimeout;
diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index 951b26629..c9d105b9e 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -31,36 +31,27 @@ <name>ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId}</name> - <properties> <ccsdk.sli.adaptors.version>${project.version}</ccsdk.sli.adaptors.version> </properties> - <dependencies> <dependency> - <groupId>org.opendaylight.controller</groupId> - <artifactId>odl-mdsal-broker</artifactId> - <type>xml</type> - <classifier>features</classifier> - </dependency> - - <dependency> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>ccsdk-sli</artifactId> <version>${ccsdk.sli.core.version}</version> <type>xml</type> <classifier>features</classifier> + <scope>provided</scope> </dependency> - <dependency> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>ccsdk-dblib</artifactId> <version>${ccsdk.sli.core.version}</version> <type>xml</type> <classifier>features</classifier> + <scope>provided</scope> </dependency> - <dependency> <groupId>${project.groupId}</groupId> <artifactId>netbox-client-provider</artifactId> diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index d01002ca3..c6237d38b 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -71,13 +71,13 @@ <dependency> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sli-common</artifactId> - <scope>compile</scope> + <scope>provided</scope> </dependency> <dependency> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sliPluginUtils-provider</artifactId> <version>${project.version}</version> - <scope>compile</scope> + <scope>provided</scope> </dependency> <dependency> <groupId>org.osgi</groupId> @@ -103,9 +103,10 @@ <module>mdsal-resource</module> <module>resource-assignment</module> <module>sql-resource</module> + <module>base</module> + <module>message-router</module> <module>features</module> <module>artifacts</module> - <module>message-router</module> </modules> <organization> <name>ONAP</name> diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java index 57796768f..83dab5418 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights * reserved. + * + * Modifications Copyright (C) 2019 IBM. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -227,8 +229,8 @@ public class EndPointAllocatorImpl implements EndPointAllocator { log.info("ResourceName:" + r.resourceKey.resourceName + " assetId:" + r.resourceKey.assetId); - ResourceData rd = getResourceData(r); - rdlist.add(rd); + + rdlist.add(getResourceData(r)); } return rdlist; diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index ebdfdb677..d863ca08f 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -66,10 +66,6 @@ <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - </dependency> <!-- Needed to run SSH --> <!-- VERSION CONFLICT !!!!! --> @@ -102,11 +98,13 @@ <dependency> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sli-common</artifactId> - </dependency> + <scope>provided</scope> + </dependency> <dependency> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sli-provider</artifactId> + <scope>provided</scope> </dependency> <dependency> |