Search in sources :

Example 66 with VfModule

use of org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule in project so by onap.

the class AAICreateTasks method connectVfModuleToVolumeGroup.

/**
 * BPMN access method to establish relationships in AAI
 *
 * @param execution
 * @throws Exception
 */
public void connectVfModuleToVolumeGroup(BuildingBlockExecution execution) {
    try {
        GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
        VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
        VolumeGroup volumeGroup = null;
        try {
            volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
        } catch (BBObjectNotFoundException e) {
            logger.info("VolumeGroup not found. Skipping Connect between VfModule and VolumeGroup");
        }
        if (volumeGroup != null) {
            logger.debug("Connecting VfModule to VolumGroup");
            aaiVfModuleResources.connectVfModuleToVolumeGroup(vnf, vfModule, volumeGroup, execution.getGeneralBuildingBlock().getCloudRegion());
        }
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException)

Example 67 with VfModule

use of org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule in project so by onap.

the class VnfAdapterVfModuleResourcesTest method test_deleteVfModule.

@Test
public void test_deleteVfModule() throws Exception {
    doReturn(deleteVfModuleRequest).when(MOCK_vnfAdapterVfModuleObjectMapper).deleteVfModuleRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(ServiceInstance.class), isA(GenericVnf.class), isA(VfModule.class));
    DeleteVfModuleRequest actualDeleteVfModuleRequest = vnfAdapterVfModuleResources.deleteVfModuleRequest(requestContext, cloudRegion, serviceInstance, genericVnf, vfModule);
    verify(MOCK_vnfAdapterVfModuleObjectMapper, times(1)).deleteVfModuleRequestMapper(requestContext, cloudRegion, serviceInstance, genericVnf, vfModule);
    assertEquals(deleteVfModuleRequest, actualDeleteVfModuleRequest);
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) DeleteVfModuleRequest(org.onap.so.adapters.vnfrest.DeleteVfModuleRequest) Test(org.junit.Test)

Example 68 with VfModule

use of org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule in project so by onap.

the class VnfAdapterVfModuleObjectMapperPayloadTest method createVfModuleRequestMapperWithNullUserParamsTest.

@Test
public void createVfModuleRequestMapperWithNullUserParamsTest() 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();
    requestContext.setMsoRequestId("requestId");
    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);
    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 + "vnfAdapterCreateVfModuleRequestNoUserParams.json")));
    CreateVfModuleRequest reqMapper1 = omapper.readValue(jsonToCompare, CreateVfModuleRequest.class);
    assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) CreateVfModuleRequest(org.onap.so.adapters.vnfrest.CreateVfModuleRequest) ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Test(org.junit.Test)

Example 69 with VfModule

use of org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule in project so by onap.

the class VnfAdapterVfModuleObjectMapperPayloadTest method createVfModuleRequestMapperDhcpDisabledTest.

@Test
public void createVfModuleRequestMapperDhcpDisabledTest() 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", "value1");
    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);
    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 + "genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.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 + "vnfAdapterCreateVfModuleRequestDhcpDisabled.json")));
    CreateVfModuleRequest reqMapper1 = omapper.readValue(jsonToCompare, CreateVfModuleRequest.class);
    assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) HashMap(java.util.HashMap) ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) CreateVfModuleRequest(org.onap.so.adapters.vnfrest.CreateVfModuleRequest) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Test(org.junit.Test)

Example 70 with VfModule

use of org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule in project so by onap.

the class BBInputSetupTest method testPopulateVfModule.

