diff options
Diffstat (limited to 'src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java')
-rw-r--r-- | src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java | 358 |
1 files changed, 187 insertions, 171 deletions
diff --git a/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java b/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java index b6c1d12..2df082c 100644 --- a/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java +++ b/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java @@ -15,6 +15,7 @@ * limitations under the License. * ============LICENSE_END===================================================== */ + package org.onap.pomba.contextbuilder.networkdiscovery.service; import com.bazaarvoice.jolt.Chainr; @@ -38,16 +39,15 @@ import javax.ws.rs.core.Response.Status.Family; import org.onap.aai.restclient.client.Headers; import org.onap.pomba.common.datatypes.Attribute; +import org.onap.pomba.common.datatypes.DataQuality; import org.onap.pomba.common.datatypes.ModelContext; import org.onap.pomba.common.datatypes.Network; import org.onap.pomba.common.datatypes.VFModule; import org.onap.pomba.common.datatypes.VM; import org.onap.pomba.common.datatypes.VNF; import org.onap.pomba.contextbuilder.networkdiscovery.exception.DiscoveryException; -import org.onap.pomba.contextbuilder.networkdiscovery.model.NdQuery; import org.onap.pomba.contextbuilder.networkdiscovery.model.NdResource; import org.onap.pomba.contextbuilder.networkdiscovery.model.NdResources; -import org.onap.pomba.contextbuilder.networkdiscovery.model.NdResourcesList; import org.onap.pomba.contextbuilder.networkdiscovery.service.rs.RestService; import org.onap.pomba.contextbuilder.networkdiscovery.util.RestUtil; import org.onap.sdnc.apps.pomba.networkdiscovery.datamodel.NetworkDiscoveryNotification; @@ -122,47 +122,33 @@ public class SpringServiceImpl implements SpringService { String serviceInstanceId, String modelVersionId, String modelInvariantId) throws DiscoveryException { String remoteAddress = req.getRemoteAddr() != null ? req.getRemoteAddr() : null; - initMDC(requestId, partnerName, serviceInstanceId, remoteAddress); - - try { - RestUtil.validateServiceInstanceId(serviceInstanceId); - RestUtil.validatePartnerName(partnerName); - validateBasicAuth(authorization); - String sdReply = getServiceDeomposition(serviceInstanceId, partnerName, requestId); - ModelContext networkDiscoveryCtx = createModelContextFromSdResonse(sdReply); - NdQuery ndQuery = createNdQueryFromSdResonse(sdReply); - sendNetworkDiscoveryRequest(networkDiscoveryCtx, ndQuery, requestId, partnerName); - return networkDiscoveryCtx; - - } catch (Exception x) { - DiscoveryException exception = new DiscoveryException(x.getMessage(), x); - MDC.put(MDC_RESPONSE_CODE, String.valueOf(exception.getHttpStatus().getStatusCode())); - MDC.put(MDC_STATUS_CODE, "ERROR"); - log.error(x.getMessage()); - throw exception; - } finally { - MDC.clear(); - } + initMdc(requestId, partnerName, serviceInstanceId, remoteAddress); + + RestUtil.validateServiceInstanceId(serviceInstanceId); + RestUtil.validatePartnerName(partnerName); + validateBasicAuth(authorization); + String sdReply = getServiceDeomposition(serviceInstanceId, partnerName, requestId); + ModelContext networkDiscoveryCtx = createModelContextFromSdResonse(sdReply); + NdResources ndResources = createNdResourcesFromSdResonse(sdReply); + sendNetworkDiscoveryRequest(networkDiscoveryCtx, ndResources, requestId, partnerName); + return networkDiscoveryCtx; } - private void initMDC(String requestId, String partnerName, String serviceInstanceId, String remoteAddress) { - MDC.clear(); - MDC.put(MDC_REQUEST_ID, requestId); - MDC.put(MDC_SERVICE_NAME, APP_NAME); - MDC.put(MDC_SERVICE_INSTANCE_ID, serviceInstanceId); - MDC.put(MDC_PARTNER_NAME, partnerName); - MDC.put(MDC_CLIENT_ADDRESS, remoteAddress); - MDC.put(MDC_START_TIME, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX").format(new Date())); - MDC.put(MDC_INVOCATION_ID, UUID.randomUUID().toString()); - MDC.put(MDC_INSTANCE_UUID, instanceUUID.toString()); - - try { - MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getCanonicalHostName()); - } catch (Exception e) { - // If, for some reason we are unable to get the canonical host name, - // we - // just want to leave the field null. - log.info("Could not get canonical host name for " + MDC_SERVER_FQDN + ", leaving field null"); + /** + * Validates the Basic authorization header as admin:admin. + * + * @throws DiscoveryException + * if there is missing parameter + */ + public void validateBasicAuth(String authorization) throws DiscoveryException { + if (authorization != null && !authorization.trim().isEmpty() && authorization.startsWith("Basic")) { + if (!authorization.equals(networkDiscoveryCtxBuilderBasicAuthorization)) { + throw new DiscoveryException("Authorization Failed", Status.UNAUTHORIZED); + } + } else { + throw new DiscoveryException( + "Missing Authorization: " + (authorization == null ? "null" : authorization), + Status.UNAUTHORIZED); } } @@ -174,77 +160,49 @@ public class SpringServiceImpl implements SpringService { if (serviceInstanceId == null) { return null; } + + String urlStr = serviceDecompositionBaseUrl + "?serviceInstanceId=" + serviceInstanceId; - log.info("Querying Service Decomposition for service instance {}", serviceInstanceId); - - String urlStr = getUrl(serviceInstanceId); - - log.info("Querying Service Decomposition for url {}", urlStr); + log.info("Querying Service Decomposition for service instance {} at url {}", serviceInstanceId, urlStr); + Response response = jerseyClient.target(urlStr).request().header(Headers.ACCEPT, MediaType.APPLICATION_JSON) + .header(Headers.AUTHORIZATION, serviceDecompositionBasicAuthorization) + .header(NETWORK_DISCOVERY_FIND_RESOURCE_BY_TYPE_REST_X_ONAP_PARTNER_NAME, partnerName) + .header(NETWORK_DISCOVERY_FIND_RESOURCE_BY_TYPE_REST_X_ONAP_REQUEST_ID, requestId).get(); - try { - Response response = jerseyClient.target(urlStr).request() - .header(Headers.ACCEPT, MediaType.APPLICATION_JSON) - .header(Headers.AUTHORIZATION, getSdBasicAuthorization()) - .header(NETWORK_DISCOVERY_FIND_RESOURCE_BY_TYPE_REST_X_ONAP_PARTNER_NAME, partnerName) - .header(NETWORK_DISCOVERY_FIND_RESOURCE_BY_TYPE_REST_X_ONAP_REQUEST_ID, requestId).get(); - - String reply = null; - if (response.getStatusInfo().getFamily() != Family.SUCCESSFUL) { - MDC.put(MDC_RESPONSE_CODE, String.valueOf(response.getStatus())); - MDC.put(MDC_STATUS_CODE, "ERROR"); - throw new DiscoveryException(response.getStatusInfo().toString(), - Response.Status.fromStatusCode(response.getStatus())); - } else { - MDC.put(MDC_RESPONSE_CODE, String.valueOf(response.getStatus())); - MDC.put(MDC_STATUS_CODE, "COMPLETE"); - reply = response.readEntity(String.class); - - log.info( - "GET Response from ServiceDecompositionMircoService GetContext for serviceInstanceId: {}, message body: {}", - serviceInstanceId, reply); - } + log.info( + "GET Response from ServiceDecompositionMircoService for serviceInstanceId: {}, status code {}", + serviceInstanceId, response.getStatusInfo().getStatusCode()); - return reply; - } catch (Exception x) { - throw new DiscoveryException(x.getMessage(), x); + if (response.getStatusInfo().getFamily() != Family.SUCCESSFUL) { + MDC.put(MDC_RESPONSE_CODE, String.valueOf(response.getStatus())); + MDC.put(MDC_STATUS_CODE, "ERROR"); + throw new DiscoveryException( + "Error from Service Decomposition service: " + response.getStatusInfo().getReasonPhrase(), + Response.Status.fromStatusCode(response.getStatus())); } - } - private String getUrl(String serviceInstanceId) { - return serviceDecompositionBaseUrl + "?serviceInstanceId=" + serviceInstanceId; - } + MDC.put(MDC_RESPONSE_CODE, String.valueOf(response.getStatus())); + MDC.put(MDC_STATUS_CODE, "COMPLETE"); + String reply = response.readEntity(String.class); - private String getSdBasicAuthorization() { - return serviceDecompositionBasicAuthorization; - } + log.info( + "GET Response from ServiceDecompositionMircoService GetContext for serviceInstanceId: {}, message body: {}", + serviceInstanceId, reply); - /** - * Validates the Basic authorization header as admin:admin. - * - * @throws DiscoveryException - * if there is missing parameter - */ - public void validateBasicAuth(String authorization) throws DiscoveryException { - if (authorization != null && !authorization.trim().isEmpty() && authorization.startsWith("Basic")) { - if (!authorization.equals(networkDiscoveryCtxBuilderBasicAuthorization)) { - throw new DiscoveryException("Authorization Failed", Status.UNAUTHORIZED); - } - } else { - throw new DiscoveryException( - "Missing Authorization: " + (authorization == null ? "null" : authorization), - Status.UNAUTHORIZED); - } + return reply; } private void updateNetworkDiscoveryCtx(ModelContext networkDiscoveryCtx, Resource resource) { + // Future: try to replace this with a Jolt transformation. for (VNF vnf : networkDiscoveryCtx.getVnfs()) { for (VFModule vfModule : vnf.getVfModules()) { for (VM vm : vfModule.getVms()) { - if (vm.getUuid().equals(resource.getId())) { + if (vm.getUuid().equals(resource.getId()) && "vserver".equals(resource.getType())) { vm.setDataQuality(resource.getDataQuality()); if (null != resource.getAttributeList()) { - for (org.onap.sdnc.apps.pomba.networkdiscovery.datamodel.Attribute ndattribute : resource.getAttributeList()) { + for (org.onap.sdnc.apps.pomba.networkdiscovery.datamodel.Attribute ndattribute : resource + .getAttributeList()) { try { String ndattributeName = ndattribute.getName(); // Some Network Discovery attribute name do not exactly @@ -270,41 +228,66 @@ public class SpringServiceImpl implements SpringService { attribute.setValue(ndattribute.getValue()); attribute.setDataQuality(ndattribute.getDataQuality()); vm.addAttribute(attribute); - break; + break; default: attribute = new Attribute(); attribute.setName(Attribute.Name.valueOf(ndattributeName)); attribute.setValue(ndattribute.getValue()); attribute.setDataQuality(ndattribute.getDataQuality()); - vm.addAttribute(attribute); + vm.addAttribute(attribute); } } catch (IllegalArgumentException ex) { // The attribute Name passed back from Network Discovery is not in our enum - log.info("Attribute Name: {} for Resource: {} Id: {} is invalid", ndattribute.getName(), resource.getName(), resource.getId()); + log.info("Attribute Name: {} for Resource: {} Id: {} is invalid", + ndattribute.getName(), resource.getName(), resource.getId()); } } } } } for (Network network : vfModule.getNetworks()) { - if (network.getUuid().equals(resource.getId())) { + if (network.getUuid().equals(resource.getId()) && "l3-network".equals(resource.getType())) { network.setDataQuality(resource.getDataQuality()); if (null != resource.getAttributeList()) { - for (org.onap.sdnc.apps.pomba.networkdiscovery.datamodel.Attribute ndattribute : resource.getAttributeList()) { + for (org.onap.sdnc.apps.pomba.networkdiscovery.datamodel.Attribute ndattribute : resource + .getAttributeList()) { try { String ndattributeName = ndattribute.getName(); - if (ndattributeName.equals("name")) { + // Some Network Discovery attribute name do not exactly + // match the pomba-audit-common model Attribute Enums, + // so we have to do some custom mapping here: + switch (ndattributeName) { + case "id": + network.setUuid(ndattribute.getValue()); + break; + case "name": network.setName(ndattribute.getValue()); - } - else { + break; + case "AdminState": Attribute attribute = new Attribute(); + attribute.setName(Attribute.Name.adminStatus); + attribute.setValue(ndattribute.getValue()); + attribute.setDataQuality(ndattribute.getDataQuality()); + network.addAttribute(attribute); + break; + case "sharedNetwork": + attribute = new Attribute(); + attribute.setName(Attribute.Name.sharedNetworkBoolean); + attribute.setValue(ndattribute.getValue()); + attribute.setDataQuality(ndattribute.getDataQuality()); + network.addAttribute(attribute); + break; + default: + attribute = new Attribute(); attribute.setName(Attribute.Name.valueOf(ndattributeName)); attribute.setValue(ndattribute.getValue()); + attribute.setDataQuality(ndattribute.getDataQuality()); network.addAttribute(attribute); } } catch (IllegalArgumentException ex) { // The attribute Name passed back from Network Discovery is not in our enum - log.info("Attribute Name: {} for Resource: {} Id: {} is invalid", ndattribute.getName(), resource.getName(), resource.getId()); + log.info("Attribute Name: {} for Resource: {} Id: {} is invalid", + ndattribute.getName(), resource.getName(), resource.getId()); } } } @@ -315,72 +298,111 @@ public class SpringServiceImpl implements SpringService { } } + private void updateNetworkDiscoveryCtxDataQuality(ModelContext networkDiscoveryCtx, String resourceId, + DataQuality dataQuality) { + for (VNF vnf : networkDiscoveryCtx.getVnfs()) { + for (VFModule vfModule : vnf.getVfModules()) { + for (VM vm : vfModule.getVms()) { + if (vm.getUuid().equals(resourceId)) { + vm.setDataQuality(dataQuality); + } + } + for (Network network : vfModule.getNetworks()) { + if (network.getUuid().equals(resourceId)) { + network.setDataQuality(dataQuality); + } + } + + } + } + } /* Return list of requestIds sent to network-discovery microService. */ - private void sendNetworkDiscoveryRequest(ModelContext networkDiscoveryCtx, - NdQuery ndQuery, - String parentRequestId, - String partnerName) throws DiscoveryException { - for (NdResourcesList ndResourcesList : ndQuery.getNdQuery()) { - for (NdResources ndResources : ndResourcesList.getNdResources()) { - for (NdResource ndResource : ndResources.getNdResources()) { - // The old_requestId is inherited from ServiceDecomposition. - // Before we send a message to NetworkDiscoveryMicroService for each Resource, - // we need to generate a new request for identification, based on the old ID. - String requestId = parentRequestId + NETWORK_DISCOVERY_RSP_REQUESTID_SPLITTER + uniqueSeq.incrementAndGet(); - - NetworkDiscoveryNotification nt = sendNetworkDiscoveryRequestToSpecificServer(partnerName, parentRequestId, - requestId, ndResource.getResourceId(), ndResource.getResourceType()); - - List<Resource> resourceList = nt.getResources(); - for (Resource resource1 : resourceList) { - updateNetworkDiscoveryCtx(networkDiscoveryCtx, resource1); - } + private void sendNetworkDiscoveryRequest(ModelContext networkDiscoveryCtx, NdResources ndResources, + String parentRequestId, String partnerName) throws DiscoveryException { + + for (NdResource ndResource : ndResources.getNdResources()) { + try { + // The old_requestId is inherited from ServiceDecomposition. + // Before we send a message to NetworkDiscoveryMicroService for each Resource, + // we need to generate a new request for identification, based on the old ID. + String requestId = parentRequestId + NETWORK_DISCOVERY_RSP_REQUESTID_SPLITTER + + uniqueSeq.incrementAndGet(); + + NetworkDiscoveryNotification nt = sendNetworkDiscoveryRequestToSpecificServer(partnerName, + parentRequestId, requestId, ndResource.getResourceId(), ndResource.getResourceType()); + + List<Resource> resourceList = nt.getResources(); + for (Resource resource1 : resourceList) { + updateNetworkDiscoveryCtx(networkDiscoveryCtx, resource1); } + } catch (Exception e) { + log.error("Error from Network Disovery Request - resourceId: {}, message: {}", + ndResource.getResourceId(), e.getMessage()); + DataQuality dataQuality = DataQuality.error("Error from Network Disovery Request: " + e.getMessage()); + updateNetworkDiscoveryCtxDataQuality(networkDiscoveryCtx, ndResource.getResourceId(), dataQuality); } } } - private NetworkDiscoveryNotification sendNetworkDiscoveryRequestToSpecificServer(String partnerName, String parentRequestId, - String requestId, String resourceId, String resourceType) + private NetworkDiscoveryNotification sendNetworkDiscoveryRequestToSpecificServer(String partnerName, + String parentRequestId, String requestId, String resourceId, String resourceType) throws DiscoveryException { - String networkDiscoveryUrl = networkDiscoveryMicroServiceBaseUrl; // Prepare MDC for logs - initMdcSendToNetworkDiscoveryMicroService(networkDiscoveryUrl, requestId, resourceType, resourceId, - partnerName); + initMdcSendToNetworkDiscoveryMicroService(networkDiscoveryMicroServiceBaseUrl, requestId, resourceType, + resourceId, partnerName); - try { - Response response = jerseySslClient.target(networkDiscoveryUrl) - .queryParam(NETWORK_DISCOVERY_FIND_RESOURCE_BY_TYPE_REST_REQUEST_ID, requestId) - .queryParam(NETWORK_DISCOVERY_FIND_RESOURCE_BY_TYPE_REST_RESOURCE_TYPE, resourceType) - .queryParam(NETWORK_DISCOVERY_FIND_RESOURCE_BY_TYPE_REST_RESOURCE_ID, resourceId) - .request() - .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON) - .header(HttpHeaders.AUTHORIZATION, getNetworkDiscoveryMircoServiceBasicAuthorization()) - .header(NETWORK_DISCOVERY_FIND_RESOURCE_BY_TYPE_REST_X_ONAP_PARTNER_NAME, partnerName) - .header(NETWORK_DISCOVERY_FIND_RESOURCE_BY_TYPE_REST_X_ONAP_REQUEST_ID, parentRequestId).get(); - - String status = Response.Status.fromStatusCode(response.getStatus()) + ",code:" + response.getStatus(); - - if (response.getStatusInfo().getFamily() != Family.SUCCESSFUL) { - MDC.put(MDC_TO_NETWORK_DISCOVERY_MICRO_SERVICE_STATUS, status); - throw new DiscoveryException(response.getStatusInfo().toString(), - Response.Status.fromStatusCode(response.getStatus())); - } else { - MDC.put(MDC_TO_NETWORK_DISCOVERY_MICRO_SERVICE_STATUS, status); - NetworkDiscoveryNotification ndResponse = response.readEntity(NetworkDiscoveryNotification.class); - log.info("Message sent. Response Payload: {}", ndResponse); - return ndResponse; - } - } catch (Exception e) { - MDC.put(MDC_TO_NETWORK_DISCOVERY_MICRO_SERVICE_STATUS, e.getMessage()); - throw new DiscoveryException(e.getMessage(), e); + log.info("Network Disvovery request for url {}, resourceId {}, resourceType {}", + networkDiscoveryMicroServiceBaseUrl, resourceId, resourceType); + + Response response = jerseySslClient.target(networkDiscoveryMicroServiceBaseUrl) + .queryParam(NETWORK_DISCOVERY_FIND_RESOURCE_BY_TYPE_REST_REQUEST_ID, requestId) + .queryParam(NETWORK_DISCOVERY_FIND_RESOURCE_BY_TYPE_REST_RESOURCE_TYPE, resourceType) + .queryParam(NETWORK_DISCOVERY_FIND_RESOURCE_BY_TYPE_REST_RESOURCE_ID, resourceId).request() + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON) + .header(HttpHeaders.AUTHORIZATION, networkDiscoveryMicroServiceBasicAuthorization) + .header(NETWORK_DISCOVERY_FIND_RESOURCE_BY_TYPE_REST_X_ONAP_PARTNER_NAME, partnerName) + .header(NETWORK_DISCOVERY_FIND_RESOURCE_BY_TYPE_REST_X_ONAP_REQUEST_ID, parentRequestId).get(); + + String status = Response.Status.fromStatusCode(response.getStatus()) + ",code:" + response.getStatus(); + + log.info("Network Disvovery response status code: {}", response.getStatus()); + + MDC.put(MDC_TO_NETWORK_DISCOVERY_MICRO_SERVICE_STATUS, status); + + if (response.getStatusInfo().getFamily() != Family.SUCCESSFUL) { + throw new DiscoveryException( + "Error from Network Discovery service: " + response.getStatusInfo().getReasonPhrase(), + Response.Status.fromStatusCode(response.getStatus())); } + + NetworkDiscoveryNotification ndResponse = response.readEntity(NetworkDiscoveryNotification.class); + log.info("Message sent. Response Payload: {}", ndResponse); + return ndResponse; } - private String getNetworkDiscoveryMircoServiceBasicAuthorization() { - return networkDiscoveryMicroServiceBasicAuthorization; + + private void initMdc(String requestId, String partnerName, String serviceInstanceId, String remoteAddress) { + MDC.clear(); + MDC.put(MDC_REQUEST_ID, requestId); + MDC.put(MDC_SERVICE_NAME, APP_NAME); + MDC.put(MDC_SERVICE_INSTANCE_ID, serviceInstanceId); + MDC.put(MDC_PARTNER_NAME, partnerName); + MDC.put(MDC_CLIENT_ADDRESS, remoteAddress); + MDC.put(MDC_START_TIME, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX").format(new Date())); + MDC.put(MDC_INVOCATION_ID, UUID.randomUUID().toString()); + MDC.put(MDC_INSTANCE_UUID, instanceUUID.toString()); + + try { + MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getCanonicalHostName()); + } catch (Exception e) { + // If, for some reason we are unable to get the canonical host name, + // we + // just want to leave the field null. + log.info("Could not get canonical host name for " + MDC_SERVER_FQDN + ", leaving field null"); + } } private void initMdcSendToNetworkDiscoveryMicroService(String networkDiscoveryUrl, String requestId, @@ -390,7 +412,7 @@ public class SpringServiceImpl implements SpringService { String parentPartnerName = MDC.get(MDC_PARTNER_NAME); MDC.clear(); - initMDC(parentRequestId, parentPartnerName, parentServiceInstanceId, networkDiscoveryMicroServiceHostAndPort); + initMdc(parentRequestId, parentPartnerName, parentServiceInstanceId, networkDiscoveryMicroServiceHostAndPort); MDC.put(MDC_SERVICE_NAME, MDC_TO_NETWORK_DISCOVERY_MICRO_SERVICE_APP); MDC.put(MDC_TO_NETWORK_DISCOVERY_MICRO_SERVICE_MSG_NAME, @@ -410,30 +432,24 @@ public class SpringServiceImpl implements SpringService { } } - private ModelContext createModelContextFromSdResonse(String response) { - List<Object> jsonSpec = JsonUtils.filepathToList("config/networkdiscovery.spec"); + List<Object> jsonSpec = JsonUtils.filepathToList("config/jolt/sdToModelContextSpec.json"); Object jsonInput = JsonUtils.jsonToObject(response); Chainr chainr = Chainr.fromSpec(jsonSpec); Object transObject = chainr.transform(jsonInput); + log.debug("Jolt transformed output: {}", JsonUtils.toJsonString(transObject)); Gson gson = new Gson(); return gson.fromJson(JsonUtils.toPrettyJsonString(transObject), ModelContext.class); - } - private NdQuery createNdQueryFromSdResonse(String response) { - List<Object> jsonSpec = JsonUtils.filepathToList("config/ndQuery.spec"); + private NdResources createNdResourcesFromSdResonse(String response) { + List<Object> jsonSpec = JsonUtils.filepathToList("config/jolt/sdToNdResourcesSpec.json"); Object jsonInput = JsonUtils.jsonToObject(response); Chainr chainr = Chainr.fromSpec(jsonSpec); Object transObject = chainr.transform(jsonInput); - Gson gson = new Gson(); - - log.info("Jolt transformed output: {}", JsonUtils.toJsonString(transObject)); - - - return gson.fromJson(JsonUtils.toPrettyJsonString(transObject), NdQuery.class); - + log.debug("Jolt transformed output: {}", JsonUtils.toJsonString(transObject)); + Gson gson = new Gson(); + return gson.fromJson(JsonUtils.toPrettyJsonString(transObject), NdResources.class); } - } |