* ============LICENSE_END=========================================================
*/
-package com.att.bpm.scripts
-import java.io.Serializable;
-
+package org.openecomp.mso.bpmn.common.scripts
import org.camunda.bpm.engine.runtime.Execution
-
import org.openecomp.mso.rest.APIResponse
-import org.openecomp.mso.rest.RESTClient
-import org.openecomp.mso.rest.RESTConfig
-import org.openecomp.mso.bpmn.core.RollbackData
-import org.openecomp.mso.bpmn.core.WorkflowException
public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
AaiUtil aaiUriUtil = new AaiUtil(this)
def aai_uri = aaiUriUtil.getCloudInfrastructureCloudRegionUri(execution)
logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
-
+ utils.logAudit("AAI URI: " + aai_uri)
execution.setVariable("CVGN_volumeGroupGetEndpoint","${aai_uri}/${aicCloudRegion}/volume-groups/volume-group/" +
volumeGroupId)
}
public void queryAAIForVolumeGroupId(Execution execution) {
def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("CVGN_volumeGroupGetEndpoint")
- def aaiRequestId = UUID.randomUUID().toString()
-
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
-
- RESTConfig config = new RESTConfig(endPoint);
- utils.log("DEBUG","queryAAIForVolumeGroupId() endpoint-" + endPoint, isDebugLogEnabled)
- def responseData = ""
+
try {
- RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO").addHeader("Content-Type", "application/xml").
- addHeader("Accept","application/xml");
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
logDebug("invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint,isDebugLogEnabled)
- APIResponse response = client.httpGet()
-
- responseData = response.getResponseBodyAsString()
- execution.setVariable("CVGN_queryVolumeGroupResponseCode", response.getStatusCode())
+ utils.log("DEBUG","queryAAIForVolumeGroupId() endpoint-" + endPoint, isDebugLogEnabled)
+ utils.logAudit("ConfirmVolumeGroup sending GET call to AAI Endpoint: " + endPoint)
+
+ AaiUtil aaiUtil = new AaiUtil(this)
+ APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint)
+ def responseData = response.getResponseBodyAsString()
+ def responseStatusCode = response.getStatusCode()
+ execution.setVariable("CVGN_queryVolumeGroupResponseCode", responseStatusCode)
execution.setVariable("CVGN_queryVolumeGroupResponse", responseData)
- logDebug("Response code:" + response.getStatusCode(), isDebugLogEnabled)
+
+ utils.logAudit("Response code:" + responseStatusCode)
+ utils.logAudit("Response:" + responseData)
+ logDebug("Response code:" + responseStatusCode, isDebugLogEnabled)
logDebug("Response:" + System.lineSeparator()+responseData,isDebugLogEnabled)
} catch (Exception ex) {
ex.printStackTrace()
def responseXML = ""
execution.setVariable("WorkflowResponse", responseXML)
}
-
-
-
}