use of org.onap.so.bpmn.infrastructure.workflow.tasks.Resource in project so by onap.
the class VnfEBBLoader method findVnfWithGivenIdAndAddCustomizationUUID.
private void findVnfWithGivenIdAndAddCustomizationUUID(ServiceInstance serviceInstanceMSO, String vnfId, List<Pair<WorkflowType, String>> aaiResourceIds, List<Resource> resourceList, Resource serviceResource, DelegateExecution execution) {
for (GenericVnf vnf : serviceInstanceMSO.getVnfs()) {
if (vnf.getVnfId().equals(vnfId)) {
aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId()));
org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId);
Resource vnfResource = new Resource(WorkflowType.VNF, aaiGenericVnf.getModelCustomizationId(), false, serviceResource);
vnfResource.setModelCustomizationId(aaiGenericVnf.getModelCustomizationId());
vnfResource.setModelVersionId(aaiGenericVnf.getModelVersionId());
resourceList.add(vnfResource);
processVfModules(vnf, aaiResourceIds, resourceList, vnfResource, execution);
processVolumeGroups(vnf, aaiResourceIds, resourceList, vnfResource);
break;
}
}
}
use of org.onap.so.bpmn.infrastructure.workflow.tasks.Resource in project so by onap.
the class VnfEBBLoader method addConfigToResources.
private void addConfigToResources(Optional<Relationships> relationshipsOp, List<Resource> resourceList, Resource vfModuleResource, List<Pair<WorkflowType, String>> aaiResourceIds) {
if (relationshipsOp.isPresent()) {
Optional<Configuration> config = workflowActionUtils.extractRelationshipsConfiguration(relationshipsOp.get());
if (config.isPresent()) {
aaiResourceIds.add(new Pair<>(WorkflowType.CONFIGURATION, config.get().getConfigurationId()));
resourceList.add(new Resource(WorkflowType.CONFIGURATION, config.get().getConfigurationId(), false, vfModuleResource));
}
}
}
use of org.onap.so.bpmn.infrastructure.workflow.tasks.Resource in project so by onap.
the class ServiceEBBLoader method traverseNetworkCollectionResourceCustomization.
private void traverseNetworkCollectionResourceCustomization(List<Resource> resourceList, Resource serviceResource, CollectionResourceCustomization collectionResourceCustomization) {
if (collectionResourceCustomizationShouldNotBeProcessed(resourceList, serviceResource, collectionResourceCustomization))
return;
int minNetworks = 0;
org.onap.so.db.catalog.beans.InstanceGroup instanceGroup = collectionResourceCustomization.getCollectionResource().getInstanceGroup();
CollectionResourceInstanceGroupCustomization collectionInstCust = null;
if (!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) {
for (CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup.getCollectionInstanceGroupCustomizations()) {
if (collectionInstanceGroupTemp.getModelCustomizationUUID().equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) {
collectionInstCust = collectionInstanceGroupTemp;
break;
}
}
if (interfaceNetworkQuantityIsAvailableInCollection(collectionInstCust)) {
minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
}
}
logger.debug("minNetworks: {}", minNetworks);
CollectionNetworkResourceCustomization collectionNetworkResourceCust = getCollectionNetworkResourceCustomization(collectionResourceCustomization, instanceGroup);
for (int i = 0; i < minNetworks; i++) {
if (collectionNetworkResourceCust != null) {
Resource resource = new Resource(WorkflowType.VIRTUAL_LINK, collectionNetworkResourceCust.getModelCustomizationUUID(), false, serviceResource);
resource.setVirtualLinkKey(Integer.toString(i));
resourceList.add(resource);
}
}
}
use of org.onap.so.bpmn.infrastructure.workflow.tasks.Resource in project so by onap.
the class ServiceEBBLoader method collectionResourceCustomizationShouldNotBeProcessed.
private boolean collectionResourceCustomizationShouldNotBeProcessed(List<Resource> resourceList, Resource serviceResource, CollectionResourceCustomization collectionResourceCustomization) {
if (collectionResourceCustomization == null) {
logger.debug("No Network Collection Customization found");
return true;
}
resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, collectionResourceCustomization.getModelCustomizationUUID(), false, serviceResource));
logger.debug("Found a network collection");
if (collectionResourceCustomization.getCollectionResource() == null) {
logger.debug("No Network Collection found. collectionResource is null");
return true;
}
if (collectionResourceCustomization.getCollectionResource().getInstanceGroup() == null) {
logger.debug("No Instance Group found for network collection.");
return true;
}
String toscaNodeType = collectionResourceCustomization.getCollectionResource().getInstanceGroup().getToscaNodeType();
if (!toscaNodeTypeHasNetworkCollection(toscaNodeType)) {
logger.debug("Instance Group tosca node type does not contain NetworkCollection: {}", toscaNodeType);
return true;
}
return false;
}
use of org.onap.so.bpmn.infrastructure.workflow.tasks.Resource in project so by onap.
the class ServiceEBBLoader method traverseAAIService.
public void traverseAAIService(DelegateExecution execution, List<Resource> resourceList, String resourceId, List<Pair<WorkflowType, String>> aaiResourceIds) {
try {
ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(resourceId);
org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = bbInputSetup.getExistingServiceInstance(serviceInstanceAAI);
var serviceResource = new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false, null);
serviceResource.setModelInvariantId(serviceInstanceAAI.getModelInvariantId());
serviceResource.setModelVersionId(serviceInstanceAAI.getModelVersionId());
resourceList.add(serviceResource);
traverseServiceInstanceMSOVnfs(resourceList, serviceResource, aaiResourceIds, serviceInstanceMSO);
traverseServiceInstanceMSOPnfs(resourceList, serviceResource, aaiResourceIds, serviceInstanceMSO);
if (serviceInstanceMSO.getNetworks() != null) {
for (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network : serviceInstanceMSO.getNetworks()) {
aaiResourceIds.add(new Pair<>(WorkflowType.NETWORK, network.getNetworkId()));
Resource networkResource = new Resource(WorkflowType.NETWORK, network.getNetworkId(), false, serviceResource);
ModelInfoNetwork modelInfoNetwork = network.getModelInfoNetwork();
if (modelInfoNetwork != null) {
networkResource.setModelCustomizationId(modelInfoNetwork.getModelCustomizationUUID());
networkResource.setModelVersionId(modelInfoNetwork.getModelUUID());
networkResource.setModelCustomizationId(modelInfoNetwork.getModelCustomizationUUID());
}
resourceList.add(networkResource);
}
}
if (serviceInstanceMSO.getCollection() != null) {
logger.debug("found networkcollection");
aaiResourceIds.add(new Pair<>(WorkflowType.NETWORKCOLLECTION, serviceInstanceMSO.getCollection().getId()));
resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, serviceInstanceMSO.getCollection().getId(), false, serviceResource));
}
if (serviceInstanceMSO.getConfigurations() != null) {
for (Configuration config : serviceInstanceMSO.getConfigurations()) {
Optional<org.onap.aai.domain.yang.Configuration> aaiConfig = aaiConfigurationResources.getConfiguration(config.getConfigurationId());
if (aaiConfig.isPresent() && aaiConfig.get().getRelationshipList() != null) {
for (Relationship relationship : aaiConfig.get().getRelationshipList().getRelationship()) {
if (relationship.getRelatedTo().contains("vnfc") || relationship.getRelatedTo().contains("vpn-binding")) {
aaiResourceIds.add(new Pair<>(WorkflowType.CONFIGURATION, config.getConfigurationId()));
resourceList.add(new Resource(WorkflowType.CONFIGURATION, config.getConfigurationId(), false, serviceResource));
break;
}
}
}
}
}
} catch (Exception ex) {
logger.error("Exception in traverseAAIService", ex);
buildAndThrowException(execution, "Could not find existing Service Instance or related Instances to execute the request on.");
}
}
Aggregations