Search in sources :

Example 86 with VfModule

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

the class VnfEBBLoaderTest method traverseAAIVnf_should_add_vnfs_and_vfmodules.

@Test
public void traverseAAIVnf_should_add_vnfs_and_vfmodules() throws Exception {
    List<Resource> resourceList = new ArrayList<>();
    List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
    GenericVnf genericVnf = mock(GenericVnf.class);
    doReturn(vnfId).when(genericVnf).getVnfId();
    org.onap.aai.domain.yang.GenericVnf aaiVnf = mock(org.onap.aai.domain.yang.GenericVnf.class);
    doReturn(aaiVnf).when(bbInputSetupUtils).getAAIGenericVnf(vnfId);
    VfModule vfModule = mock(VfModule.class);
    doReturn(vfModuleId).when(vfModule).getVfModuleId();
    ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
    modelInfoVfModule.setIsBaseBoolean(true);
    doReturn(modelInfoVfModule).when(vfModule).getModelInfoVfModule();
    org.onap.aai.domain.yang.VfModule aaiVfModule = new org.onap.aai.domain.yang.VfModule();
    aaiVfModule.setIsBaseVfModule(true);
    doReturn(aaiVfModule).when(bbInputSetupUtils).getAAIVfModule(vnfId, vfModuleId);
    doReturn(serviceInstanceAAI).when(bbInputSetupUtils).getAAIServiceInstanceById(serviceId);
    doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
    doReturn(List.of(genericVnf)).when(serviceInstanceMSO).getVnfs();
    doReturn(List.of(vfModule)).when(genericVnf).getVfModules();
    cut = new VnfEBBLoader(bbInputSetupUtils, bbInputSetup, workflowActionUtils, exceptionBuilder);
    cut.traverseAAIVnf(delegateExecution, resourceList, serviceId, vnfId, aaiResourceIds);
    assertEquals(3, resourceList.size());
    assertEquals(WorkflowType.VNF, resourceList.get(1).getResourceType());
    assertEquals(WorkflowType.VFMODULE, resourceList.get(2).getResourceType());
    assertTrue(resourceList.get(2).isBaseVfModule());
}
Also used : GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource) ArrayList(java.util.ArrayList) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) Pair(org.javatuples.Pair) Test(org.junit.Test)

Example 87 with VfModule

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

the class VnfAdapterVfModuleObjectMapper method createVfModuleRequestMapper.

public CreateVfModuleRequest createVfModuleRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf, VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws IOException, MissingValueTagException {
    CreateVfModuleRequest createVfModuleRequest = new CreateVfModuleRequest();
    createVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
    createVfModuleRequest.setCloudOwner(cloudRegion.getCloudOwner());
    createVfModuleRequest.setTenantId(cloudRegion.getTenantId());
    createVfModuleRequest.setVfModuleId(vfModule.getVfModuleId());
    createVfModuleRequest.setVfModuleName(vfModule.getVfModuleName());
    createVfModuleRequest.setVnfId(genericVnf.getVnfId());
    createVfModuleRequest.setVnfType(genericVnf.getVnfType());
    createVfModuleRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion());
    createVfModuleRequest.setVfModuleType(vfModule.getModelInfoVfModule().getModelName());
    createVfModuleRequest.setModelCustomizationUuid(vfModule.getModelInfoVfModule().getModelCustomizationUUID());
    if (volumeGroup != null) {
        createVfModuleRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId());
        createVfModuleRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
    }
    VfModule baseVfModule = getBaseVfModule(genericVnf);
    if (baseVfModule != null) {
        createVfModuleRequest.setBaseVfModuleId(baseVfModule.getVfModuleId());
        createVfModuleRequest.setBaseVfModuleStackId(baseVfModule.getHeatStackId());
    }
    createVfModuleRequest.setVfModuleParams(buildVfModuleParamsMap(requestContext, serviceInstance, genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse));
    createVfModuleRequest.setSkipAAI(true);
    createVfModuleRequest.setBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled()));
    createVfModuleRequest.setFailIfExists(false);
    MsoRequest msoRequest = buildMsoRequest(requestContext, serviceInstance);
    createVfModuleRequest.setMsoRequest(msoRequest);
    String messageId = vnfAdapterObjectMapperUtils.getRandomUuid();
    createVfModuleRequest.setMessageId(messageId);
    createVfModuleRequest.setNotificationUrl(vnfAdapterObjectMapperUtils.createCallbackUrl("VNFAResponse", messageId));
    String enableBridge = getProperty(ENABLE_BRIDGE);
    if (enableBridge == null || Boolean.valueOf(enableBridge)) {
        createVfModuleRequest.setEnableBridge(true);
    }
    return createVfModuleRequest;
}
Also used : CreateVfModuleRequest(org.onap.so.adapters.vnfrest.CreateVfModuleRequest) MsoRequest(org.onap.so.entity.MsoRequest) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)

Example 88 with VfModule

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

the class VnfAdapterVfModuleObjectMapper method getBaseVfModule.

private VfModule getBaseVfModule(GenericVnf genericVnf) {
    List<VfModule> vfModules = genericVnf.getVfModules();
    VfModule baseVfModule = null;
    if (vfModules != null) {
        for (int i = 0; i < vfModules.size(); i++) {
            if (vfModules.get(i).getModelInfoVfModule().getIsBaseBoolean()) {
                baseVfModule = vfModules.get(i);
                break;
            }
        }
    }
    return baseVfModule;
}
Also used : VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)

Example 89 with VfModule

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

the class AAIVfModuleResources method updateContrailServiceInstanceFqdnVfModule.

public void updateContrailServiceInstanceFqdnVfModule(VfModule vfModule, GenericVnf vnf) {
    AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId()));
    VfModule copiedVfModule = vfModule.shallowCopyId();
    copiedVfModule.setContrailServiceInstanceFqdn(vfModule.getContrailServiceInstanceFqdn());
    org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(copiedVfModule);
    injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
}
Also used : AAIResourceUri(org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)

Example 90 with VfModule

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

the class AAIVfModuleResources method updateOrchestrationStatusVfModule.

public void updateOrchestrationStatusVfModule(VfModule vfModule, GenericVnf vnf, OrchestrationStatus orchestrationStatus) {
    AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId()));
    VfModule copiedVfModule = vfModule.shallowCopyId();
    vfModule.setOrchestrationStatus(orchestrationStatus);
    copiedVfModule.setOrchestrationStatus(orchestrationStatus);
    org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(copiedVfModule);
    injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
}
Also used : AAIResourceUri(org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)

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