logging changes 89/95089/1
authorSmokowski, Kevin (ks6305) <kevin.smokowski@att.com>
Thu, 5 Sep 2019 20:10:01 +0000 (20:10 +0000)
committerSmokowski, Kevin (ks6305) <kevin.smokowski@att.com>
Thu, 5 Sep 2019 20:10:01 +0000 (20:10 +0000)
remove old logging statements, add a few helpful ones

Issue-ID: CCSDK-1665
Signed-off-by: Smokowski, Kevin (ks6305) <kevin.smokowski@att.com>
Change-Id: I2272f54b447647c8beab6d2053413c57e816eeac

16 files changed:
sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java
sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExprListener.java
sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionFactory.java
sli/features/odl-sli/src/main/feature/feature.xml [moved from sli/features/features-sli/src/main/feature/feature.xml with 62% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/AbstractSvcLogicNodeExecutor.java
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ConfigureNodeExecutor.java
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutor.java
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/RecordNodeExecutor.java
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReturnNodeExecutor.java
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SaveNodeExecutor.java
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SetNodeExecutor.java
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicExpressionResolver.java
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceImplBase.java
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/UpdateNodeExecutor.java
sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java

index 87e8f1a..94ffcd9 100644 (file)
@@ -193,10 +193,9 @@ public class SvcLogicDblibStore implements SvcLogicStore {
                        } else {
                                return null;
                        }
-               } catch (SQLException e) {
-                       throw new ConfigurationException("SQL query failed", e);
                } catch (Exception e) {
-                       throw new ConfigurationException("Graph processing failed", e);
+                   LOG.error("Graph processing failed", e);
+                       throw new ConfigurationException("Graph processing failed: " + e.getMessage());
                } finally {
                        try {
                                if (fetchGraphStmt != null) {
index 185986d..a187195 100644 (file)
@@ -79,7 +79,6 @@ public class SvcLogicExprListener extends ExprGrammarBaseListener
        
        private void pushExpr(SvcLogicExpression expr)
        {
-               LOG.trace("Pushing expression ["+expr.getClass().getName()+"]");
                if (curExpr != null)
                {
                        exprStack.push(curExpr);
index d275e97..9e9bfe0 100644 (file)
@@ -42,7 +42,6 @@ public class SvcLogicExpressionFactory {
        
        public static SvcLogicExpression parse(String exprStr) throws IOException
        {
-               LOG.trace("parse("+exprStr+")");
                InputStream exprStream = new ByteArrayInputStream(exprStr.getBytes());
                CharStream input = new ANTLRInputStream(exprStream);
                ExprGrammarLexer lexer = new ExprGrammarLexer(input);
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="ccsdk-dblib">
-    <feature name="features-sli" description="ccsdk-sli-core :: sli :: features-sli" version="${project.version}">
+    <feature name="ccsdk-sli">
     <!-- the generated bundle symbolic name is very long for wrapped jars, providing an instruction to shorten it -->
-        <bundle>wrap:mvn:org.onap.ccsdk.sli.core/sli-provider-base/${project.version}$Bundle-SymbolicName=org.onap.ccsdk.sli.core.sli-provider.base</bundle>
+        <bundle>wrap:mvn:org.onap.ccsdk.sli.core/sli-provider-base/${project.version}/$Bundle-SymbolicName=org.onap.ccsdk.sli.core.sli-provider-base&amp;Bundle-Name=sli-provider-base</bundle>
     </feature>
 </features>
index a51accb..9bab745 100644 (file)
 
 package org.onap.ccsdk.sli.core.sli.provider.base;
 
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
 import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor;
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.onap.ccsdk.sli.core.sli.SvcLogicExpression;
 import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
 import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
 import org.onap.ccsdk.sli.core.sli.SvcLogicRecorder;
@@ -36,6 +42,8 @@ public abstract class AbstractSvcLogicNodeExecutor {
        public abstract SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException;
 
        private static final Logger LOG = LoggerFactory.getLogger(AbstractSvcLogicNodeExecutor.class);
+       protected static final String PARAMETER_DEBUG_PATTERN = "Parameter: {} resolves to: {} which came from the expression: {}";
+    protected static final String SETTING_DEBUG_PATTERN = "Setting context attribute: {} to: {} which came from the expression: {}";
 
     protected String evaluateNodeTest(SvcLogicNode node, SvcLogicContext ctx)
                        throws SvcLogicException {
@@ -90,4 +98,23 @@ public abstract class AbstractSvcLogicNodeExecutor {
         return (nextNode);
     }
     
+    protected Map<String, String> getResolvedParameters(SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException{
+        Map<String, String> parmMap = new HashMap<>();
+
+        Set<Map.Entry<String, SvcLogicExpression>> parmSet = node
+                .getParameterSet();
+
+        for (Iterator<Map.Entry<String, SvcLogicExpression>> iter = parmSet
+                .iterator(); iter.hasNext();) {
+            Map.Entry<String, SvcLogicExpression> curEnt = iter.next();
+            String curName = curEnt.getKey();
+            SvcLogicExpression curExpr = curEnt.getValue();
+            String curExprValue = SvcLogicExpressionResolver.evaluate(curExpr, node, ctx);
+            LOG.trace(PARAMETER_DEBUG_PATTERN, curName, curExprValue, curExpr.toString());
+            parmMap.put(curName,curExprValue);
+        }
+        
+        return parmMap;
+    }
+    
 }
index 5d6a083..55afa85 100644 (file)
@@ -63,24 +63,12 @@ public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor {
                        String key = SvcLogicExpressionResolver.evaluate(
                                        node.getAttribute("key"), node, ctx);
 
-                       Map<String, String> parmMap = new HashMap<>();
-
-                       Set<Map.Entry<String, SvcLogicExpression>> parmSet = node
-                                       .getParameterSet();
                        boolean hasParms = false;
-
-                       for (Iterator<Map.Entry<String, SvcLogicExpression>> iter = parmSet
-                                       .iterator(); iter.hasNext();) {
-                               hasParms = true;
-                               Map.Entry<String, SvcLogicExpression> curEnt = iter.next();
-                               String curName = curEnt.getKey();
-                               SvcLogicExpression curExpr = curEnt.getValue();
-                               String curExprValue = SvcLogicExpressionResolver.evaluate(curExpr, node, ctx);
-                               
-                               LOG.debug("Parameter "+curName+" = "+curExpr.asParsedExpr()+" resolves to "+curExprValue);
-
-                               parmMap.put(curName,curExprValue);
-                       }
+                       
+            Map<String, String> parmMap = getResolvedParameters(node,ctx);
+            if(!parmMap.isEmpty()) {
+                hasParms = true;
+            }
 
                        if (hasParms) {
                                SvcLogicAdaptor.ConfigStatus confStatus = SvcLogicAdaptor.ConfigStatus.FAILURE;
index cef582b..0fe179b 100644 (file)
@@ -79,23 +79,8 @@ public class ExecuteNodeExecutor extends AbstractSvcLogicNodeExecutor {
                        } else {
                                try {
 
-                                       Map<String, String> parmMap = new HashMap<>();
-
-                                       Set<Map.Entry<String, SvcLogicExpression>> parmSet = node
-                                                       .getParameterSet();
-
-                                       for (Iterator<Map.Entry<String, SvcLogicExpression>> iter = parmSet
-                                                       .iterator(); iter.hasNext();) {
-                                               Map.Entry<String, SvcLogicExpression> curEnt = iter.next();
-                                               String curName = curEnt.getKey();
-                                               SvcLogicExpression curExpr = curEnt.getValue();
-                                               String curExprValue = SvcLogicExpressionResolver.evaluate(curExpr, node, ctx);
-
-                                               LOG.trace("Parameter "+curName+" = "+curExpr.asParsedExpr()+" resolves to "+curExprValue);
-
-                                               parmMap.put(curName,curExprValue);
-                                       }
 
+                                   Map<String, String> parmMap = getResolvedParameters(node,ctx);
                                        Object o = pluginMethod.invoke(plugin, parmMap, ctx);
                                String emitsOutcome = SvcLogicExpressionResolver.evaluate(node.getAttribute("emitsOutcome"),  node, ctx);
 
index be5462b..d233a36 100644 (file)
@@ -46,27 +46,7 @@ public class RecordNodeExecutor extends AbstractSvcLogicNodeExecutor {
         String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx);
         String outValue = "failure";
 
-        if (LOG.isTraceEnabled()) {
-            LOG.trace(node.getNodeType() + " node encountered - looking for recorder class " + plugin);
-        }
-
-        Map<String, String> parmMap = new HashMap<>();
-
-        Set<Map.Entry<String, SvcLogicExpression>> parmSet = node.getParameterSet();
-        boolean hasParms = false;
-
-        for (Iterator<Map.Entry<String, SvcLogicExpression>> iter = parmSet.iterator(); iter.hasNext();) {
-            hasParms = true;
-            Map.Entry<String, SvcLogicExpression> curEnt = iter.next();
-            String curName = curEnt.getKey();
-            SvcLogicExpression curExpr = curEnt.getValue();
-            String curExprValue = SvcLogicExpressionResolver.evaluate(curExpr, node, ctx);
-
-            if (LOG.isTraceEnabled()) {
-                LOG.trace("executeRecordNode : parameter " + curName + " = " + curExpr + " => " + curExprValue);
-            }
-            parmMap.put(curName, curExprValue);
-        }
+        Map<String, String> parmMap = getResolvedParameters(node,ctx);
 
         SvcLogicRecorder recorder = getSvcLogicRecorder(plugin);
         if (recorder != null) {
index d2fe35d..ab284e5 100644 (file)
@@ -66,8 +66,7 @@ public class ReturnNodeExecutor extends AbstractSvcLogicNodeExecutor {
                                        curEnt.getValue(), node, ctx);
 
                        if (LOG.isDebugEnabled()) {
-                               LOG.debug("Setting context attribute " + curName + " to "
-                                               + curValue);
+                               LOG.debug(SETTING_DEBUG_PATTERN, curName, curValue);
                        }
                        ctx.setAttribute(curName, curValue);
                }
index f8595ff..64a44b3 100644 (file)
@@ -54,24 +54,7 @@ public class SaveNodeExecutor extends AbstractSvcLogicNodeExecutor {
         boolean force = "true".equalsIgnoreCase(forceStr);
         boolean localOnly = "true".equalsIgnoreCase(localOnlyStr);
 
-        Map<String, String> parmMap = new HashMap<>();
-
-        Set<Map.Entry<String, SvcLogicExpression>> parmSet = node.getParameterSet();
-        boolean hasParms = false;
-
-        for (Iterator<Map.Entry<String, SvcLogicExpression>> iter = parmSet.iterator(); iter.hasNext();) {
-            hasParms = true;
-            Map.Entry<String, SvcLogicExpression> curEnt = iter.next();
-            String curName = curEnt.getKey();
-            SvcLogicExpression curExpr = curEnt.getValue();
-            if (curExpr != null) {
-                String curExprValue = SvcLogicExpressionResolver.evaluate(curExpr, node, ctx);
-
-                LOG.debug("Parameter " + curName + " = " + curExpr.asParsedExpr() + " resolves to " + curExprValue);
-
-                parmMap.put(curName, curExprValue);
-            }
-        }
+        Map<String, String> parmMap = getResolvedParameters(node,ctx);
 
         String outValue = FAILURE;
 
index caf0015..8907436 100644 (file)
@@ -169,8 +169,7 @@ public class SetNodeExecutor extends AbstractSvcLogicNodeExecutor {
                     String curValue = SvcLogicExpressionResolver.evaluate(curEnt.getValue(), node, ctx);
 
                     if (LOG.isDebugEnabled()) {
-                        LOG.trace("Parameter value {} resolves to {}", curEnt.getValue().asParsedExpr(), curValue);
-                        LOG.debug("Setting context attribute {} to {}", lhsVarName, curValue);
+                        LOG.debug(SETTING_DEBUG_PATTERN, lhsVarName, curValue, curEnt.getValue().toString());
                     }
                     ctx.setAttribute(lhsVarName, curValue);
                 }
index 59ba6cd..e3c0ef2 100644 (file)
@@ -44,6 +44,7 @@ public class SvcLogicExpressionResolver {
        private static final Logger LOG = LoggerFactory
                        .getLogger(SvcLogicExpressionResolver.class);
        private static final String INVALID_EXPRESSION_MSG= "Invalid expression (";
+    private static final String EXPRESSION_DEBUG_PATTERN = "Expression: {} resolves to {}: which has the value {}";
 
        public static String evaluate(SvcLogicExpression expr, SvcLogicNode node,
                        SvcLogicContext ctx) throws SvcLogicException {
@@ -51,8 +52,6 @@ public class SvcLogicExpressionResolver {
                        return (null);
                }
 
-       
-
                if (expr instanceof SvcLogicAtom) {
                        SvcLogicAtom atom = (SvcLogicAtom) expr;
 
@@ -75,15 +74,18 @@ public class SvcLogicExpressionResolver {
                                                LOG.trace("Context variable $"+varName+" unset - treating as empty string");
                                                varValue = "";
                                        }
-                                               
+                                       LOG.trace(EXPRESSION_DEBUG_PATTERN,expr.toString(),varName,varValue);
                                        return (varValue);
                                }
                                SvcLogicExpression parm = node.getParameter(varName);
                                if (parm != null) {                             
-                                       return (evaluate(parm, node, ctx));
+                                       String value = evaluate(parm, node, ctx);
+                    LOG.trace(EXPRESSION_DEBUG_PATTERN,expr.toString(),varName,value);
+                                       return value;
                                }
                                else
                                {
+                    LOG.trace(EXPRESSION_DEBUG_PATTERN,expr.toString(),varName,varName);
                                        return(varName);
                                }
                        default:
@@ -98,7 +100,6 @@ public class SvcLogicExpressionResolver {
                                List<SvcLogicExpression> operands = binExpr.getOperands();
                                if (operands.size() == 1)
                                {
-                                       LOG.trace("SvcLogicBinaryExpression as no operator and one operand - evaluating its operand");
                                        return(evaluate(operands.get(0), node, ctx));
                                }
                                else
index 5d6843f..361ca70 100644 (file)
@@ -122,11 +122,7 @@ public class SvcLogicServiceImplBase implements SvcLogicServiceBase {
             return (null);
         }
 
-               LOG.info("About to execute node # {} ({})", node.getNodeId(), node.getNodeType());
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Executing node " + node.getNodeId() + " of " + node.getGraph().getRpc());
-        }
+               LOG.info("About to execute node #{} {} node in graph {}", node.getNodeId(), node.getNodeType(), node.getGraph().toString());
 
         AbstractSvcLogicNodeExecutor executor = nodeExecutors.get(node.getNodeType());
 
index 3d93a37..104f36f 100644 (file)
@@ -49,24 +49,7 @@ public class UpdateNodeExecutor extends AbstractSvcLogicNodeExecutor {
         String pfx = SvcLogicExpressionResolver.evaluate(node.getAttribute("pfx"), node, ctx);
 
 
-        Map<String, String> parmMap = new HashMap<>();
-
-        Set<Map.Entry<String, SvcLogicExpression>> parmSet = node.getParameterSet();
-        boolean hasParms = false;
-
-        for (Iterator<Map.Entry<String, SvcLogicExpression>> iter = parmSet.iterator(); iter.hasNext();) {
-            hasParms = true;
-            Map.Entry<String, SvcLogicExpression> curEnt = iter.next();
-            String curName = curEnt.getKey();
-            SvcLogicExpression curExpr = curEnt.getValue();
-            if (curExpr != null) {
-                String curExprValue = SvcLogicExpressionResolver.evaluate(curExpr, node, ctx);
-
-                LOG.debug("Parameter " + curName + " = " + curExpr.asParsedExpr() + " resolves to " + curExprValue);
-
-                parmMap.put(curName, curExprValue);
-            }
-        }
+        Map<String, String> parmMap = getResolvedParameters(node,ctx);
 
         String outValue = "failure";
 
index 3b6151c..5bd4bd9 100755 (executable)
@@ -342,15 +342,8 @@ public class MdsalHelper {
             // "getValue", then
             // set value identified by "prefix" to that one value.
             if ((numGetters == 1) && ("getValue".equals(lastGetterName))) {
-                LOG.trace("getValueFIX : " + propNamePfx + " only has getValue() getter - setting " + propNamePfx
-                        + " = " + propVal);
                 props.setProperty(propNamePfx, propVal);
-            } else {
-                LOG.trace("getValueFIX : " + propNamePfx + " has " + numGetters + " getter(s), last one found was "
-                        + lastGetterName);
-
             }
-
         } else {
             // Class is not yang generated and not a list
             // It must be an element of a leaf list - set "prefix" to value
index d5c7f3b..f563d98 100755 (executable)
@@ -94,7 +94,6 @@ public class SvcLogicServiceImpl extends SvcLogicServiceImplBase implements SvcL
     @Override
     public Properties execute(String module, String rpc, String version, String mode, Properties props,
             DOMDataBroker domDataBroker) throws SvcLogicException {
-        LOG.info("Fetching service logic from data store");
         SvcLogicGraph graph = store.fetch(module, rpc, version, mode);
 
         if (graph == null) {