diff options
author | Ramya Balaji <rb111y@att.com> | 2018-01-15 11:02:37 -0500 |
---|---|---|
committer | Skip Wonnell <skip@att.com> | 2018-01-17 19:06:59 +0000 |
commit | c554733ede49bd0be16c5a665577ce2a32bae565 (patch) | |
tree | f7d0585a2d8715fedc301954a37dc26a795778f4 | |
parent | 00059922c48d98a45e760e7fe82d3e5a8b5bc361 (diff) |
Improved logging,error handling-VM capabilities
Code corrections for graceful failure,
added info log statements
Issue-ID: APPC-409
Change-Id: Ibae80a4392508d1de5e68933beed048ff6ae016d
Signed-off-by: Ramya Balaji <rb111y@att.com>
2 files changed, 23 insertions, 11 deletions
diff --git a/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/node/ConfigResourceNode.java b/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/node/ConfigResourceNode.java index a9d3dbb8f..30fcbbdcc 100644 --- a/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/node/ConfigResourceNode.java +++ b/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/node/ConfigResourceNode.java @@ -748,6 +748,12 @@ public class ConfigResourceNode implements SvcLogicJavaPlugin { } String vnfcFunctionCode = getVnfcFunctionCodeForVserver(ctx, vServerId); + if (StringUtils.isBlank(vnfcFunctionCode)) { + log.info("processCapabilitiesForVMLevel() :: vnfcFunctionCode is not present in context!!!"); + ctx.setAttribute("capabilities", "Not-Supported"); + return; + } + if (vmCaps.toString().contains(vnfcFunctionCode)) ctx.setAttribute("capabilities", "Supported"); else @@ -756,9 +762,15 @@ public class ConfigResourceNode implements SvcLogicJavaPlugin { } private String getVnfcFunctionCodeForVserver(SvcLogicContext ctx, String vServerId) throws Exception { - log.debug("getVnfcFunctionCodeForVserver()::vServerId=" + vServerId); + log.info("getVnfcFunctionCodeForVserver()::vServerId=" + vServerId); + for (Object key : ctx.getAttributeKeySet()) { + String parmName = (String) key; + String parmValue = ctx.getAttribute(parmName); + log.info(parmName + "=" + parmValue); + + } String vnfcFunctionCode = ctx.getAttribute("tmp.vnfInfo.vm.vnfc.vnfc-function-code"); - log.debug("getVnfcFunctionCodeForVserver()::vnfcFunctionCode=" + vnfcFunctionCode); + log.info("getVnfcFunctionCodeForVserver()::vnfcFunctionCode=" + vnfcFunctionCode); return vnfcFunctionCode; } 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 b3a20b049..676e98173 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 @@ -496,8 +496,8 @@ public class AAIResourceNode implements SvcLogicJavaPlugin { } return parameterDefinition; }*/ -public void getVserverInfo(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { - log.debug("getVserverInfo()::Retrieving vm and vnfc information for vserver:" + inParams.toString()); + public void getVserverInfo(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { + log.info("getVserverInfo()::Retrieving vm and vnfc information for vserver:" + inParams.toString()); String responsePrefix = inParams.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX); try { responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : ""; @@ -515,7 +515,7 @@ public void getVserverInfo(Map<String, String> inParams, SvcLogicContext ctx) th aaiService.getVMInfo(params, newVmCtx); String vnfcName = newVmCtx.getAttribute(responsePrefix + "vm.vnfc[0].vnfc-name"); - log.debug("getVnfcFunctionCodeForVserver()::vnfcName=" + vnfcName); + log.info("getVnfcFunctionCodeForVserver()::vnfcName=" + vnfcName); SvcLogicContext newVnfcCtx = new SvcLogicContext(); if (StringUtils.isNotBlank(vnfcName)) { vnfcParams.put("vnfcName", vnfcName); @@ -535,7 +535,7 @@ public void getVserverInfo(Map<String, String> inParams, SvcLogicContext ctx) th public void getVnfcInformationForVserver(Map<String, String> vnfcParams, SvcLogicContext newVnfcCtx, Map<String, String> inParams, SvcLogicContext ctx, AaiService aaiService, String responsePrefix) throws Exception { - log.debug("getVnfcInformationForVserver()::vnfcParams:" + vnfcParams.toString()); + log.info("getVnfcInformationForVserver()::vnfcParams:" + vnfcParams.toString()); vnfcParams.put(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX, inParams.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX)); @@ -550,7 +550,7 @@ public void getVserverInfo(Map<String, String> inParams, SvcLogicContext ctx) th || StringUtils.isBlank(vnfcGroupNotation) || StringUtils.isBlank(vnfcV4OamIp)) { log.info("getVnfcInformationForVserver()::Some vnfc parameters are blank!!!!"); } - log.debug("getVnfcInformationForVserver()::vnfcType=" + vnfcType + ",vnfcFunctionCode=" + vnfcFunctionCode, + log.info("getVnfcInformationForVserver()::vnfcType=" + vnfcType + ",vnfcFunctionCode=" + vnfcFunctionCode, ", vnfc-ipaddress-v4-oam-vip=" + vnfcV4OamIp); ctx.setAttribute(responsePrefix + "vm.vnfc.vnfc-name", vnfcParams.get("vnfcName")); ctx.setAttribute(responsePrefix + "vm.vnfc.vnfc-type", vnfcType); @@ -561,7 +561,7 @@ public void getVserverInfo(Map<String, String> inParams, SvcLogicContext ctx) th } public Map<String, String> setVmParams(SvcLogicContext ctx, String vServerId) { - log.debug("setVmParams()::setVmParamsVM level action:" + vServerId); + log.info("setVmParams()::setVmParamsVM level action:" + vServerId); Map<String, String> params = new HashMap<String, String>(); int vmCount = 0, arrayIndex = -1; String vmCountStr = ctx.getAttribute("tmp.vnfInfo.vm-count"); @@ -569,7 +569,7 @@ public void getVserverInfo(Map<String, String> inParams, SvcLogicContext ctx) th vmCount = Integer.parseInt(vmCountStr); for (int cnt = 0; cnt < vmCount; cnt++) { String vsId = ctx.getAttribute("tmp.vnfInfo.vm[" + cnt + "].vserver-id"); - log.debug("setVmParams():::vserver details::" + cnt + ":" + vsId); + log.info("setVmParams():::vserver details::" + cnt + ":" + vsId); if (StringUtils.equals(vServerId, vsId)) { arrayIndex = cnt; } @@ -581,13 +581,13 @@ public void getVserverInfo(Map<String, String> inParams, SvcLogicContext ctx) th String tenantId = ctx.getAttribute("tmp.vnfInfo.vm[" + arrayIndex + "].tenant-id"); String cloudOwner = ctx.getAttribute("tmp.vnfInfo.vm[" + arrayIndex + "].cloud-region-id"); String cloudRegionId = ctx.getAttribute("tmp.vnfInfo.vm[" + arrayIndex + "].cloud-owner"); - log.debug("setVmParams()::tenantId=" + tenantId + " cloudOwner=" + cloudOwner + " cloudRegiodId= " + log.info("setVmParams()::tenantId=" + tenantId + " cloudOwner=" + cloudOwner + " cloudRegiodId= " + cloudRegionId); params.put("vserverId", vServerId); params.put("tenantId", tenantId); params.put("cloudOwner", cloudOwner); params.put("cloudRegionId", cloudRegionId); - log.debug("setVmParams()::setVmParamsVM level action:" + params.toString()); + log.info("setVmParams()::setVmParamsVM level action:" + params.toString()); return params; } |