diff options
5 files changed, 89 insertions, 82 deletions
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java index d76fbc2133..57d3bf5bb2 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java @@ -345,68 +345,65 @@ public class VfcManager { * @return * @since ONAP Amsterdam Release */ - public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId) - throws ApplicationException { - - ValidateUtil.assertObjectNotNull(jobId); - // Step 1: query the current resource operation status - ResourceOperationStatus nsOperInfo = - (RequestsDatabase.getInstance()).getResourceOperationStatus(nsOperationKey.getServiceId(), - nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); - - // Step 2: start query - LOGGER.info("query ns status -> begin"); - String url = getUrl(jobId, CommonConstant.Step.QUERY); - String methodType = CommonConstant.MethodType.GET; - // prepare restful parameters and options - RestfulResponse rsp = RestfulUtil.send(url, methodType, ""); - ValidateUtil.assertObjectNotNull(rsp); - LOGGER.info("query ns progress response status is : {}", rsp.getStatus()); - LOGGER.info("query ns progress response content is : {}", rsp.getResponseContent()); - // Step 3:check the response staus - if (!HttpCode.isSucess(rsp.getStatus())) { - LOGGER.info("fail to query job status"); - nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus())); - nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); - nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED); - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS); - } - // Step 4: Process Network Service Instantiate Response - NsProgressStatus nsProgress = - JsonUtil.unMarshal(rsp.getResponseContent(), NsProgressStatus.class); - ResponseDescriptor rspDesc = nsProgress.getResponseDescriptor(); - // Step 5: update segment operation progress - - nsOperInfo.setProgress(rspDesc.getProgress()); - nsOperInfo.setStatusDescription(rspDesc.getStatusDescription()); - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - - // Step 6: update segment operation status - if (RequestsDbConstant.Progress.ONE_HUNDRED.equals(rspDesc.getProgress()) - && RequestsDbConstant.Status.FINISHED.equals(rspDesc.getStatus())) { - LOGGER.info("job result is succeeded, operType is {}", nsOperInfo.getOperType()); - nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus())); - if(RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(nsOperInfo.getOperType())) { - nsOperInfo.setStatus(RequestsDbConstant.Status.FINISHED); - } - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - } else if (RequestsDbConstant.Status.ERROR.equals(rspDesc.getStatus())) { - LOGGER.error("job result is failed, operType is {}", nsOperInfo.getOperType()); - nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus())); - nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED); - nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.JOB_STATUS_ERROR); - } else { - LOGGER.error("unexcepted response status"); - } - LOGGER.info("query ns status -> end"); - - return rsp; - } + public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId) throws ApplicationException { + + ValidateUtil.assertObjectNotNull(jobId); + // Step 1: query the current resource operation status + ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus( + nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); + + // Step 2: start query + LOGGER.info("query ns status -> begin"); + String url = getUrl(jobId, CommonConstant.Step.QUERY); + String methodType = CommonConstant.MethodType.GET; + // prepare restful parameters and options + RestfulResponse rsp = RestfulUtil.send(url, methodType, ""); + ValidateUtil.assertObjectNotNull(rsp); + LOGGER.info("query ns progress response status is : {}", rsp.getStatus()); + LOGGER.info("query ns progress response content is : {}", rsp.getResponseContent()); + // Step 3:check the response staus + if (!HttpCode.isSucess(rsp.getStatus())) { + LOGGER.info("fail to query job status"); + nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus())); + nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); + nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED); + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS); + } + // Step 4: Process Network Service Instantiate Response + NsProgressStatus nsProgress = JsonUtil.unMarshal(rsp.getResponseContent(), NsProgressStatus.class); + ResponseDescriptor rspDesc = nsProgress.getResponseDescriptor(); + // Step 5: update segment operation progress + + nsOperInfo.setProgress(rspDesc.getProgress()); + nsOperInfo.setStatusDescription(rspDesc.getStatusDescription()); + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + + // Step 6: update segment operation status + if (RequestsDbConstant.Progress.ONE_HUNDRED.equals(rspDesc.getProgress()) + && RequestsDbConstant.Status.FINISHED.equals(rspDesc.getStatus())) { + LOGGER.info("job result is succeeded, operType is {}", nsOperInfo.getOperType()); + nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus())); + String operType = nsOperInfo.getOperType(); + if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType) + || "createInstance".equalsIgnoreCase(operType)) { + nsOperInfo.setStatus(RequestsDbConstant.Status.FINISHED); + } + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + } else if (RequestsDbConstant.Status.ERROR.equals(rspDesc.getStatus())) { + LOGGER.error("job result is failed, operType is {}", nsOperInfo.getOperType()); + nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus())); + nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED); + nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); + (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.JOB_STATUS_ERROR); + } else { + LOGGER.error("unexcepted response status"); + } + LOGGER.info("query ns status -> end"); + + return rsp; + } /** * Scale NS instance diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java index 0bedd12eb1..5168de85cc 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java @@ -38,11 +38,11 @@ import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; import org.openecomp.mso.adapters.vfc.model.RestfulResponse; -import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; import org.openecomp.mso.properties.MsoPropertiesException; import org.openecomp.mso.properties.MsoPropertiesFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * <br> @@ -58,7 +58,7 @@ public class RestfulUtil { /** * Log service */ - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); + private static final Logger LOGGER = LoggerFactory.getLogger(RestfulUtil.class); private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); @@ -83,7 +83,7 @@ public class RestfulUtil { msbPort = msoPropertiesFactory.getMsoJavaProperties("MSO_PROP_TOPOLOGY").getProperty("msb-port", DEFAULT_MSB_PORT); } } catch(MsoPropertiesException e) { - LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.AvailabilityError, "Get msb properties failed",e); + LOGGER.error("Get msb properties failed",e); e.printStackTrace(); } return "http://" + msbIp + ":" + msbPort; @@ -95,7 +95,7 @@ public class RestfulUtil { public static RestfulResponse send(String url, String methodType, String content) { String msbUrl = getMsbHost() + url; - LOGGER.info(MessageEnum.RA_NS_EXC, "Begin to sent message " + methodType +": " + msbUrl, "org.openecomp.mso.adapters.vfc.util.RestfulUtil","VFC Adapter"); + LOGGER.info("Begin to sent message " + methodType +": " + msbUrl); HttpRequestBase method = null; HttpResponse httpResponse = null; @@ -196,12 +196,12 @@ public class RestfulUtil { } private static void logError(String errMsg, Throwable t) { - LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.AvailabilityError, errMsg, t); + LOGGER.error(errMsg, t); ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); } private static void logError(String errMsg) { - LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.AvailabilityError, errMsg); + LOGGER.error(errMsg); ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java index 3cd26be631..3515aa9218 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java @@ -83,7 +83,7 @@ public class ApplicationControllerClient { /** * Creates an ApplicationControllerClient for the specified controller type. - * @param controllerType the controller type: "appc" or "sndnc". + * @param controllerType the controller type: "appc" or "sdnc". */ public ApplicationControllerClient(String controllerType) { this.controllerType = controllerType; @@ -110,7 +110,7 @@ public class ApplicationControllerClient { protected LifeCycleManagerStateful createAppCClient(String controllerType) { try { return AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class) - .createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties()); + .createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties(controllerType)); } catch (AppcClientException e) { auditLogger.log(Level.ERROR, "Error in getting LifeCycleManagerStateful: ", e, e.getMessage()); // This null value will cause NullPointerException when used later. @@ -135,6 +135,10 @@ public class ApplicationControllerClient { } protected Properties getLCMProperties() { + return getLCMProperties("appc"); + } + + protected Properties getLCMProperties(String controllerType) { Properties properties = new Properties(); Map<String, String> globalProperties = PropertyConfiguration.getInstance() .getProperties("mso.bpmn.urn.properties"); @@ -145,6 +149,7 @@ public class ApplicationControllerClient { properties.put("topic.read.timeout", globalProperties.get("appc.client.topic.read.timeout")); properties.put("client.response.timeout", globalProperties.get("appc.client.response.timeout")); properties.put("poolMembers", globalProperties.get("appc.client.poolMembers")); + properties.put("client.controllerType", controllerType); properties.put("client.key", globalProperties.get("appc.client.key")); properties.put("client.secret", globalProperties.get("appc.client.secret")); properties.put("client.name", CLIENT_NAME); diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index a834431356..bbf61744a8 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -361,24 +361,28 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { List<Resource> deleteResourceList = serviceDecomposition.getServiceResources() String serviceRelationShip = execution.getVariable("serviceRelationShip") def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - List relationShipList = jsonSlurper.parseText(serviceRelationShip) - - + def jsonOutput = new JsonOutput() + + List relationShipList = null + if (serviceRelationShip != null) { + relationShipList = jsonSlurper.parseText(serviceRelationShip) + } + //Set the real resource instance id to the decomosed resource list - for(Resource resource: deleteResourceList){ - //reset the resource instance id , because in the decompose flow ,its a random one. - resource.setResourceId(""); + for (Resource resource: deleteResourceList) { + //reset the resource instance id , because in the decompose flow ,its a random one. + resource.setResourceId(""); //match the resource-instance-name and the model name if (relationShipList != null) { relationShipList.each { - if(StringUtils.containsIgnoreCase(it.resourceType, resource.getModelInfo().getModelName())){ - resource.setResourceId(it.resourceInstanceId); - } + if (StringUtils.containsIgnoreCase(it.resourceType, resource.getModelInfo().getModelName())) { + resource.setResourceId(it.resourceInstanceId); + } } } } execution.setVariable("deleteResourceList", deleteResourceList) + utils.log("DEBUG", "delete resource list : " + deleteResourceList, isDebugEnabled) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. processDecomposition() - " + ex.getMessage() utils.log("DEBUG", exceptionMessage, isDebugEnabled) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn index 03d7362ac5..d1019887b0 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_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="CreateVcpeResCustService" name="CreateVcpeResCustService" isExecutable="true"> <bpmn2:scriptTask id="sendSyncAckResponse_ScriptTask" name="Send Sync Ack Response" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> @@ -448,6 +448,7 @@ CreateVcpeResCustService.prepareCreateAllottedResourceTXC(execution)]]></bpmn2:s <camunda:in source="serviceDecomposition" target="serviceDecomposition" /> <camunda:in source="subscriberInfo" target="subscriberInfo" /> <camunda:in source="homingService" target="homingService" /> + <camunda:in source="customerLocation" target="customerLocation" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_11efpvh</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1jbuf1t</bpmn2:outgoing> |