Search in sources :

Example 26 with ModelInfo

use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.

the class BBInputSetupTest method testPopulateVfModuleIsReplace.

@Test
public void testPopulateVfModuleIsReplace() throws Exception {
    String vnfId = "vnfId";
    String vfModuleId = "vfModuleId";
    String volumeGroupId = "volumeGroupId";
    String vfModuleCustomizationId = "vfModuleCustomizationId";
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setModelCustomizationId(vfModuleCustomizationId);
    Service currentService = new Service();
    Service newService = new Service();
    ServiceModel serviceModel = new ServiceModel();
    serviceModel.setCurrentService(currentService);
    currentService.setModelUUID("currentUUID");
    serviceModel.setNewService(newService);
    currentService.setModelUUID("newUUID");
    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);
    lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModuleId);
    String resourceId = vfModuleId;
    RelatedInstanceList[] relatedInstanceList = new RelatedInstanceList[1];
    RelatedInstanceList relatedInstanceListObj = new RelatedInstanceList();
    RelatedInstance relatedInstance = new RelatedInstance();
    relatedInstance.setInstanceId(vnfId);
    ModelInfo vnfModelInfo = new ModelInfo();
    vnfModelInfo.setModelCustomizationId("vnfCustomizationId");
    vnfModelInfo.setModelType(ModelType.vnf);
    relatedInstance.setModelInfo(vnfModelInfo);
    relatedInstanceListObj.setRelatedInstance(relatedInstance);
    relatedInstanceList[0] = relatedInstanceListObj;
    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));
    BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setModelInfo(modelInfo).setService(newService).setServiceInstance(serviceInstance).setBbName(bbName).setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setRelatedInstanceList(relatedInstanceList).setInstanceName(instanceName).setInstanceParams(instanceParams).setCloudConfiguration(cloudConfiguration).setIsReplace(true).setServiceModel(serviceModel).build();
    SPY_bbInputSetup.populateVfModule(parameter);
    verify(SPY_bbInputSetup, times(2)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), eq(serviceModel.getCurrentService()), isA(String.class));
    verify(SPY_bbInputSetup, times(1)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), eq(serviceModel.getNewService()), 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) 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) RelatedInstance(org.onap.so.serviceinstancebeans.RelatedInstance) 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)

Example 27 with ModelInfo

use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.

the class ConfigAssignVnfTest method createVnf.

private Vnfs createVnf(String vnfModelCustomizationId, List<Map<String, String>> instanceParamsList) {
    Vnfs vnf = new Vnfs();
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setModelCustomizationId(vnfModelCustomizationId);
    vnf.setModelInfo(modelInfo);
    vnf.setInstanceParams(instanceParamsList);
    return vnf;
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) Vnfs(org.onap.so.serviceinstancebeans.Vnfs)

Example 28 with ModelInfo

use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.

the class BBInputSetup method getGBBMacroExistingService.

