From 163ec605f4b3029a3b945530ed995ec8be457796 Mon Sep 17 00:00:00 2001 From: Neha Sood Date: Mon, 4 Feb 2019 12:24:37 -0500 Subject: fix bug for readResource in AAI fix bug for readResource in AaiService Change-Id: I20a6564f3bbc16ab5deb3e0e40a75a105343965d Issue-ID: APPC-1379 Signed-off-by: Neha Sood --- .../src/main/java/org/onap/appc/aai/client/aai/AaiService.java | 7 +++++-- .../main/java/org/onap/appc/aai/client/node/AAIResourceNode.java | 9 +++++---- .../test/java/org/onap/appc/aai/client/node/MockAaiService.java | 2 -- 3 files changed, 10 insertions(+), 8 deletions(-) (limited to 'appc-outbound/appc-aai-client') diff --git a/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/aai/AaiService.java b/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/aai/AaiService.java index a25013f35..4e1da8a61 100644 --- a/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/aai/AaiService.java +++ b/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/aai/AaiService.java @@ -644,8 +644,10 @@ public class AaiService { SvcLogicResource.QueryStatus response = aaiClient.query(resourceType, false, null, query, prefix, null, resourceContext); log.info("AAIResponse: " + response.toString()); - if (!SvcLogicResource.QueryStatus.SUCCESS.equals(response)) { - throw new AaiServiceInternalException("Error Retrieving " + resourceType + " from A&AI"); + if (resourceType==null || !resourceType.equals("cloud-region")) { + if (!SvcLogicResource.QueryStatus.SUCCESS.equals(response)) { + throw new AaiServiceInternalException("Error Retrieving " + resourceType + " from A&AI"); + } } return resourceContext; } @@ -781,6 +783,7 @@ public class AaiService { String resourceType = "cloud-region"; SvcLogicContext urlCtx = readResource(resourceKey, queryPrefix, resourceType); log.info("IdentityUrl: "+urlCtx.getAttribute("urlInfo.identity-url")); + log.info("Prefix for getIdentityUrl: "+prefix+"cloud-region.identity-url"); ctx.setAttribute(prefix+"cloud-region.identity-url", urlCtx.getAttribute("urlInfo.identity-url")); } diff --git a/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/node/AAIResourceNode.java b/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/node/AAIResourceNode.java index 5a95e6e66..da44f340b 100644 --- a/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/node/AAIResourceNode.java +++ b/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/node/AAIResourceNode.java @@ -86,6 +86,7 @@ public class AAIResourceNode implements SvcLogicJavaPlugin { log.debug("Cloud Owner" + cloudOwnerValue); log.debug("CloudRegionId" + cloudOwnerValue); + SvcLogicContext cloudCtx = new SvcLogicContext(); Map paramsCloud = new HashMap<>(); paramsCloud.put(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX, inParams.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX)); @@ -156,11 +157,11 @@ public class AAIResourceNode implements SvcLogicJavaPlugin { vserverMap.put("tenant-id", ctx.getAttribute(responsePrefix + "vm[" + i + STR_TENANT_ID)); vserverMap.put("cloud-owner", ctx.getAttribute(responsePrefix + "vm[" + i + STR_CLOUD_OWNER)); vserverMap.put("cloud-region-id", ctx.getAttribute(responsePrefix + "vm[" + i + STR_CLOUD_REGION_ID)); - + // Parameters returned by getVMInfo vserverMap.put(PARAM_VSERVER_NAME, vmServerCtx.getAttribute(responsePrefix + "vm.vserver-name")); vserverMap.put("vf-module-id", vmServerCtx.getAttribute(responsePrefix + "vm.vf-module-id")); - vserverMap.put(PARAM_VSERVER_SELFLINK, vmServerCtx.getAttribute(responsePrefix + "vm.vserver-selflink")); + vserverMap.put("vserver-selflink", vmServerCtx.getAttribute(responsePrefix + "vm.vserver-selflink")); log.info("VSERVER-LINK VALUE:" + vmServerCtx.getAttribute(responsePrefix + "vm.vserver-selflink")); @@ -512,7 +513,7 @@ public class AAIResourceNode implements SvcLogicJavaPlugin { return params; } - public void getVfModuleModelInfo(Map inParams, SvcLogicContext ctx) { + public void getVfModuleModelInfo(Map inParams, SvcLogicContext ctx) throws SvcLogicException { log.info("vfModuleInfo()::Retrieving vf-module information :" + inParams.toString()); String responsePrefix = inParams.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX); try { @@ -572,7 +573,7 @@ public class AAIResourceNode implements SvcLogicJavaPlugin { } - public void getFormattedValue(Map inParams, SvcLogicContext ctx) { + public void getFormattedValue(Map inParams, SvcLogicContext ctx) throws SvcLogicException { log.info("getFormattedValue()::Formatting values :" + inParams.toString()); String responsePrefix = inParams.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX); try { diff --git a/appc-outbound/appc-aai-client/provider/src/test/java/org/onap/appc/aai/client/node/MockAaiService.java b/appc-outbound/appc-aai-client/provider/src/test/java/org/onap/appc/aai/client/node/MockAaiService.java index 1f6cd6584..9a4adef06 100644 --- a/appc-outbound/appc-aai-client/provider/src/test/java/org/onap/appc/aai/client/node/MockAaiService.java +++ b/appc-outbound/appc-aai-client/provider/src/test/java/org/onap/appc/aai/client/node/MockAaiService.java @@ -31,14 +31,12 @@ import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.onap.appc.aai.client.AppcAaiClientConstant; -//import org.onap.appc.aai.client.aai.AAIClientMock; import org.onap.appc.aai.client.aai.AaiService; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource; import org.onap.ccsdk.sli.adaptors.aai.AAIClient; public class MockAaiService extends AaiService { -- cgit 1.2.3-korg