Search in sources :

Example 66 with ModelInfo

use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.

the class BpmnRequestBuilder method mapVolumeGroupModelInformation.

protected ModelInfo mapVolumeGroupModelInformation(VolumeGroup volumeGroup) {
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setModelCustomizationId(volumeGroup.getModelCustomizationId());
    modelInfo.setModelCustomizationUuid(volumeGroup.getModelCustomizationId());
    modelInfo.setModelType(ModelType.volumeGroup);
    return modelInfo;
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo)

Example 67 with ModelInfo

use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.

the class SkipConfigVnfListenerTest method createExecuteBuildingBlock.

private ExecuteBuildingBlock createExecuteBuildingBlock() {
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setModelUuid(MODEL_UUID);
    RequestDetails requestDetails = new RequestDetails();
    requestDetails.setModelInfo(modelInfo);
    ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
    BuildingBlock buildingBlock = new BuildingBlock();
    buildingBlock.setKey(VNF_CUSTOMIZATION_UUID);
    executeBuildingBlock.setBuildingBlock(buildingBlock);
    executeBuildingBlock.setRequestDetails(requestDetails);
    return executeBuildingBlock;
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) BuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails)

Example 68 with ModelInfo

use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.

the class UpgradePreWorkflowValidatorTest method validateModelInvariantMismatch.

@Test
public void validateModelInvariantMismatch() throws JsonProcessingException {
    ServiceInstancesRequest sir = new ServiceInstancesRequest();
    sir.setRequestDetails(new RequestDetails());
    sir.getRequestDetails().setModelInfo(new ModelInfo());
    sir.getRequestDetails().getModelInfo().setModelInvariantId(UUID.randomUUID().toString());
    Resource serviceResource = new Resource(WorkflowType.SERVICE, "", false, null);
    String aaiModelInvariantId = UUID.randomUUID().toString();
    serviceResource.setModelInvariantId(aaiModelInvariantId);
    BuildingBlockExecution execution = createExecution(sir, Arrays.asList(serviceResource));
    Optional<String> message = validator.validate(execution);
    assertTrue(message.isPresent());
    assertTrue(message.get().startsWith("Request service modelInvariantId"));
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) BuildingBlockExecution(org.onap.so.bpmn.common.BuildingBlockExecution) Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) Test(org.junit.Test)

Example 69 with ModelInfo

use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.

the class UpgradePreWorkflowValidatorTest method validateNoVnfsInAAI.

@Test
public void validateNoVnfsInAAI() throws JsonProcessingException {
    ServiceInstancesRequest sir = new ServiceInstancesRequest();
    sir.setRequestDetails(new RequestDetails());
    sir.getRequestDetails().setModelInfo(new ModelInfo());
    String modelInvariantId = UUID.randomUUID().toString();
    sir.getRequestDetails().getModelInfo().setModelInvariantId(modelInvariantId);
    Resource serviceResource = new Resource(WorkflowType.SERVICE, "", false, null);
    serviceResource.setModelInvariantId(modelInvariantId);
    BuildingBlockExecution execution = createExecution(sir, Arrays.asList(serviceResource));
    Optional<String> message = validator.validate(execution);
    assertThat(message).isEmpty();
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) BuildingBlockExecution(org.onap.so.bpmn.common.BuildingBlockExecution) Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) Test(org.junit.Test)

Example 70 with ModelInfo

use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.

the class WorkflowActionBBTasksTest method select2BBTest.

@Test
public void select2BBTest() {
    String vnfCustomizationUUID = "1234567";
    String modelUuid = "1234567";
    prepareDelegateExecution();
    List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
    BuildingBlock buildingBlock = new BuildingBlock().setBpmnFlowName("ConfigDeployVnfBB").setKey(vnfCustomizationUUID);
    RequestDetails rd = new RequestDetails();
    ModelInfo mi = new ModelInfo();
    mi.setModelUuid(modelUuid);
    rd.setModelInfo(mi);
    ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock).setRequestDetails(rd);
    ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
    flowsToExecute.add(ebb);
    List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>();
    VnfResourceCustomization vrc = new VnfResourceCustomization();
    vrc.setSkipPostInstConf(false);
    vrc.setModelCustomizationUUID(vnfCustomizationUUID);
    vnfResourceCustomizations.add(vrc);
    GenericVnf genericVnf = new GenericVnf();
    genericVnf.setModelCustomizationId(vnfCustomizationUUID);
    doReturn(vnfResourceCustomizations).when(catalogDbClient).getVnfResourceCustomizationByModelUuid(modelUuid);
    doReturn(vrc).when(catalogDbClient).findVnfResourceCustomizationInList(vnfCustomizationUUID, vnfResourceCustomizations);
    flowsToExecute.add(ebb2);
    execution.setVariable("flowsToExecute", flowsToExecute);
    workflowActionBBTasks.selectBB(execution);
    boolean success = (boolean) execution.getVariable("completed");
    int currentSequence = (int) execution.getVariable("gCurrentSequence");
    assertFalse(success);
    assertEquals(1, currentSequence);
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) BuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock) GenericVnf(org.onap.aai.domain.yang.GenericVnf) ArrayList(java.util.ArrayList) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) VnfResourceCustomization(org.onap.so.db.catalog.beans.VnfResourceCustomization) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Aggregations

ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)84 Test (org.junit.Test)46 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)35 Service (org.onap.so.db.catalog.beans.Service)30 HashMap (java.util.HashMap)18 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)18 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)17 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)17 RelatedInstanceList (org.onap.so.serviceinstancebeans.RelatedInstanceList)15 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)14 RelatedInstance (org.onap.so.serviceinstancebeans.RelatedInstance)14 ServiceInstancesRequest (org.onap.so.serviceinstancebeans.ServiceInstancesRequest)14 VnfResourceCustomization (org.onap.so.db.catalog.beans.VnfResourceCustomization)12 RequestInfo (org.onap.so.serviceinstancebeans.RequestInfo)12 ServiceModel (org.onap.so.bpmn.servicedecomposition.entities.ServiceModel)11 CloudConfiguration (org.onap.so.serviceinstancebeans.CloudConfiguration)11 File (java.io.File)10 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)10 VolumeGroup (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup)10 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)10