aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java4
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java8
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmBasicHttpSecurityConfigurer.java9
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java11
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java10
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java18
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationController.java4
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionController.java2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java31
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java14
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java79
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java72
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java61
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java50
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/Empty_workflowActivitySpecSequence_Response.json5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnfQuery_Response.json41
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OrchestrationTaskRepository.java33
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java8
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java4
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java3
-rw-r--r--packages/docker/pom.xml4
-rw-r--r--pom.xml46
24 files changed, 423 insertions, 123 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index e0d5d3803f..03ef24ded0 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -719,8 +719,8 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
}
@Test
- public void getWorkflowByModelUUID_validUuid_expectedOutput() {
- List<Workflow> workflows = client.findWorkflowByModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
+ public void getWorkflowByVnfModelUUID_validUuid_expectedOutput() {
+ List<Workflow> workflows = client.findWorkflowByVnfModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
assertTrue(workflows != null);
assertTrue(workflows.size() != 0);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java
index fb32fb9605..d798267918 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java
@@ -32,8 +32,12 @@ public class Constants {
public static final String SERVICE_VERSION = "v1";
public static final String BASE_URL = "/so/" + SERVICE_NAME + "/" + SERVICE_VERSION;
public static final String PACKAGE_MANAGEMENT_BASE_URL = BASE_URL + "/vnfpkgm/v1";
- public static final String ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL = BASE_URL + "/etsicatalogmanager/notification";
- public static final String ETSI_SUBSCRIPTION_NOTIFICATION_CONTROLLER_BASE_URL = BASE_URL + "/etsicatalogmanager";
+ public static final String ETSI_CATALOG_MANAGER_BASE_ENDPOINT = "/etsicatalogmanager";
+ public static final String ETSI_SUBSCRIPTION_NOTIFICATION_ENDPOINT = "/notification";
+ public static final String ETSI_SUBSCRIPTION_NOTIFICATION_CONTROLLER_BASE_URL =
+ BASE_URL + ETSI_CATALOG_MANAGER_BASE_ENDPOINT;
+ public static final String ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL =
+ ETSI_SUBSCRIPTION_NOTIFICATION_CONTROLLER_BASE_URL + ETSI_SUBSCRIPTION_NOTIFICATION_ENDPOINT;
public static final String APPLICATION_ZIP = "application/zip";
public static final String OPERATION_NOTIFICATION_ENDPOINT = "/lcn/VnfLcmOperationOccurrenceNotification";
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmBasicHttpSecurityConfigurer.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmBasicHttpSecurityConfigurer.java
index 1e0a18a339..f1815054e3 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmBasicHttpSecurityConfigurer.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmBasicHttpSecurityConfigurer.java
@@ -9,9 +9,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.
@@ -35,7 +35,6 @@ import org.springframework.util.StringUtils;
/**
* @author Waqas Ikram (waqas.ikram@est.tech)
* @author Gareth Roper (gareth.roper@est.tech)
- *
*/
@Primary
@Component
@@ -53,10 +52,10 @@ public class VnfmBasicHttpSecurityConfigurer implements HttpSecurityConfigurer {
http.csrf().disable().authorizeRequests().anyRequest().permitAll();
} else {
http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll()
- .antMatchers(HttpMethod.GET, "/etsi/subscription/notification").permitAll().antMatchers("/**")
+ .antMatchers(HttpMethod.GET, Constants.ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL).permitAll()
+ .antMatchers("/**")
.hasAnyRole(StringUtils.collectionToDelimitedString(soUserCredentialConfiguration.getRoles(), ","))
.and().httpBasic();
-
}
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java
index c6d51c99aa..d0fd4c9e7c 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java
@@ -20,14 +20,10 @@
package org.onap.so.adapters.vnfmadapter.converters.sol003.etsicatalog;
-import static org.slf4j.LoggerFactory.getLogger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import java.util.Optional;
-import java.util.UUID;
-import javax.swing.text.html.Option;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.Version;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfProducts;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfProductsProviders;
@@ -38,7 +34,6 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilterVersions;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilterVnfProducts;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilterVnfProductsFromProviders;
-import org.slf4j.Logger;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Service;
@@ -48,14 +43,11 @@ import org.springframework.stereotype.Service;
*
* @author Ronan Kenny (ronan.kenny@est.tech)
* @author Gareth Roper (gareth.roper@est.tech)
- *
*/
@Service
public class PkgmSubscriptionRequestConverter implements
Converter<PkgmSubscriptionRequest, org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest> {
- private static final Logger logger = getLogger(PkgmSubscriptionRequestConverter.class);
-
@Override
public org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest convert(
PkgmSubscriptionRequest pkgmSubscriptionRequest) {
@@ -133,7 +125,8 @@ public class PkgmSubscriptionRequestConverter implements
final List<VnfProductsProviders> etsiCatalogManagerVnfProductsProviders = new ArrayList<>();
filterProductsFromProvider.forEach(vnfProduct -> {
etsiCatalogManagerVnfProductsProviders
- .add(new VnfProductsProviders().vnfProducts(getVnfProducts(vnfProduct.getVnfProducts())));
+ .add(new VnfProductsProviders().vnfProvider(vnfProduct.getVnfProvider())
+ .vnfProducts(getVnfProducts(vnfProduct.getVnfProducts())));
});
return etsiCatalogManagerVnfProductsProviders;
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java
index 573a798410..73ec7053a7 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java
@@ -79,7 +79,7 @@ public class EtsiCatalogServiceProviderImpl implements EtsiCatalogServiceProvide
etsiCatalogUrlProvider.getVnfPackageArtifactUrl(vnfPkgId, artifactPath), byte[].class);
logger.info("getVnfPackageArtifact Request to ETSI Catalog Manager Status Code: {}",
response.getStatusCodeValue());
- if (response.getStatusCode() == HttpStatus.OK) {
+ if (response.getStatusCode().is2xxSuccessful()) {
return Optional.ofNullable(response.getBody());
}
} catch (final HttpResouceNotFoundException httpResouceNotFoundException) {
@@ -104,7 +104,7 @@ public class EtsiCatalogServiceProviderImpl implements EtsiCatalogServiceProvide
httpServiceProvider.getHttpResponse(etsiCatalogUrlProvider.getVnfPackagesUrl(), VnfPkgInfo[].class);
logger.info("getVnfPackages Request to ETSI Catalog Manager Status Code: {}",
response.getStatusCodeValue());
- if (response.getStatusCode() == HttpStatus.OK) {
+ if (response.getStatusCode().is2xxSuccessful()) {
if (response.hasBody()) {
final VnfPkgInfo[] vnfPackages = response.getBody();
assert (vnfPackages != null);
@@ -145,7 +145,7 @@ public class EtsiCatalogServiceProviderImpl implements EtsiCatalogServiceProvide
.getHttpResponse(etsiCatalogUrlProvider.getVnfPackageUrl(vnfPkgId), VnfPkgInfo.class);
logger.info("getVnfPackage Request for vnfPkgId {} to ETSI Catalog Manager Status Code: {}", vnfPkgId,
response.getStatusCodeValue());
- if (response.getStatusCode() == HttpStatus.OK) {
+ if (response.getStatusCode().is2xxSuccessful()) {
if (response.hasBody()) {
final VnfPkgInfo vnfPkgInfo = response.getBody();
if (conversionService.canConvert(vnfPkgInfo.getClass(), InlineResponse2001.class)) {
@@ -183,7 +183,7 @@ public class EtsiCatalogServiceProviderImpl implements EtsiCatalogServiceProvide
final ResponseEntity<PkgmSubscription> responseEntity =
httpServiceProvider.postHttpRequest(etsiCatalogManagerSubscriptionRequest,
etsiCatalogUrlProvider.getSubscriptionUrl(), PkgmSubscription.class);
- if (responseEntity.getStatusCode() == HttpStatus.OK) {
+ if (responseEntity.getStatusCode().is2xxSuccessful()) {
if (responseEntity.hasBody()) {
return Optional.of(responseEntity.getBody());
}
@@ -209,7 +209,7 @@ public class EtsiCatalogServiceProviderImpl implements EtsiCatalogServiceProvide
final ResponseEntity<Void> responseEntity = httpServiceProvider
.deleteHttpRequest(etsiCatalogUrlProvider.getSubscriptionUrl() + "/" + subscriptionId, Void.class);
- if (responseEntity.getStatusCode() == HttpStatus.NO_CONTENT) {
+ if (responseEntity.getStatusCode().is2xxSuccessful()) {
logger.info("Subscription with ID: {} has been successfully deleted from the ETSI Catalog Manager",
subscriptionId);
return true;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java
index bbf8b74952..efe747deae 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java
@@ -31,7 +31,6 @@ import java.util.Objects;
import java.util.Optional;
import org.onap.so.adapters.vnfmadapter.Constants;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.EtsiCatalogServiceProvider;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.EtsiCatalogUrlProvider;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.BasicAuth;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscription;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2002;
@@ -41,7 +40,6 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.
import org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement.cache.PackageManagementCacheServiceProvider;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.InternalServerErrorException;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.SubscriptionRequestConversionException;
-import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.utils.CryptoUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@@ -55,15 +53,12 @@ import org.springframework.stereotype.Service;
*
* @author Ronan Kenny (ronan.kenny@est.tech)
* @author Gareth Roper (gareth.roper@est.tech)
- *
*/
@Service
public class SubscriptionManager {
private static final Logger logger = getLogger(SubscriptionManager.class);
private final PackageManagementCacheServiceProvider packageManagementCacheServiceProvider;
- private final EtsiCatalogUrlProvider etsiCatalogUrlProvider;
- private final HttpRestServiceProvider httpServiceProvider;
private final ConversionService conversionService;
private final EtsiCatalogServiceProvider etsiCatalogServiceProvider;
private final String vnfmAdapterEndpoint;
@@ -73,16 +68,12 @@ public class SubscriptionManager {
@Autowired
public SubscriptionManager(final PackageManagementCacheServiceProvider packageManagementCacheServiceProvider,
- final ConversionService conversionService, final HttpRestServiceProvider httpServiceProvider,
- final EtsiCatalogUrlProvider etsiCatalogUrlProvider,
- final EtsiCatalogServiceProvider etsiCatalogServiceProvider,
+ final ConversionService conversionService, final EtsiCatalogServiceProvider etsiCatalogServiceProvider,
@Value("${vnfmadapter.endpoint}") final String vnfmAdapterEndpoint,
@Value("${mso.key}") final String msoKeyString,
- @Value("${vnfmadapter.auth:D6CFE56451508B75536C5E8A1E7AE06D0346006A693BF29293A6E1C762EFD59C671911DB6E9294E4FE15E4C1C5524B}") final String vnfmAdapterAuth) {
+ @Value("${vnfmadapter.auth:BF29BA36F0CFE1C05507781F6B97EFBCA7EFAC9F595954D465FC43F646883EF585C20A58CBB02528A6FAAC}") final String vnfmAdapterAuth) {
this.packageManagementCacheServiceProvider = packageManagementCacheServiceProvider;
- this.etsiCatalogUrlProvider = etsiCatalogUrlProvider;
this.conversionService = conversionService;
- this.httpServiceProvider = httpServiceProvider;
this.etsiCatalogServiceProvider = etsiCatalogServiceProvider;
this.vnfmAdapterEndpoint = vnfmAdapterEndpoint;
this.vnfmAdapterAuth = vnfmAdapterAuth;
@@ -101,8 +92,8 @@ public class SubscriptionManager {
if (optionalEtsiCatalogManagerSubscription.isPresent()) {
PkgmSubscription etsiCatalogManagerSubscription = optionalEtsiCatalogManagerSubscription.get();
logger.debug("postPkgmSubscriptionRequest Response SubscriptionId: {}",
- Objects.requireNonNull(etsiCatalogManagerSubscription.getId().toString()));
- final String subscriptionId = etsiCatalogManagerSubscription.getId().toString();
+ Objects.requireNonNull(etsiCatalogManagerSubscription.getId()));
+ final String subscriptionId = etsiCatalogManagerSubscription.getId();
packageManagementCacheServiceProvider.addSubscription(subscriptionId, pkgmSubscriptionRequest);
@@ -120,7 +111,6 @@ public class SubscriptionManager {
}
-
public Optional<String> getSubscriptionId(final PkgmSubscriptionRequest pkgmSubscriptionRequest) {
return packageManagementCacheServiceProvider.getSubscriptionId(pkgmSubscriptionRequest);
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationController.java
index c5bd5bc14e..b4004b083d 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationController.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationController.java
@@ -36,9 +36,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
* @author Gareth Roper (gareth.roper@est.tech)
*/
@Controller
-@RequestMapping(value = ETSI_SUBSCRIPTION_NOTIFICATION_CONTROLLER_BASE_URL,
- produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
- consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+@RequestMapping(value = ETSI_SUBSCRIPTION_NOTIFICATION_CONTROLLER_BASE_URL)
public class EtsiSubscriptionNotificationController {
private static final Logger logger = getLogger(EtsiSubscriptionNotificationController.class);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionController.java
index 4be0838c08..6db3797f9b 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionController.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionController.java
@@ -79,7 +79,7 @@ public class Sol003PackageManagementSubscriptionController {
@PostMapping(value = "/subscriptions")
public ResponseEntity<?> postSubscriptionRequest(@RequestBody final PkgmSubscriptionRequest pkgmSubscriptionRequest)
throws GeneralSecurityException {
- logger.info(LOG_REQUEST_RECEIVED, " postSubscriptionRequest Endpoint Called");
+ logger.info(LOG_REQUEST_RECEIVED, " postSubscriptionRequest Endpoint Called", pkgmSubscriptionRequest);
// Check if subscription exists already.
final Optional<String> exists = subscriptionManager.getSubscriptionId(pkgmSubscriptionRequest);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java
index 3d26c33679..c776e55ff0 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java
@@ -20,21 +20,25 @@
package org.onap.so.adapters.vnfmadapter.rest;
+import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.onap.so.adapters.vnfmadapter.Constants.PACKAGE_MANAGEMENT_BASE_URL;
import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
-import java.security.GeneralSecurityException;
+import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
+import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
+import com.google.gson.Gson;
import java.net.URI;
import java.net.URISyntaxException;
+import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
-import com.google.gson.Gson;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -51,13 +55,13 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilterVnfProductsFromProviders;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsLinks;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesLinksSelf;
-import org.onap.so.utils.CryptoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -65,36 +69,24 @@ import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.web.client.RestTemplate;
-import org.springframework.http.HttpMethod;
-import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
-import static org.hamcrest.Matchers.is;
-import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
-import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
/**
* @author Ronan Kenny (ronan.kenny@est.tech)
* @author Gareth Roper (gareth.roper@est.tech)
- *
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
-@SuppressWarnings("unchecked")
public class Sol003PackageManagementSubscriptionControllerTest {
- private static String subscriptionId;
private final Gson gson = new Gson();
-
+ private final URI msbEndpoint = URI.create("http://msb-iag.onap:80/api/vnfpkgm/v1/subscriptions");
@Autowired
@Qualifier(CONFIGURABLE_REST_TEMPLATE)
private RestTemplate testRestTemplate;
-
private MockRestServiceServer mockRestServer;
-
@Autowired
private CacheManager cacheServiceProvider;
- private final URI msbEndpoint = URI.create("http://msb-iag.onap:80/api/vnfpkgm/v1/subscriptions");
-
@Autowired
private Sol003PackageManagementSubscriptionController sol003PackageManagementSubscriptionController;
@@ -135,7 +127,6 @@ public class Sol003PackageManagementSubscriptionControllerTest {
final ResponseEntity<InlineResponse2002> response =
(ResponseEntity<InlineResponse2002>) sol003PackageManagementSubscriptionController
.postSubscriptionRequest(pkgmSubscriptionRequest);
- subscriptionId = Objects.requireNonNull(response.getBody()).getId();
// Create duplicate entry
final PkgmSubscriptionRequest pkgmSubscriptionRequest2 = buildPkgmSubscriptionRequest();
@@ -154,7 +145,7 @@ public class Sol003PackageManagementSubscriptionControllerTest {
final ResponseEntity<InlineResponse2002> response =
(ResponseEntity<InlineResponse2002>) sol003PackageManagementSubscriptionController
.postSubscriptionRequest(pkgmSubscriptionRequest);
- subscriptionId = Objects.requireNonNull(response.getBody()).getId();
+ final String subscriptionId = response.getBody().getId();
final ResponseEntity<InlineResponse2002> response2002 =
(ResponseEntity<InlineResponse2002>) sol003PackageManagementSubscriptionController
@@ -162,9 +153,8 @@ public class Sol003PackageManagementSubscriptionControllerTest {
final HttpHeaders headers = buildHttpHeaders(response.getBody().getCallbackUri());
-
assertEquals(response.getBody().getFilter(), pkgmSubscriptionRequest.getFilter());
- assert (response.getHeaders().equals(headers));
+ assertEquals(response.getHeaders(), headers);
assertEquals(HttpStatus.OK, response2002.getStatusCode());
assertEquals(pkgmSubscriptionRequest.getFilter(), response.getBody().getFilter());
// Ensure CallBackUri is set to new URI
@@ -215,7 +205,6 @@ public class Sol003PackageManagementSubscriptionControllerTest {
(ResponseEntity<InlineResponse2002>) sol003PackageManagementSubscriptionController
.postSubscriptionRequest(pkgmSubscriptionRequest);
-
final ResponseEntity responseDelete =
sol003PackageManagementSubscriptionController.deleteSubscription(subscriptionId);
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java
index fb95ae3993..11707c4149 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.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.
@@ -27,9 +27,15 @@ 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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class AAIDeleteServiceInstance implements JavaDelegate {
+ private static final Logger logger = LoggerFactory.getLogger(AAIDeleteServiceInstance.class);
+ private static final String ERROR_MESSAGE =
+ "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI.";
+
ExceptionUtil exceptionUtil = new ExceptionUtil();
public void execute(DelegateExecution execution) throws Exception {
@@ -41,8 +47,8 @@ public class AAIDeleteServiceInstance implements JavaDelegate {
aaiRC.delete(serviceInstanceURI);
execution.setVariable("GENDS_SuccessIndicator", true);
} catch (Exception ex) {
- String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI."
- + ex.getMessage();
+ logger.debug(ERROR_MESSAGE, ex);
+ String msg = ERROR_MESSAGE + ex.getMessage();
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java
index 2d69351744..f7b0c662db 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.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.
@@ -30,17 +30,70 @@ public class AAIServiceInstance {
String environmentContext;
String workloadContext;
- public AAIServiceInstance(String serviceInstanceName, String serviceType, String serviceRole,
- String orchestrationStatus, String modelInvariantUuid, String modelVersionId, String environmentContext,
- String workloadContext) {
- this.serviceInstanceName = serviceInstanceName;
- this.serviceType = serviceType;
- this.serviceRole = serviceRole;
- this.orchestrationStatus = orchestrationStatus;
- this.modelInvariantUuid = modelInvariantUuid;
- this.modelVersionId = modelVersionId;
- this.environmentContext = environmentContext;
- this.workloadContext = workloadContext;
+ public class AAIServiceInstanceBuilder {
+ private String serviceInstanceName;
+ private String serviceType;
+ private String serviceRole;
+ private String orchestrationStatus;
+ private String modelInvariantUuid;
+ private String modelVersionId;
+ private String environmentContext;
+ private String workloadContext;
+
+ public AAIServiceInstanceBuilder setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setModelInvariantUuid(String modelInvariantUuid) {
+ this.modelInvariantUuid = modelInvariantUuid;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setEnvironmentContext(String environmentContext) {
+ this.environmentContext = environmentContext;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ return this;
+ }
+
+ public AAIServiceInstance createAAIServiceInstance() {
+ return new AAIServiceInstance(this);
+ }
+ }
+
+ public AAIServiceInstance(AAIServiceInstanceBuilder aaiServiceInstanceBuilder) {
+ this.serviceInstanceName = aaiServiceInstanceBuilder.serviceInstanceName;
+ this.serviceType = aaiServiceInstanceBuilder.serviceType;
+ this.serviceRole = aaiServiceInstanceBuilder.serviceRole;
+ this.orchestrationStatus = aaiServiceInstanceBuilder.orchestrationStatus;
+ this.modelInvariantUuid = aaiServiceInstanceBuilder.modelInvariantUuid;
+ this.modelVersionId = aaiServiceInstanceBuilder.modelVersionId;
+ this.environmentContext = aaiServiceInstanceBuilder.environmentContext;
+ this.workloadContext = aaiServiceInstanceBuilder.workloadContext;
}
public String getServiceInstanceName() {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 80c6f0b969..2284c4af1a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -431,7 +431,12 @@ public class WorkflowAction {
execution.setVariable("isRollbackComplete", false);
} catch (Exception ex) {
- buildAndThrowException(execution, "Exception while setting execution list. ", ex);
+ if (!(execution.hasVariable("WorkflowException")
+ || execution.hasVariable("WorkflowExceptionExceptionMessage"))) {
+ buildAndThrowException(execution, "Exception while setting execution list. ", ex);
+ } else {
+ throw ex;
+ }
}
}
@@ -537,7 +542,7 @@ public class WorkflowAction {
if (configurations.size() > 1) {
String multipleRelationshipsError =
"Multiple relationships exist from VNFC " + vnfc.getVnfcName() + " to Configurations";
- buildAndThrowException(dataObj.getExecution(), multipleRelationshipsError,
+ buildAndThrowException(dataObj.getExecution(), "Exception in getConfigBuildingBlock: ",
new Exception(multipleRelationshipsError));
}
for (org.onap.aai.domain.yang.Configuration configuration : configurations) {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index 8e47c34cb0..4fdd97d95a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -41,6 +41,7 @@ import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.when;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
@@ -228,6 +229,77 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
+ public void selectExecutionListExceptionAlreadyBuiltTest() throws Exception {
+ DelegateExecution delegateExecution = new DelegateExecutionFake();
+ String gAction = "deleteInstance";
+ String resource = "VfModule";
+ delegateExecution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ delegateExecution.setVariable("requestAction", gAction);
+ String bpmnRequest =
+ new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
+ delegateExecution.setVariable("bpmnRequest", bpmnRequest);
+ delegateExecution.setVariable("aLaCarte", true);
+ delegateExecution.setVariable("apiVersion", "7");
+ delegateExecution.setVariable("requestUri",
+ "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
+ "UnassignVfModuleBB", "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+
+ doAnswer(invocation -> {
+ DelegateExecutionFake execution = invocation.getArgument(0);
+ execution.setVariable("WorkflowException", "exception");
+ execution.setVariable("WorkflowExceptionErrorMessage", "errorMessage");
+ throw new BpmnError("WorkflowException");
+ }).when(exceptionUtil).buildAndThrowWorkflowException(delegateExecution, 7000,
+ "Exception in getConfigBuildingBlock: Multiple relationships exist from VNFC testVnfcName to Configurations");
+
+
+ org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
+ vnf.setVnfId("vnf0");
+ vnf.setModelCustomizationId("modelCustomizationId");
+ when(bbSetupUtils.getAAIGenericVnf(any())).thenReturn(vnf);
+
+ org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule();
+ vfModule.setModelCustomizationId("modelCustomizationId");
+ when(bbSetupUtils.getAAIVfModule(any(), any())).thenReturn(vfModule);
+
+ List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>();
+ org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
+ vnfc.setModelInvariantId("modelInvariantId");
+ vnfc.setVnfcName("testVnfcName");
+ vnfcs.add(vnfc);
+ doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(any(), any(), any(), any());
+
+ List<org.onap.aai.domain.yang.Configuration> configurations =
+ new ArrayList<org.onap.aai.domain.yang.Configuration>();
+ org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
+ configuration.setConfigurationId("configurationId");
+ configuration.setModelCustomizationId("modelCustimizationId");
+ configuration.setConfigurationName("testConfigurationName");
+ configurations.add(configuration);
+ org.onap.aai.domain.yang.Configuration configuration1 = new org.onap.aai.domain.yang.Configuration();
+ configuration1.setConfigurationId("configurationId");
+ configuration1.setModelCustomizationId("modelCustimizationId");
+ configuration1.setConfigurationName("testConfigurationName");
+ configurations.add(configuration1);
+ doReturn(configurations).when(SPY_workflowAction).getRelatedResourcesInVnfc(any(), any(), any());
+
+ doReturn("testName").when(SPY_workflowAction).getVnfcNameForConfiguration(any());
+
+ thrown.expect(BpmnError.class);
+ SPY_workflowAction.selectExecutionList(delegateExecution);
+ assertEquals(
+ "Exception in getConfigBuildingBlock: Multiple relationships exist from VNFC testVnfcName to Configurations",
+ delegateExecution.getVariable("WorkflowException"));
+ }
+
+ @Test
public void selectExecutionListDuplicateNameExceptionTest() throws Exception {
String gAction = "createInstance";
execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
index 925d10179f..0d0e6ee92f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
@@ -23,6 +23,8 @@ package org.onap.so.apihandlerinfra;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.TreeSet;
+import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -90,21 +92,40 @@ public class WorkflowSpecificationsHandler {
@Transactional
public Response queryWorkflowSpecifications(@QueryParam("vnfModelVersionId") String vnfModelVersionId,
- @PathParam("version") String version) throws Exception {
-
+ @QueryParam("pnfModelVersionId") String pnfModelVersionId, @PathParam("version") String version)
+ throws Exception {
String apiVersion = version.substring(1);
- ObjectMapper mapper1 = new ObjectMapper();
- mapper1.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-
- List<Workflow> workflows = catalogDbClient.findWorkflowByModelUUID(vnfModelVersionId);
+ List<Workflow> workflows = new ArrayList<>();
+ if (vnfModelVersionId == null && pnfModelVersionId == null) {
+ workflows.addAll(queryWorkflowSpecificationsForAll());
+ } else {
+ // 1. query workflow specifications for given vnfModelVersionId if need.
+ if (vnfModelVersionId != null) {
+ List<Workflow> vnfWorkflows = queryWorkflowSpecificationsForVnf(vnfModelVersionId);
+ logger.debug("Retrieved " + vnfWorkflows.size() + " workflows for given vnfModelVersionId.");
+ if (vnfWorkflows.size() > 0) {
+ workflows.addAll(vnfWorkflows);
+ }
+ }
- List<Workflow> nativeWorkflows = catalogDbClient.findWorkflowBySource(NATIVE_WORKFLOW);
- if (nativeWorkflows != null && !nativeWorkflows.isEmpty()) {
- workflows.addAll(nativeWorkflows);
+ // 2. query workflow specifications for given pnfModelVersionId if need.
+ if (pnfModelVersionId != null) {
+ List<Workflow> pnfWorkflows = queryWorkflowSpecificationsForPnf(pnfModelVersionId);
+ logger.debug("Retrieved " + pnfWorkflows.size() + " workflows for given pnfModelVerionId.");
+ if (pnfWorkflows.size() > 0) {
+ workflows.addAll(pnfWorkflows);
+ }
+ }
}
- WorkflowSpecifications workflowSpecifications = mapWorkflowsToWorkflowSpecifications(workflows);
+ // Deduplication
+ List<Workflow> retWorkflows = workflows.stream()
+ .collect(Collectors.collectingAndThen(
+ Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Workflow::getArtifactUUID))),
+ ArrayList::new));
+
+ WorkflowSpecifications workflowSpecifications = mapWorkflowsToWorkflowSpecifications(retWorkflows);
String jsonResponse;
try {
@@ -239,4 +260,24 @@ public class WorkflowSpecificationsHandler {
}
return validationList;
}
+
+ private List<Workflow> queryWorkflowSpecificationsForAll() {
+ List<Workflow> workflows = catalogDbClient.findWorkflowBySource(NATIVE_WORKFLOW);
+ return workflows;
+ }
+
+ private List<Workflow> queryWorkflowSpecificationsForVnf(String vnfModelVersionId) {
+ List<Workflow> workflows = catalogDbClient.findWorkflowByVnfModelUUID(vnfModelVersionId);
+
+ List<Workflow> nativeWorkflows = catalogDbClient.findWorkflowBySource(NATIVE_WORKFLOW);
+ if (!nativeWorkflows.isEmpty()) {
+ workflows.addAll(nativeWorkflows);
+ }
+ return workflows;
+ }
+
+ private List<Workflow> queryWorkflowSpecificationsForPnf(String pnfModelVersionId) {
+ List<Workflow> workflows = catalogDbClient.findWorkflowByPnfModelUUID(pnfModelVersionId);
+ return workflows;
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
index 0beab1bd13..7af92cb8ef 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
@@ -68,7 +68,7 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
private final String basePath = "onap/so/infra/workflowSpecifications/v1/workflows";
@Test
- public void queryWorkflowSpecifications_Test_Success()
+ public void queryWorkflowSpecificationsByVnfModelUUID_Test_Success()
throws ParseException, JSONException, JsonParseException, JsonMappingException, IOException {
HttpHeaders headers = new HttpHeaders();
@@ -77,7 +77,7 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
HttpEntity<String> entity = new HttpEntity<String>(null, headers);
wireMockServer.stubFor(get(urlMatching(
- "/workflow/search/findWorkflowByModelUUID[?]vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52"))
+ "/workflow/search/findWorkflowByVnfModelUUID[?]vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(getWiremockResponseForCatalogdb("WorkflowSpecificationsQuery_Response.json"))
.withStatus(org.apache.http.HttpStatus.SC_OK)));
@@ -324,6 +324,52 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
assertThat(expectedResult, sameBeanAs(workflowSpecifications).ignoring(WorkflowInputParameter.class));
}
+ @Test
+ public void queryWorkflowSpecificationsByPnfModelUUID_Test_Success()
+ throws ParseException, JSONException, JsonParseException, JsonMappingException, IOException {
+
+ HttpHeaders headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ headers.set("Content-Type", MediaType.APPLICATION_JSON);
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+
+ wireMockServer.stubFor(get(urlMatching(
+ "/workflow/search/findWorkflowByPnfModelUUID[?]pnfResourceModelUUID=f2d1f2b2-88bb-49da-b716-36ae420ccbff"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb(
+ "WorkflowSpecificationsForPnfQuery_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ wireMockServer.stubFor(get(urlMatching("/workflow/4/workflowActivitySpecSequence"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("Empty_workflowActivitySpecSequence_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath))
+ .queryParam("pnfModelVersionId", "f2d1f2b2-88bb-49da-b716-36ae420ccbff");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+
+ WorkflowSpecifications expectedResponse = mapper.readValue(
+ new String(Files.readAllBytes(
+ Paths.get("src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json"))),
+ WorkflowSpecifications.class);
+ WorkflowSpecifications realResponse = mapper.readValue(response.getBody(), WorkflowSpecifications.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(expectedResponse, sameBeanAs(realResponse));
+ assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
+ assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
+ assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
+ assertEquals("1.0.0", response.getHeaders().get("X-LatestVersion").get(0));
+ }
+
private String getWiremockResponseForCatalogdb(String file) {
try {
File resource = ResourceUtils.getFile("classpath:__files/catalogdb/" + file);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/Empty_workflowActivitySpecSequence_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/Empty_workflowActivitySpecSequence_Response.json
new file mode 100644
index 0000000000..89675e8f02
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/Empty_workflowActivitySpecSequence_Response.json
@@ -0,0 +1,5 @@
+{
+ "_embedded": {
+ "workflowActivitySpecSequence": []
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json
new file mode 100644
index 0000000000..257b9dc843
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json
@@ -0,0 +1,20 @@
+{
+ "workflowSpecificationList": [
+ {
+ "workflowSpecification": {
+ "artifactInfo": {
+ "artifactType": "workflow",
+ "artifactUuid": "b2fd5627-55e4-4f4f-8064-9e6f443e9152",
+ "artifactName": "DummyPnfWorkflow",
+ "artifactVersion": "1.0",
+ "artifactDescription": "Dummy Pnf Workflow to test custom Pnf workflow",
+ "workflowName": "Dummy Pnf Workflow",
+ "operationName": "DummyPnfWorkflow",
+ "workflowSource": "native",
+ "workflowResourceTarget": "pnf"
+ },
+ "workflowInputParameters": []
+ }
+ }
+ ]
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnfQuery_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnfQuery_Response.json
new file mode 100644
index 0000000000..a4e1bbcdc5
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnfQuery_Response.json
@@ -0,0 +1,41 @@
+{
+ "_embedded": {
+ "workflow": [
+ {
+ "artifactChecksum": "MANUAL RECORD",
+ "artifactName": "DummyPnfWorkflow",
+ "artifactUUID": "b2fd5627-55e4-4f4f-8064-9e6f443e9152",
+ "body": null,
+ "created": "2020-02-18T08:28:15.000+0000",
+ "description": "Dummy Pnf Workflow to test custom Pnf workflow",
+ "id": 4,
+ "name": "Dummy Pnf Workflow",
+ "operationName": "DummyPnfWorkflow",
+ "pnfResourceWorkflow": null,
+ "resourceTarget": "pnf",
+ "source": "native",
+ "timeoutMinutes": null,
+ "version": 1.0,
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/workflow/search/findWorkflowByPnfModelUUID?pnfResourceModelUUID=f2d1f2b2-88bb-49da-b716-36ae420ccbff"
+ },
+ "workflow": {
+ "href": "http://localhost:8090/workflow/4"
+ },
+ "workflowActivitySpecSequence": {
+ "href": "http://localhost:8090/workflow/4/workflowActivitySpecSequence"
+ }
+ }
+ }
+ ]
+ },
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/workflow/search/findWorkflowByPnfModelUUID?pnfResourceModelUUID=f2d1f2b2-88bb-49da-b716-36ae420ccbff"
+ },
+ "workflowActivitySpecSequence": {
+ "href": "http://localhost:8090/workflow/4/workflowActivitySpecSequence"
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OrchestrationTaskRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OrchestrationTaskRepository.java
new file mode 100644
index 0000000000..1093c79638
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OrchestrationTaskRepository.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.data.repository;
+
+import org.onap.so.db.request.beans.OrchestrationTask;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.repository.query.Param;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+import java.util.List;
+
+@RepositoryRestResource(collectionResourceRel = "orchestrationTask", path = "orchestrationTask")
+public interface OrchestrationTaskRepository extends JpaRepository<OrchestrationTask, String> {
+
+ public List<OrchestrationTask> findByStatus(@Param("status") String status);
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index 015a063024..cf066f9721 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -203,7 +203,7 @@ public class CatalogDbClient {
private String findServiceByServiceInstanceId = "/findServiceByServiceInstanceId";
private String findPnfResourceCustomizationByModelUuid = "/findPnfResourceCustomizationByModelUuid";
private String findWorkflowByArtifactUUID = "/findByArtifactUUID";
- private String findWorkflowByModelUUID = "/findWorkflowByModelUUID";
+ private String findWorkflowByVnfModelUUID = "/findWorkflowByVnfModelUUID";
private String findWorkflowByPnfModelUUID = "/findWorkflowByPnfModelUUID";
private String findWorkflowBySource = "/findBySource";
private String findVnfResourceCustomizationByModelUuid = "/findVnfResourceCustomizationByModelUuid";
@@ -345,7 +345,7 @@ public class CatalogDbClient {
endpoint + PNF_RESOURCE_CUSTOMIZATION + SEARCH + findPnfResourceCustomizationByModelUuid;
findWorkflowByArtifactUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByArtifactUUID;
- findWorkflowByModelUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByModelUUID;
+ findWorkflowByVnfModelUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByVnfModelUUID;
findWorkflowByPnfModelUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByPnfModelUUID;
findWorkflowBySource = endpoint + WORKFLOW + SEARCH + findWorkflowBySource;
@@ -1069,8 +1069,8 @@ public class CatalogDbClient {
.queryParam(ARTIFACT_UUID, artifactUUID).build().toString()));
}
- public List<Workflow> findWorkflowByModelUUID(String vnfResourceModelUUID) {
- return this.getMultipleResources(workflowClient, getUri(UriBuilder.fromUri(findWorkflowByModelUUID)
+ public List<Workflow> findWorkflowByVnfModelUUID(String vnfResourceModelUUID) {
+ return this.getMultipleResources(workflowClient, getUri(UriBuilder.fromUri(findWorkflowByVnfModelUUID)
.queryParam(VNF_RESOURCE_MODEL_UUID, vnfResourceModelUUID).build().toString()));
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java
index f1b399325e..91c6940e95 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java
@@ -37,14 +37,14 @@ public interface WorkflowRepository extends JpaRepository<Workflow, Integer> {
* Used to fetch the @{link Workflow} by the Model UUID.
*
* This operation is required by {@link org.onap.so.db.catalog.client.CatalogDbClient} to provide Workflow based on
- * model UUID without projection.
+ * vnf model UUID without projection.
*
* @param vnfResourceModelUUID UUID
* @return List of Workflow
*/
@Query(value = "select b.* from vnf_resource_to_workflow a join workflow b where a.WORKFLOW_ID = b.ID and a.VNF_RESOURCE_MODEL_UUID = ?1",
nativeQuery = true)
- List<Workflow> findWorkflowByModelUUID(String vnfResourceModelUUID);
+ List<Workflow> findWorkflowByVnfModelUUID(String vnfResourceModelUUID);
/**
* Used to fetch the @{link Workflow} by the Pnf Model UUID.
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java
index 7d1b8d0d96..b07e82b8a8 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java
@@ -36,7 +36,8 @@ public class WorkflowRepositoryTest extends BaseTest {
@Test
public void findByVnfResourceModelUUIDTest() throws Exception {
- List<Workflow> workflows = workflowRepository.findWorkflowByModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
+ List<Workflow> workflows =
+ workflowRepository.findWorkflowByVnfModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
Assert.assertTrue(workflows != null);
Assert.assertTrue(workflows.size() != 0);
diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml
index 44d94dfdbf..c78979eccb 100644
--- a/packages/docker/pom.xml
+++ b/packages/docker/pom.xml
@@ -397,7 +397,7 @@
<dependencySets>
<dependencySet>
<includes>
- <include>org.onap.so:so-simulator</include>
+ <include>org.onap.so.simulator:so-simulator</include>
</includes>
<outputFileNameMapping>app.jar</outputFileNameMapping>
</dependencySet>
@@ -516,7 +516,7 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.so</groupId>
+ <groupId>org.onap.so.simulator</groupId>
<artifactId>so-simulator</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/pom.xml b/pom.xml
index 9f453d4ee8..0955338a4e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,8 +32,8 @@
<module>cloudify-client</module>
<module>cxf-logging</module>
<module>so-monitoring</module>
- <module>packages</module>
<module>so-simulator</module>
+ <module>packages</module>
</modules>
<properties>
<project.mso.base.folder>.</project.mso.base.folder>
@@ -42,12 +42,12 @@
<sonar.language>java</sonar.language>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath>
- <sonar.jacoco.reportPath>${project.build.directory}/code-coverage/jacoco-ut.exec</sonar.jacoco.reportPath>
+ <sonar.coverage.jacoco.xmlReportPaths>${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
<!--sonar.jacoco.itReportPath>${project.mso.base.folder}/packages/arquillian-unit-tests/target/mso-automated-tests/jacoco-it.exec</sonar.jacoco.itReportPath -->
<sonar.jacoco.reportMissing.force.zero>true</sonar.jacoco.reportMissing.force.zero>
<sonar.projectVersion>${project.version}</sonar.projectVersion>
<sonar.cpd.exclusions>**/*</sonar.cpd.exclusions>
- <jacoco.version>0.7.5.201505241946</jacoco.version>
+ <jacoco.version>0.8.5</jacoco.version>
<org.apache.maven.user-settings />
<openstack.version>1.5.1</openstack.version>
<maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
@@ -337,24 +337,28 @@
</configuration>
</plugin>
<plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <version>${jacoco.version}</version>
- <executions>
- <execution>
- <id>default-prepare-agent</id>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- </execution>
- <execution>
- <id>default-report</id>
- <goals>
- <goal>report</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>${jacoco.version}</version>
+ <executions>
+ <execution>
+ <id>prepare-agent</id>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>report</id>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <dataFile>${project.build.directory}/code-coverage/jacoco.exec</dataFile>
+ <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>