diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
7 files changed, 21 insertions, 11 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java index 32516c1dcb..41649dc838 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java @@ -20,7 +20,9 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; +import com.google.common.base.Optional; import org.onap.so.rest.exceptions.InvalidRestRequestException; +import org.onap.so.rest.exceptions.HttpResouceNotFoundException; import org.onap.so.rest.exceptions.RestProcessingException; import org.onap.so.rest.service.HttpRestServiceProvider; import org.onap.vnfmadapter.v1.model.CreateVnfRequest; @@ -33,7 +35,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; -import com.google.common.base.Optional; /** * @author waqas.ikram@est.tech @@ -82,7 +83,8 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide } return Optional.of(createVnfResponse); - } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) { + } catch (final RestProcessingException | InvalidRestRequestException + | HttpResouceNotFoundException httpInvocationException) { LOGGER.error("Unexpected error while processing create and instantiation request", httpInvocationException); return Optional.absent(); } @@ -144,7 +146,8 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide return Optional.absent(); } return Optional.of(response.getBody()); - } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) { + } catch (final RestProcessingException | InvalidRestRequestException + | HttpResouceNotFoundException httpInvocationException) { LOGGER.error("Unexpected error while processing job request", httpInvocationException); throw httpInvocationException; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java index 9413e8ef2e..e73a504291 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java @@ -124,12 +124,14 @@ public class ConfigAssignVnf { private Service getServiceFromRequestUserParams(List<Map<String, Object>> userParams) throws Exception { Map<String, Object> serviceMap = userParams.stream().filter(key -> key.containsKey("service")).findFirst() .orElseThrow(() -> new Exception("Can not find service in userParams section in generalBuildingBlock")); - return convertServiceFromJsonToServiceObject((String) serviceMap.get("service")); + return getServiceObjectFromServiceMap(serviceMap); } - private Service convertServiceFromJsonToServiceObject(String serviceFromJson) throws Exception { + private Service getServiceObjectFromServiceMap(Map<String, Object> serviceMap) throws Exception { + ObjectMapper objectMapper = new ObjectMapper(); + String serviceFromJson = objectMapper.writeValueAsString(serviceMap.get("service")); try { - return new ObjectMapper().readValue(serviceFromJson, Service.class); + return objectMapper.readValue(serviceFromJson, Service.class); } catch (Exception e) { logger.error(String.format( "An exception occurred while converting json object to Service object. The json is: %s", @@ -150,5 +152,4 @@ public class ConfigAssignVnf { genericVnfModelCustomizationUuid)); } } - } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java index 52d294955a..11cac08f57 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.validations; import java.util.Optional; import java.util.regex.Pattern; +import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.listener.validation.PreBuildingBlockValidator; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @@ -62,7 +63,7 @@ public class CloudRegionOrchestrationValidator implements PreBuildingBlockValida } } catch (Exception e) { logger.error("failed to validate", e); - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e, ONAPComponents.SO); } return Optional.empty(); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java index 173e776af9..d78fa69680 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java @@ -269,6 +269,7 @@ public class NetworkAdapterObjectMapper { org.onap.so.openstack.beans.Subnet.class) == null) { PropertyMap<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet, org.onap.so.openstack.beans.Subnet> personMap = new PropertyMap<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet, org.onap.so.openstack.beans.Subnet>() { + @Override protected void configure() { map().setSubnetName(source.getSubnetName()); map(source.getSubnetId(), destination.getSubnetId()); @@ -387,7 +388,7 @@ public class NetworkAdapterObjectMapper { createNetworkRequest.setSkipAAI(true); createNetworkRequest.setBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled())); // TODO confirm value - false by default - createNetworkRequest.setFailIfExists(true); + createNetworkRequest.setFailIfExists(false); // NetworkTechnology(NetworkTechnology.NEUTRON); NOOP - default return createNetworkRequest; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java index a78870afc4..ebebae3cce 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java @@ -78,7 +78,7 @@ public class VnfAdapterObjectMapper { createVolumeGroupRequest.setSkipAAI(true); createVolumeGroupRequest.setSuppressBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled())); - createVolumeGroupRequest.setFailIfExists(true); + createVolumeGroupRequest.setFailIfExists(false); createVolumeGroupRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance)); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java index 8c13c9be97..685531e9a7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java @@ -150,7 +150,7 @@ public class VnfAdapterVfModuleObjectMapper { createVfModuleRequest.setSkipAAI(true); createVfModuleRequest.setBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled())); - createVfModuleRequest.setFailIfExists(true); + createVfModuleRequest.setFailIfExists(false); MsoRequest msoRequest = buildMsoRequest(requestContext, serviceInstance); createVfModuleRequest.setMsoRequest(msoRequest); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java index 6ddb292a6c..a41c79b171 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java @@ -96,6 +96,10 @@ public class VfModuleTopologyOperationRequestMapper { genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.UNASSIGN; requestAction = GenericResourceApiRequestActionEnumeration.DELETEVFMODULEINSTANCE; includeModelInformation = false; + } else if (svcAction.equals(SDNCSvcAction.CHANGE_ASSIGN)) { + genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.CHANGEASSIGN; + requestAction = GenericResourceApiRequestActionEnumeration.CREATEVFMODULEINSTANCE; + includeModelInformation = true; } String sdncReqId = UUID.randomUUID().toString(); |