aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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/V7.3__Add_Columns_Tenant_Name_Product_Family_Name.sql7
-rw-r--r--adapters/mso-ve-vnfm-adapter/pom.xml8
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java29
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java8
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java2
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java4
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java5
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java38
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscribeSender.java (renamed from adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSender.java)38
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java43
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java71
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml13
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java6
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java39
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java52
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscribeSenderTest.java (renamed from adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSenderTest.java)21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java2
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectType.java3
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java7
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java12
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java16
-rw-r--r--deployment-configs/src/main/resources/logger/logback-spring.xml2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java54
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java7
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java68
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java21
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java51
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/ServiceFromAAI.json4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql2
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql9
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java3
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java23
-rw-r--r--pom.xml6
35 files changed, 578 insertions, 118 deletions
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 3deabb3ce1..24dab2fc5b 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
@@ -145,6 +145,8 @@ public class ArchiveInfraRequestsScheduler {
archivedInfra.setVnfType(iar.getVnfType());
archivedInfra.setVolumeGroupId(iar.getVolumeGroupId());
archivedInfra.setVolumeGroupName(iar.getVolumeGroupName());
+ archivedInfra.setProductFamilyName(iar.getProductFamilyName());
+ archivedInfra.setTenantName(iar.getTenantName());
newArchivedReqs.add(archivedInfra);
oldInfraReqs.add(iar);
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.3__Add_Columns_Tenant_Name_Product_Family_Name.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.3__Add_Columns_Tenant_Name_Product_Family_Name.sql
new file mode 100644
index 0000000000..a79b1a86c1
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.3__Add_Columns_Tenant_Name_Product_Family_Name.sql
@@ -0,0 +1,7 @@
+use requestdb;
+
+ALTER TABLE infra_active_requests ADD COLUMN IF NOT EXISTS TENANT_NAME varchar(200);
+ALTER TABLE archived_infra_requests ADD COLUMN IF NOT EXISTS TENANT_NAME varchar(200);
+
+ALTER TABLE infra_active_requests ADD COLUMN IF NOT EXISTS PRODUCT_FAMILY_NAME varchar(200);
+ALTER TABLE archived_infra_requests ADD COLUMN IF NOT EXISTS PRODUCT_FAMILY_NAME varchar(200); \ No newline at end of file
diff --git a/adapters/mso-ve-vnfm-adapter/pom.xml b/adapters/mso-ve-vnfm-adapter/pom.xml
index 4472956eb7..d58f183ab0 100644
--- a/adapters/mso-ve-vnfm-adapter/pom.xml
+++ b/adapters/mso-ve-vnfm-adapter/pom.xml
@@ -30,6 +30,10 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
+ <groupId>org.springframework.retry</groupId>
+ <artifactId>spring-retry</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-vnfm-adapter-ext-clients</artifactId>
<version>${project.version}</version>
@@ -52,6 +56,10 @@
<artifactId>jersey-hk2</artifactId>
</dependency>
<dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
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 188b6718f2..a2bd603ae6 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
@@ -22,11 +22,14 @@ package org.onap.so.adapters.vevnfm.aai;
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.EsrVnfm;
import org.onap.aai.domain.yang.EsrVnfmList;
+import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.entities.uri.Depth;
import org.slf4j.Logger;
@@ -40,10 +43,30 @@ public class AaiConnection {
private static final int FIRST_INDEX = 0;
- public EsrSystemInfo receiveVnfm() {
+ private static void isValid(final EsrSystemInfo info) throws VeVnfmException {
+ if (info == null || Strings.isBlank(info.getServiceUrl())) {
+ throw new VeVnfmException("No 'url' field in VNFM info");
+ }
+ }
+
+ public EsrSystemInfo receiveVnfm() throws VeVnfmException {
+ EsrSystemInfo info;
+
+ try {
+ info = receiveVnfmInternal();
+ } catch (Exception e) {
+ throw new VeVnfmException(e);
+ }
+
+ isValid(info);
+
+ return info;
+ }
+
+ private EsrSystemInfo receiveVnfmInternal() {
final AAIResourcesClient resourcesClient = new AAIResourcesClient();
- final Optional<EsrVnfmList> response =
- resourcesClient.get(EsrVnfmList.class, AAIUriFactory.createResourceUri(AAIObjectType.VNFM_LIST));
+ final AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VNFM_LIST);
+ final Optional<EsrVnfmList> response = resourcesClient.get(EsrVnfmList.class, resourceUri);
if (response.isPresent()) {
final EsrVnfmList esrVnfmList = response.get();
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 f7b7283c59..ae330f7ed6 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java
@@ -20,7 +20,9 @@
package org.onap.so.adapters.vevnfm.configuration;
+import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.so.adapters.vevnfm.service.StartupService;
+import org.onap.so.adapters.vevnfm.service.SubscriptionScheduler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.annotation.Configuration;
@@ -39,10 +41,14 @@ public class StartupConfiguration {
@Autowired
private StartupService startupService;
+ @Autowired
+ private SubscriptionScheduler subscriptionScheduler;
+
@EventListener(ApplicationReadyEvent.class)
public void onApplicationReadyEvent() throws Exception {
if (!environment.acceptsProfiles(Profiles.of(TEST_PROFILE))) {
- startupService.run();
+ final EsrSystemInfo info = startupService.receiveVnfm();
+ subscriptionScheduler.setInfo(info);
}
}
}
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 1882b4e183..cb324c32a9 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
@@ -38,7 +38,7 @@ public class NotificationController {
@Autowired
private DmaapService dmaapService;
- @PostMapping("${notification.url}")
+ @PostMapping("${vnfm.notification}")
public ResponseEntity receiveNotification(@RequestBody final VnfLcmOperationOccurrenceNotification notification) {
logger.info("Notification received {}", notification);
dmaapService.send(notification);
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java
index abd9ff9d33..a0c1c1e9db 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java
@@ -25,4 +25,8 @@ public class VeVnfmException extends Exception {
public VeVnfmException(final String message) {
super(message);
}
+
+ public VeVnfmException(final Throwable cause) {
+ super(cause);
+ }
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java
index 251e0c426b..838a67d115 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java
@@ -20,11 +20,16 @@
package org.onap.so.adapters.vevnfm.provider;
+import org.apache.logging.log4j.util.Strings;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
public class AuthorizationHeadersProvider extends BasicHttpHeadersProvider {
public void addAuthorization(final String authorization) {
+ if (Strings.isBlank(authorization)) {
+ return;
+ }
+
getHttpHeaders().set(AUTHORIZATION_HEADER, authorization);
}
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 dfbafa223c..3d215148f2 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java
@@ -20,35 +20,43 @@
package org.onap.so.adapters.vevnfm.service;
-import org.apache.logging.log4j.util.Strings;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.so.adapters.vevnfm.aai.AaiConnection;
import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.retry.annotation.Backoff;
+import org.springframework.retry.annotation.EnableRetry;
+import org.springframework.retry.annotation.Recover;
+import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
@Service
+@EnableRetry
public class StartupService {
- @Autowired
- private AaiConnection aaiConnection;
+ private static final Logger logger = LoggerFactory.getLogger(StartupService.class);
+
+ @Value("${vnfm.default-endpoint}")
+ private String vnfmDefaultEndpoint;
@Autowired
- private SubscriberService subscriberService;
+ private AaiConnection aaiConnection;
- private static void isValid(final EsrSystemInfo info) throws VeVnfmException {
- if (Strings.isBlank(info.getServiceUrl())) {
- throw new VeVnfmException("No 'url' field in VNFM info");
- }
+ @Retryable(value = {VeVnfmException.class}, maxAttempts = 5, backoff = @Backoff(delay = 5000, multiplier = 10))
+ public EsrSystemInfo receiveVnfm() throws VeVnfmException {
+ return aaiConnection.receiveVnfm();
}
- public void run() throws Exception {
- final EsrSystemInfo info = aaiConnection.receiveVnfm();
- isValid(info);
- final boolean done = subscriberService.subscribe(info);
+ @Recover
+ public EsrSystemInfo recoverReceiveVnfm(final Throwable e) {
+ logger.warn("Connection to AAI failed");
+ final EsrSystemInfo info = new EsrSystemInfo();
+ info.setServiceUrl(vnfmDefaultEndpoint);
+ logger.warn("This EsrSystemInfo is used by default: {}", info);
- if (!done) {
- throw new VeVnfmException("Could not subscribe to VNFM");
- }
+ return info;
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSender.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscribeSender.java
index 8fdfb41d26..d01c3c8f66 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSender.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscribeSender.java
@@ -18,9 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vevnfm.subscription;
+package org.onap.so.adapters.vevnfm.service;
+import com.fasterxml.jackson.annotation.JsonProperty;
import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.slf4j.Logger;
@@ -29,11 +31,14 @@ 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.Component;
+import org.springframework.stereotype.Service;
+import lombok.ToString;
-@Component
+@Service
public class SubscribeSender {
+ public static final String SLASH = "/";
+
private static final Logger logger = LoggerFactory.getLogger(SubscribeSender.class);
@Value("${vnfm.subscription}")
@@ -42,18 +47,37 @@ public class SubscribeSender {
@Autowired
private HttpRestServiceProvider restProvider;
- public boolean send(final EsrSystemInfo info, final LccnSubscriptionRequest request) {
- final ResponseEntity<String> response = restProvider.postHttpRequest(request, getUrl(info), String.class);
+ public String send(final EsrSystemInfo info, final LccnSubscriptionRequest request) throws VeVnfmException {
+ final ResponseEntity<SubscribeToManoResponse> response =
+ restProvider.postHttpRequest(request, getUrl(info), SubscribeToManoResponse.class);
final HttpStatus statusCode = response.getStatusCode();
- final String body = response.getBody();
+ final SubscribeToManoResponse body = response.getBody();
logger.info("The VNFM replied with the code {} and the body {}", statusCode, body);
- return HttpStatus.CREATED == statusCode;
+ if (HttpStatus.CREATED != statusCode) {
+ throw new VeVnfmException("The status code was different than " + HttpStatus.CREATED);
+ }
+
+ return body.id;
+ }
+
+ public boolean check(final EsrSystemInfo info, final String id) {
+ final ResponseEntity<SubscribeToManoResponse> response =
+ restProvider.getHttpResponse(getUrl(info) + SLASH + id, SubscribeToManoResponse.class);
+ return response.getBody() != null && response.getBody().id.equals(id);
}
private String getUrl(final EsrSystemInfo info) {
return info.getServiceUrl() + vnfmSubscription;
}
+
+ @ToString
+ static class SubscribeToManoResponse {
+ @JsonProperty("id")
+ String id;
+ @JsonProperty("callbackUri")
+ String callbackUri;
+ }
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java
index eefd9ba93b..9760584d7a 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
@@ -22,9 +22,10 @@ package org.onap.so.adapters.vevnfm.service;
import com.squareup.okhttp.Credentials;
import java.util.Collections;
+import org.apache.logging.log4j.util.Strings;
import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
import org.onap.so.adapters.vevnfm.provider.AuthorizationHeadersProvider;
-import org.onap.so.adapters.vevnfm.subscription.SubscribeSender;
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;
@@ -35,16 +36,11 @@ import org.springframework.stereotype.Service;
@Service
public class SubscriberService {
- private static final char COLON = ':';
+ @Value("${vevnfmadapter.endpoint}")
+ private String endpoint;
- @Value("${system.url}")
- private String systemUrl;
-
- @Value("${server.port}")
- private String serverPort;
-
- @Value("${notification.url}")
- private String notificationUrl;
+ @Value("${vnfm.notification}")
+ private String notification;
@Value("${spring.security.usercredentials[0].username}")
private String username;
@@ -59,19 +55,40 @@ public class SubscriberService {
private SubscribeSender sender;
private static String getAuthorization(final EsrSystemInfo info) {
- return Credentials.basic(info.getUserName(), info.getPassword());
+ if (info == null) {
+ return null;
+ }
+
+ final String userName = info.getUserName();
+
+ if (Strings.isBlank(userName)) {
+ return null;
+ }
+
+ final String password = info.getPassword();
+ return Credentials.basic(userName, password);
}
- public boolean subscribe(final EsrSystemInfo info) {
+ public String subscribe(final EsrSystemInfo info) throws VeVnfmException {
try {
headersProvider.addAuthorization(getAuthorization(info));
final LccnSubscriptionRequest request = createRequest();
return sender.send(info, request);
+ } catch (Exception e) {
+ throw new VeVnfmException(e);
} finally {
headersProvider.removeAuthorization();
}
}
+ public boolean checkSubscription(final EsrSystemInfo info, final String id) throws VeVnfmException {
+ try {
+ return sender.check(info, id);
+ } catch (Exception e) {
+ throw new VeVnfmException(e);
+ }
+ }
+
private LccnSubscriptionRequest createRequest() {
final LccnSubscriptionRequest request = new LccnSubscriptionRequest();
request.callbackUri(getCallbackUri());
@@ -87,6 +104,6 @@ public class SubscriberService {
}
private String getCallbackUri() {
- return systemUrl + COLON + serverPort + notificationUrl;
+ 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
new file mode 100644
index 0000000000..16427437fc
--- /dev/null
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java
@@ -0,0 +1,71 @@
+/*-
+ * ============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.aai.domain.yang.EsrSystemInfo;
+import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Service;
+
+@Service
+@EnableScheduling
+public class SubscriptionScheduler {
+
+ private static final Logger logger = LoggerFactory.getLogger(SubscriptionScheduler.class);
+
+ @Autowired
+ private SubscriberService subscriberService;
+
+ private String subscribedId;
+
+ private EsrSystemInfo info;
+
+ public void setInfo(final EsrSystemInfo info) {
+ this.info = info;
+ }
+
+ @Scheduled(fixedRate = 5000, initialDelay = 2000)
+ void subscribeTask() throws VeVnfmException {
+ if (info != null) {
+ if (subscribedId == null) {
+ logger.info("Starting subscribe task");
+ subscribedId = subscriberService.subscribe(info);
+ }
+ }
+ }
+
+ @Scheduled(fixedRate = 20000)
+ void checkSubscribeTask() throws VeVnfmException {
+ if (info != null) {
+ if (subscribedId != null) {
+ logger.info("Checking subscription: {}", subscribedId);
+ if (!subscriberService.checkSubscription(info, subscribedId)) {
+ logger.info("Subscription {} not available", subscribedId);
+ subscribedId = null;
+ }
+ }
+ }
+ }
+}
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 35871c51ac..72198b83c1 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml
@@ -15,13 +15,10 @@
# limitations under the License.
server:
- port: 8080
+ port: 9098
-system:
- url: http://localhost
-
-notification:
- url: /lcm/v1/vnf/instances/notifications
+vevnfmadapter:
+ endpoint: http://so-ve-vnfm-adapter.onap:9098
mso:
key: 07a7159d3bf51a0e53be7a8f89699be7
@@ -31,10 +28,12 @@ aai:
auth: 75C4483F9C05E2C33A8602635FA532397EC44AB667A2B64DED4FEE08DD932F2E3C1FEE
vnfm:
+ default-endpoint: https://so-vnfm-simulator.onap:9093
subscription: /vnflcm/v1/subscriptions
+ notification: /lcm/v1/vnf/instances/notifications
dmaap:
- endpoint: http://message-router:30227
+ endpoint: http://message-router.onap:30227
topic: /events/unauthenticated.DCAE_CL_OUTPUT
spring:
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 57638a165a..974e6ec544 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
@@ -53,8 +53,8 @@ public class NotificationControllerTest {
private static final String MINIMAL_JSON_CONTENT = "{}";
private static final int ZERO = 0;
- @Value("${notification.url}")
- private String notificationUrl;
+ @Value("${vnfm.notification}")
+ private String notification;
@Autowired
private WebApplicationContext webApplicationContext;
@@ -74,7 +74,7 @@ public class NotificationControllerTest {
@Test
public void testReceiveNotification() throws Exception {
// given
- final MockHttpServletRequestBuilder request = MockMvcRequestBuilders.post(notificationUrl)
+ final MockHttpServletRequestBuilder request = MockMvcRequestBuilders.post(notification)
.contentType(MediaType.APPLICATION_JSON).content(MINIMAL_JSON_CONTENT);
mockRestServer.expect(once(), anything()).andRespond(withSuccess());
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java
index 64503ddfc2..f9ae427086 100644
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java
+++ b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java
@@ -28,6 +28,8 @@ import org.springframework.http.HttpHeaders;
public class AuthorizationHeadersProviderTest {
private static final String AUTHORIZATION_EXAMPLE = "authorization";
+ private static final String BLANK_EXAMPLE = "\t\n";
+ private static final String EMPTY = "";
private final AuthorizationHeadersProvider provider = new AuthorizationHeadersProvider();
@@ -44,4 +46,41 @@ public class AuthorizationHeadersProviderTest {
assertEquals(size, headers.size());
assertFalse(headers.containsKey(AUTHORIZATION_HEADER));
}
+
+ @Test
+ public void testBlankAuthorization() {
+ final HttpHeaders headers = provider.getHttpHeaders();
+ final int size = headers.size();
+
+ provider.addAuthorization(BLANK_EXAMPLE);
+ assertEquals(size, headers.size());
+ }
+
+ @Test
+ public void testEmptyAuthorization() {
+ final HttpHeaders headers = provider.getHttpHeaders();
+ final int size = headers.size();
+
+ provider.addAuthorization(EMPTY);
+ assertEquals(size, headers.size());
+ }
+
+ @Test
+ public void testNullAuthorization() {
+ final HttpHeaders headers = provider.getHttpHeaders();
+ final int size = headers.size();
+
+ provider.addAuthorization(null);
+ assertEquals(size, headers.size());
+ }
+
+ @Test
+ public void testRemoveAuthorization() {
+ final HttpHeaders headers = provider.getHttpHeaders();
+ final int size = headers.size();
+
+ provider.removeAuthorization();
+ provider.removeAuthorization();
+ assertEquals(size, headers.size());
+ }
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java
index 0f9c23e261..d1d34a706f 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
@@ -20,7 +20,9 @@
package org.onap.so.adapters.vevnfm.service;
-import static org.mockito.Mockito.*;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -30,62 +32,34 @@ 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.exception.VeVnfmException;
@RunWith(MockitoJUnitRunner.class)
public class StartupServiceTest {
- @Mock
- private AaiConnection aaiConnection;
+ private static final String URL = "rt";
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
@Mock
- private SubscriberService subscriberService;
+ private AaiConnection aaiConnection;
@InjectMocks
private StartupService startupService;
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
@Test
public void testSuccess() throws Exception {
// given
final EsrSystemInfo info = new EsrSystemInfo();
- info.setServiceUrl("lh");
- when(aaiConnection.receiveVnfm()).thenReturn(info);
- when(subscriberService.subscribe(info)).thenReturn(true);
-
- // when
- startupService.run();
-
- // then
- verify(aaiConnection, times(1)).receiveVnfm();
- verify(subscriberService, times(1)).subscribe(info);
- }
+ info.setServiceUrl(URL);
- @Test
- public void testFailureAai() throws Exception {
- // given
- final EsrSystemInfo info = new EsrSystemInfo();
when(aaiConnection.receiveVnfm()).thenReturn(info);
- thrown.expect(VeVnfmException.class);
-
// when
- startupService.run();
- }
-
- @Test
- public void testFailureSubscriber() throws Exception {
- // given
- final EsrSystemInfo info = new EsrSystemInfo();
- info.setServiceUrl("lh");
- when(aaiConnection.receiveVnfm()).thenReturn(info);
- when(subscriberService.subscribe(info)).thenReturn(false);
+ final EsrSystemInfo systemInfo = startupService.receiveVnfm();
- thrown.expect(VeVnfmException.class);
-
- // when
- startupService.run();
+ // then
+ verify(aaiConnection).receiveVnfm();
+ assertEquals(info, systemInfo);
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSenderTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscribeSenderTest.java
index d1fda0eee6..b7f1f982a2 100644
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSenderTest.java
+++ b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscribeSenderTest.java
@@ -18,9 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vevnfm.subscription;
+package org.onap.so.adapters.vevnfm.service;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
+import static org.onap.so.adapters.vevnfm.service.SubscribeSender.SLASH;
import static org.springframework.http.HttpHeaders.CONTENT_TYPE;
import static org.springframework.test.web.client.ExpectedCount.once;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.*;
@@ -33,6 +34,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.so.adapters.vevnfm.configuration.StartupConfiguration;
+import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -50,8 +52,9 @@ import org.springframework.web.client.RestTemplate;
@ActiveProfiles(StartupConfiguration.TEST_PROFILE)
public class SubscribeSenderTest {
- private static final String SLASH = "/";
- private static final String MINIMAL_JSON_CONTENT = "{}";
+ private static final String URL = "lh";
+ private static final String ID = "1a2s3d4f";
+ private static final String JSON = "{\"id\":\"" + ID + "\"}";
private static final Gson GSON;
@@ -78,22 +81,22 @@ public class SubscribeSenderTest {
}
@Test
- public void testSuccess() {
+ public void testSuccess() throws VeVnfmException {
// given
final EsrSystemInfo info = new EsrSystemInfo();
- info.setServiceUrl("lh");
+ info.setServiceUrl(URL);
final LccnSubscriptionRequest request = new LccnSubscriptionRequest();
mockRestServer.expect(once(), requestTo(SLASH + info.getServiceUrl() + vnfmSubscription))
.andExpect(header(CONTENT_TYPE, CoreMatchers.containsString(MediaType.APPLICATION_JSON_VALUE)))
.andExpect(method(HttpMethod.POST)).andExpect(content().json(GSON.toJson(request)))
- .andRespond(withStatus(HttpStatus.CREATED).body(MINIMAL_JSON_CONTENT));
+ .andRespond(withStatus(HttpStatus.CREATED).body(JSON).contentType(MediaType.APPLICATION_JSON));
// when
- final boolean done = sender.send(info, request);
+ final String id = sender.send(info, request);
// then
- assertTrue(done);
mockRestServer.verify();
+ assertEquals(ID, id);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
index 4285e9aa84..663b097b78 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
@@ -121,7 +121,7 @@ public class VnfAdapterCreateTasks {
try {
volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
} catch (BBObjectNotFoundException bbException) {
- logger.error("Exception occurred if bb objrct not found in VnfAdapterCreateTasks createVfModule ",
+ logger.error("Exception occurred if bb object not found in VnfAdapterCreateTasks createVfModule ",
bbException);
}
CloudRegion cloudRegion = gBBInput.getCloudRegion();
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
index c2c8e933b1..db541f7f7f 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
@@ -58,6 +58,7 @@ import org.onap.aai.domain.yang.PortGroup;
import org.onap.aai.domain.yang.Project;
import org.onap.aai.domain.yang.Pserver;
import org.onap.aai.domain.yang.RouteTableReference;
+import org.onap.aai.domain.yang.Service;
import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.aai.domain.yang.ServiceSubscription;
import org.onap.aai.domain.yang.SpPartner;
@@ -122,6 +123,8 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable {
public static final AAIObjectType SERVICE_INSTANCE_METADATA = new AAIObjectType(
AAIObjectType.SERVICE_INSTANCE + "/metadata", org.onap.aai.domain.yang.v13.Metadata.class);
+ public static final AAIObjectType SERVICE = new AAIObjectType(
+ AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/services/service/{service-id}", Service.class);
public static final AAIObjectType SERVICE_INSTANCE =
new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), ServiceInstance.class);
public static final AAIObjectType PROJECT = new AAIObjectType(AAINamespaceConstants.BUSINESS, Project.class);
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java
index 5ae1082464..3e85cc5ec6 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java
@@ -3,6 +3,7 @@ package org.onap.so.logging.jaxrs.filter;
import javax.annotation.Priority;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
+import javax.ws.rs.container.PreMatching;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.logger.HttpHeadersConstants;
import org.onap.so.logger.LogConstants;
@@ -11,6 +12,7 @@ import org.springframework.stereotype.Component;
import org.onap.logging.filter.base.AuditLogContainerFilter;
@Priority(1)
+@PreMatching
@Component
public class SOAuditLogContainerFilter extends AuditLogContainerFilter {
@@ -26,9 +28,4 @@ public class SOAuditLogContainerFilter extends AuditLogContainerFilter {
}
MDC.put(LogConstants.URI_BASE, request.getUriInfo().getBaseUri().toString());
}
-
- @Override
- protected void additionalPostHandling(ContainerResponseContext response) {
- // override to add additional post handling
- }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java b/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java
index 4a284b55ec..777dcc6171 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java
@@ -37,6 +37,8 @@ public class CloudConfiguration implements Serializable {
protected String aicNodeClli;
@JsonProperty("tenantId")
protected String tenantId;
+ @JsonProperty("tenantName")
+ protected String tenantName;
@JsonProperty("cloudOwner")
protected String cloudOwner = Defaults.CLOUD_OWNER.toString();
@JsonProperty("lcpCloudRegionId")
@@ -82,6 +84,13 @@ public class CloudConfiguration implements Serializable {
this.tenantId = value;
}
+ public String getTenantName() {
+ return tenantName;
+ }
+
+ public void setTenantName(String tenantName) {
+ this.tenantName = tenantName;
+ }
public String getLcpCloudRegionId() {
return lcpCloudRegionId;
@@ -102,7 +111,8 @@ public class CloudConfiguration implements Serializable {
@Override
public String toString() {
return new ToStringBuilder(this).append("aicNodeClli", getAicNodeClli()).append("tenantId", getTenantId())
- .append("cloudOwner", getCloudOwner()).append("lcpCloudRegionId", getLcpCloudRegionId()).toString();
+ .append("tenantName", getTenantName()).append("cloudOwner", getCloudOwner())
+ .append("lcpCloudRegionId", getLcpCloudRegionId()).toString();
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java
index 250c5df5ce..026db1e644 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java
@@ -43,6 +43,8 @@ public class RequestInfo implements Serializable {
protected String orderNumber;
@JsonProperty("productFamilyId")
protected String productFamilyId;
+ @JsonProperty("productFamilyName")
+ protected String productFamilyName;
@JsonProperty("orderVersion")
protected Integer orderVersion;
@JsonSerialize(include = Inclusion.ALWAYS)
@@ -180,6 +182,14 @@ public class RequestInfo implements Serializable {
public void setProductFamilyId(String productFamilyId) {
this.productFamilyId = productFamilyId;
+ };
+
+ public String getProductFamilyName() {
+ return productFamilyName;
+ }
+
+ public void setProductFamilyName(String productFamilyName) {
+ this.productFamilyName = productFamilyName;
}
/**
@@ -215,9 +225,9 @@ public class RequestInfo implements Serializable {
public String toString() {
return "RequestInfo [billingAccountNumber=" + billingAccountNumber + ", callbackUrl=" + callbackUrl
+ ", correlator=" + correlator + ", orderNumber=" + orderNumber + ", productFamilyId=" + productFamilyId
- + ", orderVersion=" + orderVersion + ", source=" + source + ", instanceName=" + instanceName
- + ", suppressRollback=" + suppressRollback + ", requestorId=" + requestorId + ", applicationId="
- + applicationId + "]";
+ + ", productFamilyName=" + productFamilyName + ", orderVersion=" + orderVersion + ", source=" + source
+ + ", instanceName=" + instanceName + ", suppressRollback=" + suppressRollback + ", requestorId="
+ + requestorId + ", applicationId=" + applicationId + "]";
}
diff --git a/deployment-configs/src/main/resources/logger/logback-spring.xml b/deployment-configs/src/main/resources/logger/logback-spring.xml
index 831a33a490..3f022f55fb 100644
--- a/deployment-configs/src/main/resources/logger/logback-spring.xml
+++ b/deployment-configs/src/main/resources/logger/logback-spring.xml
@@ -27,7 +27,7 @@
<property name="currentTimeStamp" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;,UTC}"/>
<property name="errorPattern"
- value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName:-Unknown}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode:-900}|%X{ErrorDesc:-UnknownError}|%msg%n" />
+ value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName:-Unknown}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode:-900}|%X{ErrorDesc:-UnknownError}|%msg%nopex%n" />
<property name="debugPattern"
value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%logger{50} - %msg%n" />
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
index 31e026b332..ce371203ab 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
@@ -42,7 +42,11 @@ import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.Tenant;
import org.onap.so.apihandler.common.ResponseBuilder;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
import org.onap.so.apihandlerinfra.tasksbeans.TasksRequest;
import org.onap.so.apihandlerinfra.validation.ApplyUpdatedConfigValidation;
import org.onap.so.apihandlerinfra.validation.CloudConfigurationValidation;
@@ -97,7 +101,6 @@ import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-
@Component
public class MsoRequest {
@@ -107,6 +110,9 @@ public class MsoRequest {
@Autowired
private ResponseBuilder builder;
+ @Autowired
+ private AAIDataRetrieval aaiDataRet;
+
@Value("${mso.enforceDLP:false}")
private boolean enforceDLP;
@@ -316,6 +322,25 @@ public class MsoRequest {
aq.setPnfName(servInsReq.getPnfName());
}
+ if (servInsReq.getRequestDetails() != null && servInsReq.getRequestDetails().getRequestInfo() != null
+ && servInsReq.getRequestDetails().getRequestInfo().getProductFamilyId() != null) {
+ logger.debug("Retrieving productFamilyName to put into requests db");
+
+ org.onap.aai.domain.yang.Service service =
+ aaiDataRet.getService(servInsReq.getRequestDetails().getRequestInfo().getProductFamilyId());
+ if (service != null) {
+ logger.debug("Found service by service-id");
+ String productFamilyName = service.getServiceDescription();
+ if (productFamilyName != null) {
+ aq.setProductFamilyName(productFamilyName);
+ }
+ }
+ }
+
+ aq.setProductFamilyName(getProductFamilyNameFromAAI(servInsReq));
+
+ aq.setTenantName(getTenantNameFromAAI(servInsReq));
+
if (ModelType.service.name().equalsIgnoreCase(requestScope)) {
if (servInsReq.getRequestDetails().getRequestInfo() != null) {
if (servInsReq.getRequestDetails().getRequestInfo().getInstanceName() != null) {
@@ -683,4 +708,31 @@ public class MsoRequest {
return vnfType;
}
+ protected String getTenantNameFromAAI(ServiceInstancesRequest servInsReq) {
+ String tenantName = null;
+ if (servInsReq.getRequestDetails() != null && servInsReq.getRequestDetails().getCloudConfiguration() != null
+ && servInsReq.getRequestDetails().getCloudConfiguration().getTenantId() != null) {
+ Tenant tenant = aaiDataRet.getTenant(servInsReq.getRequestDetails().getCloudConfiguration().getCloudOwner(),
+ servInsReq.getRequestDetails().getCloudConfiguration().getLcpCloudRegionId(),
+ servInsReq.getRequestDetails().getCloudConfiguration().getTenantId());
+ if (tenant != null) {
+ tenantName = tenant.getTenantName();
+ }
+ }
+ return tenantName;
+ }
+
+ protected String getProductFamilyNameFromAAI(ServiceInstancesRequest servInsReq) {
+ String productFamilyName = null;
+ if (servInsReq.getRequestDetails() != null && servInsReq.getRequestDetails().getRequestInfo() != null
+ && servInsReq.getRequestDetails().getRequestInfo().getProductFamilyId() != null) {
+ org.onap.aai.domain.yang.Service service =
+ aaiDataRet.getService(servInsReq.getRequestDetails().getRequestInfo().getProductFamilyId());
+ if (service != null) {
+ productFamilyName = service.getServiceDescription();
+ }
+ }
+ return productFamilyName;
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
index ae68cc6032..fec93f72e4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
@@ -347,6 +347,13 @@ public class OrchestrationRequests {
} else {
requestDetails = mapper.readValue(requestBody, RequestDetails.class);
}
+ if (requestDetails.getRequestInfo() != null && iar.getProductFamilyName() != null) {
+ requestDetails.getRequestInfo().setProductFamilyName(iar.getProductFamilyName());
+ }
+ if (requestDetails.getCloudConfiguration() != null && iar.getTenantName() != null) {
+ requestDetails.getCloudConfiguration().setTenantName(iar.getTenantName());
+ }
+
} catch (IOException e) {
logger.error("Exception occurred", e);
ErrorLoggerInfo errorLoggerInfo =
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java
index fc5769632b..21129d7c2d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java
@@ -138,4 +138,72 @@ public class OrchestrationTasks {
}
}
+ @PUT
+ @Path("/{version:[vV][4-7]}/{taskId}")
+ @Operation(description = "Update an Orchestrated Task", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ @Produces(MediaType.APPLICATION_JSON)
+ @Transactional
+ public Response UpdateOrchestrationTask(@PathParam("taskId") String taskId, String requestJson,
+ @PathParam("version") String version) {
+ try {
+ OrchestrationTask orchestrationTask = requestsDbClient.getOrchestrationTask(taskId);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Orchestration Task Update", e);
+ Response response =
+ msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
+ e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null, version);
+ return response;
+ }
+
+ try {
+ OrchestrationTask orchestrationTask = mapper.readValue(requestJson, OrchestrationTask.class);
+ requestsDbClient.updateOrchestrationTask(taskId, orchestrationTask);
+ return builder.buildResponse(HttpStatus.SC_OK, null, orchestrationTask, version);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Orchestration Task Update", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException, e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null,
+ version);
+ return response;
+ }
+ }
+
+ @DELETE
+ @Path("/{version:[vV][4-7]}/{taskId}")
+ @Operation(description = "Delete an Orchestrated Task", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ @Produces(MediaType.APPLICATION_JSON)
+ @Transactional
+ public Response DeleteOrchestrationTask(@PathParam("taskId") String taskId, @PathParam("version") String version) {
+ try {
+ OrchestrationTask orchestrationTask = requestsDbClient.getOrchestrationTask(taskId);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Orchestration Task Delete", e);
+ Response response =
+ msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
+ e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null, version);
+ return response;
+ }
+
+ try {
+ requestsDbClient.deleteOrchestrationTask(taskId);
+ return builder.buildResponse(HttpStatus.SC_OK, null, null, version);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Orchestration Task Delete", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException, e.getMessage(), ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB, null,
+ version);
+ return response;
+ }
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
index 344e5438c9..fee7a3a8f4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
@@ -3,7 +3,9 @@ package org.onap.so.apihandlerinfra.infra.rest;
import java.util.Optional;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.Service;
import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.Tenant;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
@@ -34,7 +36,6 @@ public class AAIDataRetrieval {
});
}
-
public VfModule getAAIVfModule(String vnfId, String vfModuleId) {
return this.getAaiResourcesClient()
.get(VfModule.class, AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId))
@@ -75,6 +76,24 @@ public class AAIDataRetrieval {
});
}
+ public Service getService(String serviceId) {
+ return this.getAaiResourcesClient()
+ .get(Service.class, AAIUriFactory.createResourceUri(AAIObjectType.SERVICE, serviceId)).orElseGet(() -> {
+ logger.debug("No Service found in A&AI ServiceId: {}", serviceId);
+ return null;
+ });
+ }
+
+ public Tenant getTenant(String cloudOwner, String cloudRegion, String tenantId) {
+ return this.getAaiResourcesClient()
+ .get(Tenant.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegion, tenantId))
+ .orElseGet(() -> {
+ logger.debug("No Tenant found in A&AI TenantId: {}", tenantId);
+ return null;
+ });
+ }
+
protected AAIResourcesClient getAaiResourcesClient() {
if (aaiResourcesClient == null) {
aaiResourcesClient = new AAIResourcesClient();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java
index f1d5a5487f..d1e5dc717e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java
@@ -22,6 +22,7 @@ package org.onap.so.apihandlerinfra;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.doReturn;
import java.io.IOException;
import java.io.StringReader;
import java.nio.file.Files;
@@ -34,12 +35,19 @@ import javax.ws.rs.core.Response;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.http.HttpStatus;
+import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.aai.domain.yang.Service;
+import org.onap.aai.domain.yang.Tenant;
import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.springframework.test.context.junit4.rules.SpringClassRule;
@@ -75,6 +83,17 @@ public class MsoRequestTest extends BaseTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
+ @Mock
+ private AAIDataRetrieval aaiDataRet;
+
+ @InjectMocks
+ private MsoRequest msoRequestMock;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ }
+
public String inputStream(String JsonInput) throws IOException {
JsonInput = "src/test/resources/MsoRequestTest" + JsonInput;
String input = new String(Files.readAllBytes(Paths.get(JsonInput)));
@@ -1056,5 +1075,37 @@ public class MsoRequestTest extends BaseTest {
assertNotNull(result);
}
+ @Test
+ public void getTenantNameFromAAITest() throws Exception {
+ this.sir = mapper.readValue(inputStream("/SuccessfulValidation/ServiceAssign.json"),
+ ServiceInstancesRequest.class);
+ String tenantId = "88a6ca3ee0394ade9403f075db23167e";
+ String tenantNameFromAAI = "testTenantName";
+ String cloudRegion = "mdt1";
+ String cloudOwner = "cloudOwner";
+ this.sir.getRequestDetails().getCloudConfiguration().setCloudOwner(cloudOwner);
+ Tenant tenant = new Tenant();
+ tenant.setTenantId(tenantId);
+ tenant.setTenantName(tenantNameFromAAI);
+ doReturn(tenant).when(aaiDataRet).getTenant(cloudOwner, cloudRegion, tenantId);
+ String tenantName = msoRequestMock.getTenantNameFromAAI(this.sir);
+ assertEquals(tenantNameFromAAI, tenantName);
+ }
+
+
+ @Test
+ public void getProductFamilyNameFromAAITest() throws Exception {
+ this.sir = mapper.readValue(inputStream("/SuccessfulValidation/ServiceAssign.json"),
+ ServiceInstancesRequest.class);
+ String serviceId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb";
+ String serviceDescription = "testServiceDescription";
+ Service service = new Service();
+ service.setServiceId(serviceId);
+ service.setServiceDescription(serviceDescription);
+ doReturn(service).when(aaiDataRet).getService(serviceId);
+ String productFamilyName = msoRequestMock.getProductFamilyNameFromAAI(this.sir);
+ assertEquals(serviceDescription, productFamilyName);
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
index f566628ee3..1332ffd913 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
@@ -441,6 +441,10 @@ public class ServiceInstancesTest extends BaseTest {
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK)));
+
wireMockServer.stubFor(get(urlMatching(".*/service/search/.*"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
@@ -483,6 +487,10 @@ public class ServiceInstancesTest extends BaseTest {
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK)));
+
wireMockServer.stubFor(get(urlMatching(".*/service/search/.*"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
@@ -524,6 +532,10 @@ public class ServiceInstancesTest extends BaseTest {
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK)));
+
wireMockServer.stubFor(get(urlMatching(".*/service/search/.*"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
@@ -1939,6 +1951,10 @@ public class ServiceInstancesTest extends BaseTest {
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK)));
+
wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceRecipe)).withStatus(HttpStatus.SC_OK)));
@@ -2114,6 +2130,10 @@ public class ServiceInstancesTest extends BaseTest {
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK)));
+
wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceRecipe)).withStatus(HttpStatus.SC_OK)));
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/ServiceFromAAI.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/ServiceFromAAI.json
new file mode 100644
index 0000000000..f0d511789f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/ServiceFromAAI.json
@@ -0,0 +1,4 @@
+{
+ "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "service-description": "testServiceDescription"
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
index 1a1e9bec79..85a17dd369 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
@@ -1297,6 +1297,8 @@ CREATE TABLE `infra_active_requests` (
`ORIGINAL_REQUEST_ID` varchar(45) DEFAULT NULL,
`EXT_SYSTEM_ERROR_SOURCE` varchar(80) DEFAULT NULL,
`ROLLBACK_EXT_SYSTEM_ERROR_SOURCE` varchar(80) DEFAULT NULL,
+ `TENANT_NAME` varchar(200) DEFAULT NULL,
+ `PRODUCT_FAMILY_NAME` varchar(200) DEFAULT NULL,
PRIMARY KEY (`REQUEST_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql
index 1efd125c2b..c6d22f5402 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql
@@ -100,7 +100,10 @@ CREATE TABLE IF NOT EXISTS PUBLIC.INFRA_ACTIVE_REQUESTS(
REQUEST_URL VARCHAR SELECTIVITY 1,
ORIGINAL_REQUEST_ID VARCHAR SELECTIVITY 1,
EXT_SYSTEM_ERROR_SOURCE VARCHAR SELECTIVITY 1,
- ROLLBACK_EXT_SYSTEM_ERROR_SOURCE VARCHAR SELECTIVITY 1
+ ROLLBACK_EXT_SYSTEM_ERROR_SOURCE VARCHAR SELECTIVITY 1,
+ TENANT_NAME VARCHAR SELECTIVITY 1,
+ PRODUCT_FAMILY_NAME VARCHAR SELECTIVITY 1
+
);
INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, TENANT_ID, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES
@@ -169,7 +172,9 @@ CREATE CACHED TABLE PUBLIC.ARCHIVED_INFRA_REQUESTS(
OPERATIONAL_ENV_NAME VARCHAR SELECTIVITY 1,
INSTANCE_GROUP_ID VARCHAR SELECTIVITY 1,
INSTANCE_GROUP_NAME VARCHAR SELECTIVITY 1,
- REQUEST_URL VARCHAR SELECTIVITY 1
+ REQUEST_URL VARCHAR SELECTIVITY 1,
+ TENANT_NAME VARCHAR SELECTIVITY 1,
+ PRODUCT_FAMILY_NAME VARCHAR SELECTIVITY 1
);
CREATE TABLE IF NOT EXISTS cloud_api_requests(
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
index 9b246460b8..750fa13c77 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
@@ -89,6 +89,7 @@ public class InfraActiveRequests extends InfraRequests {
.append("operationalEnvName", getOperationalEnvName()).append("requestUrl", getRequestUrl())
.append("originalRequestId", getOriginalRequestId())
.append("extSystemErrorSource", getExtSystemErrorSource())
- .append("rollbackExtSystemErrorSource", getRollbackExtSystemErrorSource()).toString();
+ .append("rollbackExtSystemErrorSource", getRollbackExtSystemErrorSource())
+ .append("tenantName", getTenantName()).append("productFamilyName", getProductFamilyName()).toString();
}
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
index 6d6b5a825e..66768ea349 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
@@ -149,6 +149,10 @@ public abstract class InfraRequests implements java.io.Serializable {
private String extSystemErrorSource;
@Column(name = "ROLLBACK_EXT_SYSTEM_ERROR_SOURCE", length = 80)
private String rollbackExtSystemErrorSource;
+ @Column(name = "TENANT_NAME", length = 80)
+ private String tenantName;
+ @Column(name = "PRODUCT_FAMILY_NAME", length = 80)
+ private String productFamilyName;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "SO_REQUEST_ID", referencedColumnName = "REQUEST_ID", updatable = false)
@@ -550,6 +554,22 @@ public abstract class InfraRequests implements java.io.Serializable {
this.rollbackExtSystemErrorSource = rollbackExtSystemErrorSource;
}
+ public String getTenantName() {
+ return tenantName;
+ }
+
+ public void setTenantName(String tenantName) {
+ this.tenantName = tenantName;
+ }
+
+ public String getProductFamilyName() {
+ return productFamilyName;
+ }
+
+ public void setProductFamilyName(String productFamilyName) {
+ this.productFamilyName = productFamilyName;
+ }
+
@PrePersist
protected void onCreate() {
if (requestScope == null)
@@ -609,6 +629,7 @@ public abstract class InfraRequests implements java.io.Serializable {
.append("operationalEnvName", getOperationalEnvName()).append("instanceGroupId", getInstanceGroupId())
.append("instanceGroupName", getInstanceGroupName()).append("requestUrl", getRequestUrl())
.append("originalRequestId", originalRequestId).append("extSystemErrorSource", extSystemErrorSource)
- .append("rollbackExtSystemErrorSource", rollbackExtSystemErrorSource).toString();
+ .append("rollbackExtSystemErrorSource", rollbackExtSystemErrorSource).append("tenantName", tenantName)
+ .append("productFamilyName", productFamilyName).toString();
}
}
diff --git a/pom.xml b/pom.xml
index 0719b205df..ea3f635f71 100644
--- a/pom.xml
+++ b/pom.xml
@@ -670,17 +670,17 @@
<dependency>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-slf4j</artifactId>
- <version>1.6.3-SNAPSHOT</version>
+ <version>1.6.4</version>
</dependency>
<dependency>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-filter-base</artifactId>
- <version>1.6.2-SNAPSHOT</version>
+ <version>1.6.4</version>
</dependency>
<dependency>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-filter-spring</artifactId>
- <version>1.6.3-SNAPSHOT</version>
+ <version>1.6.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>