Search in sources :

Example 81 with RequestDetails

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

the class BBInputSetup method getGBB.

protected GeneralBuildingBlock getGBB(ExecuteBuildingBlock executeBB, Map<ResourceKey, String> lookupKeyMap, String requestAction, boolean aLaCarte, String resourceId, String vnfType) throws Exception {
    String requestId = executeBB.getRequestId();
    this.populateLookupKeyMapWithIds(executeBB.getWorkflowResourceIds(), lookupKeyMap);
    RequestDetails requestDetails = executeBB.getRequestDetails();
    if (requestDetails == null) {
        requestDetails = bbInputSetupUtils.getRequestDetails(requestId);
    }
    if (requestDetails.getModelInfo() == null) {
        return this.getGBBCM(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId);
    } else {
        ModelType modelType = requestDetails.getModelInfo().getModelType();
        if (aLaCarte && modelType.equals(ModelType.service)) {
            return this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId);
        } else if (aLaCarte && !modelType.equals(ModelType.service)) {
            return this.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
        } else {
            return this.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
        }
    }
}
Also used : ModelType(org.onap.so.serviceinstancebeans.ModelType) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails)

Example 82 with RequestDetails

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

the class NfSoftwareUpgradeDispatcher method requestVerification.

private RequestDetails requestVerification(DelegateExecution delegateExecution) throws IOException {
    RequestDetails bpmnRequestDetails = mapper.readValue(JsonUtils.getJsonValue(String.valueOf(delegateExecution.getVariable(BPMN_REQUEST)), "requestDetails"), RequestDetails.class);
    throwIfNull(delegateExecution, bpmnRequestDetails.getModelInfo(), SERVICE_MODEL_INFO);
    throwIfNull(delegateExecution, bpmnRequestDetails.getRequestInfo(), "RequestInfo");
    throwIfNull(delegateExecution, bpmnRequestDetails.getRequestParameters(), "RequestParameters");
    throwIfNull(delegateExecution, bpmnRequestDetails.getRequestParameters().getUserParams(), "UserParams");
    return bpmnRequestDetails;
}
Also used : RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails)

Example 83 with RequestDetails

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

the class AaiResourceIdValidatorTest method validateNetworkResourceIdInAAIDuplicateNameTest.

@Test
public void validateNetworkResourceIdInAAIDuplicateNameTest() throws Exception {
    RequestDetails reqDetails = setupRequestDetails();
    WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
    workflowResourceIds.setServiceInstanceId("siId123");
    L3Network network = new L3Network();
    network.setModelCustomizationId("9999999");
    Optional<L3Network> opNetwork = Optional.of(network);
    when(bbInputSetupUtilsMock.getRelatedNetworkByNameFromServiceInstance("siId123", "name123")).thenReturn(opNetwork);
    this.expectedException.expect(DuplicateNameException.class);
    this.expectedException.expectMessage(containsString("l3Network with name (name123), same parent and different customization id (9999999) already exists. The name must be unique."));
    testedObject.validateNetworkResourceIdInAAI("generatedId123", "name123", reqDetails, workflowResourceIds);
}
Also used : L3Network(org.onap.aai.domain.yang.L3Network) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) WorkflowResourceIds(org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds) Test(org.junit.Test)

Example 84 with RequestDetails

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

the class AaiResourceIdValidatorTest method validateResourceIdInAAINetworkTest.

@Test
public void validateResourceIdInAAINetworkTest() throws Exception {
    RequestDetails reqDetails = setupRequestDetails();
    WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
    workflowResourceIds.setServiceInstanceId("siId123");
    L3Network network = new L3Network();
    network.setNetworkId("id123");
    network.setModelCustomizationId("1234567");
    Optional<L3Network> opNetwork = Optional.of(network);
    L3Network network2 = new L3Network();
    network2.setNetworkId("id123");
    network2.setModelCustomizationId("222");
    Optional<L3Network> opNetwork2 = Optional.of(network2);
    when(bbInputSetupUtilsMock.getRelatedNetworkByNameFromServiceInstance("siId123", "name123")).thenReturn(opNetwork);
    when(bbInputSetupUtilsMock.getRelatedNetworkByNameFromServiceInstance("siId123", "networkName222")).thenReturn(opNetwork2);
    String id = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "name123", reqDetails, workflowResourceIds);
    assertEquals("id123", id);
    String id2 = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "111111", reqDetails, workflowResourceIds);
    assertEquals("generatedId123", id2);
    this.expectedException.expect(DuplicateNameException.class);
    this.expectedException.expectMessage(containsString("l3Network with name (networkName222), same parent and different customization id (222) already exists. The name must be unique."));
    testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "networkName222", reqDetails, workflowResourceIds);
}
Also used : L3Network(org.onap.aai.domain.yang.L3Network) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) WorkflowResourceIds(org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds) Test(org.junit.Test)

Example 85 with RequestDetails

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

the class AaiResourceIdValidatorTest method validateResourceIdInAAISIExistsTest.

@Test
public void validateResourceIdInAAISIExistsTest() throws Exception {
    RequestDetails reqDetails = setupRequestDetails();
    reqDetails.getModelInfo().setModelVersionId("1234567");
    ServiceInstance si = new ServiceInstance();
    si.setServiceInstanceId("siId123");
    si.setModelVersionId("1234567");
    ServiceInstances serviceInstances = new ServiceInstances();
    serviceInstances.getServiceInstance().add(si);
    Map<String, String> uriKeys = new HashMap<>();
    uriKeys.put(AAIFluentTypeBuilder.Types.CUSTOMER.getUriParams().globalCustomerId, "globalCustomerId");
    uriKeys.put(AAIFluentTypeBuilder.Types.SERVICE_SUBSCRIPTION.getUriParams().serviceType, "serviceType");
    when(bbInputSetupUtilsMock.getAAIServiceInstancesGloballyByName("siName123")).thenReturn(serviceInstances);
    when(bbInputSetupUtilsMock.getURIKeysFromServiceInstance("siId123")).thenReturn(uriKeys);
    this.expectedException.expect(DuplicateNameException.class);
    this.expectedException.expectMessage(containsString("serviceInstance with name (siName123) and global-customer-id (globalCustomerId), service-type (serviceType), model-version-id (1234567) already exists. The name must be unique."));
    testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName123", reqDetails, new WorkflowResourceIds());
}
Also used : ServiceInstances(org.onap.aai.domain.yang.ServiceInstances) HashMap(java.util.HashMap) ServiceInstance(org.onap.aai.domain.yang.ServiceInstance) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) WorkflowResourceIds(org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds) Test(org.junit.Test)

Aggregations

RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)163 Test (org.junit.Test)126 Service (org.onap.so.db.catalog.beans.Service)55 File (java.io.File)52 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)51 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)47 WorkflowResourceIds (org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds)43 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)42 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)38 HashMap (java.util.HashMap)37 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)36 ServiceInstancesRequest (org.onap.so.serviceinstancebeans.ServiceInstancesRequest)36 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)35 BuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock)27 RequestInfo (org.onap.so.serviceinstancebeans.RequestInfo)27 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)23 ConfigurationResourceKeys (org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys)21 CloudConfiguration (org.onap.so.serviceinstancebeans.CloudConfiguration)20 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)19 GenericVnf (org.onap.aai.domain.yang.GenericVnf)18