Search in sources :

Example 61 with ModelInfo

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

the class RequestScopeValidation method validate.

@Override
public ValidationInformation validate(ValidationInformation info) throws ValidationException {
    ModelInfo modelInfo = info.getSir().getRequestDetails().getModelInfo();
    RequestInfo requestInfo = info.getSir().getRequestDetails().getRequestInfo();
    String requestScope;
    if (modelInfo == null) {
        throw new ValidationException("model-info");
    }
    if (requestInfo == null) {
        throw new ValidationException("requestInfo");
    }
    info.setRequestInfo(requestInfo);
    if (modelInfo.getModelType() == null) {
        throw new ValidationException("modelType");
    }
    requestScope = info.getSir().getRequestDetails().getModelInfo().getModelType().name();
    info.setRequestScope(requestScope);
    return info;
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) ValidationException(org.onap.so.exceptions.ValidationException) RequestInfo(org.onap.so.serviceinstancebeans.RequestInfo)

Example 62 with ModelInfo

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

the class WorkflowAction method getResourceKey.

private Resource getResourceKey(ServiceInstancesRequest sIRequest, WorkflowType resourceType) {
    String resourceId = "";
    ModelInfo modelInfo = sIRequest.getRequestDetails().getModelInfo();
    if (modelInfo != null) {
        if (modelInfo.getModelType().equals(ModelType.service)) {
            resourceId = modelInfo.getModelVersionId();
        } else {
            resourceId = modelInfo.getModelCustomizationId();
        }
    }
    return new Resource(resourceType, resourceId, true, null);
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo)

Example 63 with ModelInfo

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

the class UserParamsServiceTraversal method setResourceListForNetworks.

private void setResourceListForNetworks(DelegateExecution execution, String serviceModelVersionId, String requestAction, List<Resource> resourceList, Resource serviceResource, Service validate) {
    for (Networks network : validate.getResources().getNetworks()) {
        Resource networkResource = new Resource(WorkflowType.NETWORK, network.getModelInfo().getModelCustomizationId(), false, serviceResource);
        networkResource.setProcessingPriority(network.getProcessingPriority());
        ModelInfo modelInfo = network.getModelInfo();
        if (modelInfo != null) {
            networkResource.setModelCustomizationId(modelInfo.getModelCustomizationUuid());
            networkResource.setModelVersionId(modelInfo.getModelVersionId());
        }
        resourceList.add(networkResource);
    }
    if (requestAction.equals(CREATE_INSTANCE)) {
        String networkColCustId = queryCatalogDbForNetworkCollection(execution, serviceModelVersionId);
        if (networkColCustId != null) {
            resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, networkColCustId, false, serviceResource));
        }
    }
}
Also used : Networks(org.onap.so.serviceinstancebeans.Networks) ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource)

Example 64 with ModelInfo

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

the class UserParamsServiceTraversal method getResourceList.

private List<Resource> getResourceList(DelegateExecution execution, String serviceModelVersionId, String requestAction, Service validate) {
    List<Resource> resourceList = new ArrayList<>();
    Resource serviceResource = new Resource(WorkflowType.SERVICE, validate.getModelInfo().getModelVersionId(), false, null);
    ModelInfo modelInfo = validate.getModelInfo();
    if (modelInfo != null) {
        serviceResource.setModelVersionId(modelInfo.getModelVersionId());
        serviceResource.setModelInvariantId(modelInfo.getModelInvariantUuid());
    }
    resourceList.add(serviceResource);
    if (validate.getResources().getVnfs() != null) {
        setResourceListForVnfs(execution, resourceList, serviceResource, validate);
    }
    if (validate.getResources().getPnfs() != null) {
        setResourceListForPnfs(resourceList, serviceResource, validate);
    }
    if (validate.getResources().getNetworks() != null) {
        setResourceListForNetworks(execution, serviceModelVersionId, requestAction, resourceList, serviceResource, validate);
    }
    return resourceList;
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource) ArrayList(java.util.ArrayList)

Example 65 with ModelInfo

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

the class BpmnRequestBuilder method mapVnfModelInformation.

protected ModelInfo mapVnfModelInformation(GenericVnf vnf) {
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setModelCustomizationId(vnf.getModelCustomizationId());
    modelInfo.setModelCustomizationUuid(vnf.getModelCustomizationId());
    modelInfo.setModelType(ModelType.vnf);
    return modelInfo;
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo)

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