* ================================================================================
* Copyright (C) 2018 CMCC. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.json.JSONArray
import org.json.JSONObject;
import org.onap.so.bpmn.core.json.JsonUtils
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
import com.fasterxml.jackson.databind.ObjectMapper
+import org.onap.so.client.HttpClientFactory
+import org.onap.logging.filter.base.ErrorCode
+
import javax.ws.rs.core.Response
import org.onap.so.bpmn.infrastructure.vfcmodel.ScaleResource
import org.onap.so.bpmn.infrastructure.vfcmodel.NsParameters
import org.onap.so.bpmn.infrastructure.vfcmodel.LocationConstraint
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
-import org.onap.so.utils.TargetEntity
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import org.onap.logging.filter.base.ONAPComponents;
* flow for VFC Network Service Scale
*/
public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoScaleVFCNetworkServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoScaleVFCNetworkServiceInstance.class);
String host = "http://mso.mso.testlab.openecomp.org:8080"
* generate the nsParameters
*/
public void preProcessRequest(DelegateExecution execution) {
- msoLogger.trace("preProcessRequest() ")
+ logger.trace("preProcessRequest() ")
List<NSResourceInputParameter> nsRIPList = convertScaleNsReq2NSResInputParamList(execution)
String requestJsonStr = ""
execution.setVariable("reqBody", requestJsonStr)
- msoLogger.trace("Exit preProcessRequest ")
+ logger.trace("Exit preProcessRequest ")
}
/**
if (returnCode == "200" || returnCode == "202") {
jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId")
}
- utils.log("INFO", "scaleNetworkService get a ns scale job Id:" + jobId, isDebugEnabled)
+ logger.info( "scaleNetworkService get a ns scale job Id:" + jobId)
execution.setVariable("jobId", jobId)
execution.setVariable("nodeTemplateUUID", nodeTemplateUUID)
try {
Thread.sleep(5000)
} catch (InterruptedException e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Time Delay exception" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Time Delay exception" + e, "BPMN",
+ ErrorCode.UnknownError.getValue());
}
}
* requestBody: the body of the request
*/
private Response postRequest(DelegateExecution execution, String urlString, String requestBody){
- msoLogger.trace("Started Execute VFC adapter Post Process ")
- msoLogger.info("url:"+urlString +"\nrequestBody:"+ requestBody)
+ logger.trace("Started Execute VFC adapter Post Process ")
+ logger.info("url:"+urlString +"\nrequestBody:"+ requestBody)
Response apiResponse = null
try{
URL url = new URL(urlString);
- HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.VNF_ADAPTER)
httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk")
apiResponse = httpClient.post(requestBody)
- msoLogger.info("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
- msoLogger.trace("Completed Execute VF-C adapter Post Process ")
+ logger.info("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
+ logger.trace("Completed Execute VF-C adapter Post Process ")
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing VFC Post Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e);
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured " +
+ "while executing VFC Post Call.", "BPMN", ErrorCode.UnknownError.getValue(), e);
throw new BpmnError("MSOWorkflowException")
}
return apiResponse