diff options
5 files changed, 26 insertions, 15 deletions
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyReader.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyReader.java index 73f46c95..09a6e49b 100644 --- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyReader.java +++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyReader.java @@ -37,19 +37,23 @@ public abstract class PolicyReader implements PolicyFinder { * @param policy the policy * @return the list of naming-models found in the policy */ + private static final String NAMING_MODELS = "naming-models"; + private static final String NAMING_TYPE = "naming-type"; + public static List<Map<String, ?>> namingModels(Map<String, ?> policy) { + Set<String> keys = policy.keySet(); // TODO : retrieve naming-models at any level if (keys.contains("config")) { @SuppressWarnings("unchecked") Map<String, ?> config = (Map<String, ?>) policy.get("config"); - List<Map<String, ?>> namingModels = list(map(config, "content"), "naming-models"); + List<Map<String, ?>> namingModels = list(map(config, "content"), NAMING_MODELS); if (namingModels == null) { - namingModels = list(config, "naming-models"); + namingModels = list(config, NAMING_MODELS); } return namingModels; } else { - return list(map(map(policy, "input"), "naming-model"), "naming-models"); + return list(map(map(policy, "input"), "naming-model"), NAMING_MODELS); } } @@ -65,7 +69,7 @@ public abstract class PolicyReader implements PolicyFinder { Map<String, ?> theModel = null; if (namingModels != null) { for (Map<String, ?> model : namingModels) { - Object val = model.get("naming-type"); + Object val = model.get(NAMING_TYPE); if (namingType.equals(val)) { theModel = model; break; @@ -120,8 +124,9 @@ public abstract class PolicyReader implements PolicyFinder { * Finds the naming-operation from the given naming-model. */ public static String namingOperation(Map<String, ?> namimgModel) { - String propValue = value(namimgModel, "name-operation"); - return propValue; + //String propValue = value(namimgModel, "name-operation"); + //return propValue; + return value(namimgModel, "name-operation"); } /** @@ -294,8 +299,8 @@ public abstract class PolicyReader implements PolicyFinder { Map<String, Object> getPolicy(String jsonString) throws Exception { ObjectMapper mapper = new ObjectMapper(); - Map<String, Object> jsonObject = mapper.readValue(jsonString, new TypeReference<Map<String, Object>>() {}); - return jsonObject; + // Map<String, Object> jsonObject = mapper.readValue(jsonString, new TypeReference<Map<String, Object>>() {}); + return mapper.readValue(jsonString, new TypeReference<Map<String, Object>>() {}); } static List<Map<String, ?>> list(Map<String, ?> policy, String name) { diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicySequence.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicySequence.java index dc0b6fdc..526f67c1 100644 --- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicySequence.java +++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicySequence.java @@ -83,11 +83,11 @@ public class PolicySequence { } } if (this.maxValue == null) { - long length = this.length; - if (length <= 0) { - length = 3; + long mlength = this.length; + if (mlength <= 0) { + mlength = 3; } - this.maxValue = (long) Math.pow(base, length) - 1; + this.maxValue = (long) Math.pow(base, mlength) - 1; } } return maxValue; diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PropertyOperator.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PropertyOperator.java index 448ee075..8fd30120 100644 --- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PropertyOperator.java +++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PropertyOperator.java @@ -128,8 +128,8 @@ public class PropertyOperator { if (mapped == null) { mapped = camelConverted(recipeItem); } - String value = applyJavaOperation(null, recipeItem, mapped); - return value; + //String value = applyJavaOperation(null, recipeItem, mapped); + return applyJavaOperation(null, recipeItem, mapped); } static String operationFunction(String operation) throws Exception { diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/validator/ExternalKeyValidator.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/validator/ExternalKeyValidator.java index 28dde566..4b7ec79b 100644 --- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/validator/ExternalKeyValidator.java +++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/validator/ExternalKeyValidator.java @@ -36,7 +36,7 @@ public class ExternalKeyValidator { * Tells if the given external ID is present in the DB. */ public boolean isPresent(String externalId) { - if (genNameRepo.findByExternalId(externalId).size() > 0) { + if (genNameRepo.findByExternalId(externalId).size() > 0 || genNameRepo.findByExternalId(externalId).isEmpty() ) { return true; } return false; diff --git a/ms/vlantag-api/pom.xml b/ms/vlantag-api/pom.xml index 61b11b29..de5e97a7 100644 --- a/ms/vlantag-api/pom.xml +++ b/ms/vlantag-api/pom.xml @@ -73,6 +73,12 @@ </dependency> <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-common</artifactId> + <version>${ccsdk.sli.core.version}</version> + <scope>provided</scope> + </dependency> + <dependency> <groupId>org.onap.ccsdk.sli.adaptors</groupId> <artifactId>resource-assignment-provider</artifactId> <version>${ccsdk.sli.adaptors.version}</version> |