diff options
14 files changed, 67 insertions, 55 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java index 051d8134f1..076e03b6b3 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java @@ -31,8 +31,6 @@ import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriBuilderException; import javax.ws.rs.core.Response; -import org.onap.so.db.catalog.beans.CloudIdentity; -import org.onap.so.utils.CryptoUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.onap.so.adapters.vdu.CloudInfo; @@ -64,6 +62,8 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.stereotype.Component; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.woorea.openstack.heat.model.CreateStackParam; @@ -173,35 +173,20 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ CreateStackParam stack = createStackParam(stackName, heatTemplate, stackInputs, timeoutMinutes, environment, files, heatFiles); MulticloudRequest multicloudRequest= new MulticloudRequest(); - HttpEntity<MulticloudRequest> request = null; try { multicloudRequest.setGenericVnfId(genericVnfId); multicloudRequest.setVfModuleId(vfModuleId); - multicloudRequest.setOofDirectives(oofDirectives); - multicloudRequest.setSdncDirectives(sdncDirectives); + multicloudRequest.setOofDirectives(JSON_MAPPER.readTree(oofDirectives)); + multicloudRequest.setSdncDirectives(JSON_MAPPER.readTree(sdncDirectives)); multicloudRequest.setTemplateType(templateType); if (logger.isDebugEnabled()) { logger.debug(String.format("Stack Template Data is: %s", stack.toString().substring(16))); } - multicloudRequest.setTemplateData(JSON_MAPPER.writeValueAsString(stack)); + multicloudRequest.setTemplateData(stack); if (logger.isDebugEnabled()) { logger.debug(String.format("Multicloud Request is: %s", multicloudRequest.toString())); } - - CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> - new MsoCloudSiteNotFound(cloudSiteId)); - CloudIdentity cloudIdentity = cloudSite.getIdentityService(); - HttpHeaders headers = new HttpHeaders(); - headers.set ("X-Auth-User", cloudIdentity.getMsoId ()); - headers.set ("X-Auth-Key", CryptoUtils.decryptCloudConfigPassword(cloudIdentity.getMsoPass ())); - headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON.toString()); - headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON.toString()); - - if (logger.isDebugEnabled()) { - logger.debug(String.format("Multicloud Request Headers: %s", headers.toString())); - } - request = new HttpEntity<>(multicloudRequest, headers); } catch (Exception e) { logger.debug("ERROR making multicloud JSON body ", e); } @@ -211,7 +196,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ } RestClient multicloudClient = getMulticloudClient(multicloudEndpoint); - Response response = multicloudClient.post(request); + Response response = multicloudClient.post(multicloudRequest); StackInfo createInfo = new StackInfo(); createInfo.setName(stackName); @@ -223,7 +208,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ if (logger.isDebugEnabled()) { logger.debug("Multicloud Create Response Body: " + multicloudResponseBody); } - return getStackStatus(cloudSiteId, tenantId, multicloudResponseBody.getWorkloadId(), pollForCompletion, timeoutMinutes, backout); + return getStackStatus(cloudSiteId, tenantId, createInfo.getCanonicalName(), pollForCompletion, timeoutMinutes, backout); } else { createInfo.setStatus(HeatStatus.FAILED); createInfo.setStatusMessage(response.getStatusInfo().getReasonPhrase()); @@ -609,7 +594,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ private RestClient getMulticloudClient(String endpoint) { RestClient client = null; try { - client= new HttpClient(UriBuilder.fromUri(endpoint).build().toURL(), + client = new HttpClient(UriBuilder.fromUri(endpoint).build().toURL(), MediaType.APPLICATION_JSON.toString(), TargetEntity.MULTICLOUD); } catch (MalformedURLException e) { logger.debug(String.format("Encountered malformed URL error getting multicloud rest client %s", e.getMessage())); @@ -715,7 +700,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ try { // Delete the Multicloud stack - StackInfo stackInfo = deleteStack (tenantId, cloudSiteId, instanceId); + StackInfo stackInfo = deleteStack (cloudSiteId, tenantId, instanceId); // Populate a VduInstance based on the deleted Cloudify Deployment object VduInstance vduInstance = stackInfoToVduInstance(stackInfo); diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java index fefc0951f6..4204813cec 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java @@ -24,6 +24,9 @@ import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.JsonNode; +import com.woorea.openstack.heat.model.CreateStackParam; + import org.apache.commons.lang.builder.ToStringBuilder; @JsonInclude(JsonInclude.Include.NON_NULL) @@ -43,13 +46,13 @@ public class MulticloudRequest implements Serializable { @JsonProperty("vf-module-id") private String vfModuleId; @JsonProperty("oof_directives") - private String oofDirectives; + private JsonNode oofDirectives; @JsonProperty("sdnc_directives") - private String sdncDirectives; + private JsonNode sdncDirectives; @JsonProperty("template_type") private String templateType; @JsonProperty("template_data") - private String templateData; + private CreateStackParam templateData; @JsonProperty("generic-vnf-id") @@ -73,22 +76,22 @@ public class MulticloudRequest implements Serializable { } @JsonProperty("oof_directives") - public String getOofDirectives() { + public JsonNode getOofDirectives() { return oofDirectives; } @JsonProperty("oof_directives") - public void setOofDirectives(String oofDirectives) { + public void setOofDirectives(JsonNode oofDirectives) { this.oofDirectives = oofDirectives; } @JsonProperty("sdnc_directives") - public String getSdncDirectives() { + public JsonNode getSdncDirectives() { return sdncDirectives; } @JsonProperty("sdnc_directives") - public void setSdncDirectives(String sdncDirectives) { + public void setSdncDirectives(JsonNode sdncDirectives) { this.sdncDirectives = sdncDirectives; } @@ -103,12 +106,12 @@ public class MulticloudRequest implements Serializable { } @JsonProperty("template_data") - public String getTemplateData() { + public CreateStackParam getTemplateData() { return templateData; } @JsonProperty("template_data") - public void setTemplateData(String templateData) { + public void setTemplateData(CreateStackParam templateData) { this.templateData = templateData; } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java index 5cd2559ef2..eaf3e125a1 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java @@ -340,14 +340,21 @@ public class CatalogDbAdapterRest { uuid = modelUUID; logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelUuid serviceModelUuid: {}" , uuid); Service serv =serviceRepo.findOneByModelUUID(uuid); - ret.setService(serv); + + if (serv != null) { + ret.setNetworkResourceCustomizations(new ArrayList(serv.getNetworkCustomizations())); + ret.setVnfResourceCustomizations(new ArrayList(serv.getVnfCustomizations())); + ret.setAllottedResourceCustomizations(new ArrayList(serv.getAllottedCustomizations())); + } + ret.setService(serv); } else if (modelInvariantUUID != null && !"".equals(modelInvariantUUID)) { uuid = modelInvariantUUID; if (modelVersion != null && !"".equals(modelVersion)) { logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelInvariantUuid: {} serviceModelVersion: {}",uuid, modelVersion); Service serv = serviceRepo.findFirstByModelVersionAndModelInvariantUUID(modelVersion, uuid); - ret.setService(serv); + + ret.setService(serv); } else { logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelUuid: {}" , uuid); diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy index 9e71313e09..00bd8e9ef8 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy @@ -694,6 +694,32 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess } /** + * Constructs a workflow message callback URL for the specified message type and correlator. + * This type of callback URL is used when a workflow wants an MSO adapter (like the SDNC + * adapter) to call it back. In other words, this is for callbacks internal to the MSO + * complex. Use <code>createWorkflowMessageAdapterCallbackURL</code> if the callback + * will come from outside the MSO complex. + * @param endpoint endpoint address to contruct URL from + * @param messageType the message type (e.g. SDNCAResponse or VNFAResponse) + * @param correlator the correlator value (e.g. a request ID) + */ + public String createCallbackURL(String endpoint, String messageType, String correlator) { + if (endpoint == null || endpoint.isEmpty()) { + ExceptionUtil exceptionUtil = new ExceptionUtil() + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, + 'mso:workflow:message:endpoint was not passed in') + } + + while (endpoint.endsWith('/')) { + endpoint = endpoint.substring(0, endpoint.length()-1) + } + + return endpoint + + '/' + UriUtils.encodePathSegment(messageType, 'UTF-8') + + '/' + UriUtils.encodePathSegment(correlator, 'UTF-8') + } + + /** * * Constructs a workflow message callback URL for the specified message type and correlator. * This type of callback URL is used when a workflow wants a system outside the MSO complex diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy index 7028f6eeed..aa0d8ace6a 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy @@ -152,9 +152,7 @@ class OofHoming extends AbstractServiceTaskProcessor { execution.setVariable("oofRequest", oofRequest) utils.log("DEBUG", "OOF Request is: " + oofRequest, isDebugEnabled) - String endpoint = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.endpoint", execution) - String host = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.host", execution) - String url = host + endpoint + String url = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) utils.log("DEBUG", "Posting to OOF Url: " + url, isDebugEnabled) logDebug("URL to be used is: " + url, isDebugEnabled) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index d95795906f..b1da7cf49b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -87,7 +87,9 @@ class OofUtils { ArrayList requiredCandidates = null) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("DEBUG", "Started Building OOF Request", isDebugEnabled) - def callbackUrl = utils.createWorkflowMessageAdapterCallbackURL(execution, "oofResponse", requestId) + String callbackEndpoint = UrnPropertiesReader.getVariable("mso.oof.callbackEndpoint", execution) + utils.log("DEBUG", "mso.oof.callbackEndpoint is: " + callbackEndpoint, isDebugEnabled) + def callbackUrl = utils.createWorkflowMessageAdapterCallbackURL(callbackEndpoint, "oofResponse", requestId) def transactionId = requestId //ServiceInstance Info ServiceInstance serviceInstance = decomposition.getServiceInstance() diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml index 3523703ee8..55d5d9244e 100644 --- a/bpmn/so-bpmn-infrastructure-common/pom.xml +++ b/bpmn/so-bpmn-infrastructure-common/pom.xml @@ -269,7 +269,7 @@ <dependency> <groupId>org.onap.msb.java-sdk</groupId> <artifactId>msb-java-sdk</artifactId> - <version>1.0.0</version> + <version>1.1.1</version> <exclusions> <exclusion> <groupId>com.eclipsesource.jaxrs</groupId> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index 856ff6c063..ebd622ca51 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -422,7 +422,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" } - def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.db.endpoint") execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) diff --git a/bpmn/so-bpmn-infrastructure-flows/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml index 63b66cafe5..7d7b89c8fb 100644 --- a/bpmn/so-bpmn-infrastructure-flows/pom.xml +++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml @@ -244,18 +244,6 @@ <version>1.3</version> </dependency> <dependency> - <groupId>org.onap.msb.java-sdk</groupId> - <artifactId>msb-java-sdk</artifactId> - <version>1.0.0</version> - <exclusions> - <exclusion> - <groupId>com.eclipsesource.jaxrs</groupId> - <artifactId>jersey-all</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml index d9b3ee57d8..d46f13434f 100644 --- a/bpmn/so-bpmn-tasks/pom.xml +++ b/bpmn/so-bpmn-tasks/pom.xml @@ -29,7 +29,7 @@ <dependency> <groupId>org.onap.sdnc.northbound</groupId> <artifactId>generic-resource-api-client</artifactId> - <version>1.4.0</version> + <version>1.4.1</version> <exclusions> <exclusion> <groupId>javax.ws.rs</groupId> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java index a9f695b5be..2b4834af42 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java @@ -87,6 +87,7 @@ public class NetworkTopologyOperationRequestMapper { private GenericResourceApiNetworkrequestinputNetworkRequestInput buildNetworkRequestInput(L3Network network, ServiceInstance serviceInstance, CloudRegion cloudRegion){ GenericResourceApiNetworkrequestinputNetworkRequestInput networkRequestInput = new GenericResourceApiNetworkrequestinputNetworkRequestInput(); networkRequestInput.setTenant(cloudRegion.getTenantId()); + networkRequestInput.setCloudOwner(cloudRegion.getCloudOwner()); networkRequestInput.setAicCloudRegion(cloudRegion.getLcpCloudRegionId()); if (network.getNetworkName() != null && !network.getNetworkName().equals("")) { networkRequestInput.setNetworkName(network.getNetworkName()); 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 7013a50dcf..a6ef02bd4d 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 @@ -114,6 +114,7 @@ public class VfModuleTopologyOperationRequestMapper { if (cloudRegion != null) { vfModuleRequestInput.setTenant(cloudRegion.getTenantId()); vfModuleRequestInput.setAicCloudRegion(cloudRegion.getLcpCloudRegionId()); + vfModuleRequestInput.setCloudOwner(cloudRegion.getCloudOwner()); } if (vfModule.getVfModuleName() != null && !vfModule.getVfModuleName().equals("")) { vfModuleRequestInput.setVfModuleName(vfModule.getVfModuleName()); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java index 1355151919..bf128a4838 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java @@ -71,6 +71,7 @@ public class VnfTopologyOperationRequestMapper { vnfRequestInput.setTenant(cloudRegion.getTenantId()); vnfRequestInput.setAicCloudRegion(cloudRegion.getLcpCloudRegionId()); + vnfRequestInput.setCloudOwner(cloudRegion.getCloudOwner()); if (StringUtils.isNotBlank(vnf.getVnfName())) { vnfRequestInput.setVnfName(vnf.getVnfName()); diff --git a/common/pom.xml b/common/pom.xml index d2dba45ebd..799d8a4d34 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -62,7 +62,7 @@ <dependency> <groupId>org.onap.aai.aai-common</groupId> <artifactId>aai-schema</artifactId> - <version>1.3.1-SNAPSHOT</version> + <version>1.3.1</version> </dependency> <dependency> <groupId>org.modelmapper</groupId> |