use of org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup in project so by onap.
the class AAIVolumeGroupResources method updateHeatStackIdVolumeGroup.
public void updateHeatStackIdVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()).volumeGroup(volumeGroup.getVolumeGroupId()));
VolumeGroup copiedVolumeGroup = volumeGroup.shallowCopyId();
copiedVolumeGroup.setHeatStackId(volumeGroup.getHeatStackId());
injectionHelper.getAaiClient().update(uri, aaiObjectMapper.mapVolumeGroup(copiedVolumeGroup));
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup in project so by onap.
the class VnfAdapterObjectMapperTest method test_createVolumeGroupParams_with_user_params.
@Test
public void test_createVolumeGroupParams_with_user_params() throws Exception {
GenericVnf genericVnf = new GenericVnf();
genericVnf.setVnfId("vnfId");
genericVnf.setVnfName("vnfName");
RequestContext requestContext = new RequestContext();
Map<String, Object> userParamsMap = new HashMap<>();
userParamsMap.put("name", "userParamKey");
userParamsMap.put("value", "userParamValue");
List<Map<String, Object>> userParams = new ArrayList<>();
userParams.add(userParamsMap);
RequestParameters requestParameters = new RequestParameters();
requestParameters.setUserParams(userParams);
requestContext.setRequestParameters(requestParameters);
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId("volumeGroupId");
volumeGroup.setVolumeGroupName("volumeGroupName");
String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json")));
Map<String, String> expectedVolumeGroupParams = new HashMap<>();
expectedVolumeGroupParams.put("vnf_id", genericVnf.getVnfId());
expectedVolumeGroupParams.put("vnf_name", genericVnf.getVnfName());
expectedVolumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId());
expectedVolumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName());
expectedVolumeGroupParams.put("paramOne", "paramOneValue");
expectedVolumeGroupParams.put("paramTwo", "paramTwoValue");
expectedVolumeGroupParams.put("paramThree", "paramThreeValue");
expectedVolumeGroupParams.put("userParamKey", "userParamValue");
Map<String, Object> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext, genericVnf, volumeGroup, sdncVfModuleQueryResponse);
assertEquals(expectedVolumeGroupParams, actualVolumeGroupParams);
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup in project so by onap.
the class VnfAdapterObjectMapperTest method test_createVolumeGroupRequestMapper_for_alaCarte_flow.
@Test
public void test_createVolumeGroupRequestMapper_for_alaCarte_flow() throws Exception {
RequestContext requestContext = new RequestContext();
requestContext.setMsoRequestId("msoRequestId");
ServiceInstance serviceInstance = new ServiceInstance();
serviceInstance.setServiceInstanceId("serviceInstanceId");
ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
modelInfoServiceInstance.setModelVersion("modelVersion");
serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
GenericVnf genericVnf = new GenericVnf();
genericVnf.setVnfId("vnfId");
genericVnf.setVnfName("vnfName");
genericVnf.setVnfType("vnfType");
serviceInstance.getVnfs().add(genericVnf);
ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
modelInfoVfModule.setModelName("modelName");
modelInfoVfModule.setModelCustomizationUUID("modelCustomizationUUID");
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId("volumeGroupId");
volumeGroup.setVolumeGroupName("volumeGroupName");
volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
volumeGroup.setModelInfoVfModule(modelInfoVfModule);
serviceInstance.getVnfs().get(0).getVolumeGroups().add(volumeGroup);
CloudRegion cloudRegion = new CloudRegion();
cloudRegion.setLcpCloudRegionId("lcpCloudRegionId");
cloudRegion.setTenantId("tenantId");
OrchestrationContext orchestrationContext = new OrchestrationContext();
orchestrationContext.setIsRollbackEnabled(true);
CreateVolumeGroupRequest expectedCreateVolumeGroupRequest = new CreateVolumeGroupRequest();
expectedCreateVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
expectedCreateVolumeGroupRequest.setTenantId(cloudRegion.getTenantId());
expectedCreateVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId());
expectedCreateVolumeGroupRequest.setVolumeGroupName(volumeGroup.getVolumeGroupName());
expectedCreateVolumeGroupRequest.setVnfType(genericVnf.getVnfType());
expectedCreateVolumeGroupRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion());
expectedCreateVolumeGroupRequest.setVfModuleType(volumeGroup.getModelInfoVfModule().getModelName());
expectedCreateVolumeGroupRequest.setModelCustomizationUuid(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID());
Map<String, Object> volumeGroupParams = new HashMap<>();
volumeGroupParams.put("vnf_id", genericVnf.getVnfId());
volumeGroupParams.put("vnf_name", genericVnf.getVnfName());
volumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId());
volumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName());
expectedCreateVolumeGroupRequest.setVolumeGroupParams(volumeGroupParams);
expectedCreateVolumeGroupRequest.setSkipAAI(true);
expectedCreateVolumeGroupRequest.setSuppressBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled()));
expectedCreateVolumeGroupRequest.setFailIfExists(false);
MsoRequest msoRequest = new MsoRequest();
msoRequest.setRequestId(requestContext.getMsoRequestId());
msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
expectedCreateVolumeGroupRequest.setMsoRequest(msoRequest);
expectedCreateVolumeGroupRequest.setMessageId("messageId");
expectedCreateVolumeGroupRequest.setNotificationUrl("endpoint/VNFAResponse/messageId");
doReturn("endpoint/").when(vnfAdapterObjectMapper).getProperty(isA(String.class));
doReturn("messageId").when(vnfAdapterObjectMapper).getRandomUuid();
CreateVolumeGroupRequest actualCreateVolumeGroupRequest = vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, null);
assertThat(actualCreateVolumeGroupRequest, sameBeanAs(expectedCreateVolumeGroupRequest));
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup in project so by onap.
the class VnfAdapterObjectMapperTest method test_createVolumeGroupParams.
@Test
public void test_createVolumeGroupParams() throws Exception {
GenericVnf genericVnf = new GenericVnf();
genericVnf.setVnfId("vnfId");
genericVnf.setVnfName("vnfName");
RequestContext requestContext = new RequestContext();
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId("volumeGroupId");
volumeGroup.setVolumeGroupName("volumeGroupName");
String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json")));
Map<String, String> expectedVolumeGroupParams = new HashMap<>();
expectedVolumeGroupParams.put("vnf_id", genericVnf.getVnfId());
expectedVolumeGroupParams.put("vnf_name", genericVnf.getVnfName());
expectedVolumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId());
expectedVolumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName());
expectedVolumeGroupParams.put("paramOne", "paramOneValue");
expectedVolumeGroupParams.put("paramTwo", "paramTwoValue");
expectedVolumeGroupParams.put("paramThree", "paramThreeValue");
Map<String, Object> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext, genericVnf, volumeGroup, sdncVfModuleQueryResponse);
assertEquals(expectedVolumeGroupParams, actualVolumeGroupParams);
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup in project so by onap.
the class VnfAdapterObjectMapperTest method test_deleteVolumeGroupRequestMapper.
private void test_deleteVolumeGroupRequestMapper(String heatStackId) throws Exception {
DeleteVolumeGroupRequest expectedDeleteVolumeGroupRequest = new DeleteVolumeGroupRequest();
CloudRegion cloudRegion = new CloudRegion();
cloudRegion.setLcpCloudRegionId("lcpCloudRegionId");
expectedDeleteVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
cloudRegion.setTenantId("tenantId");
expectedDeleteVolumeGroupRequest.setTenantId(cloudRegion.getTenantId());
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId("volumeGroupId");
expectedDeleteVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId());
if (heatStackId != null) {
volumeGroup.setHeatStackId("heatStackId");
expectedDeleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
} else {
volumeGroup.setVolumeGroupName("volumeGroupName");
expectedDeleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getVolumeGroupName());
}
expectedDeleteVolumeGroupRequest.setSkipAAI(true);
MsoRequest msoRequest = new MsoRequest();
RequestContext requestContext = new RequestContext();
requestContext.setMsoRequestId("msoRequestId");
msoRequest.setRequestId(requestContext.getMsoRequestId());
ServiceInstance serviceInstance = new ServiceInstance();
serviceInstance.setServiceInstanceId("serviceInstanceId");
msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
expectedDeleteVolumeGroupRequest.setMsoRequest(msoRequest);
String messageId = "messageId";
String endpoint = "endpoint";
doReturn(messageId).when(vnfAdapterObjectMapper).getRandomUuid();
doReturn(endpoint).when(vnfAdapterObjectMapper).getProperty(isA(String.class));
expectedDeleteVolumeGroupRequest.setMessageId(messageId);
expectedDeleteVolumeGroupRequest.setNotificationUrl(endpoint + "/VNFAResponse/" + messageId);
DeleteVolumeGroupRequest actualDeleteVolumeGroupRequest = vnfAdapterObjectMapper.deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup);
assertThat(actualDeleteVolumeGroupRequest, sameBeanAs(expectedDeleteVolumeGroupRequest));
}
Aggregations