protected GeneralBuildingBlock getGBBMacroExistingService(ExecuteBuildingBlock executeBB, Map<ResourceKey, String> lookupKeyMap, String bbName, String requestAction, CloudConfiguration cloudConfiguration) throws Exception {
    org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null;
    String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID);
    RequestDetails requestDetails = executeBB.getRequestDetails();
    BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setExecuteBB(executeBB).setLookupKeyMap(lookupKeyMap).setBbName(bbName).setRequestAction(requestAction).setCloudConfiguration(cloudConfiguration).setRequestDetails(requestDetails).setResourceId(serviceInstanceId).build();
    GeneralBuildingBlock gBB = null;
    Service service = null;
    if (serviceInstanceId != null) {
        aaiServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId);
        if (aaiServiceInstance != null) {
            String modelVersionId = aaiServiceInstance.getModelVersionId();
            if ("upgradeInstance".equalsIgnoreCase(requestAction)) {
                modelVersionId = requestDetails.getModelInfo().getModelVersionId();
            }
            service = bbInputSetupUtils.getCatalogServiceByModelUUID(modelVersionId);
            if (service == null) {
                String message = String.format("Related service instance model not found in MSO CatalogDB: model-version-id=%s", aaiServiceInstance.getModelVersionId());
                throw new ServiceModelNotFoundException(message);
            }
        } else {
            String message = String.format("Related service instance from AAI not found: service-instance-id=%s", serviceInstanceId);
            throw new NoServiceInstanceFoundException(message);
        }
    }
    ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance);
    serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service));
    parameter.setServiceInstance(serviceInstance);
    gBB = populateGBBWithSIAndAdditionalInfo(parameter);
    serviceInstance = gBB.getServiceInstance();
    CloudRegion cloudRegion = null;
    if (cloudConfiguration == null) {
        Optional<CloudRegion> cloudRegionOp = cloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance);
        if (cloudRegionOp.isPresent()) {
            cloudRegion = cloudRegionOp.get();
        }
    }
    if (cloudConfiguration != null) {
        org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration);
        cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion);
    }
    gBB.setCloudRegion(cloudRegion);
    if (bbName.contains(VNF) || (bbName.contains(CONTROLLER) && (VNF).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) {
        for (GenericVnf genericVnf : serviceInstance.getVnfs()) {
            if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null && genericVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) {
                org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(genericVnf.getVnfId());
                ModelInfo modelInfo = new ModelInfo();
                if (vnf != null) {
                    modelInfo.setModelCustomizationUuid(vnf.getModelCustomizationId());
                }
                this.mapCatalogVnf(genericVnf, modelInfo, service);
            }
        }
    } else if (bbName.contains(VF_MODULE) || (bbName.contains(CONTROLLER) && (VF_MODULE).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) {
        for (GenericVnf vnf : serviceInstance.getVnfs()) {
            for (VfModule vfModule : vnf.getVfModules()) {
                if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null && vfModule.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) {
                    String vnfModelCustomizationUUID = this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId();
                    ModelInfo vnfModelInfo = new ModelInfo();
                    vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
                    this.mapCatalogVnf(vnf, vnfModelInfo, service);
                    lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnf.getVnfId());
                    String vfModuleCustomizationUUID = this.bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()).getModelCustomizationId();
                    ModelInfo vfModuleModelInfo = new ModelInfo();
                    vfModuleModelInfo.setModelCustomizationId(vfModuleCustomizationUUID);
                    this.mapCatalogVfModule(vfModule, vfModuleModelInfo, service, vnfModelCustomizationUUID);
                    if (cloudRegion != null) {
                        Optional<String> volumeGroupIdOp = getVolumeGroupIdRelatedToVfModule(vnf, vfModuleModelInfo, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), lookupKeyMap);
                        if (volumeGroupIdOp.isPresent()) {
                            lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupIdOp.get());
                        }
                    }
                    if (vfModule.getModelInfoVfModule() != null && vfModule.getModelInfoVfModule().getModelName() != null && vfModule.getModelInfoVfModule().getModelName().contains("helm")) {
                        gBB.getRequestContext().setIsHelm(true);
                    }
                    break;
                }
            }
        }
    } else if (bbName.contains(VOLUME_GROUP)) {
        for (GenericVnf vnf : serviceInstance.getVnfs()) {
            for (VolumeGroup volumeGroup : vnf.getVolumeGroups()) {
                if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) != null && volumeGroup.getVolumeGroupId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID))) {
                    String vnfModelCustomizationUUID = this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId();
                    ModelInfo vnfModelInfo = new ModelInfo();
                    vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
                    this.mapCatalogVnf(vnf, vnfModelInfo, service);
                    lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnf.getVnfId());
                    if (cloudRegion != null) {
                        String volumeGroupCustomizationUUID = this.bbInputSetupUtils.getAAIVolumeGroup(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()).getModelCustomizationId();
                        ModelInfo volumeGroupModelInfo = new ModelInfo();
                        volumeGroupModelInfo.setModelCustomizationId(volumeGroupCustomizationUUID);
                        this.mapCatalogVolumeGroup(volumeGroup, volumeGroupModelInfo, service, vnfModelCustomizationUUID);
                    }
                    break;
                }
            }
        }
    } else if (bbName.contains(NETWORK)) {
        for (L3Network network : serviceInstance.getNetworks()) {
            if (lookupKeyMap.get(ResourceKey.NETWORK_ID) != null && network.getNetworkId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.NETWORK_ID))) {
                String networkCustomizationUUID = this.bbInputSetupUtils.getAAIL3Network(network.getNetworkId()).getModelCustomizationId();
                ModelInfo modelInfo = new ModelInfo();
                modelInfo.setModelCustomizationUuid(networkCustomizationUUID);
                this.mapCatalogNetwork(network, modelInfo, service);
                break;
            }
        }
    } else if (bbName.contains("Fabric")) {
        for (Configuration configuration : serviceInstance.getConfigurations()) {
            if (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null && configuration.getConfigurationId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) {
                String configurationCustUUID = this.bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId()).getModelCustomizationId();
                ModelInfo modelInfo = new ModelInfo();
                modelInfo.setModelCustomizationUuid(configurationCustUUID);
                this.mapCatalogConfiguration(configuration, modelInfo, service, executeBB.getConfigurationResourceKeys());
                break;
            }
        }
    } else if (bbName.equals("HealthCheckBB") && (VNF).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope())) {
        this.setisHelmforHealthCheckBB(service, serviceInstance, gBB);
    }
    if (executeBB.getWorkflowResourceIds() != null) {
        parameter.setResourceId(executeBB.getWorkflowResourceIds().getNetworkCollectionId());
        parameter.setKey(executeBB.getBuildingBlock().getKey());
        this.populateNetworkCollectionAndInstanceGroupAssign(parameter);
    }
    return gBB;
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) Optional(java.util.Optional) CloudConfiguration(org.onap.so.serviceinstancebeans.CloudConfiguration) Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) ExceptionBuilder(org.onap.so.client.exception.ExceptionBuilder) AAIFluentTypeBuilder(org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder) Service(org.onap.so.db.catalog.beans.Service) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) ServiceModelNotFoundException(org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ServiceModelNotFoundException) NoServiceInstanceFoundException(org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException)

