aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-adapter-utils/pom.xml2
-rw-r--r--adapters/mso-adapters-rest-interface/pom.xml2
-rw-r--r--adapters/mso-catalog-db-adapter/pom.xml2
-rw-r--r--adapters/mso-nssmf-adapter/pom.xml149
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/MSONssmfApplication.java32
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/RequestDbConfig.java68
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/WebSecurityConfig.java37
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientPropertiesImpl.java69
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientProvider.java34
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProvider.java32
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java66
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/ErrorResponse.java63
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/TokenRequest.java54
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/TokenResponse.java44
-rw-r--r--adapters/mso-openstack-adapters/pom.xml2
-rw-r--r--adapters/mso-requests-db-adapter/pom.xml2
-rw-r--r--adapters/mso-sdnc-adapter/pom.xml2
-rw-r--r--adapters/mso-ve-vnfm-adapter/pom.xml2
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java40
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/EsrId.java45
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java5
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java15
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java11
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java57
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java9
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscriptionSchedulerTest.java69
-rw-r--r--adapters/mso-vfc-adapter/pom.xml2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java3
-rw-r--r--adapters/mso-vnfm-adapter/pom.xml2
-rw-r--r--adapters/pom.xml2
-rw-r--r--adapters/so-appc-orchestrator/pom.xml2
34 files changed, 864 insertions, 66 deletions
diff --git a/adapters/mso-adapter-utils/pom.xml b/adapters/mso-adapter-utils/pom.xml
index aa9a1cea9e..b8dec73f80 100644
--- a/adapters/mso-adapter-utils/pom.xml
+++ b/adapters/mso-adapter-utils/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-adapter-utils</artifactId>
diff --git a/adapters/mso-adapters-rest-interface/pom.xml b/adapters/mso-adapters-rest-interface/pom.xml
index 5f987e61ce..584c47fea6 100644
--- a/adapters/mso-adapters-rest-interface/pom.xml
+++ b/adapters/mso-adapters-rest-interface/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-adapters-rest-interface</artifactId>
diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml
index 9745935925..bcc523ab98 100644
--- a/adapters/mso-catalog-db-adapter/pom.xml
+++ b/adapters/mso-catalog-db-adapter/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so.adapters</groupId>
diff --git a/adapters/mso-nssmf-adapter/pom.xml b/adapters/mso-nssmf-adapter/pom.xml
new file mode 100644
index 0000000000..b6b52ce7c5
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/pom.xml
@@ -0,0 +1,149 @@
+<!--
+ ~*
+ ~============LICENSE_START=======================================================
+ ~* ONAP - SO
+ ~*================================================================================
+ ~* Copyright (C) 2020 Huawei Technologies Co., Ltd. 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=========================================================
+ ~*/
+ -->
+
+<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.so</groupId>
+ <artifactId>adapters</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>mso-nssmf-adapter</artifactId>
+ <packaging>jar</packaging>
+ <name>mso-nssmf-adapter</name>
+ <description>Web service endpoint for nssmf operations</description>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${springboot.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <build>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <configuration>
+ <mainClass>org.onap.so.adapters.nssmf.MSONssmfApplication</mainClass>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-jdbc</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-jdbc</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-spring-boot-starter-jaxws</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-service-description-swagger</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-data-jpa</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>mso-requests-db</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>mso-requests-db-repositories</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mariadb.jdbc</groupId>
+ <artifactId>mariadb-java-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>ch.vorburger.mariaDB4j</groupId>
+ <artifactId>mariaDB4j</artifactId>
+ <version>2.2.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-configuration-processor</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp3</groupId>
+ <artifactId>okhttp</artifactId>
+ <version>3.14.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>1.18.2</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/MSONssmfApplication.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/MSONssmfApplication.java
new file mode 100644
index 0000000000..cd011e6437
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/MSONssmfApplication.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.nssmf;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication(scanBasePackages = {"org.onap.so"})
+public class MSONssmfApplication {
+
+ public static void main(String... args) {
+ SpringApplication.run(MSONssmfApplication.class, args);
+ }
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/RequestDbConfig.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/RequestDbConfig.java
new file mode 100644
index 0000000000..484f7624aa
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/RequestDbConfig.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.nssmf;
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.jdbc.DataSourceBuilder;
+import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.context.annotation.Profile;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@Profile({"!test"})
+@Configuration
+@EnableTransactionManagement
+@EnableJpaRepositories(entityManagerFactoryRef = "requestEntityManagerFactory",
+ transactionManagerRef = "requestTransactionManager", basePackages = {"org.onap.so.db.request.data.repository"})
+public class RequestDbConfig {
+
+ @Primary
+ @Bean(name = "requestDataSource")
+ @ConfigurationProperties(prefix = "spring.datasource")
+ public DataSource dataSource() {
+ return DataSourceBuilder.create().build();
+ }
+
+ @Primary
+ @Bean(name = "requestEntityManagerFactory")
+ public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder,
+ @Qualifier("requestDataSource") DataSource dataSource) {
+ return builder.dataSource(dataSource).packages("org.onap.so.db.request.beans").persistenceUnit("requestDB")
+ .build();
+ }
+
+ @Primary
+ @Bean(name = "requestTransactionManager")
+ public PlatformTransactionManager transactionManager(
+ @Qualifier("requestEntityManagerFactory") EntityManagerFactory entityManagerFactory) {
+ return new JpaTransactionManager(entityManagerFactory);
+ }
+
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/WebSecurityConfig.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/WebSecurityConfig.java
new file mode 100644
index 0000000000..1522ca9c6d
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/WebSecurityConfig.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.nssmf;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+
+@EnableWebSecurity
+@Configuration
+public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
+
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+ http.csrf().disable();
+ }
+
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientPropertiesImpl.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientPropertiesImpl.java
new file mode 100644
index 0000000000..3333c64cd8
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientPropertiesImpl.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.nssmf.extclients.aai;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.onap.so.client.aai.AAIProperties;
+import org.onap.so.client.aai.AAIVersion;
+import org.onap.so.spring.SpringContextHelper;
+import org.springframework.context.ApplicationContext;
+
+public class AaiClientPropertiesImpl implements AAIProperties {
+
+ private final String endpoint;
+
+ private final String encryptedBasicAuth;
+
+ private final String encrytptionKey;
+
+ public AaiClientPropertiesImpl() {
+ final ApplicationContext context = SpringContextHelper.getAppContext();
+ this.endpoint = context.getEnvironment().getProperty("aai.endpoint");
+ this.encryptedBasicAuth = context.getEnvironment().getProperty("aai.auth");
+ this.encrytptionKey = context.getEnvironment().getProperty("mso.key");
+ }
+
+ @Override
+ public AAIVersion getDefaultVersion() {
+ return AAIVersion.LATEST;
+ }
+
+ @Override
+ public String getAuth() {
+ return encryptedBasicAuth;
+ }
+
+ @Override
+ public String getKey() {
+ return encrytptionKey;
+ }
+
+ @Override
+ public URL getEndpoint() throws MalformedURLException {
+ return new URL(endpoint);
+ }
+
+ @Override
+ public String getSystemName() {
+ return "MSO";
+ }
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientProvider.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientProvider.java
new file mode 100644
index 0000000000..48e3ef1666
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientProvider.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.nssmf.extclients.aai;
+
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class AaiClientProvider {
+
+ @Bean
+ public AAIResourcesClient getAaiClient() {
+ return new AAIResourcesClient();
+ }
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProvider.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProvider.java
new file mode 100644
index 0000000000..c737ba6440
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProvider.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.nssmf.extclients.aai;
+
+import org.onap.aai.domain.yang.EsrSystemInfoList;
+import org.onap.aai.domain.yang.EsrThirdpartySdncList;
+
+public interface AaiServiceProvider {
+
+ EsrThirdpartySdncList invokeGetThirdPartySdncList();
+
+ EsrSystemInfoList invokeGetThirdPartySdncEsrSystemInfo(String sdncId);
+
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java
new file mode 100644
index 0000000000..f8422e2a8f
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.nssmf.extclients.aai;
+
+
+import org.onap.aai.domain.yang.EsrSystemInfoList;
+import org.onap.aai.domain.yang.EsrThirdpartySdncList;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class AaiServiceProviderImpl implements AaiServiceProvider {
+
+ private static final Logger logger = LoggerFactory.getLogger(AaiServiceProviderImpl.class);
+
+ private final AaiClientProvider aaiClientProvider;
+
+ @Autowired
+ public AaiServiceProviderImpl(final AaiClientProvider aaiClientProvider) {
+ this.aaiClientProvider = aaiClientProvider;
+ }
+
+ @Override
+ public EsrThirdpartySdncList invokeGetThirdPartySdncList() {
+ return aaiClientProvider.getAaiClient()
+ .get(EsrThirdpartySdncList.class, AAIUriFactory.createResourceUri(AAIObjectType.THIRDPARTY_SDNC_LIST))
+ .orElseGet(() -> {
+ logger.debug("No VNFMs in AAI");
+ return null;
+ });
+ }
+
+ @Override
+ public EsrSystemInfoList invokeGetThirdPartySdncEsrSystemInfo(String sdncId) {
+ return aaiClientProvider.getAaiClient()
+ .get(EsrSystemInfoList.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.THIRDPARTY_SDNC_SYSTEM_INFO_LIST, sdncId))
+ .orElseGet(() -> {
+ logger.debug("VNFM not found in AAI");
+ return null;
+ });
+ }
+
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/ErrorResponse.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/ErrorResponse.java
new file mode 100644
index 0000000000..188349c0bf
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/ErrorResponse.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.nssmf.model;
+
+public class ErrorResponse {
+
+ private int status;
+
+ private String error;
+
+ private String message;
+
+ public ErrorResponse(int status, String message) {
+ this.status = status;
+ this.message = message;
+ this.error = "Bad Request";
+ }
+
+ public int getStatus() {
+ return status;
+ }
+
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
+ public String getError() {
+ if (status == 500) {
+ this.error = "Internal Server Error";
+ }
+ return error;
+ }
+
+ public void setError(String error) {
+ this.error = error;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/TokenRequest.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/TokenRequest.java
new file mode 100644
index 0000000000..3590c683e6
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/TokenRequest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.nssmf.model;
+
+public class TokenRequest {
+
+ private String grantType;
+
+ private String userName;
+
+ private String value;
+
+ public String getGrantType() {
+ return grantType;
+ }
+
+ public void setGrantType(String grantType) {
+ this.grantType = grantType;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/TokenResponse.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/TokenResponse.java
new file mode 100644
index 0000000000..8007075e04
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/TokenResponse.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.nssmf.model;
+
+public class TokenResponse {
+
+ private String accessToken;
+
+ private int expires;
+
+ public String getAccessToken() {
+ return accessToken;
+ }
+
+ public void setAccessToken(String accessToken) {
+ this.accessToken = accessToken;
+ }
+
+ public int getExpires() {
+ return expires;
+ }
+
+ public void setExpires(int expires) {
+ this.expires = expires;
+ }
+}
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index f0c066aa05..a668b42106 100644
--- a/adapters/mso-openstack-adapters/pom.xml
+++ b/adapters/mso-openstack-adapters/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>mso-openstack-adapters</artifactId>
<packaging>jar</packaging>
diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml
index 366a207d60..2354272756 100644
--- a/adapters/mso-requests-db-adapter/pom.xml
+++ b/adapters/mso-requests-db-adapter/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so.adapters</groupId>
diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml
index 07c8ed5eab..7fd1aa62d4 100644
--- a/adapters/mso-sdnc-adapter/pom.xml
+++ b/adapters/mso-sdnc-adapter/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>mso-sdnc-adapter</artifactId>
<properties>
diff --git a/adapters/mso-ve-vnfm-adapter/pom.xml b/adapters/mso-ve-vnfm-adapter/pom.xml
index d58f183ab0..3d054d9eca 100644
--- a/adapters/mso-ve-vnfm-adapter/pom.xml
+++ b/adapters/mso-ve-vnfm-adapter/pom.xml
@@ -8,7 +8,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so.adapters</groupId>
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java
index a2bd603ae6..9b2a8c3d62 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java
@@ -20,6 +20,8 @@
package org.onap.so.adapters.vevnfm.aai;
+import java.util.Collections;
+import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import org.apache.logging.log4j.util.Strings;
@@ -43,27 +45,27 @@ public class AaiConnection {
private static final int FIRST_INDEX = 0;
- private static void isValid(final EsrSystemInfo info) throws VeVnfmException {
- if (info == null || Strings.isBlank(info.getServiceUrl())) {
+ private static void isValid(final List<EsrSystemInfo> infos) throws VeVnfmException {
+ if (infos == null || infos.isEmpty() || Strings.isBlank(infos.get(FIRST_INDEX).getServiceUrl())) {
throw new VeVnfmException("No 'url' field in VNFM info");
}
}
- public EsrSystemInfo receiveVnfm() throws VeVnfmException {
- EsrSystemInfo info;
+ public List<EsrSystemInfo> receiveVnfm() throws VeVnfmException {
+ List<EsrSystemInfo> infos;
try {
- info = receiveVnfmInternal();
+ infos = receiveVnfmInternal();
} catch (Exception e) {
throw new VeVnfmException(e);
}
- isValid(info);
+ isValid(infos);
- return info;
+ return infos;
}
- private EsrSystemInfo receiveVnfmInternal() {
+ private List<EsrSystemInfo> receiveVnfmInternal() {
final AAIResourcesClient resourcesClient = new AAIResourcesClient();
final AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VNFM_LIST);
final Optional<EsrVnfmList> response = resourcesClient.get(EsrVnfmList.class, resourceUri);
@@ -73,33 +75,29 @@ public class AaiConnection {
logger.info("The VNFM replied with: {}", esrVnfmList);
final List<EsrVnfm> esrVnfm = esrVnfmList.getEsrVnfm();
- if (esrVnfm.isEmpty()) {
- return null;
+ final List<EsrSystemInfo> infos = new LinkedList<>();
+
+ for (final EsrVnfm vnfm : esrVnfm) {
+ final String vnfmId = vnfm.getVnfmId();
+ infos.addAll(receiveVnfmServiceUrl(resourcesClient, vnfmId));
}
- final String vnfmId = esrVnfm.get(FIRST_INDEX).getVnfmId();
- return receiveVnfmServiceUrl(resourcesClient, vnfmId);
+ return infos;
}
return null;
}
- private EsrSystemInfo receiveVnfmServiceUrl(final AAIResourcesClient resourcesClient, final String vnfmId) {
+ private List<EsrSystemInfo> receiveVnfmServiceUrl(final AAIResourcesClient resourcesClient, final String vnfmId) {
final Optional<EsrVnfm> response = resourcesClient.get(EsrVnfm.class,
AAIUriFactory.createResourceUri(AAIObjectType.VNFM, vnfmId).depth(Depth.ONE));
if (response.isPresent()) {
final EsrVnfm esrVnfm = response.get();
logger.info("The VNFM replied with: {}", esrVnfm);
- final List<EsrSystemInfo> esrSystemInfo = esrVnfm.getEsrSystemInfoList().getEsrSystemInfo();
-
- if (esrSystemInfo.isEmpty()) {
- return null;
- }
-
- return esrSystemInfo.get(FIRST_INDEX);
+ return esrVnfm.getEsrSystemInfoList().getEsrSystemInfo();
}
- return null;
+ return Collections.emptyList();
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/EsrId.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/EsrId.java
new file mode 100644
index 0000000000..13ff2b6397
--- /dev/null
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/EsrId.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SO
+ * ================================================================================
+ * Copyright (C) 2020 Samsung. 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.so.adapters.vevnfm.aai;
+
+import org.onap.aai.domain.yang.EsrSystemInfo;
+
+public class EsrId {
+
+ private EsrSystemInfo info;
+ private String id;
+
+ public EsrSystemInfo getInfo() {
+ return info;
+ }
+
+ public void setInfo(final EsrSystemInfo info) {
+ this.info = info;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(final String id) {
+ this.id = id;
+ }
+}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java
index ae330f7ed6..c033fc3f96 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java
@@ -20,6 +20,7 @@
package org.onap.so.adapters.vevnfm.configuration;
+import java.util.List;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.so.adapters.vevnfm.service.StartupService;
import org.onap.so.adapters.vevnfm.service.SubscriptionScheduler;
@@ -47,8 +48,8 @@ public class StartupConfiguration {
@EventListener(ApplicationReadyEvent.class)
public void onApplicationReadyEvent() throws Exception {
if (!environment.acceptsProfiles(Profiles.of(TEST_PROFILE))) {
- final EsrSystemInfo info = startupService.receiveVnfm();
- subscriptionScheduler.setInfo(info);
+ final List<EsrSystemInfo> infos = startupService.receiveVnfm();
+ subscriptionScheduler.setInfos(infos);
}
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java
index 59397cead3..36a4c3300d 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java
@@ -25,12 +25,15 @@ public class DmaapService {
private HttpRestServiceProvider restProvider;
public void send(final VnfLcmOperationOccurrenceNotification notification) {
- final ResponseEntity<String> response = restProvider.postHttpRequest(notification, getUrl(), String.class);
-
- final HttpStatus statusCode = response.getStatusCode();
- final String body = response.getBody();
-
- logger.info("The DMaaP replied with the code {} and the body {}", statusCode, body);
+ try {
+ final ResponseEntity<String> response = restProvider.postHttpRequest(notification, getUrl(), String.class);
+ final HttpStatus statusCode = response.getStatusCode();
+ final String body = response.getBody();
+
+ logger.info("The DMaaP replied with the code {} and the body {}", statusCode, body);
+ } catch (Exception e) {
+ logger.warn("An issue connecting to DMaaP", e);
+ }
}
private String getUrl() {
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java
index 3d215148f2..92906ef35c 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java
@@ -20,6 +20,8 @@
package org.onap.so.adapters.vevnfm.service;
+import java.util.Collections;
+import java.util.List;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.so.adapters.vevnfm.aai.AaiConnection;
import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
@@ -45,18 +47,17 @@ public class StartupService {
@Autowired
private AaiConnection aaiConnection;
- @Retryable(value = {VeVnfmException.class}, maxAttempts = 5, backoff = @Backoff(delay = 5000, multiplier = 10))
- public EsrSystemInfo receiveVnfm() throws VeVnfmException {
+ @Retryable(value = {Exception.class}, maxAttempts = 5, backoff = @Backoff(delay = 5000, multiplier = 2))
+ public List<EsrSystemInfo> receiveVnfm() throws VeVnfmException {
return aaiConnection.receiveVnfm();
}
@Recover
- public EsrSystemInfo recoverReceiveVnfm(final Throwable e) {
+ public List<EsrSystemInfo> recoverReceiveVnfm(final Throwable t) {
logger.warn("Connection to AAI failed");
final EsrSystemInfo info = new EsrSystemInfo();
info.setServiceUrl(vnfmDefaultEndpoint);
logger.warn("This EsrSystemInfo is used by default: {}", info);
-
- return info;
+ return Collections.singletonList(info);
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java
index 16427437fc..d9f3acc3df 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java
@@ -20,7 +20,10 @@
package org.onap.so.adapters.vevnfm.service;
+import java.util.LinkedList;
+import java.util.List;
import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.so.adapters.vevnfm.aai.EsrId;
import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -38,33 +41,57 @@ public class SubscriptionScheduler {
@Autowired
private SubscriberService subscriberService;
- private String subscribedId;
+ private List<EsrId> esrIds;
- private EsrSystemInfo info;
+ public void setInfos(final List<EsrSystemInfo> infos) {
+ esrIds = new LinkedList<>();
- public void setInfo(final EsrSystemInfo info) {
- this.info = info;
+ for (final EsrSystemInfo info : infos) {
+ final EsrId esrId = new EsrId();
+ esrId.setInfo(info);
+ esrIds.add(esrId);
+ }
+ }
+
+ List<EsrId> getEsrIds() {
+ return esrIds;
}
@Scheduled(fixedRate = 5000, initialDelay = 2000)
void subscribeTask() throws VeVnfmException {
- if (info != null) {
- if (subscribedId == null) {
- logger.info("Starting subscribe task");
- subscribedId = subscriberService.subscribe(info);
+ if (isEsrIdsValid()) {
+ for (final EsrId esrId : esrIds) {
+ singleSubscribe(esrId);
}
}
}
@Scheduled(fixedRate = 20000)
void checkSubscribeTask() throws VeVnfmException {
- if (info != null) {
- if (subscribedId != null) {
- logger.info("Checking subscription: {}", subscribedId);
- if (!subscriberService.checkSubscription(info, subscribedId)) {
- logger.info("Subscription {} not available", subscribedId);
- subscribedId = null;
- }
+ if (isEsrIdsValid()) {
+ for (final EsrId esrId : esrIds) {
+ singleCheckSubscription(esrId);
+ }
+ }
+ }
+
+ private boolean isEsrIdsValid() {
+ return esrIds != null && !esrIds.isEmpty();
+ }
+
+ private void singleSubscribe(final EsrId esrId) throws VeVnfmException {
+ if (esrId.getId() == null) {
+ logger.info("Single subscribe task");
+ esrId.setId(subscriberService.subscribe(esrId.getInfo()));
+ }
+ }
+
+ private void singleCheckSubscription(final EsrId esrId) throws VeVnfmException {
+ if (esrId.getId() != null) {
+ logger.info("Checking subscription: {}", esrId.getId());
+ if (!subscriberService.checkSubscription(esrId.getInfo(), esrId.getId())) {
+ logger.info("Subscription {} not available", esrId.getId());
+ esrId.setId(null);
}
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java
index d1d34a706f..9b18cf96dc 100644
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java
+++ b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java
@@ -23,6 +23,8 @@ package org.onap.so.adapters.vevnfm.service;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import java.util.Collections;
+import java.util.List;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -52,14 +54,15 @@ public class StartupServiceTest {
// given
final EsrSystemInfo info = new EsrSystemInfo();
info.setServiceUrl(URL);
+ final List<EsrSystemInfo> infos = Collections.singletonList(info);
- when(aaiConnection.receiveVnfm()).thenReturn(info);
+ when(aaiConnection.receiveVnfm()).thenReturn(infos);
// when
- final EsrSystemInfo systemInfo = startupService.receiveVnfm();
+ final List<EsrSystemInfo> systemInfo = startupService.receiveVnfm();
// then
verify(aaiConnection).receiveVnfm();
- assertEquals(info, systemInfo);
+ assertEquals(infos, systemInfo);
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscriptionSchedulerTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscriptionSchedulerTest.java
new file mode 100644
index 0000000000..d3da7c86ec
--- /dev/null
+++ b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscriptionSchedulerTest.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SO
+ * ================================================================================
+ * Copyright (C) 2020 Samsung. 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.so.adapters.vevnfm.service;
+
+import static org.junit.Assert.assertNull;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import java.util.Collections;
+import java.util.List;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.EsrSystemInfo;
+
+@RunWith(MockitoJUnitRunner.class)
+public class SubscriptionSchedulerTest {
+
+ private static final String URL = "url";
+ private static final String ID = "id044";
+
+ @Mock
+ private SubscriberService subscriberService;
+
+ @InjectMocks
+ private SubscriptionScheduler subscriptionScheduler;
+
+ @Test
+ public void testFullScenario() throws Exception {
+ // given
+ final EsrSystemInfo info = new EsrSystemInfo();
+ info.setServiceUrl(URL);
+ final List<EsrSystemInfo> infos = Collections.singletonList(info);
+
+ when(subscriberService.subscribe(eq(info))).thenReturn(ID);
+ when(subscriberService.checkSubscription(eq(info), eq(ID))).thenReturn(false);
+
+ // when
+ subscriptionScheduler.setInfos(infos);
+ subscriptionScheduler.subscribeTask();
+ subscriptionScheduler.checkSubscribeTask();
+
+ // then
+ verify(subscriberService).subscribe(info);
+ verify(subscriberService).checkSubscription(info, ID);
+
+ assertNull(subscriptionScheduler.getEsrIds().get(0).getId());
+ }
+}
diff --git a/adapters/mso-vfc-adapter/pom.xml b/adapters/mso-vfc-adapter/pom.xml
index 09dd512629..451831f966 100644
--- a/adapters/mso-vfc-adapter/pom.xml
+++ b/adapters/mso-vfc-adapter/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-vfc-adapter</artifactId>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
index bf293e5f4b..bb322eb1d8 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-vnfm-adapter</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>mso-vnfm-adapter-api</artifactId>
<properties>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
index 8e2cfd2be4..a643aaa5b8 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-vnfm-adapter</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>mso-vnfm-adapter-ext-clients</artifactId>
<properties>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
index bc491a6fc5..66b1d2e12e 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-vnfm-adapter</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>mso-vnfm-etsi-adapter</artifactId>
<properties>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java
index 8012f7e6cf..322251e753 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.onap.so.adapters.vnfmadapter.Constants.ETSI_SUBSCRIPTION_NOTIFICATION_CONTROLLER_BASE_URL;
import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import static org.springframework.test.annotation.DirtiesContext.ClassMode.BEFORE_CLASS;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.*;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
@@ -57,6 +58,7 @@ import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.http.*;
+import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.client.MockRestServiceServer;
@@ -74,6 +76,7 @@ import com.google.gson.GsonBuilder;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
+@DirtiesContext(classMode = BEFORE_CLASS)
public class EtsiSubscriptionNotificationControllerTest {
@LocalServerPort
diff --git a/adapters/mso-vnfm-adapter/pom.xml b/adapters/mso-vnfm-adapter/pom.xml
index 962b3b4fb7..3e295aa184 100644
--- a/adapters/mso-vnfm-adapter/pom.xml
+++ b/adapters/mso-vnfm-adapter/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-vnfm-adapter</artifactId>
diff --git a/adapters/pom.xml b/adapters/pom.xml
index b96c3744c3..8acc7012ba 100644
--- a/adapters/pom.xml
+++ b/adapters/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>adapters</artifactId>
diff --git a/adapters/so-appc-orchestrator/pom.xml b/adapters/so-appc-orchestrator/pom.xml
index 717bcee3fc..e8e5808eca 100644
--- a/adapters/so-appc-orchestrator/pom.xml
+++ b/adapters/so-appc-orchestrator/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so.adapters</groupId>