use of org.onap.aai.domain.yang.VolumeGroups in project so by onap.
the class AAIDataRetrievalTest method getVolumeGroupsOfVnfTest.
@Test
public void getVolumeGroupsOfVnfTest() throws Exception {
VolumeGroups volumeGroups = getVolumeGroups();
AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")).relatedTo(Types.VOLUME_GROUPS.getFragment());
doReturn(Optional.of(volumeGroups)).when(aaiResourcesClient).get(VolumeGroups.class, uri);
List<VolumeGroup> volumeGroupList = aaiDataRetrieval.getVolumeGroupsOfVnf("vnfId");
assertEquals("vg1", volumeGroupList.get(0).getVolumeGroupId());
Optional<String> volumeGroupIds = aaiDataRetrieval.getVolumeGroupIdsByVnfId("vnfId");
assertEquals(Optional.of("vg1,vg2"), volumeGroupIds);
}
use of org.onap.aai.domain.yang.VolumeGroups in project so by onap.
the class BBInputSetupUtilsTest method getRelatedVolumeGroupFromVfModuleMultipleVolumeGroupsExceptionTest.
@Test
public void getRelatedVolumeGroupFromVfModuleMultipleVolumeGroupsExceptionTest() throws Exception {
expectedException.expect(Exception.class);
final String vnfId = "vnfId";
final String volumeGroupId = "volumeGroupId";
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId("id123");
volumeGroup.setVolumeGroupName("name123");
VolumeGroups expectedVolumeGroup = new VolumeGroups();
expectedVolumeGroup.getVolumeGroup().add(volumeGroup);
expectedVolumeGroup.getVolumeGroup().add(volumeGroup);
doReturn(expectedVolumeGroup).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class));
bbInputSetupUtils.getRelatedVolumeGroupFromVfModule(vnfId, volumeGroupId);
}
use of org.onap.aai.domain.yang.VolumeGroups in project so by onap.
the class AAIDataRetrieval method getVolumeGroupsOfVnf.
public List<VolumeGroup> getVolumeGroupsOfVnf(String vnfId) {
List<VolumeGroup> volumeGroupList = new ArrayList<VolumeGroup>();
AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).relatedTo(Types.VOLUME_GROUPS.getFragment());
Optional<VolumeGroups> volumeGroups = getAaiResourcesClient().get(VolumeGroups.class, uri);
if (!volumeGroups.isPresent() || volumeGroups.get().getVolumeGroup().isEmpty()) {
logger.debug("No VolumeGroups attached to Vnf in AAI : {}", vnfId);
} else {
volumeGroupList = volumeGroups.get().getVolumeGroup();
}
return volumeGroupList;
}
use of org.onap.aai.domain.yang.VolumeGroups in project so by onap.
the class AAIDataRetrievalTest method getVolumeGroupsOfVnfWhenNoneTest.
@Test
public void getVolumeGroupsOfVnfWhenNoneTest() throws Exception {
VolumeGroups volumeGroups = new VolumeGroups();
AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")).relatedTo(Types.VOLUME_GROUPS.getFragment());
doReturn(Optional.of(volumeGroups)).when(aaiResourcesClient).get(VolumeGroups.class, uri);
List<VolumeGroup> volumeGroupList = aaiDataRetrieval.getVolumeGroupsOfVnf("vnfId");
assertEquals(true, volumeGroupList.isEmpty());
Optional<String> volumeGroupIds = aaiDataRetrieval.getVolumeGroupIdsByVnfId("vnfId");
assertEquals(false, volumeGroupIds.isPresent());
}
use of org.onap.aai.domain.yang.VolumeGroups in project so by onap.
the class AAIDataRetrievalTest method getVolumeGroups.
private VolumeGroups getVolumeGroups() {
VolumeGroup volumeGroup1 = new VolumeGroup();
volumeGroup1.setVolumeGroupId("vg1");
VolumeGroup volumeGroup2 = new VolumeGroup();
volumeGroup2.setVolumeGroupId("vg2");
VolumeGroups volumeGroups = new VolumeGroups();
volumeGroups.getVolumeGroup().add(volumeGroup1);
volumeGroups.getVolumeGroup().add(volumeGroup2);
return volumeGroups;
}
Aggregations