use of org.onap.so.bpmn.infrastructure.workflow.tasks.Resource in project so by onap.
the class UpgradePreWorkflowValidatorTest method validateAAIVnfsNotSupported.
@Test
public void validateAAIVnfsNotSupported() throws JsonProcessingException {
ServiceInstancesRequest sir = new ServiceInstancesRequest();
sir.setRequestDetails(new RequestDetails());
sir.getRequestDetails().setModelInfo(new ModelInfo());
sir.getRequestDetails().getModelInfo().setModelUuid(UUID.randomUUID().toString());
String modelInvariantId = UUID.randomUUID().toString();
sir.getRequestDetails().getModelInfo().setModelInvariantId(modelInvariantId);
Resource serviceResource = new Resource(WorkflowType.SERVICE, "", false, null);
serviceResource.setModelInvariantId(modelInvariantId);
Resource vnfResource = new Resource(WorkflowType.VNF, "", false, serviceResource);
vnfResource.setVnfCustomizationId(UUID.randomUUID().toString());
Service service = new Service();
VnfResourceCustomization vnfCustomization = new VnfResourceCustomization();
vnfCustomization.setModelCustomizationUUID(UUID.randomUUID().toString());
service.setVnfCustomizations(Arrays.asList(vnfCustomization));
when(catalogDbClient.getServiceByModelUUID(anyString())).thenReturn(service);
BuildingBlockExecution execution = createExecution(sir, Arrays.asList(serviceResource, vnfResource));
Optional<String> message = validator.validate(execution);
assertTrue(message.isPresent());
assertTrue(message.get().startsWith("Existing vnfs in AAI are not supported by service model"));
}
use of org.onap.so.bpmn.infrastructure.workflow.tasks.Resource in project so by onap.
the class SkipCDSBuildingBlockListenerTest method before.
@Before
public void before() {
executeBuildingBlock = new ExecuteBuildingBlock();
buildingBlock = new BuildingBlock();
ArrayList<Resource> resources = new ArrayList<>();
Resource service = new Resource(WorkflowType.SERVICE, SERVICE_MODEL_VERSION_ID, false, null);
service.setModelVersionId(SERVICE_MODEL_VERSION_ID);
resources.add(service);
Resource vnf = new Resource(WorkflowType.VNF, VNF_MODEL_CUSTOMIZATION_ID, false, null);
vnf.setModelCustomizationId(VNF_MODEL_CUSTOMIZATION_ID);
resources.add(vnf);
Resource vfModule = new Resource(WorkflowType.VFMODULE, VF_MODULE_CUSTOMIZATION_ID, false, null);
vfModule.setModelCustomizationId(VF_MODULE_CUSTOMIZATION_ID);
resources.add(vfModule);
Resource pnf = new Resource(WorkflowType.PNF, PNF_CUSTOMIZATION_ID, false, null);
pnf.setModelCustomizationId(PNF_CUSTOMIZATION_ID);
resources.add(pnf);
buildingBlockExecution.setVariable("resources", resources);
vnfCust = new VnfResourceCustomization();
vfCust = new VfModuleCustomization();
pnfResourceCustomization = new PnfResourceCustomization();
}
use of org.onap.so.bpmn.infrastructure.workflow.tasks.Resource in project so by onap.
the class UserParamsServiceTraversal method setVolumeGroupWorkFlowTypeToResourceList.
private void setVolumeGroupWorkFlowTypeToResourceList(List<Resource> resourceList, Resource vnfResource, VfModuleCustomization vfModuleCustomization) {
if (vfModuleCustomization.getVfModule().getVolumeHeatTemplate() != null && vfModuleCustomization.getVolumeHeatEnv() != null) {
foundVfModuleOrVG = true;
resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, vfModuleCustomization.getModelCustomizationUUID(), false, vnfResource));
}
}
use of org.onap.so.bpmn.infrastructure.workflow.tasks.Resource in project so by onap.
the class UserParamsServiceTraversal method setVfModuleWorkFlowTypeToResourceList.
private Resource setVfModuleWorkFlowTypeToResourceList(List<Resource> resourceList, Resource vnfResource, VfModuleCustomization vfModuleCustomization, VfModules vfModule) {
Resource resource = new Resource(WorkflowType.VFMODULE, vfModuleCustomization.getModelCustomizationUUID(), false, vnfResource);
resource.setProcessingPriority(vfModule.getProcessingPriority());
resource.setBaseVfModule(vfModuleCustomization.getVfModule().getIsBase() != null && vfModuleCustomization.getVfModule().getIsBase());
resource.setInstanceName(vfModule.getInstanceName());
resourceList.add(resource);
return resource;
}
use of org.onap.so.bpmn.infrastructure.workflow.tasks.Resource in project so by onap.
the class UserParamsServiceTraversal method setResourceListForNetworks.
private void setResourceListForNetworks(DelegateExecution execution, String serviceModelVersionId, String requestAction, List<Resource> resourceList, Resource serviceResource, Service validate) {
for (Networks network : validate.getResources().getNetworks()) {
Resource networkResource = new Resource(WorkflowType.NETWORK, network.getModelInfo().getModelCustomizationId(), false, serviceResource);
networkResource.setProcessingPriority(network.getProcessingPriority());
ModelInfo modelInfo = network.getModelInfo();
if (modelInfo != null) {
networkResource.setModelCustomizationId(modelInfo.getModelCustomizationUuid());
networkResource.setModelVersionId(modelInfo.getModelVersionId());
}
resourceList.add(networkResource);
}
if (requestAction.equals(CREATE_INSTANCE)) {
String networkColCustId = queryCatalogDbForNetworkCollection(execution, serviceModelVersionId);
if (networkColCustId != null) {
resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, networkColCustId, false, serviceResource));
}
}
}
Aggregations