(CreateInstantiateRequest) execution.getVariable(CREATE_INSTANTIATE_REQUEST_PARAM_NAME);
logger.info("request: {}", request);
- setJobStatus(execution, JobStatusEnum.IN_PROGRESS, "Checking if NF Instance record exists in database for "
+ addJobStatus(execution, JobStatusEnum.IN_PROGRESS, "Checking if NF Instance record exists in database for "
+ request.getNsInstId() + " and " + request.getVnfName());
if (!databaseServiceProvider.isNsInstExists(request.getNsInstId(), request.getVnfName())) {
abortOperation(execution,
(CreateInstantiateRequest) execution.getVariable(CREATE_INSTANTIATE_REQUEST_PARAM_NAME);
logger.info("request: {}", request);
- setJobStatus(execution, IN_PROGRESS, "Creating NF Instance record in database for " + request.getVnfName());
+ addJobStatus(execution, IN_PROGRESS, "Creating NF Instance record in database for " + request.getVnfName());
final Optional<NfvoNsInst> optional = databaseServiceProvider.getNfvoNsInst(request.getNsInstId());
final CreateInstantiateRequest request =
(CreateInstantiateRequest) execution.getVariable(CREATE_INSTANTIATE_REQUEST_PARAM_NAME);
- setJobStatus(execution, IN_PROGRESS, "Creating GenericVnf record in AAI for " + request.getVnfName());
+ addJobStatus(execution, IN_PROGRESS, "Creating GenericVnf record in AAI for " + request.getVnfName());
final String nfInstId = (String) execution.getVariable(NF_INST_ID_PARAM_NAME);
final String nsInstId = (String) execution.getVariable(NS_INSTANCE_ID_PARAM_NAME);
(CreateInstantiateRequest) execution.getVariable(CREATE_INSTANTIATE_REQUEST_PARAM_NAME);
logger.info("request: {}", request);
- setJobStatus(execution, IN_PROGRESS,
+ addJobStatus(execution, IN_PROGRESS,
"Invoking SOL003 adapter for creating and instantiating VNF: " + request.getVnfName());
final CreateVnfRequest vnfRequest = new CreateVnfRequest();
logger.info("Vnf instantiation response: {}", vnfResponse);
execution.setVariable(CREATE_VNF_RESPONSE_PARAM_NAME, vnfResponse);
- setJobStatus(execution, IN_PROGRESS, "Successfully invoked SOL003 adapater creating and instantiating VNF: "
+ addJobStatus(execution, IN_PROGRESS, "Successfully invoked SOL003 adapater creating and instantiating VNF: "
+ request.getVnfName() + " CreaetVnfResponse Job Id: " + vnfResponse.getJobId());
logger.debug("Finished executing invokeCreateInstantiationRequest ...");
} catch (final Exception exception) {
updateNfInstanceStatus(execution, State.INSTANTIATED);
final CreateInstantiateRequest request =
(CreateInstantiateRequest) execution.getVariable(CREATE_INSTANTIATE_REQUEST_PARAM_NAME);
- setJobStatus(execution, FINISHED, "Successfully created and Instantiated VNF: " + request.getVnfName()
+ addJobStatus(execution, FINISHED, "Successfully created and Instantiated VNF: " + request.getVnfName()
+ " will set status to " + State.INSTANTIATED);
logger.info("Finished executing updateNfInstanceStatusToInstantiated ...");
updateNfInstanceStatus(execution, State.FAILED);
final CreateInstantiateRequest request =
(CreateInstantiateRequest) execution.getVariable(CREATE_INSTANTIATE_REQUEST_PARAM_NAME);
- setJobStatus(execution, ERROR, "Failed to create and instantiate VNF: " + request.getVnfName()
+ addJobStatus(execution, ERROR, "Failed to create and instantiate VNF: " + request.getVnfName()
+ " will set status to " + State.FAILED);
logger.info("Finished executing updateNfInstanceStatusToInstantiated ...");
private void updateNfInstanceStatus(final DelegateExecution execution, final State vnfStatus) {
final String nfInstId = (String) execution.getVariable(NF_INST_ID_PARAM_NAME);
-
final Optional<NfvoNfInst> optional = databaseServiceProvider.getNfvoNfInst(nfInstId);
if (optional.isEmpty()) {
final String message = "Unable to find NfvoNfInst record in database using nfInstId: " + nfInstId;
logger.error(message);
-
abortOperation(execution, message);
-
}
final NfvoNfInst nfvoNfInst = optional.get();
*/
package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.tasks;
+import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.DELETE_VNF_RESPONSE_PARAM_NAME;
+import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.NF_INST_ID_PARAM_NAME;
+import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.TERMINATE_VNF_VNFID_PARAM_NAME;
+import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum.ERROR;
+import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum.FINISHED;
+import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum.IN_PROGRESS;
+import java.util.Optional;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.DeleteVnfResponse;
import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.aai.AaiServiceProvider;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import java.util.Optional;
-import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.NF_INST_ID_PARAM_NAME;
-import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.DELETE_VNF_RESPONSE_PARAM_NAME;
-import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.TERMINATE_VNF_VNFID_PARAM_NAME;
-import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum.ERROR;
-import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum.FINISHED;
-import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum.IN_PROGRESS;
/**
* @author Andrew Lamb (andrew.a.lamb@est.tech)
logger.info("vnfId: {}", vnfId);
execution.setVariable(NF_INST_ID_PARAM_NAME, vnfId);
- setJobStatus(execution, JobStatusEnum.IN_PROGRESS,
+ addJobStatus(execution, JobStatusEnum.IN_PROGRESS,
"Checking if VNF Instance with id: " + vnfId + " exists in database.");
if (!databaseServiceProvider.isNfInstExists(vnfId)) {
abortOperation(execution,
final String vnfId = (String) execution.getVariable(TERMINATE_VNF_VNFID_PARAM_NAME);
try {
- setJobStatus(execution, IN_PROGRESS, "Invoking SOL003 adapter for terminating VNF with vnfId: " + vnfId);
+ addJobStatus(execution, IN_PROGRESS, "Invoking SOL003 adapter for terminating VNF with vnfId: " + vnfId);
final Optional<DeleteVnfResponse> optional = sol003AdapterServiceProvider.invokeTerminationRequest(vnfId);
logger.info("Vnf delete response: {}", vnfResponse);
execution.setVariable(DELETE_VNF_RESPONSE_PARAM_NAME, vnfResponse);
- setJobStatus(execution, IN_PROGRESS, "Successfully invoked SOL003 adapter terminate VNF with vnfId: "
+ addJobStatus(execution, IN_PROGRESS, "Successfully invoked SOL003 adapter terminate VNF with vnfId: "
+ vnfId + " DeleteVnfResponse Job Id: " + vnfResponse.getJobId());
logger.debug("Finished executing invokeTerminateRequest ...");
} catch (final Exception exception) {
final String vnfId = (String) execution.getVariable(TERMINATE_VNF_VNFID_PARAM_NAME);
try {
- setJobStatus(execution, IN_PROGRESS, "Deleting GenericVnf record from AAI for vnfId: " + vnfId);
+ addJobStatus(execution, IN_PROGRESS, "Deleting GenericVnf record from AAI for vnfId: " + vnfId);
aaiServiceProvider.deleteGenericVnf(vnfId);
} catch (final Exception exception) {
logger.info("Executing deleteNfInstanceFromDb");
final String vnfId = (String) execution.getVariable(TERMINATE_VNF_VNFID_PARAM_NAME);
- setJobStatus(execution, IN_PROGRESS, "Deleting NF Instance record from Database for vnfId: " + vnfId);
+ addJobStatus(execution, IN_PROGRESS, "Deleting NF Instance record from Database for vnfId: " + vnfId);
databaseServiceProvider.deleteNfvoNfInst(vnfId);
- setJobStatus(execution, FINISHED, "Successfully finished terminating VNF with vnfId: " + vnfId);
+ addJobStatus(execution, FINISHED, "Successfully finished terminating VNF with vnfId: " + vnfId);
logger.info("Finished executing deleteNfInstanceFromDb ...");
}
updateNfInstanceStatus(execution, State.TERMINATING);
final String vnfId = (String) execution.getVariable(TERMINATE_VNF_VNFID_PARAM_NAME);
- setJobStatus(execution, IN_PROGRESS,
+ addJobStatus(execution, IN_PROGRESS,
"Terminating VNF with vnfId: " + vnfId + " will set status to " + State.TERMINATING);
logger.info("Finished executing updateNfInstanceStatusToTerminating ...");
updateNfInstanceStatus(execution, State.NOT_INSTANTIATED);
final String vnfId = (String) execution.getVariable(TERMINATE_VNF_VNFID_PARAM_NAME);
- setJobStatus(execution, IN_PROGRESS,
+ addJobStatus(execution, IN_PROGRESS,
"Successfully terminated VNF with vnfId: " + vnfId + " will set status to " + State.NOT_INSTANTIATED);
logger.info("Finished executing updateNfInstanceStatusToInstantiated ...");
updateNfInstanceStatus(execution, State.FAILED);
final String vnfId = (String) execution.getVariable(TERMINATE_VNF_VNFID_PARAM_NAME);
- setJobStatus(execution, ERROR,
+ addJobStatus(execution, ERROR,
"Failed to terminate VNF with vnfId: " + vnfId + " will set status to " + State.FAILED);
logger.info("Finished executing updateNfInstanceStatusToFailed ...");
if (optional.isEmpty()) {
final String message = "Unable to find NfvoNfInst record in database using vnfId: " + vnfId;
logger.error(message);
-
abortOperation(execution, message);
-
}
final NfvoNfInst nfvoNfInst = optional.get();