+ Map<ResourceKey, String> lookupMap = buildingBlockExecution.getLookupMap();
+ String childSvcInstanceId = lookupMap.get(ResourceKey.CHILD_SERVICE_INSTANCE_ID);
+ String childServiceInstanceId =
+ buildingBlockExecution.getLookupMap().get(ResourceKey.CHILD_SERVICE_INSTANCE_ID);
+ String parentServiceInstanceId = buildingBlockExecution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID);
+ ServiceInstance childInstanceAAI = aaiResourcesClient.get(ServiceInstance.class,
+ AAIUriFactory
+ .createResourceUri(
+ AAIFluentTypeBuilder.Types.SERVICE_INSTANCE.getFragment(childServiceInstanceId))
+ .depth(Depth.TWO))
+ .orElse(null);
+ ServiceInstance parentInstanceAAI =
+ aaiResourcesClient.get(ServiceInstance.class,
+ AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.Types.SERVICE_INSTANCE.getFragment(parentServiceInstanceId))
+ .depth(Depth.TWO))
+ .orElse(null);
+ if (childInstanceAAI == null || parentInstanceAAI == null) {
+ exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 10004, "Service AAI request failed",
+ ONAPComponents.SO);
+ }
+ Service parentInstance = serviceInstanceToServiceBeanMapper(parentInstanceAAI);
+ Service childInstance = serviceInstanceToServiceBeanMapper(childInstanceAAI);
+ ServiceInstancesRequest sir = ChildServiceRequestBuilder
+ .getInstance(buildingBlockExecution, parentInstance, childInstance)
+ .setParentRequestId(
+ buildingBlockExecution.getGeneralBuildingBlock().getRequestContext().getMsoRequestId())
+ .setChildSvcInstanceId(childSvcInstanceId).setCorrelationId(UUID.randomUUID().toString()).build();
+ buildingBlockExecution.setVariable(CHILD_SVC_REQ_PAYLOAD, sir);