Example 29 with ModelInfo

use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.

the class BBInputSetup method setisHelmforHealthCheckBB.

private void setisHelmforHealthCheckBB(Service service, ServiceInstance serviceInstance, GeneralBuildingBlock gBB) {
    for (GenericVnf vnf : serviceInstance.getVnfs()) {
        for (VfModule vfModule : vnf.getVfModules()) {
            String vnfModelCustomizationUUID = this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId();
            ModelInfo vnfModelInfo = new ModelInfo();
            vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
            this.mapCatalogVnf(vnf, vnfModelInfo, service);
            String vfModuleCustomizationUUID = this.bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()).getModelCustomizationId();
            ModelInfo vfModuleModelInfo = new ModelInfo();
            vfModuleModelInfo.setModelCustomizationId(vfModuleCustomizationUUID);
            this.mapCatalogVfModule(vfModule, vfModuleModelInfo, service, vnfModelCustomizationUUID);
            if (vfModule.getModelInfoVfModule() != null && vfModule.getModelInfoVfModule().getModelName() != null && vfModule.getModelInfoVfModule().getModelName().contains("helm")) {
                gBB.getRequestContext().setIsHelm(true);
                break;
            }
        }
    }
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)

Example 30 with ModelInfo

use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.

the class BBInputSetup method populateVolumeGroup.

