aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-ve-vnfm-adapter
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-ve-vnfm-adapter')
-rw-r--r--adapters/mso-ve-vnfm-adapter/pom.xml89
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/Application.java36
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java123
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiPropertiesExt.java67
-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/ApplicationConfiguration.java44
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java55
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/constant/VnfNotificationFilterType.java41
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java69
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/AaiEvent.java44
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/DmaapEvent.java110
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java32
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java39
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java70
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java63
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscribeSender.java83
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java121
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java98
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/VnfAaiChecker.java51
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties1
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml56
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java90
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java86
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java68
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscribeSenderTest.java102
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscriptionSchedulerTest.java69
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/VnfAaiCheckerTest.java87
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/resources/application.yaml56
28 files changed, 0 insertions, 1895 deletions
diff --git a/adapters/mso-ve-vnfm-adapter/pom.xml b/adapters/mso-ve-vnfm-adapter/pom.xml
deleted file mode 100644
index 3d054d9eca..0000000000
--- a/adapters/mso-ve-vnfm-adapter/pom.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?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.so</groupId>
- <artifactId>adapters</artifactId>
- <version>1.6.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-ve-vnfm-adapter</artifactId>
- <packaging>jar</packaging>
-
- <name>mso-ve-vnfm-adapter</name>
- <description>Ve-Vnfm (SOL002) Adapter</description>
-
- <properties>
- <java.version>1.8</java.version>
- <maven.compiler.source>${java.version}</maven.compiler.source>
- <maven.compiler.target>${java.version}</maven.compiler.target>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.retry</groupId>
- <artifactId>spring-retry</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-vnfm-adapter-ext-clients</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>jersey-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>jersey-client</artifactId>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.inject</groupId>
- <artifactId>jersey-hk2</artifactId>
- </dependency>
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <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.vevnfm.Application</mainClass>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>repackage</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/Application.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/Application.java
deleted file mode 100644
index 875fddd7f0..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/Application.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SO
- * ================================================================================
- * Copyright (C) 2019 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;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication(scanBasePackages = {"org.onap.so"})
-public class Application {
-
- public static final String BASIC_PROFILE = "basic";
-
- public static void main(final String... args) {
- final SpringApplication springApplication = new SpringApplication(Application.class);
- springApplication.setAdditionalProfiles(BASIC_PROFILE);
- springApplication.run(args);
- }
-}
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
deleted file mode 100644
index fd20a0f78e..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*-
- * ============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 java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Optional;
-import org.apache.logging.log4j.util.Strings;
-import org.onap.aai.domain.yang.EsrSystemInfo;
-import org.onap.aai.domain.yang.EsrSystemInfoList;
-import org.onap.aai.domain.yang.EsrVnfm;
-import org.onap.aai.domain.yang.EsrVnfmList;
-import org.onap.aai.domain.yang.v18.GenericVnf;
-import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.aai.AAIResourcesClient;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.graphinventory.entities.uri.Depth;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-@Service
-public class AaiConnection {
-
- private static final Logger logger = LoggerFactory.getLogger(AaiConnection.class);
-
- private static final int FIRST_INDEX = 0;
-
- 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 List<EsrSystemInfo> receiveVnfm() throws VeVnfmException {
- List<EsrSystemInfo> infos;
-
- try {
- infos = receiveVnfmInternal();
- } catch (Exception e) {
- throw new VeVnfmException(e);
- }
-
- isValid(infos);
-
- return infos;
- }
-
- 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);
-
- if (response.isPresent()) {
- final EsrVnfmList esrVnfmList = response.get();
- logger.info("The AAI ESR replied with: {}", esrVnfmList);
- final List<EsrVnfm> esrVnfm = esrVnfmList.getEsrVnfm();
-
- final List<EsrSystemInfo> infos = new LinkedList<>();
-
- for (final EsrVnfm vnfm : esrVnfm) {
- final String vnfmId = vnfm.getVnfmId();
- infos.addAll(receiveVnfmServiceUrl(resourcesClient, vnfmId));
- }
-
- return infos;
- }
-
- return null;
- }
-
- 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 AAI ESR replied with: {}", esrVnfm);
- final EsrSystemInfoList esrSystemInfoList = esrVnfm.getEsrSystemInfoList();
-
- if (esrSystemInfoList != null) {
- return esrSystemInfoList.getEsrSystemInfo();
- }
- }
-
- return Collections.emptyList();
- }
-
- public boolean checkGenericVnfId(final String vnfId) {
- final AAIResourcesClient resourcesClient = new AAIResourcesClient();
- final AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
- final Optional<GenericVnf> response = resourcesClient.get(GenericVnf.class, resourceUri);
-
- if (response.isPresent()) {
- final GenericVnf vnf = response.get();
- logger.info("The AAI replied with: {}", vnf);
- return vnfId.equals(vnf.getVnfId());
- }
-
- return false;
- }
-}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiPropertiesExt.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiPropertiesExt.java
deleted file mode 100644
index aa8c7f68c9..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiPropertiesExt.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*-
- * ============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 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 AaiPropertiesExt implements AAIProperties {
-
- private final String endpoint;
- private final String encryptedBasicAuth;
- private final String encryptionKey;
-
- public AaiPropertiesExt() {
- final ApplicationContext context = SpringContextHelper.getAppContext();
- this.endpoint = context.getEnvironment().getProperty("aai.endpoint");
- this.encryptedBasicAuth = context.getEnvironment().getProperty("aai.auth");
- this.encryptionKey = context.getEnvironment().getProperty("mso.key");
- }
-
- @Override
- public URL getEndpoint() throws MalformedURLException {
- return new URL(endpoint);
- }
-
- @Override
- public String getSystemName() {
- return "MSO";
- }
-
- @Override
- public AAIVersion getDefaultVersion() {
- return AAIVersion.V15;
- }
-
- @Override
- public String getAuth() {
- return encryptedBasicAuth;
- }
-
- @Override
- public String getKey() {
- return encryptionKey;
- }
-}
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
deleted file mode 100644
index 13ff2b6397..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/EsrId.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * ============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/ApplicationConfiguration.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ApplicationConfiguration.java
deleted file mode 100644
index 411572ff5b..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ApplicationConfiguration.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * ============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.configuration;
-
-import org.onap.so.adapters.vevnfm.provider.AuthorizationHeadersProvider;
-import org.onap.so.configuration.rest.HttpHeadersProvider;
-import org.onap.so.rest.service.HttpRestServiceProvider;
-import org.onap.so.rest.service.HttpRestServiceProviderImpl;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.client.RestTemplate;
-
-@Configuration
-public class ApplicationConfiguration {
-
- @Bean
- public AuthorizationHeadersProvider headersProvider() {
- return new AuthorizationHeadersProvider();
- }
-
- @Bean
- public HttpRestServiceProvider restProvider(final RestTemplate restTemplate,
- final HttpHeadersProvider headersProvider) {
- return new HttpRestServiceProviderImpl(restTemplate, headersProvider);
- }
-}
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
deleted file mode 100644
index c033fc3f96..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============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.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;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.context.event.ApplicationReadyEvent;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.event.EventListener;
-import org.springframework.core.env.Environment;
-import org.springframework.core.env.Profiles;
-
-@Configuration
-public class StartupConfiguration {
-
- public static final String TEST_PROFILE = "test";
-
- @Autowired
- private Environment environment;
-
- @Autowired
- private StartupService startupService;
-
- @Autowired
- private SubscriptionScheduler subscriptionScheduler;
-
- @EventListener(ApplicationReadyEvent.class)
- public void onApplicationReadyEvent() throws Exception {
- if (!environment.acceptsProfiles(Profiles.of(TEST_PROFILE))) {
- 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/constant/VnfNotificationFilterType.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/constant/VnfNotificationFilterType.java
deleted file mode 100644
index 09a6ae186d..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/constant/VnfNotificationFilterType.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-
- * ============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.constant;
-
-/**
- * Which incoming Notification with particular VNF id is supported
- */
-public enum VnfNotificationFilterType {
- /**
- * None
- */
- NONE,
-
- /**
- * Only those which are valid in AAI
- */
- AAI_CHECKED,
-
- /**
- * All
- */
- ALL
-}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java
deleted file mode 100644
index e187ec99d0..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SO
- * ================================================================================
- * Copyright (C) 2019 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.controller;
-
-import org.onap.so.adapters.vevnfm.constant.VnfNotificationFilterType;
-import org.onap.so.adapters.vevnfm.service.DmaapService;
-import org.onap.so.adapters.vevnfm.service.VnfAaiChecker;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-public class NotificationController {
-
- private static final Logger logger = LoggerFactory.getLogger(NotificationController.class);
-
- private final VnfNotificationFilterType vnfFilterType;
- private final VnfAaiChecker vnfAaiChecker;
- private final DmaapService dmaapService;
-
- @Autowired
- public NotificationController(
- @Value("${notification.vnf-filter-type}") final VnfNotificationFilterType vnfFilterType,
- final VnfAaiChecker vnfAaiChecker, final DmaapService dmaapService) {
- this.vnfFilterType = vnfFilterType;
- this.vnfAaiChecker = vnfAaiChecker;
- this.dmaapService = dmaapService;
- }
-
- @PostMapping("${vnfm.notification}")
- public ResponseEntity receiveNotification(@RequestBody final VnfLcmOperationOccurrenceNotification notification) {
- logger.info("Notification received {}", notification);
-
- final String vnfInstanceId = notification.getVnfInstanceId();
-
- if (vnfAaiChecker.vnfCheck(vnfFilterType, vnfInstanceId)) {
- logger.info("The info with the VNF id '{}' is sent to DMaaP", vnfInstanceId);
- dmaapService.send(notification);
- } else {
- logger.info("This VNF id '{}' is not supported", vnfInstanceId);
- }
-
- return ResponseEntity.ok().build();
- }
-}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/AaiEvent.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/AaiEvent.java
deleted file mode 100644
index ceabb8a020..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/AaiEvent.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * ============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.event;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class AaiEvent {
-
- private final boolean vserverIsClosedLoopDisabled;
- private final String genericVnfVnfId;
-
- public AaiEvent(final boolean cld, final String id) {
- this.vserverIsClosedLoopDisabled = cld;
- this.genericVnfVnfId = id;
- }
-
- @JsonProperty("vserver.is-closed-loop-disabled")
- public boolean isVserverIsClosedLoopDisabled() {
- return vserverIsClosedLoopDisabled;
- }
-
- @JsonProperty("generic-vnf.vnf-id")
- public String getGenericVnfVnfId() {
- return genericVnfVnfId;
- }
-}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/DmaapEvent.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/DmaapEvent.java
deleted file mode 100644
index dc0c5502dd..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/DmaapEvent.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*-
- * ============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.event;
-
-import static java.time.temporal.ChronoField.INSTANT_SECONDS;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.time.Instant;
-import java.util.UUID;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification;
-
-public class DmaapEvent {
-
- public static final String MSERVICE = "microservice.stringmatcher";
- public static final String ONSET = "ONSET";
- public static final String VNF = "VNF";
- public static final String VNFID = "generic-vnf.vnf-id";
- public static final String ETSI = "ETSI";
-
- private final String closedLoopControlName;
- private final long closedLoopAlarmStart;
- private final String closedLoopEventClient;
- private final String closedLoopEventStatus;
- private final String requestId;
- private final String targetType;
- private final String target;
- private final AaiEvent aaiEvent;
- private final String from;
- private final String version;
- private final VnfLcmOperationOccurrenceNotification etsiLcmEvent;
-
- public DmaapEvent(final String closedLoopControlName, final String version,
- final VnfLcmOperationOccurrenceNotification etsiLcmEvent) {
- this.closedLoopControlName = closedLoopControlName;
- this.closedLoopAlarmStart = Instant.now().getLong(INSTANT_SECONDS);
- this.closedLoopEventClient = MSERVICE;
- this.closedLoopEventStatus = ONSET;
- this.requestId = UUID.randomUUID().toString();
- this.targetType = VNF;
- this.target = VNFID;
- this.aaiEvent = new AaiEvent(false, etsiLcmEvent.getId());
- this.from = ETSI;
- this.version = version;
- this.etsiLcmEvent = etsiLcmEvent;
- }
-
- public String getClosedLoopControlName() {
- return closedLoopControlName;
- }
-
- public long getClosedLoopAlarmStart() {
- return closedLoopAlarmStart;
- }
-
- public String getClosedLoopEventClient() {
- return closedLoopEventClient;
- }
-
- public String getClosedLoopEventStatus() {
- return closedLoopEventStatus;
- }
-
- @JsonProperty("requestID")
- public String getRequestId() {
- return requestId;
- }
-
- @JsonProperty("target_type")
- public String getTargetType() {
- return targetType;
- }
-
- public String getTarget() {
- return target;
- }
-
- @JsonProperty("AAI")
- public AaiEvent getAaiEvent() {
- return aaiEvent;
- }
-
- public String getFrom() {
- return from;
- }
-
- public String getVersion() {
- return version;
- }
-
- public VnfLcmOperationOccurrenceNotification getEtsiLcmEvent() {
- return etsiLcmEvent;
- }
-}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java
deleted file mode 100644
index a0c1c1e9db..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*-
- * ============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.exception;
-
-public class VeVnfmException extends Exception {
-
- public VeVnfmException(final String message) {
- super(message);
- }
-
- public VeVnfmException(final Throwable cause) {
- super(cause);
- }
-}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java
deleted file mode 100644
index 838a67d115..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- * ============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.provider;
-
-import org.apache.logging.log4j.util.Strings;
-import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
-
-public class AuthorizationHeadersProvider extends BasicHttpHeadersProvider {
-
- public void addAuthorization(final String authorization) {
- if (Strings.isBlank(authorization)) {
- return;
- }
-
- getHttpHeaders().set(AUTHORIZATION_HEADER, authorization);
- }
-
- public void removeAuthorization() {
- getHttpHeaders().remove(AUTHORIZATION_HEADER);
- }
-}
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
deleted file mode 100644
index c685ae815a..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * ============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 org.onap.so.adapters.vevnfm.event.DmaapEvent;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification;
-import org.onap.so.rest.service.HttpRestServiceProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Service;
-
-@Service
-public class DmaapService {
-
- private static final Logger logger = LoggerFactory.getLogger(DmaapService.class);
-
- @Value("${dmaap.endpoint}")
- private String endpoint;
-
- @Value("${dmaap.topic}")
- private String topic;
-
- @Value("${dmaap.closed-loop.control.name}")
- private String closedLoopControlName;
-
- @Value("${dmaap.version}")
- private String version;
-
- @Autowired
- private HttpRestServiceProvider restProvider;
-
- public void send(final VnfLcmOperationOccurrenceNotification notification) {
- try {
- final DmaapEvent event = new DmaapEvent(closedLoopControlName, version, notification);
- final ResponseEntity<String> response = restProvider.postHttpRequest(event, 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() {
- return endpoint + topic;
- }
-}
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
deleted file mode 100644
index 92906ef35c..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * ============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 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;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.retry.annotation.Backoff;
-import org.springframework.retry.annotation.EnableRetry;
-import org.springframework.retry.annotation.Recover;
-import org.springframework.retry.annotation.Retryable;
-import org.springframework.stereotype.Service;
-
-@Service
-@EnableRetry
-public class StartupService {
-
- private static final Logger logger = LoggerFactory.getLogger(StartupService.class);
-
- @Value("${vnfm.default-endpoint}")
- private String vnfmDefaultEndpoint;
-
- @Autowired
- private AaiConnection aaiConnection;
-
- @Retryable(value = {Exception.class}, maxAttempts = 5, backoff = @Backoff(delay = 5000, multiplier = 2))
- public List<EsrSystemInfo> receiveVnfm() throws VeVnfmException {
- return aaiConnection.receiveVnfm();
- }
-
- @Recover
- 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 Collections.singletonList(info);
- }
-}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscribeSender.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscribeSender.java
deleted file mode 100644
index d01c3c8f66..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscribeSender.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*-
- * ============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 com.fasterxml.jackson.annotation.JsonProperty;
-import org.onap.aai.domain.yang.EsrSystemInfo;
-import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
-import org.onap.so.rest.service.HttpRestServiceProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Service;
-import lombok.ToString;
-
-@Service
-public class SubscribeSender {
-
- public static final String SLASH = "/";
-
- private static final Logger logger = LoggerFactory.getLogger(SubscribeSender.class);
-
- @Value("${vnfm.subscription}")
- private String vnfmSubscription;
-
- @Autowired
- private HttpRestServiceProvider restProvider;
-
- public String send(final EsrSystemInfo info, final LccnSubscriptionRequest request) throws VeVnfmException {
- final ResponseEntity<SubscribeToManoResponse> response =
- restProvider.postHttpRequest(request, getUrl(info), SubscribeToManoResponse.class);
-
- final HttpStatus statusCode = response.getStatusCode();
- final SubscribeToManoResponse body = response.getBody();
-
- logger.info("The VNFM replied with the code {} and the body {}", statusCode, body);
-
- if (HttpStatus.CREATED != statusCode) {
- throw new VeVnfmException("The status code was different than " + HttpStatus.CREATED);
- }
-
- return body.id;
- }
-
- public boolean check(final EsrSystemInfo info, final String id) {
- final ResponseEntity<SubscribeToManoResponse> response =
- restProvider.getHttpResponse(getUrl(info) + SLASH + id, SubscribeToManoResponse.class);
- return response.getBody() != null && response.getBody().id.equals(id);
- }
-
- private String getUrl(final EsrSystemInfo info) {
- return info.getServiceUrl() + vnfmSubscription;
- }
-
- @ToString
- static class SubscribeToManoResponse {
- @JsonProperty("id")
- String id;
- @JsonProperty("callbackUri")
- String callbackUri;
- }
-}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java
deleted file mode 100644
index d2cf4833ba..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*-
- * ============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 com.google.gson.Gson;
-import com.squareup.okhttp.Credentials;
-import java.util.Collections;
-import org.apache.logging.log4j.util.Strings;
-import org.onap.aai.domain.yang.EsrSystemInfo;
-import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
-import org.onap.so.adapters.vevnfm.provider.AuthorizationHeadersProvider;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthentication;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthenticationParamsBasic;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsFilter;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-
-@Service
-public class SubscriberService {
-
- private static final Gson gson = new Gson();
-
- @Value("${vevnfmadapter.vnf-filter-json}")
- private String vnfFilter;
-
- @Value("${vevnfmadapter.endpoint}")
- private String endpoint;
-
- @Value("${vnfm.notification}")
- private String notification;
-
- @Value("${spring.security.usercredentials[0].username}")
- private String username;
-
- @Value("${spring.security.usercredentials[0].openpass}")
- private String openpass;
-
- @Autowired
- private AuthorizationHeadersProvider headersProvider;
-
- @Autowired
- private SubscribeSender sender;
-
- private static String getAuthorization(final EsrSystemInfo info) {
- if (info == null) {
- return null;
- }
-
- final String userName = info.getUserName();
-
- if (Strings.isBlank(userName)) {
- return null;
- }
-
- final String password = info.getPassword();
- return Credentials.basic(userName, password);
- }
-
- public String subscribe(final EsrSystemInfo info) throws VeVnfmException {
- try {
- headersProvider.addAuthorization(getAuthorization(info));
- final LccnSubscriptionRequest request = createRequest();
- return sender.send(info, request);
- } catch (Exception e) {
- throw new VeVnfmException(e);
- } finally {
- headersProvider.removeAuthorization();
- }
- }
-
- public boolean checkSubscription(final EsrSystemInfo info, final String id) throws VeVnfmException {
- try {
- return sender.check(info, id);
- } catch (Exception e) {
- throw new VeVnfmException(e);
- }
- }
-
- private LccnSubscriptionRequest createRequest() {
- final LccnSubscriptionRequest request = new LccnSubscriptionRequest();
- request.filter(getFilter());
- request.callbackUri(getCallbackUri());
- final SubscriptionsAuthenticationParamsBasic paramsBasic = new SubscriptionsAuthenticationParamsBasic();
- final SubscriptionsAuthentication authentication = new SubscriptionsAuthentication();
- paramsBasic.setUserName(username);
- paramsBasic.setPassword(openpass);
- authentication.setAuthType(Collections.singletonList(SubscriptionsAuthentication.AuthTypeEnum.BASIC));
- authentication.setParamsBasic(paramsBasic);
- request.authentication(authentication);
-
- return request;
- }
-
- private SubscriptionsFilter getFilter() {
- return gson.fromJson(vnfFilter, SubscriptionsFilter.class);
- }
-
- private String getCallbackUri() {
- return endpoint + notification;
- }
-}
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
deleted file mode 100644
index d9f3acc3df..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*-
- * ============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 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;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Service;
-
-@Service
-@EnableScheduling
-public class SubscriptionScheduler {
-
- private static final Logger logger = LoggerFactory.getLogger(SubscriptionScheduler.class);
-
- @Autowired
- private SubscriberService subscriberService;
-
- private List<EsrId> esrIds;
-
- public void setInfos(final List<EsrSystemInfo> infos) {
- esrIds = new LinkedList<>();
-
- 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 (isEsrIdsValid()) {
- for (final EsrId esrId : esrIds) {
- singleSubscribe(esrId);
- }
- }
- }
-
- @Scheduled(fixedRate = 20000)
- void checkSubscribeTask() throws VeVnfmException {
- 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/main/java/org/onap/so/adapters/vevnfm/service/VnfAaiChecker.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/VnfAaiChecker.java
deleted file mode 100644
index 02a9c1855c..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/VnfAaiChecker.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * ============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 org.onap.so.adapters.vevnfm.aai.AaiConnection;
-import org.onap.so.adapters.vevnfm.constant.VnfNotificationFilterType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service
-public class VnfAaiChecker {
-
- private final AaiConnection aaiConnection;
-
- @Autowired
- public VnfAaiChecker(final AaiConnection aaiConnection) {
- this.aaiConnection = aaiConnection;
- }
-
- public boolean vnfCheck(final VnfNotificationFilterType filterType, final String vnfId) {
- switch (filterType) {
- case ALL:
- return true;
- case AAI_CHECKED:
- return aaiConnection.checkGenericVnfId(vnfId);
- case NONE:
- return false;
- default:
- throw new IllegalArgumentException(
- "The value of VnfNotificationFilterType is not supported: " + filterType);
- }
- }
-}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties b/adapters/mso-ve-vnfm-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
deleted file mode 100644
index 9fc8e62cf5..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.so.adapters.vevnfm.aai.AaiPropertiesExt
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml b/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml
deleted file mode 100644
index c69c95187a..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# Copyright © 2019, 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.
-
-server:
- port: 9098
-
-vevnfmadapter:
- vnf-filter-json: '{notificationTypes:[VnfLcmOperationOccurrenceNotification],operationStates:[COMPLETED]}'
- endpoint: http://so-ve-vnfm-adapter.onap:9098
-
-mso:
- key: 07a7159d3bf51a0e53be7a8f89699be7
-
-aai:
- endpoint: https://aai.onap:30233
- auth: 75C4483F9C05E2C33A8602635FA532397EC44AB667A2B64DED4FEE08DD932F2E3C1FEE
-
-vnfm:
- default-endpoint: https://so-vnfm-simulator.onap:9093
- subscription: /vnflcm/v1/subscriptions
- notification: /lcm/v1/vnf/instances/notifications
-
-notification:
- vnf-filter-type: NONE
-
-dmaap:
- endpoint: http://message-router.onap:30227
- topic: /events/unauthenticated.DCAE_CL_OUTPUT
- closed-loop:
- control:
- name: ClosedLoopControlName
- version: 1.0.2
-
-spring:
- security:
- usercredentials:
- - username: admin
- openpass: a4b3c2d1
- password: '$2a$10$vU.mWyNTsikAxXIA5c269ewCpAbYTiyMS0m1N.kn4F2CSGEnrKN7K'
- role: USER
- http:
- converters:
- preferred-json-mapper: gson
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java
deleted file mode 100644
index 56c53a72e8..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SO
- * ================================================================================
- * Copyright (C) 2019 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.controller;
-
-import static org.junit.Assert.assertEquals;
-import static org.springframework.test.web.client.match.MockRestRequestMatchers.anything;
-import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.so.adapters.vevnfm.configuration.StartupConfiguration;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.mock.web.MockHttpServletResponse;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.test.web.client.MockRestServiceServer;
-import org.springframework.test.web.servlet.MockMvc;
-import org.springframework.test.web.servlet.MvcResult;
-import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
-import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
-import org.springframework.test.web.servlet.setup.MockMvcBuilders;
-import org.springframework.web.client.RestTemplate;
-import org.springframework.web.context.WebApplicationContext;
-
-@SpringBootTest
-@RunWith(SpringRunner.class)
-@ActiveProfiles(StartupConfiguration.TEST_PROFILE)
-public class NotificationControllerTest {
-
- private static final String MINIMAL_JSON_CONTENT = "{}";
- private static final int ZERO = 0;
-
- @Value("${vnfm.notification}")
- private String notification;
-
- @Autowired
- private WebApplicationContext webApplicationContext;
-
- @Autowired
- private RestTemplate restTemplate;
-
- private MockMvc mvc;
- private MockRestServiceServer mockRestServer;
-
- @Before
- public void init() {
- mvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
- mockRestServer = MockRestServiceServer.bindTo(restTemplate).build();
- }
-
- @Test
- public void testReceiveNotification() throws Exception {
- // given
- final MockHttpServletRequestBuilder request = MockMvcRequestBuilders.post(notification)
- .contentType(MediaType.APPLICATION_JSON).content(MINIMAL_JSON_CONTENT);
-
- mockRestServer.expect(anything()).andRespond(withSuccess());
-
- // when
- final MvcResult mvcResult = mvc.perform(request).andReturn();
-
- // then
- final MockHttpServletResponse response = mvcResult.getResponse();
- assertEquals(HttpStatus.OK.value(), response.getStatus());
- assertEquals(ZERO, response.getContentLength());
- mockRestServer.verify();
- }
-}
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java
deleted file mode 100644
index f9ae427086..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*-
- * ============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.provider;
-
-import static org.junit.Assert.*;
-import static org.onap.so.configuration.rest.BasicHttpHeadersProvider.AUTHORIZATION_HEADER;
-import org.junit.Test;
-import org.springframework.http.HttpHeaders;
-
-public class AuthorizationHeadersProviderTest {
-
- private static final String AUTHORIZATION_EXAMPLE = "authorization";
- private static final String BLANK_EXAMPLE = "\t\n";
- private static final String EMPTY = "";
-
- private final AuthorizationHeadersProvider provider = new AuthorizationHeadersProvider();
-
- @Test
- public void testSuccessValidAuthorizationAndRemoval() {
- final HttpHeaders headers = provider.getHttpHeaders();
- final int size = headers.size();
-
- provider.addAuthorization(AUTHORIZATION_EXAMPLE);
- assertEquals(size + 1, headers.size());
- assertTrue(headers.containsKey(AUTHORIZATION_HEADER));
-
- provider.removeAuthorization();
- assertEquals(size, headers.size());
- assertFalse(headers.containsKey(AUTHORIZATION_HEADER));
- }
-
- @Test
- public void testBlankAuthorization() {
- final HttpHeaders headers = provider.getHttpHeaders();
- final int size = headers.size();
-
- provider.addAuthorization(BLANK_EXAMPLE);
- assertEquals(size, headers.size());
- }
-
- @Test
- public void testEmptyAuthorization() {
- final HttpHeaders headers = provider.getHttpHeaders();
- final int size = headers.size();
-
- provider.addAuthorization(EMPTY);
- assertEquals(size, headers.size());
- }
-
- @Test
- public void testNullAuthorization() {
- final HttpHeaders headers = provider.getHttpHeaders();
- final int size = headers.size();
-
- provider.addAuthorization(null);
- assertEquals(size, headers.size());
- }
-
- @Test
- public void testRemoveAuthorization() {
- final HttpHeaders headers = provider.getHttpHeaders();
- final int size = headers.size();
-
- provider.removeAuthorization();
- provider.removeAuthorization();
- assertEquals(size, headers.size());
- }
-}
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
deleted file mode 100644
index 9b18cf96dc..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*-
- * ============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.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;
-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;
-import org.onap.so.adapters.vevnfm.aai.AaiConnection;
-
-@RunWith(MockitoJUnitRunner.class)
-public class StartupServiceTest {
-
- private static final String URL = "rt";
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Mock
- private AaiConnection aaiConnection;
-
- @InjectMocks
- private StartupService startupService;
-
- @Test
- public void testSuccess() throws Exception {
- // given
- final EsrSystemInfo info = new EsrSystemInfo();
- info.setServiceUrl(URL);
- final List<EsrSystemInfo> infos = Collections.singletonList(info);
-
- when(aaiConnection.receiveVnfm()).thenReturn(infos);
-
- // when
- final List<EsrSystemInfo> systemInfo = startupService.receiveVnfm();
-
- // then
- verify(aaiConnection).receiveVnfm();
- assertEquals(infos, systemInfo);
- }
-}
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscribeSenderTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscribeSenderTest.java
deleted file mode 100644
index b7f1f982a2..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscribeSenderTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*-
- * ============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.assertEquals;
-import static org.onap.so.adapters.vevnfm.service.SubscribeSender.SLASH;
-import static org.springframework.http.HttpHeaders.CONTENT_TYPE;
-import static org.springframework.test.web.client.ExpectedCount.once;
-import static org.springframework.test.web.client.match.MockRestRequestMatchers.*;
-import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import org.hamcrest.CoreMatchers;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.aai.domain.yang.EsrSystemInfo;
-import org.onap.so.adapters.vevnfm.configuration.StartupConfiguration;
-import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.test.web.client.MockRestServiceServer;
-import org.springframework.web.client.RestTemplate;
-
-@SpringBootTest
-@RunWith(SpringRunner.class)
-@ActiveProfiles(StartupConfiguration.TEST_PROFILE)
-public class SubscribeSenderTest {
-
- private static final String URL = "lh";
- private static final String ID = "1a2s3d4f";
- private static final String JSON = "{\"id\":\"" + ID + "\"}";
-
- private static final Gson GSON;
-
- static {
- final GsonBuilder builder = new GsonBuilder();
- builder.serializeNulls();
- GSON = builder.create();
- }
-
- @Value("${vnfm.subscription}")
- private String vnfmSubscription;
-
- @Autowired
- private SubscribeSender sender;
-
- @Autowired
- private RestTemplate restTemplate;
-
- private MockRestServiceServer mockRestServer;
-
- @Before
- public void init() {
- mockRestServer = MockRestServiceServer.bindTo(restTemplate).build();
- }
-
- @Test
- public void testSuccess() throws VeVnfmException {
- // given
- final EsrSystemInfo info = new EsrSystemInfo();
- info.setServiceUrl(URL);
- final LccnSubscriptionRequest request = new LccnSubscriptionRequest();
-
- mockRestServer.expect(once(), requestTo(SLASH + info.getServiceUrl() + vnfmSubscription))
- .andExpect(header(CONTENT_TYPE, CoreMatchers.containsString(MediaType.APPLICATION_JSON_VALUE)))
- .andExpect(method(HttpMethod.POST)).andExpect(content().json(GSON.toJson(request)))
- .andRespond(withStatus(HttpStatus.CREATED).body(JSON).contentType(MediaType.APPLICATION_JSON));
-
- // when
- final String id = sender.send(info, request);
-
- // then
- mockRestServer.verify();
- assertEquals(ID, id);
- }
-}
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
deleted file mode 100644
index d3da7c86ec..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscriptionSchedulerTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*-
- * ============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-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/VnfAaiCheckerTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/VnfAaiCheckerTest.java
deleted file mode 100644
index 84705d10ce..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/VnfAaiCheckerTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*-
- * ============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.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.when;
-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.so.adapters.vevnfm.aai.AaiConnection;
-import org.onap.so.adapters.vevnfm.constant.VnfNotificationFilterType;
-
-@RunWith(MockitoJUnitRunner.class)
-public class VnfAaiCheckerTest {
-
- private static final String VNF_ID = "t5h78w";
-
- @Mock
- private AaiConnection aaiConnection;
-
- @InjectMocks
- private VnfAaiChecker checker;
-
- @Test
- public void testAll() {
- // when
- final boolean response = checker.vnfCheck(VnfNotificationFilterType.ALL, VNF_ID);
-
- // then
- assertTrue(response);
- }
-
- @Test
- public void testAaiCheckedPresent() {
- // given
- when(aaiConnection.checkGenericVnfId(eq(VNF_ID))).thenReturn(true);
-
- // when
- final boolean response = checker.vnfCheck(VnfNotificationFilterType.AAI_CHECKED, VNF_ID);
-
- // then
- assertTrue(response);
- }
-
- @Test
- public void testAaiCheckedAbsent() {
- // given
- when(aaiConnection.checkGenericVnfId(eq(VNF_ID))).thenReturn(false);
-
- // when
- final boolean response = checker.vnfCheck(VnfNotificationFilterType.AAI_CHECKED, VNF_ID);
-
- // then
- assertFalse(response);
- }
-
- @Test
- public void testNone() {
- // when
- final boolean response = checker.vnfCheck(VnfNotificationFilterType.NONE, VNF_ID);
-
- // then
- assertFalse(response);
- }
-}
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/resources/application.yaml b/adapters/mso-ve-vnfm-adapter/src/test/resources/application.yaml
deleted file mode 100644
index 2c7f67e459..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/test/resources/application.yaml
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# Copyright © 2019, 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.
-
-server:
- port: 9098
-
-vevnfmadapter:
- vnf-filter-json: '{notificationTypes:[VnfLcmOperationOccurrenceNotification],operationStates:[COMPLETED]}'
- endpoint: http://so-ve-vnfm-adapter.onap:9098
-
-mso:
- key: 07a7159d3bf51a0e53be7a8f89699be7
-
-aai:
- endpoint: https://aai.onap:30233
- auth: 75C4483F9C05E2C33A8602635FA532397EC44AB667A2B64DED4FEE08DD932F2E3C1FEE
-
-vnfm:
- default-endpoint: https://so-vnfm-simulator.onap:9093
- subscription: /vnflcm/v1/subscriptions
- notification: /lcm/v1/vnf/instances/notifications
-
-notification:
- vnf-filter-type: ALL
-
-dmaap:
- endpoint: http://message-router.onap:30227
- topic: /events/unauthenticated.DCAE_CL_OUTPUT
- closed-loop:
- control:
- name: ClosedLoopControlName
- version: 1.0.2
-
-spring:
- security:
- usercredentials:
- - username: admin
- openpass: a4b3c2d1
- password: '$2a$10$vU.mWyNTsikAxXIA5c269ewCpAbYTiyMS0m1N.kn4F2CSGEnrKN7K'
- role: USER
- http:
- converters:
- preferred-json-mapper: gson