Improved logging,error handling-VM capabilities 11/28211/3
authorRamya Balaji <rb111y@att.com>
Mon, 15 Jan 2018 16:02:37 +0000 (11:02 -0500)
committerSkip Wonnell <skip@att.com>
Wed, 17 Jan 2018 19:06:59 +0000 (19:06 +0000)
Code corrections for graceful failure,
added info log statements

Issue-ID: APPC-409
Change-Id: Ibae80a4392508d1de5e68933beed048ff6ae016d
Signed-off-by: Ramya Balaji <rb111y@att.com>
appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/node/ConfigResourceNode.java
appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/node/AAIResourceNode.java

index a9d3dbb..30fcbbd 100644 (file)
@@ -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;
     }
 
index b3a20b0..676e981 100644 (file)
@@ -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;
 
     }