protected void populateVolumeGroup(BBInputSetupParameter parameter) throws Exception {
    String replaceVnfModelCustomizationUUID = null;
    VolumeGroup volumeGroup = null;
    GenericVnf vnf = null;
    String vnfModelCustomizationUUID = null;
    String generatedVnfType = parameter.getVnfType();
    if (generatedVnfType == null || generatedVnfType.isEmpty()) {
        generatedVnfType = parameter.getService().getModelName() + "/" + parameter.getModelInfo().getModelCustomizationName();
    }
    if (parameter.getRelatedInstanceList() != null) {
        for (RelatedInstanceList relatedInstList : parameter.getRelatedInstanceList()) {
            RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
            if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
                if (parameter.getIsReplace()) {
                    replaceVnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId();
                } else {
                    vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId();
                }
                break;
            }
        }
    }
    for (GenericVnf tempVnf : parameter.getServiceInstance().getVnfs()) {
        if (tempVnf.getVnfId().equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.GENERIC_VNF_ID))) {
            vnf = tempVnf;
            vnfModelCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId();
            ModelInfo vnfModelInfo = new ModelInfo();
            if (parameter.getIsReplace()) {
                vnfModelInfo.setModelCustomizationUuid(replaceVnfModelCustomizationUUID);
                mapCatalogVnf(tempVnf, vnfModelInfo, parameter.getServiceModel().getNewService());
            } else {
                vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
                mapCatalogVnf(tempVnf, vnfModelInfo, parameter.getServiceModel().getCurrentService());
            }
            break;
        }
    }
    if (vnf != null && vnfModelCustomizationUUID != null) {
        for (VolumeGroup volumeGroupTemp : vnf.getVolumeGroups()) {
            if (parameter.getLookupKeyMap().get(ResourceKey.VOLUME_GROUP_ID) != null && volumeGroupTemp.getVolumeGroupId().equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.VOLUME_GROUP_ID))) {
                volumeGroup = volumeGroupTemp;
                if (volumeGroup.getModelInfoVfModule() == null) {
                    throw new Exception("ModelInfoVfModule is null for VolumeGroup: " + volumeGroup.getVolumeGroupId());
                }
                String volumeGroupCustId = volumeGroup.getModelInfoVfModule().getModelCustomizationUUID();
                ModelInfo modelInfoVolumeGroup = new ModelInfo();
                modelInfoVolumeGroup.setModelCustomizationId(volumeGroupCustId);
                if (parameter.getIsReplace() && parameter.getLookupKeyMap().get(ResourceKey.VOLUME_GROUP_ID) != null && volumeGroupTemp.getVolumeGroupId().equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.VOLUME_GROUP_ID))) {
                    mapCatalogVolumeGroup(volumeGroupTemp, modelInfoVolumeGroup, parameter.getServiceModel().getNewService(), replaceVnfModelCustomizationUUID);
                } else {
                    mapCatalogVolumeGroup(volumeGroupTemp, modelInfoVolumeGroup, parameter.getServiceModel().getCurrentService(), vnfModelCustomizationUUID);
                }
                break;
            }
        }
        if (volumeGroup == null && parameter.getBbName().equalsIgnoreCase(AssignFlows.VOLUME_GROUP.toString())) {
            volumeGroup = createVolumeGroup(parameter.getLookupKeyMap(), parameter.getResourceId(), parameter.getInstanceName(), generatedVnfType, parameter.getInstanceParams());
            vnf.getVolumeGroups().add(volumeGroup);
            if (parameter.getIsReplace()) {
                if (parameter.getExecuteBB().getOldVolumeGroupName() != null && !parameter.getExecuteBB().getOldVolumeGroupName().isEmpty()) {
                    volumeGroup.setVolumeGroupName(parameter.getExecuteBB().getOldVolumeGroupName());
                }
                mapCatalogVolumeGroup(volumeGroup, parameter.getModelInfo(), parameter.getServiceModel().getNewService(), replaceVnfModelCustomizationUUID);
            } else {
                mapCatalogVolumeGroup(volumeGroup, parameter.getModelInfo(), parameter.getServiceModel().getCurrentService(), vnfModelCustomizationUUID);
            }
        }
    } else {
        logger.debug("Related VNF instance Id not found: {}", parameter.getLookupKeyMap().get(ResourceKey.GENERIC_VNF_ID));
        throw new Exception("Could not find relevant information for related VNF");
    }
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) RelatedInstanceList(org.onap.so.serviceinstancebeans.RelatedInstanceList) RelatedInstance(org.onap.so.serviceinstancebeans.RelatedInstance) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) ServiceModelNotFoundException(org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ServiceModelNotFoundException) NoServiceInstanceFoundException(org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException) ResourceNotFoundException(org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ResourceNotFoundException)

Aggregations

ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)84 Test (org.junit.Test)46 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)35 Service (org.onap.so.db.catalog.beans.Service)30 HashMap (java.util.HashMap)18 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)18 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)17 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)17 RelatedInstanceList (org.onap.so.serviceinstancebeans.RelatedInstanceList)15 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)14 RelatedInstance (org.onap.so.serviceinstancebeans.RelatedInstance)14 ServiceInstancesRequest (org.onap.so.serviceinstancebeans.ServiceInstancesRequest)14 VnfResourceCustomization (org.onap.so.db.catalog.beans.VnfResourceCustomization)12 RequestInfo (org.onap.so.serviceinstancebeans.RequestInfo)12 ServiceModel (org.onap.so.bpmn.servicedecomposition.entities.ServiceModel)11 CloudConfiguration (org.onap.so.serviceinstancebeans.CloudConfiguration)11 File (java.io.File)10 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)10 VolumeGroup (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup)10 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)10