Search in sources :

Example 11 with ModelInfo

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

the class UserParamsServiceTraversal method setResourceListForVnfs.

private void setResourceListForVnfs(DelegateExecution execution, List<Resource> resourceList, Resource serviceResource, Service validate) {
    for (Vnfs vnf : validate.getResources().getVnfs()) {
        setVnfCustomizationUUID(vnf);
        Resource vnfResource = new Resource(WorkflowType.VNF, vnf.getModelInfo().getModelCustomizationId(), false, serviceResource);
        vnfResource.setProcessingPriority(vnf.getProcessingPriority());
        vnfResource.setInstanceName(vnf.getInstanceName());
        ModelInfo modelInfo = vnf.getModelInfo();
        if (modelInfo != null) {
            vnfResource.setModelCustomizationId(modelInfo.getModelCustomizationUuid());
            vnfResource.setModelVersionId(modelInfo.getModelVersionId());
        }
        resourceList.add(vnfResource);
        setResourceListForVfModules(execution, resourceList, vnfResource, validate, vnf);
    }
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource) Vnfs(org.onap.so.serviceinstancebeans.Vnfs)

Example 12 with ModelInfo

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

the class RequestHandlerUtilsUnitTest method getIsBaseVfModuleFalseTest.

@Test
public void getIsBaseVfModuleFalseTest() throws ApiException {
    VfModule vfModule = new VfModule();
    vfModule.setIsBase(false);
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setModelVersionId(MODEL_VERSION_ID);
    doReturn(vfModule).when(catDbClient).getVfModuleByModelUUID(MODEL_VERSION_ID);
    Boolean expected = false;
    Boolean result = requestHandler.getIsBaseVfModule(modelInfo, action, vnfType, sdcServiceModelVersion, currentActiveRequest);
    assertEquals(result, expected);
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) VfModule(org.onap.so.db.catalog.beans.VfModule) Test(org.junit.Test)

Example 13 with ModelInfo

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

the class ServiceInstancesTest method setServiceTypeTestDefault.

@Test
public void setServiceTypeTestDefault() throws JsonProcessingException {
    String requestScope = ModelType.service.toString();
    Boolean aLaCarteFlag = false;
    ServiceInstancesRequest sir = new ServiceInstancesRequest();
    RequestDetails requestDetails = new RequestDetails();
    RequestInfo requestInfo = new RequestInfo();
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setModelVersionId("0dd91181-49da-446b-b839-cd959a96f04a");
    requestInfo.setSource("VID");
    requestDetails.setModelInfo(modelInfo);
    requestDetails.setRequestInfo(requestInfo);
    sir.setRequestDetails(requestDetails);
    Service defaultService = new Service();
    defaultService.setServiceType("testServiceType");
    wireMockServer.stubFor(get(urlMatching(".*/service/0dd91181-49da-446b-b839-cd959a96f04a")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_NOT_FOUND)));
    wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
    String serviceType = requestHandlerUtils.getServiceType(requestScope, sir, aLaCarteFlag);
    assertEquals(serviceType, "testServiceType");
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) Service(org.onap.so.db.catalog.beans.Service) RequestInfo(org.onap.so.serviceinstancebeans.RequestInfo) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) Test(org.junit.Test)

Example 14 with ModelInfo

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

the class RequestHandlerUtilsUnitTest method getIsBaseVfModuleModelInfoNotSetTest.

@Test
public void getIsBaseVfModuleModelInfoNotSetTest() throws ApiException {
    ModelInfo modelInfo = new ModelInfo();
    Boolean expected = false;
    Boolean result = requestHandler.getIsBaseVfModule(modelInfo, Action.deleteInstance, vnfType, sdcServiceModelVersion, currentActiveRequest);
    assertEquals(result, expected);
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) Test(org.junit.Test)

Example 15 with ModelInfo

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

the class RequestHandlerUtilsUnitTest method getIsBaseVfModuleNullTest.

@Test
public void getIsBaseVfModuleNullTest() throws ApiException {
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setModelVersionId(MODEL_VERSION_ID);
    modelInfo.setModelName(MODEL_NAME);
    String errorMessage = "VnfType vnfType and VF Module Model Name modelName with version 7 not found in MSO Catalog DB";
    doNothing().when(requestHandler).updateStatus(currentActiveRequest, Status.FAILED, errorMessage);
    doReturn(null).when(catDbClient).getVfModuleByModelUUID(MODEL_VERSION_ID);
    thrown.expect(VfModuleNotFoundException.class);
    thrown.expectMessage(errorMessage);
    requestHandler.getIsBaseVfModule(modelInfo, action, vnfType, sdcServiceModelVersion, currentActiveRequest);
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) Test(org.junit.Test)

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