Search in sources :

Example 1 with GenericVnfNotFoundException

use of org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.exception.GenericVnfNotFoundException in project so by onap.

the class MonitorVnfmNodeTask method getNodeStatus.

/**
 * Check the final status of vnf in A&AI
 *
 * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
 */
public void getNodeStatus(final BuildingBlockExecution execution) {
    try {
        LOGGER.debug("Executing getNodeStatus  ...");
        final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
        final String vnfId = vnf.getVnfId();
        LOGGER.debug("Query A&AI for generic VNF using vnfID: {}", vnfId);
        final Optional<GenericVnf> aaiGenericVnfOptional = aaiVnfResources.getGenericVnf(vnfId);
        if (!aaiGenericVnfOptional.isPresent()) {
            throw new GenericVnfNotFoundException("Unable to find generic vnf in A&AI using vnfID: " + vnfId);
        }
        final GenericVnf genericVnf = aaiGenericVnfOptional.get();
        final String orchestrationStatus = genericVnf.getOrchestrationStatus();
        LOGGER.debug("Found generic vnf with orchestration status : {}", orchestrationStatus);
        execution.setVariable(getNodeStatusVariableName(), isOrchestrationStatusValid(orchestrationStatus));
    } catch (final Exception exception) {
        LOGGER.error("Unable to get vnf from AAI", exception);
        exceptionUtil.buildAndThrowWorkflowException(execution, 1220, exception);
    }
}
Also used : GenericVnf(org.onap.aai.domain.yang.GenericVnf) GenericVnfNotFoundException(org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.exception.GenericVnfNotFoundException) GenericVnfNotFoundException(org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.exception.GenericVnfNotFoundException)

Aggregations

GenericVnf (org.onap.aai.domain.yang.GenericVnf)1 GenericVnfNotFoundException (org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.exception.GenericVnfNotFoundException)1