use of org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule in project so by onap.
the class VnfAdapterCreateTasksTest method test_createVolumeGroupRequest.
@Test
public void test_createVolumeGroupRequest() throws Exception {
RequestContext requestContext = setRequestContext();
ServiceInstance serviceInstance = setServiceInstance();
GenericVnf genericVnf = setGenericVnf();
VfModule vfModule = setVfModule();
vfModule.setSelflink("vfModuleSelfLink");
VolumeGroup volumeGroup = setVolumeGroup();
volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
CloudRegion cloudRegion = setCloudRegion();
OrchestrationContext orchestrationContext = setOrchestrationContext();
orchestrationContext.setIsRollbackEnabled(true);
String sdncVnfQueryResponse = "SDNCVnfQueryResponse";
execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncVnfQueryResponse);
CreateVolumeGroupRequest request = new CreateVolumeGroupRequest();
request.setVolumeGroupId("volumeGroupStackId");
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
doReturn(request).when(vnfAdapterVolumeGroupResources).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVnfQueryResponse);
vnfAdapterCreateTasks.createVolumeGroupRequest(execution);
verify(vnfAdapterVolumeGroupResources, times(1)).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVnfQueryResponse);
assertEquals(request.toXmlString(), execution.getVariable("VNFREST_Request"));
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule in project so by onap.
the class AppcRunTasksTest method runAppcCommand.
@Test
public void runAppcCommand() throws BBObjectNotFoundException {
execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "SUCCESS-TEST");
fillRequiredAppcExecutionFields();
GenericVnf genericVnf = getTestGenericVnf();
when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
mockReferenceResponse();
execution.getLookupMap().put(ResourceKey.VF_MODULE_ID, "VF-MODULE-ID-TEST");
VfModule vfModule = new VfModule();
vfModule.setVfModuleId("VF-MODULE-ID");
when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
when(appCClient.getErrorCode()).thenReturn("0");
appcRunTasks.runAppcCommand(execution, Action.Lock);
assertEquals(true, execution.getVariable("rollbackVnfLock"));
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule in project so by onap.
the class TestDataSetup method buildVfModule.
public VfModule buildVfModule() {
vfModuleCounter++;
VfModule vfModule = new VfModule();
vfModule.setVfModuleId("testVfModuleId" + vfModuleCounter);
vfModule.setVfModuleName("testVfModuleName" + vfModuleCounter);
vfModule.setModuleIndex(0);
ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
modelInfoVfModule.setModelInvariantUUID("testModelInvariantUUID" + vfModuleCounter);
modelInfoVfModule.setModelVersion("testModelVersion" + vfModuleCounter);
modelInfoVfModule.setModelUUID("testModelUUID" + vfModuleCounter);
modelInfoVfModule.setModelName("testModelName" + vfModuleCounter);
modelInfoVfModule.setModelCustomizationUUID("testModelCustomizationUUID" + vfModuleCounter);
if (vfModuleCounter == 1) {
modelInfoVfModule.setIsBaseBoolean(Boolean.TRUE);
} else {
modelInfoVfModule.setIsBaseBoolean(Boolean.FALSE);
}
vfModule.setModelInfoVfModule(modelInfoVfModule);
return vfModule;
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule in project so by onap.
the class AAIVfModuleResources method updateHeatStackIdVfModule.
public void updateHeatStackIdVfModule(VfModule vfModule, GenericVnf vnf) {
AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId()));
VfModule copiedVfModule = vfModule.shallowCopyId();
copiedVfModule.setHeatStackId(vfModule.getHeatStackId());
org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(copiedVfModule);
injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule in project so by onap.
the class VnfAdapterVfModuleObjectMapperPayloadTest method createVfModuleAddonRequestMapperTest.
@Test
public void createVfModuleAddonRequestMapperTest() throws Exception {
// prepare and set service instance
ServiceInstance serviceInstance = new ServiceInstance();
serviceInstance.setServiceInstanceId("serviceInstanceId");
ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid");
modelInfoServiceInstance.setModelName("serviceModelName");
modelInfoServiceInstance.setModelUuid("serviceModelUuid");
modelInfoServiceInstance.setModelVersion("serviceModelVersion");
modelInfoServiceInstance.setEnvironmentContext("environmentContext");
modelInfoServiceInstance.setWorkloadContext("workloadContext");
serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
//
RequestContext requestContext = new RequestContext();
Map<String, Object> userParams = new HashMap<>();
userParams.put("key1", "value2");
requestContext.setMsoRequestId("requestId");
requestContext.setUserParams(userParams);
requestContext.setProductFamilyId("productFamilyId");
GenericVnf vnf = new GenericVnf();
vnf.setVnfId("vnfId");
vnf.setVnfType("vnfType");
vnf.setVnfName("vnfName");
ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid");
modelInfoGenericVnf.setModelName("vnfModelName");
modelInfoGenericVnf.setModelVersion("vnfModelVersion");
modelInfoGenericVnf.setModelUuid("vnfModelUuid");
modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid");
vnf.setModelInfoGenericVnf(modelInfoGenericVnf);
Integer vfModuleIndex = 1;
VfModule vfModule = new VfModule();
vfModule.setVfModuleId("vfModuleId");
vfModule.setVfModuleName("vfModuleName");
vfModule.setModuleIndex(vfModuleIndex);
ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid");
modelInfoVfModule.setModelName("vfModuleModelName");
modelInfoVfModule.setModelVersion("vfModuleModelVersion");
modelInfoVfModule.setModelUUID("vfModuleModelUuid");
modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid");
vfModule.setModelInfoVfModule(modelInfoVfModule);
VfModule baseVfModule = new VfModule();
baseVfModule.setVfModuleId("baseVfModuleId");
baseVfModule.setHeatStackId("baseVfModuleStackId");
ModelInfoVfModule baseModelInfoVfModule = new ModelInfoVfModule();
baseModelInfoVfModule.setIsBaseBoolean(true);
baseVfModule.setModelInfoVfModule(baseModelInfoVfModule);
vnf.getVfModules().add(baseVfModule);
CloudRegion cloudRegion = new CloudRegion();
cloudRegion.setLcpCloudRegionId("cloudRegionId");
cloudRegion.setTenantId("tenantId");
OrchestrationContext orchestrationContext = new OrchestrationContext();
orchestrationContext.setIsRollbackEnabled(false);
String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopology.json")));
String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json")));
CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleAddonRequest.json")));
CreateVfModuleRequest reqMapper1 = omapper.readValue(jsonToCompare, CreateVfModuleRequest.class);
assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
}
Aggregations