summaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V9.0__AddConfiguredForVnfOrchestrationStatus.sql2
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceArtifactTest.java55
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfoTest.java54
-rw-r--r--adapters/mso-nssmf-adapter/pom.xml18
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/application-aaf.yaml0
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/application-basic.yaml0
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/application.yaml33
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/nssmf.jksbin1386 -> 0 bytes
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/nssmf.p12bin1616 -> 0 bytes
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.jksbin1386 -> 0 bytes
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.p12bin1616 -> 4095 bytes
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.trust.jksbin0 -> 1413 bytes
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java12
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java2
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.3__Add_Columns_Workflow_Name_Operation_Name.sql7
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java26
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiPropertiesExt.java12
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ConfigProperties.java134
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java15
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/constant/NotificationVnfFilterType.java41
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java25
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java26
-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/SubscribeSender.java11
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java41
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java9
-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/application.yaml4
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java11
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java5
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscribeSenderTest.java8
-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
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java10
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterUrlProvider.java105
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/VnfPkgInfoConverter.java60
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProvider.java72
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java71
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogSubscriptionServiceProvider.java55
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java49
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java16
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java46
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementController.java2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java27
-rw-r--r--adapters/so-appc-orchestrator/pom.xml1
45 files changed, 1015 insertions, 255 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V9.0__AddConfiguredForVnfOrchestrationStatus.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V9.0__AddConfiguredForVnfOrchestrationStatus.sql
new file mode 100644
index 0000000000..81e6092f5f
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V9.0__AddConfiguredForVnfOrchestrationStatus.sql
@@ -0,0 +1,2 @@
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE)
+VALUES ('VNF', 'CONFIGURED', 'ACTIVATE', 'CONTINUE');
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceArtifactTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceArtifactTest.java
new file mode 100644
index 0000000000..2266eafa12
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceArtifactTest.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ * ================================================================================
+ * 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.catalogdb.catalogrest;
+
+import org.assertj.core.api.Assertions;
+import org.junit.Test;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceArtifact;
+import org.onap.so.jsonpath.JsonPathUtil;
+import java.util.ArrayList;
+import java.util.List;
+import static org.mockito.Mockito.mock;
+
+public class QueryServiceArtifactTest {
+
+ @Test
+ public void ServiceArtifactTest() {
+ QueryServiceArtifact queryServiceArtifact = new QueryServiceArtifact(createList());
+ String jsonResult = queryServiceArtifact.JSON2(true, false);
+ Assertions.assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.serviceArtifact[0].name").get())
+ .isEqualTo("eMBB.zip");
+ }
+
+ private List<ServiceArtifact> createList() {
+ List<ServiceArtifact> artifacts = new ArrayList<>();
+ Service service = mock(Service.class);
+ ServiceArtifact artifact = new ServiceArtifact();
+ artifact.setService(service);
+ artifact.setArtifactUUID("b170dbeb-2954-4a4f-ad12-6bc84b3e089e");
+ artifact.setChecksum("ZWRkMGM3NzNjMmE3NzliYTFiZGNmZjVlMDE4OWEzMTA=");
+ artifact.setDescription("embbCn");
+ artifact.setType("OTHER");
+ artifact.setName("eMBB.zip");
+ artifact.setVersion("1");
+ artifacts.add(artifact);
+ return artifacts;
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfoTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfoTest.java
new file mode 100644
index 0000000000..e948141b89
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfoTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ * ================================================================================
+ * 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.catalogdb.catalogrest;
+
+import org.assertj.core.api.Assertions;
+import org.junit.Test;
+import org.onap.so.db.catalog.beans.ServiceInfo;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.jsonpath.JsonPathUtil;
+import java.util.ArrayList;
+import java.util.List;
+import static org.mockito.Mockito.mock;
+
+public class QueryServiceInfoTest {
+
+ @Test
+ public void serviceInfoTest() {
+ QueryServiceInfo queryServiceInfo = new QueryServiceInfo(createList());
+ String jsonResult = queryServiceInfo.JSON2(true, false);
+ String serviceInfo = jsonResult.substring(jsonResult.indexOf("{"), jsonResult.length());
+ Assertions.assertThat(JsonPathUtil.getInstance().locateResult(serviceInfo, "$.id").get()).isEqualTo("1");
+ }
+
+ private List<ServiceInfo> createList() {
+ Service service = mock(Service.class);
+ ServiceInfo serviceInfo = new ServiceInfo();
+ serviceInfo.setId(1);
+ serviceInfo.setService(service);
+ serviceInfo.setServiceInput(null);
+ serviceInfo.setServiceProperties(null);
+
+ List<ServiceInfo> serviceInfos = new ArrayList<>();
+ serviceInfos.add(serviceInfo);
+ return serviceInfos;
+ }
+
+}
diff --git a/adapters/mso-nssmf-adapter/pom.xml b/adapters/mso-nssmf-adapter/pom.xml
index 3e9c2fe6d7..b257adaa96 100644
--- a/adapters/mso-nssmf-adapter/pom.xml
+++ b/adapters/mso-nssmf-adapter/pom.xml
@@ -66,6 +66,24 @@
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
</plugins>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <excludes>
+ <exclude>**/*.p12</exclude>
+ <exclude>**/*.jks</exclude>
+ </excludes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>**/*.p12</include>
+ <include>**/*.jks</include>
+ </includes>
+ </resource>
+ </resources>
</build>
<dependencies>
<dependency>
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/application-aaf.yaml b/adapters/mso-nssmf-adapter/src/main/resources/application-aaf.yaml
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/resources/application-aaf.yaml
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/application-basic.yaml b/adapters/mso-nssmf-adapter/src/main/resources/application-basic.yaml
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/resources/application-basic.yaml
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/application.yaml b/adapters/mso-nssmf-adapter/src/main/resources/application.yaml
index cb2f04d7ec..303d63d4a2 100644
--- a/adapters/mso-nssmf-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-nssmf-adapter/src/main/resources/application.yaml
@@ -25,11 +25,10 @@ logging:
spring:
datasource:
+ jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb
+ username: ${DB_USERNAME}
+ password: ${DB_PASSWORD}
driver-class-name: org.mariadb.jdbc.Driver
- jdbcUrl: jdbc:mariadb://192.168.235.44:30444/requestdb
- username: root
- password: secretpassword
-
jpa:
show-sql: false
hibernate:
@@ -37,6 +36,15 @@ spring:
ddl-auto: validate
naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
enable-lazy-load-no-trans: true
+ security:
+ usercredentials:
+ - username: bpel
+ password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
+ role: BPEL-Client
+ - username: mso_admin
+ password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
+ role: ACTUATOR
+
server:
port: 8080
tomcat:
@@ -46,8 +54,6 @@ mso:
key: 07a7159d3bf51a0e53be7a8f89699be7
site-name: localSite
logPath: ./logs/nssmf
- msb-ip: msb-iag.{{ include "common.namespace" . }}
- msb-port: 80
adapters:
requestDb:
endpoint: https://so-request-db-adapter.{{ include "common.namespace" . }}:8083
@@ -55,7 +61,14 @@ mso:
#Actuator
management:
- security:
- enabled: false
- basic:
- enabled: false \ No newline at end of file
+ endpoints:
+ web:
+ base-path: /manage
+ exposure:
+ include: "*"
+ metrics:
+ se-global-registry: false
+ export:
+ prometheus:
+ enabled: true # Whether exporting of metrics to Prometheus is enabled.
+ step: 1m # Step size (i.e. reporting frequency) to use.
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/nssmf.jks b/adapters/mso-nssmf-adapter/src/main/resources/nssmf.jks
deleted file mode 100644
index 2ecce5bd3d..0000000000
--- a/adapters/mso-nssmf-adapter/src/main/resources/nssmf.jks
+++ /dev/null
Binary files differ
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/nssmf.p12 b/adapters/mso-nssmf-adapter/src/main/resources/nssmf.p12
deleted file mode 100644
index 25e7fbfca9..0000000000
--- a/adapters/mso-nssmf-adapter/src/main/resources/nssmf.p12
+++ /dev/null
Binary files differ
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.jks b/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.jks
deleted file mode 100644
index f7cd9e8f86..0000000000
--- a/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.jks
+++ /dev/null
Binary files differ
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.p12 b/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.p12
index 1927b1f13f..79631bf344 100644
--- a/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.p12
+++ b/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.p12
Binary files differ
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.trust.jks b/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.trust.jks
new file mode 100644
index 0000000000..6f8168d896
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.trust.jks
Binary files differ
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
index c578b29664..adcde92917 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
@@ -148,10 +148,16 @@ public class AaiHelper {
public Pserver buildPserver(final Server server) {
Pserver pserver = new Pserver();
pserver.setInMaint(false);
- pserver.setPserverId(server.getId());
pserver.setHostname(server.getHypervisorHostname());
- pserver.setPserverName2(server.getHost());
- pserver.setProvStatus(server.getStatus().value());
+ if (server.getId() != null) {
+ pserver.setPserverId(server.getId());
+ }
+ if (server.getHost() != null) {
+ pserver.setPserverName2(server.getHost());
+ }
+ if (server.getStatus() != null && server.getStatus().value() != null) {
+ pserver.setProvStatus(server.getStatus().value());
+ }
return pserver;
}
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java
index 9f48144eb8..4fe49e38dd 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java
@@ -143,6 +143,8 @@ public class ArchiveInfraRequestsScheduler {
archivedInfra.setProductFamilyName(iar.getProductFamilyName());
archivedInfra.setTenantName(iar.getTenantName());
archivedInfra.setResourceStatusMessage(iar.getResourceStatusMessage());
+ archivedInfra.setWorkflowName(iar.getWorkflowName());
+ archivedInfra.setOperationName(iar.getOperationName());
newArchivedReqs.add(archivedInfra);
oldInfraReqs.add(iar);
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.3__Add_Columns_Workflow_Name_Operation_Name.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.3__Add_Columns_Workflow_Name_Operation_Name.sql
new file mode 100644
index 0000000000..d493bc01ac
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.3__Add_Columns_Workflow_Name_Operation_Name.sql
@@ -0,0 +1,7 @@
+use requestdb;
+
+ALTER TABLE infra_active_requests ADD COLUMN IF NOT EXISTS WORKFLOW_NAME varchar(200);
+ALTER TABLE archived_infra_requests ADD COLUMN IF NOT EXISTS WORKFLOW_NAME varchar(200);
+
+ALTER TABLE infra_active_requests ADD COLUMN IF NOT EXISTS OPERATION_NAME varchar(200);
+ALTER TABLE archived_infra_requests ADD COLUMN IF NOT EXISTS OPERATION_NAME varchar(200); \ No newline at end of file
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 9b2a8c3d62..fd20a0f78e 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
@@ -26,8 +26,10 @@ 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;
@@ -72,7 +74,7 @@ public class AaiConnection {
if (response.isPresent()) {
final EsrVnfmList esrVnfmList = response.get();
- logger.info("The VNFM replied with: {}", esrVnfmList);
+ logger.info("The AAI ESR replied with: {}", esrVnfmList);
final List<EsrVnfm> esrVnfm = esrVnfmList.getEsrVnfm();
final List<EsrSystemInfo> infos = new LinkedList<>();
@@ -94,10 +96,28 @@ public class AaiConnection {
if (response.isPresent()) {
final EsrVnfm esrVnfm = response.get();
- logger.info("The VNFM replied with: {}", esrVnfm);
- return esrVnfm.getEsrSystemInfoList().getEsrSystemInfo();
+ 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
index aa8c7f68c9..e8660086c0 100644
--- 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
@@ -22,6 +22,7 @@ package org.onap.so.adapters.vevnfm.aai;
import java.net.MalformedURLException;
import java.net.URL;
+import org.onap.so.adapters.vevnfm.configuration.ConfigProperties;
import org.onap.so.client.aai.AAIProperties;
import org.onap.so.client.aai.AAIVersion;
import org.onap.so.spring.SpringContextHelper;
@@ -29,15 +30,18 @@ import org.springframework.context.ApplicationContext;
public class AaiPropertiesExt implements AAIProperties {
+ private static final String MSO = "MSO";
+
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");
+ final ConfigProperties configProperties = context.getBean(ConfigProperties.class);
+ this.endpoint = configProperties.getAaiEndpoint();
+ this.encryptedBasicAuth = configProperties.getAaiAuth();
+ this.encryptionKey = configProperties.getMsoKey();
}
@Override
@@ -47,7 +51,7 @@ public class AaiPropertiesExt implements AAIProperties {
@Override
public String getSystemName() {
- return "MSO";
+ return MSO;
}
@Override
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ConfigProperties.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ConfigProperties.java
new file mode 100644
index 0000000000..d4ca5af0f2
--- /dev/null
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ConfigProperties.java
@@ -0,0 +1,134 @@
+/*-
+ * ============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.constant.NotificationVnfFilterType;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class ConfigProperties {
+
+ @Value("${vevnfmadapter.vnf-filter-json}")
+ private String vevnfmadapterVnfFilterJson;
+
+ @Value("${vevnfmadapter.endpoint}")
+ private String vevnfmadapterEndpoint;
+
+ @Value("${mso.key}")
+ private String msoKey;
+
+ @Value("${aai.endpoint}")
+ private String aaiEndpoint;
+
+ @Value("${aai.auth}")
+ private String aaiAuth;
+
+ @Value("${vnfm.default-endpoint}")
+ private String vnfmDefaultEndpoint;
+
+ @Value("${vnfm.subscription}")
+ private String vnfmSubscription;
+
+ @Value("${vnfm.notification}")
+ private String vnfmNotification;
+
+ @Value("${notification.vnf-filter-type}")
+ private NotificationVnfFilterType notificationVnfFilterType;
+
+ @Value("${dmaap.endpoint}")
+ private String dmaapEndpoint;
+
+ @Value("${dmaap.topic}")
+ private String dmaapTopic;
+
+ @Value("${dmaap.closed-loop.control.name}")
+ private String dmaapClosedLoopControlName;
+
+ @Value("${dmaap.version}")
+ private String dmaapVersion;
+
+ @Value("${spring.security.usercredentials[0].username}")
+ private String springSecurityUsername;
+
+ @Value("${spring.security.usercredentials[0].openpass}")
+ private String springSecurityOpenpass;
+
+ public String getVevnfmadapterVnfFilterJson() {
+ return vevnfmadapterVnfFilterJson;
+ }
+
+ public String getVevnfmadapterEndpoint() {
+ return vevnfmadapterEndpoint;
+ }
+
+ public String getMsoKey() {
+ return msoKey;
+ }
+
+ public String getAaiEndpoint() {
+ return aaiEndpoint;
+ }
+
+ public String getAaiAuth() {
+ return aaiAuth;
+ }
+
+ public String getVnfmDefaultEndpoint() {
+ return vnfmDefaultEndpoint;
+ }
+
+ public String getVnfmSubscription() {
+ return vnfmSubscription;
+ }
+
+ public String getVnfmNotification() {
+ return vnfmNotification;
+ }
+
+ public NotificationVnfFilterType getNotificationVnfFilterType() {
+ return notificationVnfFilterType;
+ }
+
+ public String getDmaapEndpoint() {
+ return dmaapEndpoint;
+ }
+
+ public String getDmaapTopic() {
+ return dmaapTopic;
+ }
+
+ public String getDmaapClosedLoopControlName() {
+ return dmaapClosedLoopControlName;
+ }
+
+ public String getDmaapVersion() {
+ return dmaapVersion;
+ }
+
+ public String getSpringSecurityUsername() {
+ return springSecurityUsername;
+ }
+
+ public String getSpringSecurityOpenpass() {
+ return springSecurityOpenpass;
+ }
+}
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 c033fc3f96..8b5afbf6a1 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
@@ -36,14 +36,17 @@ public class StartupConfiguration {
public static final String TEST_PROFILE = "test";
- @Autowired
- private Environment environment;
-
- @Autowired
- private StartupService startupService;
+ private final Environment environment;
+ private final StartupService startupService;
+ private final SubscriptionScheduler subscriptionScheduler;
@Autowired
- private SubscriptionScheduler subscriptionScheduler;
+ public StartupConfiguration(final Environment environment, final StartupService startupService,
+ final SubscriptionScheduler subscriptionScheduler) {
+ this.environment = environment;
+ this.startupService = startupService;
+ this.subscriptionScheduler = subscriptionScheduler;
+ }
@EventListener(ApplicationReadyEvent.class)
public void onApplicationReadyEvent() throws Exception {
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/constant/NotificationVnfFilterType.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/constant/NotificationVnfFilterType.java
new file mode 100644
index 0000000000..57935a9fda
--- /dev/null
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/constant/NotificationVnfFilterType.java
@@ -0,0 +1,41 @@
+/*-
+ * ============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;
+
+/**
+ * Select which incoming Notification with particular VNF id should be supported
+ */
+public enum NotificationVnfFilterType {
+ /**
+ * 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
index cb324c32a9..5b1f27f2ca 100644
--- 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
@@ -20,7 +20,10 @@
package org.onap.so.adapters.vevnfm.controller;
+import org.onap.so.adapters.vevnfm.configuration.ConfigProperties;
+import org.onap.so.adapters.vevnfm.constant.NotificationVnfFilterType;
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;
@@ -35,13 +38,31 @@ public class NotificationController {
private static final Logger logger = LoggerFactory.getLogger(NotificationController.class);
+ private final NotificationVnfFilterType notificationVnfFilterType;
+ private final VnfAaiChecker vnfAaiChecker;
+ private final DmaapService dmaapService;
+
@Autowired
- private DmaapService dmaapService;
+ public NotificationController(final ConfigProperties configProperties, final VnfAaiChecker vnfAaiChecker,
+ final DmaapService dmaapService) {
+ this.notificationVnfFilterType = configProperties.getNotificationVnfFilterType();
+ this.vnfAaiChecker = vnfAaiChecker;
+ this.dmaapService = dmaapService;
+ }
@PostMapping("${vnfm.notification}")
public ResponseEntity receiveNotification(@RequestBody final VnfLcmOperationOccurrenceNotification notification) {
logger.info("Notification received {}", notification);
- dmaapService.send(notification);
+
+ final String vnfInstanceId = notification.getVnfInstanceId();
+
+ if (vnfAaiChecker.vnfCheck(notificationVnfFilterType, 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/service/DmaapService.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java
index c685ae815a..d6fa86cd29 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
@@ -20,13 +20,13 @@
package org.onap.so.adapters.vevnfm.service;
+import org.onap.so.adapters.vevnfm.configuration.ConfigProperties;
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;
@@ -36,20 +36,20 @@ 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;
+ private final String endpoint;
+ private final String topic;
+ private final String closedLoopControlName;
+ private final String version;
+ private final HttpRestServiceProvider restProvider;
@Autowired
- private HttpRestServiceProvider restProvider;
+ public DmaapService(final ConfigProperties configProperties, final HttpRestServiceProvider restProvider) {
+ this.endpoint = configProperties.getDmaapEndpoint();
+ this.topic = configProperties.getDmaapTopic();
+ this.closedLoopControlName = configProperties.getDmaapClosedLoopControlName();
+ this.version = configProperties.getDmaapVersion();
+ this.restProvider = restProvider;
+ }
public void send(final VnfLcmOperationOccurrenceNotification notification) {
try {
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 92906ef35c..c128275e43 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
@@ -24,11 +24,11 @@ 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.configuration.ConfigProperties;
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;
@@ -41,11 +41,14 @@ public class StartupService {
private static final Logger logger = LoggerFactory.getLogger(StartupService.class);
- @Value("${vnfm.default-endpoint}")
- private String vnfmDefaultEndpoint;
+ private final String vnfmDefaultEndpoint;
+ private final AaiConnection aaiConnection;
@Autowired
- private AaiConnection aaiConnection;
+ public StartupService(final ConfigProperties configProperties, final AaiConnection aaiConnection) {
+ this.vnfmDefaultEndpoint = configProperties.getVnfmDefaultEndpoint();
+ this.aaiConnection = aaiConnection;
+ }
@Retryable(value = {Exception.class}, maxAttempts = 5, backoff = @Backoff(delay = 5000, multiplier = 2))
public List<EsrSystemInfo> receiveVnfm() throws VeVnfmException {
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
index d01c3c8f66..4cce0773fb 100644
--- 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
@@ -22,13 +22,13 @@ 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.configuration.ConfigProperties;
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;
@@ -41,11 +41,14 @@ public class SubscribeSender {
private static final Logger logger = LoggerFactory.getLogger(SubscribeSender.class);
- @Value("${vnfm.subscription}")
- private String vnfmSubscription;
+ private final String vnfmSubscription;
+ private final HttpRestServiceProvider restProvider;
@Autowired
- private HttpRestServiceProvider restProvider;
+ public SubscribeSender(final ConfigProperties configProperties, final HttpRestServiceProvider restProvider) {
+ this.vnfmSubscription = configProperties.getVnfmSubscription();
+ this.restProvider = restProvider;
+ }
public String send(final EsrSystemInfo info, final LccnSubscriptionRequest request) throws VeVnfmException {
final ResponseEntity<SubscribeToManoResponse> response =
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
index 9760584d7a..cad44eaeed 100644
--- 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
@@ -20,39 +20,45 @@
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.configuration.ConfigProperties;
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 {
- @Value("${vevnfmadapter.endpoint}")
- private String endpoint;
+ private static final Gson gson = new Gson();
- @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;
+ private final String vnfFilter;
+ private final String endpoint;
+ private final String notification;
+ private final String username;
+ private final String openpass;
+ private final AuthorizationHeadersProvider headersProvider;
+ private final SubscribeSender sender;
@Autowired
- private SubscribeSender sender;
+ public SubscriberService(final ConfigProperties configProperties,
+ final AuthorizationHeadersProvider headersProvider, final SubscribeSender sender) {
+ this.vnfFilter = configProperties.getVevnfmadapterVnfFilterJson();
+ this.endpoint = configProperties.getVevnfmadapterEndpoint();
+ this.notification = configProperties.getVnfmNotification();
+ this.username = configProperties.getSpringSecurityUsername();
+ this.openpass = configProperties.getSpringSecurityOpenpass();
+ this.headersProvider = headersProvider;
+ this.sender = sender;
+ }
private static String getAuthorization(final EsrSystemInfo info) {
if (info == null) {
@@ -91,6 +97,7 @@ public class SubscriberService {
private LccnSubscriptionRequest createRequest() {
final LccnSubscriptionRequest request = new LccnSubscriptionRequest();
+ request.filter(getFilter());
request.callbackUri(getCallbackUri());
final SubscriptionsAuthenticationParamsBasic paramsBasic = new SubscriptionsAuthenticationParamsBasic();
final SubscriptionsAuthentication authentication = new SubscriptionsAuthentication();
@@ -103,6 +110,10 @@ public class SubscriberService {
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
index d9f3acc3df..a696336011 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
@@ -38,11 +38,14 @@ public class SubscriptionScheduler {
private static final Logger logger = LoggerFactory.getLogger(SubscriptionScheduler.class);
- @Autowired
- private SubscriberService subscriberService;
-
+ private final SubscriberService subscriberService;
private List<EsrId> esrIds;
+ @Autowired
+ public SubscriptionScheduler(final SubscriberService subscriberService) {
+ this.subscriberService = subscriberService;
+ }
+
public void setInfos(final List<EsrSystemInfo> infos) {
esrIds = new LinkedList<>();
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
new file mode 100644
index 0000000000..1442fa2862
--- /dev/null
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/VnfAaiChecker.java
@@ -0,0 +1,51 @@
+/*-
+ * ============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.NotificationVnfFilterType;
+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 NotificationVnfFilterType 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/application.yaml b/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml
index a2a33bfb5c..c69c95187a 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml
@@ -18,6 +18,7 @@ server:
port: 9098
vevnfmadapter:
+ vnf-filter-json: '{notificationTypes:[VnfLcmOperationOccurrenceNotification],operationStates:[COMPLETED]}'
endpoint: http://so-ve-vnfm-adapter.onap:9098
mso:
@@ -32,6 +33,9 @@ vnfm:
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
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
index 974e6ec544..27def126ef 100644
--- 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
@@ -21,15 +21,14 @@
package org.onap.so.adapters.vevnfm.controller;
import static org.junit.Assert.assertEquals;
-import static org.springframework.test.web.client.ExpectedCount.once;
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.ConfigProperties;
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;
@@ -53,8 +52,8 @@ public class NotificationControllerTest {
private static final String MINIMAL_JSON_CONTENT = "{}";
private static final int ZERO = 0;
- @Value("${vnfm.notification}")
- private String notification;
+ @Autowired
+ private ConfigProperties configProperties;
@Autowired
private WebApplicationContext webApplicationContext;
@@ -62,11 +61,13 @@ public class NotificationControllerTest {
@Autowired
private RestTemplate restTemplate;
+ private String notification;
private MockMvc mvc;
private MockRestServiceServer mockRestServer;
@Before
public void init() {
+ notification = configProperties.getVnfmNotification();
mvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
mockRestServer = MockRestServiceServer.bindTo(restTemplate).build();
}
@@ -77,7 +78,7 @@ public class NotificationControllerTest {
final MockHttpServletRequestBuilder request = MockMvcRequestBuilders.post(notification)
.contentType(MediaType.APPLICATION_JSON).content(MINIMAL_JSON_CONTENT);
- mockRestServer.expect(once(), anything()).andRespond(withSuccess());
+ mockRestServer.expect(anything()).andRespond(withSuccess());
// when
final MvcResult mvcResult = mvc.perform(request).andReturn();
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 9b18cf96dc..5d5ffa6555 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
@@ -34,16 +34,21 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.so.adapters.vevnfm.aai.AaiConnection;
+import org.onap.so.adapters.vevnfm.configuration.ConfigProperties;
@RunWith(MockitoJUnitRunner.class)
public class StartupServiceTest {
private static final String URL = "rt";
+ private static final String ENDPOINT = "localhost";
@Rule
public ExpectedException thrown = ExpectedException.none();
@Mock
+ private ConfigProperties configProperties;
+
+ @Mock
private AaiConnection aaiConnection;
@InjectMocks
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
index b7f1f982a2..02d664e206 100644
--- 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
@@ -33,11 +33,11 @@ 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.ConfigProperties;
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;
@@ -64,8 +64,8 @@ public class SubscribeSenderTest {
GSON = builder.create();
}
- @Value("${vnfm.subscription}")
- private String vnfmSubscription;
+ @Autowired
+ private ConfigProperties configProperties;
@Autowired
private SubscribeSender sender;
@@ -73,10 +73,12 @@ public class SubscribeSenderTest {
@Autowired
private RestTemplate restTemplate;
+ private String vnfmSubscription;
private MockRestServiceServer mockRestServer;
@Before
public void init() {
+ vnfmSubscription = configProperties.getVnfmSubscription();
mockRestServer = MockRestServiceServer.bindTo(restTemplate).build();
}
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
new file mode 100644
index 0000000000..da5992ee42
--- /dev/null
+++ b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/VnfAaiCheckerTest.java
@@ -0,0 +1,87 @@
+/*-
+ * ============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.NotificationVnfFilterType;
+
+@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(NotificationVnfFilterType.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(NotificationVnfFilterType.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(NotificationVnfFilterType.AAI_CHECKED, VNF_ID);
+
+ // then
+ assertFalse(response);
+ }
+
+ @Test
+ public void testNone() {
+ // when
+ final boolean response = checker.vnfCheck(NotificationVnfFilterType.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
new file mode 100644
index 0000000000..2c7f67e459
--- /dev/null
+++ b/adapters/mso-ve-vnfm-adapter/src/test/resources/application.yaml
@@ -0,0 +1,56 @@
+#
+# 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
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java
index 87e8bb4d57..bb2730bd2b 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java
@@ -28,6 +28,7 @@ import org.onap.so.adapters.vnfmadapter.converters.etsicatalog.sol003.PkgOnboard
import org.onap.so.adapters.vnfmadapter.converters.etsicatalog.sol003.VnfPkgInfoConverter;
import org.onap.so.adapters.vnfmadapter.converters.sol003.etsicatalog.PkgmSubscriptionRequestConverter;
import org.onap.so.adapters.vnfmadapter.oauth.OAuth2AccessTokenAdapter;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -43,10 +44,17 @@ import org.springframework.security.oauth2.common.OAuth2AccessToken;
@Configuration
public class MessageConverterConfiguration {
+ private final VnfmAdapterUrlProvider vnfmAdapterUrlProvider;
+
+ @Autowired
+ public MessageConverterConfiguration(final VnfmAdapterUrlProvider vnfmAdapterUrlProvider) {
+ this.vnfmAdapterUrlProvider = vnfmAdapterUrlProvider;
+ }
+
@Bean
public ConversionService conversionService() {
final DefaultConversionService service = new DefaultConversionService();
- service.addConverter(new VnfPkgInfoConverter());
+ service.addConverter(new VnfPkgInfoConverter(vnfmAdapterUrlProvider));
service.addConverter(new PkgmSubscriptionRequestConverter());
service.addConverter(new PkgChangeNotificationConverter());
service.addConverter(new PkgOnboardingNotificationConverter());
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterUrlProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterUrlProvider.java
new file mode 100644
index 0000000000..411a57069f
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterUrlProvider.java
@@ -0,0 +1,105 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.vnfmadapter;
+
+import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
+import static org.onap.so.adapters.vnfmadapter.Constants.ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL;
+import static org.onap.so.adapters.vnfmadapter.Constants.OPERATION_NOTIFICATION_ENDPOINT;
+import static org.onap.so.adapters.vnfmadapter.Constants.PACKAGE_MANAGEMENT_BASE_URL;
+import static org.slf4j.LoggerFactory.getLogger;
+import java.net.URI;
+import java.security.GeneralSecurityException;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.onap.so.utils.CryptoUtils;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+
+/**
+ * Provides VNFM Adapter endpoint URLs
+ *
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+@Configuration
+public class VnfmAdapterUrlProvider {
+
+ private static final Logger logger = getLogger(VnfmAdapterUrlProvider.class);
+ private static final String COLON = ":";
+ private static final int LIMIT = 2;
+
+ private final String vnfmAdapterEndpoint;
+ private final String msoKeyString;
+ private final String vnfmAdapterAuth;
+
+ @Autowired
+ public VnfmAdapterUrlProvider(@Value("${vnfmadapter.endpoint}") final String vnfmAdapterEndpoint,
+ @Value("${mso.key}") final String msoKeyString,
+ @Value("${vnfmadapter.auth:BF29BA36F0CFE1C05507781F6B97EFBCA7EFAC9F595954D465FC43F646883EF585C20A58CBB02528A6FAAC}") final String vnfmAdapterAuth) {
+ this.vnfmAdapterEndpoint = vnfmAdapterEndpoint;
+ this.msoKeyString = msoKeyString;
+ this.vnfmAdapterAuth = vnfmAdapterAuth;
+ }
+
+ public String getEtsiSubscriptionNotificationBaseUrl() {
+ return vnfmAdapterEndpoint + ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL;
+ }
+
+ public URI getSubscriptionUri(final String subscriptionId) {
+ return URI.create(getSubscriptionUriString(subscriptionId));
+ }
+
+ public ImmutablePair<String, String> getDecryptAuth() throws GeneralSecurityException {
+ final String decryptedAuth = CryptoUtils.decrypt(vnfmAdapterAuth, msoKeyString);
+ final String[] auth = decryptedAuth.split(COLON, LIMIT);
+ if (auth.length > 1) {
+ return ImmutablePair.of(auth[0], auth[1]);
+ }
+ logger.error("Unexpected auth value: {}", vnfmAdapterAuth);
+ return ImmutablePair.nullPair();
+ }
+
+ public String getSubscriptionUriString(final String subscriptionId) {
+ return vnfmAdapterEndpoint + PACKAGE_MANAGEMENT_BASE_URL + "/subscriptions/" + subscriptionId;
+ }
+
+ public String getVnfLcmOperationOccurrenceNotificationUrl() {
+ return vnfmAdapterEndpoint + BASE_URL + OPERATION_NOTIFICATION_ENDPOINT;
+ }
+
+ public String getVnfPackageUrl(final String vnfPkgId) {
+ return vnfmAdapterEndpoint + PACKAGE_MANAGEMENT_BASE_URL + "/vnf_packages/" + vnfPkgId;
+ }
+
+ public String getVnfPackageVnfdUrl(final String vnfPkgId) {
+ return getVnfPackageUrl(vnfPkgId) + "/vnfd";
+ }
+
+ public String getVnfPackageContentUrl(final String vnfPkgId) {
+ return getVnfPackageUrl(vnfPkgId) + "/package_content";
+ }
+
+ public String getOauthTokenUrl() {
+ return vnfmAdapterEndpoint + "/oauth/token";
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/VnfPkgInfoConverter.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/VnfPkgInfoConverter.java
index 160b875374..ee941f6951 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/VnfPkgInfoConverter.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/VnfPkgInfoConverter.java
@@ -22,22 +22,22 @@ package org.onap.so.adapters.vnfmadapter.converters.etsicatalog.sol003;
import java.util.ArrayList;
import java.util.List;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.core.convert.converter.Converter;
-import org.springframework.stereotype.Service;
+import org.onap.so.adapters.vnfmadapter.VnfmAdapterUrlProvider;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.Checksum;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VNFPKGMLinkSerializer;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPackageArtifactInfo;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPackageSoftwareImageInfo;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPkgInfo;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2001;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesChecksum;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesSoftwareImages;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPackageSoftwareImageInfo;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesAdditionalArtifacts;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPackageArtifactInfo;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesChecksum;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesLinks;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesLinksSelf;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VNFPKGMLinkSerializer;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.Checksum;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.UriLink;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesSoftwareImages;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.stereotype.Service;
/**
* Converter to convert from an Etsi Catalog Manager {@link VnfPkgInfo} Object to its equivalent SOL003 Object
@@ -48,6 +48,11 @@ import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.UriLink;
@Service
public class VnfPkgInfoConverter implements Converter<VnfPkgInfo, InlineResponse2001> {
private static final Logger logger = LoggerFactory.getLogger(VnfPkgInfoConverter.class);
+ private final VnfmAdapterUrlProvider vnfmAdapterUrlProvider;
+
+ public VnfPkgInfoConverter(final VnfmAdapterUrlProvider vnfmAdapterUrlProvider) {
+ this.vnfmAdapterUrlProvider = vnfmAdapterUrlProvider;
+ }
/**
* Convert a {@link VnfPkgInfo} Object to an {@link InlineResponse2001} Object
@@ -58,7 +63,7 @@ public class VnfPkgInfoConverter implements Converter<VnfPkgInfo, InlineResponse
@Override
public InlineResponse2001 convert(final VnfPkgInfo vnfPkgInfo) {
if (vnfPkgInfo == null) {
- logger.info("No VnfPkgInfo Object Provided for Conversion. (Null object received, returning Null)");
+ logger.error("No VnfPkgInfo Object Provided for Conversion. (Null object received, returning Null)");
return null;
}
final InlineResponse2001 response = new InlineResponse2001();
@@ -87,7 +92,7 @@ public class VnfPkgInfoConverter implements Converter<VnfPkgInfo, InlineResponse
response.setUserDefinedData((vnfPkgInfo.getUserDefinedData()));
if (vnfPkgInfo.getLinks() != null) {
- response.setLinks(convertVNFPKGMLinkSerializerToVnfPackagesLinks(vnfPkgInfo.getLinks()));
+ response.setLinks(getVnfPackagesLinks(vnfPkgInfo.getLinks(), vnfPkgInfo.getId()));
}
return response;
@@ -167,22 +172,27 @@ public class VnfPkgInfoConverter implements Converter<VnfPkgInfo, InlineResponse
return vnfPackagesAdditionalArtifacts;
}
- private VnfPackagesLinks convertVNFPKGMLinkSerializerToVnfPackagesLinks(
- final VNFPKGMLinkSerializer vnfpkgmLinkSerializer) {
+ private VnfPackagesLinks getVnfPackagesLinks(final VNFPKGMLinkSerializer links, final String vnfPkgId) {
final VnfPackagesLinks vnfPackagesLinks = new VnfPackagesLinks();
- vnfPackagesLinks.setSelf(convertUriLinkToVnfPackagesLinksSelf(vnfpkgmLinkSerializer.getSelf()));
- vnfPackagesLinks.setVnfd(convertUriLinkToVnfPackagesLinksSelf(vnfpkgmLinkSerializer.getVnfd()));
- vnfPackagesLinks
- .setPackageContent(convertUriLinkToVnfPackagesLinksSelf(vnfpkgmLinkSerializer.getPackageContent()));
+
+ if (links.getSelf() != null) {
+ vnfPackagesLinks.setSelf(getVnfPackagesLinksSelf(vnfmAdapterUrlProvider.getVnfPackageUrl(vnfPkgId)));
+ }
+
+ if (links.getVnfd() != null) {
+ vnfPackagesLinks.setVnfd(getVnfPackagesLinksSelf(vnfmAdapterUrlProvider.getVnfPackageVnfdUrl(vnfPkgId)));
+ }
+
+ if (links.getPackageContent() != null) {
+ vnfPackagesLinks.setPackageContent(
+ getVnfPackagesLinksSelf(vnfmAdapterUrlProvider.getVnfPackageContentUrl(vnfPkgId)));
+ }
+
return vnfPackagesLinks;
}
- private VnfPackagesLinksSelf convertUriLinkToVnfPackagesLinksSelf(final UriLink uriLink) {
- final VnfPackagesLinksSelf vnfPackagesLinksSelf = new VnfPackagesLinksSelf();
- if (uriLink != null) {
- vnfPackagesLinksSelf.setHref(uriLink.getHref());
- }
- return vnfPackagesLinksSelf;
+ private VnfPackagesLinksSelf getVnfPackagesLinksSelf(final String href) {
+ return new VnfPackagesLinksSelf().href(href);
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProvider.java
new file mode 100644
index 0000000000..95252218c8
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProvider.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
+
+import java.util.Optional;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2001;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public interface EtsiCatalogPackageManagementServiceProvider {
+
+ /**
+ * GET Package Content, from VNF Package.
+ *
+ * @param vnfPkgId The ID of the VNF Package from which the "package_content" will be retrieved.
+ * @return The Package Content of a VNF Package ("vnfPkgId").
+ */
+ Optional<byte[]> getVnfPackageContent(final String vnfPkgId);
+
+ /**
+ * GET VNF packages information from ETSI Catalog. Will return zero or more VNF package representations.
+ *
+ * @return An Array of all VNF packages retrieved from the ETSI Catalog.
+ */
+ Optional<InlineResponse2001[]> getVnfPackages();
+
+ /**
+ * GET specific VNF package information from ETSI Catalog.
+ *
+ * @param vnfPkgId The ID of the VNF Package that you want to query.
+ * @return The VNF package retrieved from the ETSI Catalog
+ */
+ Optional<InlineResponse2001> getVnfPackage(final String vnfPkgId);
+
+ /**
+ * GET specific VNF package VNFD from ETSI Catalog.
+ *
+ * @param vnfPkgId The ID of the VNF Package that you want to query.
+ * @return The VNF package retrieved from the ETSI Catalog
+ */
+ Optional<byte[]> getVnfPackageVnfd(final String vnfPkgId);
+
+ /**
+ * GET Package Artifact, from VNF Package.
+ *
+ * @param vnfPkgId The ID of the VNF Package from which the artifact will be retrieved.
+ * @param artifactPath Sequence of one or more path segments representing the path of the artifact within the VNF
+ * Package, e.g., foo/bar/run.sh
+ * @return The Package Artifact of a VNF Package ("vnfPkgId", "artifactPath").
+ */
+ Optional<byte[]> getVnfPackageArtifact(final String vnfPkgId, final String artifactPath);
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java
index 0dcc49eeac..61db82f38c 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java
@@ -20,80 +20,13 @@
package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
-import java.util.Optional;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.NsdmSubscription;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscription;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2001;
-
/**
* Provides methods for invoking REST calls to the ETSI Catalog Manager.
*
* @author gareth.roper@est.tech
*/
-public interface EtsiCatalogServiceProvider {
-
- /**
- * GET Package Content, from VNF Package.
- *
- * @param vnfPkgId The ID of the VNF Package from which the "package_content" will be retrieved.
- * @return The Package Content of a VNF Package ("vnfPkgId").
- */
- Optional<byte[]> getVnfPackageContent(final String vnfPkgId);
-
- /**
- * GET VNF packages information from ETSI Catalog. Will return zero or more VNF package representations.
- *
- * @return An Array of all VNF packages retrieved from the ETSI Catalog.
- */
- Optional<InlineResponse2001[]> getVnfPackages();
-
- /**
- * GET specific VNF package information from ETSI Catalog.
- *
- * @param vnfPkgId The ID of the VNF Package that you want to query.
- * @return The VNF package retrieved from the ETSI Catalog
- */
- Optional<InlineResponse2001> getVnfPackage(final String vnfPkgId);
-
- /**
- * GET specific VNF package VNFD from ETSI Catalog.
- *
- * @param vnfPkgId The ID of the VNF Package that you want to query.
- * @return The VNF package retrieved from the ETSI Catalog
- */
- Optional<byte[]> getVnfPackageVnfd(final String vnfPkgId);
-
- /**
- * GET Package Artifact, from VNF Package.
- *
- * @param vnfPkgId The ID of the VNF Package from which the artifact will be retrieved.
- * @param artifactPath Sequence of one or more path segments representing the path of the artifact within the VNF
- * Package, e.g., foo/bar/run.sh
- * @return The Package Artifact of a VNF Package ("vnfPkgId", "artifactPath").
- */
- Optional<byte[]> getVnfPackageArtifact(final String vnfPkgId, final String artifactPath);
-
- /**
- * POST the SubscriptionRequest Object.
- *
- * @return The ETSI Catalog Manager's PkgmSubscription object.
- */
- Optional<PkgmSubscription> postSubscription(
- final org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest etsiCatalogManagerSubscriptionRequest);
-
- /**
- * Get the Subscription from ETSI Catalog.
- *
- * @param subscriptionId Subscription ID
- * @return The Subscription {@link NsdmSubscription} from ETSI Catalog
- */
- Optional<NsdmSubscription> getSubscription(final String subscriptionId);
+public interface EtsiCatalogServiceProvider
+ extends EtsiCatalogSubscriptionServiceProvider, EtsiCatalogPackageManagementServiceProvider {
- /**
- * DELETE the SubscriptionRequest Object.
- *
- * @return A Boolean representing if the delete was successful or not.
- */
- boolean deleteSubscription(final String subscriptionId);
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogSubscriptionServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogSubscriptionServiceProvider.java
new file mode 100644
index 0000000000..ed04ad7746
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogSubscriptionServiceProvider.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
+
+import java.util.Optional;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.NsdmSubscription;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscription;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public interface EtsiCatalogSubscriptionServiceProvider {
+
+ /**
+ * POST the SubscriptionRequest Object.
+ *
+ * @return The ETSI Catalog Manager's PkgmSubscription object.
+ */
+ Optional<PkgmSubscription> postSubscription(
+ final org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest etsiCatalogManagerSubscriptionRequest);
+
+ /**
+ * Get the Subscription from ETSI Catalog.
+ *
+ * @param subscriptionId Subscription ID
+ * @return The Subscription {@link NsdmSubscription} from ETSI Catalog
+ */
+ Optional<NsdmSubscription> getSubscription(final String subscriptionId);
+
+ /**
+ * DELETE the SubscriptionRequest Object.
+ *
+ * @return A Boolean representing if the delete was successful or not.
+ */
+ boolean deleteSubscription(final String subscriptionId);
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
index 7c22020287..fabf8839a6 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
@@ -20,17 +20,13 @@
package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
-import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
-import static org.onap.so.adapters.vnfmadapter.Constants.OPERATION_NOTIFICATION_ENDPOINT;
-import com.google.common.reflect.TypeToken;
-import com.google.gson.Gson;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import org.apache.commons.lang3.tuple.ImmutablePair;
import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.so.adapters.vnfmadapter.VnfmAdapterUrlProvider;
import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider;
import org.onap.so.adapters.vnfmadapter.extclients.vim.model.AccessInfo;
import org.onap.so.adapters.vnfmadapter.extclients.vim.model.InterfaceInfo;
@@ -47,15 +43,17 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsFilte
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsFilterVnfInstanceSubscriptionFilter;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.VnfInstancesvnfInstanceIdinstantiateExtVirtualLinks;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.VnfInstancesvnfInstanceIdinstantiateVimConnectionInfo;
-import org.onap.so.utils.CryptoUtils;
import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
import org.onap.vnfmadapter.v1.model.ExternalVirtualLink;
import org.onap.vnfmadapter.v1.model.Tenant;
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.stereotype.Service;
+import com.google.common.reflect.TypeToken;
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
/**
* Provides helper methods for interactions with VNFM.
@@ -66,19 +64,13 @@ public class VnfmHelper {
private static final Logger logger = LoggerFactory.getLogger(VnfmHelper.class);
private static final String SEPARATOR = "_";
private final AaiServiceProvider aaiServiceProvider;
-
- @Value("${vnfmadapter.endpoint}")
- private String vnfmAdapterEndoint;
-
- @Value("${vnfmadapter.auth:E39823AAB2739CC654C4E92B52C05BC34149342D0A46451B00CA508C8EDC62242CE4E9DA9445D3C01A3F13}")
- private String vnfmAdapterAuth;
-
- @Value("${mso.key}")
- private String msoEncryptionKey;
+ private final VnfmAdapterUrlProvider vnfmAdapterUrlProvider;
@Autowired
- public VnfmHelper(final AaiServiceProvider aaiServiceProvider) {
+ public VnfmHelper(final AaiServiceProvider aaiServiceProvider,
+ final VnfmAdapterUrlProvider vnfmAdapterUrlProvider) {
this.aaiServiceProvider = aaiServiceProvider;
+ this.vnfmAdapterUrlProvider = vnfmAdapterUrlProvider;
}
/**
@@ -99,11 +91,6 @@ public class VnfmHelper {
return instantiateVnfRequest;
}
- private String getFlavourId() {
- // TODO read from csar
- return "default";
- }
-
private List<VnfInstancesvnfInstanceIdinstantiateVimConnectionInfo> getVimConnectionInfos(final Tenant tenant) {
final List<VnfInstancesvnfInstanceIdinstantiateVimConnectionInfo> connectionInfos = new ArrayList<>();
connectionInfos.add(getVimConnectionInfo(tenant));
@@ -183,7 +170,7 @@ public class VnfmHelper {
throws GeneralSecurityException {
final LccnSubscriptionRequest lccnSubscriptionRequest = new LccnSubscriptionRequest();
lccnSubscriptionRequest.setAuthentication(getSubscriptionsAuthentication());
- lccnSubscriptionRequest.setCallbackUri(vnfmAdapterEndoint + BASE_URL + OPERATION_NOTIFICATION_ENDPOINT);
+ lccnSubscriptionRequest.setCallbackUri(vnfmAdapterUrlProvider.getVnfLcmOperationOccurrenceNotificationUrl());
final SubscriptionsFilter filter = new SubscriptionsFilter();
filter.addNotificationTypesItem(NotificationTypesEnum.VNFLCMOPERATIONOCCURRENCENOTIFICATION);
final SubscriptionsFilterVnfInstanceSubscriptionFilter vnfInstanceSubscriptionFilter =
@@ -197,19 +184,19 @@ public class VnfmHelper {
private SubscriptionsAuthentication getSubscriptionsAuthentication() throws GeneralSecurityException {
final SubscriptionsAuthentication authentication = new SubscriptionsAuthentication();
- final String[] decrypedAuth = CryptoUtils.decrypt(vnfmAdapterAuth, msoEncryptionKey).split(":");
+ final ImmutablePair<String, String> decrypedAuth = vnfmAdapterUrlProvider.getDecryptAuth();
- SubscriptionsAuthenticationParamsOauth2ClientCredentials oauthParams =
+ final SubscriptionsAuthenticationParamsOauth2ClientCredentials oauthParams =
new SubscriptionsAuthenticationParamsOauth2ClientCredentials();
- oauthParams.setTokenEndpoint(vnfmAdapterEndoint + "/oauth/token");
- oauthParams.clientId(decrypedAuth[0]);
- oauthParams.setClientPassword(decrypedAuth[1]);
+ oauthParams.setTokenEndpoint(vnfmAdapterUrlProvider.getOauthTokenUrl());
+ oauthParams.clientId(decrypedAuth.getLeft());
+ oauthParams.setClientPassword(decrypedAuth.getRight());
authentication.addAuthTypeItem(AuthTypeEnum.OAUTH2_CLIENT_CREDENTIALS);
authentication.paramsOauth2ClientCredentials(oauthParams);
final SubscriptionsAuthenticationParamsBasic basicAuthParams = new SubscriptionsAuthenticationParamsBasic();
- basicAuthParams.setUserName(decrypedAuth[0]);
- basicAuthParams.setPassword(decrypedAuth[1]);
+ basicAuthParams.setUserName(decrypedAuth.getLeft());
+ basicAuthParams.setPassword(decrypedAuth.getRight());
authentication.addAuthTypeItem(AuthTypeEnum.BASIC);
authentication.paramsBasic(basicAuthParams);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
index 073fc93107..eaaa8d8544 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
@@ -28,7 +28,6 @@ import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
-import java.util.ListIterator;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
@@ -40,10 +39,8 @@ import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.aai.domain.yang.EsrVnfm;
-import org.onap.logging.filter.spring.SpringClientPayloadFilter;
import org.onap.so.adapters.vnfmadapter.extclients.AbstractServiceProviderConfiguration;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
-import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
import org.slf4j.Logger;
@@ -54,7 +51,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
-import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.security.oauth2.client.OAuth2RestTemplate;
import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails;
@@ -102,7 +98,7 @@ public class VnfmServiceProviderConfiguration extends AbstractServiceProviderCon
if (trustStore != null) {
setTrustStore(restTemplate);
}
- return new HttpRestServiceProviderImpl(restTemplate, new BasicHttpHeadersProvider());
+ return new HttpRestServiceProviderImpl(restTemplate, new BasicHttpHeadersProvider().getHttpHeaders());
}
private RestTemplate createRestTemplate(final EsrVnfm vnfm) {
@@ -155,14 +151,4 @@ public class VnfmServiceProviderConfiguration extends AbstractServiceProviderCon
}
}
- private void removeSpringClientFilter(final RestTemplate restTemplate) {
- ListIterator<ClientHttpRequestInterceptor> interceptorIterator = restTemplate.getInterceptors().listIterator();
- while (interceptorIterator.hasNext()) {
- ClientHttpRequestInterceptor interceptor = interceptorIterator.next();
- if (interceptor instanceof SOSpringClientFilter || interceptor instanceof SpringClientPayloadFilter) {
- interceptorIterator.remove();
- }
- }
- }
-
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java
index a23eb6c3e3..a63e14c899 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java
@@ -29,7 +29,8 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
-import org.onap.so.adapters.vnfmadapter.Constants;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.onap.so.adapters.vnfmadapter.VnfmAdapterUrlProvider;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.EtsiCatalogServiceProvider;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.BasicAuth;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.NsdmSubscription;
@@ -42,10 +43,8 @@ import org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement
import org.onap.so.adapters.vnfmadapter.rest.exceptions.ConversionFailedException;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.InternalServerErrorException;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.SubscriptionNotFoundException;
-import org.onap.so.utils.CryptoUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.convert.ConversionService;
import org.springframework.stereotype.Service;
@@ -62,22 +61,16 @@ public class SubscriptionManager {
private final PackageManagementCacheServiceProvider packageManagementCacheServiceProvider;
private final ConversionService conversionService;
private final EtsiCatalogServiceProvider etsiCatalogServiceProvider;
- private final String vnfmAdapterEndpoint;
- private final String msoKeyString;
- private final String vnfmAdapterAuth;
+ private final VnfmAdapterUrlProvider vnfmAdapterUrlProvider;
@Autowired
public SubscriptionManager(final PackageManagementCacheServiceProvider packageManagementCacheServiceProvider,
final ConversionService conversionService, final EtsiCatalogServiceProvider etsiCatalogServiceProvider,
- @Value("${vnfmadapter.endpoint}") final String vnfmAdapterEndpoint,
- @Value("${mso.key}") final String msoKeyString,
- @Value("${vnfmadapter.auth:BF29BA36F0CFE1C05507781F6B97EFBCA7EFAC9F595954D465FC43F646883EF585C20A58CBB02528A6FAAC}") final String vnfmAdapterAuth) {
+ final VnfmAdapterUrlProvider vnfmAdapterUrlProvider) {
this.packageManagementCacheServiceProvider = packageManagementCacheServiceProvider;
this.conversionService = conversionService;
this.etsiCatalogServiceProvider = etsiCatalogServiceProvider;
- this.vnfmAdapterEndpoint = vnfmAdapterEndpoint;
- this.vnfmAdapterAuth = vnfmAdapterAuth;
- this.msoKeyString = msoKeyString;
+ this.vnfmAdapterUrlProvider = vnfmAdapterUrlProvider;
}
public Optional<InlineResponse201> createSubscription(final PkgmSubscriptionRequest pkgmSubscriptionRequest)
@@ -100,7 +93,7 @@ public class SubscriptionManager {
final InlineResponse201 response = new InlineResponse201();
response.setId(subscriptionId);
response.setFilter(pkgmSubscriptionRequest.getFilter());
- response.setCallbackUri(getSubscriptionUri(subscriptionId).toString());
+ response.setCallbackUri(vnfmAdapterUrlProvider.getSubscriptionUriString(subscriptionId));
response.setLinks(new SubscriptionsLinks()
.self(new VnfPackagesLinksSelf().href(getSubscriptionUri(subscriptionId).toString())));
@@ -167,8 +160,7 @@ public class SubscriptionManager {
}
public URI getSubscriptionUri(final String subscriptionId) {
- return URI.create(
- vnfmAdapterEndpoint + Constants.PACKAGE_MANAGEMENT_BASE_URL + "/subscriptions/" + subscriptionId);
+ return vnfmAdapterUrlProvider.getSubscriptionUri(subscriptionId);
}
public Optional<PkgmSubscriptionRequest> getSubscriptionRequest(final String subscriptionId) {
@@ -199,25 +191,19 @@ public class SubscriptionManager {
if (etsiCatalogManagerSubscriptionRequest != null) {
etsiCatalogManagerSubscriptionRequest
- .setCallbackUri(vnfmAdapterEndpoint + Constants.ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL);
-
- final String[] auth = decryptAuth();
- final String username = auth[0];
- final String password = auth[1];
-
- etsiCatalogManagerSubscriptionRequest.setAuthentication(
- new org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.SubscriptionAuthentication()
- .addAuthTypeItem(BASIC).paramsBasic(new BasicAuth().userName(username).password(password)));
+ .setCallbackUri(vnfmAdapterUrlProvider.getEtsiSubscriptionNotificationBaseUrl());
+
+ final ImmutablePair<String, String> immutablePair = vnfmAdapterUrlProvider.getDecryptAuth();
+ if (!immutablePair.equals(ImmutablePair.nullPair())) {
+ etsiCatalogManagerSubscriptionRequest.setAuthentication(
+ new org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.SubscriptionAuthentication()
+ .addAuthTypeItem(BASIC).paramsBasic(new BasicAuth().userName(immutablePair.getLeft())
+ .password(immutablePair.getRight())));
+ }
return etsiCatalogManagerSubscriptionRequest;
}
throw new ConversionFailedException(
"Failed to convert Sol003 PkgmSubscriptionRequest to ETSI-Catalog Manager PkgmSubscriptionRequest");
}
- private String[] decryptAuth() throws GeneralSecurityException {
- final String decryptedAuth = CryptoUtils.decrypt(vnfmAdapterAuth, msoKeyString);
- final String[] auth = decryptedAuth.split(":");
- return auth;
- }
-
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementController.java
index f1d20c65ef..6d067902c5 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementController.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementController.java
@@ -170,8 +170,6 @@ public class Sol003PackageManagementController {
+ " Sol003PackageManagementController from the EtsiCatalogManager using the\n GET \"vnf_packages\" by vnfPkgId: \""
+ vnfPkgId + "\" for artifactPath: \"" + artifactPath + "\"\n" + "endpoint.";
logger.error(errorMessage);
- // return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new
- // ProblemDetails().detail(errorMessage));
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new ProblemDetails().detail(errorMessage));
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java
index 31e612a812..be8b0c2e0b 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java
@@ -45,6 +45,7 @@ import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPackageA
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPackageSoftwareImageInfo;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPkgInfo;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2001;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesLinks;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -94,7 +95,11 @@ public class Sol003PackageManagementControllerTest {
private static final String VNFD_VERSION = "vnfdVersion";
private static final String ALGORITHM = "algorithm";
private static final String HASH = "hash";
- private static final String URI_HREF = "uriHref";
+ private static final String EXPECTED_BASE_URL =
+ "https://so-vnfm-adapter.onap:30406/so/vnfm-adapter/v1/vnfpkgm/v1/vnf_packages/";
+ private static final String EXPECTED_SELF_HREF = EXPECTED_BASE_URL + VNF_PACKAGE_ID;
+ private static final String EXPECTED_VNFD_HREF = EXPECTED_BASE_URL + VNF_PACKAGE_ID + "/vnfd";
+ private static final String EXPECTED_PACKAGE_CONTENT_HREF = EXPECTED_BASE_URL + VNF_PACKAGE_ID + "/package_content";
private MockRestServiceServer mockRestServer;
private BasicHttpHeadersProvider basicHttpHeadersProvider;
@@ -346,7 +351,11 @@ public class Sol003PackageManagementControllerTest {
assertEquals(ARTIFACT_PATH, inlineResponse2001.getAdditionalArtifacts().get(0).getArtifactPath());
assertEquals(ALGORITHM, inlineResponse2001.getAdditionalArtifacts().get(0).getChecksum().getAlgorithm());
assertEquals(HASH, inlineResponse2001.getAdditionalArtifacts().get(0).getChecksum().getHash());
- assertEquals(URI_HREF, inlineResponse2001.getLinks().getSelf().getHref());
+ final VnfPackagesLinks links = inlineResponse2001.getLinks();
+ assertNotNull(links);
+ assertEquals(EXPECTED_SELF_HREF, links.getSelf().getHref());
+ assertEquals(EXPECTED_VNFD_HREF, links.getVnfd().getHref());
+ assertEquals(EXPECTED_PACKAGE_CONTENT_HREF, links.getPackageContent().getHref());
}
@Test
@@ -426,7 +435,12 @@ public class Sol003PackageManagementControllerTest {
assertEquals(ARTIFACT_PATH, inlineResponse2001.getAdditionalArtifacts().get(0).getArtifactPath());
assertEquals(ALGORITHM, inlineResponse2001.getAdditionalArtifacts().get(0).getChecksum().getAlgorithm());
assertEquals(HASH, inlineResponse2001.getAdditionalArtifacts().get(0).getChecksum().getHash());
- assertEquals(URI_HREF, inlineResponse2001.getLinks().getSelf().getHref());
+ final VnfPackagesLinks links = inlineResponse2001.getLinks();
+ assertNotNull(links);
+ assertEquals(EXPECTED_SELF_HREF, links.getSelf().getHref());
+ assertEquals(EXPECTED_VNFD_HREF, links.getVnfd().getHref());
+ assertEquals(EXPECTED_PACKAGE_CONTENT_HREF, links.getPackageContent().getHref());
+
}
@Test
@@ -648,9 +662,10 @@ public class Sol003PackageManagementControllerTest {
}
private VNFPKGMLinkSerializer createVNFPKGMLinkSerializerLinks() {
- final UriLink uriLink = new UriLink().href(URI_HREF);
- final VNFPKGMLinkSerializer vnfpkgmLinkSerializer = new VNFPKGMLinkSerializer().self(uriLink);
- return vnfpkgmLinkSerializer;
+ final String baseUrl = "http://msb-iag:443/api/vnfpkgm/v1/vnf_packages";
+ return new VNFPKGMLinkSerializer().self(new UriLink().href(baseUrl + "/myVnfPackageId"))
+ .vnfd(new UriLink().href(baseUrl + "/myVnfPackageId/vnfd"))
+ .packageContent(new UriLink().href(baseUrl + "/myVnfPackageId/package_content"));
}
}
diff --git a/adapters/so-appc-orchestrator/pom.xml b/adapters/so-appc-orchestrator/pom.xml
index 66dcc4dd30..64eefaa151 100644
--- a/adapters/so-appc-orchestrator/pom.xml
+++ b/adapters/so-appc-orchestrator/pom.xml
@@ -14,7 +14,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
- <appc.client.version>1.7.1-SNAPSHOT</appc.client.version>
</properties>
<name>so-appc-orchestrator</name>
<description>MSO APPC-C Orchestrator</description>