diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main')
37 files changed, 565 insertions, 293 deletions
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 c7fcc5c5d3..35e68bb79f 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018 Intel Corp. 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. 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 7c5ffca4ab..8ce633845b 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 @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018 Intel Corp. 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. @@ -82,20 +82,20 @@ class OofUtils { //ServiceInstance Info ServiceInstance serviceInstance = decomposition.getServiceInstance() def serviceInstanceId = "" - def serviceInstanceName = "" + def serviceName = "" serviceInstanceId = execution.getVariable("serviceInstanceId") - serviceInstanceName = execution.getVariable("serviceInstanceName") + serviceName = execution.getVariable("subscriptionServiceType") if (serviceInstanceId == null || serviceInstanceId == "null") { utils.log("DEBUG", "Unable to obtain Service Instance Id", isDebugEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " + - "obtain Service Instance Id, execution.getVariable(\"serviceInstanceName\") is null") + "obtain Service Instance Id, execution.getVariable(\"serviceInstanceId\") is null") } - if (serviceInstanceName == null || serviceInstanceName == "null") { - utils.log("DEBUG", "Unable to obtain Service Instance Name", isDebugEnabled) + if (serviceName == null || serviceName == "null") { + utils.log("DEBUG", "Unable to obtain Service Name", isDebugEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " + - "obtain Service Instance Name, execution.getVariable(\"serviceInstanceName\") is null") + "obtain Service Name, execution.getVariable(\"subscriptionServiceType\") is null") } //Model Info ModelInfo model = decomposition.getModelInfo() @@ -144,24 +144,12 @@ class OofUtils { utils.log("DEBUG", "Allotted Resource: " + resource.toString(), isDebugEnabled) def serviceResourceId = resource.getResourceId() - def resourceModuleName = resource.getNfFunction() - utils.log("DEBUG", "resourceModuleName: " + resourceModuleName, - isDebugEnabled) - def resourceModelInvariantId = "no-resourceModelInvariantId" - def resourceModelVersionId = "no-resourceModelVersionId" - - List modelIdLst = execution.getVariable("homingModelIds") - utils.log("DEBUG", "Incoming modelIdLst is: " + modelIdLst.toString(), isDebugEnabled) - for (Map modelId : modelIdLst ) - if (resourceModuleName == modelId.resourceModuleName) { - resourceModelInvariantId = modelId.resourceModelInvariantId - resourceModelVersionId = modelId.resourceModelVersionId - } - - def resourceModelName = "" //Optional - def resourceModelVersion = "" //Optional - def resourceModelType = "" //Optional - def tenantId = "" //Optional + def resourceModelInvariantId = resource.getModelInfo().getModelInvariantUuid() + def resourceModelVersionId = resource.getModelInfo().getModelUuid() + def resourceModelName = resource.getModelInfo().getModelName() + def resourceModelVersion = resource.getModelInfo().getModelVersion() + def resourceModelType = resource.getModelInfo().getModelType() + def tenantId = execution.getVariable("tenantId") def requiredCandidatesJson = "" requiredCandidatesJson = createCandidateJson( @@ -171,7 +159,7 @@ class OofUtils { String demand = " {\n" + - " \"resourceModuleName\": \"${resourceModuleName}\",\n" + + " \"resourceModuleName\": \"${resourceModelName}\",\n" + " \"serviceResourceId\": \"${serviceResourceId}\",\n" + " \"tenantId\": \"${tenantId}\",\n" + " \"resourceModelInfo\": {\n" + @@ -191,21 +179,18 @@ class OofUtils { isDebugEnabled) ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo() def serviceResourceId = vnfResource.getResourceId() - def resourceModuleName = vnfResource.getNfFunction() - utils.log("DEBUG", "resourceModuleName: " + resourceModuleName, - isDebugEnabled) def resourceModelInvariantId = vnfResourceModelInfo.getModelInvariantUuid() def resourceModelName = vnfResourceModelInfo.getModelName() def resourceModelVersion = vnfResourceModelInfo.getModelVersion() def resourceModelVersionId = vnfResourceModelInfo.getModelUuid() def resourceModelType = vnfResourceModelInfo.getModelType() - def tenantId = "" //Optional + def tenantId = execution.getVariable("tenantId") def requiredCandidatesJson = "" String placementDemand = " {\n" + - " \"resourceModuleName\": \"${resourceModuleName}\",\n" + + " \"resourceModuleName\": \"${resourceModelName}\",\n" + " \"serviceResourceId\": \"${serviceResourceId}\",\n" + " \"tenantId\": \"${tenantId}\",\n" + " \"resourceModelInfo\": {\n" + @@ -297,7 +282,7 @@ class OofUtils { " },\n" + " \"serviceInfo\": {\n" + " \"serviceInstanceId\": \"${serviceInstanceId}\",\n" + - " \"serviceName\": \"${serviceInstanceName}\",\n" + + " \"serviceName\": \"${serviceName}\",\n" + " \"modelInfo\": {\n" + " \"modelType\": \"${modelType}\",\n" + " \"modelInvariantId\": \"${modelInvariantId}\",\n" + diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy index ba450c1b12..58c8f27de9 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy @@ -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. @@ -281,14 +281,14 @@ class SDNCAdapterUtils { } boolean isAic3 = execution.getVariable("isAic3") - + if(isAic3) { nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC3.0") } else { nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC2.X") } - + String content = """ <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1" xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1"> @@ -319,7 +319,7 @@ class SDNCAdapterUtils { /** * Builds an SDNC "reserve" request and stores it in the specified execution - * variable. + * variable. * @param execution the execution * @param action the type of action: reserve, turnup, etc * @param resultVar the execution variable in which the result will be stored @@ -424,7 +424,7 @@ class SDNCAdapterUtils { if (additionalData == null) { additionalData = "" } - + if(isAic3) { nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC3.0") } @@ -470,7 +470,7 @@ class SDNCAdapterUtils { exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error") } } - + public String updateHomingInfo(String homingInfo, String aicVersion) { String newHomingInfo if(homingInfo == null || homingInfo.trim().length() == 0) { @@ -480,7 +480,7 @@ class SDNCAdapterUtils { newHomingInfo = homingInfo.substring(0, homingInfo.indexOf("</l2-homing-information>")) + "<aic-version>" + aicVersion + "</aic-version></l2-homing-information>" } } - + /** * Builds a topology SDNC request and return String request. * As V2 will use 1607-style request, region instead of aic clli code @@ -506,7 +506,7 @@ class SDNCAdapterUtils { } else { hdrRequestId = testHdrRequestId } - + String requestId = "" try { requestId = execution.getVariable("mso-request-id") @@ -561,6 +561,9 @@ class SDNCAdapterUtils { int subscriberNameEnd = siRelatedLink.indexOf("/service-subscriptions/") subscriberName = siRelatedLink.substring(subscriberNameStart + 19, subscriberNameEnd) subscriberName = UriUtils.decode(subscriberName,"UTF-8") + }else{ + serviceType = execution.getVariable("serviceType") + subscriberName = execution.getVariable("subscriberName") } String content = @@ -635,11 +638,11 @@ class SDNCAdapterUtils { requestId = execution.getVariable("mso-request-id") if (requestId == null) { requestId = execution.getVariable("msoRequestId") - } + } } else { requestId = testRequestId - } - + } + String aicCloudRegion = cloudRegionId String tenantId = "" if (utils.nodeExists(requestXML, "tenant-id")) { @@ -717,7 +720,7 @@ class SDNCAdapterUtils { String content = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" - xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> @@ -993,7 +996,7 @@ class SDNCAdapterUtils { exceptionUtil.buildAndThrowWorkflowException(execution, 400, msg) } } - + public String modelInfoToEcompModelInformation(String jsonModelInfo) { String modelInvariantUuid = jsonUtil.getJsonValue(jsonModelInfo, "modelInvariantUuid") String modelUuid = jsonUtil.getJsonValue(jsonModelInfo, "modelUuid") @@ -1004,11 +1007,11 @@ class SDNCAdapterUtils { String modelCustomizationString = "" if (modelCustomizationUuid != null) { modelCustomizationString = "<model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>" - } + } String modelVersion = jsonUtil.getJsonValue(jsonModelInfo, "modelVersion") if (modelVersion == null) { modelVersion = "" - } + } String modelName = jsonUtil.getJsonValue(jsonModelInfo, "modelName") String ecompModelInformation = """<onap-model-information> @@ -1019,6 +1022,6 @@ class SDNCAdapterUtils { <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> </onap-model-information>""" - return ecompModelInformation - } + return ecompModelInformation + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy index fd4ab32215..5ff49fbae8 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy @@ -110,9 +110,12 @@ class SniroUtils{ String requestType = "initial" List<Resource> resources = decomposition.getServiceResources() for(Resource r:resources){ - HomingSolution currentSolution = (HomingSolution) r.getCurrentHomingSolution() + HomingSolution currentSolution = r.getCurrentHomingSolution() if(currentSolution != null){ - requestType = "speed changed" + String indicator = currentSolution.getServiceInstanceId() + if(indicator != null){ + requestType = "speed changed" + } } } @@ -319,7 +322,6 @@ class SniroUtils{ } if((isBlank(placements) || placements.equalsIgnoreCase("[]")) && (isBlank(licenses) || licenses.equalsIgnoreCase("[]"))){ msoLogger.debug("Sniro Async Response does not contain: licenses or placements") - exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Sniro Async Callback Response does not contain: licenses or placements") }else{ return } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java index ca1acc5963..47e36424dd 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java @@ -85,12 +85,9 @@ public class PayloadClient { public static Optional<String> healthCheckFormat(String vnfName, String vnfHostIpAddress) throws JsonProcessingException{ HealthCheckAction payloadResult = new HealthCheckAction(); RequestParametersHealthCheck requestParams = new RequestParametersHealthCheck(); - ConfigurationParametersHealthCheck configParams = new ConfigurationParametersHealthCheck(); - requestParams.setVnfName(vnfName); - configParams.setVnfName(vnfName); - payloadResult.setConfigurationParameters(configParams); + requestParams.setVnfHostIpAddress(vnfHostIpAddress); payloadResult.setRequestParameters(requestParams); - return Optional.of(mapper.writeValueAsString(payloadResult)); + return Optional.of((mapper.writeValueAsString(payloadResult)).replaceAll("\"", "\\\\\"")); } public static Optional<String> snapshotFormat(String vmId, String identityUrl)throws JsonProcessingException{ diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigScaleOutPayload.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigScaleOutPayload.java new file mode 100644 index 0000000000..9035f4d506 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigScaleOutPayload.java @@ -0,0 +1,58 @@ +/* ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.bpmn.appc.payload.beans; + +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ConfigScaleOutPayload { + + @JsonProperty("request-parameters") + private RequestParametersConfigScaleOut requestParameters; + @JsonProperty("configuration-parameters") + private Map<String, String> configurationParameters = new HashMap<>(); + + public RequestParametersConfigScaleOut getRequestParameters() { + return requestParameters; + } + + public void setRequestParameters(RequestParametersConfigScaleOut requestParameters) { + this.requestParameters = requestParameters; + } + + public Map<String, String> getConfigurationParameters() { + return configurationParameters; + } + + public void setConfigurationParameters(Map<String, String> configurationParameters) { + this.configurationParameters = configurationParameters; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("ConfigScaleOutPayload{"); + sb.append("requestParameters=").append(requestParameters); + sb.append(", configurationParameters='").append(configurationParameters); + sb.append('}'); + return sb.toString(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigScaleOut.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigScaleOut.java new file mode 100644 index 0000000000..0333fd7a78 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigScaleOut.java @@ -0,0 +1,55 @@ +/* ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class RequestParametersConfigScaleOut { + + @JsonProperty("vnf-host-ip-address") + private String vnfHostIpAddress; + @JsonProperty("vf-module-id") + private String vfModuleId; + + public String getVnfHostIpAddress() { + return vnfHostIpAddress; + } + + public void setVnfHostIpAddress(String vnfHostIpAddress) { + this.vnfHostIpAddress = vnfHostIpAddress; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("RequestParametersConfigScaleOut{"); + sb.append("vnf-host-ip-address=").append(vnfHostIpAddress); + sb.append(", vf-module-id='").append(vfModuleId); + sb.append('}'); + return sb.toString(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java index ca87ad6d15..053ac5e741 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java @@ -32,16 +32,27 @@ public class RequestParametersHealthCheck { @JsonProperty("vnf-name") private String vnfName; - +@JsonProperty("vnf-host-ip-address") +private String vnfHostIpAddress; @JsonProperty("vnf-name") public String getVnfName() { -return vnfName; + return vnfName; } @JsonProperty("vnf-name") public void setVnfName(String vnfName) { -this.vnfName = vnfName; + this.vnfName = vnfName; +} + +@JsonProperty("vnf-host-ip-address") +public void setVnfHostIpAddress(String vnfHostIpAddress) { + this.vnfHostIpAddress = vnfHostIpAddress; +} + +@JsonProperty("vnf-host-ip-address") +public String getVnfHostIpAddress() { + return vnfHostIpAddress; } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java index f1c2c8dda6..deae46ce98 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java @@ -21,8 +21,10 @@ package org.onap.so.bpmn.common; import org.onap.so.client.aai.AAICommonObjectMapperProvider; +import org.onap.so.client.aai.AAIQueryClient; import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.policy.PolicyClientImpl; import org.onap.so.client.sdno.SDNOValidator; import org.onap.so.client.sdno.SDNOValidatorImpl; import org.springframework.stereotype.Component; @@ -46,6 +48,10 @@ public class InjectionHelper { return new AAIResourcesClient(); } + public AAIQueryClient getAaiQueryClient() { + return new AAIQueryClient(); + } + public SDNOValidator getSdnoValidator() { return new SDNOValidatorImpl(); } @@ -57,4 +63,8 @@ public class InjectionHelper { public AAIResultWrapper getAaiResultWrapper(String json) { return new AAIResultWrapper(json); } + + public PolicyClientImpl getPolicyClient() { + return new PolicyClientImpl(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java new file mode 100644 index 0000000000..c3511e69a4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java @@ -0,0 +1,72 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.bpmn.common.baseclient; + +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.http.client.BufferingClientHttpRequestFactory; +import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.RestTemplate; + +//TODO move to common location +public class BaseClient<I,O> { + + private HttpHeaders httpHeader; + private String targetUrl; + + public HttpHeaders getHttpHeader() { + return httpHeader; + } + + public void setHttpHeader(HttpHeaders httpHeader) { + this.httpHeader = httpHeader; + } + + public String getTargetUrl() { + return targetUrl; + } + + public void setTargetUrl(String targetUrl) { + this.targetUrl = targetUrl; + } + + public O get(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { + return run(data, HttpMethod.GET, typeRef, uriVariables); + } + + public O post(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { + return run(data, HttpMethod.POST, typeRef, uriVariables); + } + + public O run(I data, HttpMethod method, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { + HttpEntity<I> requestEntity = new HttpEntity<I>(data, getHttpHeader()); + RestTemplate restTemplate = new RestTemplate(); + restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory())); + ResponseEntity<O> responseEntity = restTemplate.exchange(getTargetUrl(), method, requestEntity, typeRef, + uriVariables); + return responseEntity.getBody(); + } + +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java index e4bd2f1de0..35bd25fabf 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java @@ -55,9 +55,9 @@ import com.google.gson.reflect.TypeToken; public class ResourceRequestBuilder { - public static String CUSTOMIZATION_UUID = "customizationUUID"; + private static String CUSTOMIZATION_UUID = "customizationUUID"; - public static String SERVICE_URL_TOSCA_CSAR = "/v3/serviceToscaCsar?serviceModelUuid="; + private static String SERVICE_URL_TOSCA_CSAR = "/v3/serviceToscaCsar"; private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ResourceRequestBuilder.class); @@ -184,7 +184,7 @@ public class ResourceRequestBuilder { private static String getCsarFromUuid(String uuid) throws Exception { String catalogEndPoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint"); - HttpClient client = new HttpClient(UriBuilder.fromUri(catalogEndPoint + SERVICE_URL_TOSCA_CSAR + uuid).build().toURL(), "application/json", TargetEntity.CATALOG_DB); + HttpClient client = new HttpClient(UriBuilder.fromUri(catalogEndPoint).path(SERVICE_URL_TOSCA_CSAR).queryParam("serviceModelUuid", uuid).build().toURL(), "application/json", TargetEntity.CATALOG_DB); Response response = client.get(); String value = response.readEntity(String.class); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java index 937c79be1d..978f1e9324 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java @@ -37,13 +37,13 @@ public class CtagAssignment implements Serializable, ShallowCopy<CtagAssignment> @Id @JsonProperty("vlan-id-inner") - private long vlanIdInner; + private Long vlanIdInner; - public long getVlanIdInner() { + public Long getVlanIdInner() { return vlanIdInner; } - public void setVlanIdInner(long vlanIdInner) { + public void setVlanIdInner(Long vlanIdInner) { this.vlanIdInner = vlanIdInner; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java index 218763a006..ba3ab7f315 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java @@ -62,7 +62,7 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> { @JsonProperty("platform") private Platform platform; @JsonProperty("cascaded") - private boolean cascaded; + private Boolean cascaded; @JsonProperty("cloud-params") private Map<String, String> cloudParams = new HashMap<>(); @JsonProperty("cloud-context") @@ -104,9 +104,9 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> { @JsonProperty("vdisk-units") private String vdiskUnits; @JsonProperty("in-maint") - private boolean inMaint; + private Boolean inMaint; @JsonProperty("is-closed-loop-disabled") - private boolean isClosedLoopDisabled; + private Boolean isClosedLoopDisabled; @JsonProperty("summary-status") private String summaryStatus; @JsonProperty("encrypted-access-flag") @@ -138,9 +138,29 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> { @JsonProperty("instance-groups") private List<InstanceGroup> instanceGroups = new ArrayList<InstanceGroup>(); @JsonProperty("call-homing") - private boolean callHoming; + private Boolean callHoming; + @JsonProperty("nf-function") + private String nfFunction; + @JsonProperty("nf-role") + private String nfRole; + public String getNfFunction() { + return nfFunction; + } + + public void setNfFunction(String nfFunction) { + this.nfFunction = nfFunction; + } + + public String getNfRole() { + return nfRole; + } + + public void setNfRole(String nfRole) { + this.nfRole = nfRole; + } + public List<InstanceGroup> getInstanceGroups() { return instanceGroups; } @@ -309,19 +329,19 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> { this.vdiskUnits = vdiskUnits; } - public boolean isInMaint() { + public Boolean isInMaint() { return inMaint; } - public void setInMaint(boolean inMaint) { + public void setInMaint(Boolean inMaint) { this.inMaint = inMaint; } - public boolean isClosedLoopDisabled() { + public Boolean isIsClosedLoopDisabled() { return isClosedLoopDisabled; } - public void setClosedLoopDisabled(boolean isClosedLoopDisabled) { + public void setClosedLoopDisabled(Boolean isClosedLoopDisabled) { this.isClosedLoopDisabled = isClosedLoopDisabled; } @@ -453,11 +473,11 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> { this.platform = platform; } - public boolean isCascaded() { + public Boolean isCascaded() { return cascaded; } - public void setCascaded(boolean cascaded) { + public void setCascaded(Boolean cascaded) { this.cascaded = cascaded; } @@ -485,11 +505,11 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> { this.cloudRegion = cloudRegion; } - public boolean isCallHoming() { + public Boolean isCallHoming() { return callHoming; } - public void setCallHoming(boolean callHoming) { + public void setCallHoming(Boolean callHoming) { this.callHoming = callHoming; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java index 51cd998073..5f43ba076a 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java @@ -46,7 +46,7 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> { @JsonProperty("network-id") private String networkId; @JsonProperty("cascaded") - private boolean cascaded; + private Boolean cascaded; @JsonProperty("cloud-params") private Map<String, String> cloudParams = new HashMap<>(); @JsonProperty("network-name") @@ -60,7 +60,7 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> { @JsonProperty("network-role") private String networkRole; @JsonProperty("is-bound-to-vpn") - private boolean isBoundToVpn; + private Boolean isBoundToVpn; @JsonProperty("service-id") private String serviceId; @JsonProperty("network-role-instance") @@ -82,11 +82,11 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> { @JsonProperty("physical-network-name") private String physicalNetworkName; @JsonProperty("is-provider-network") - private boolean isProviderNetwork; + private Boolean isProviderNetwork; @JsonProperty("is-shared-network") - private boolean isSharedNetwork; + private Boolean isSharedNetwork; @JsonProperty("is-external-network") - private boolean isExternalNetwork; + private Boolean isExternalNetwork; @JsonProperty("self-link") private String selflink; @JsonProperty("operational-status") @@ -142,10 +142,10 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> { public void setNetworkRole(String networkRole) { this.networkRole = networkRole; } - public boolean isBoundToVpn() { + public Boolean isIsBoundToVpn() { return isBoundToVpn; } - public void setIsBoundToVpn(boolean isBoundToVpn) { + public void setIsBoundToVpn(Boolean isBoundToVpn) { this.isBoundToVpn = isBoundToVpn; } public String getServiceId() { @@ -202,22 +202,22 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> { public void setPhysicalNetworkName(String physicalNetworkName) { this.physicalNetworkName = physicalNetworkName; } - public boolean isProviderNetwork() { + public Boolean isIsProviderNetwork() { return isProviderNetwork; } - public void setIsProviderNetwork(boolean isProviderNetwork) { + public void setIsProviderNetwork(Boolean isProviderNetwork) { this.isProviderNetwork = isProviderNetwork; } - public boolean isSharedNetwork() { + public Boolean isIsSharedNetwork() { return isSharedNetwork; } - public void setIsSharedNetwork(boolean isSharedNetwork) { + public void setIsSharedNetwork(Boolean isSharedNetwork) { this.isSharedNetwork = isSharedNetwork; } - public boolean isExternalNetwork() { + public Boolean isIsExternalNetwork() { return isExternalNetwork; } - public void setIsExternalNetwork(boolean isExternalNetwork) { + public void setIsExternalNetwork(Boolean isExternalNetwork) { this.isExternalNetwork = isExternalNetwork; } public String getSelflink() { @@ -242,10 +242,10 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> { public List<SegmentationAssignment> getSegmentationAssignments() { return segmentationAssignments; } - public boolean isCascaded() { + public Boolean isCascaded() { return cascaded; } - public void setIsCascaded(boolean cascaded) { + public void setIsCascaded(Boolean cascaded) { this.cascaded = cascaded; } public Map<String, String> getCloudParams() { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java index 4bba39ee62..f102c15062 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java @@ -57,13 +57,13 @@ public class LInterface implements Serializable, ShallowCopy<LInterface>{ @JsonProperty("interface-description") private String interfaceDescription; @JsonProperty("is-port-mirrored") - private boolean isPortMirrored; + private Boolean isPortMirrored; @JsonProperty("in-maint") - private boolean inMaint; + private Boolean inMaint; @JsonProperty("prov-status") private String provStatus; @JsonProperty("is-ip-unnumbered") - private boolean isIpUnnumbered; + private Boolean isIpUnnumbered; @JsonProperty("allowed-address-pairs") private String allowedAddressPairs; @JsonProperty("vlans") @@ -131,13 +131,13 @@ public class LInterface implements Serializable, ShallowCopy<LInterface>{ public void setInterfaceDescription(String interfaceDescription) { this.interfaceDescription = interfaceDescription; } - public boolean isPortMirrored() { + public Boolean isIsPortMirrored() { return isPortMirrored; } - public void setPortMirrored(boolean isPortMirrored) { + public void setPortMirrored(Boolean isPortMirrored) { this.isPortMirrored = isPortMirrored; } - public boolean isInMaint() { + public Boolean isInMaint() { return inMaint; } public void setInMaint(boolean inMaint) { @@ -149,10 +149,10 @@ public class LInterface implements Serializable, ShallowCopy<LInterface>{ public void setProvStatus(String provStatus) { this.provStatus = provStatus; } - public boolean isIpUnnumbered() { + public Boolean isIsIpUnnumbered() { return isIpUnnumbered; } - public void setIpUnnumbered(boolean isIpUnnumbered) { + public void setIpUnnumbered(Boolean isIpUnnumbered) { this.isIpUnnumbered = isIpUnnumbered; } public String getAllowedAddressPairs() { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java index 8a3248e92c..f69f4628fa 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java @@ -53,7 +53,7 @@ public class LagInterface implements Serializable, ShallowCopy<LagInterface>{ @JsonProperty("prov-status") private String provStatus; @JsonProperty("in-maint") - private boolean inMaint; + private Boolean inMaint; @JsonProperty("l-interfaces") private List<LInterface> lInterfaces = new ArrayList<>(); @@ -99,7 +99,7 @@ public class LagInterface implements Serializable, ShallowCopy<LagInterface>{ public void setProvStatus(String provStatus) { this.provStatus = provStatus; } - public boolean isInMaint() { + public Boolean isInMaint() { return inMaint; } public void setInMaint(boolean inMaint) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java index 4f54139386..742a541352 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java @@ -48,9 +48,9 @@ public class PhysicalLink implements Serializable, ShallowCopy<PhysicalLink> { @JsonProperty("management-option") private String managementOption; @JsonProperty("bandwidth-up") - private int bandwidthUp; + private Integer bandwidthUp; @JsonProperty("bandwidth-down") - private int bandwidthDown; + private Integer bandwidthDown; @JsonProperty("bandwidth-units") private String bandwidthUnits; @JsonProperty("wan-port") @@ -99,19 +99,19 @@ public class PhysicalLink implements Serializable, ShallowCopy<PhysicalLink> { this.managementOption = managementOption; } - public int getBandwidthUp(){ + public Integer getBandwidthUp(){ return bandwidthUp; } - public void setBandwidthUp(int bandwidthUp){ + public void setBandwidthUp(Integer bandwidthUp){ this.bandwidthUp = bandwidthUp; } - public int getBandwidthDown(){ + public Integer getBandwidthDown(){ return bandwidthDown; } - public void setBandwidthDown(int bandwidthDown){ + public void setBandwidthDown(Integer bandwidthDown){ this.bandwidthDown = bandwidthDown; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java index cb23f3a3b9..7277438102 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java @@ -57,7 +57,7 @@ public class Subnet implements Serializable, ShallowCopy<Subnet>{ @JsonProperty("orchestration-status") private OrchestrationStatus orchestrationStatus; @JsonProperty("dhcp-enabled") - private boolean dhcpEnabled; + private Boolean dhcpEnabled; @JsonProperty("dhcp-start") private String dhcpStart; @JsonProperty("dhcp-end") @@ -119,10 +119,10 @@ public class Subnet implements Serializable, ShallowCopy<Subnet>{ public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { this.orchestrationStatus = orchestrationStatus; } - public boolean isDhcpEnabled() { + public Boolean isDhcpEnabled() { return dhcpEnabled; } - public void setDhcpEnabled(boolean dhcpEnabled) { + public void setDhcpEnabled(Boolean dhcpEnabled) { this.dhcpEnabled = dhcpEnabled; } public String getDhcpStart() { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java index fba78d7a87..469bc991b4 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java @@ -50,7 +50,7 @@ public class VfModule implements Serializable, ShallowCopy<VfModule> { @JsonProperty("cloud-params") private Map<String, String> cloudParams = new HashMap<>(); @JsonProperty("cascaded") - private boolean cascaded; + private Boolean cascaded; @JsonProperty("heat-stack-id") private String heatStackId; @JsonProperty("contrail-service-instance-fqdn") @@ -116,7 +116,7 @@ public class VfModule implements Serializable, ShallowCopy<VfModule> { public void setCloudParams(Map<String, String> cloudParams) { this.cloudParams = cloudParams; } - public boolean isCascaded() { + public Boolean isCascaded() { return cascaded; } public void setCascaded(boolean cascaded) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java index 65eeedc44c..a0788d4b0d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java @@ -59,11 +59,11 @@ public class Vlan implements Serializable, ShallowCopy<Vlan>{ @JsonProperty("orchestration-status") private OrchestrationStatus orchestrationStatus; @JsonProperty("in-maint") - private boolean inMaint; + private Boolean inMaint; @JsonProperty("prov-status") private String provStatus; @JsonProperty("is-ip-unnumbered") - private boolean isIpUnnumbered; + private Boolean isIpUnnumbered; @JsonProperty("l3-interface-ipv4-address-list") private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<L3InterfaceIpv4AddressList>(); @JsonProperty("l3-interface-ipv6-address-list") @@ -123,7 +123,7 @@ public class Vlan implements Serializable, ShallowCopy<Vlan>{ public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { this.orchestrationStatus = orchestrationStatus; } - public boolean isInMaint() { + public Boolean isInMaint() { return inMaint; } public void setInMaint(boolean inMaint) { @@ -135,10 +135,10 @@ public class Vlan implements Serializable, ShallowCopy<Vlan>{ public void setProvStatus(String provStatus) { this.provStatus = provStatus; } - public boolean isIpUnnumbered() { + public Boolean isIsIpUnnumbered() { return isIpUnnumbered; } - public void setIpUnnumbered(boolean isIpUnnumbered) { + public void setIpUnnumbered(Boolean isIpUnnumbered) { this.isIpUnnumbered = isIpUnnumbered; } public List<L3InterfaceIpv4AddressList> getL3InterfaceIpv4AddressList() { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java index 565a151077..99a643a129 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java @@ -52,7 +52,7 @@ public class VolumeGroup implements Serializable, ShallowCopy<VolumeGroup> { @JsonProperty("cloud-params") private Map<String, String> cloudParams = new HashMap<>(); @JsonProperty("cascaded") - private boolean cascaded; + private Boolean cascaded; @JsonProperty("heat-stack-id") private String heatStackId; @JsonProperty("model-info-vf-module") @@ -100,7 +100,7 @@ public class VolumeGroup implements Serializable, ShallowCopy<VolumeGroup> { public void setCloudParams(Map<String, String> cloudParams) { this.cloudParams = cloudParams; } - public boolean isCascaded() { + public Boolean isCascaded() { return cascaded; } public void setCascaded(boolean cascaded) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java index 38f974168e..7b11e9f68e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java @@ -37,7 +37,7 @@ public class BuildingBlock implements Serializable{ @JsonProperty("key") private String key; @JsonProperty("is-virtual-link") - private boolean isVirtualLink; + private Boolean isVirtualLink; @JsonProperty("virtual-link-key") private String virtualLinkKey; @@ -59,10 +59,10 @@ public class BuildingBlock implements Serializable{ public void setKey(String key) { this.key = key; } - public boolean getIsVirtualLink() { + public Boolean getIsVirtualLink() { return isVirtualLink; } - public void setIsVirtualLink(boolean isVirtualLink) { + public void setIsVirtualLink(Boolean isVirtualLink) { this.isVirtualLink = isVirtualLink; } public String getVirtualLinkKey() { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java new file mode 100644 index 0000000000..8f0ced955c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. 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.bpmn.servicedecomposition.entities; + +import java.io.Serializable; + +public class ConfigurationResourceKeys implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = 1L; + private String vfModuleCustomizationUUID; + private String vnfResourceCustomizationUUID; + private String cvnfcCustomizationUUID; + + public String getVfModuleCustomizationUUID() { + return vfModuleCustomizationUUID; + } + public void setVfModuleCustomizationUUID(String vfModuleCustomizationUUID) { + this.vfModuleCustomizationUUID = vfModuleCustomizationUUID; + } + public String getVnfResourceCustomizationUUID() { + return vnfResourceCustomizationUUID; + } + public void setVnfResourceCustomizationUUID(String vnfResourceCustomizationUUID) { + this.vnfResourceCustomizationUUID = vnfResourceCustomizationUUID; + } + public String getCvnfcCustomizationUUID() { + return cvnfcCustomizationUUID; + } + public void setCvnfcCustomizationUUID(String cvnfcCustomizationUUID) { + this.cvnfcCustomizationUUID = cvnfcCustomizationUUID; + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java index 36a24bd1e1..be73b37f85 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java @@ -35,10 +35,11 @@ public class ExecuteBuildingBlock implements Serializable{ private String resourceId; private String requestAction; private String vnfType; - private boolean aLaCarte; - private boolean homing; + private Boolean aLaCarte; + private Boolean homing; private WorkflowResourceIds workflowResourceIds; private RequestDetails requestDetails; + private ConfigurationResourceKeys configurationResourceKeys; public BuildingBlock getBuildingBlock() { return buildingBlock; @@ -70,10 +71,10 @@ public class ExecuteBuildingBlock implements Serializable{ public void setRequestAction(String requestAction) { this.requestAction = requestAction; } - public boolean isaLaCarte() { + public Boolean isaLaCarte() { return aLaCarte; } - public void setaLaCarte(boolean aLaCarte) { + public void setaLaCarte(Boolean aLaCarte) { this.aLaCarte = aLaCarte; } public String getVnfType() { @@ -82,10 +83,10 @@ public class ExecuteBuildingBlock implements Serializable{ public void setVnfType(String vnfType) { this.vnfType = vnfType; } - public boolean isHoming() { + public Boolean isHoming() { return homing; } - public void setHoming(boolean homing) { + public void setHoming(Boolean homing) { this.homing = homing; } public WorkflowResourceIds getWorkflowResourceIds() { @@ -100,4 +101,10 @@ public class ExecuteBuildingBlock implements Serializable{ public void setRequestDetails(RequestDetails requestDetails) { this.requestDetails = requestDetails; } + public ConfigurationResourceKeys getConfigurationResourceKeys() { + return configurationResourceKeys; + } + public void setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) { + this.configurationResourceKeys = configurationResourceKeys; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java index d594c73638..8f1262f70e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java @@ -32,13 +32,13 @@ public class OrchestrationContext implements Serializable { private static final long serialVersionUID = 6843015923244810369L; @JsonProperty("is-rollback-enabled") - private boolean isRollbackEnabled; + private Boolean isRollbackEnabled; - public boolean getIsRollbackEnabled() { + public Boolean getIsRollbackEnabled() { return this.isRollbackEnabled; } - public void setIsRollbackEnabled(boolean isRollbackEnabled) { + public void setIsRollbackEnabled(Boolean isRollbackEnabled) { this.isRollbackEnabled = isRollbackEnabled; } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java index 7715651b68..d37c8d13f3 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java @@ -21,7 +21,10 @@ package org.onap.so.bpmn.servicedecomposition.generalobjects; import java.io.Serializable; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; +import java.util.Map; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -51,6 +54,8 @@ public class RequestContext implements Serializable{ private String msoRequestId; @JsonProperty("requestParameters") private RequestParameters requestParameters; + @JsonProperty("configurationParameters") + private List<Map<String, String>> configurationParameters = new ArrayList<>(); public String getServiceURI() { return serviceURI; @@ -112,4 +117,10 @@ public class RequestContext implements Serializable{ public void setRequestParameters(RequestParameters requestParameters) { this.requestParameters = requestParameters; } + public List<Map<String, String>> getConfigurationParameters() { + return configurationParameters; + } + public void setConfigurationParameters(List<Map<String, String>> configurationParameters) { + this.configurationParameters = configurationParameters; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java index 17e42b4396..3c8f0e933f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java @@ -33,28 +33,28 @@ public class SolutionInfo implements Serializable { private static final long serialVersionUID = 6903399488466840832L; @JsonProperty("solution-id") //identifies which solution - private int solutionId; + private Integer solutionId; @JsonProperty("homed") - private boolean homed; + private Boolean homed; @JsonProperty("is-rehome") - private boolean isRehome; + private Boolean isRehome; @JsonProperty("targeted-cloud") private CloudRegion targetedCloudRegion; - public boolean isHomed() { + public Boolean isHomed() { return homed; } - public void setHomed(boolean homed) { + public void setHomed(Boolean homed) { this.homed = homed; } - public boolean isRehome() { + public Boolean isRehome() { return isRehome; } - public void setRehome(boolean isRehome) { + public void setRehome(Boolean isRehome) { this.isRehome = isRehome; } @@ -63,7 +63,7 @@ public class SolutionInfo implements Serializable { * given resource or resource pair. * i.e. 1, 2, 3.... */ - public int getSolutionId() { + public Integer getSolutionId() { return solutionId; } @@ -72,7 +72,7 @@ public class SolutionInfo implements Serializable { * given resource or resource pair. * i.e. 1, 2, 3.... */ - public void setSolutionId(int solutionId) { + public void setSolutionId(Integer solutionId) { this.solutionId = solutionId; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java index 349010781d..cb6fabde30 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java @@ -43,7 +43,7 @@ public class ModelInfoCollection implements Serializable { @JsonProperty("description") private String description; @JsonProperty("quantity") - private int quantity; + private Integer quantity; public String getModelCustomizationUUID() { return modelCustomizationUUID; @@ -87,10 +87,10 @@ public class ModelInfoCollection implements Serializable { public void setDescription(String description) { this.description = description; } - public int getQuantity() { + public Integer getQuantity() { return quantity; } - public void setQuantity(int quantity) { + public void setQuantity(Integer quantity) { this.quantity = quantity; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java index 9d3aa5934b..87168107e1 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java @@ -34,6 +34,8 @@ public class ModelInfoConfiguration implements Serializable{ private String modelVersionId; @JsonProperty("model-customization-id") private String modelCustomizationId; + @JsonProperty("policy-name") + private String policyName; public String getModelInvariantId() { return modelInvariantId; @@ -53,4 +55,10 @@ public class ModelInfoConfiguration implements Serializable{ public void setModelCustomizationId(String modelCustomizationId) { this.modelCustomizationId = modelCustomizationId; } + public String getPolicyName() { + return policyName; + } + public void setPolicyName(String policyName) { + this.policyName = policyName; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index b5203c676a..6d5fb2f825 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -49,6 +49,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; @@ -71,6 +72,7 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.logger.MsoLogger; @@ -141,8 +143,8 @@ public class BBInputSetup implements JavaDelegate { String resourceId = executeBB.getResourceId(); String requestAction = executeBB.getRequestAction(); String vnfType = executeBB.getVnfType(); - boolean aLaCarte = executeBB.isaLaCarte(); - boolean homing = executeBB.isHoming(); + boolean aLaCarte = Boolean.TRUE.equals(executeBB.isaLaCarte()); + boolean homing = Boolean.TRUE.equals(executeBB.isHoming()); Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); outputBB = this.getGBB(executeBB, lookupKeyMap, requestAction, aLaCarte, resourceId, vnfType); ObjectMapper mapper = new ObjectMapper(); @@ -267,32 +269,24 @@ public class BBInputSetup implements JavaDelegate { } protected void populateConfiguration(ModelInfo modelInfo, Service service, String bbName, - ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String instanceName) { - boolean foundByName = false; - boolean foundById = false; - for (Configuration configuration : serviceInstance.getConfigurations()) { + ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String instanceName, ConfigurationResourceKeys configurationResourceKeys) { + Configuration configuration = null; + for (Configuration configurationTemp : serviceInstance.getConfigurations()) { if (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null - && configuration.getConfigurationId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) { - foundById = true; + && configurationTemp.getConfigurationId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) { + configuration = configurationTemp; org.onap.aai.domain.yang.Configuration aaiConfiguration = bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId()); if(aaiConfiguration!=null){ modelInfo.setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId()); } - this.mapCatalogConfiguration(configuration, modelInfo, service); - } else if (instanceName != null && configuration.getConfigurationName().equalsIgnoreCase(instanceName)) { - foundByName = true; - lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, configuration.getConfigurationId()); - org.onap.aai.domain.yang.Configuration aaiConfiguration = bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId()); - if(aaiConfiguration!=null){ - modelInfo.setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId()); - } - this.mapCatalogConfiguration(configuration, modelInfo, service); } } - if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())) { - Configuration configuration = this.createConfiguration(lookupKeyMap, instanceName, resourceId); + if (configuration == null && bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())) { + configuration = this.createConfiguration(lookupKeyMap, instanceName, resourceId); serviceInstance.getConfigurations().add(configuration); - this.mapCatalogConfiguration(configuration, modelInfo, service); + } + if(configuration != null) { + this.mapCatalogConfiguration(configuration, modelInfo, service, configurationResourceKeys); } } @@ -306,11 +300,28 @@ public class BBInputSetup implements JavaDelegate { return configuration; } - protected void mapCatalogConfiguration(Configuration configuration, ModelInfo modelInfo, Service service) { + protected void mapCatalogConfiguration(Configuration configuration, ModelInfo modelInfo, Service service, ConfigurationResourceKeys configurationResourceKeys) { ConfigurationResourceCustomization configurationResourceCustomization = findConfigurationResourceCustomization(modelInfo, service); - if (configurationResourceCustomization != null) { - configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization)); + VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = + findVnfVfmoduleCvnfcConfigurationCustomization(configurationResourceKeys.getVfModuleCustomizationUUID(), + configurationResourceKeys.getVnfResourceCustomizationUUID(), configurationResourceKeys.getCvnfcCustomizationUUID(), configurationResourceCustomization); + if (configurationResourceCustomization != null && vnfVfmoduleCvnfcConfigurationCustomization != null) { + configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization + , vnfVfmoduleCvnfcConfigurationCustomization)); + } + } + + protected VnfVfmoduleCvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String vfModuleCustomizationUUID, + String vnfResourceCustomizationUUID, String cvnfcCustomizationUUID, ConfigurationResourceCustomization configurationResourceCustomization) { + for(VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization : + configurationResourceCustomization.getConfigurationResource().getVnfVfmoduleCvnfcConfigurationCustomization()) { + if(vnfVfmoduleCvnfcConfigurationCustomization.getVfModuleCustomization().getModelCustomizationUUID().equalsIgnoreCase(vfModuleCustomizationUUID) + && vnfVfmoduleCvnfcConfigurationCustomization.getVnfResourceCustomization().getModelCustomizationUUID().equalsIgnoreCase(vnfResourceCustomizationUUID) + && vnfVfmoduleCvnfcConfigurationCustomization.getCvnfcCustomization().getModelCustomizationUUID().equalsIgnoreCase(cvnfcCustomizationUUID)) { + return vnfVfmoduleCvnfcConfigurationCustomization; + } } + return null; } protected ConfigurationResourceCustomization findConfigurationResourceCustomization(ModelInfo modelInfo, Service service) { @@ -346,13 +357,15 @@ public class BBInputSetup implements JavaDelegate { ModelInfo vnfModelInfo = new ModelInfo(); vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); this.mapCatalogVnf(tempVnf, vnfModelInfo, service); - for(VolumeGroup volumeGroup : tempVnf.getVolumeGroups()) { - String volumeGroupCustId = - this.bbInputSetupUtils.getAAIVolumeGroup(CLOUD_OWNER, - cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()).getModelCustomizationId(); - if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) { - lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); - break; + if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) == null) { + for(VolumeGroup volumeGroup : tempVnf.getVolumeGroups()) { + String volumeGroupCustId = + this.bbInputSetupUtils.getAAIVolumeGroup(CLOUD_OWNER, + cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()).getModelCustomizationId(); + if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) { + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); + break; + } } } break; @@ -705,7 +718,7 @@ public class BBInputSetup implements JavaDelegate { } } ServiceInstance serviceInstance = this.getALaCarteServiceInstance(service, requestDetails, customer, - project, owningEntity, lookupKeyMap, resourceId, executeBB.isaLaCarte(), + project, owningEntity, lookupKeyMap, resourceId, Boolean.TRUE.equals(executeBB.isaLaCarte()), executeBB.getBuildingBlock().getBpmnFlowName()); return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, customer); } else { @@ -877,7 +890,7 @@ public class BBInputSetup implements JavaDelegate { if (bbName.contains(NETWORK) && !bbName.contains(NETWORK_COLLECTION)) { String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID); ModelInfo networkModelInfo = new ModelInfo(); - if(!executeBB.getBuildingBlock().getIsVirtualLink()) { + if((!Boolean.TRUE.equals(executeBB.getBuildingBlock().getIsVirtualLink()))) { NetworkResourceCustomization networkCust = getNetworkCustomizationByKey(key, service); if (networkCust != null) { networkModelInfo.setModelCustomizationUuid(networkCust.getModelCustomizationUUID()); @@ -888,18 +901,19 @@ public class BBInputSetup implements JavaDelegate { } } else { msoLogger.debug("Orchestrating on Collection Network Resource Customization"); - serviceInstance.getNetworks().add(getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId)); + CollectionNetworkResourceCustomization collectionNetworkResourceCust = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key); + L3Network l3Network = getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId, collectionNetworkResourceCust, serviceInstance); + NetworkResourceCustomization networkResourceCustomization = + mapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust); + if(l3Network != null) { + l3Network.setModelInfoNetwork(mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization)); + } } } else if(bbName.contains("Configuration")) { String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID); ModelInfo configurationModelInfo = new ModelInfo(); configurationModelInfo.setModelCustomizationUuid(key); - ConfigurationResourceCustomization configurationCust = findConfigurationResourceCustomization(configurationModelInfo, service); - if(configurationCust != null) { - this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null); - } else { - msoLogger.debug("Could not find a configuration customization with key: " + key); - } + this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null, executeBB.getConfigurationResourceKeys()); } if (executeBB.getWorkflowResourceIds() != null) { this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance, @@ -909,15 +923,20 @@ public class BBInputSetup implements JavaDelegate { } protected L3Network getVirtualLinkL3Network(Map<ResourceKey, String> lookupKeyMap, String bbName, String key, - String networkId) { - CollectionNetworkResourceCustomization collectionNetworkResourceCust = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key); - if(collectionNetworkResourceCust != null && (bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) + String networkId, CollectionNetworkResourceCustomization collectionNetworkResourceCust, ServiceInstance serviceInstance) { + if(collectionNetworkResourceCust != null) { + if((bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { - NetworkResourceCustomization networkResourceCustomization = - mapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust); - L3Network l3Network = createNetwork(lookupKeyMap, null, networkId, null); - l3Network.setModelInfoNetwork(mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization)); - return l3Network; + L3Network network = createNetwork(lookupKeyMap, null, networkId, null); + serviceInstance.getNetworks().add(network); + return network; + } else { + for (L3Network network : serviceInstance.getNetworks()) { + if (network.getNetworkId().equalsIgnoreCase(networkId)) { + return network; + } + } + } } return null; } @@ -1017,7 +1036,7 @@ public class BBInputSetup implements JavaDelegate { .getModelCustomizationId(); ModelInfo modelInfo = new ModelInfo(); modelInfo.setModelCustomizationUuid(configurationCustUUID); - this.mapCatalogConfiguration(configuration, modelInfo, service); + this.mapCatalogConfiguration(configuration, modelInfo, service, executeBB.getConfigurationResourceKeys()); break; } } @@ -1085,7 +1104,7 @@ public class BBInputSetup implements JavaDelegate { configurationModelInfo.setModelCustomizationUuid(key); ConfigurationResourceCustomization configurationCust = findConfigurationResourceCustomization(configurationModelInfo, service); if(configurationCust != null) { - this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null); + this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null, executeBB.getConfigurationResourceKeys()); } else { msoLogger.debug("Could not find a configuration customization with key: " + key); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index c2161a4fee..877d5bb88f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -76,6 +76,7 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.RequestDetails; @@ -454,11 +455,13 @@ public class BBInputSetupMapperLayer { } protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration( - ConfigurationResourceCustomization configurationResourceCustomization) { + ConfigurationResourceCustomization configurationResourceCustomization, + VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization) { ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); modelInfoConfiguration.setModelVersionId(configurationResourceCustomization.getConfigurationResource().getModelUUID()); modelInfoConfiguration.setModelCustomizationId(configurationResourceCustomization.getModelCustomizationUUID()); modelInfoConfiguration.setModelInvariantId(configurationResourceCustomization.getConfigurationResource().getModelInvariantUUID()); + modelInfoConfiguration.setPolicyName(vnfVfmoduleCvnfcConfigurationCustomization.getPolicyName()); return modelInfoConfiguration; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java index 4b85538428..84ecfc7576 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -45,7 +45,7 @@ import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.db.request.RequestsDbClient; + import org.onap.so.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; @@ -54,6 +54,7 @@ import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.RequestDetails; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java index 9feee14640..8fae2816b2 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java @@ -31,12 +31,13 @@ import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.client.appc.ApplicationControllerSupport.StatusCategory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; - +@Component public class ApplicationControllerAction { protected ApplicationControllerOrchestrator client = new ApplicationControllerOrchestrator(); private String errorCode = "1002"; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java deleted file mode 100644 index 61869ca322..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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.client.db.request; - -import java.io.IOException; -import java.net.URI; - -import org.onap.so.db.request.beans.InfraActiveRequests; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpRequest; -import org.springframework.http.client.ClientHttpRequestExecution; -import org.springframework.http.client.ClientHttpRequestInterceptor; -import org.springframework.http.client.ClientHttpResponse; -import org.springframework.stereotype.Component; -import org.springframework.web.client.RestTemplate; - -import uk.co.blackpepper.bowman.Client; -import uk.co.blackpepper.bowman.ClientFactory; -import uk.co.blackpepper.bowman.Configuration; -import uk.co.blackpepper.bowman.RestTemplateConfigurer; - -@Component("RequestDbClient") -public class RequestsDbClient { - - private Client<InfraActiveRequests> infraActiveRequestClient; - - @Value("${mso.adapters.db.spring.endpoint}") - private String endpoint; - - @Value("${mso.db.auth}") - private String msoAdaptersAuth; - - public RequestsDbClient() { - ClientFactory clientFactory = Configuration.builder().setRestTemplateConfigurer(new RestTemplateConfigurer() { - - public void configure(RestTemplate restTemplate) { - - restTemplate.getInterceptors().add(new ClientHttpRequestInterceptor() { - - public ClientHttpResponse intercept(HttpRequest request, byte[] body, - ClientHttpRequestExecution execution) throws IOException { - - request.getHeaders().add("Authorization", msoAdaptersAuth); - return execution.execute(request, body); - } - }); - } - }).build().buildClientFactory(); - infraActiveRequestClient = clientFactory.create(InfraActiveRequests.class); - - } - - public InfraActiveRequests getInfraActiveRequestbyRequestId(String requestId) { - return this.getSingleInfraActiveRequests(this.getUri(endpoint + "/infraActiveRequests/" + requestId)); - } - - protected InfraActiveRequests getSingleInfraActiveRequests(URI uri) { - return infraActiveRequestClient.get(uri); - } - - public void updateInfraActiveRequests(InfraActiveRequests request) { - infraActiveRequestClient.put(request); - } - - protected URI getUri(String uri) { - return URI.create(uri); - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index c74e81506c..42da72528f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.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. @@ -37,9 +37,9 @@ public class ExceptionBuilder { String msg = "Exception in %s.%s "; try{ msoLogger.error(exception); - + String errorVariable = "Error%s%s"; - + StackTraceElement[] trace = Thread.currentThread().getStackTrace(); for (StackTraceElement traceElement : trace) { if (!traceElement.getClassName().equals(this.getClass().getName()) && !traceElement.getClassName().equals(Thread.class.getName())) { @@ -49,7 +49,7 @@ public class ExceptionBuilder { break; } } - + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, msg.toString()); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex){ diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java new file mode 100644 index 0000000000..64283d78ca --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. 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.openecomp.mso.bpmn.common.workflow.service; + +import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; + +/** + * Exception thrown when an error occurs while processing the workflow. + * This encapsulates the workflow response so that the same can be sent back to api handler. + */ +public class WorkflowProcessorException extends RuntimeException { + WorkflowResponse workflowResponse; + + public WorkflowProcessorException(WorkflowResponse workflowResponse) { + this.workflowResponse = workflowResponse; + } + + public WorkflowResponse getWorkflowResponse() { + return workflowResponse; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn index 31a981729b..67bd961844 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="CompleteMsoProcess" name="CompleteMsoProcess" isExecutable="true"> <bpmn2:scriptTask id="preProcessRequest" name="Pre-Process Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_18</bpmn2:incoming> @@ -101,6 +101,7 @@ buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB stat <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> <camunda:in variables="all" /> <camunda:out variables="all" /> + <camunda:in businessKey="#{execution.processBusinessKey}" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_81</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_13qdn1s</bpmn2:outgoing> |