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