use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.
the class BBInputSetupUtilsTest method getRelatedVolumeGroupByNameFromVnfTest.
@Test
public void getRelatedVolumeGroupByNameFromVnfTest() throws Exception {
final String vnfId = "vnf-id123";
final String volumeGroupId = "id123";
final String volumeGroupName = "volume-group-name123";
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId(volumeGroupId);
volumeGroup.setVolumeGroupName(volumeGroupName);
doReturn(Optional.of(volumeGroup)).when(MOCK_aaiResourcesClient).getOne(VolumeGroups.class, VolumeGroup.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).relatedTo(Types.VOLUME_GROUPS.getFragment()).queryParam("volume-group-name", volumeGroupName));
Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, volumeGroupName);
assertEquals(volumeGroup.getVolumeGroupId(), actual.get().getVolumeGroupId());
}
use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.
the class AaiResourceIdValidatorTest method validateVolumeGroupResourceIdInAAIDifferentModelCustIdTest.
@Test
public void validateVolumeGroupResourceIdInAAIDifferentModelCustIdTest() throws Exception {
RequestDetails reqDetails = setupRequestDetails();
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setVnfId("vnfId123");
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupName("name123");
volumeGroup.setVfModuleModelCustomizationId("9999999");
Optional<VolumeGroup> opVolumeGroup = Optional.of(volumeGroup);
when(bbInputSetupUtilsMock.getRelatedVolumeGroupByNameFromVnf("vnfId123", "name123")).thenReturn(opVolumeGroup);
this.expectedException.expect(DuplicateNameException.class);
this.expectedException.expectMessage(containsString("volumeGroup with name name123 already exists. The name must be unique."));
testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "name123", reqDetails, workflowResourceIds);
}
use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.
the class WorkflowActionTest method selectExecutionListALaCarteVfModuleKeepVolumeGroupReplaceTest.
@Test
public void selectExecutionListALaCarteVfModuleKeepVolumeGroupReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "VfModule";
String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri", "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
execution.setVariable("vfModuleId", "1234");
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId("volumeGroupId");
doReturn(Optional.of(volumeGroup)).when(bbSetupUtils).getRelatedVolumeGroupFromVfModule("b80b16a5-f80d-4ffa-91c8-bd47c7438a3d", "1234");
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
vfModuleCustomization.setVolumeHeatEnv(new HeatEnvironment());
org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule();
vfModule.setVolumeHeatTemplate(new HeatTemplate());
vfModuleCustomization.setVfModule(vfModule);
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("9a6d01fd-19a7-490a-9800-460830a12e0b")).thenReturn(vfModuleCustomization);
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
northBoundRequest.setOrchestrationFlowList(replaceVfModuleOrchFlows);
when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "DeactivateVfModuleBB", "DeleteVfModuleATTBB", "UnassignVFModuleBB", "AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ChangeModelVnfBB", "ChangeModelServiceInstanceBB");
}
use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.
the class WorkflowActionTest method selectExecutionListALaCarteVfModuleVolumeGroupToNoVolumeGroupReplaceTest.
@Test
public void selectExecutionListALaCarteVfModuleVolumeGroupToNoVolumeGroupReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "VfModule";
String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri", "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
execution.setVariable("vfModuleId", "1234");
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId("volumeGroupId");
doReturn(Optional.of(volumeGroup)).when(bbSetupUtils).getRelatedVolumeGroupFromVfModule("b80b16a5-f80d-4ffa-91c8-bd47c7438a3d", "1234");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
northBoundRequest.setOrchestrationFlowList(replaceVfModuleOrchFlows);
when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "DeactivateVfModuleBB", "DeleteVfModuleATTBB", "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "UnassignVFModuleBB", "UnassignVolumeGroupBB", "AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ChangeModelVnfBB", "ChangeModelServiceInstanceBB");
}
use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.
the class WorkflowActionTest method selectExecutionListALaCarteVfModuleVolumeGroupToNoVolumeGroupReplaceRetainAssignmentsTest.
@Test
public void selectExecutionListALaCarteVfModuleVolumeGroupToNoVolumeGroupReplaceRetainAssignmentsTest() throws Exception {
String gAction = "replaceInstanceRetainAssignments";
String resource = "VfModule";
String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri", "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
execution.setVariable("vfModuleId", "1234");
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId("volumeGroupId");
doReturn(Optional.of(volumeGroup)).when(bbSetupUtils).getRelatedVolumeGroupFromVfModule("b80b16a5-f80d-4ffa-91c8-bd47c7438a3d", "1234");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
northBoundRequest.setOrchestrationFlowList(replaceRetainAssignmentsVfModuleOrchFlows);
when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "DeactivateVfModuleBB", "DeleteVfModuleATTBB", "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "UnassignVolumeGroupBB", "ChangeModelVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ChangeModelVnfBB", "ChangeModelServiceInstanceBB");
}
Aggregations