use of org.onap.so.serviceinstancebeans.RelatedInstanceList in project so by onap.
the class BBInputSetup method getGBBALaCarteNonService.
protected GeneralBuildingBlock getGBBALaCarteNonService(ExecuteBuildingBlock executeBB, RequestDetails requestDetails, Map<ResourceKey, String> lookupKeyMap, String requestAction, String resourceId, String vnfType) throws Exception {
String bbName = executeBB.getBuildingBlock().getBpmnFlowName();
String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID);
org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null;
ServiceModel serviceModel = new ServiceModel();
Service service = null;
Service newService = null;
boolean isReplace = false;
if (serviceInstanceId != null) {
aaiServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId);
if (aaiServiceInstance != null) {
if (requestAction.equalsIgnoreCase("replaceInstance") || requestAction.equalsIgnoreCase("replaceInstanceRetainAssignments")) {
RelatedInstanceList[] relatedInstanceList = requestDetails.getRelatedInstanceList();
if (relatedInstanceList != null) {
for (RelatedInstanceList relatedInstList : relatedInstanceList) {
RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
if (relatedInstance.getModelInfo().getModelType().equals(ModelType.service)) {
newService = bbInputSetupUtils.getCatalogServiceByModelUUID(relatedInstance.getModelInfo().getModelVersionId());
isReplace = true;
}
}
}
}
service = bbInputSetupUtils.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
serviceModel.setNewService(newService);
serviceModel.setCurrentService(service);
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 if (newService == null && isReplace) {
String message = "Related service instance model in Request not found in MSO CatalogDB";
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);
if (isReplace) {
serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(serviceModel.getNewService()));
} else {
serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(serviceModel.getCurrentService()));
}
BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(executeBB.getRequestId()).setRequestDetails(requestDetails).setService(service).setBbName(bbName).setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setVnfType(vnfType).setKey(executeBB.getBuildingBlock().getKey()).setConfigurationResourceKeys(executeBB.getConfigurationResourceKeys()).setExecuteBB(executeBB).setRequestAction(requestAction).setIsReplace(isReplace).setServiceModel(serviceModel).build();
this.populateObjectsOnAssignAndCreateFlows(parameter);
return this.populateGBBWithSIAndAdditionalInfo(parameter);
}
use of org.onap.so.serviceinstancebeans.RelatedInstanceList 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");
}
}
use of org.onap.so.serviceinstancebeans.RelatedInstanceList in project so by onap.
the class RequestHandlerUtils method getVnfOrVfModuleUri.
private RecipeLookupResult getVnfOrVfModuleUri(ServiceInstancesRequest servInstReq, Actions action) throws ValidationException {
ModelInfo modelInfo = servInstReq.getRequestDetails().getModelInfo();
String vnfComponentType = modelInfo.getModelType().name();
RelatedInstanceList[] instanceList = null;
if (servInstReq.getRequestDetails() != null) {
instanceList = servInstReq.getRequestDetails().getRelatedInstanceList();
}
Recipe recipe;
String defaultSource = getDefaultModel(servInstReq);
String modelCustomizationId = modelInfo.getModelCustomizationId();
String modelCustomizationName = modelInfo.getModelCustomizationName();
String relatedInstanceModelVersionId = null;
String relatedInstanceModelInvariantId = null;
String relatedInstanceVersion = null;
String relatedInstanceModelCustomizationName = null;
if (instanceList != null) {
for (RelatedInstanceList relatedInstanceList : instanceList) {
RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo();
if (relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
relatedInstanceModelVersionId = relatedInstanceModelInfo.getModelVersionId();
relatedInstanceVersion = relatedInstanceModelInfo.getModelVersion();
}
if (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)) {
relatedInstanceModelVersionId = relatedInstanceModelInfo.getModelVersionId();
relatedInstanceModelInvariantId = relatedInstanceModelInfo.getModelInvariantId();
relatedInstanceVersion = relatedInstanceModelInfo.getModelVersion();
relatedInstanceModelCustomizationName = relatedInstanceModelInfo.getModelCustomizationName();
}
}
if (modelInfo.getModelType().equals(ModelType.vnf)) {
// a. For a vnf request (only create, no update currently):
// i. (v3-v4) If modelInfo.modelCustomizationId is provided, use it to validate catalog DB has record in
// vnf_resource_customization.model_customization_uuid.
// ii. (v2-v4) If modelInfo.modelCustomizationId is NOT provided (because it is a pre-1702 ASDC model or
// pre-v3), then modelInfo.modelCustomizationName must have
// been provided (else create request should be rejected). APIH should use the
// relatedInstance.modelInfo[service].modelVersionId** + modelInfo[vnf].modelCustomizationName
// to “join�? service_to_resource_customizations with vnf_resource_customization to confirm a
// vnf_resource_customization.model_customization_uuid record exists.
// **If relatedInstance.modelInfo[service].modelVersionId was not provided, use
// relatedInstance.modelInfo[service].modelInvariantId + modelVersion instead to lookup modelVersionId
// (MODEL_UUID) in SERVICE table.
// iii. Regardless of how the value was provided/obtained above, APIH must always populate
// vnfModelCustomizationId in bpmnRequest. It would be assumed it was MSO generated
// during 1707 data migration if VID did not provide it originally on request.
// iv. Note: continue to construct the “vnf-type�? value and pass to BPMN (must still be populated
// in A&AI).
// 1. If modelCustomizationName is NOT provided on a vnf/vfModule request, use modelCustomizationId to
// look it up in our catalog to construct vnf-type value to pass to BPMN.
VnfResource vnfResource = null;
VnfResourceCustomization vrc = null;
if (modelCustomizationId != null) {
vrc = catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(modelCustomizationId);
if (vrc != null) {
vnfResource = vrc.getVnfResources();
}
} else {
org.onap.so.db.catalog.beans.Service service = catalogDbClient.getServiceByID(relatedInstanceModelVersionId);
if (service == null) {
service = catalogDbClient.getServiceByModelVersionAndModelInvariantUUID(relatedInstanceVersion, relatedInstanceModelInvariantId);
}
if (service == null) {
throw new ValidationException("service in relatedInstance");
}
for (VnfResourceCustomization vnfResourceCustom : service.getVnfCustomizations()) {
if (vnfResourceCustom.getModelInstanceName().equals(modelCustomizationName)) {
vrc = vnfResourceCustom;
}
}
if (vrc != null) {
vnfResource = vrc.getVnfResources();
modelInfo.setModelCustomizationId(vrc.getModelCustomizationUUID());
modelInfo.setModelCustomizationUuid(vrc.getModelCustomizationUUID());
}
}
if (vnfResource == null) {
throw new ValidationException("vnfResource");
} else {
if (modelInfo.getModelVersionId() == null) {
modelInfo.setModelVersionId(vnfResource.getModelUUID());
}
}
VnfRecipe vnfRecipe = null;
if (vrc != null) {
String nfRole = vrc.getNfRole();
if (nfRole != null) {
vnfRecipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(vrc.getNfRole(), action.toString());
}
}
if (vnfRecipe == null) {
vnfRecipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
}
if (vnfRecipe == null) {
return null;
}
return new RecipeLookupResult(vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout());
} else {
/*
* (v5-v7) If modelInfo.modelCustomizationId is NOT provided (because it is a pre-1702 ASDC model or
* pre-v3), then modelInfo.modelCustomizationName must have // been provided (else create request should
* be rejected). APIH should use the relatedInstance.modelInfo[vnf].modelVersionId +
* modelInfo[vnf].modelCustomizationName // to join vnf_to_resource_customizations with
* vf_resource_customization to confirm a vf_resource_customization.model_customization_uuid record
* exists. // Once the vnfs model_customization_uuid has been obtained, use it to find all vfModule
* customizations for that vnf customization in the vnf_res_custom_to_vf_module_custom join table. //
* For each vf_module_cust_model_customization_uuid value returned, use that UUID to query
* vf_module_customization table along with modelInfo[vfModule|volumeGroup].modelVersionId to // confirm
* record matches request data (and to identify the modelCustomizationId associated with the vfModule in
* the request). This means taking each record found // in vf_module_customization and looking up in
* vf_module (using vf_module_customization’s FK into vf_module) to find a match on
* MODEL_INVARIANT_UUID (modelInvariantId) // and MODEL_VERSION (modelVersion).
*/
VfModuleCustomization vfmc = null;
VnfResource vnfr;
VnfResourceCustomization vnfrc;
VfModule vfModule = null;
if (modelInfo.getModelCustomizationId() != null) {
vfmc = catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(modelInfo.getModelCustomizationId());
} else {
vnfr = catalogDbClient.getVnfResourceByModelUUID(relatedInstanceModelVersionId);
if (vnfr == null) {
vnfr = catalogDbClient.getFirstVnfResourceByModelInvariantUUIDAndModelVersion(relatedInstanceModelInvariantId, relatedInstanceVersion);
}
vnfrc = catalogDbClient.getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources(relatedInstanceModelCustomizationName, vnfr);
List<VfModuleCustomization> list = vnfrc.getVfModuleCustomizations();
String vfModuleModelUUID = modelInfo.getModelVersionId();
for (VfModuleCustomization vf : list) {
VfModuleCustomization vfmCustom;
if (vfModuleModelUUID != null) {
vfmCustom = catalogDbClient.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(vf.getModelCustomizationUUID(), vfModuleModelUUID);
if (vfmCustom != null) {
vfModule = vfmCustom.getVfModule();
}
} else {
vfmCustom = catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(vf.getModelCustomizationUUID());
if (vfmCustom != null) {
vfModule = vfmCustom.getVfModule();
} else {
vfModule = catalogDbClient.getVfModuleByModelInvariantUUIDAndModelVersion(relatedInstanceModelInvariantId, relatedInstanceVersion);
}
}
if (vfModule != null) {
modelInfo.setModelCustomizationId(vf.getModelCustomizationUUID());
modelInfo.setModelCustomizationUuid(vf.getModelCustomizationUUID());
break;
}
}
}
if (vfmc == null && vfModule == null) {
throw new ValidationException("vfModuleCustomization");
} else if (vfModule == null && vfmc != null) {
// can't be null as vfModuleModelUUID is not-null property in
vfModule = vfmc.getVfModule();
// VfModuleCustomization table
}
if (modelInfo.getModelVersionId() == null) {
modelInfo.setModelVersionId(vfModule.getModelUUID());
}
recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(vfModule.getModelUUID(), vnfComponentType, action.toString());
if (recipe == null) {
List<VfModule> vfModuleRecords = catalogDbClient.getVfModuleByModelInvariantUUIDOrderByModelVersionDesc(vfModule.getModelInvariantUUID());
if (!vfModuleRecords.isEmpty()) {
for (VfModule record : vfModuleRecords) {
recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(record.getModelUUID(), vnfComponentType, action.toString());
if (recipe != null) {
break;
}
}
}
}
if (recipe == null) {
recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(defaultSource, vnfComponentType, action.toString());
if (recipe == null) {
recipe = catalogDbClient.getFirstVnfComponentsRecipeByVnfComponentTypeAndAction(vnfComponentType, action.toString());
}
if (recipe == null) {
return null;
}
}
}
} else {
if (modelInfo.getModelType().equals(ModelType.vnf)) {
recipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
if (recipe == null) {
return null;
}
} else {
recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(defaultSource, vnfComponentType, action.toString());
if (recipe == null) {
return null;
}
}
}
return new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout());
}
use of org.onap.so.serviceinstancebeans.RelatedInstanceList in project so by onap.
the class MsoRequest method createRequestObject.
public InfraActiveRequests createRequestObject(ServiceInstancesRequest servInsReq, Actions action, String requestId, Status status, String originalRequestJSON, String requestScope) {
InfraActiveRequests aq = new InfraActiveRequests();
try {
if (null == servInsReq) {
servInsReq = new ServiceInstancesRequest();
}
String networkType = "";
String vnfType = "";
aq.setRequestId(requestId);
aq.setRequestAction(action.toString());
aq.setRequestUrl(MDC.get(LogConstants.HTTP_URL));
Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
aq.setStartTime(startTimeStamp);
if (requestScope.equals(ModelType.instanceGroup.name()) && action == Action.deleteInstance) {
aq.setRequestScope(requestScope);
} else {
RequestInfo requestInfo = servInsReq.getRequestDetails().getRequestInfo();
if (requestInfo != null) {
if (requestInfo.getSource() != null) {
aq.setSource(requestInfo.getSource());
}
if (requestInfo.getCallbackUrl() != null) {
aq.setCallBackUrl(requestInfo.getCallbackUrl());
}
if (requestInfo.getCorrelator() != null) {
aq.setCorrelator(requestInfo.getCorrelator());
}
if (requestInfo.getRequestorId() != null) {
aq.setRequestorId(requestInfo.getRequestorId());
}
}
if (servInsReq.getRequestDetails().getModelInfo() != null || (action == Action.inPlaceSoftwareUpdate || action == Action.applyUpdatedConfig)) {
aq.setRequestScope(requestScope);
}
if (servInsReq.getRequestDetails().getCloudConfiguration() != null) {
CloudConfiguration cloudConfiguration = servInsReq.getRequestDetails().getCloudConfiguration();
if (cloudConfiguration.getLcpCloudRegionId() != null) {
aq.setCloudRegion(cloudConfiguration.getLcpCloudRegionId());
}
if (cloudConfiguration.getTenantId() != null) {
aq.setTenantId(cloudConfiguration.getTenantId());
}
}
if (servInsReq.getServiceInstanceId() != null) {
aq.setServiceInstanceId(servInsReq.getServiceInstanceId());
}
if (servInsReq.getVnfInstanceId() != null) {
aq.setVnfId(servInsReq.getVnfInstanceId());
}
if (servInsReq.getPnfName() != null) {
aq.setRequestScope(requestScope);
aq.setPnfName(servInsReq.getPnfName());
}
if (servInsReq.getRequestDetails() != null && servInsReq.getRequestDetails().getRequestInfo() != null && servInsReq.getRequestDetails().getRequestInfo().getProductFamilyId() != null) {
logger.debug("Retrieving productFamilyName to put into requests db");
org.onap.aai.domain.yang.Service service = aaiDataRet.getService(servInsReq.getRequestDetails().getRequestInfo().getProductFamilyId());
if (service != null) {
logger.debug("Found service by service-id");
String productFamilyName = service.getServiceDescription();
if (productFamilyName != null) {
aq.setProductFamilyName(productFamilyName);
}
}
}
aq.setProductFamilyName(getProductFamilyNameFromAAI(servInsReq));
aq.setTenantName(getTenantNameFromAAI(servInsReq));
if (ModelType.service.name().equalsIgnoreCase(requestScope)) {
if (servInsReq.getRequestDetails().getRequestInfo() != null) {
if (servInsReq.getRequestDetails().getRequestInfo().getInstanceName() != null) {
aq.setServiceInstanceName(requestInfo.getInstanceName());
}
}
}
if (ModelType.network.name().equalsIgnoreCase(requestScope)) {
aq.setNetworkName(servInsReq.getRequestDetails().getRequestInfo().getInstanceName());
aq.setNetworkType(networkType);
aq.setNetworkId(servInsReq.getNetworkInstanceId());
}
if (ModelType.volumeGroup.name().equalsIgnoreCase(requestScope)) {
aq.setVolumeGroupId(servInsReq.getVolumeGroupInstanceId());
aq.setVolumeGroupName(servInsReq.getRequestDetails().getRequestInfo().getInstanceName());
aq.setVnfType(vnfType);
}
if (ModelType.vfModule.name().equalsIgnoreCase(requestScope)) {
aq.setVfModuleName(requestInfo.getInstanceName());
aq.setVfModuleModelName(servInsReq.getRequestDetails().getModelInfo().getModelName());
aq.setVfModuleId(servInsReq.getVfModuleInstanceId());
aq.setVolumeGroupId(servInsReq.getVolumeGroupInstanceId());
aq.setVnfType(vnfType);
}
if (ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
aq.setConfigurationId(servInsReq.getConfigurationId());
aq.setConfigurationName(requestInfo.getInstanceName());
}
if (requestScope.equalsIgnoreCase(ModelType.instanceGroup.name())) {
aq.setInstanceGroupId(servInsReq.getInstanceGroupId());
aq.setInstanceGroupName(requestInfo.getInstanceName());
}
if (ModelType.vnf.name().equalsIgnoreCase(requestScope)) {
if (requestInfo != null) {
aq.setVnfName(requestInfo.getInstanceName());
}
if (null != servInsReq.getRequestDetails()) {
RelatedInstanceList[] instanceList = servInsReq.getRequestDetails().getRelatedInstanceList();
if (instanceList != null) {
for (RelatedInstanceList relatedInstanceList : instanceList) {
RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
if (relatedInstance.getModelInfo().getModelType().equals(ModelType.service)) {
aq.setVnfType(vnfType);
}
}
}
}
}
}
aq.setRequestBody(originalRequestJSON);
aq.setRequestStatus(status.toString());
aq.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
} catch (Exception e) {
logger.error("Exception when creation record request", e);
if (!status.equals(Status.FAILED)) {
throw e;
}
}
return aq;
}
use of org.onap.so.serviceinstancebeans.RelatedInstanceList in project so by onap.
the class MsoRequest method getVfModuleType.
public String getVfModuleType(ServiceInstancesRequest sir, String requestScope) {
String vnfType;
String vfModuleType = null;
String vfModuleModelName;
ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
RelatedInstanceList[] instanceList = sir.getRequestDetails().getRelatedInstanceList();
String serviceModelName = null;
String vnfModelName = null;
String volumeGroupId = null;
if (instanceList == null) {
return null;
}
for (RelatedInstanceList relatedInstanceList : instanceList) {
RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo();
if (relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
serviceModelName = relatedInstanceModelInfo.getModelName();
} else if (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf) && !(ModelType.configuration.name().equalsIgnoreCase(requestScope))) {
vnfModelName = relatedInstanceModelInfo.getModelCustomizationName();
} else if (relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)) {
volumeGroupId = relatedInstance.getInstanceId();
}
}
if (requestScope.equalsIgnoreCase(ModelType.vfModule.name())) {
vfModuleModelName = modelInfo.getModelName();
vnfType = serviceModelName + "/" + vnfModelName;
vfModuleType = vnfType + "::" + vfModuleModelName;
sir.setVolumeGroupInstanceId(volumeGroupId);
}
return vfModuleType;
}
Aggregations