+This is the adapter for VFC
\ No newline at end of file
String vnfHostIpAddress = execution.getVariable('vnfHostIpAddress')
String vmIdList = execution.getVariable("vmIdList")
String identityUrl = execution.getVariable("identityUrl")
- String controllerType = execution.getVariable("controllerType")
+ String controllerType = execution.getVariable("controllerType")
+ String vfModuleId = execution.getVariable("vfModuleId")
HashMap<String, String> payloadInfo = new HashMap<String, String>();
payloadInfo.put("vnfName", vnfName)
payloadInfo.put("aicIdentity", aicIdentity)
payloadInfo.put("vnfHostIpAddress", vnfHostIpAddress)
payloadInfo.put("vmIdList", vmIdList)
payloadInfo.put("identityUrl", identityUrl)
+ payloadInfo.put("vfModuleId",vfModuleId)
Optional<String> payload
logDebug("Running APP-C action: " + action.toString(), isDebugLogEnabled)
utils.log("DEBUG", "VNFID: " + vnfId, isDebugLogEnabled)
return value;
}
- @JsonProperty("type")
+ @JsonProperty("value")
public void setValue(String value) {
this.value = value;
}
requestIdInput.setValue(requestId);\r
requestActionInput.setValue(requestAction);\r
serviceInstanceIdInput.setValue(serviceInstanceId);\r
+ serviceTypeInput.setValue(serviceType);\r
recipeParamsInput.setValue(recipeParams);\r
resourceInput.setValue(requestDetails);\r
recipeRequest.setHost(host);\r
recipeRequest.setServiceInstanceId(serviceInstanceIdInput);\r
recipeRequest.setServiceType(serviceTypeInput);\r
recipeRequest.setRecipeParams(recipeParamsInput);\r
+ recipeRequest.setResourceInput(resourceInput);\r
jsonReq = recipeRequest.toString();\r
msoLogger.debug("request body is " + jsonReq);\r
} catch(Exception e) {\r
public static String CUSTOMIZATION_UUID = "customizationUUID";
- public static String SERVICE_URL_TOSCA_CSAR = "http://localhost:8080/ecomp/mso/catalog/v3/serviceToscaCsar?serviceModelUuid=";
+ public static String SERVICE_URL_TOSCA_CSAR = "http://mso:8080/ecomp/mso/catalog/v3/serviceToscaCsar?serviceModelUuid=";
private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
* "requestInputs":{K,V}
* }
* <br>
- *
+ *
+ * @param execution Execution context
* @param serviceUuid The service template uuid
- * @param resourceucstomizationUuid The resource customization uuid
+ * @param resourceCustomizationUuid The resource customization uuid
* @param serviceParameters the service parameters passed from the API
* @return the resource instantiate parameters
* @since ONAP Beijing Release
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. \r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.bpmn.appc.payload;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+\r
+import java.util.Optional;\r
+\r
+import org.json.JSONObject;\r
+import org.junit.Test;\r
+\r
+public class PayloadClientTest {\r
+\r
+ @Test\r
+ public void upgradeFormatTest() throws Exception {\r
+ String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"existing-software-version\":\"existingVersion\",\"new-software-version\":\"newVersion\"}}";\r
+ JSONObject jsonObject = new JSONObject();\r
+ jsonObject.put("existing-software-version", "existingVersion");\r
+ jsonObject.put("new-software-version", "newVersion");\r
+ Optional<String> payload = Optional.of(jsonObject.toString());\r
+ Optional<String> payloadClient = PayloadClient.upgradeFormat(payload, "vnfName1"); \r
+ assertEquals(payloadResult, payloadClient.get());\r
+ }\r
+\r
+ @Test\r
+ public void resumeTrafficFormatTest() throws Exception {\r
+ String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\"}}";\r
+ Optional<String> payloadClient = PayloadClient.resumeTrafficFormat("vnfName1"); \r
+ assertEquals(payloadResult, payloadClient.get());\r
+ } \r
+ \r
+ @Test\r
+ public void quiesceTrafficFormatTest() throws Exception {\r
+ String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"operations_timeout\":\"operationTimeout\"}}";\r
+ JSONObject jsonObject = new JSONObject();\r
+ jsonObject.put("operations-timeout", "operationTimeout");\r
+ Optional<String> payload = Optional.of(jsonObject.toString());\r
+ Optional<String> payloadClient = PayloadClient.quiesceTrafficFormat(payload, "vnfName1"); \r
+ assertEquals(payloadResult, payloadClient.get());\r
+ } \r
+ \r
+ @Test\r
+ public void startStopFormatTest() throws Exception {\r
+ String payloadResult = "{\" AICIdentity \":\"aicIdentity1\"}";\r
+ Optional<String> payloadClient = PayloadClient.startStopFormat("aicIdentity1"); \r
+ assertEquals(payloadResult, payloadClient.get());\r
+ } \r
+ \r
+ @Test\r
+ public void healthCheckFormatTest() throws Exception {\r
+ String payloadResult = "{\"request-parameters\":{\"vnf-name\":\"vnfName1\"},\"configuration-parameters\":{\"vnf_name\":\"vnfName1\"}}";\r
+ Optional<String> payloadClient = PayloadClient.healthCheckFormat("vnfName1", "vnfHostIpAddress1"); \r
+ assertEquals(payloadResult, payloadClient.get());\r
+ } \r
+ \r
+ @Test\r
+ public void snapshotFormatTest() throws Exception {\r
+ String payloadResult = "{\"vm-id\":\"vmId1\",\"identity-url\":\"identityUrl1\"}";\r
+ Optional<String> payloadClient = PayloadClient.snapshotFormat("vmId1", "identityUrl1"); \r
+ assertEquals(payloadResult, payloadClient.get());\r
+ } \r
+ \r
+}
\ No newline at end of file
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. \r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.bpmn.common.util;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+\r
+import org.junit.Test;\r
+\r
+public class CryptoHandlerTest {\r
+\r
+ @Test\r
+ public void test() throws Exception {\r
+ String plainPswd = "mso0206";\r
+ String encryptPwd = "C1FC4A39E16419DD41DFC1212843F440";\r
+ CryptoHandler cryptoHandler = new CryptoHandler();\r
+ String aaiPassword = cryptoHandler.getMsoAaiPassword();\r
+ assertEquals(plainPswd, aaiPassword);\r
+ String encryptPassword = cryptoHandler.encryptMsoPassword(plainPswd);\r
+ assertEquals(encryptPwd, encryptPassword);\r
+ String decryptPassword = cryptoHandler.decryptMsoPassword(encryptPwd);\r
+ assertEquals(plainPswd, decryptPassword);\r
+ }\r
+\r
+}
\ No newline at end of file
--- /dev/null
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+package org.openecomp.mso.bpmn.core.domain;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+public class CompareModelsResultTest {\r
+ \r
+ private CompareModelsResult modelsResult;\r
+ private List<ResourceModelInfo> addedResourceList;\r
+ private List<ResourceModelInfo> deletedResourceList;\r
+ private ResourceModelInfo resourceModelInfo1;\r
+ private ResourceModelInfo resourceModelInfo2;\r
+ private List<String> requestInputs;\r
+ \r
+ @Before\r
+ public void before() {\r
+ resourceModelInfo1 = new ResourceModelInfo();\r
+ resourceModelInfo1.setResourceCustomizationUuid("f1d563e8-e714-4393-8f99-cc480144a05e");\r
+ resourceModelInfo1.setResourceInvariantUuid("e1d563e8-e714-4393-8f99-cc480144a05f");\r
+ resourceModelInfo1.setResourceName("resourceName1");\r
+ resourceModelInfo1.setResourceUuid("f1d563e8-e714-4393-8f99-cc480144a05g");\r
+ resourceModelInfo2 = new ResourceModelInfo();\r
+ resourceModelInfo2.setResourceCustomizationUuid("a1d563e8-e714-4393-8f99-cc480144a05d");\r
+ resourceModelInfo2.setResourceInvariantUuid("b1d563e8-e714-4393-8f99-cc480144a05e");\r
+ resourceModelInfo2.setResourceName("resourceName2");\r
+ resourceModelInfo2.setResourceUuid("c1d563e8-e714-4393-8f99-cc480144a05f"); \r
+ }\r
+ \r
+ @Test\r
+ public void testSetAddedResourceList() {\r
+ addedResourceList = new ArrayList<ResourceModelInfo>();\r
+ addedResourceList.add(resourceModelInfo1);\r
+ addedResourceList.add(resourceModelInfo2);\r
+ modelsResult = new CompareModelsResult();\r
+ modelsResult.setAddedResourceList(addedResourceList);\r
+ assertEquals(addedResourceList, modelsResult.getAddedResourceList());\r
+ }\r
+\r
+ @Test\r
+ public void testSetDeletedResourceList() {\r
+ deletedResourceList = new ArrayList<ResourceModelInfo>();\r
+ deletedResourceList.add(resourceModelInfo1);\r
+ deletedResourceList.add(resourceModelInfo2);\r
+ modelsResult = new CompareModelsResult();\r
+ modelsResult.setDeletedResourceList(deletedResourceList);\r
+ assertEquals(deletedResourceList, modelsResult.getDeletedResourceList());\r
+ } \r
+\r
+ @Test\r
+ public void testSetRequestInputs() {\r
+ requestInputs = new ArrayList<String>();\r
+ requestInputs.add("requestInput1");\r
+ requestInputs.add("requestInput2");\r
+ modelsResult = new CompareModelsResult();\r
+ modelsResult.setRequestInputs(requestInputs);\r
+ assertEquals(requestInputs, modelsResult.getRequestInputs());\r
+ } \r
+ \r
+}\r
if (isBlank(serviceInstanceId)) {
msg = "Input serviceInstanceId' is null"
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- }
-
- /*
- * Extracting User Parameters from incoming Request and converting into a Map
- */
- def jsonSlurper = new JsonSlurper()
- def jsonOutput = new JsonOutput()
-
- Map reqMap = jsonSlurper.parseText(siRequest)
-
- //InputParams
- def userParams = reqMap.requestDetails?.requestParameters?.userParams
-
- Map<String, String> inputMap = [:]
- if (userParams) {
- userParams.each {
- userParam -> inputMap.put(userParam.name, userParam.value.toString())
- }
}
- execution.setVariable("operationType", "CompareModel")
- utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled)
- execution.setVariable("serviceInputParams", inputMap)
-
- } catch (BpmnError e) {
- throw e;
+ //subscriberInfo
+ String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId")
+ if (isBlank(globalSubscriberId)) {
+ msg = "Input globalSubscriberId' is null"
+ utils.log("INFO", msg, isDebugEnabled)
+ } else {
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
+ }
+
+ //subscriptionServiceType
+ String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "serviceType")
+ if (isBlank(subscriptionServiceType)) {
+ msg = "Input subscriptionServiceType is null"
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("serviceType", subscriptionServiceType)
+ }
+
+ //modelInvariantIdTarget
+ String modelInvariantIdTarget = jsonUtil.getJsonValue(siRequest, "modelInvariantIdTarget")
+ if (isBlank(modelInvariantIdTarget)) {
+ msg = "Input modelInvariantIdTarget' is null"
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("modelInvariantIdTarget", modelInvariantIdTarget)
+ }
+
+ //modelVersionIdTarget
+ String modelVersionIdTarget = jsonUtil.getJsonValue(siRequest, "modelVersionIdTarget")
+ if (isBlank(modelVersionIdTarget)) {
+ msg = "Input modelVersionIdTarget is null"
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("modelVersionIdTarget", modelVersionIdTarget)
+ }
+
+ execution.setVariable("operationType", "CompareModel")
+
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
utils.log("INFO", msg, isDebugEnabled)
CompareModelsResult compareModelsResult = execution.getVariable("compareModelsResult")
// RESTResponse (for API Handler(APIH) Reply Task)
- String syncResponse = compareModelsResult.toString()
+ String syncResponse = compareModelsResult.toJsonStringNoRootName()
utils.log("INFO", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled)
sendWorkflowResponse(execution, 202, syncResponse)
} catch (Exception ex) {
String msg = "Exception in sendSyncResponse: " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
utils.log("INFO"," ***** Exit sendSyncResopnse *****", isDebugEnabled)
}
Map reqMap = jsonSlurper.parseText(siRequest)\r
\r
//InputParams\r
- def userParams = reqMap.requestDetails?.requestParameters?.userParams\r
+ def userParamsList = reqMap.requestDetails?.requestParameters?.userParams\r
\r
Map<String, String> inputMap = [:]\r
- if (userParams) {\r
- userParams.each {\r
- userParam -> inputMap.put(userParam.name, userParam.value.toString())\r
+ if (userParamsList) {\r
+ for (def i=0; i<userParamsList.size(); i++) {\r
+ def userParams1 = userParamsList.get(i)\r
+ userParams1.each { param -> inputMap.put(param.key, param.value)}\r
}\r
}\r
+\r
\r
- utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled)\r
+ utils.log("DEBUG", "User Input Parameters map: " + inputMap.toString(), isDebugEnabled)\r
execution.setVariable("serviceInputParams", inputMap)\r
+ execution.setVariable("uuiRequest", inputMap.get("UUIRequest"))\r
execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")\r
//TODO\r
//execution.setVariable("serviceInputParams", jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams"))\r
import org.openecomp.mso.bpmn.core.WorkflowException \r
import org.openecomp.mso.bpmn.core.json.JsonUtils \r
import org.openecomp.mso.rest.APIResponse\r
-\r
import java.util.UUID;\r
\r
import org.camunda.bpm.engine.delegate.BpmnError \r
* generate the nsParameters\r
*/\r
public void preProcessRequest (DelegateExecution execution) {\r
+ JsonUtils jsonUtil = new JsonUtils()\r
+\r
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
String msg = ""\r
utils.log("INFO", " *** preProcessRequest() *** ", isDebugEnabled)\r
try {\r
//deal with nsName and Description\r
- String nsServiceName = execution.getVariable("nsServiceName")\r
+ String resourceInput = execution.getVariable("resourceInput")\r
+\r
+ // get service name\r
+ String resourceName = jsonUtil.getJsonValue(resourceInput, "resourceInstanceName")\r
+ String nsServiceName = resourceName.substring(resourceName.indexOf("_") + 1)\r
+ execution.setVariable("nsServiceName", nsServiceName)\r
+\r
String nsServiceDescription = execution.getVariable("nsServiceDescription")\r
utils.log("INFO", "nsServiceName:" + nsServiceName + " nsServiceDescription:" + nsServiceDescription, isDebugEnabled)\r
//deal with operation key\r
- String globalSubscriberId = execution.getVariable("globalSubscriberId")\r
+ String globalSubscriberId = jsonUtil.getJsonValue(resourceInput, "globalSubscriberId")\r
utils.log("INFO", "globalSubscriberId:" + globalSubscriberId, isDebugEnabled)\r
+\r
String serviceType = execution.getVariable("serviceType")\r
utils.log("INFO", "serviceType:" + serviceType, isDebugEnabled)\r
- String serviceId = execution.getVariable("serviceId")\r
+\r
+ String serviceId = execution.getVariable("serviceInstanceId")\r
utils.log("INFO", "serviceId:" + serviceId, isDebugEnabled)\r
- String operationId = execution.getVariable("operationId")\r
+\r
+ String operationId = execution.getVariable("requestId")\r
utils.log("INFO", "serviceType:" + serviceType, isDebugEnabled)\r
- String nodeTemplateUUID = execution.getVariable("resourceUUID")\r
+\r
+ String nodeTemplateUUID = jsonUtil.getJsonValue(resourceInput, "resourceModelInfo.modelCustomizationUuid")\r
utils.log("INFO", "nodeTemplateUUID:" + nodeTemplateUUID, isDebugEnabled)\r
/*\r
* segmentInformation needed as a object of segment\r
* }\r
* }\r
*/\r
- String nsParameters = execution.getVariable("resourceParameters")\r
+ String nsParameters = jsonUtil.getJsonValue(resourceInput, "resourceParameters")\r
utils.log("INFO", "nsParameters:" + nsParameters, isDebugEnabled)\r
String nsOperationKey = """{\r
"globalSubscriberId":"${globalSubscriberId}",\r
String nsParameters = execution.getVariable("nsParameters");\r
String nsServiceName = execution.getVariable("nsServiceName")\r
String nsServiceDescription = execution.getVariable("nsServiceDescription")\r
+ String locationConstraints = jsonUtil.getJsonValue(nsParameters, "locationConstraints")\r
+ String requestInputs = jsonUtil.getJsonValue(nsParameters, "requestInputs")\r
String reqBody ="""{\r
"nsServiceName":"${nsServiceName}",\r
"nsServiceDescription":"${nsServiceDescription}",\r
"nsOperationKey":${nsOperationKey},\r
- "nsParameters":${nsParameters}\r
+ "nsParameters":{\r
+ "locationConstraints":${locationConstraints},\r
+ "additionalParamForNs":${requestInputs}\r
+ }\r
}"""\r
APIResponse apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody)\r
String returnCode = apiResponse.getStatusCode()\r
-/*-
- * ============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.openecomp.mso.bpmn.infrastructure.scripts;
-
-import groovy.json.JsonSlurper
-import groovy.json.JsonOutput
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.apache.commons.lang3.*
-import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor;
-import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil;
-import org.openecomp.mso.bpmn.common.scripts.NetworkUtils;
-import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils;
-import org.openecomp.mso.bpmn.common.scripts.VidUtils;
-import org.openecomp.mso.bpmn.core.RollbackData
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.bpmn.core.json.JsonUtils
-
-public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
-
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
-
- /**
- * Validates the request message and sets up the workflow.
- * @param execution the execution
- */
- public void preProcessRequest(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.preProcessRequest(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- execution.setVariable("CVFMI_sentSyncResponse", false)
-
- def prefix = 'CVFMI_'
- logDebug('Entered 1' + method, isDebugLogEnabled)
- execution.setVariable('prefix', prefix)
- logDebug('Entered 2' + method, isDebugLogEnabled)
- execution.setVariable("isVidRequest", "false")
-
- logDebug("Set variables", isDebugLogEnabled)
-
- def rollbackData = execution.getVariable("RollbackData")
- if (rollbackData == null) {
- rollbackData = new RollbackData()
- }
- execution.setVariable("RollbackData", rollbackData)
-
- logDebug("Set rollback data", isDebugLogEnabled)
- def incomingRequest = execution.getVariable('bpmnRequest')
-
- utils.log("DEBUG", "Incoming Infra Request: " + incomingRequest, isDebugLogEnabled)
- utils.logAudit("CreateVfModule Infra incoming Request: " + incomingRequest)
-
- setBasicDBAuthHeader(execution, isDebugLogEnabled)
-
- // check if request is xml or json
- try {
- def jsonSlurper = new JsonSlurper()
- def jsonOutput = new JsonOutput()
- Map reqMap = jsonSlurper.parseText(incomingRequest)
- utils.log("DEBUG", " Request is in JSON format.", isDebugLogEnabled)
-
- def serviceInstanceId = execution.getVariable('serviceInstanceId')
- def vnfId = execution.getVariable('vnfId')
-
- execution.setVariable(prefix + 'serviceInstanceId', serviceInstanceId)
- execution.setVariable(prefix+'vnfId', vnfId)
- execution.setVariable("isVidRequest", "true")
-
- def vnfName = ''
- def asdcServiceModelVersion = ''
- def serviceModelInfo = null
- def vnfModelInfo = null
-
- def relatedInstanceList = reqMap.requestDetails?.relatedInstanceList
-
- if (relatedInstanceList != null) {
- relatedInstanceList.each {
- if (it.relatedInstance.modelInfo?.modelType == 'service') {
- asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion
- serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo)
-
- }
- if (it.relatedInstance.modelInfo.modelType == 'vnf') {
- vnfName = it.relatedInstance.instanceName ?: ''
- vnfModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo)
- }
- }
- }
-
- execution.setVariable(prefix + 'vnfName', vnfName)
- execution.setVariable(prefix + 'asdcServiceModelVersion', asdcServiceModelVersion)
- execution.setVariable(prefix + 'serviceModelInfo', serviceModelInfo)
- execution.setVariable(prefix + 'vnfModelInfo', vnfModelInfo)
-
-
- def vnfType = execution.getVariable('vnfType')
- execution.setVariable(prefix + 'vnfType', vnfType)
- def vfModuleId = execution.getVariable('vfModuleId')
- execution.setVariable(prefix + 'vfModuleId', vfModuleId)
- def volumeGroupId = execution.getVariable('volumeGroupId')
- execution.setVariable(prefix + 'volumeGroupId', volumeGroupId)
- def userParams = reqMap.requestDetails?.requestParameters?.userParams
-
- Map<String, String> userParamsMap = [:]
- if (userParams != null) {
- userParams.each { userParam ->
- userParamsMap.put(userParam.name, jsonOutput.toJson(userParam.value).toString())
- }
- }
-
- utils.log("DEBUG", 'Processed user params: ' + userParamsMap, isDebugLogEnabled)
-
- execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap)
-
- def isBaseVfModule = "false"
- if (execution.getVariable('isBaseVfModule') == true) {
- isBaseVfModule = "true"
- }
-
- execution.setVariable(prefix + 'isBaseVfModule', isBaseVfModule)
-
- def requestId = execution.getVariable("mso-request-id")
- execution.setVariable(prefix + 'requestId', requestId)
-
- def vfModuleModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo)
- execution.setVariable(prefix + 'vfModuleModelInfo', vfModuleModelInfo)
-
- def suppressRollback = reqMap.requestDetails?.requestInfo?.suppressRollback
-
-
- def backoutOnFailure = ""
- if(suppressRollback != null){
- if ( suppressRollback == true) {
- backoutOnFailure = "false"
- } else if ( suppressRollback == false) {
- backoutOnFailure = "true"
- }
- }
-
- execution.setVariable('disableRollback', suppressRollback)
-
- def vfModuleName = reqMap.requestDetails?.requestInfo?.instanceName ?: null
- execution.setVariable(prefix + 'vfModuleName', vfModuleName)
-
- def serviceId = reqMap.requestDetails?.requestParameters?.serviceId ?: ''
- execution.setVariable(prefix + 'serviceId', serviceId)
-
- def usePreload = reqMap.requestDetails?.requestParameters?.usePreload
- execution.setVariable(prefix + 'usePreload', usePreload)
-
- // This is aLaCarte flow, so aLaCarte flag is always on
- execution.setVariable(prefix + 'aLaCarte', true)
-
- def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration
- def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId
- execution.setVariable(prefix + 'lcpCloudRegionId', lcpCloudRegionId)
- def tenantId = cloudConfiguration.tenantId
- execution.setVariable(prefix + 'tenantId', tenantId)
-
- def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: ''
- execution.setVariable(prefix + 'globalSubscriberId', globalSubscriberId)
-
- execution.setVariable(prefix + 'sdncVersion', '1702')
-
- execution.setVariable("CreateVfModuleInfraSuccessIndicator", false)
- execution.setVariable("RollbackCompleted", false)
-
- execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
-
-
- def source = reqMap.requestDetails?.requestInfo?.source
- execution.setVariable("CVFMI_source", source)
-
- //For Completion Handler & Fallout Handler
- String requestInfo =
- """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
- <request-id>${requestId}</request-id>
- <action>CREATE</action>
- <source>${source}</source>
- </request-info>"""
-
- execution.setVariable("CVFMI_requestInfo", requestInfo)
-
- //backoutOnFailure
-
- execution.setVariable("CVFMI_originalWorkflowException", null)
-
-
- def newVfModuleId = UUID.randomUUID().toString()
- execution.setVariable("newVfModuleId", newVfModuleId)
- execution.setVariable(prefix + 'vfModuleId', newVfModuleId)
-
- logDebug('RequestInfo: ' + execution.getVariable("CVFMI_requestInfo"), isDebugLogEnabled)
-
- logDebug('rollbackEnabled: ' + execution.getVariable("CVFMI_rollbackEnabled"), isDebugLogEnabled)
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError bpmnError) {
- throw bpmnError
- }
- catch(groovy.json.JsonException je) {
- utils.log("DEBUG", " Request is not in JSON format.", isDebugLogEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest")
- }
- catch(Exception e) {
- String restFaultMessage = e.getMessage()
- //execution.setVariable("CVFMODVOL2_RESTFault", restFaultMessage)
- //execution.setVariable("CVFMODVOL2_isDataOk", false)
- utils.log("ERROR", " Exception Encountered - " + "\n" + restFaultMessage, isDebugLogEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest")
- }
-
- }
-
- /**
- * Validates a workflow response.
- * @param execution the execution
- * @param responseVar the execution variable in which the response is stored
- * @param responseCodeVar the execution variable in which the response code is stored
- * @param errorResponseVar the execution variable in which the error response is stored
- */
- public void validateWorkflowResponse(DelegateExecution execution, String responseVar,
- String responseCodeVar, String errorResponseVar) {
- SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
- sdncAdapterUtils.validateSDNCResponse(execution, responseVar, responseCodeVar, errorResponseVar)
- }
-
-
- /**
- * Sends the empty, synchronous response back to the API Handler.
- * @param execution the execution
- */
- public void sendResponse(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.sendResponse(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def requestInfo = execution.getVariable('CVFMI_requestInfo')
- def requestId = execution.getVariable('CVFMI_requestId')
- def source = execution.getVariable('CVFMI_source')
-
- // RESTResponse (for API Handler (APIH) Reply Task)
- def newVfModuleId = execution.getVariable("newVfModuleId")
- String synchResponse = """{"requestReferences":{"instanceId":"${newVfModuleId}","requestId":"${requestId}"}}""".trim()
-
- sendWorkflowResponse(execution, 200, synchResponse)
-
- execution.setVariable("CVFMI_sentSyncResponse", true)
- utils.logAudit("CreateVfModule Infra Response: " + synchResponse)
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
- }
- }
-
- /**
- *
- * @param execution the execution
- */
- public void postProcessResponse(DelegateExecution execution){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
-
- utils.log("DEBUG", " ======== STARTED PostProcessResponse Process ======== ", isDebugEnabled)
- try{
- def requestInfo = execution.getVariable("CVFMI_requestInfo")
- def action = utils.getNodeText1(requestInfo, "action")
-
- utils.log("DEBUG", "requestInfo is: " + requestInfo, isDebugEnabled)
- utils.log("DEBUG", "action is: " + action, isDebugEnabled)
-
- String payload =
- """ <aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:ns="http://org.openecomp/mso/request/types/v1"
- xmlns:ns8="http://org.openecomp/mso/workflow/schema/v1">
- <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
- ${requestInfo}
- </request-info>
- <ns8:status-message>Vf Module has been created successfully.</ns8:status-message>
- <ns8:mso-bpel-name>BPMN</ns8:mso-bpel-name>
- </aetgt:MsoCompletionRequest>"""
-
- payload = utils.formatXml(payload)
- execution.setVariable("CVFMI_SuccessFlag", true)
- execution.setVariable("CVFMI_msoCompletionRequest", payload)
- utils.logAudit("CreateVfModuleInfra completion request: " + payload)
- utils.log("DEBUG", "Outgoing MsoCompletionRequest: \n" + payload, isDebugEnabled)
-
- }catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing PostProcessResponse. Exception is:\n" + e, isDebugEnabled)
- execution.setVariable("CVFMI_ErrorResponse", "Error Occured during PostProcessResponse Method:\n" + e.getMessage())
- }
- utils.log("DEBUG", "======== COMPLETED PostProcessResponse Process ======== ", isDebugEnabled)
- }
-
-
-
-
-
- /**
- * Validates the request, request id and service instance id. If a problem is found,
- * a WorkflowException is generated and an MSOWorkflowException event is thrown. This
- * method also sets up the log context for the workflow.
- * @param execution the execution
- * @return the validated request
- */
- public String validateInfraRequest(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.validateInfraRequest(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- String processKey = getProcessKey(execution);
- def prefix = execution.getVariable("prefix")
-
- if (prefix == null) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " prefix is null")
- }
-
- try {
- def request = execution.getVariable(prefix + 'Request')
-
- if (request == null) {
- request = execution.getVariable(processKey + 'Request')
-
- if (request == null) {
- request = execution.getVariable('bpmnRequest')
- }
-
- setVariable(execution, processKey + 'Request', null);
- setVariable(execution, 'bpmnRequest', null);
- setVariable(execution, prefix + 'Request', request);
- }
-
- if (request == null) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null")
- }
-
- /*
-
- def requestId = execution.getVariable("mso-request-id")
-
- if (requestId == null) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request has no mso-request-id")
- }
-
- setVariable(execution, prefix + 'requestId', requestId)
-
- def serviceInstanceId = execution.getVariable("mso-service-instance-id")
-
- if (serviceInstanceId == null) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request message has no mso-service-instance-id")
- }
-
- utils.logContext(requestId, serviceInstanceId)
- */
- utils.logAudit("CreateVfModule incoming request: " + request)
- logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled)
- logDebug('Exited ' + method, isDebugLogEnabled)
- return request
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
- }
- }
-
- public void prepareUpdateInfraRequest(DelegateExecution execution){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
-
- utils.log("DEBUG", " ======== STARTED prepareUpdateInfraRequest Process ======== ", isDebugEnabled)
- try{
-
-
- String requestInfo = execution.getVariable("CVFMI_requestInfo")
- def aicCloudRegion = execution.getVariable("CVFMI_lcpCloudRegionId")
- def tenantId = execution.getVariable("CVFMI_tenantId")
- def requestId = utils.getNodeText1(requestInfo, "request-id")
- def vnfId = execution.getVariable("CVFMI_vnfId")
- def vfModuleId = execution.getVariable("CVFMI_vfModuleId")
- // vfModuleName may be generated by DoCreateVfModule subprocess if it is not specified on the input
- def vfModuleName = execution.getVariable("CVFMI_vfModuleName")
-
- def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
- execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
- utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
-
- String payload =
- """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:ns="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <ns:updateInfraRequest xmlns:ns="http://org.openecomp.mso/requestsdb">
- <requestId>${requestId}</requestId>
- <lastModifiedBy>BPMN</lastModifiedBy>
- <statusMessage>VF Module successfully created</statusMessage>
- <responseBody></responseBody>
- <requestStatus>COMPLETE</requestStatus>
- <progress>100</progress>
- <vnfOutputs><vnf-outputs xmlns="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:aetgt="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"><vnf-id>${vnfId}</vnf-id><vf-module-id>${vfModuleId}</vf-module-id></vnf-outputs></vnfOutputs>
- <vfModuleId>${vfModuleId}</vfModuleId>
- <vfModuleName>${vfModuleName}</vfModuleName>
- </ns:updateInfraRequest>
- </soapenv:Body>
- </soapenv:Envelope>"""
-
- payload = utils.formatXml(payload)
- execution.setVariable("CVFMI_updateInfraRequest", payload)
- utils.log("DEBUG", "Outgoing UpdateInfraRequest: \n" + payload, isDebugEnabled)
- utils.logAudit("CreateVfModuleInfra Outgoing UpdateInfra Request: " + payload)
-
- }catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing prepareUpdateInfraRequest. Exception is:\n" + e, isDebugEnabled)
- execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateInfraRequest Method:\n" + e.getMessage())
- }
- utils.log("DEBUG", "======== COMPLETED prepareUpdateInfraRequest Process ======== ", isDebugEnabled)
- }
-
- /**
- * Builds a "FalloutHandler" request and stores it in the specified execution variable.
- *
- * @param execution the execution
- * @param resultVar the execution variable in which the result will be stored
- */
- public void falloutHandlerPrep(DelegateExecution execution, String resultVar) {
- def method = getClass().getSimpleName() + '.falloutHandlerPrep(' +
- 'execution=' + execution.getId() +
- ', resultVar=' + resultVar +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
-
- try {
- def WorkflowException workflowException = execution.getVariable("WorkflowException")
- def requestInformation = execution.getVariable("CVFMI_requestInfo")
- def errorResponseCode = workflowException.getErrorCode()
- def errorResponseMsg = workflowException.getErrorMessage()
- def encErrorResponseMsg = ""
- if (errorResponseMsg != null) {
- encErrorResponseMsg = errorResponseMsg.replace("&", "&").replace("<", "<").replace(">", ">")
- }
-
- String content = """
- <aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:reqtype="http://org.openecomp/mso/request/types/v1"
- xmlns:msoservtypes="http://org.openecomp/mso/request/types/v1"
- xmlns:structuredtypes="http://org.openecomp/mso/structured/types/v1">
- ${requestInformation}
- <aetgt:WorkflowException>
- <aetgt:ErrorMessage>${encErrorResponseMsg}</aetgt:ErrorMessage>
- <aetgt:ErrorCode>${errorResponseCode}</aetgt:ErrorCode>
- </aetgt:WorkflowException>
- </aetgt:FalloutHandlerRequest>
- """
-
- logDebug("CONTENT before translation: " + content, isDebugLogEnabled)
- content = utils.formatXml(content)
- logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled)
- utils.logAudit("CreateVfModuleInfra FallOutHander Request: " + content)
- execution.setVariable(resultVar, content)
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')
- }
- }
-
- public void logAndSaveOriginalException(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.validateRollbackResponse(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- logWorkflowException(execution, 'CreateVfModuleInfra caught an event')
- saveWorkflowException(execution, 'CVFMI_originalWorkflowException')
- }
-
- public void validateRollbackResponse(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.validateRollbackResponse(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- def originalException = execution.getVariable("CVFMI_originalWorkflowException")
- execution.setVariable("WorkflowException", originalException)
-
- execution.setVariable("RollbackCompleted", true)
-
- }
-
- public void sendErrorResponse(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
- utils.log("DEBUG", " *** STARTED CreateVfModulenfra sendErrorResponse Process *** ", isDebugEnabled)
- try {
- def sentSyncResponse = execution.getVariable("CVFMI_sentSyncResponse")
- if(sentSyncResponse == false){
- WorkflowException wfex = execution.getVariable("WorkflowException")
- String response = exceptionUtil.buildErrorResponseXml(wfex)
-
- utils.logAudit(response)
- sendWorkflowResponse(execution, 500, response)
- }else{
- utils.log("DEBUG", "Not Sending Error Response. Sync Response Already Sent", isDebugEnabled)
- }
-
- } catch (Exception ex) {
- utils.log("DEBUG", "Error Occured in CreateVfModuleInfra sendErrorResponse Process " + ex.getMessage(), isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVfModuleInfra sendErrorResponse Process")
-
- }
- utils.log("DEBUG", "*** COMPLETED CreateVfModuleInfra sendErrorResponse Process ***", isDebugEnabled)
- }
-
-
-}
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.bpmn.infrastructure.scripts;\r
+\r
+import groovy.json.JsonSlurper\r
+import groovy.json.JsonOutput\r
+\r
+import org.camunda.bpm.engine.delegate.BpmnError\r
+import org.camunda.bpm.engine.delegate.DelegateExecution\r
+import org.onap.appc.client.lcm.model.Action\r
+import org.apache.commons.lang3.*\r
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor;\r
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil;\r
+import org.openecomp.mso.bpmn.common.scripts.NetworkUtils;\r
+import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils;\r
+import org.openecomp.mso.bpmn.common.scripts.VidUtils;\r
+import org.openecomp.mso.bpmn.core.RollbackData\r
+import org.openecomp.mso.bpmn.core.WorkflowException\r
+import org.openecomp.mso.bpmn.core.json.JsonUtils\r
+\r
+public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {\r
+\r
+ ExceptionUtil exceptionUtil = new ExceptionUtil()\r
+ JsonUtils jsonUtil = new JsonUtils()\r
+\r
+ /**\r
+ * Validates the request message and sets up the workflow.\r
+ * @param execution the execution\r
+ */\r
+ public void preProcessRequest(DelegateExecution execution) {\r
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +\r
+ 'execution=' + execution.getId() +\r
+ ')'\r
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
+ logDebug('Entered ' + method, isDebugLogEnabled)\r
+\r
+ execution.setVariable("CVFMI_sentSyncResponse", false)\r
+ \r
+ def prefix = 'CVFMI_'\r
+ logDebug('Entered 1' + method, isDebugLogEnabled)\r
+ execution.setVariable('prefix', prefix)\r
+ logDebug('Entered 2' + method, isDebugLogEnabled)\r
+ execution.setVariable("isVidRequest", "false")\r
+\r
+ logDebug("Set variables", isDebugLogEnabled)\r
+\r
+ def rollbackData = execution.getVariable("RollbackData")\r
+ if (rollbackData == null) {\r
+ rollbackData = new RollbackData()\r
+ }\r
+ execution.setVariable("RollbackData", rollbackData)\r
+\r
+ logDebug("Set rollback data", isDebugLogEnabled)\r
+ def incomingRequest = execution.getVariable('bpmnRequest')\r
+\r
+ utils.log("DEBUG", "Incoming Infra Request: " + incomingRequest, isDebugLogEnabled)\r
+ utils.logAudit("CreateVfModule Infra incoming Request: " + incomingRequest)\r
+\r
+ setBasicDBAuthHeader(execution, isDebugLogEnabled)\r
+ \r
+ // check if request is xml or json\r
+ try {\r
+ def jsonSlurper = new JsonSlurper()\r
+ def jsonOutput = new JsonOutput()\r
+ Map reqMap = jsonSlurper.parseText(incomingRequest)\r
+ utils.log("DEBUG", " Request is in JSON format.", isDebugLogEnabled)\r
+\r
+ def serviceInstanceId = execution.getVariable('serviceInstanceId')\r
+ def vnfId = execution.getVariable('vnfId')\r
+ \r
+ execution.setVariable(prefix + 'serviceInstanceId', serviceInstanceId)\r
+ execution.setVariable(prefix+'vnfId', vnfId)\r
+ execution.setVariable("isVidRequest", "true")\r
+ \r
+ def vnfName = ''\r
+ def asdcServiceModelVersion = ''\r
+ def serviceModelInfo = null\r
+ def vnfModelInfo = null\r
+ \r
+ def relatedInstanceList = reqMap.requestDetails?.relatedInstanceList\r
+ \r
+ if (relatedInstanceList != null) {\r
+ relatedInstanceList.each {\r
+ if (it.relatedInstance.modelInfo?.modelType == 'service') {\r
+ asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion\r
+ serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo)\r
+ \r
+ }\r
+ if (it.relatedInstance.modelInfo.modelType == 'vnf') {\r
+ vnfName = it.relatedInstance.instanceName ?: ''\r
+ vnfModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo)\r
+ }\r
+ }\r
+ }\r
+ \r
+ execution.setVariable(prefix + 'vnfName', vnfName)\r
+ execution.setVariable(prefix + 'asdcServiceModelVersion', asdcServiceModelVersion)\r
+ execution.setVariable(prefix + 'serviceModelInfo', serviceModelInfo)\r
+ execution.setVariable(prefix + 'vnfModelInfo', vnfModelInfo)\r
+ \r
+ \r
+ def vnfType = execution.getVariable('vnfType')\r
+ execution.setVariable(prefix + 'vnfType', vnfType) \r
+ def vfModuleId = execution.getVariable('vfModuleId')\r
+ execution.setVariable(prefix + 'vfModuleId', vfModuleId)\r
+ def volumeGroupId = execution.getVariable('volumeGroupId')\r
+ execution.setVariable(prefix + 'volumeGroupId', volumeGroupId)\r
+ def userParams = reqMap.requestDetails?.requestParameters?.userParams \r
+ \r
+ Map<String, String> userParamsMap = [:]\r
+ if (userParams != null) {\r
+ userParams.each { userParam ->\r
+ userParamsMap.put(userParam.name, jsonOutput.toJson(userParam.value).toString())\r
+ } \r
+ } \r
+ \r
+ utils.log("DEBUG", 'Processed user params: ' + userParamsMap, isDebugLogEnabled) \r
+ \r
+ execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap)\r
+ \r
+ def isBaseVfModule = "false"\r
+ if (execution.getVariable('isBaseVfModule') == true) {\r
+ isBaseVfModule = "true"\r
+ } \r
+ \r
+ execution.setVariable(prefix + 'isBaseVfModule', isBaseVfModule)\r
+ \r
+ def requestId = execution.getVariable("mso-request-id")\r
+ execution.setVariable(prefix + 'requestId', requestId)\r
+ \r
+ def vfModuleModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo)\r
+ execution.setVariable(prefix + 'vfModuleModelInfo', vfModuleModelInfo)\r
+ \r
+ def suppressRollback = reqMap.requestDetails?.requestInfo?.suppressRollback\r
+ \r
+ \r
+ def backoutOnFailure = ""\r
+ if(suppressRollback != null){\r
+ if ( suppressRollback == true) {\r
+ backoutOnFailure = "false"\r
+ } else if ( suppressRollback == false) {\r
+ backoutOnFailure = "true"\r
+ }\r
+ }\r
+ \r
+ execution.setVariable('disableRollback', suppressRollback)\r
+ \r
+ def vfModuleName = reqMap.requestDetails?.requestInfo?.instanceName ?: null\r
+ execution.setVariable(prefix + 'vfModuleName', vfModuleName)\r
+ \r
+ def serviceId = reqMap.requestDetails?.requestParameters?.serviceId ?: ''\r
+ execution.setVariable(prefix + 'serviceId', serviceId)\r
+ \r
+ def usePreload = reqMap.requestDetails?.requestParameters?.usePreload\r
+ execution.setVariable(prefix + 'usePreload', usePreload)\r
+ \r
+ // This is aLaCarte flow, so aLaCarte flag is always on \r
+ execution.setVariable(prefix + 'aLaCarte', true)\r
+ \r
+ def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration\r
+ def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId\r
+ execution.setVariable(prefix + 'lcpCloudRegionId', lcpCloudRegionId)\r
+ def tenantId = cloudConfiguration.tenantId\r
+ execution.setVariable(prefix + 'tenantId', tenantId)\r
+ \r
+ def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: ''\r
+ execution.setVariable(prefix + 'globalSubscriberId', globalSubscriberId)\r
+ \r
+ execution.setVariable(prefix + 'sdncVersion', '1702')\r
+\r
+ execution.setVariable("CreateVfModuleInfraSuccessIndicator", false)\r
+ execution.setVariable("RollbackCompleted", false)\r
+ \r
+ execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)\r
+ \r
+ \r
+ def source = reqMap.requestDetails?.requestInfo?.source\r
+ execution.setVariable("CVFMI_source", source)\r
+ \r
+ //For Completion Handler & Fallout Handler\r
+ String requestInfo =\r
+ """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">\r
+ <request-id>${requestId}</request-id>\r
+ <action>CREATE</action>\r
+ <source>${source}</source>\r
+ </request-info>"""\r
+ \r
+ execution.setVariable("CVFMI_requestInfo", requestInfo)\r
+ \r
+ //backoutOnFailure\r
+ \r
+ execution.setVariable("CVFMI_originalWorkflowException", null)\r
+ \r
+\r
+ def newVfModuleId = UUID.randomUUID().toString()\r
+ execution.setVariable("newVfModuleId", newVfModuleId)\r
+ execution.setVariable(prefix + 'vfModuleId', newVfModuleId)\r
+ execution.setVariable('actionHealthCheck', Action.HealthCheck)\r
+ execution.setVariable('actionConfigScaleOut', Action.ConfigScaleOut)\r
+ def controllerType = execution.getVariable('controllerType')\r
+ execution.setVariable(prefix + 'controllerType', controllerType)\r
+ execution.setVariable('healthCheckIndex0', 0)\r
+\r
+ logDebug('RequestInfo: ' + execution.getVariable("CVFMI_requestInfo"), isDebugLogEnabled) \r
+ \r
+ logDebug('rollbackEnabled: ' + execution.getVariable("CVFMI_rollbackEnabled"), isDebugLogEnabled)\r
+\r
+ logDebug('Exited ' + method, isDebugLogEnabled)\r
+ } catch (BpmnError bpmnError) {\r
+ throw bpmnError\r
+ }\r
+ catch(groovy.json.JsonException je) {\r
+ utils.log("DEBUG", " Request is not in JSON format.", isDebugLogEnabled)\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest")\r
+ }\r
+ catch(Exception e) {\r
+ String restFaultMessage = e.getMessage()\r
+ //execution.setVariable("CVFMODVOL2_RESTFault", restFaultMessage)\r
+ //execution.setVariable("CVFMODVOL2_isDataOk", false)\r
+ utils.log("ERROR", " Exception Encountered - " + "\n" + restFaultMessage, isDebugLogEnabled)\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest")\r
+ }\r
+\r
+ }\r
+\r
+ /**\r
+ * Validates a workflow response.\r
+ * @param execution the execution\r
+ * @param responseVar the execution variable in which the response is stored\r
+ * @param responseCodeVar the execution variable in which the response code is stored\r
+ * @param errorResponseVar the execution variable in which the error response is stored\r
+ */\r
+ public void validateWorkflowResponse(DelegateExecution execution, String responseVar,\r
+ String responseCodeVar, String errorResponseVar) {\r
+ SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)\r
+ sdncAdapterUtils.validateSDNCResponse(execution, responseVar, responseCodeVar, errorResponseVar)\r
+ }\r
+\r
+\r
+ /**\r
+ * Sends the empty, synchronous response back to the API Handler.\r
+ * @param execution the execution\r
+ */\r
+ public void sendResponse(DelegateExecution execution) {\r
+ def method = getClass().getSimpleName() + '.sendResponse(' +\r
+ 'execution=' + execution.getId() +\r
+ ')'\r
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
+ logDebug('Entered ' + method, isDebugLogEnabled)\r
+\r
+ try {\r
+ def requestInfo = execution.getVariable('CVFMI_requestInfo')\r
+ def requestId = execution.getVariable('CVFMI_requestId')\r
+ def source = execution.getVariable('CVFMI_source') \r
+ \r
+ // RESTResponse (for API Handler (APIH) Reply Task)\r
+ def newVfModuleId = execution.getVariable("newVfModuleId")\r
+ String synchResponse = """{"requestReferences":{"instanceId":"${newVfModuleId}","requestId":"${requestId}"}}""".trim()\r
+\r
+ sendWorkflowResponse(execution, 200, synchResponse)\r
+\r
+ execution.setVariable("CVFMI_sentSyncResponse", true)\r
+ utils.logAudit("CreateVfModule Infra Response: " + synchResponse)\r
+ logDebug('Exited ' + method, isDebugLogEnabled)\r
+ } catch (BpmnError e) {\r
+ throw e;\r
+ } catch (Exception e) {\r
+ logError('Caught exception in ' + method, e)\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())\r
+ }\r
+ }\r
+\r
+ /**\r
+ *\r
+ * @param execution the execution\r
+ */\r
+ public void postProcessResponse(DelegateExecution execution){\r
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
+\r
+ utils.log("DEBUG", " ======== STARTED PostProcessResponse Process ======== ", isDebugEnabled)\r
+ try{ \r
+ def requestInfo = execution.getVariable("CVFMI_requestInfo")\r
+ def action = utils.getNodeText1(requestInfo, "action")\r
+\r
+ utils.log("DEBUG", "requestInfo is: " + requestInfo, isDebugEnabled)\r
+ utils.log("DEBUG", "action is: " + action, isDebugEnabled)\r
+\r
+ String payload =\r
+ """ <aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"\r
+ xmlns:ns="http://org.openecomp/mso/request/types/v1"\r
+ xmlns:ns8="http://org.openecomp/mso/workflow/schema/v1">\r
+ <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">\r
+ ${requestInfo}\r
+ </request-info>\r
+ <ns8:status-message>Vf Module has been created successfully.</ns8:status-message>\r
+ <ns8:mso-bpel-name>BPMN</ns8:mso-bpel-name>\r
+ </aetgt:MsoCompletionRequest>"""\r
+\r
+ payload = utils.formatXml(payload)\r
+ execution.setVariable("CVFMI_SuccessFlag", true)\r
+ execution.setVariable("CVFMI_msoCompletionRequest", payload)\r
+ utils.logAudit("CreateVfModuleInfra completion request: " + payload)\r
+ utils.log("DEBUG", "Outgoing MsoCompletionRequest: \n" + payload, isDebugEnabled)\r
+\r
+ }catch(Exception e){\r
+ utils.log("ERROR", "Exception Occured Processing PostProcessResponse. Exception is:\n" + e, isDebugEnabled)\r
+ execution.setVariable("CVFMI_ErrorResponse", "Error Occured during PostProcessResponse Method:\n" + e.getMessage())\r
+ }\r
+ utils.log("DEBUG", "======== COMPLETED PostProcessResponse Process ======== ", isDebugEnabled)\r
+ }\r
+\r
+\r
+\r
+\r
+\r
+ /**\r
+ * Validates the request, request id and service instance id. If a problem is found,\r
+ * a WorkflowException is generated and an MSOWorkflowException event is thrown. This\r
+ * method also sets up the log context for the workflow.\r
+ * @param execution the execution\r
+ * @return the validated request\r
+ */\r
+ public String validateInfraRequest(DelegateExecution execution) {\r
+ def method = getClass().getSimpleName() + '.validateInfraRequest(' +\r
+ 'execution=' + execution.getId() +\r
+ ')'\r
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
+ logDebug('Entered ' + method, isDebugLogEnabled)\r
+\r
+ String processKey = getProcessKey(execution);\r
+ def prefix = execution.getVariable("prefix")\r
+\r
+ if (prefix == null) {\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " prefix is null")\r
+ }\r
+\r
+ try {\r
+ def request = execution.getVariable(prefix + 'Request')\r
+\r
+ if (request == null) {\r
+ request = execution.getVariable(processKey + 'Request')\r
+\r
+ if (request == null) {\r
+ request = execution.getVariable('bpmnRequest')\r
+ }\r
+\r
+ setVariable(execution, processKey + 'Request', null);\r
+ setVariable(execution, 'bpmnRequest', null);\r
+ setVariable(execution, prefix + 'Request', request);\r
+ }\r
+\r
+ if (request == null) {\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null")\r
+ }\r
+\r
+ /*\r
+\r
+ def requestId = execution.getVariable("mso-request-id")\r
+\r
+ if (requestId == null) {\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request has no mso-request-id")\r
+ }\r
+\r
+ setVariable(execution, prefix + 'requestId', requestId)\r
+\r
+ def serviceInstanceId = execution.getVariable("mso-service-instance-id")\r
+\r
+ if (serviceInstanceId == null) {\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request message has no mso-service-instance-id")\r
+ }\r
+\r
+ utils.logContext(requestId, serviceInstanceId)\r
+ */\r
+ utils.logAudit("CreateVfModule incoming request: " + request)\r
+ logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled)\r
+ logDebug('Exited ' + method, isDebugLogEnabled)\r
+ return request\r
+ } catch (BpmnError e) {\r
+ throw e;\r
+ } catch (Exception e) {\r
+ logError('Caught exception in ' + method, e)\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")\r
+ }\r
+ }\r
+\r
+ public void prepareUpdateInfraRequest(DelegateExecution execution){\r
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
+\r
+ utils.log("DEBUG", " ======== STARTED prepareUpdateInfraRequest Process ======== ", isDebugEnabled)\r
+ try{\r
+ \r
+ \r
+ String requestInfo = execution.getVariable("CVFMI_requestInfo") \r
+ def aicCloudRegion = execution.getVariable("CVFMI_lcpCloudRegionId")\r
+ def tenantId = execution.getVariable("CVFMI_tenantId")\r
+ def requestId = utils.getNodeText1(requestInfo, "request-id")\r
+ def vnfId = execution.getVariable("CVFMI_vnfId")\r
+ def vfModuleId = execution.getVariable("CVFMI_vfModuleId")\r
+ // vfModuleName may be generated by DoCreateVfModule subprocess if it is not specified on the input\r
+ def vfModuleName = execution.getVariable("CVFMI_vfModuleName")\r
+\r
+ def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")\r
+ execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)\r
+ utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)\r
+\r
+ String payload =\r
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\r
+ xmlns:ns="http://org.openecomp.mso/requestsdb">\r
+ <soapenv:Header/>\r
+ <soapenv:Body>\r
+ <ns:updateInfraRequest xmlns:ns="http://org.openecomp.mso/requestsdb">\r
+ <requestId>${requestId}</requestId>\r
+ <lastModifiedBy>BPMN</lastModifiedBy>\r
+ <statusMessage>VF Module successfully created</statusMessage>\r
+ <responseBody></responseBody>\r
+ <requestStatus>COMPLETE</requestStatus>\r
+ <progress>100</progress>\r
+ <vnfOutputs><vnf-outputs xmlns="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:aetgt="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"><vnf-id>${vnfId}</vnf-id><vf-module-id>${vfModuleId}</vf-module-id></vnf-outputs></vnfOutputs>\r
+ <vfModuleId>${vfModuleId}</vfModuleId>\r
+ <vfModuleName>${vfModuleName}</vfModuleName>\r
+ </ns:updateInfraRequest>\r
+ </soapenv:Body>\r
+ </soapenv:Envelope>"""\r
+\r
+ payload = utils.formatXml(payload)\r
+ execution.setVariable("CVFMI_updateInfraRequest", payload)\r
+ utils.log("DEBUG", "Outgoing UpdateInfraRequest: \n" + payload, isDebugEnabled)\r
+ utils.logAudit("CreateVfModuleInfra Outgoing UpdateInfra Request: " + payload)\r
+\r
+ }catch(Exception e){\r
+ utils.log("ERROR", "Exception Occured Processing prepareUpdateInfraRequest. Exception is:\n" + e, isDebugEnabled)\r
+ execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateInfraRequest Method:\n" + e.getMessage())\r
+ }\r
+ utils.log("DEBUG", "======== COMPLETED prepareUpdateInfraRequest Process ======== ", isDebugEnabled)\r
+ }\r
+\r
+ /**\r
+ * Builds a "FalloutHandler" request and stores it in the specified execution variable.\r
+ *\r
+ * @param execution the execution\r
+ * @param resultVar the execution variable in which the result will be stored\r
+ */\r
+ public void falloutHandlerPrep(DelegateExecution execution, String resultVar) {\r
+ def method = getClass().getSimpleName() + '.falloutHandlerPrep(' +\r
+ 'execution=' + execution.getId() +\r
+ ', resultVar=' + resultVar +\r
+ ')'\r
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
+ logDebug('Entered ' + method, isDebugLogEnabled)\r
+\r
+\r
+ try {\r
+ def WorkflowException workflowException = execution.getVariable("WorkflowException") \r
+ def requestInformation = execution.getVariable("CVFMI_requestInfo")\r
+ def errorResponseCode = workflowException.getErrorCode()\r
+ def errorResponseMsg = workflowException.getErrorMessage()\r
+ def encErrorResponseMsg = ""\r
+ if (errorResponseMsg != null) {\r
+ encErrorResponseMsg = errorResponseMsg.replace("&", "&").replace("<", "<").replace(">", ">")\r
+ }\r
+\r
+ String content = """\r
+ <aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"\r
+ xmlns:reqtype="http://org.openecomp/mso/request/types/v1"\r
+ xmlns:msoservtypes="http://org.openecomp/mso/request/types/v1"\r
+ xmlns:structuredtypes="http://org.openecomp/mso/structured/types/v1">\r
+ ${requestInformation}\r
+ <aetgt:WorkflowException>\r
+ <aetgt:ErrorMessage>${encErrorResponseMsg}</aetgt:ErrorMessage>\r
+ <aetgt:ErrorCode>${errorResponseCode}</aetgt:ErrorCode>\r
+ </aetgt:WorkflowException>\r
+ </aetgt:FalloutHandlerRequest>\r
+ """\r
+\r
+ logDebug("CONTENT before translation: " + content, isDebugLogEnabled)\r
+ content = utils.formatXml(content)\r
+ logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled)\r
+ utils.logAudit("CreateVfModuleInfra FallOutHander Request: " + content)\r
+ execution.setVariable(resultVar, content)\r
+\r
+ logDebug('Exited ' + method, isDebugLogEnabled)\r
+ } catch (BpmnError e) {\r
+ throw e;\r
+ } catch (Exception e) {\r
+ logError('Caught exception in ' + method, e)\r
+ exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')\r
+ }\r
+ }\r
+\r
+ public void logAndSaveOriginalException(DelegateExecution execution) {\r
+ def method = getClass().getSimpleName() + '.validateRollbackResponse(' +\r
+ 'execution=' + execution.getId() +\r
+ ')'\r
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
+ logDebug('Entered ' + method, isDebugLogEnabled)\r
+\r
+ logWorkflowException(execution, 'CreateVfModuleInfra caught an event')\r
+ saveWorkflowException(execution, 'CVFMI_originalWorkflowException')\r
+ }\r
+\r
+ public void validateRollbackResponse(DelegateExecution execution) {\r
+ def method = getClass().getSimpleName() + '.validateRollbackResponse(' +\r
+ 'execution=' + execution.getId() +\r
+ ')'\r
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
+ logDebug('Entered ' + method, isDebugLogEnabled)\r
+\r
+ def originalException = execution.getVariable("CVFMI_originalWorkflowException")\r
+ execution.setVariable("WorkflowException", originalException)\r
+\r
+ execution.setVariable("RollbackCompleted", true)\r
+\r
+ }\r
+ \r
+ public void sendErrorResponse(DelegateExecution execution){\r
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+\r
+ utils.log("DEBUG", " *** STARTED CreateVfModulenfra sendErrorResponse Process *** ", isDebugEnabled)\r
+ try {\r
+ def sentSyncResponse = execution.getVariable("CVFMI_sentSyncResponse")\r
+ if(sentSyncResponse == false){\r
+ WorkflowException wfex = execution.getVariable("WorkflowException")\r
+ String response = exceptionUtil.buildErrorResponseXml(wfex)\r
+\r
+ utils.logAudit(response)\r
+ sendWorkflowResponse(execution, 500, response)\r
+ }else{\r
+ utils.log("DEBUG", "Not Sending Error Response. Sync Response Already Sent", isDebugEnabled)\r
+ }\r
+\r
+ } catch (Exception ex) {\r
+ utils.log("DEBUG", "Error Occured in CreateVfModuleInfra sendErrorResponse Process " + ex.getMessage(), isDebugEnabled)\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVfModuleInfra sendErrorResponse Process")\r
+\r
+ }\r
+ utils.log("DEBUG", "*** COMPLETED CreateVfModuleInfra sendErrorResponse Process ***", isDebugEnabled)\r
+ }\r
+\r
+\r
+}\r
"modelUuid":"${modelUuid}",\r
"modelVersion":""\r
}"""\r
- execution.setVariable("serviceModelInfo", serviceModelInfo)\r
+ \r
execution.setVariable("serviceModelInfo_Target", serviceModelInfo)\r
\r
utils.log("DEBUG", " ***** Completed prepareDecomposeService_Target of update generic e2e service ***** ", isDebugEnabled)\r
"modelUuid":"${modelUuid}",\r
"modelVersion":""\r
}"""\r
- execution.setVariable("serviceModelInfo", serviceModelInfo)\r
+ \r
execution.setVariable("serviceModelInfo_Original", serviceModelInfo)\r
\r
utils.log("DEBUG", " ***** Completed prepareDecomposeService_Original of update generic e2e service ***** ", isDebugEnabled)\r
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
+import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder
import org.openecomp.mso.bpmn.core.RollbackData
import org.openecomp.mso.bpmn.core.WorkflowException
import org.openecomp.mso.rest.APIResponse;
JsonUtils jsonUtil = new JsonUtils()
public void preProcessRequest (DelegateExecution execution) {
- execution.setVariable("isDebugLogEnabled","true")
def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
utils.log("INFO","Entered " + method, isDebugEnabled)
String msg = ""
- utils.log("INFO"," ***** Enter CompareModelofE2EServiceInstance preProcessRequest *****", isDebugEnabled)
+ utils.log("INFO"," ***** Enter DoCompareModelofE2EServiceInstance preProcessRequest *****", isDebugEnabled)
execution.setVariable("prefix", Prefix)
//Inputs
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
- String modelInvariantUuid = execution.getVariable('modelInvariantIdTarget')
+ String modelInvariantUuid = execution.getVariable("modelInvariantIdTarget")
if (isBlank(modelInvariantUuid)){
msg = "Input modelInvariantUuid is null"
utils.log("INFO", msg, isDebugEnabled)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
- String modelUuid = execution.getVariable('modelVersionIdTarget')
+ String modelUuid = execution.getVariable("modelVersionIdTarget")
if (isBlank(modelUuid)){
msg = "Input modelUuid is null"
utils.log("INFO", msg, isDebugEnabled)
requestInputs.addAll(resourceParameters.keySet())
}
- for(Resource rc : deletedResourceList) {
+ for(Resource rc : delResourceList) {
mi = rc.getModelInfo()
String resourceCustomizationUuid = mi.getModelCustomizationUuid()
ResourceModelInfo rmodel = new ResourceModelInfo()
String serviceInstanceName = execution.getVariable("serviceInstanceName")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
String uuiRequest = execution.getVariable("uuiRequest")
- String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceDefId")
- String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.templateId")
+ String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid")
+ String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid")
String serviceModelName = jsonUtil.getJsonValue(uuiRequest, "service.parameters.templateName")
execution.setVariable("serviceModelName", serviceModelName)
//aai serviceType and Role can be setted as fixed value now.
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
try {
- utils.log("DEBUG", " ***** Inside prepareDecomposeService of create generic e2e service ***** ", isDebugEnabled)
+ utils.log("INFO", " ***** Inside prepareDecomposeService of create generic e2e service ***** ", isDebugEnabled)
String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
String modelUuid = execution.getVariable("modelUuid")
//here modelVersion is not set, we use modelUuid to decompose the service.
public void processDecomposition(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", " ***** Inside processDecomposition() of create generic e2e service flow ***** ", isDebugEnabled)
+ utils.log("INFO", " ***** Inside processDecomposition() of create generic e2e service flow ***** ", isDebugEnabled)
try {
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. processDecomposition() - " + ex.getMessage()
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ utils.log("INFO", exceptionMessage, isDebugEnabled)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
}
utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
try{
String serviceId = execution.getVariable("serviceInstanceId")
- String operationId = execution.getVariable("operationId")
+ String operationId = execution.getVariable("msoRequestId")
String operationType = execution.getVariable("operationType")
String resourceTemplateUUIDs = ""
String result = "processing"
def currentIndex = execution.getVariable("currentResourceIndex")
List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
Resource currentResource = sequencedResourceList.get(currentIndex)
+ execution.setVariable("resourceType", currentResource.getModelInfo().getModelName())
utils.log("INFO", "Now we deal with resouce:" + currentResource.getModelInfo().getModelName(), isDebugEnabled)
utils.log("INFO", "======== COMPLETED getCurrentResoure Process ======== ", isDebugEnabled)
}
utils.log("INFO", "======== Start prepareResourceRecipeRequest Process ======== ", isDebugEnabled)
ResourceInput resourceInput = new ResourceInput()
String serviceInstanceName = execution.getVariable("serviceInstanceName")
+ String resourceType = execution.getVariable("resourceType")
String resourceInstanceName = resourceType + "_" + serviceInstanceName
resourceInput.setResourceInstanceName(resourceInstanceName)
utils.log("INFO", "Prepare Resource Request resourceInstanceName:" + resourceInstanceName, isDebugEnabled)
resourceInput.setResourceModelInfo(currentResource.getModelInfo());
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo());
+ def String resourceCustomizationUuid = currentResource.getModelInfo().getModelCustomizationUuid();
String incomingRequest = execution.getVariable("uuiRequest")
//set the requestInputs from tempalte To Be Done
- String serviceModelUuid = execution.getVariable("modelUuid")
- String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters")
+ String serviceModelUuid = jsonUtil.getJsonValue(incomingRequest,"service.serviceUuid")
+ String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters")
String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters)
resourceInput.setResourceParameters(resourceParameters)
execution.setVariable("resourceInput", resourceInput)
String requestAction = resourceInput.getOperationType()
JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceModelInfo().getModelUuid(), requestAction)
String recipeUri = resourceRecipe.getString("orchestrationUri")
- String recipeTimeOut = resourceRecipe.getString("recipeTimeout")
+ int recipeTimeOut = resourceRecipe.getInt("recipeTimeout")
String recipeParamXsd = resourceRecipe.get("paramXSD")
HttpResponse resp = BpmnRestClient.post(recipeUri, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
-
+ utils.log("INFO", "======== end executeResourceRecipe Process ======== ", isDebugEnabled)
}
public void postConfigRequest(DelegateExecution execution){
<camunda:in source="serviceInstanceId" target="serviceInstanceId" />
<camunda:in source="serviceInstanceName" target="serviceInstanceName" />
<camunda:in source="productFamilyId" target="productFamilyId" />
- <camunda:in source="disableRollback" target="disableRollback" />
+ <camunda:in source="modelInvariantIdTarget" target="modelInvariantIdTarget" />
<camunda:in source="uuiRequest" target="uuiRequest" />
<camunda:out source="rolledBack" target="rolledBack" />
- <camunda:out source="serviceInstanceName" target="serviceInstanceName" />
- <camunda:in source="failIfExists" target="failIfExists" />
+ <camunda:out source="compareModelsResult" target="compareModelsResult" />
+ <camunda:in source="modelVersionIdTarget" target="modelVersionIdTarget" />
<camunda:in source="globalSubscriberId" target="globalSubscriberId" />
<camunda:in source="serviceType" target="serviceType" />
<camunda:in source="initialStatus" target="initialStatus" />
<bpmn:sequenceFlow id="SequenceFlow_1dsbjjb" name="" sourceRef="StartEvent_0v1ffn4" targetRef="ScriptTask_0u3lw39" />
<bpmn:sequenceFlow id="SequenceFlow_1yay321" name="" sourceRef="ScriptTask_0u3lw39" targetRef="EndEvent_0eznq6x" />
</bpmn:subProcess>
- <bpmn:callActivity id="DoCreateE2EServiceInstance" name="Call DoCreateE2EServiceInstance " calledElement="DoCreateE2EServiceInstance">
+ <bpmn:callActivity id="DoCreateE2EServiceInstance" name="Call DoCreateE2EServiceInstance " calledElement="DoCreateE2EServiceInstanceV3">
<bpmn:extensionElements>
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="msoRequestId" target="msoRequestId" />
<camunda:in sourceExpression="1610" target="sdncVersion" />
<camunda:in source="initialStatus" target="initialStatus" />
<camunda:in source="serviceType" target="serviceType" />
+ <camunda:in source="uuiRequest" target="uuiRequest" />
+ <camunda:in source="requestAction" target="operationType" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_19eilro</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0klbpxx</bpmn:outgoing>
<?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="_pNTO8MRhEeWv36YLr7PC3Q" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" 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="_pNTO8MRhEeWv36YLr7PC3Q" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="CreateVfModuleInfra" name="CreateVfModuleInfra" isExecutable="true">
<bpmn2:startEvent id="StartEvent_1" name="Start">
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
<camunda:in source="CVFMI_vfModuleInputParams" target="vfModuleInputParams" />
<camunda:in source="CVFMI_aLaCarte" target="aLaCarte" />
</bpmn2:extensionElements>
- <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_1vx081s</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
</bpmn2:callActivity>
<bpmn2:scriptTask id="SendResponse" name="Send Response" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def createVfModule = new CreateVfModuleInfra()
+ <bpmn2:outgoing>SequenceFlow_0e2ta6w</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*\r
+def createVfModule = new CreateVfModuleInfra()\r
createVfModule.sendResponse(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="SendResponse" targetRef="DoCreateVfModuleSubprocess" />
<bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_1" name="To FinishLine">
<bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
<bpmn2:linkEventDefinition id="_LinkEventDefinition_34" name="FinishLine" />
<bpmn2:scriptTask id="PrepareUpdateInfraRequest" name="Prepare Update Infra Request" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def createVfModule = new CreateVfModuleInfra()
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*\r
+def createVfModule = new CreateVfModuleInfra()\r
createVfModule.prepareUpdateInfraRequest(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:serviceTask id="ServiceTask_1" name="Update Infra Request">
</camunda:connector>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_1crl7uf</bpmn2:outgoing>
</bpmn2:serviceTask>
<bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="PrepareUpdateInfraRequest" targetRef="ServiceTask_1" />
- <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="ServiceTask_1" targetRef="UpdateInfraRequestResponseCheck" />
<bpmn2:scriptTask id="PrepareMSOCompletionHandler" name="Prepare MSO Completion Handler" scriptFormat="groovy">
- <bpmn2:incoming>updateInfraRequestResponseGood</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_0td7d9m</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def createVfModule = new CreateVfModuleInfra()
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*\r
+def createVfModule = new CreateVfModuleInfra()\r
createVfModule.postProcessResponse(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="PrepareMSOCompletionHandler" targetRef="MSOCompletionHandler" />
<bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing>
</bpmn2:callActivity>
<bpmn2:exclusiveGateway id="UpdateInfraRequestResponseCheck" name="Success? " default="updateInfraRequestResponseBad">
- <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_1crl7uf</bpmn2:incoming>
<bpmn2:outgoing>updateInfraRequestResponseBad</bpmn2:outgoing>
<bpmn2:outgoing>updateInfraRequestResponseGood</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
<bpmn2:sequenceFlow id="updateInfraRequestResponseBad" name="no" sourceRef="UpdateInfraRequestResponseCheck" targetRef="EndEvent_2" />
- <bpmn2:sequenceFlow id="updateInfraRequestResponseGood" name="yes" sourceRef="UpdateInfraRequestResponseCheck" targetRef="PrepareMSOCompletionHandler">
+ <bpmn2:sequenceFlow id="updateInfraRequestResponseGood" name="yes" sourceRef="UpdateInfraRequestResponseCheck" targetRef="CallActivity_17ukiqm">
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CVFMI_dbResponseCode" ) == '200'}]]></bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
<bpmn2:endEvent id="EndEvent_2">
<bpmn2:scriptTask id="PrepareFalloutHandler" name="Prepare Fallout Handler" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_018p5wf</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def cvfm = new CreateVfModuleInfra()
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*\r
+def cvfm = new CreateVfModuleInfra()\r
cvfm.falloutHandlerPrep(execution, 'CVFMI_FalloutHandlerRequest')]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="PrepareFalloutHandler" targetRef="FalloutHandler" />
<bpmn2:scriptTask id="SendErrorResponse" name="Send Error Response" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_0wsgnab</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_018p5wf</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def createVfModule = new CreateVfModuleInfra()
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*\r
+def createVfModule = new CreateVfModuleInfra()\r
createVfModule.sendErrorResponse(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
</bpmn2:subProcess>
<bpmn2:scriptTask id="PreProcessRequest" name="Pre-Process Request" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def createVfModule = new CreateVfModuleInfra()
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*\r
+def createVfModule = new CreateVfModuleInfra()\r
createVfModule.preProcessRequest(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="PreProcessRequest" targetRef="SendResponse" />
<bpmn2:scriptTask id="ProcessError" name="Process Error" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_1qvgrvq</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_1jqizzo</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-ExceptionUtil exceptionUtil = new ExceptionUtil()
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*\r
+ExceptionUtil exceptionUtil = new ExceptionUtil()\r
exceptionUtil.processJavaException(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:endEvent id="EndEvent_0100eju">
<bpmn2:sequenceFlow id="SequenceFlow_1qvgrvq" name="" sourceRef="StartEvent_1mov8he" targetRef="ProcessError" />
<bpmn2:sequenceFlow id="SequenceFlow_1jqizzo" name="" sourceRef="ProcessError" targetRef="EndEvent_0100eju" />
</bpmn2:subProcess>
+ <bpmn2:callActivity id="CallActivity_0i3men0" name="APP-C Healthcheck" calledElement="AppCClient">
+ <bpmn2:extensionElements>
+ <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+ <camunda:in source="actionHealthCheck" target="action" />
+ <camunda:in source="CVFMI_vnfId" target="vnfId" />
+ <camunda:in source="CVFMI_requestId" target="msoRequestId" />
+ <camunda:in source="CVFMI_vnfName" target="vnfName" />
+ <camunda:in source="CVFMO_controllerType" target="controllerType" />
+ <camunda:in source="healthCheckIndex0" target="healthCheckIndex" />
+ <camunda:out source="errorCode" target="errorCode" />
+ <camunda:out source="errorText" target="errorText" />
+ <camunda:out source="workStep" target="workStep" />
+ <camunda:out source="failedActivity" target="failedActivity" />
+ </bpmn2:extensionElements>
+ <bpmn2:incoming>SequenceFlow_0e2ta6w</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_07llpjo</bpmn2:outgoing>
+ </bpmn2:callActivity>
+ <bpmn2:sequenceFlow id="SequenceFlow_0e2ta6w" sourceRef="SendResponse" targetRef="CallActivity_0i3men0" />
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_09h60ub" name="Error on Pre Health Check?" default="SequenceFlow_1vx081s">
+ <bpmn2:incoming>SequenceFlow_07llpjo</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1vx081s</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_0nszq2o</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_1vx081s" name="no" sourceRef="ExclusiveGateway_09h60ub" targetRef="DoCreateVfModuleSubprocess" />
+ <bpmn2:sequenceFlow id="SequenceFlow_07llpjo" sourceRef="CallActivity_0i3men0" targetRef="ExclusiveGateway_09h60ub" />
+ <bpmn2:endEvent id="EndEvent_0n6bb71">
+ <bpmn2:incoming>SequenceFlow_0nszq2o</bpmn2:incoming>
+ <bpmn2:errorEventDefinition errorRef="Error_1" />
+ </bpmn2:endEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_0nszq2o" name="yes" sourceRef="ExclusiveGateway_09h60ub" targetRef="EndEvent_0n6bb71">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy"><![CDATA[execution.getVariable("errorCode") != "0"]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:callActivity id="CallActivity_17ukiqm" name="APP-C ConfigScaleOut" calledElement="AppCClient">
+ <bpmn2:extensionElements>
+ <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+ <camunda:in source="actionConfigScaleOut" target="action" />
+ <camunda:in source="CVFMI_vnfId" target="vnfId" />
+ <camunda:in source="CVFMI_requestId" target="msoRequestId" />
+ <camunda:in source="CVFMI_vnfName" target="vnfName" />
+ <camunda:in source="CVFMO_controllerType" target="controllerType" />
+ <camunda:in source="healthCheckIndex0" target="healthCheckIndex" />
+ <camunda:out source="errorCode" target="errorConfigScaleOutCode" />
+ <camunda:out source="errorText" target="errorText" />
+ <camunda:out source="workStep" target="workStep" />
+ <camunda:out source="failedActivity" target="failedActivity" />
+ <camunda:in source="CVFMI_vfModuleId" target="vfModuleId" />
+ </bpmn2:extensionElements>
+ <bpmn2:incoming>updateInfraRequestResponseGood</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1tk5ru7</bpmn2:outgoing>
+ </bpmn2:callActivity>
+ <bpmn2:sequenceFlow id="SequenceFlow_1crl7uf" sourceRef="ServiceTask_1" targetRef="UpdateInfraRequestResponseCheck" />
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_1hncvjy" name="Error on ConfigScaleOut?" default="SequenceFlow_0td7d9m">
+ <bpmn2:incoming>SequenceFlow_1tk5ru7</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_0td7d9m</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_0h5cld9</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_1tk5ru7" sourceRef="CallActivity_17ukiqm" targetRef="ExclusiveGateway_1hncvjy" />
+ <bpmn2:sequenceFlow id="SequenceFlow_0td7d9m" name="no" sourceRef="ExclusiveGateway_1hncvjy" targetRef="PrepareMSOCompletionHandler" />
+ <bpmn2:endEvent id="EndEvent_0a97jcr">
+ <bpmn2:incoming>SequenceFlow_0h5cld9</bpmn2:incoming>
+ <bpmn2:errorEventDefinition errorRef="Error_1" />
+ </bpmn2:endEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_0h5cld9" name="yes" sourceRef="ExclusiveGateway_1hncvjy" targetRef="EndEvent_0a97jcr">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy"><![CDATA[execution.getVariable("errorConfigScaleOutCode") != "0"]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
</bpmn2:process>
<bpmn2:error id="Error_1" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmn2:error id="Error_2" name="REST Fault" errorCode="RESTFault" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_50" targetElement="_BPMNShape_ScriptTask_124">
<di:waypoint xsi:type="dc:Point" x="77" y="249" />
- <di:waypoint xsi:type="dc:Point" x="226" y="249" />
+ <di:waypoint xsi:type="dc:Point" x="142" y="249" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="99" y="249" width="6" height="6" />
+ <dc:Bounds x="110" y="234" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_124" bpmnElement="PreProcessRequest">
- <dc:Bounds x="226" y="209" width="100" height="80" />
+ <dc:Bounds x="142" y="209" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ServiceTask_86" bpmnElement="SendResponse">
- <dc:Bounds x="432" y="209" width="100" height="80" />
+ <dc:Bounds x="309" y="209" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_124" targetElement="_BPMNShape_ServiceTask_86">
- <di:waypoint xsi:type="dc:Point" x="326" y="249" />
- <di:waypoint xsi:type="dc:Point" x="432" y="249" />
+ <di:waypoint xsi:type="dc:Point" x="242" y="249" />
+ <di:waypoint xsi:type="dc:Point" x="309" y="249" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="348" y="249" width="6" height="6" />
+ <dc:Bounds x="276" y="234" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_178" bpmnElement="DoCreateVfModuleSubprocess">
- <dc:Bounds x="612" y="209" width="145" height="80" />
+ <dc:Bounds x="816" y="209" width="145" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ServiceTask_86" targetElement="_BPMNShape_ScriptTask_178">
- <di:waypoint xsi:type="dc:Point" x="532" y="249" />
- <di:waypoint xsi:type="dc:Point" x="612" y="249" />
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_IntermediateThrowEvent_47" bpmnElement="IntermediateThrowEvent_1">
- <dc:Bounds x="823" y="231" width="36" height="36" />
+ <dc:Bounds x="1031" y="231" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="841" y="272" width="0" height="0" />
+ <dc:Bounds x="1016" y="272" width="65" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_178" targetElement="_BPMNShape_IntermediateThrowEvent_47">
- <di:waypoint xsi:type="dc:Point" x="756" y="249" />
- <di:waypoint xsi:type="dc:Point" x="823" y="249" />
+ <di:waypoint xsi:type="dc:Point" x="961" y="249" />
+ <di:waypoint xsi:type="dc:Point" x="995" y="249" />
+ <di:waypoint xsi:type="dc:Point" x="995" y="249" />
+ <di:waypoint xsi:type="dc:Point" x="1031" y="249" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1010" y="249" width="0" height="0" />
+ </bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_IntermediateCatchEvent_32" bpmnElement="IntermediateCatchEvent_1">
<dc:Bounds x="39" y="349" width="36" height="36" />
<dc:Bounds x="277" y="327" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_179" bpmnElement="UpdateInfraRequestResponseCheck" isMarkerVisible="true">
- <dc:Bounds x="443" y="341" width="50" height="50" />
+ <dc:Bounds x="406" y="342" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="435" y="308" width="68" height="22" />
+ <dc:Bounds x="407" y="309" width="49" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_220" bpmnElement="PrepareMSOCompletionHandler">
- <dc:Bounds x="552" y="327" width="100" height="80" />
+ <dc:Bounds x="810" y="327" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_221" bpmnElement="MSOCompletionHandler">
- <dc:Bounds x="708" y="327" width="100" height="80" />
+ <dc:Bounds x="948" y="327" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_177" bpmnElement="EndEvent_1">
- <dc:Bounds x="1020" y="349" width="36" height="36" />
+ <dc:Bounds x="1237" y="349" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1038" y="390" width="0" height="0" />
+ <dc:Bounds x="1210" y="390" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_178" bpmnElement="EndEvent_2">
- <dc:Bounds x="452" y="469" width="36" height="36" />
+ <dc:Bounds x="413" y="454" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="470" y="510" width="0" height="0" />
+ <dc:Bounds x="386" y="495" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_IntermediateCatchEvent_32" targetElement="_BPMNShape_ScriptTask_219">
<di:waypoint xsi:type="dc:Point" x="227" y="367" />
<di:waypoint xsi:type="dc:Point" x="277" y="367" />
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ServiceTask_103" targetElement="_BPMNShape_ExclusiveGateway_179">
- <di:waypoint xsi:type="dc:Point" x="377" y="367" />
- <di:waypoint xsi:type="dc:Point" x="410" y="367" />
- <di:waypoint xsi:type="dc:Point" x="410" y="366" />
- <di:waypoint xsi:type="dc:Point" x="443" y="366" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="407" y="366" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="updateInfraRequestResponseBad" sourceElement="_BPMNShape_ExclusiveGateway_179" targetElement="_BPMNShape_EndEvent_178">
- <di:waypoint xsi:type="dc:Point" x="468" y="391" />
- <di:waypoint xsi:type="dc:Point" x="469" y="421" />
- <di:waypoint xsi:type="dc:Point" x="470" y="421" />
- <di:waypoint xsi:type="dc:Point" x="470" y="469" />
+ <di:waypoint xsi:type="dc:Point" x="430" y="391" />
+ <di:waypoint xsi:type="dc:Point" x="431" y="454" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="459" y="419" width="20" height="22" />
+ <dc:Bounds x="423.56413838294776" y="426.8392769104355" width="12" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="updateInfraRequestResponseGood" sourceElement="_BPMNShape_ExclusiveGateway_179" targetElement="_BPMNShape_ScriptTask_220">
- <di:waypoint xsi:type="dc:Point" x="493" y="366" />
- <di:waypoint xsi:type="dc:Point" x="523" y="366" />
- <di:waypoint xsi:type="dc:Point" x="523" y="367" />
- <di:waypoint xsi:type="dc:Point" x="552" y="367" />
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="updateInfraRequestResponseGood" sourceElement="_BPMNShape_ExclusiveGateway_179" targetElement="CallActivity_17ukiqm_di">
+ <di:waypoint xsi:type="dc:Point" x="456" y="367" />
+ <di:waypoint xsi:type="dc:Point" x="525" y="367" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="510" y="367" width="27" height="22" />
+ <dc:Bounds x="482.10526315789474" y="367.00000000000006" width="18" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ScriptTask_220" targetElement="_BPMNShape_ScriptTask_221">
- <di:waypoint xsi:type="dc:Point" x="652" y="367" />
- <di:waypoint xsi:type="dc:Point" x="708" y="367" />
+ <di:waypoint xsi:type="dc:Point" x="910" y="367" />
+ <di:waypoint xsi:type="dc:Point" x="948" y="367" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="678" y="367" width="6" height="6" />
+ <dc:Bounds x="884" y="349" width="90" height="6" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_SubProcess_20" bpmnElement="ErrorHandler" isExpanded="true">
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_241" bpmnElement="SetSuccessIndicator">
- <dc:Bounds x="858" y="328" width="103" height="79" />
+ <dc:Bounds x="1105" y="327" width="103" height="79" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_16" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ScriptTask_221" targetElement="_BPMNShape_ScriptTask_241">
- <di:waypoint xsi:type="dc:Point" x="808" y="367" />
- <di:waypoint xsi:type="dc:Point" x="858" y="367" />
+ <di:waypoint xsi:type="dc:Point" x="1048" y="367" />
+ <di:waypoint xsi:type="dc:Point" x="1105" y="366" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1031.5" y="341.5" width="90" height="20" />
+ </bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_16" sourceElement="_BPMNShape_ScriptTask_241" targetElement="_BPMNShape_EndEvent_177">
- <di:waypoint xsi:type="dc:Point" x="960" y="367" />
- <di:waypoint xsi:type="dc:Point" x="1020" y="367" />
+ <di:waypoint xsi:type="dc:Point" x="1208" y="367" />
+ <di:waypoint xsi:type="dc:Point" x="1237" y="367" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1177.5" y="342" width="90" height="20" />
+ </bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="SubProcess_0pgv3l6_di" bpmnElement="SubProcess_0pgv3l6" isExpanded="true">
<dc:Bounds x="160" y="1001" width="313" height="169" />
<bpmndi:BPMNShape id="ScriptTask_036ipyg_di" bpmnElement="SendErrorResponse">
<dc:Bounds x="296" y="698" width="100" height="80" />
</bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_0i3men0_di" bpmnElement="CallActivity_0i3men0">
+ <dc:Bounds x="478" y="209" width="145" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0e2ta6w_di" bpmnElement="SequenceFlow_0e2ta6w">
+ <di:waypoint xsi:type="dc:Point" x="409" y="249" />
+ <di:waypoint xsi:type="dc:Point" x="478" y="249" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="444" y="224" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_09h60ub_di" bpmnElement="ExclusiveGateway_09h60ub" isMarkerVisible="true">
+ <dc:Bounds x="690.4550758459743" y="224.00350058343057" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="679" y="274.00350058343054" width="73" height="25" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1vx081s_di" bpmnElement="SequenceFlow_1vx081s">
+ <di:waypoint xsi:type="dc:Point" x="740" y="249" />
+ <di:waypoint xsi:type="dc:Point" x="775" y="249" />
+ <di:waypoint xsi:type="dc:Point" x="775" y="249" />
+ <di:waypoint xsi:type="dc:Point" x="816" y="249" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="784" y="249" width="12" height="13" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_07llpjo_di" bpmnElement="SequenceFlow_07llpjo">
+ <di:waypoint xsi:type="dc:Point" x="623" y="249" />
+ <di:waypoint xsi:type="dc:Point" x="653" y="249" />
+ <di:waypoint xsi:type="dc:Point" x="653" y="249" />
+ <di:waypoint xsi:type="dc:Point" x="690" y="249" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="668" y="249" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_0n6bb71_di" bpmnElement="EndEvent_0n6bb71">
+ <dc:Bounds x="697" y="118" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="715" y="159" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0nszq2o_di" bpmnElement="SequenceFlow_0nszq2o">
+ <di:waypoint xsi:type="dc:Point" x="715" y="224" />
+ <di:waypoint xsi:type="dc:Point" x="715" y="154" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="721" y="179" width="17" height="13" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_17ukiqm_di" bpmnElement="CallActivity_17ukiqm">
+ <dc:Bounds x="525" y="327" width="145" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1crl7uf_di" bpmnElement="SequenceFlow_1crl7uf">
+ <di:waypoint xsi:type="dc:Point" x="377" y="367" />
+ <di:waypoint xsi:type="dc:Point" x="406" y="367" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="391.5" y="346" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1hncvjy_di" bpmnElement="ExclusiveGateway_1hncvjy" isMarkerVisible="true">
+ <dc:Bounds x="712" y="342" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="696" y="308" width="82" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1tk5ru7_di" bpmnElement="SequenceFlow_1tk5ru7">
+ <di:waypoint xsi:type="dc:Point" x="670" y="367" />
+ <di:waypoint xsi:type="dc:Point" x="712" y="367" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="691" y="346" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0td7d9m_di" bpmnElement="SequenceFlow_0td7d9m">
+ <di:waypoint xsi:type="dc:Point" x="762" y="367" />
+ <di:waypoint xsi:type="dc:Point" x="810" y="367" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="780" y="346" width="12" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_0a97jcr_di" bpmnElement="EndEvent_0a97jcr">
+ <dc:Bounds x="719" y="454" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="692" y="495" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0h5cld9_di" bpmnElement="SequenceFlow_0h5cld9">
+ <di:waypoint xsi:type="dc:Point" x="737" y="392" />
+ <di:waypoint xsi:type="dc:Point" x="737" y="423" />
+ <di:waypoint xsi:type="dc:Point" x="737" y="423" />
+ <di:waypoint xsi:type="dc:Point" x="737" y="454" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="743" y="417" width="18" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
<bpmn2:extensionElements>
<camunda:in source="msoRequestId" target="msoRequestId" />
<camunda:in source="serviceInstanceId" target="serviceInstanceId" />
- <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+ <camunda:in source="serviceModelInfo_Target" target="serviceModelInfo" />
<camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
<camunda:out source="serviceDecomposition" target="serviceDecomposition" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<bpmn2:extensionElements>
<camunda:in source="msoRequestId" target="msoRequestId" />
<camunda:in source="serviceInstanceId" target="serviceInstanceId" />
- <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+ <camunda:in source="serviceModelInfo_Original" target="serviceModelInfo" />
<camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
<camunda:out source="serviceDecomposition" target="serviceDecomposition" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<bpmn2:extensionElements>
<camunda:in source="msoRequestId" target="msoRequestId" />
<camunda:in source="serviceInstanceId" target="serviceInstanceId" />
- <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
<camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
- <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
+ <camunda:out source="serviceDecomposition_Target" target="serviceDecomposition_Target" />
<camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="model-invariant-id-target" target="model-invariant-id-target" />
+ <camunda:in source="model-version-id-target" target="model-version-id-target" />
+ <camunda:in source="model-invariant-id-original" target="model-invariant-id-original" />
+ <camunda:in source="model-version-id-original" target="model-version-id-original" />
+ <camunda:out source="addResourceList" target="addResourceList" />
+ <camunda:out source="delResourceList" target="delResourceList" />
+ <camunda:out source="serviceDecomposition_Original" target="serviceDecomposition_Original" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_1rebkae</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_1pe6r93</bpmn2:outgoing>
<camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="serviceType" target="GENGS_serviceType" />
+ <camunda:in source="serviceInstanceId" target="GENGS_serviceInstanceId" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_1i7t9hq</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
def dcsi= new DoCreateE2EServiceInstance()
dcsi.doServiceHoming(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:callActivity id="CallActivity_1ojtwas" name="Call DoCreateResources" calledElement="DoCreateResources">
+ <bpmn2:callActivity id="CallActivity_1ojtwas" name="Call DoCreateResources" calledElement="DoCreateResourcesV3">
<bpmn2:extensionElements>
<camunda:in source="nsServiceName" target="nsServiceName" />
<camunda:in source="nsServiceDescription" target="nsServiceDescription" />
<camunda:in source="globalSubscriberId" target="globalSubscriberId" />
<camunda:in source="serviceType" target="serviceType" />
- <camunda:in source="serviceId" target="serviceId" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
<camunda:in source="operationId" target="operationId" />
<camunda:in source="resourceType" target="resourceType" />
<camunda:in source="resourceUUID" target="resourceUUID" />
<camunda:in source="resourceParameters" target="resourceParameters" />
<camunda:in source="operationType" target="operationType" />
+ <camunda:in source="addResourceList" target="addResourceList" />
+ <camunda:in source="serviceInstanceName" target="serviceInstanceName" />
+ <camunda:in source="serviceDecomposition" target="serviceDecomposition" />
+ <camunda:in source="uuiRequest" target="uuiRequest" />
+ <camunda:in source="msoRequestId" target="msoRequestId" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_0bf6bzp</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0d0c20n</bpmn2:outgoing>
<?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="_MagIIMOUEeW8asg-vCEgWQ" 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: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="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="DoCreateResourcesV3" name="DoCreateResourcesV3" isExecutable="true">
<bpmn2:startEvent id="createSI_startEvent" name="Start Flow">
<bpmn2:outgoing>SequenceFlow_1qiiycn</bpmn2:outgoing>
def ddsi = new DoCreateResources()
ddsi.prepareResourceRecipeRequest(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:scriptTask id="Task_12ghoph" name="Execute Resource Recipe">
+ <bpmn2:scriptTask id="Task_12ghoph" name="Execute Resource Recipe" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_1u9k0dm</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_13c7bhn</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
<param-name>resteasy.resources</param-name>\r
<param-value>org.openecomp.mso.logger.MsoLoggingServlet,org.openecomp.mso.bpmn.core.HealthCheckHandler</param-value>\r
</context-param>\r
+ <context-param>\r
+ <param-name>mso.configuration</param-name>\r
+ <param-value>MSO_PROP_APIHANDLER_INFRA=mso.apihandler-infra.properties</param-value>\r
+ </context-param>\r
<listener>\r
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>\r
+ <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>\r
</listener>\r
+\r
+ <context-param>\r
+ <param-name>resteasy.jndi.resources</param-name>\r
+ <param-value>java:module/MsoPropertiesFactory</param-value>\r
+ </context-param>\r
<filter>\r
<filter-name>LogFilter</filter-name>\r
<filter-class>org.openecomp.mso.logger.LogFilter</filter-class>\r
import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSDNCAdapterVfModule;\r
import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockVNFAdapterRestVfModule;\r
import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDBUpdateVfModule;\r
+import static org.openecomp.mso.bpmn.mock.StubResponseAPPC.MockAppcError;\r
\r
import java.io.IOException;\r
import java.util.HashMap;\r
/**\r
* Unit test cases for CreateVfModuleInfra.bpmn\r
*/\r
+@Ignore\r
public class CreateVfModuleInfraTest extends WorkflowTest {\r
\r
private final CallbackSet callbacks = new CallbackSet();\r
@Test \r
@Deployment(resources = {\r
"process/CreateVfModuleInfra.bpmn",\r
+ "subprocess/BuildingBlock/AppCClient.bpmn",\r
"subprocess/DoCreateVfModule.bpmn",\r
"subprocess/GenericGetVnf.bpmn",\r
"subprocess/SDNCAdapterV1.bpmn",\r
"subprocess/UpdateAAIVfModule.bpmn",\r
"subprocess/UpdateAAIGenericVnf.bpmn",\r
"subprocess/CompleteMsoProcess.bpmn",\r
- "subprocess/FalloutHandler.bpmn"\r
+ "subprocess/FalloutHandler.bpmn",\r
+ "subprocess/BuildingBlock/AppCClient.bpmn"\r
})\r
public void sunnyDayVIDWithPreloads() throws Exception {\r
\r
MockSDNCAdapterVfModule(); \r
MockVNFAdapterRestVfModule();\r
MockDBUpdateVfModule();\r
+ MockAppcError();\r
\r
String businessKey = UUID.randomUUID().toString();\r
String createVfModuleRequest =\r
@Test \r
@Deployment(resources = {\r
"process/CreateVfModuleInfra.bpmn",\r
+ "subprocess/BuildingBlock/AppCClient.bpmn",\r
"subprocess/DoCreateVfModule.bpmn",\r
"subprocess/GenericGetVnf.bpmn",\r
"subprocess/SDNCAdapterV1.bpmn",\r
"subprocess/UpdateAAIVfModule.bpmn",\r
"subprocess/UpdateAAIGenericVnf.bpmn",\r
"subprocess/CompleteMsoProcess.bpmn",\r
- "subprocess/FalloutHandler.bpmn"\r
+ "subprocess/FalloutHandler.bpmn",\r
+ "subprocess/BuildingBlock/AppCClient.bpmn"\r
})\r
public void sunnyDayVIDNoPreloads() throws Exception {\r
\r
MockSDNCAdapterVfModule(); \r
MockVNFAdapterRestVfModule();\r
MockDBUpdateVfModule();\r
+ MockAppcError();\r
\r
String businessKey = UUID.randomUUID().toString();\r
String createVfModuleRequest =\r
@Ignore\r
@Deployment(resources = {\r
"process/CreateVfModuleInfra.bpmn",\r
+ "subprocess/BuildingBlock/AppCClient.bpmn",\r
"subprocess/DoCreateVfModule.bpmn",\r
"subprocess/GenericGetVnf.bpmn",\r
"subprocess/SDNCAdapterV1.bpmn",\r
"subprocess/UpdateAAIVfModule.bpmn",\r
"subprocess/UpdateAAIGenericVnf.bpmn",\r
"subprocess/CompleteMsoProcess.bpmn",\r
- "subprocess/FalloutHandler.bpmn"\r
+ "subprocess/FalloutHandler.bpmn",\r
+ "subprocess/BuildingBlock/AppCClient.bpmn"\r
})\r
\r
public void sunnyDayVIDWithVolumeGroupAttach() throws Exception {\r
MockSDNCAdapterVfModule(); \r
MockVNFAdapterRestVfModule();\r
MockDBUpdateVfModule();\r
+ MockAppcError();\r
\r
String businessKey = UUID.randomUUID().toString();\r
String createVfModuleRequest =\r
@Test \r
@Deployment(resources = {\r
"process/CreateVfModuleInfra.bpmn",\r
+ "subprocess/BuildingBlock/AppCClient.bpmn",\r
"subprocess/DoCreateVfModule.bpmn",\r
"subprocess/GenericGetVnf.bpmn",\r
"subprocess/SDNCAdapterV1.bpmn",\r
"subprocess/UpdateAAIVfModule.bpmn",\r
"subprocess/UpdateAAIGenericVnf.bpmn",\r
"subprocess/CompleteMsoProcess.bpmn",\r
- "subprocess/FalloutHandler.bpmn"\r
+ "subprocess/FalloutHandler.bpmn",\r
+ "subprocess/BuildingBlock/AppCClient.bpmn"\r
})\r
public void sunnyDayVIDMultipleUserParamValues() throws Exception {\r
\r
MockSDNCAdapterVfModule(); \r
MockVNFAdapterRestVfModule();\r
MockDBUpdateVfModule();\r
+ MockAppcError();\r
\r
String businessKey = UUID.randomUUID().toString();\r
String createVfModuleRequest =\r
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.infrastructure.workflow.service;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Set;
+
+import org.junit.Test;
+
+public class WorkflowResourceApplicationTest {
+
+ @Test
+ public void test() throws Exception {
+ WorkflowResourceApplication workflowResourceApp = new WorkflowResourceApplication();
+ Set<Class<?>> classes = workflowResourceApp.getClasses();
+ assertEquals(0, classes.size());
+ Set<Object> singleton = workflowResourceApp.getSingletons();
+ assertEquals(3, singleton.size());
+ }
+}
\ No newline at end of file
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.cloudify.base.client;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+import static org.junit.Assert.assertEquals;
+
+import org.apache.http.HttpStatus;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.openecomp.mso.cloudify.v3.model.Execution;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+
+public class CloudifyClientTest {
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Test
+ public void clientCreate(){
+ wireMockRule.stubFor(get(urlPathEqualTo("/testUrl")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withBody("{\"id\": \"123\"}").withStatus(HttpStatus.SC_OK)));
+ int port = wireMockRule.port();
+ CloudifyClient cc = new CloudifyClient("http://localhost:"+port);
+ cc.setToken("token");
+ CloudifyRequest<Execution> crx = cc.get("/testUrl", Execution.class);
+ Execution x = crx.execute();
+ assertEquals("123", x.getId());
+ }
+
+ @Test
+ public void clientCreateWithBadConnector(){
+ thrown.expect(CloudifyResponseException.class);
+ wireMockRule.stubFor(get(urlPathEqualTo("/testUrl")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withBody("{\"id\": \"123\"}").withStatus(HttpStatus.SC_OK)));
+ int port = wireMockRule.port();
+ CloudifyClientConnector ccc = new CloudifyClientConnector(){
+ @Override
+ public <T> CloudifyResponse request(CloudifyRequest<T> request) {
+ throw new CloudifyResponseException("test case", 401);
+ }};
+ CloudifyClient cc = new CloudifyClient("http://localhost:"+port, ccc);
+// cc.setToken("token");
+ CloudifyRequest<Execution> crx = cc.get("/testUrl", Execution.class);
+ Execution x = crx.execute();
+ }
+
+ @Test
+ public void clientCreateWithBadConnectorAndToken(){
+ thrown.expect(CloudifyResponseException.class);
+ wireMockRule.stubFor(get(urlPathEqualTo("/testUrl")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withBody("{\"id\": \"123\"}").withStatus(HttpStatus.SC_OK)));
+ int port = wireMockRule.port();
+ CloudifyClientConnector ccc = new CloudifyClientConnector(){
+ @Override
+ public <T> CloudifyResponse request(CloudifyRequest<T> request) {
+ throw new CloudifyResponseException("test case", 401);
+ }};
+ CloudifyClient cc = new CloudifyClient("http://localhost:"+port, ccc);
+ cc.setToken("token");
+ CloudifyRequest<Execution> crx = cc.get("/testUrl", Execution.class);
+ Execution x = crx.execute();
+ }
+
+ @Test
+ public void clientCreateWithTenant(){
+ wireMockRule.stubFor(get(urlPathEqualTo("/testUrl")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withBody("{\"id\": \"123\"}").withStatus(HttpStatus.SC_OK)));
+ int port = wireMockRule.port();
+ CloudifyClient cc = new CloudifyClient("http://localhost:"+port, "other_tenant");
+ cc.setToken("token");
+ cc.property("property", "value");
+ CloudifyRequest<Execution> crx = cc.get("/testUrl", Execution.class);
+ Execution x = crx.execute();
+ assertEquals("123", x.getId());
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.cloudify.base.client;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+import static org.junit.Assert.assertEquals;
+
+import org.apache.http.HttpStatus;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+
+public class CloudifyClientTokenProviderTest {
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Test
+ public void createTokenProvider() {
+ wireMockRule.stubFor(get(urlPathEqualTo("/testUrl")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withBody("{\"role\": \"user\", \"value\": \"tokenVal\"}").withStatus(HttpStatus.SC_OK)));
+ int port = wireMockRule.port();
+
+ CloudifyClientTokenProvider cctp = new CloudifyClientTokenProvider("http://localhost:"+port+"/testUrl", "user", "pswd");
+ String token = cctp.getToken();
+ assertEquals("tokenVal", token);
+ token = cctp.getToken();
+ assertEquals("tokenVal", token);
+ cctp.expireToken();
+ }
+}
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+import com.github.tomakehurst.wiremock.http.Fault;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.delete;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.assertEquals;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+
+import org.openecomp.mso.cloudify.base.client.CloudifyConnectException;
import org.openecomp.mso.cloudify.base.client.CloudifyRequest;
import org.openecomp.mso.cloudify.base.client.CloudifyResponseException;
+import org.openecomp.mso.cloudify.base.client.Entity;
import org.openecomp.mso.cloudify.base.client.HttpMethod;
import org.openecomp.mso.cloudify.v3.model.Deployment;
@Rule
public ExpectedException thrown = ExpectedException.none();
-
+
@Test
public void sunnyDay_POST(){
wireMockRule.stubFor(post(urlPathEqualTo("/testUrl")).willReturn(aResponse()
conector.request(request);
verify(postRequestedFor(urlEqualTo("/testUrl")));
}
-
-
+
+
@Test
public void sunnyDay_GET(){
wireMockRule.stubFor(get(urlPathEqualTo("/testUrl")).willReturn(aResponse()
@Test
- public void rainydDay_PATCH(){
+ public void rainyDay_PATCH(){
thrown.expect(HttpClientException.class);
thrown.expectMessage("Unrecognized HTTP Method: PATCH");
HttpClientConnector conector = new HttpClientConnector();
}
-
@Test
- public void rainydDay_RunTimeException(){
+ public void rainyDayRunTimeException(){
wireMockRule.stubFor(post(urlEqualTo("/503")).willReturn(
aResponse().withStatus(503).withHeader("Content-Type", "text/plain").withBody("failure")));
thrown.expect(RuntimeException.class);
conector.request(request);
}
+
+ @Test
+ public void rainyDayBadUri() {
+ wireMockRule.stubFor(post(urlPathEqualTo("/testUrl")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withBody("TEST").withStatus(HttpStatus.SC_OK)));
+ thrown.expect(HttpClientException.class);
+ int port = wireMockRule.port();
+ HttpClientConnector conector = new HttpClientConnector();
+ CloudifyRequest<Deployment> request = new CloudifyRequest<Deployment>();
+ Deployment deployment = new Deployment();
+ deployment.setId("id");
+ request.entity(deployment, "application/json");
+ request.endpoint("(@#$@(#*$&asfasdf");
+ request.setBasicAuthentication("USER","PASSWORD");
+ request.header("Content-Type","application/json");
+ request.method(HttpMethod.POST);
+ conector.request(request);
+ }
+
+ @Test
+ public void sunnyDayWithJsonEntity_POST(){
+ wireMockRule.stubFor(post(urlPathEqualTo("/testUrl")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withBody("TEST").withStatus(HttpStatus.SC_OK)));
+ int port = wireMockRule.port();
+ HttpClientConnector conector = new HttpClientConnector();
+
+ Deployment deployment = new Deployment();
+ deployment.setId("id");
+
+ CloudifyRequest<Deployment> request = new CloudifyRequest<Deployment>(null, HttpMethod.POST, "/", Entity.json(deployment), null);
+
+ request.endpoint("http://localhost:"+port);
+ request.path("testUrl");
+ request.header("Content-Type","application/json");
+ request.header("Content-Type", null);
+
+ request.returnType(Deployment.class);
+ assertEquals(Deployment.class, request.returnType());
+
+ Entity<Deployment> t = request.json(deployment);
+ assertEquals(t.getEntity().getId(), "id");
+
+ request.queryParam("test", "one").queryParam("test", "two");
+
+ conector.request(request);
+
+ verify(postRequestedFor(urlEqualTo("/testUrl?test=two")));
+ }
+
+ @Test
+ public void sunnyDayWithStreamEntity_POST() {
+ wireMockRule.stubFor(post(urlPathEqualTo("/testUrl")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withBody("TEST").withStatus(HttpStatus.SC_OK)));
+ int port = wireMockRule.port();
+ HttpClientConnector conector = new HttpClientConnector();
+
+ InputStream is = new ByteArrayInputStream("{}".getBytes(StandardCharsets.UTF_8));
+ CloudifyRequest<Deployment> request = new CloudifyRequest<Deployment>(null, HttpMethod.POST, "/testUrl", Entity.stream(is), null);
+
+ request.endpoint("http://localhost:"+port);
+ request.setBasicAuthentication("USER","PASSWORD");
+ request.header("Content-Type","application/json");
+
+ conector.request(request);
+ verify(postRequestedFor(urlEqualTo("/testUrl")));
+ }
+
+ @Test
+ public void rainyDayGarbageData(){
+ wireMockRule.stubFor(get(urlPathEqualTo("/testUrl")).willReturn(
+ aResponse().withFault(Fault.RANDOM_DATA_THEN_CLOSE)));
+ thrown.expect(CloudifyConnectException.class);
+ int port = wireMockRule.port();
+ HttpClientConnector conector = new HttpClientConnector();
+ CloudifyRequest<Deployment> request = new CloudifyRequest<Deployment>();
+ request.endpoint("http://localhost:"+port+"/testUrl");
+ request.setBasicAuthentication("USER","PASSWORD");
+ request.method(HttpMethod.GET);
+ conector.request(request);
+ }
+
+ @Test
+ public void rainyDayEmptyResponse(){
+ thrown.expect(HttpClientException.class);
+ int port = wireMockRule.port();
+ HttpClientConnector conector = new HttpClientConnector();
+ CloudifyRequest<Deployment> request = new CloudifyRequest<Deployment>();
+ request.endpoint("http://localhost:"+port+"/testUrl");
+ request.setBasicAuthentication("USER","PASSWORD");
+ request.method(HttpMethod.GET);
+ conector.request(request); // gets down to "Get here on an error response (4XX-5XX)", then tries to throw a CloudifyResponseException, which calls getEntity, which tries to parse an HTML error page as a JSON, which causes the HttpClientException.
+ }
+
}
\ No newline at end of file
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.cloudify.v3.client;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+import static org.junit.Assert.assertEquals;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+
+import org.apache.http.HttpStatus;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.openecomp.mso.cloudify.v3.client.BlueprintsResource.DeleteBlueprint;
+import org.openecomp.mso.cloudify.v3.client.BlueprintsResource.GetBlueprint;
+import org.openecomp.mso.cloudify.v3.client.BlueprintsResource.ListBlueprints;
+import org.openecomp.mso.cloudify.v3.client.BlueprintsResource.UploadBlueprint;
+import org.openecomp.mso.cloudify.v3.model.Blueprint;
+import org.openecomp.mso.cloudify.v3.model.Blueprints;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+
+public class BlueprintsResourceTest {
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Test
+ public void cloudifyClientBlueprintFromStream() {
+ wireMockRule.stubFor(put(urlPathEqualTo("/api/v3/blueprints/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{\"id\": \"123\"}")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ BlueprintsResource br = c.blueprints();
+ InputStream is = new ByteArrayInputStream("{}".getBytes(StandardCharsets.UTF_8));
+ UploadBlueprint ub = br.uploadFromStream("123", "blueprint.json", is);
+ Blueprint b = ub.execute();
+ assertEquals("123", b.getId());
+ }
+
+ @Test
+ public void cloudifyClientBlueprintFromUrl() {
+ wireMockRule.stubFor(put(urlPathEqualTo("/api/v3/blueprints/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{\"id\": \"123\"}")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ BlueprintsResource br = c.blueprints();
+ UploadBlueprint ub = br.uploadFromUrl("123", "blueprint.json", "http://localhost:"+port+"/blueprint");
+ Blueprint b = ub.execute();
+ assertEquals("123", b.getId());
+ }
+
+ @Test
+ public void cloudifyClientBlueprintDelete() {
+ wireMockRule.stubFor(delete(urlPathEqualTo("/api/v3/blueprints/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{\"id\": \"123\"}")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ BlueprintsResource br = c.blueprints();
+ DeleteBlueprint db = br.deleteById("123");
+ Blueprint b = db.execute();
+ assertEquals("123", b.getId());
+ }
+
+ @Test
+ public void cloudifyClientBlueprintList() {
+ wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/blueprints")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{\"items\": [{\"id\": \"123\"}]}")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ BlueprintsResource br = c.blueprints();
+ ListBlueprints lb = br.list();
+ Blueprints b = lb.execute();
+ assertEquals("123", b.getItems().get(0).getId());
+ }
+
+ @Test
+ public void cloudifyClientBlueprintGetById() {
+ wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/blueprints/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{\"id\": \"123\"}")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ BlueprintsResource br = c.blueprints();
+ GetBlueprint gb = br.getById("123");
+ Blueprint b = gb.execute();
+ assertEquals("123", b.getId());
+ }
+
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.cloudify.v3.client;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.patch;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+import static org.junit.Assert.assertEquals;
+
+import org.apache.http.HttpStatus;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.openecomp.mso.cloudify.connector.http.HttpClientException;
+import org.openecomp.mso.cloudify.v3.client.ExecutionsResource.CancelExecution;
+import org.openecomp.mso.cloudify.v3.client.ExecutionsResource.GetExecution;
+import org.openecomp.mso.cloudify.v3.client.ExecutionsResource.ListExecutions;
+import org.openecomp.mso.cloudify.v3.client.ExecutionsResource.StartExecution;
+import org.openecomp.mso.cloudify.v3.client.ExecutionsResource.UpdateExecution;
+import org.openecomp.mso.cloudify.v3.model.CancelExecutionParams;
+import org.openecomp.mso.cloudify.v3.model.Execution;
+import org.openecomp.mso.cloudify.v3.model.Executions;
+import org.openecomp.mso.cloudify.v3.model.StartExecutionParams;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+
+public class ExecutionsResourceTest {
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Test
+ public void cloudifyClientExecutions() {
+ wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/executions")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{\"items\": [{ \"id\": \"345\" }, { \"id\": \"123\" }], \"metadata\": {\"pagination\": {\"total\": 100, \"offset\": 0, \"size\": 25}}}")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ ExecutionsResource xr = c.executions();
+ ListExecutions lx = xr.list();
+ Executions x = lx.execute();
+ assertEquals("123", x.getItems().get(1).getId());
+ }
+
+ @Test
+ public void cloudifyClientExecutionsSorted() {
+ wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/executions")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{\"items\": [{ \"id\": \"123\" }, { \"id\": \"345\" }], \"metadata\": {\"pagination\": {\"total\": 100, \"offset\": 0, \"size\": 25}}}")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ ExecutionsResource xr = c.executions();
+ ListExecutions lx = xr.listSorted("id");
+ Executions x = lx.execute();
+ assertEquals("345", x.getItems().get(1).getId());
+ }
+
+ @Test
+ public void cloudifyClientExecutionsFilter() {
+ wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/executions")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{\"items\": [{ \"id\": \"121\" }, { \"id\": \"123\" }], \"metadata\": {\"pagination\": {\"total\": 100, \"offset\": 0, \"size\": 25}}}")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ ExecutionsResource xr = c.executions();
+ ListExecutions lx = xr.listFiltered("a=b", "id");
+ Executions x = lx.execute();
+ assertEquals("123", x.getItems().get(1).getId());
+ }
+
+ @Test
+ public void cloudifyClientExecutionById() {
+ wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/executions")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{ \"id\": \"123\" }")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ ExecutionsResource xr = c.executions();
+ GetExecution gx = xr.byId("123");
+ Execution x = gx.execute();
+ assertEquals("123", x.getId());
+ }
+
+ @Test
+ public void cloudifyClientStartExecution() {
+ wireMockRule.stubFor(post(urlPathEqualTo("/api/v3/executions")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{ \"id\": \"123\" }")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ ExecutionsResource xr = c.executions();
+
+ StartExecutionParams params = new StartExecutionParams();
+ StartExecution sx = xr.start(params);
+ Execution x = sx.execute();
+ assertEquals("123", x.getId());
+ }
+
+ @Test
+ public void cloudifyClientUpdateExecution() {
+ thrown.expect(HttpClientException.class);
+ thrown.expectMessage("Unrecognized HTTP Method: PATCH");
+
+ wireMockRule.stubFor(patch(urlPathEqualTo("/api/v3/executions")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{ \"id\": \"123\" }")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ ExecutionsResource xr = c.executions();
+
+ UpdateExecution ux = xr.updateStatus("123", "good");
+ Execution x = ux.execute();
+ assertEquals("123", x.getId());
+ }
+
+ @Test
+ public void cloudifyClientCancelExecution() {
+ wireMockRule.stubFor(post(urlPathEqualTo("/api/v3/executions")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{ \"id\": \"123\" }")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ ExecutionsResource xr = c.executions();
+
+ CancelExecutionParams params = new CancelExecutionParams();
+ CancelExecution cx = xr.cancel("123", params);
+ Execution x = cx.execute();
+ assertEquals("123", x.getId());
+ }
+
+
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.utils;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.openecomp.mso.logger.MsoLogger;
+
+public class UUIDCheckerTest {
+
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
+
+ @Test
+ public void testUUIDChecker() throws Exception {
+ boolean isValidUUID = UUIDChecker.isValidUUID("invalid-uuid");
+ assertEquals(false, isValidUUID);
+ String validUUID = UUIDChecker.verifyOldUUID("invalid-uuid", LOGGER);
+ assertEquals(true, UUIDChecker.isValidUUID(validUUID));
+ String generatedUUID = UUIDChecker.generateUUID(LOGGER);
+ assertEquals(true, UUIDChecker.isValidUUID(generatedUUID));
+ String generatedServiceInstanceId = UUIDChecker.generateServiceInstanceID(LOGGER);
+ assertEquals(true, UUIDChecker.isValidUUID(generatedServiceInstanceId));
+ }
+
+}
<key-property name="serviceId" type="string" column="SERVICE_ID"/>
<key-property name="operationId" column="OPERATION_ID" type="string" length="256"/>
</composite-id>
+ <property name="serviceName" column="SERVICE_NAME" type="string" length="256"/>
<property name="operation" column="OPERATION_TYPE" type="string" length="256"/>
<property name="userId" column="USER_ID" type="string" length="256"/>
<property name="result" column="RESULT" type="string" length="256"/>
return null;
}
- VnfRecipe recipe = this.getVnfRecipeByNameVersion(vnfResource.getModelName(), vnfResource.getModelVersion(), action);
+ VnfRecipe recipe = this.getVnfRecipeByNameVersion(vnfResource.getModelName(), vnfResource.getVersion(), action);
return recipe;
}
<swm.version>2.19.3-1</swm.version>
<openstack.version>1.2.1</openstack.version>
<nexusproxy>https://nexus.onap.org</nexusproxy>
- <maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
+ <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
<resteasy.version>3.0.19.Final</resteasy.version>
</properties>
<distributionManagement>