Search in sources :

Example 1 with RequestDetails

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

the class UpdateServiceInstanceInAai method execute.

@Override
public void execute(DelegateExecution delegateExecution) throws Exception {
    logger.debug("Running execute block for activity id: {}, name: {}", delegateExecution.getCurrentActivityId(), delegateExecution.getCurrentActivityName());
    RequestDetails bpmnRequestDetails = requestVerification(delegateExecution);
    final String serviceInstanceId = String.valueOf(delegateExecution.getVariable(SERVICE_INSTANCE_ID));
    final String serviceType = bpmnRequestDetails.getRequestParameters().getSubscriptionServiceType();
    final String globalSubscriberId = bpmnRequestDetails.getSubscriberInfo().getGlobalSubscriberId();
    final String modelId = bpmnRequestDetails.getModelInfo().getModelUuid();
    if (PNF_RESOURCE.equalsIgnoreCase(serviceType)) {
        getAndSetServiceInstance(serviceInstanceId, serviceType, globalSubscriberId, modelId);
    }
    // TODO : handling for vnf
    logger.trace("Completed updating request for ServiceLevelUpgrade.");
}
Also used : RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails)

Example 2 with RequestDetails

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

the class GenericPnfDispatcher 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 3 with RequestDetails

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

the class GenericPnfDispatcher method execute.

@Override
public void execute(DelegateExecution delegateExecution) throws Exception {
    logger.debug("Running execute block for activity id: {}, name: {}", delegateExecution.getCurrentActivityId(), delegateExecution.getCurrentActivityName());
    RequestDetails bpmnRequestDetails = requestVerification(delegateExecution);
    final String serviceInstanceName = bpmnRequestDetails.getRequestInfo().getInstanceName();
    final String pnfName;
    if (delegateExecution.getVariable(PNF_NAME) == null || String.valueOf(delegateExecution.getVariable(PNF_NAME)).trim().isEmpty()) {
        pnfName = bpmnRequestDetails.getRequestParameters().getUserParamValue(PNF_NAME);
    } else {
        pnfName = String.valueOf(delegateExecution.getVariable(PNF_NAME));
    }
    final String serviceModelUuid = bpmnRequestDetails.getModelInfo().getModelUuid();
    final List<Map<String, Object>> userParams = bpmnRequestDetails.getRequestParameters().getUserParams();
    final Pnf pnf = getPnfByPnfName(delegateExecution, pnfName);
    final List<PnfResourceCustomization> pnfCustomizations = getPnfResourceCustomizations(delegateExecution, serviceModelUuid);
    final PnfResourceCustomization pnfResourceCustomization = pnfCustomizations.get(0);
    final String payload = bpmnRequestDetails.getRequestParameters().getPayload();
    populateExecution(delegateExecution, bpmnRequestDetails, pnfResourceCustomization, pnf, serviceInstanceName, pnfName, serviceModelUuid, userParams, payload);
    logger.trace("Completed dispatcher request for PNF.");
}
Also used : PnfResourceCustomization(org.onap.so.db.catalog.beans.PnfResourceCustomization) Pnf(org.onap.aai.domain.yang.Pnf) Map(java.util.Map) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails)

Example 4 with RequestDetails

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

the class ServiceLevelRequestDispatcher method execute.

@Override
public void execute(DelegateExecution delegateExecution) throws Exception {
    logger.debug("Running execute block for activity id: {}, name: {}", delegateExecution.getCurrentActivityId(), delegateExecution.getCurrentActivityName());
    RequestDetails bpmnRequestDetails = requestVerification(delegateExecution);
    final String serviceInstanceId = String.valueOf(delegateExecution.getVariable(SERVICE_INSTANCE_ID));
    final String serviceType = bpmnRequestDetails.getRequestParameters().getSubscriptionServiceType();
    final String globalSubscriberId = bpmnRequestDetails.getSubscriberInfo().getGlobalSubscriberId();
    final String modelInvariantId = bpmnRequestDetails.getModelInfo().getModelInvariantId();
    final String modelId = bpmnRequestDetails.getModelInfo().getModelUuid();
    final String modelVersion = bpmnRequestDetails.getModelInfo().getModelVersion();
    if (ServiceLevelConstants.PNF.equalsIgnoreCase(serviceType)) {
        getAndSetPnfNameFromServiceInstance(serviceInstanceId, serviceType, globalSubscriberId, delegateExecution);
    }
    // TODO : handling for vnf
    logger.trace("Completed dispatcher request for ServiceLevelUpgrade.");
}
Also used : RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails)

Example 5 with RequestDetails

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

the class RequestHandlerUtilsTest method setServiceTypeTestALaCarte.

@Test
public void setServiceTypeTestALaCarte() throws JsonProcessingException {
    String requestScope = ModelType.service.toString();
    Boolean aLaCarteFlag = true;
    ServiceInstancesRequest sir = new ServiceInstancesRequest();
    RequestDetails requestDetails = new RequestDetails();
    RequestInfo requestInfo = new RequestInfo();
    requestInfo.setSource("VID");
    requestDetails.setRequestInfo(requestInfo);
    sir.setRequestDetails(requestDetails);
    Service defaultService = new Service();
    defaultService.setServiceType("testServiceTypeALaCarte");
    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, "testServiceTypeALaCarte");
}
Also used : 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)

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