aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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.java (renamed from adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/constant/VnfNotificationFilterType.java)4
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java15
-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.java37
-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.java4
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java8
-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.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java176
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java44
-rw-r--r--docs/architecture/architecture.rst7
22 files changed, 391 insertions, 163 deletions
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/VnfNotificationFilterType.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/constant/NotificationVnfFilterType.java
index 09a6ae186d..57935a9fda 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/constant/VnfNotificationFilterType.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/constant/NotificationVnfFilterType.java
@@ -21,9 +21,9 @@
package org.onap.so.adapters.vevnfm.constant;
/**
- * Which incoming Notification with particular VNF id is supported
+ * Select which incoming Notification with particular VNF id should be supported
*/
-public enum VnfNotificationFilterType {
+public enum NotificationVnfFilterType {
/**
* None
*/
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 e187ec99d0..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,14 +20,14 @@
package org.onap.so.adapters.vevnfm.controller;
-import org.onap.so.adapters.vevnfm.constant.VnfNotificationFilterType;
+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;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -38,15 +38,14 @@ public class NotificationController {
private static final Logger logger = LoggerFactory.getLogger(NotificationController.class);
- private final VnfNotificationFilterType vnfFilterType;
+ private final NotificationVnfFilterType notificationVnfFilterType;
private final VnfAaiChecker vnfAaiChecker;
private final DmaapService dmaapService;
@Autowired
- public NotificationController(
- @Value("${notification.vnf-filter-type}") final VnfNotificationFilterType vnfFilterType,
- final VnfAaiChecker vnfAaiChecker, final DmaapService dmaapService) {
- this.vnfFilterType = vnfFilterType;
+ public NotificationController(final ConfigProperties configProperties, final VnfAaiChecker vnfAaiChecker,
+ final DmaapService dmaapService) {
+ this.notificationVnfFilterType = configProperties.getNotificationVnfFilterType();
this.vnfAaiChecker = vnfAaiChecker;
this.dmaapService = dmaapService;
}
@@ -57,7 +56,7 @@ public class NotificationController {
final String vnfInstanceId = notification.getVnfInstanceId();
- if (vnfAaiChecker.vnfCheck(vnfFilterType, vnfInstanceId)) {
+ if (vnfAaiChecker.vnfCheck(notificationVnfFilterType, vnfInstanceId)) {
logger.info("The info with the VNF id '{}' is sent to DMaaP", vnfInstanceId);
dmaapService.send(notification);
} else {
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 d2cf4833ba..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
@@ -25,6 +25,7 @@ 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;
@@ -32,7 +33,6 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthe
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
@@ -40,26 +40,25 @@ public class SubscriberService {
private static final Gson gson = new Gson();
- @Value("${vevnfmadapter.vnf-filter-json}")
- private String vnfFilter;
-
- @Value("${vevnfmadapter.endpoint}")
- private String endpoint;
-
- @Value("${vnfm.notification}")
- private String notification;
-
- @Value("${spring.security.usercredentials[0].username}")
- private String username;
-
- @Value("${spring.security.usercredentials[0].openpass}")
- private String openpass;
+ 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 AuthorizationHeadersProvider headersProvider;
-
- @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) {
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
index 02a9c1855c..1442fa2862 100644
--- 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
@@ -21,7 +21,7 @@
package org.onap.so.adapters.vevnfm.service;
import org.onap.so.adapters.vevnfm.aai.AaiConnection;
-import org.onap.so.adapters.vevnfm.constant.VnfNotificationFilterType;
+import org.onap.so.adapters.vevnfm.constant.NotificationVnfFilterType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -35,7 +35,7 @@ public class VnfAaiChecker {
this.aaiConnection = aaiConnection;
}
- public boolean vnfCheck(final VnfNotificationFilterType filterType, final String vnfId) {
+ public boolean vnfCheck(final NotificationVnfFilterType filterType, final String vnfId) {
switch (filterType) {
case ALL:
return true;
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 56c53a72e8..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
@@ -26,9 +26,9 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat
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;
@@ -52,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;
@@ -61,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();
}
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
index 84705d10ce..da5992ee42 100644
--- 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
@@ -30,7 +30,7 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.adapters.vevnfm.aai.AaiConnection;
-import org.onap.so.adapters.vevnfm.constant.VnfNotificationFilterType;
+import org.onap.so.adapters.vevnfm.constant.NotificationVnfFilterType;
@RunWith(MockitoJUnitRunner.class)
public class VnfAaiCheckerTest {
@@ -46,7 +46,7 @@ public class VnfAaiCheckerTest {
@Test
public void testAll() {
// when
- final boolean response = checker.vnfCheck(VnfNotificationFilterType.ALL, VNF_ID);
+ final boolean response = checker.vnfCheck(NotificationVnfFilterType.ALL, VNF_ID);
// then
assertTrue(response);
@@ -58,7 +58,7 @@ public class VnfAaiCheckerTest {
when(aaiConnection.checkGenericVnfId(eq(VNF_ID))).thenReturn(true);
// when
- final boolean response = checker.vnfCheck(VnfNotificationFilterType.AAI_CHECKED, VNF_ID);
+ final boolean response = checker.vnfCheck(NotificationVnfFilterType.AAI_CHECKED, VNF_ID);
// then
assertTrue(response);
@@ -70,7 +70,7 @@ public class VnfAaiCheckerTest {
when(aaiConnection.checkGenericVnfId(eq(VNF_ID))).thenReturn(false);
// when
- final boolean response = checker.vnfCheck(VnfNotificationFilterType.AAI_CHECKED, VNF_ID);
+ final boolean response = checker.vnfCheck(NotificationVnfFilterType.AAI_CHECKED, VNF_ID);
// then
assertFalse(response);
@@ -79,7 +79,7 @@ public class VnfAaiCheckerTest {
@Test
public void testNone() {
// when
- final boolean response = checker.vnfCheck(VnfNotificationFilterType.NONE, VNF_ID);
+ final boolean response = checker.vnfCheck(NotificationVnfFilterType.NONE, VNF_ID);
// then
assertFalse(response);
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index e686fc2fb5..488b4aab41 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -640,7 +640,8 @@ public class BBInputSetup implements JavaDelegate {
// want
.findAny() // If 'findAny' then return found
.orElse(null);
- } else {
+ }
+ if (vfResourceCustomization == null) {
vfResourceCustomization = bbInputSetupUtils
.getVfModuleCustomizationByModelCuztomizationUUID(modelInfo.getModelCustomizationId());
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index 21b0d834dd..be9965b5b7 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -2947,7 +2947,7 @@ public class BBInputSetupTest {
}
@Test
- public void testMapCatalogVfModuleIfNoVnf() {
+ public void testMapCatalogVfModuleIfNoVfUnderVnf() {
String vnfModelCustomizationUUID = "vnfResourceCustUUID";
String vfModuleCustomizationUUID = "vfModelCustomizationUUID";
VfModule vfModule = new VfModule();
@@ -2958,7 +2958,6 @@ public class BBInputSetupTest {
vnfResourceCust.setModelCustomizationUUID(vnfModelCustomizationUUID);
VfModuleCustomization vfModuleCust = new VfModuleCustomization();
vfModuleCust.setModelCustomizationUUID(vfModuleCustomizationUUID);
- vnfResourceCust.getVfModuleCustomizations().add(vfModuleCust);
ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
doReturn(vfModuleCust).when(SPY_bbInputSetupUtils)
.getVfModuleCustomizationByModelCuztomizationUUID(vfModuleCustomizationUUID);
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
index c63edc93c7..e7e0951d04 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
@@ -54,6 +54,7 @@ import org.onap.aai.domain.yang.LogicalLinks;
import org.onap.aai.domain.yang.PInterface;
import org.onap.aai.domain.yang.Pnf;
import org.onap.aai.domain.yang.Relationship;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.bpmn.core.UrnPropertiesReader;
import org.onap.so.bpmn.core.domain.Resource;
import org.onap.so.bpmn.core.domain.ServiceDecomposition;
@@ -66,7 +67,6 @@ import org.onap.so.client.aai.entities.Relationships;
import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -93,7 +93,7 @@ public class ServicePluginFactory {
private static final String VS_UNMONITORED = "VS_besteffort";
private static final String TS_MONITORED = "TS1";
private static final String TS_UNMONITORED = "TS2";
- private static final String CUSTOM_TP_LIST[] =
+ private static final String[] CUSTOM_TP_LIST =
new String[] {VS_MONITORED, VS_UNMONITORED, TS_MONITORED, TS_UNMONITORED};
static {
@@ -108,10 +108,14 @@ public class ServicePluginFactory {
logger.error("Failed to load property file, Either property file is missing or empty!");
}
} catch (IOException e) {
- logger.error("Failed to load property file!");
+ logger.error("Failed to load property file!", e);
}
}
+ private ServicePluginFactory() {
+
+ }
+
public static synchronized ServicePluginFactory getInstance() {
if (null == instance) {
instance = new ServicePluginFactory();
@@ -119,9 +123,6 @@ public class ServicePluginFactory {
return instance;
}
- private ServicePluginFactory() {
-
- }
private String getInventoryOSSEndPoint() {
return UrnPropertiesReader.getVariable("mso.service-plugin.inventory-oss-endpoint",
@@ -197,7 +198,7 @@ public class ServicePluginFactory {
return false;
}
- Map<String, Object> accessTPInfo = new HashMap<String, Object>();
+ Map<String, Object> accessTPInfo = new HashMap<>();
accessTPInfo.put("access-provider-id", tpInfoMap.get("access-provider-id"));
accessTPInfo.put("access-client-id", tpInfoMap.get("access-client-id"));
accessTPInfo.put("access-topology-id", tpInfoMap.get("access-topology-id"));
@@ -254,7 +255,7 @@ public class ServicePluginFactory {
}
}
- Map<String, Object> tpInfoMap = new HashMap<String, Object>();
+ Map<String, Object> tpInfoMap = new HashMap<>();
// Site resource has location param and SOTNAttachment resource has clientSignal param
if (location == null || clientSignal == null) {
@@ -413,8 +414,6 @@ public class ServicePluginFactory {
serviceRequestInputs.put("remote-access-node-id", crossTPs.get("remote-access-node-id"));
serviceRequestInputs.put("remote-access-ltp-id", crossTPs.get("remote-access-ltp-id"));
}
-
- return;
}
private LogicalLink selectLogicalLink(List<LogicalLink> logicalLinks, String svcName) {
@@ -430,14 +429,14 @@ public class ServicePluginFactory {
if (relationship.getRelatedTo().equals("p-interface")
&& relationship.getRelatedLink().contains("-ltpId-" + localTp)
&& link.getOperationalStatus().equalsIgnoreCase("up")) {
- logger.info("linkname:" + link.getLinkName() + " is matching with allowed list");
+ logger.info("linkname:{} is matching with allowed list", link.getLinkName());
return link;
}
}
}
}
- logger.error("There is no matching logical link for allowed list :" + Arrays.toString(allowedList));
+ logger.error("There is no matching logical link for allowed list :{}", Arrays.toString(allowedList));
return null;
} else {
logger.info("link customization is not required");
@@ -459,7 +458,7 @@ public class ServicePluginFactory {
if (link != null) {
boolean isRemoteLink = false;
- logger.info("processing link :" + link.getLinkName());
+ logger.info("processing link :{}", link.getLinkName());
AAIResultWrapper wrapper = new AAIResultWrapper(link);
Optional<Relationships> optRelationships = wrapper.getRelationships();
List<AAIResourceUri> pInterfaces = new ArrayList<>();
@@ -484,70 +483,7 @@ public class ServicePluginFactory {
remoteTP = pInterfaces.get(1);
}
- if (localTP != null && remoteTP != null) {
- // give local tp
- String tpUrl = localTP.build().toString();
- String localNodeId = tpUrl.split("/")[4];
- tpInfo.put("local-access-node-id", localNodeId);
-
- logger.info("Get info for local TP :" + localNodeId);
- Optional<Pnf> optLocalPnf = client.get(Pnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.PNF, localNodeId));
-
- if (optLocalPnf.isPresent()) {
- Pnf localPnf = optLocalPnf.get();
-
- for (Relationship rel : localPnf.getRelationshipList().getRelationship()) {
- if (rel.getRelatedTo().equalsIgnoreCase("network-resource")) {
- String[] networkRef = rel.getRelatedLink()
- .substring(rel.getRelatedLink().lastIndexOf("/") + 1).split("-");
- if (networkRef.length == 6) {
- tpInfo.put("local-access-provider-id", networkRef[1]);
- tpInfo.put("local-access-client-id", networkRef[3]);
- tpInfo.put("local-access-topology-id", networkRef[5]);
- }
- }
- }
- }
- String ltpIdStr = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
- if (ltpIdStr.contains("-")) {
- tpInfo.put("local-access-ltp-id", ltpIdStr.substring(ltpIdStr.lastIndexOf("-") + 1));
- }
-
- // give remote tp
- tpUrl = remoteTP.build().toString();
- PInterface intfRemote = client.get(PInterface.class, remoteTP).get();
-
- String remoteNodeId = tpUrl.split("/")[4];
- tpInfo.put("remote-access-node-id", remoteNodeId);
-
- logger.info("Get info for remote TP:" + remoteNodeId);
-
- String[] networkRefRemote = intfRemote.getNetworkRef().split("-");
- Optional<Pnf> optRemotePnf = client.get(Pnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.PNF, remoteNodeId));
-
- if (optRemotePnf.isPresent()) {
- Pnf remotePnf = optRemotePnf.get();
-
- for (Relationship rel : remotePnf.getRelationshipList().getRelationship()) {
- if (rel.getRelatedTo().equalsIgnoreCase("network-resource")) {
- String[] networkRef = rel.getRelatedLink()
- .substring(rel.getRelatedLink().lastIndexOf("/") + 1).split("-");
- if (networkRef.length == 6) {
- tpInfo.put("remote-access-provider-id", networkRefRemote[1]);
- tpInfo.put("remote-access-client-id", networkRefRemote[3]);
- tpInfo.put("remote-access-topology-id", networkRefRemote[5]);
- }
- }
- }
- }
-
- String ltpIdStrR = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
- if (ltpIdStrR.contains("-")) {
- tpInfo.put("remote-access-ltp-id", ltpIdStrR.substring(ltpIdStr.lastIndexOf("-") + 1));
- }
- }
+ tpInfo = getTPInfo(client, localTP, remoteTP);
}
}
}
@@ -555,6 +491,91 @@ public class ServicePluginFactory {
return tpInfo;
}
+ private Map<String, Object> getTPInfo(AAIResourcesClient client, AAIResourceUri localTP, AAIResourceUri remoteTP) {
+
+ Map<String, Object> tpInfo = new HashMap<>();
+
+ if (localTP != null && remoteTP != null) {
+ // give local tp
+ String tpUrl = localTP.build().toString();
+ String localNodeId = tpUrl.split("/")[4];
+ tpInfo.put("local-access-node-id", localNodeId);
+
+ logger.info("Get info for local TP :{}", localNodeId);
+ Optional<Pnf> optLocalPnf =
+ client.get(Pnf.class, AAIUriFactory.createResourceUri(AAIObjectType.PNF, localNodeId));
+
+
+ getTpInfoFromLocalTp(tpInfo, optLocalPnf);
+
+ String ltpIdStr = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
+ if (ltpIdStr.contains("-")) {
+ tpInfo.put("local-access-ltp-id", ltpIdStr.substring(ltpIdStr.lastIndexOf("-") + 1));
+ }
+
+ // give remote tp
+ tpUrl = remoteTP.build().toString();
+ PInterface intfRemote = client.get(PInterface.class, remoteTP).get();
+
+ String remoteNodeId = tpUrl.split("/")[4];
+ tpInfo.put("remote-access-node-id", remoteNodeId);
+
+ logger.info("Get info for remote TP:{}", remoteNodeId);
+
+ String[] networkRefRemote = intfRemote.getNetworkRef().split("-");
+ Optional<Pnf> optRemotePnf =
+ client.get(Pnf.class, AAIUriFactory.createResourceUri(AAIObjectType.PNF, remoteNodeId));
+
+ getTpInfoFromRemoteTp(tpInfo, networkRefRemote, optRemotePnf);
+
+ String ltpIdStrR = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
+ if (ltpIdStrR.contains("-")) {
+ tpInfo.put("remote-access-ltp-id", ltpIdStrR.substring(ltpIdStr.lastIndexOf("-") + 1));
+ }
+ }
+
+ return tpInfo;
+ }
+
+
+ private void getTpInfoFromLocalTp(Map<String, Object> tpInfo, Optional<Pnf> optLocalPnf) {
+ if (optLocalPnf.isPresent()) {
+ Pnf localPnf = optLocalPnf.get();
+
+ for (Relationship rel : localPnf.getRelationshipList().getRelationship()) {
+ if (rel.getRelatedTo().equalsIgnoreCase("network-resource")) {
+ String[] networkRef =
+ rel.getRelatedLink().substring(rel.getRelatedLink().lastIndexOf("/") + 1).split("-");
+ if (networkRef.length == 6) {
+ tpInfo.put("local-access-provider-id", networkRef[1]);
+ tpInfo.put("local-access-client-id", networkRef[3]);
+ tpInfo.put("local-access-topology-id", networkRef[5]);
+ }
+ }
+ }
+ }
+ }
+
+ private void getTpInfoFromRemoteTp(Map<String, Object> tpInfo, String[] networkRefRemote,
+ Optional<Pnf> optRemotePnf) {
+ if (optRemotePnf.isPresent()) {
+ Pnf remotePnf = optRemotePnf.get();
+
+ for (Relationship rel : remotePnf.getRelationshipList().getRelationship()) {
+ if (rel.getRelatedTo().equalsIgnoreCase("network-resource")) {
+ String[] networkRef =
+ rel.getRelatedLink().substring(rel.getRelatedLink().lastIndexOf("/") + 1).split("-");
+ if (networkRef.length == 6) {
+ tpInfo.put("remote-access-provider-id", networkRefRemote[1]);
+ tpInfo.put("remote-access-client-id", networkRefRemote[3]);
+ tpInfo.put("remote-access-topology-id", networkRefRemote[5]);
+ }
+ }
+ }
+ }
+ }
+
+
// this method check if pInterface is remote
private boolean isRemotePInterface(AAIResourcesClient client, AAIResourceUri uri) {
@@ -899,6 +920,7 @@ public class ServicePluginFactory {
return responseContent;
} catch (Exception e) {
+ logger.debug("Exception in sendRequest", e);
return null;
} finally {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
index de8a35de06..e614ddd28d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
@@ -109,7 +109,7 @@ public abstract class AbstractSdncOperationTask implements JavaDelegate {
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
postBody = objectMapper.writeValueAsString(inputEntity);
} catch (JsonProcessingException e) {
- logger.error(Arrays.toString(e.getStackTrace()));
+ logger.error("JsonProcessingException in getPostbody", e);
}
return postBody;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java
index 3da5b0de70..3907ae43de 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java
@@ -7,9 +7,9 @@
* 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.
@@ -21,9 +21,14 @@
package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client;
import java.util.Base64;
+import org.onap.so.bpmn.infrastructure.workflow.serviceTask.SdncUnderlayVpnOperationClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class HeaderUtil {
+ private static Logger logger = LoggerFactory.getLogger(HeaderUtil.class);
+
public static final String USER = "admin";
public static final String PASS = "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U";
public static final String DefaulAuth = getAuthorization(USER, PASS);
@@ -38,6 +43,7 @@ public class HeaderUtil {
try {
base64 = Base64.getEncoder().encodeToString(str.getBytes("utf-8"));
} catch (Exception ex) {
+ logger.error("Exception in base64Encode", ex);
}
return base64;
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
index 9adae88a5a..67ce6bfbe9 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
@@ -41,6 +41,7 @@ import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
+import org.onap.so.adapters.nwrest.NetworkRequestCommon;
import org.onap.so.adapters.nwrest.UpdateNetworkError;
import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
@@ -224,7 +225,7 @@ public class NetworkAdapterRestV1Test {
deleteNetworkRequest.setMessageId(messageId);
delegateExecution.setVariable("networkAdapterRequest", deleteNetworkRequest);
Status status = Status.OK;
- String responseEntity = "createNetworkResponse";
+ String responseEntity = "deleteNetworkResponse";
Optional<Response> response = Optional.of(createResponse(status, responseEntity));
when(networkAdapterResources.deleteNetworkAsync(deleteNetworkRequest)).thenReturn(response);
// when
@@ -233,6 +234,47 @@ public class NetworkAdapterRestV1Test {
verifyExecutionContent(status, responseEntity, messageId);
}
+ @Test
+ public void callNetworkAdapter_UpdateNetworkRequestSuccess() throws Exception {
+ // given
+ String messageId = "UpdateNetReqMessageId";
+ UpdateNetworkRequest updateNetworkRequest = new UpdateNetworkRequest();
+ updateNetworkRequest.setMessageId(messageId);
+ delegateExecution.setVariable("networkAdapterRequest", updateNetworkRequest);
+ Status status = Status.OK;
+ String responseEntity = "updateNetworkResponse";
+ Optional<Response> response = Optional.of(createResponse(status, responseEntity));
+ when(networkAdapterResources.updateNetworkAsync(updateNetworkRequest)).thenReturn(response);
+ // when
+ networkAdapterRestV1Tasks.callNetworkAdapter(delegateExecution);
+ // then
+ verifyExecutionContent(status, responseEntity, messageId);
+ }
+
+ @Test
+ public void callNetworkAdapterError_networkAdapterRequestIsNull() {
+ // when
+ networkAdapterRestV1Tasks.callNetworkAdapter(delegateExecution);
+ // then
+ verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(any(DelegateExecution.class), eq(7000),
+ any(Exception.class), eq(ONAPComponents.SO));
+ }
+
+ @Test
+ public void callNetworkAdapterError_noResponse() throws Exception {
+ // given
+ String messageId = "UpdateNetReqMessageId";
+ UpdateNetworkRequest updateNetworkRequest = new UpdateNetworkRequest();
+ updateNetworkRequest.setMessageId(messageId);
+ delegateExecution.setVariable("networkAdapterRequest", updateNetworkRequest);
+ when(networkAdapterResources.updateNetworkAsync(updateNetworkRequest)).thenReturn(Optional.empty());
+ // when
+ networkAdapterRestV1Tasks.callNetworkAdapter(delegateExecution);
+ // then
+ verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(any(DelegateExecution.class), eq(7000),
+ any(Exception.class), eq(ONAPComponents.SO));
+ }
+
private void verifyExecutionContent(Status status, String responseEntity, String messageId) {
assertEquals(delegateExecution.getVariable("NETWORKREST_networkAdapterStatusCode"),
Integer.toString(status.getStatusCode()));
diff --git a/docs/architecture/architecture.rst b/docs/architecture/architecture.rst
index 72b108a271..a75591b885 100644
--- a/docs/architecture/architecture.rst
+++ b/docs/architecture/architecture.rst
@@ -1,6 +1,7 @@
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
.. Copyright 2018 Huawei Technologies Co., Ltd.
+.. _architecture:
SO - Architecture
=================
@@ -25,7 +26,7 @@ SO Sub-Components
* Handle service-level and infrastructure (VNF & network) requests
Service-agnostic APIs
- * “Service Instantiation API”
+ * "Service Instantiation API"
Model-driven recipe selection
* Use SO Catalog to map input requests to BPMN flows
@@ -43,7 +44,7 @@ SO Sub-Components
Expose RESTful interface to API-H (unique path per recipe)
- Make use of common “building block” sub-flows
+ Make use of common "building block" sub-flows
Sequence orchestration steps for each Resource in the recipe
* Request and configure network resources via SDN-C
@@ -120,4 +121,4 @@ Third Party and Open Source
**Other Open Source Components of Note:**
Tomcat
MySQL/MariaDB
- Openstack Java SDK (“woorea”)
+ Openstack Java SDK ("woorea")