summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/config/BaseDBConfiguration.java6
-rwxr-xr-xdblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDBCachedDataSource.java39
-rw-r--r--sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/PrintYangToProp.java37
-rw-r--r--sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicCrawler.java6
-rw-r--r--sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExprListener.java4
-rw-r--r--sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpression.java4
-rw-r--r--sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/CallNodeExecutor.java11
-rw-r--r--sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ConfigureNodeExecutor.java15
-rw-r--r--sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutor.java19
-rwxr-xr-xsli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java21
10 files changed, 92 insertions, 70 deletions
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/config/BaseDBConfiguration.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/config/BaseDBConfiguration.java
index 5f0209b67..967059a31 100755
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/config/BaseDBConfiguration.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/config/BaseDBConfiguration.java
@@ -209,7 +209,7 @@ public abstract class BaseDBConfiguration {
* <code>Integer</code>.
*/
public int getDbMinLimit() throws NumberFormatException {
- String value = properties.getProperty(MIN_LIMIT);
+ String value = properties.getProperty(MIN_LIMIT, "-1");
return Integer.parseInt(value);
}
@@ -222,7 +222,7 @@ public abstract class BaseDBConfiguration {
* <code>Integer</code>.
*/
public int getDbMaxLimit() throws NumberFormatException {
- String value = properties.getProperty(MAX_LIMIT);
+ String value = properties.getProperty(MAX_LIMIT, "-1");
return Integer.parseInt(value);
}
@@ -235,7 +235,7 @@ public abstract class BaseDBConfiguration {
* <code>Integer</code>.
*/
public int getDbInitialLimit() throws NumberFormatException {
- String value = properties.getProperty(INIT_LIMIT);
+ String value = properties.getProperty(INIT_LIMIT, "-1");
return Integer.parseInt(value);
}
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDBCachedDataSource.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDBCachedDataSource.java
index 80ca577cf..09c1c202b 100755
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDBCachedDataSource.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDBCachedDataSource.java
@@ -42,6 +42,9 @@ public class JdbcDBCachedDataSource extends CachedDataSource {
private int initialLimit;
private static final String AS_CONF_ERROR = "AS_CONF_ERROR: ";
+ private static final int MIN_LIMIT = 5;
+ private static final int MAX_LIMIT = 10;
+ private static final int INITIAL_LIMIT = 10;
private static final Logger LOGGER = LoggerFactory.getLogger(JdbcDBCachedDataSource.class);
@@ -88,26 +91,26 @@ public class JdbcDBCachedDataSource extends CachedDataSource {
}
minLimit = jdbcConfig.getDbMinLimit();
-// if (minLimit == null)
-// {
-// String errorMsg = "Invalid XML contents: JDBC Connection missing minLimit attribute";
-// LOGGER.error(AS_CONF_ERROR + errorMsg);
-// throw new DBConfigException(errorMsg);
-// }
+ if (minLimit == -1)
+ {
+ String errorMsg = "Invalid XML contents: JDBC Connection missing minLimit attribute";
+ LOGGER.error(AS_CONF_ERROR + errorMsg);
+ minLimit = MIN_LIMIT;
+ }
maxLimit = jdbcConfig.getDbMaxLimit();
-// if (maxLimit == null)
-// {
-// String errorMsg = "Invalid XML contents: JDBC Connection missing maxLimit attribute";
-// LOGGER.error(AS_CONF_ERROR + errorMsg);
-// throw new DBConfigException(errorMsg);
-// }
+ if (maxLimit == -1)
+ {
+ String errorMsg = "Invalid XML contents: JDBC Connection missing maxLimit attribute";
+ LOGGER.error(AS_CONF_ERROR + errorMsg);
+ maxLimit = MAX_LIMIT;
+ }
initialLimit = jdbcConfig.getDbInitialLimit();
-// if (initialLimit == null)
-// {
-// String errorMsg = "Invalid XML contents: JDBC Connection missing initialLimit attribute";
-// LOGGER.error(AS_CONF_ERROR + errorMsg);
-// throw new DBConfigException(errorMsg);
-// }
+ if (initialLimit == -1)
+ {
+ String errorMsg = "Invalid XML contents: JDBC Connection missing initialLimit attribute";
+ LOGGER.error(AS_CONF_ERROR + errorMsg);
+ initialLimit = INITIAL_LIMIT;
+ }
dbUrl = jdbcConfig.getDbUrl();
if (dbUrl == null) {
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/PrintYangToProp.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/PrintYangToProp.java
index e22f39258..c4b76793e 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/PrintYangToProp.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/PrintYangToProp.java
@@ -57,7 +57,8 @@ public class PrintYangToProp {
private static Properties properties;
private static final String BUILDER="-builder";
private static final String IMPL="-impl";
-
+ private static final String TO_PROPERTIES_STRING="() to Properties entry";
+ private static final String CAUGHT_EXCEPTION_MSG="Caught exception trying to convert value returned by ";
public static Properties prop = new Properties();
public static ArrayList<String> propList = new ArrayList<>();
@@ -178,7 +179,7 @@ public class PrintYangToProp {
"Caught exception trying to convert Yang-generated enum returned by "
+ fromClass.getName() + "."
+ m.getName()
- + "() to Properties entry", e);
+ + TO_PROPERTIES_STRING, e);
}
} else if (isIpv4Address(returnType)) {
// Save its value
@@ -194,7 +195,7 @@ public class PrintYangToProp {
}
if (retValue != null) {
- String propVal = retValue.getValue().toString();
+ String propVal = retValue.getValue();
//LOG.debug("Setting property " + propName
// + " to " + propVal);
props.setProperty(propName, propVal);
@@ -202,10 +203,10 @@ public class PrintYangToProp {
}
} catch (Exception e) {
LOG.error(
- "Caught exception trying to convert value returned by "
+ CAUGHT_EXCEPTION_MSG
+ fromClass.getName() + "."
+ m.getName()
- + "() to Properties entry", e);
+ + TO_PROPERTIES_STRING, e);
}
} else if (isIpv6Address(returnType)) {
// Save its value
@@ -229,10 +230,10 @@ public class PrintYangToProp {
}
} catch (Exception e) {
LOG.error(
- "Caught exception trying to convert value returned by "
+ CAUGHT_EXCEPTION_MSG
+ fromClass.getName() + "."
+ m.getName()
- + "() to Properties entry", e);
+ + TO_PROPERTIES_STRING, e);
}
} else if (isIpv4Prefix(returnType)) {
//System.out.println("isIpv4Prefix");
@@ -257,10 +258,10 @@ public class PrintYangToProp {
}
} catch (Exception e) {
LOG.error(
- "Caught exception trying to convert value returned by "
+ CAUGHT_EXCEPTION_MSG
+ fromClass.getName() + "."
+ m.getName()
- + "() to Properties entry", e);
+ + TO_PROPERTIES_STRING, e);
}
} else if (isIpv6Prefix(returnType)) {
//System.out.println("isIpv6Prefix");
@@ -285,10 +286,10 @@ public class PrintYangToProp {
}
} catch (Exception e) {
LOG.error(
- "Caught exception trying to convert value returned by "
+ CAUGHT_EXCEPTION_MSG
+ fromClass.getName() + "."
+ m.getName()
- + "() to Properties entry", e);
+ + TO_PROPERTIES_STRING, e);
}
} else {
try {
@@ -308,7 +309,7 @@ public class PrintYangToProp {
"Caught exception trying to convert Yang-generated class returned by"
+ fromClass.getName() + "."
+ m.getName()
- + "() to Properties entry", e);
+ + TO_PROPERTIES_STRING, e);
}
}
} else if (returnType.equals(Class.class)) {
@@ -339,7 +340,7 @@ public class PrintYangToProp {
"Caught exception trying to convert List returned by "
+ fromClass.getName() + "."
+ m.getName()
- + "() to Properties entry", e);
+ + TO_PROPERTIES_STRING, e);
}
} else {
@@ -367,10 +368,10 @@ public class PrintYangToProp {
}
} catch (Exception e) {
LOG.error(
- "Caught exception trying to convert value returned by "
+ CAUGHT_EXCEPTION_MSG
+ fromClass.getName() + "."
+ m.getName()
- + "() to Properties entry", e);
+ + TO_PROPERTIES_STRING, e);
}
}
@@ -783,7 +784,7 @@ public class PrintYangToProp {
+ toClass.getName()
+ "."
+ m.getName()
- + "() to Properties entry",
+ + TO_PROPERTIES_STRING,
e);
}
}
@@ -835,7 +836,7 @@ public class PrintYangToProp {
"Caught exception trying to convert List returned by"
+ toClass.getName() + "."
+ m.getName()
- + "() to Properties entry",
+ + TO_PROPERTIES_STRING,
e);
}
}
@@ -925,7 +926,7 @@ public class PrintYangToProp {
+ toClass.getName()
+ "."
+ m.getName()
- + "() to Properties entry",
+ + TO_PROPERTIES_STRING,
e);
}
}
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicCrawler.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicCrawler.java
index 5ee138a3e..c6fd8b6a2 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicCrawler.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicCrawler.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -37,8 +39,8 @@ public class SvcLogicCrawler extends SimpleFileVisitor<Path> {
private List<Path> activationFilePathList;
public SvcLogicCrawler() {
- xmlGraphPathList = new ArrayList<Path>();
- activationFilePathList = new ArrayList<Path>();
+ xmlGraphPathList = new ArrayList<>();
+ activationFilePathList = new ArrayList<>();
}
@Override
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExprListener.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExprListener.java
index 2a40e7a1d..e96b702ef 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExprListener.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExprListener.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -55,7 +57,7 @@ public class SvcLogicExprListener extends ExprGrammarBaseListener
public SvcLogicExprListener()
{
- exprStack = new LinkedList<SvcLogicExpression>();
+ exprStack = new LinkedList<>();
}
public SvcLogicExpression getParsedExpr()
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpression.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpression.java
index 26783e70f..81aeb6c37 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpression.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpression.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -28,7 +30,7 @@ import java.util.List;
public abstract class SvcLogicExpression implements Serializable {
- private List<SvcLogicExpression> operands = new LinkedList<SvcLogicExpression>();
+ private List<SvcLogicExpression> operands = new LinkedList<>();
public void addOperand(SvcLogicExpression expr)
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/CallNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/CallNodeExecutor.java
index 284795bd0..fd052ada2 100644
--- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/CallNodeExecutor.java
+++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/CallNodeExecutor.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -34,6 +36,7 @@ public class CallNodeExecutor extends AbstractSvcLogicNodeExecutor {
private static final Logger LOG = LoggerFactory
.getLogger(CallNodeExecutor.class);
+ private static final String CURRENT_GRAPH="currentGraph";
@Override
public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx)
@@ -114,7 +117,7 @@ public class CallNodeExecutor extends AbstractSvcLogicNodeExecutor {
version = SvcLogicExpressionResolver.evaluate(moduleExpr, node, ctx);
}
- String parentGraph = ctx.getAttribute("currentGraph");
+ String parentGraph = ctx.getAttribute(CURRENT_GRAPH);
ctx.setAttribute("parentGraph", parentGraph);
SvcLogicStore store = svc.getStore();
@@ -124,7 +127,7 @@ public class CallNodeExecutor extends AbstractSvcLogicNodeExecutor {
SvcLogicGraph calledGraph = store.fetch(module, rpc, version, mode);
if (calledGraph != null) {
LOG.debug("Parent " + parentGraph + " is calling child " + calledGraph.toString());
- ctx.setAttribute("currentGraph", calledGraph.toString());
+ ctx.setAttribute(CURRENT_GRAPH, calledGraph.toString());
svc.execute(calledGraph, ctx);
outValue = ctx.getStatus();
graphWasCalled = true;
@@ -140,7 +143,7 @@ public class CallNodeExecutor extends AbstractSvcLogicNodeExecutor {
if (LOG.isDebugEnabled()) {
LOG.debug("about to execute " + outValue + " branch");
}
- ctx.setAttribute("currentGraph", parentGraph);
+ ctx.setAttribute(CURRENT_GRAPH, parentGraph);
return (nextNode);
}
@@ -165,7 +168,7 @@ public class CallNodeExecutor extends AbstractSvcLogicNodeExecutor {
}
}
- ctx.setAttribute("currentGraph", parentGraph);
+ ctx.setAttribute(CURRENT_GRAPH, parentGraph);
ctx.setAttribute("parentGraph", null);
return (nextNode);
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ConfigureNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ConfigureNodeExecutor.java
index 5b1d9efe9..7ffdfcaf7 100644
--- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ConfigureNodeExecutor.java
+++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ConfigureNodeExecutor.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -37,6 +39,7 @@ import org.slf4j.LoggerFactory;
public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor {
private static final Logger LOG = LoggerFactory
.getLogger(ConfigureNodeExecutor.class);
+ private static final String CAUGHT_EXCEPTION_MSG="Caught exception from ";
public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node,
SvcLogicContext ctx) throws SvcLogicException {
@@ -58,7 +61,7 @@ public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor {
String key = SvcLogicExpressionResolver.evaluate(
node.getAttribute("key"), node, ctx);
- Map<String, String> parmMap = new HashMap<String, String>();
+ Map<String, String> parmMap = new HashMap<>();
Set<Map.Entry<String, SvcLogicExpression>> parmSet = node
.getParameterSet();
@@ -83,7 +86,7 @@ public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor {
try {
confStatus = adaptor.configure(key, parmMap, ctx);
} catch (Exception e) {
- LOG.warn("Caught exception from "+adaptorName+".configure", e);
+ LOG.warn(CAUGHT_EXCEPTION_MSG+adaptorName+".configure", e);
confStatus = SvcLogicAdaptor.ConfigStatus.FAILURE;
}
@@ -98,7 +101,7 @@ public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor {
activateStatus = adaptor.activate(key, ctx);
} catch (Exception e) {
- LOG.warn("Caught exception from "+adaptorName+".activate", e);
+ LOG.warn(CAUGHT_EXCEPTION_MSG+adaptorName+".activate", e);
activateStatus = SvcLogicAdaptor.ConfigStatus.FAILURE;
}
switch (activateStatus) {
@@ -124,7 +127,7 @@ public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor {
deactivateStatus = adaptor.deactivate(key, ctx);
} catch (Exception e) {
- LOG.warn("Caught exception from "+adaptorName+".deactivate", e);
+ LOG.warn(CAUGHT_EXCEPTION_MSG+adaptorName+".deactivate", e);
deactivateStatus = SvcLogicAdaptor.ConfigStatus.FAILURE;
}
switch (deactivateStatus) {
@@ -166,7 +169,7 @@ public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor {
try {
activateStatus = adaptor.activate(key, ctx);
} catch (Exception e) {
- LOG.warn("Caught exception from "+adaptorName+".activate", e);
+ LOG.warn(CAUGHT_EXCEPTION_MSG+adaptorName+".activate", e);
activateStatus = SvcLogicAdaptor.ConfigStatus.FAILURE;
}
switch (activateStatus) {
@@ -192,7 +195,7 @@ public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor {
try {
deactivateStatus = adaptor.deactivate(key, ctx);
} catch (Exception e) {
- LOG.warn("Caught exception from "+adaptorName+".deactivate", e);
+ LOG.warn(CAUGHT_EXCEPTION_MSG+adaptorName+".deactivate", e);
deactivateStatus = SvcLogicAdaptor.ConfigStatus.FAILURE;
}
switch (deactivateStatus) {
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutor.java
index 357f11d02..e9fe78e88 100644
--- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutor.java
+++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutor.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -39,6 +41,7 @@ import org.slf4j.LoggerFactory;
public class ExecuteNodeExecutor extends AbstractSvcLogicNodeExecutor {
private static final Logger LOG = LoggerFactory
.getLogger(ExecuteNodeExecutor.class);
+ private static final String FAILURE="failure";
private static final String pluginErrorMessage = "Could not execute plugin. SvcLogic status will be set to failure.";
public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node,
@@ -46,7 +49,7 @@ public class ExecuteNodeExecutor extends AbstractSvcLogicNodeExecutor {
String pluginName = SvcLogicExpressionResolver.evaluate(
node.getAttribute("plugin"), node, ctx);
- String outValue = "failure";
+ String outValue = FAILURE;
if (LOG.isDebugEnabled()) {
LOG.debug("execute node encountered - looking for plugin "
@@ -76,7 +79,7 @@ public class ExecuteNodeExecutor extends AbstractSvcLogicNodeExecutor {
} else {
try {
- Map<String, String> parmMap = new HashMap<String, String>();
+ Map<String, String> parmMap = new HashMap<>();
Set<Map.Entry<String, SvcLogicExpression>> parmSet = node
.getParameterSet();
@@ -104,16 +107,16 @@ public class ExecuteNodeExecutor extends AbstractSvcLogicNodeExecutor {
}else{
LOG.error(pluginErrorMessage, e);
}
- outValue = "failure";
- ctx.setStatus("failure");
+ outValue = FAILURE;
+ ctx.setStatus(FAILURE);
} catch (IllegalAccessException e) {
LOG.error(pluginErrorMessage, e);
- outValue = "failure";
- ctx.setStatus("failure");
+ outValue = FAILURE;
+ ctx.setStatus(FAILURE);
} catch (IllegalArgumentException e) {
LOG.error(pluginErrorMessage, e);
- outValue = "failure";
- ctx.setStatus("failure");
+ outValue = FAILURE;
+ ctx.setStatus(FAILURE);
}
}
diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
index bfbe9f974..48bb754ec 100755
--- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
+++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -23,7 +25,6 @@ package org.onap.ccsdk.sli.core.sli.provider;
import java.io.File;
import java.io.FileInputStream;
-import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.lang.reflect.Constructor;
@@ -50,6 +51,8 @@ public class MdsalHelper {
private static final Logger LOG = LoggerFactory.getLogger(MdsalHelper.class);
private static Properties yangMappingProperties = new Properties();
+ private static final String IP_ADDRESS="IpAddress";
+ private static final String IP_PREFIX="IpPrefix";
@Deprecated
public static void setProperties(Properties input) {
@@ -131,7 +134,7 @@ public class MdsalHelper {
Object retValue = m.invoke(fromObj);
if (retValue != null) {
String propVal = null;
- if ("IpAddress".equals(simpleTypeName) || "IpPrefix".equals(simpleTypeName)) {
+ if (IP_ADDRESS.equals(simpleTypeName) || IP_PREFIX.equals(simpleTypeName)) {
propVal = String.valueOf((char[]) retValue);
} else if ("Ipv4Address".equals(simpleTypeName) || "Ipv6Address".equals(simpleTypeName)) {
propVal = (String) retValue;
@@ -632,7 +635,7 @@ public class MdsalHelper {
String simpleName = paramClass.getSimpleName();
if ("Ipv4Address".equals(simpleName) || "Ipv6Address".equals(simpleName)
- || "IpAddress".equals(simpleName)) {
+ || IP_ADDRESS.equals(simpleName)) {
if ((paramValue != null) && (paramValue.length() > 0)) {
try {
@@ -671,7 +674,7 @@ public class MdsalHelper {
+ m.getName() + "() with Properties entry", e);
}
}
- } else if ("IpPrefix".equals(simpleName)) {
+ } else if (IP_PREFIX.equals(simpleName)) {
if ((paramValue != null) && (paramValue.length() > 0)) {
try {
IpPrefix ipPrefix = IpPrefixBuilder.getDefaultInstance(paramValue);
@@ -993,8 +996,8 @@ public class MdsalHelper {
}
private static boolean classHasSpecialHandling(String simpleName) {
- if ("IpAddress".equals(simpleName) || "Ipv4Address".equals(simpleName) || "Ipv6Address".equals(simpleName)
- || "IpPrefix".equals(simpleName) || "PortNumber".equals(simpleName) || "Dscp".equals(simpleName)) {
+ if (IP_ADDRESS.equals(simpleName) || "Ipv4Address".equals(simpleName) || "Ipv6Address".equals(simpleName)
+ || IP_PREFIX.equals(simpleName) || "PortNumber".equals(simpleName) || "Dscp".equals(simpleName)) {
return true;
}
return false;
@@ -1068,7 +1071,7 @@ public class MdsalHelper {
String simpleName = returnClass.getSimpleName();
if ("Ipv4Address".equals(simpleName) || "Ipv6Address".equals(simpleName)
- || "IpAddress".equals(simpleName) || "IpPrefix".equals(simpleName)
+ || IP_ADDRESS.equals(simpleName) || IP_PREFIX.equals(simpleName)
|| "PortNumber".equals(simpleName) || "Dscp".equals(simpleName)) {
LOG.trace(m.getName() + " is an " + simpleName);
pstr.print("\n\n * " + propName);
@@ -1131,7 +1134,7 @@ public class MdsalHelper {
return (false);
}
String simpleName = c.getSimpleName();
- return ("IpPrefix".equals(simpleName));
+ return (IP_PREFIX.equals(simpleName));
}
public static boolean isIpv4Address(Class c) {
@@ -1167,7 +1170,7 @@ public class MdsalHelper {
return (false);
}
String simpleName = c.getSimpleName();
- return ("IpAddress".equals(simpleName));
+ return (IP_ADDRESS.equals(simpleName));
}
public static boolean isPortNumber(Class c) {