use of org.onap.aai.domain.yang.GenericVnf 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);
}
}
use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class BpmnRequestBuilder method buildVFModuleDeleteRequest.
public ServiceInstancesRequest buildVFModuleDeleteRequest(String vnfId, String vfModuleId, ModelType modelType) throws AAIEntityNotFound {
GenericVnf vnf = aaiDataRet.getGenericVnf(vnfId);
if (vnf == null) {
throw new AAIEntityNotFound(GENERIC_VNF_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId);
}
VfModule vfModule = aaiDataRet.getAAIVfModule(vnfId, vfModuleId);
if (vfModule == null) {
throw new AAIEntityNotFound(VF_MODULE_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId + " vfModuleId: " + vfModuleId);
}
return createServiceInstancesRequest(vnf, vfModule, modelType);
}
use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class BpmnRequestBuilder method buildVolumeGroupDeleteRequest.
public ServiceInstancesRequest buildVolumeGroupDeleteRequest(String vnfId, String volumeGroupId) throws AAIEntityNotFound {
GenericVnf vnf = aaiDataRet.getGenericVnf(vnfId);
if (vnf == null) {
throw new AAIEntityNotFound(GENERIC_VNF_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId);
}
VolumeGroup volumeGroup = aaiDataRet.getVolumeGroup(vnfId, volumeGroupId);
if (volumeGroup == null) {
throw new AAIEntityNotFound(VF_MODULE_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId + " volumeGroupId: " + volumeGroupId);
}
return createServiceInstancesRequest(vnf, volumeGroup);
}
use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class AaiResourceIdValidator method validateVnfResourceIdInAAI.
protected String validateVnfResourceIdInAAI(String generatedResourceId, String instanceName, RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws DuplicateNameException {
Optional<GenericVnf> vnf = bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(workflowResourceIds.getServiceInstanceId(), instanceName);
if (vnf.isPresent()) {
if (vnf.get().getModelCustomizationId().equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) {
return vnf.get().getVnfId();
} else {
throw new DuplicateNameException("generic-vnf", String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, instanceName, vnf.get().getModelCustomizationId()));
}
}
GenericVnfs vnfs = bbInputSetupUtils.getAAIVnfsGloballyByName(instanceName);
if (vnfs != null) {
throw new DuplicateNameException("generic-vnf", String.format(NAME_EXISTS_WITH_DIFF_PARENT, instanceName, vnfs.getGenericVnf().get(0).getVnfId()));
}
return generatedResourceId;
}
use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class ServiceEBBLoader method traverseServiceInstanceMSOVnfs.
private void traverseServiceInstanceMSOVnfs(List<Resource> resourceList, Resource serviceResource, List<Pair<WorkflowType, String>> aaiResourceIds, org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO) {
if (serviceInstanceMSO.getVnfs() == null) {
return;
}
for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO.getVnfs()) {
aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId()));
GenericVnf genericVnf = bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId());
Resource vnfResource = new Resource(WorkflowType.VNF, vnf.getVnfId(), false, serviceResource);
vnfResource.setVnfCustomizationId(genericVnf.getModelCustomizationId());
vnfResource.setModelCustomizationId(genericVnf.getModelCustomizationId());
vnfResource.setModelVersionId(genericVnf.getModelVersionId());
resourceList.add(vnfResource);
traverseVnfModules(resourceList, vnfResource, aaiResourceIds, vnf);
if (vnf.getVolumeGroups() != null) {
for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf.getVolumeGroups()) {
aaiResourceIds.add(new Pair<>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId()));
resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false, vnfResource));
}
}
}
}
Aggregations