@Test
public void testPopulateVfModule() throws Exception {
    String vnfId = "vnfId";
    String vfModuleId = "vfModuleId";
    String volumeGroupId = "volumeGroupId";
    String vfModuleCustomizationId = "vfModuleCustomizationId";
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setModelCustomizationId(vfModuleCustomizationId);
    Service service = new Service();
    ServiceModel serviceModel = new ServiceModel();
    serviceModel.setCurrentService(service);
    String bbName = AssignFlows.VF_MODULE.toString();
    ServiceInstance serviceInstance = new ServiceInstance();
    GenericVnf vnf = new GenericVnf();
    vnf.setVnfId(vnfId);
    VolumeGroup volumeGroup = new VolumeGroup();
    volumeGroup.setVolumeGroupId(volumeGroupId);
    vnf.getVolumeGroups().add(volumeGroup);
    serviceInstance.getVnfs().add(vnf);
    VfModule vfModule1 = new VfModule();
    vfModule1.setVfModuleId("vfModuleId1");
    VfModule vfModule2 = new VfModule();
    vfModule2.setVfModuleId("vfModuleId2");
    vnf.getVfModules().add(vfModule1);
    vnf.getVfModules().add(vfModule2);
    Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
    lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId);
    String resourceId = vfModuleId;
    RelatedInstanceList[] relatedInstanceList = null;
    String instanceName = "vfModuleName";
    List<Map<String, String>> instanceParams = null;
    CloudConfiguration cloudConfiguration = new CloudConfiguration();
    org.onap.aai.domain.yang.GenericVnf vnfAAI = new org.onap.aai.domain.yang.GenericVnf();
    vnfAAI.setModelCustomizationId("vnfModelCustId");
    org.onap.aai.domain.yang.VolumeGroup volumeGroupAAI = new org.onap.aai.domain.yang.VolumeGroup();
    volumeGroupAAI.setModelCustomizationId(vfModuleCustomizationId);
    org.onap.aai.domain.yang.VfModule vfModuleAAI = new org.onap.aai.domain.yang.VfModule();
    vfModuleAAI.setModelCustomizationId(vfModuleCustomizationId);
    doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
    doReturn(volumeGroupAAI).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(CLOUD_OWNER, cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
    doReturn(vfModuleAAI).when(SPY_bbInputSetupUtils).getAAIVfModule(isA(String.class), isA(String.class));
    doNothing().when(SPY_bbInputSetup).mapCatalogVnf(isA(GenericVnf.class), isA(ModelInfo.class), isA(Service.class));
    doNothing().when(SPY_bbInputSetup).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), isA(Service.class), isA(String.class));
    SPY_bbInputSetup.populateVfModule(new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID).setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setRelatedInstanceList(relatedInstanceList).setInstanceName(instanceName).setInstanceParams(instanceParams).setCloudConfiguration(cloudConfiguration).setServiceModel(serviceModel).build());
    verify(SPY_bbInputSetup, times(3)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), isA(Service.class), isA(String.class));
    assertEquals("Lookup Key Map populated with VfModule Id", vfModuleId, lookupKeyMap.get(ResourceKey.VF_MODULE_ID));
    assertEquals("Lookup Key Map populated with VolumeGroup Id", volumeGroupId, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID));
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) HashMap(java.util.HashMap) RelatedInstanceList(org.onap.so.serviceinstancebeans.RelatedInstanceList) AAIFluentTypeBuilder(org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) ServiceModel(org.onap.so.bpmn.servicedecomposition.entities.ServiceModel) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) Service(org.onap.so.db.catalog.beans.Service) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) CloudConfiguration(org.onap.so.serviceinstancebeans.CloudConfiguration) Map(java.util.Map) BaseBBInputSetupTestHelper.prepareLookupKeyMap(org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareLookupKeyMap) HashMap(java.util.HashMap) Test(org.junit.Test)

Aggregations

VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)97 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)74 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)53 Test (org.junit.Test)46 ModelInfoVfModule (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule)45 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)37 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)35 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)30 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)27 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)27 HashMap (java.util.HashMap)22 VolumeGroup (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup)20 OrchestrationContext (org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext)18 CreateVfModuleRequest (org.onap.so.adapters.vnfrest.CreateVfModuleRequest)14 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)14 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)13 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)12 Service (org.onap.so.db.catalog.beans.Service)12 Map (java.util.Map)11 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)11