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.");
}
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;
}
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.");
}
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.");
}
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");
}
Aggregations