Search in sources :

Example 1 with ModelInfoVfModule

use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule in project so by onap.

the class BuildingBlockTestDataSetup method buildVfModule.

public VfModule buildVfModule() {
    vfModuleCounter++;
    VfModule vfModule = new VfModule();
    vfModule.setVfModuleId("testVfModuleId" + vfModuleCounter);
    vfModule.setVfModuleName("testVfModuleName" + vfModuleCounter);
    ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
    modelInfoVfModule.setModelInvariantUUID("testModelInvariantUUID" + vfModuleCounter);
    modelInfoVfModule.setModelVersion("testModelVersion" + vfModuleCounter);
    modelInfoVfModule.setModelUUID("testModelUUID" + vfModuleCounter);
    modelInfoVfModule.setModelName("testModelName" + vfModuleCounter);
    modelInfoVfModule.setModelCustomizationUUID("testModelCustomizationUUID" + vfModuleCounter);
    vfModule.setModelInfoVfModule(modelInfoVfModule);
    return vfModule;
}
Also used : ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule)

Example 2 with ModelInfoVfModule

use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule in project so by onap.

the class BBInputSetupTest method testPopulateVolumeGroup.

@Test
public void testPopulateVolumeGroup() throws Exception {
    RequestDetails requestDetails = new RequestDetails();
    RelatedInstanceList ril = new RelatedInstanceList();
    RelatedInstance ri = new RelatedInstance();
    ModelInfo mi = new ModelInfo();
    mi.setModelType(ModelType.vnf);
    mi.setModelCustomizationUuid("vnfModelCustomizationUUID");
    mi.setModelCustomizationId("vnfModelCustomizationUUID");
    ri.setModelInfo(mi);
    ril.setRelatedInstance(ri);
    requestDetails.setRelatedInstanceList(new RelatedInstanceList[] { ril });
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setModelCustomizationId("volumeGroupCustId");
    RequestInfo reqInfo = new RequestInfo();
    reqInfo.setInstanceName("volumeGroupName");
    requestDetails.setModelInfo(modelInfo);
    requestDetails.setRequestInfo(reqInfo);
    ServiceInstance serviceInstance = new ServiceInstance();
    GenericVnf vnf = new GenericVnf();
    vnf.setVnfId("genericVnfId");
    VolumeGroup vg = new VolumeGroup();
    vg.setVolumeGroupName("volumeGroupName");
    vg.setVolumeGroupId("volumeGroupId");
    vg.setModelInfoVfModule(new ModelInfoVfModule());
    vg.getModelInfoVfModule().setModelCustomizationUUID("volumeGroupCustId");
    vnf.getVolumeGroups().add(vg);
    serviceInstance.getVnfs().add(vnf);
    Service service = mapper.readValue(new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class);
    Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
    lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId");
    ServiceModel serviceModel = new ServiceModel();
    serviceModel.setCurrentService(service);
    String bbName = AssignFlows.VOLUME_GROUP.toString();
    String resourceId = "123";
    doNothing().when(SPY_bbInputSetup).mapCatalogVolumeGroup(isA(VolumeGroup.class), eq(modelInfo), eq(service), eq("vnfModelCustomizationUUID"));
    org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = new org.onap.aai.domain.yang.GenericVnf();
    aaiGenericVnf.setModelCustomizationId("vnfModelCustomizationUUID");
    doReturn(aaiGenericVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
    lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId");
    BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID).setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setRequestDetails(requestDetails).setInstanceName(reqInfo.getInstanceName()).setServiceModel(serviceModel).build();
    SPY_bbInputSetup.populateVolumeGroup(parameter);
    verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(eq(vg), isA(ModelInfo.class), eq(service), eq("vnfModelCustomizationUUID"));
    vnf.getVolumeGroups().clear();
    SPY_bbInputSetup.populateVolumeGroup(parameter);
    verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(vnf.getVolumeGroups().get(0), modelInfo, service, "vnfModelCustomizationUUID");
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) RelatedInstanceList(org.onap.so.serviceinstancebeans.RelatedInstanceList) RelatedInstance(org.onap.so.serviceinstancebeans.RelatedInstance) HashMap(java.util.HashMap) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Service(org.onap.so.db.catalog.beans.Service) RequestInfo(org.onap.so.serviceinstancebeans.RequestInfo) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) ServiceModel(org.onap.so.bpmn.servicedecomposition.entities.ServiceModel) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) File(java.io.File) Test(org.junit.Test)

Example 3 with ModelInfoVfModule

use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule in project so by onap.

the class AbstractVnfCDSRequestProviderTest method createVfModule.

protected VfModule createVfModule() {
    VfModule vfModule = new VfModule();
    vfModule.setVfModuleId(VF_MODULE_ID);
    vfModule.setVfModuleName(VF_MODULE_NAME);
    ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
    modelInfoVfModule.setModelCustomizationUUID(VF_MODULE_CUSTOMIZATION_UUID);
    vfModule.setModelInfoVfModule(modelInfoVfModule);
    return vfModule;
}
Also used : ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)

Example 4 with ModelInfoVfModule

use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule 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;
}
Also used : ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule)

Example 5 with ModelInfoVfModule

use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule 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));
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) CreateVolumeGroupRequest(org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) HashMap(java.util.HashMap) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) MsoRequest(org.onap.so.entity.MsoRequest) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Test(org.junit.Test)

Aggregations

ModelInfoVfModule (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule)33 Test (org.junit.Test)27 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)25 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)20 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)18 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)18 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)17 HashMap (java.util.HashMap)16 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)16 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)16 OrchestrationContext (org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext)13 CreateVfModuleRequest (org.onap.so.adapters.vnfrest.CreateVfModuleRequest)10 VolumeGroup (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup)8 RequestParameters (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters)4 Service (org.onap.so.db.catalog.beans.Service)4 VfModuleCustomization (org.onap.so.db.catalog.beans.VfModuleCustomization)4 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 URI (java.net.URI)3 ArrayList (java.util.ArrayList)3