diff options
Diffstat (limited to 'src')
20 files changed, 817 insertions, 121 deletions
diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/Extractor.java b/src/main/java/org/onap/clamp/clds/tosca/update/Extractor.java index b0bf82780..c6eabcd34 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/Extractor.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/Extractor.java @@ -23,7 +23,6 @@ package org.onap.clamp.clds.tosca.update; -import java.io.IOException; import java.util.LinkedHashMap; import java.util.Map.Entry; import org.yaml.snakeyaml.Yaml; @@ -33,14 +32,18 @@ public class Extractor { private String source; private String nativeComponent; - @SuppressWarnings("unchecked") - public Extractor(String toParse, String nativeComponent) throws IOException { + /** + * Constructor. + * + * @param toParse Tosca to parse + * @param nativeComponent The policy type to scan + */ + public Extractor(String toParse, String nativeComponent) { this.source = toParse; this.nativeComponent = nativeComponent; allItems = new LinkedHashMap<String, Component>(); getAllAsMaps(); - } public LinkedHashMap<String, Component> getAllItems() { diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/Field.java b/src/main/java/org/onap/clamp/clds/tosca/update/Field.java new file mode 100644 index 000000000..e01f14c43 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/tosca/update/Field.java @@ -0,0 +1,147 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2020 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.clamp.clds.tosca.update; + +public class Field { + private String title; + private Object value; + private Boolean visible; + private Boolean staticValue; + + public Field(String title) { + this.title = title; + } + + /** + * Constructor. + * + * @param title The title + * @param value The value + * @param visible visible or not + * @param staticValue The static value + */ + public Field(String title, Object value, Boolean visible, Boolean staticValue) { + this.title = title; + this.value = value; + this.visible = visible; + this.staticValue = staticValue; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + + public Boolean getVisible() { + return visible; + } + + public void setVisible(Boolean visible) { + this.visible = visible; + } + + public Boolean getStaticValue() { + return staticValue; + } + + public void setStaticValue(Boolean staticValue) { + this.staticValue = staticValue; + } + + public String toString() { + return title + " " + value + " " + visible + " " + staticValue; + } + + /** + * This method compares two fields. + * + * @param otherField Compare the current object with the one specified + * @return true if they are totally equals, false otherwise + */ + public boolean compareWithField(Object otherField) { + if (this == otherField) { + return true; + } + if (otherField == null || getClass() != otherField.getClass()) { + return false; + } + + Field field = (Field) otherField; + + if (title != null ? !title.equals(field.title) : field.title != null) { + return false; + } + if (value != null ? !value.equals(field.value) : field.value != null) { + return false; + } + if (visible != null ? !visible.equals(field.visible) : field.visible != null) { + return false; + } + return staticValue != null ? staticValue.equals(field.staticValue) : field.staticValue == null; + } + + @Override + public boolean equals(Object object) { + if (this == object) { + return true; + } + if (object == null || getClass() != object.getClass()) { + return false; + } + + Field field = (Field) object; + + return title != null ? title.equals(field.title) : field.title == null; + } + + @Override + public int hashCode() { + return title != null ? title.hashCode() : 0; + } + + /** + * This method test the entire equality. + * + * @param field1 object one + * @param field2 object two + * @return true if they are totally equals (all attributes, false otherwise + */ + public static boolean fieldsEquals(Field field1, Field field2) { + return (field2.getTitle().equals(field1.getTitle()) && field2.getValue().equals(field1.getValue()) + && field2.getVisible().equals(field1.getVisible()) + && field2.getStaticValue().equals(field1.getStaticValue())); + } + +} diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/ParserToJson.java b/src/main/java/org/onap/clamp/clds/tosca/update/ParserToJson.java index 7bf629d61..3c5cf975b 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/ParserToJson.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/ParserToJson.java @@ -227,7 +227,7 @@ public class ParserToJson { switch ((String) property.getItems().get("type")) { case "map": // Get it as an object - JsonObject componentAsProperty = child.getJsonProcess(nameComponent,"object"); + JsonObject componentAsProperty = child.getJsonProcess(nameComponent, "object"); propertiesContainer.add(nameComponent, componentAsProperty); if (currentPropertyTemplate.hasFields("properties")) { propertiesInJson.add("properties", propertiesContainer); @@ -247,13 +247,13 @@ public class ParserToJson { JsonObject itemContainer = new JsonObject(); String valueInEntrySchema = this.extractSpecificFieldFromMap(property, "entry_schema"); itemContainer.addProperty("type", valueInEntrySchema); - propertiesInJson.add("items", itemContainer); - } - else {//map - // propertiesInJson.add("key?", valueInEntrySchema); + propertiesInJson.add("items", itemContainer); } + // MAP Case, for now nothing + break; - default://Each classical field : type, description, default.. + default: + //Each classical field : type, description, default.. if (currentPropertyTemplate.hasFields(propertyField) && !propertyField.equals("required")) { property.addFieldToJson(propertiesInJson, propertyField, property.getItems().get(propertyField)); diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/Template.java b/src/main/java/org/onap/clamp/clds/tosca/update/Template.java index 34459067f..4507e3d71 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/Template.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/Template.java @@ -23,7 +23,9 @@ package org.onap.clamp.clds.tosca.update; +import com.google.gson.JsonObject; import java.util.ArrayList; +import java.util.List; public class Template { @@ -31,14 +33,14 @@ public class Template { * name parameter is used as "key", in the LinkedHashMap of Templates. */ private String name; - private ArrayList<String> fields; + private List<Field> fields; public Template(String name) { this.name = name; - this.fields = new ArrayList<String>(); + this.fields = new ArrayList<>(); } - public Template(String name, ArrayList<String> fields) { + public Template(String name, List<Field> fields) { this.name = name; this.fields = fields; } @@ -51,42 +53,110 @@ public class Template { this.name = name; } - public ArrayList<String> getFields() { + public List<Field> getFields() { return fields; } - public void setFields(ArrayList<String> fields) { + public void setFields(List<Field> fields) { this.fields = fields; } - public boolean hasFields(String name) { - return fields.contains(name); + /** + * Search in fields if fieldName exists. + * + * @param fieldName The field name + * @return Ture if it exists, false otherwise + */ + public boolean hasFields(String fieldName) { + for (Field field : this.getFields()) { + if (field.getTitle().equals(fieldName)) { + return true; + } + } + return false; + } + + /** + * Get a specific Field. + * + * @param fieldName The field name + * @return THe Field found + */ + public Field getSpecificField(String fieldName) { + for (Field field : this.getFields()) { + if (field.getTitle().equals(fieldName)) { + return field; + } + } + return null; } - public void addField(String field) { + public void addField(Field field) { fields.add(field); } - public void removeField(String field) { + public void removeField(Field field) { fields.remove(field); } /** + * Enable or disable the visibility. + * + * @param nameField THe field name + * @param state True or false + */ + public void setVisibility(String nameField, boolean state) { + for (Field field : this.fields) { + if (field.getTitle().equals(nameField)) { + field.setVisible(state); + } + } + } + + /** + * This method defines if a field is static or not. + * + * @param nameField The name of the field + * @param state true or false + */ + public void setStatic(String nameField, boolean state) { + for (Field field : this.fields) { + if (field.getTitle().equals(nameField)) { + field.setStaticValue(state); + } + } + } + + /** + * This method updates the value of a specfic field. + * + * @param nameField The name of the field + * @param newValue The new value as Object + */ + public void updateValueField(String nameField, Object newValue) { + for (Field field : this.fields) { + if (field.getTitle().equals(nameField)) { + field.setValue(newValue); + } + } + } + + /** * Compare two templates : size and their contents. * * @param template the template * @return a boolean */ public boolean checkFields(Template template) { - boolean duplicateFields = false; if (template.getFields().size() == this.getFields().size()) { int countMatchingFields = 0; //loop each component of first - for (String templateField : template.getFields()) { - //if component.key is present in the second - if (this.getFields().contains(templateField)) { - countMatchingFields++; + for (Field templateFieldToCheck : template.getFields()) { + for (Field templateField : this.getFields()) { + if (templateFieldToCheck.compareWithField(templateField)) { + countMatchingFields++; + } } } @@ -97,6 +167,56 @@ public class Template { return duplicateFields; } + /** + * This method gets the specific field status. + * + * @param field The field name + * @return true or false + */ + public boolean fieldStaticStatus(String field) { + if (this.hasFields(field) && this.getSpecificField(field).getStaticValue().equals(true) + && this.getSpecificField(field).getValue() != null) { + return true; + } + return false; + } + + public boolean isVisible(String field) { + return this.getSpecificField(field).getVisible(); + } + + /** + * Set the value of a property of the Field in the json. + * + * @param jsonSchema The Json schema + * @param fieldName The Field name + * @param value The value + */ + public void setValue(JsonObject jsonSchema, String fieldName, String value) { + if (isVisible(fieldName)) { + if (fieldStaticStatus(fieldName)) { + String defaultValue = (String) this.getSpecificField(fieldName).getValue(); + jsonSchema.addProperty(fieldName, defaultValue); + } + else { + jsonSchema.addProperty(fieldName, value); + } + } + } + + /** + * Inject a static value in the json. + * + * @param jsonSchema The json schema object + * @param fieldName The field name + */ + public void injectStaticValue(JsonObject jsonSchema, String fieldName) { + if (isVisible(fieldName)) { + Field toInject = this.getSpecificField(fieldName); + jsonSchema.addProperty(fieldName, (String) toInject.getValue()); + } + } + @Override public String toString() { return " fields : " + fields; diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/TemplateManagement.java b/src/main/java/org/onap/clamp/clds/tosca/update/TemplateManagement.java index ce5cdb817..743077151 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/TemplateManagement.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/TemplateManagement.java @@ -23,14 +23,14 @@ package org.onap.clamp.clds.tosca.update; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; import java.io.IOException; -import java.io.StringReader; -import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.LinkedHashMap; -import java.util.Properties; +import java.util.List; +import java.util.Map; +import org.onap.clamp.clds.util.JsonUtils; public class TemplateManagement { @@ -93,7 +93,7 @@ public class TemplateManagement { * @param name name * @param fields fields */ - public void addTemplate(String name, ArrayList<String> fields) { + public void addTemplate(String name, List<Field> fields) { Template template = new Template(name, fields); //If it is true, the operation does not have any interest : // replace OR put two different object with the same body @@ -115,17 +115,17 @@ public class TemplateManagement { * Update Template : adding with true flag, removing with false. * * @param nameTemplate name template - * @param fieldName field name + * @param field field name * @param operation operation */ - public void updateTemplate(String nameTemplate, String fieldName, Boolean operation) { + public void updateTemplate(String nameTemplate, Field field, Boolean operation) { // Operation = true && field is not present => add Field - if (operation && !this.templates.get(nameTemplate).getFields().contains(fieldName)) { - this.templates.get(nameTemplate).addField(fieldName); + if (operation && !this.templates.get(nameTemplate).getFields().contains(field)) { + this.templates.get(nameTemplate).addField(field); } // Operation = false && field is present => remove Field - else if (!operation && this.templates.get(nameTemplate).getFields().contains(fieldName)) { - this.templates.get(nameTemplate).removeField(fieldName); + else if (!operation && this.templates.get(nameTemplate).getFields().contains(field)) { + this.templates.get(nameTemplate).removeField(field); } } @@ -162,20 +162,30 @@ public class TemplateManagement { /** * Create and complete several Templates from file.properties. * - * @param templateProperties The template properties as String + * @param jsonTemplates The template properties as String * @return a map */ - private LinkedHashMap<String, Template> initializeTemplates(String templateProperties) throws IOException { - LinkedHashMap<String, Template> generatedTemplates = new LinkedHashMap<>(); - Properties templates = new Properties(); - templates.load(new StringReader(templateProperties)); + @SuppressWarnings("unused") + private LinkedHashMap<String, Template> initializeTemplates(String jsonTemplates) { - for (Object key : templates.keySet()) { - String fields = (String) templates.get(key); - String[] fieldsInArray = fields.split(","); - Template template = new Template((String) key, new ArrayList<>(Arrays.asList(fieldsInArray))); + LinkedHashMap<String, Template> generatedTemplates = new LinkedHashMap<>(); + JsonObject templates = JsonUtils.GSON.fromJson(jsonTemplates, JsonObject.class); + + for (Map.Entry<String, JsonElement> templateAsJson : templates.entrySet()) { + Template template = new Template(templateAsJson.getKey()); + JsonObject templateBody = (JsonObject) templateAsJson.getValue(); + for (Map.Entry<String, JsonElement> field : templateBody.entrySet()) { + String fieldName = field.getKey(); + JsonObject bodyFieldAsJson = (JsonObject) field.getValue(); + Object fieldValue = bodyFieldAsJson.get("defaultValue").getAsString(); + Boolean fieldVisible = bodyFieldAsJson.get("visible").getAsBoolean(); + Boolean fieldStatic = bodyFieldAsJson.get("static").getAsBoolean(); + Field bodyField = new Field(fieldName, fieldValue, fieldVisible, fieldStatic); + template.getFields().add(bodyField); + } generatedTemplates.put(template.getName(), template); } return generatedTemplates; } + } diff --git a/src/main/java/org/onap/clamp/policy/Policy.java b/src/main/java/org/onap/clamp/policy/Policy.java index 004c450af..d52e418e3 100644 --- a/src/main/java/org/onap/clamp/policy/Policy.java +++ b/src/main/java/org/onap/clamp/policy/Policy.java @@ -294,7 +294,7 @@ public abstract class Policy extends AuditEntity { * @param policyModelType The tosca model type (the policy_type entry in the tosca) that will used to create the * json schema * @return THe Json Schema as JsonObject - * @throws IOException In case of failure when opening the templates.properties file + * @throws IOException In case of failure when opening the templates.json file * @throws UnknownComponentException If the policyModelType is not found in the tosca model */ public static JsonObject generateJsonRepresentationFromToscaModel(String policyToscaModel, @@ -302,7 +302,7 @@ public abstract class Policy extends AuditEntity { throws IOException, UnknownComponentException { return new TemplateManagement(policyToscaModel,ResourceFileUtil.getResourceAsString( "clds/tosca_update/defaultToscaTypes.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")) + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")) .launchTranslation(policyModelType); } } diff --git a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java index 96b3a09bd..b8093ccf1 100644 --- a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java +++ b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java @@ -108,7 +108,9 @@ public class MicroServicePolicy extends Policy implements Serializable { this.setPolicyModel(policyModel); this.shared = shared; try { - this.setJsonRepresentation(Policy.generateJsonRepresentationFromToscaModel(policyModel.getPolicyModelTosca(),policyModel.getPolicyModelType())); + this.setJsonRepresentation( + Policy.generateJsonRepresentationFromToscaModel(policyModel.getPolicyModelTosca(), + policyModel.getPolicyModelType())); } catch (UnknownComponentException | NullPointerException | IOException e) { logger.error("Unable to generate the microservice policy Schema ... ", e); this.setJsonRepresentation(new JsonObject()); @@ -130,7 +132,8 @@ public class MicroServicePolicy extends Policy implements Serializable { * @param pdpSubgroup The Pdp Subgrouop info */ public MicroServicePolicy(String name, PolicyModel policyModel, Boolean shared, - JsonObject jsonRepresentation, LoopElementModel loopElementModel, String pdpGroup, String pdpSubgroup) { + JsonObject jsonRepresentation, LoopElementModel loopElementModel, String pdpGroup, + String pdpSubgroup) { this.name = name; this.setPolicyModel(policyModel); this.shared = shared; @@ -265,7 +268,8 @@ public class MicroServicePolicy extends Policy implements Serializable { if (other.name != null) { return false; } - } else if (!name.equals(other.name)) { + } + else if (!name.equals(other.name)) { return false; } return true; diff --git a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicyService.java b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicyService.java index 3ad97c598..9bc641c6d 100644 --- a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicyService.java +++ b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicyService.java @@ -63,11 +63,12 @@ public class MicroServicePolicyService implements PolicyService<MicroServicePoli return repository.save( repository.findById(policy.getName()).map(p -> updateMicroservicePolicyProperties(p, policy, loop)) .orElse(new MicroServicePolicy(policy.getName(), policy.getPolicyModel(), - policy.getShared(), policy.getJsonRepresentation(),null, policy.getPdpGroup(), policy.getPdpSubgroup()))); + policy.getShared(), policy.getJsonRepresentation(), null, policy.getPdpGroup(), + policy.getPdpSubgroup()))); } private MicroServicePolicy updateMicroservicePolicyProperties(MicroServicePolicy oldPolicy, - MicroServicePolicy newPolicy, Loop loop) { + MicroServicePolicy newPolicy, Loop loop) { oldPolicy.setConfigurationsJson(newPolicy.getConfigurationsJson()); if (!oldPolicy.getUsedByLoops().contains(loop)) { oldPolicy.getUsedByLoops().add(loop); @@ -85,7 +86,7 @@ public class MicroServicePolicyService implements PolicyService<MicroServicePoli * @param deploymentUrl The Deployment URL as returned by DCAE */ public void updateDcaeDeploymentFields(MicroServicePolicy microServicePolicy, String deploymentId, - String deploymentUrl) { + String deploymentUrl) { microServicePolicy.setDcaeDeploymentId(deploymentId); microServicePolicy.setDcaeDeploymentStatusUrl(deploymentUrl); repository.save(microServicePolicy); diff --git a/src/main/resources/META-INF/resources/swagger.html b/src/main/resources/META-INF/resources/swagger.html index 62f30005c..69e9c7c15 100644 --- a/src/main/resources/META-INF/resources/swagger.html +++ b/src/main/resources/META-INF/resources/swagger.html @@ -444,25 +444,25 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </li> <li><a href="#_paths">2. Paths</a> <ul class="sectlevel2"> -<li><a href="#_route92">2.1. GET /v1/healthcheck</a> +<li><a href="#_route61">2.1. GET /v1/healthcheck</a> <ul class="sectlevel3"> <li><a href="#_responses">2.1.1. Responses</a></li> <li><a href="#_produces">2.1.2. Produces</a></li> </ul> </li> -<li><a href="#_route93">2.2. GET /v1/user/getUser</a> +<li><a href="#_route62">2.2. GET /v1/user/getUser</a> <ul class="sectlevel3"> <li><a href="#_responses_2">2.2.1. Responses</a></li> <li><a href="#_produces_2">2.2.2. Produces</a></li> </ul> </li> -<li><a href="#_route80">2.3. GET /v2/dictionary</a> +<li><a href="#_route49">2.3. GET /v2/dictionary</a> <ul class="sectlevel3"> <li><a href="#_responses_3">2.3.1. Responses</a></li> <li><a href="#_produces_3">2.3.2. Produces</a></li> </ul> </li> -<li><a href="#_route82">2.4. PUT /v2/dictionary</a> +<li><a href="#_route51">2.4. PUT /v2/dictionary</a> <ul class="sectlevel3"> <li><a href="#_parameters">2.4.1. Parameters</a></li> <li><a href="#_responses_4">2.4.2. Responses</a></li> @@ -491,7 +491,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_7">2.7.4. Produces</a></li> </ul> </li> -<li><a href="#_route84">2.8. DELETE /v2/dictionary/{name}</a> +<li><a href="#_route53">2.8. DELETE /v2/dictionary/{name}</a> <ul class="sectlevel3"> <li><a href="#_parameters_4">2.8.1. Parameters</a></li> <li><a href="#_responses_8">2.8.2. Responses</a></li> @@ -505,75 +505,75 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_9">2.9.3. Produces</a></li> </ul> </li> -<li><a href="#_route76">2.10. PUT /v2/loop/delete/{loopName}</a> +<li><a href="#_route45">2.10. PUT /v2/loop/delete/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_6">2.10.1. Parameters</a></li> <li><a href="#_responses_10">2.10.2. Responses</a></li> </ul> </li> -<li><a href="#_route70">2.11. PUT /v2/loop/deploy/{loopName}</a> +<li><a href="#_route39">2.11. PUT /v2/loop/deploy/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_7">2.11.1. Parameters</a></li> <li><a href="#_responses_11">2.11.2. Responses</a></li> <li><a href="#_produces_10">2.11.3. Produces</a></li> </ul> </li> -<li><a href="#_route64">2.12. GET /v2/loop/getAllNames</a> +<li><a href="#_route33">2.12. GET /v2/loop/getAllNames</a> <ul class="sectlevel3"> <li><a href="#_responses_12">2.12.1. Responses</a></li> <li><a href="#_produces_11">2.12.2. Produces</a></li> </ul> </li> -<li><a href="#_route77">2.13. GET /v2/loop/getstatus/{loopName}</a> +<li><a href="#_route46">2.13. GET /v2/loop/getstatus/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_8">2.13.1. Parameters</a></li> <li><a href="#_responses_13">2.13.2. Responses</a></li> <li><a href="#_produces_12">2.13.3. Produces</a></li> </ul> </li> -<li><a href="#_route71">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a> +<li><a href="#_route40">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_9">2.14.1. Parameters</a></li> <li><a href="#_responses_14">2.14.2. Responses</a></li> <li><a href="#_produces_13">2.14.3. Produces</a></li> </ul> </li> -<li><a href="#_route74">2.15. PUT /v2/loop/restart/{loopName}</a> +<li><a href="#_route43">2.15. PUT /v2/loop/restart/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_10">2.15.1. Parameters</a></li> <li><a href="#_responses_15">2.15.2. Responses</a></li> <li><a href="#_produces_14">2.15.3. Produces</a></li> </ul> </li> -<li><a href="#_route73">2.16. PUT /v2/loop/stop/{loopName}</a> +<li><a href="#_route42">2.16. PUT /v2/loop/stop/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_11">2.16.1. Parameters</a></li> <li><a href="#_responses_16">2.16.2. Responses</a></li> <li><a href="#_produces_15">2.16.3. Produces</a></li> </ul> </li> -<li><a href="#_route75">2.17. PUT /v2/loop/submit/{loopName}</a> +<li><a href="#_route44">2.17. PUT /v2/loop/submit/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_12">2.17.1. Parameters</a></li> <li><a href="#_responses_17">2.17.2. Responses</a></li> <li><a href="#_produces_16">2.17.3. Produces</a></li> </ul> </li> -<li><a href="#_route66">2.18. GET /v2/loop/svgRepresentation/{loopName}</a> +<li><a href="#_route35">2.18. GET /v2/loop/svgRepresentation/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_13">2.18.1. Parameters</a></li> <li><a href="#_responses_18">2.18.2. Responses</a></li> <li><a href="#_produces_17">2.18.3. Produces</a></li> </ul> </li> -<li><a href="#_route72">2.19. PUT /v2/loop/undeploy/{loopName}</a> +<li><a href="#_route41">2.19. PUT /v2/loop/undeploy/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_14">2.19.1. Parameters</a></li> <li><a href="#_responses_19">2.19.2. Responses</a></li> <li><a href="#_produces_18">2.19.3. Produces</a></li> </ul> </li> -<li><a href="#_route67">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a> +<li><a href="#_route36">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_15">2.20.1. Parameters</a></li> <li><a href="#_responses_20">2.20.2. Responses</a></li> @@ -581,7 +581,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_19">2.20.4. Produces</a></li> </ul> </li> -<li><a href="#_route69">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a> +<li><a href="#_route38">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_16">2.21.1. Parameters</a></li> <li><a href="#_responses_21">2.21.2. Responses</a></li> @@ -589,7 +589,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_20">2.21.4. Produces</a></li> </ul> </li> -<li><a href="#_route68">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a> +<li><a href="#_route37">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_17">2.22.1. Parameters</a></li> <li><a href="#_responses_22">2.22.2. Responses</a></li> @@ -597,14 +597,14 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_21">2.22.4. Produces</a></li> </ul> </li> -<li><a href="#_route65">2.23. GET /v2/loop/{loopName}</a> +<li><a href="#_route34">2.23. GET /v2/loop/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_18">2.23.1. Parameters</a></li> <li><a href="#_responses_23">2.23.2. Responses</a></li> <li><a href="#_produces_22">2.23.3. Produces</a></li> </ul> </li> -<li><a href="#_route87">2.24. GET /v2/policyToscaModels</a> +<li><a href="#_route56">2.24. GET /v2/policyToscaModels</a> <ul class="sectlevel3"> <li><a href="#_responses_24">2.24.1. Responses</a></li> <li><a href="#_produces_23">2.24.2. Produces</a></li> @@ -624,7 +624,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_25">2.26.3. Produces</a></li> </ul> </li> -<li><a href="#_route88">2.27. PUT /v2/policyToscaModels/{policyModelType}</a> +<li><a href="#_route57">2.27. PUT /v2/policyToscaModels/{policyModelType}</a> <ul class="sectlevel3"> <li><a href="#_parameters_21">2.27.1. Parameters</a></li> <li><a href="#_responses_27">2.27.2. Responses</a></li> @@ -632,7 +632,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_26">2.27.4. Produces</a></li> </ul> </li> -<li><a href="#_route91">2.28. GET /v2/templates</a> +<li><a href="#_route60">2.28. GET /v2/templates</a> <ul class="sectlevel3"> <li><a href="#_responses_28">2.28.1. Responses</a></li> <li><a href="#_produces_27">2.28.2. Produces</a></li> @@ -692,7 +692,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <div class="sect2"> <h3 id="_uri_scheme"><a class="anchor" href="#_uri_scheme"></a><a class="link" href="#_uri_scheme">1.2. URI scheme</a></h3> <div class="paragraph"> -<p><em>Host</em> : localhost:40597<br> +<p><em>Host</em> : localhost:39237<br> <em>BasePath</em> : /restservices/clds/<br> <em>Schemes</em> : HTTP</p> </div> @@ -703,7 +703,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <h2 id="_paths"><a class="anchor" href="#_paths"></a><a class="link" href="#_paths">2. Paths</a></h2> <div class="sectionbody"> <div class="sect2"> -<h3 id="_route92"><a class="anchor" href="#_route92"></a><a class="link" href="#_route92">2.1. GET /v1/healthcheck</a></h3> +<h3 id="_route61"><a class="anchor" href="#_route61"></a><a class="link" href="#_route61">2.1. GET /v1/healthcheck</a></h3> <div class="sect3"> <h4 id="_responses"><a class="anchor" href="#_responses"></a><a class="link" href="#_responses">2.1.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -740,7 +740,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route93"><a class="anchor" href="#_route93"></a><a class="link" href="#_route93">2.2. GET /v1/user/getUser</a></h3> +<h3 id="_route62"><a class="anchor" href="#_route62"></a><a class="link" href="#_route62">2.2. GET /v1/user/getUser</a></h3> <div class="sect3"> <h4 id="_responses_2"><a class="anchor" href="#_responses_2"></a><a class="link" href="#_responses_2">2.2.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -774,7 +774,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route80"><a class="anchor" href="#_route80"></a><a class="link" href="#_route80">2.3. GET /v2/dictionary</a></h3> +<h3 id="_route49"><a class="anchor" href="#_route49"></a><a class="link" href="#_route49">2.3. GET /v2/dictionary</a></h3> <div class="sect3"> <h4 id="_responses_3"><a class="anchor" href="#_responses_3"></a><a class="link" href="#_responses_3">2.3.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -811,7 +811,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route82"><a class="anchor" href="#_route82"></a><a class="link" href="#_route82">2.4. PUT /v2/dictionary</a></h3> +<h3 id="_route51"><a class="anchor" href="#_route51"></a><a class="link" href="#_route51">2.4. PUT /v2/dictionary</a></h3> <div class="sect3"> <h4 id="_parameters"><a class="anchor" href="#_parameters"></a><a class="link" href="#_parameters">2.4.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1060,7 +1060,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route84"><a class="anchor" href="#_route84"></a><a class="link" href="#_route84">2.8. DELETE /v2/dictionary/{name}</a></h3> +<h3 id="_route53"><a class="anchor" href="#_route53"></a><a class="link" href="#_route53">2.8. DELETE /v2/dictionary/{name}</a></h3> <div class="sect3"> <h4 id="_parameters_4"><a class="anchor" href="#_parameters_4"></a><a class="link" href="#_parameters_4">2.8.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1184,7 +1184,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route76"><a class="anchor" href="#_route76"></a><a class="link" href="#_route76">2.10. PUT /v2/loop/delete/{loopName}</a></h3> +<h3 id="_route45"><a class="anchor" href="#_route45"></a><a class="link" href="#_route45">2.10. PUT /v2/loop/delete/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_6"><a class="anchor" href="#_parameters_6"></a><a class="link" href="#_parameters_6">2.10.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1233,7 +1233,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route70"><a class="anchor" href="#_route70"></a><a class="link" href="#_route70">2.11. PUT /v2/loop/deploy/{loopName}</a></h3> +<h3 id="_route39"><a class="anchor" href="#_route39"></a><a class="link" href="#_route39">2.11. PUT /v2/loop/deploy/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_7"><a class="anchor" href="#_parameters_7"></a><a class="link" href="#_parameters_7">2.11.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1295,7 +1295,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route64"><a class="anchor" href="#_route64"></a><a class="link" href="#_route64">2.12. GET /v2/loop/getAllNames</a></h3> +<h3 id="_route33"><a class="anchor" href="#_route33"></a><a class="link" href="#_route33">2.12. GET /v2/loop/getAllNames</a></h3> <div class="sect3"> <h4 id="_responses_12"><a class="anchor" href="#_responses_12"></a><a class="link" href="#_responses_12">2.12.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1332,7 +1332,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route77"><a class="anchor" href="#_route77"></a><a class="link" href="#_route77">2.13. GET /v2/loop/getstatus/{loopName}</a></h3> +<h3 id="_route46"><a class="anchor" href="#_route46"></a><a class="link" href="#_route46">2.13. GET /v2/loop/getstatus/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_8"><a class="anchor" href="#_parameters_8"></a><a class="link" href="#_parameters_8">2.13.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1394,7 +1394,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route71"><a class="anchor" href="#_route71"></a><a class="link" href="#_route71">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a></h3> +<h3 id="_route40"><a class="anchor" href="#_route40"></a><a class="link" href="#_route40">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_9"><a class="anchor" href="#_parameters_9"></a><a class="link" href="#_parameters_9">2.14.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1456,7 +1456,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route74"><a class="anchor" href="#_route74"></a><a class="link" href="#_route74">2.15. PUT /v2/loop/restart/{loopName}</a></h3> +<h3 id="_route43"><a class="anchor" href="#_route43"></a><a class="link" href="#_route43">2.15. PUT /v2/loop/restart/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_10"><a class="anchor" href="#_parameters_10"></a><a class="link" href="#_parameters_10">2.15.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1518,7 +1518,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route73"><a class="anchor" href="#_route73"></a><a class="link" href="#_route73">2.16. PUT /v2/loop/stop/{loopName}</a></h3> +<h3 id="_route42"><a class="anchor" href="#_route42"></a><a class="link" href="#_route42">2.16. PUT /v2/loop/stop/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_11"><a class="anchor" href="#_parameters_11"></a><a class="link" href="#_parameters_11">2.16.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1580,7 +1580,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route75"><a class="anchor" href="#_route75"></a><a class="link" href="#_route75">2.17. PUT /v2/loop/submit/{loopName}</a></h3> +<h3 id="_route44"><a class="anchor" href="#_route44"></a><a class="link" href="#_route44">2.17. PUT /v2/loop/submit/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_12"><a class="anchor" href="#_parameters_12"></a><a class="link" href="#_parameters_12">2.17.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1642,7 +1642,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route66"><a class="anchor" href="#_route66"></a><a class="link" href="#_route66">2.18. GET /v2/loop/svgRepresentation/{loopName}</a></h3> +<h3 id="_route35"><a class="anchor" href="#_route35"></a><a class="link" href="#_route35">2.18. GET /v2/loop/svgRepresentation/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_13"><a class="anchor" href="#_parameters_13"></a><a class="link" href="#_parameters_13">2.18.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1704,7 +1704,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route72"><a class="anchor" href="#_route72"></a><a class="link" href="#_route72">2.19. PUT /v2/loop/undeploy/{loopName}</a></h3> +<h3 id="_route41"><a class="anchor" href="#_route41"></a><a class="link" href="#_route41">2.19. PUT /v2/loop/undeploy/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_14"><a class="anchor" href="#_parameters_14"></a><a class="link" href="#_parameters_14">2.19.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1766,7 +1766,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route67"><a class="anchor" href="#_route67"></a><a class="link" href="#_route67">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a></h3> +<h3 id="_route36"><a class="anchor" href="#_route36"></a><a class="link" href="#_route36">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_15"><a class="anchor" href="#_parameters_15"></a><a class="link" href="#_parameters_15">2.20.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1844,7 +1844,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route69"><a class="anchor" href="#_route69"></a><a class="link" href="#_route69">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a></h3> +<h3 id="_route38"><a class="anchor" href="#_route38"></a><a class="link" href="#_route38">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_16"><a class="anchor" href="#_parameters_16"></a><a class="link" href="#_parameters_16">2.21.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1922,7 +1922,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route68"><a class="anchor" href="#_route68"></a><a class="link" href="#_route68">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a></h3> +<h3 id="_route37"><a class="anchor" href="#_route37"></a><a class="link" href="#_route37">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_17"><a class="anchor" href="#_parameters_17"></a><a class="link" href="#_parameters_17">2.22.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2000,7 +2000,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route65"><a class="anchor" href="#_route65"></a><a class="link" href="#_route65">2.23. GET /v2/loop/{loopName}</a></h3> +<h3 id="_route34"><a class="anchor" href="#_route34"></a><a class="link" href="#_route34">2.23. GET /v2/loop/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_18"><a class="anchor" href="#_parameters_18"></a><a class="link" href="#_parameters_18">2.23.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2062,7 +2062,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route87"><a class="anchor" href="#_route87"></a><a class="link" href="#_route87">2.24. GET /v2/policyToscaModels</a></h3> +<h3 id="_route56"><a class="anchor" href="#_route56"></a><a class="link" href="#_route56">2.24. GET /v2/policyToscaModels</a></h3> <div class="sect3"> <h4 id="_responses_24"><a class="anchor" href="#_responses_24"></a><a class="link" href="#_responses_24">2.24.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2223,7 +2223,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route88"><a class="anchor" href="#_route88"></a><a class="link" href="#_route88">2.27. PUT /v2/policyToscaModels/{policyModelType}</a></h3> +<h3 id="_route57"><a class="anchor" href="#_route57"></a><a class="link" href="#_route57">2.27. PUT /v2/policyToscaModels/{policyModelType}</a></h3> <div class="sect3"> <h4 id="_parameters_21"><a class="anchor" href="#_parameters_21"></a><a class="link" href="#_parameters_21">2.27.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2301,7 +2301,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route91"><a class="anchor" href="#_route91"></a><a class="link" href="#_route91">2.28. GET /v2/templates</a></h3> +<h3 id="_route60"><a class="anchor" href="#_route60"></a><a class="link" href="#_route60">2.28. GET /v2/templates</a></h3> <div class="sect3"> <h4 id="_responses_28"><a class="anchor" href="#_responses_28"></a><a class="link" href="#_responses_28">2.28.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> diff --git a/src/main/resources/application-noaaf.properties b/src/main/resources/application-noaaf.properties index 320e0c2a3..288511b3b 100644 --- a/src/main/resources/application-noaaf.properties +++ b/src/main/resources/application-noaaf.properties @@ -173,4 +173,7 @@ clamp.config.security.permission.type.template=org.onap.clamp.clds.template clamp.config.security.permission.type.tosca=org.onap.clamp.clds.tosca #This one indicates the type of instances (dev|prod|perf...), this must be set accordingly in clds-users.properties clamp.config.security.permission.instance=dev -clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal
\ No newline at end of file +clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal + +## Tosca converter +clamp.config.tosca.converter.templates=classpath:/clds/tosca_updates/templates.json
\ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index ed7f4ef4a..a249d2d00 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -189,7 +189,7 @@ clamp.config.cadi.aafUrl=https://AAF_LOCATE_URL/onap.org.osaaf.aaf.service:2.1 clamp.config.cadi.cadiX509Issuers=CN=intermediateCA_1, OU=OSAAF, O=ONAP, C=US:CN=intermediateCA_7, OU=OSAAF, O=ONAP, C=US:CN=intermediateCA_9, OU=OSAAF, O=ONAP, C=US ## Tosca converter -clamp.config.tosca.converter.templates=classpath:/clds/tosca_updates/templates.properties +clamp.config.tosca.converter.templates=classpath:/clds/tosca_updates/templates.json # Configuration settings for CDS clamp.config.cds.url=http4://blueprints-processor-http:8080 diff --git a/src/main/resources/clds/tosca_update/templates.json b/src/main/resources/clds/tosca_update/templates.json new file mode 100644 index 000000000..f709e2f6d --- /dev/null +++ b/src/main/resources/clds/tosca_update/templates.json @@ -0,0 +1,398 @@ +{ + "integer":{ + "type":{ + "defaultValue":"integer", + "visible":true, + "static":false + }, + "description":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "title":{ + "defaultValue":"", + "visible":true, + "static":false + + }, + "deprecated":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "default":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "enum":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "const":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "multipleOf":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "maximum":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "exclusiveMaximum":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "minimum":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "exclusiveMinimum":{ + "defaultValue":"", + "visible":true, + "static":false + } + }, + "number":{ + "type":{ + "defaultValue":"number", + "visible":true, + "static":false + }, + "description":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "title":{ + "defaultValue":"", + "visible":true, + "static":false + + }, + "deprecated":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "default":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "enum":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "const":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "multipleOf":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "maximum":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "exclusiveMaximum":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "minimum":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "exclusiveMinimum":{ + "defaultValue":"", + "visible":true, + "static":false + } + }, + "boolean":{ + "type":{ + "defaultValue":"boolean", + "visible":true, + "static":false + }, + "description":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "title":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "deprecated":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "default":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "const":{ + "defaultValue":"", + "visible":true, + "static":false + } + }, + "string":{ + "type":{ + "defaultValue":"string", + "visible":true, + "static":false + }, + "description":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "title":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "deprecated":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "default":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "enum":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "const":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "length":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "minLength":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "maxLength":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "pattern":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "format":{ + "defaultValue":"", + "visible":true, + "static":false + } + }, + "timestamp":{ + "type":{ + "defaultValue":"string", + "visible":true, + "static":false + }, + "description":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "title":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "deprecated":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "default":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "enum":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "const":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "length":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "minLength":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "maxLength":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "pattern":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "format":{ + "defaultValue":"", + "visible":true, + "static":false + } + }, + "array":{ + "type":{ + "defaultValue":"array", + "visible":true, + "static":false + }, + "description":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "title":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "deprecated":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "default":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "const":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "uniqueItems":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "properties":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "minContains":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "maxContains":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "minItems":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "maxItems":{ + "defaultValue":"", + "visible":true, + "static":false + } + }, + "object":{ + "type":{ + "defaultValue":"object", + "visible":true, + "static":false + }, + "description":{ + "defaultValue":"", + "visible":true, + "static":true + }, + "title":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "format":{ + "defaultValue":"tabs", + "visible":true, + "static":true + }, + "required":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "minProperties":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "maxProperties":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "properties":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "dependentRequired":{ + "defaultValue":"", + "visible":true, + "static":false + }, + "dependencies":{ + "defaultValue":"", + "visible":true, + "static":false + } + } +}
\ No newline at end of file diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java index c65c84a45..a99d4ab56 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java +++ b/src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java @@ -40,7 +40,7 @@ public class ArrayFieldTest extends TestCase { TemplateManagement templateManagement = new TemplateManagement(ResourceFileUtil.getResourceAsString( "tosca/new-converter/sampleOperationalPoliciesEXTENTED.yaml"),ResourceFileUtil.getResourceAsString( "clds/tosca_update/defaultToscaTypes.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); Component component = templateManagement.getComponents().get("onap.datatype.controlloop.Actor"); Property property = component.getProperties().get("actor"); ArrayField arrayParser = new ArrayField((ArrayList<Object>) property.getItems().get("default")); diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ComponentTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/ComponentTest.java index f5d2fe6ee..565547e4b 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/ComponentTest.java +++ b/src/test/java/org/onap/clamp/clds/tosca/update/ComponentTest.java @@ -42,7 +42,7 @@ public class ComponentTest extends TestCase { new TemplateManagement(
ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties"));
+ ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json"));
Component component = templateManagement.getComponents().get("onap.datatype.controlloop.Actor");
assertEquals(reference, component.propertiesNames());
}
diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java index 6f1046ea9..a4d329e29 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java +++ b/src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java @@ -34,7 +34,7 @@ public class ConstraintTest extends TestCase { TemplateManagement templateManagement = new TemplateManagement( ResourceFileUtil.getResourceAsString("tosca/new-converter/constraints.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); Component component = templateManagement.getComponents().get("onap.datatype.controlloop.Operation"); diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/PropertyTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/PropertyTest.java index 5a9955999..62def32b8 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/PropertyTest.java +++ b/src/test/java/org/onap/clamp/clds/tosca/update/PropertyTest.java @@ -43,7 +43,7 @@ public class PropertyTest extends TestCase { TemplateManagement templateManagement = new TemplateManagement( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPoliciesEXTENTED.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); Component component = templateManagement.getComponents().get("onap.datatype.controlloop.Actor"); Property property = component.getProperties().get("actor"); JsonArray toTest = property.parseArray((ArrayList<Object>) property.getItems().get("default")); @@ -59,7 +59,7 @@ public class PropertyTest extends TestCase { TemplateManagement templateManagement = new TemplateManagement( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); Component component = templateManagement.getComponents().get("onap.datatype.controlloop.operation.Failure"); Property property = component.getProperties().get("category"); Template template = templateManagement.getTemplates().get("string"); diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/TemplateManagementTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/TemplateManagementTest.java index 4447a98cd..aaa549386 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/TemplateManagementTest.java +++ b/src/test/java/org/onap/clamp/clds/tosca/update/TemplateManagementTest.java @@ -26,6 +26,7 @@ package org.onap.clamp.clds.tosca.update; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import junit.framework.TestCase; import org.onap.clamp.clds.util.ResourceFileUtil; @@ -44,7 +45,7 @@ public class TemplateManagementTest extends TestCase { + ".policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0?" + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString( "clds/tosca_update/defaultToscaTypes.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); assertNull(templateManagement.getParseToJson()); String componentName = "onap.policies.monitoring.cdap.tca.hi.lo.app"; templateManagement.launchTranslation(componentName); @@ -64,7 +65,7 @@ public class TemplateManagementTest extends TestCase { + ".policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0?" + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString( "clds/tosca_update/defaultToscaTypes.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); assertNull(templateManagement.getParseToJson()); String componentName = "onap.policies.controlloop.guard.common.FrequencyLimiter"; templateManagement.launchTranslation(componentName); @@ -84,7 +85,7 @@ public class TemplateManagementTest extends TestCase { + ".policies.controlloop.operational.common.Apex/versions/1.0.0?" + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString( "clds/tosca_update/defaultToscaTypes.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); assertNull(templateManagement.getParseToJson()); String componentName = "onap.policies.controlloop.operational.common.Apex"; templateManagement.launchTranslation(componentName); @@ -104,7 +105,7 @@ public class TemplateManagementTest extends TestCase { + ".policies.controlloop.operational.common.Drools/versions/1.0.0?" + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString( "clds/tosca_update/defaultToscaTypes.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); assertNull(templateManagement.getParseToJson()); String componentName = "onap.policies.controlloop.operational.common.Drools"; templateManagement.launchTranslation(componentName); @@ -122,7 +123,7 @@ public class TemplateManagementTest extends TestCase { new TemplateManagement( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); assertNull(templateManagement.getParseToJson()); String componentName = "onap.policies.controlloop.operational.common.Drools"; templateManagement.launchTranslation(componentName); @@ -139,10 +140,12 @@ public class TemplateManagementTest extends TestCase { new TemplateManagement( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); int count = templateManagement.getTemplates().size(); - ArrayList<String> templateFields = - new ArrayList<>(Arrays.asList("type", "description", "required", "metadata", "constraints")); + List<Field> templateFields = new ArrayList<>(Arrays.asList(new Field("type"), new Field("description"), + new Field( + "required"), + new Field("metadata"), new Field("constraints"))); templateManagement.addTemplate("test", templateFields); assertNotSame(count, templateManagement.getTemplates().size()); } @@ -157,7 +160,7 @@ public class TemplateManagementTest extends TestCase { new TemplateManagement( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); int count = templateManagement.getTemplates().size(); templateManagement.removeTemplate("string"); assertNotSame(count, templateManagement.getTemplates().size()); @@ -173,9 +176,9 @@ public class TemplateManagementTest extends TestCase { new TemplateManagement( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); int count = templateManagement.getTemplates().get("integer").getFields().size(); - templateManagement.updateTemplate("integer", "type", false); + templateManagement.updateTemplate("integer", new Field("type"), false); assertNotSame(count, templateManagement.getTemplates().get("integer").getFields().size()); } @@ -189,10 +192,11 @@ public class TemplateManagementTest extends TestCase { new TemplateManagement( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); boolean has = true; - ArrayList<String> templateFieldsString = - new ArrayList<>(Arrays.asList("type", "description", "required", "metadata", "constraints")); + List<Field> templateFieldsString = + new ArrayList<>(Arrays.asList(new Field("type"), new Field("description"), new Field("required"), + new Field("metadata"), new Field("constraints"))); Template templateTest = new Template("String", templateFieldsString); has = templateManagement.hasTemplate(templateTest); assertEquals(false, has); diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/TemplateTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/TemplateTest.java index ebc119f0d..4ffb4e28e 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/TemplateTest.java +++ b/src/test/java/org/onap/clamp/clds/tosca/update/TemplateTest.java @@ -25,6 +25,7 @@ package org.onap.clamp.clds.tosca.update; import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import junit.framework.TestCase; public class TemplateTest extends TestCase { @@ -34,7 +35,8 @@ public class TemplateTest extends TestCase { */ public void testCheckFields() { Template toTest = new Template("toTest"); - ArrayList<String> fields = new ArrayList<>(Arrays.asList("type", "description", "enum")); + List<Field> fields = new ArrayList<>(Arrays.asList(new Field("type"), new Field("description"),new Field( + "enum"))); toTest.setFields(fields); Template reference = new Template("toTest"); reference.setFields(fields); diff --git a/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java b/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java index f08e86e8e..03b2e506d 100644 --- a/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java +++ b/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java @@ -77,7 +77,8 @@ public class PolicyEngineControllerTestItCase { .contains(new PolicyModel("onap.policies.controlloop.guard.common.FrequencyLimiter", null, "1.0.0")); assertThat(policyModelsList) .contains(new PolicyModel("onap.policies.controlloop.guard.common.Blacklist", null, "1.0.0")); - assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.guard.common.MinMax", null, "2.0.0")); + assertThat(policyModelsList) + .contains(new PolicyModel("onap.policies.controlloop.guard.common.MinMax", null, "2.0.0")); // Re-do it to check that there is no issue with duplicate key policyController.synchronizeAllPolicies(); diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 54ba0900c..0e453535c 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -165,4 +165,7 @@ clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Princ # Configuration settings for CDS clamp.config.cds.url=http4://localhost:${docker.http-cache.port.host} clamp.config.cds.userName=ccsdkapps -clamp.config.cds.password=ccsdkapps
\ No newline at end of file +clamp.config.cds.password=ccsdkapps + +## Tosca converter +clamp.config.tosca.converter.templates=classpath:/clds/tosca_updates/templates.json
\ No newline at end of file |