diff options
author | sebdet <sebastien.determe@intl.att.com> | 2020-03-12 14:38:07 -0700 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2020-03-13 11:03:29 -0700 |
commit | 723de7f63f0951d0cfe7a23956cf9d00128809b1 (patch) | |
tree | 751562c9a0c9a885f6be143c12a6c85472519afb /src | |
parent | 774b4ba65f0d23ae34d3bddb63058796121c1ae3 (diff) |
Fix the new tosca converter
Fix the metadata section analysis and make the tosca parser more configurable (in applications.properties)
Issue-ID: CLAMP-580
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: I9068bd9dc89861c640660a7f78fae2cb70bdc178
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'src')
54 files changed, 2303 insertions, 1909 deletions
diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/ToscaConverterManager.java b/src/main/java/org/onap/clamp/clds/tosca/update/ToscaConverterManager.java deleted file mode 100644 index b3224b045..000000000 --- a/src/main/java/org/onap/clamp/clds/tosca/update/ToscaConverterManager.java +++ /dev/null @@ -1,192 +0,0 @@ -/*- - * ============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; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import java.io.IOException; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import org.onap.clamp.clds.util.JsonUtils; - -public class ToscaConverterManager { - - private LinkedHashMap<String, Template> templates; - private LinkedHashMap<String, ToscaElement> components; - private ToscaConverterToJson toscaConverterToJson; - private ToscaItemsParser toscaItemsParser; - - /** - * Constructor. - * - * @param toscaYamlContent Policy Tosca Yaml content as string - * @param nativeToscaDatatypes The tosca yaml with tosca native datatypes - * @param templateProperties template properties as string - * @throws IOException in case of failure - */ - public ToscaConverterManager(String toscaYamlContent, String nativeToscaDatatypes, String templateProperties) - throws IOException { - if (toscaYamlContent != null && !toscaYamlContent.isEmpty()) { - this.toscaItemsParser = new ToscaItemsParser(toscaYamlContent, nativeToscaDatatypes); - this.components = toscaItemsParser.getAllItemsFound(); - this.templates = initializeTemplates(templateProperties); - } - else { - components = null; - } - } - - //GETTERS & SETTERS - public LinkedHashMap<String, ToscaElement> getComponents() { - return components; - } - - public void setComponents(LinkedHashMap<String, ToscaElement> components) { - this.components = components; - } - - public ToscaConverterToJson getParseToJson() { - return toscaConverterToJson; - } - - public void setParseToJson(ToscaConverterToJson toscaConverterToJson) { - this.toscaConverterToJson = toscaConverterToJson; - } - - public LinkedHashMap<String, Template> getTemplates() { - return templates; - } - - public void setTemplates(LinkedHashMap<String, Template> templates) { - this.templates = templates; - } - - public ToscaItemsParser getToscaItemsParser() { - return toscaItemsParser; - } - - /** - * Add a template. - * - * @param name name - * @param templateFields fields - */ - public void addTemplate(String name, List<TemplateField> templateFields) { - Template template = new Template(name, templateFields); - //If it is true, the operation does not have any interest : - // replace OR put two different object with the same body - if (!templates.containsKey(template.getName()) || !this.hasTemplate(template)) { - this.templates.put(template.getName(), template); - } - } - - /** - * By name, find and remove a given template. - * - * @param nameTemplate name template - */ - public void removeTemplate(String nameTemplate) { - this.templates.remove(nameTemplate); - } - - /** - * Update Template : adding with true flag, removing with false. - * - * @param nameTemplate name template - * @param templateField field name - * @param operation operation - */ - public void updateTemplate(String nameTemplate, TemplateField templateField, Boolean operation) { - // Operation = true && field is not present => add Field - if (operation && !this.templates.get(nameTemplate).getTemplateFields().contains(templateField)) { - this.templates.get(nameTemplate).addField(templateField); - } - // Operation = false && field is present => remove Field - else if (!operation && this.templates.get(nameTemplate).getTemplateFields().contains(templateField)) { - this.templates.get(nameTemplate).removeField(templateField); - } - } - - /** - * Check if the JSONTemplates have the same bodies. - * - * @param template template - * @return a boolean - */ - public boolean hasTemplate(Template template) { - boolean duplicateTemplate = false; - Collection<String> templatesName = templates.keySet(); - if (templatesName.contains(template.getName())) { - Template existingTemplate = templates.get(template.getName()); - duplicateTemplate = existingTemplate.checkFields(template); - } - return duplicateTemplate; - } - - /** - * For a given Component, get a corresponding JsonObject, through parseToJSON. - * - * @param componentName name - * @return an json object - */ - public JsonObject startConversionToJson(String componentName) throws UnknownComponentException { - this.toscaConverterToJson = new ToscaConverterToJson(components, templates); - if (toscaConverterToJson.matchComponent(componentName) == null) { - throw new UnknownComponentException(componentName); - } - return toscaConverterToJson.getJsonProcess(componentName, "object"); - } - - /** - * Create and complete several Templates from file.properties. - * - * @param jsonTemplates The template properties as String - * @return a map - */ - @SuppressWarnings("unused") - private LinkedHashMap<String, Template> initializeTemplates(String jsonTemplates) { - - 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(); - TemplateField bodyTemplateField = new TemplateField(fieldName, fieldValue, fieldVisible, fieldStatic); - template.getTemplateFields().add(bodyTemplateField); - } - generatedTemplates.put(template.getName(), template); - } - return generatedTemplates; - } - -} diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupport.java b/src/main/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupport.java new file mode 100644 index 000000000..c1bf1ad80 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupport.java @@ -0,0 +1,93 @@ +/*- + * ============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; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.gson.JsonObject; +import java.io.IOException; +import org.onap.clamp.clds.config.ClampProperties; +import org.onap.clamp.clds.tosca.update.parser.metadata.ToscaMetadataParser; +import org.onap.clamp.clds.tosca.update.parser.metadata.ToscaMetadataParserWithDictionarySupport; +import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager; +import org.onap.clamp.clds.util.JsonUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class ToscaConverterWithDictionarySupport { + + private static final EELFLogger logger = + EELFManager.getInstance().getLogger(ToscaConverterWithDictionarySupport.class); + + private ClampProperties clampProperties; + private ToscaMetadataParser metadataParser; + + /** + * Constructor with Spring support. + * + * @param clampProperties Clamp Spring properties + * @param metadataParser Metadata parser + */ + @Autowired + public ToscaConverterWithDictionarySupport(ClampProperties clampProperties, + ToscaMetadataParserWithDictionarySupport metadataParser) { + this.clampProperties = clampProperties; + this.metadataParser = metadataParser; + } + + /** + * This method converts a tosca file to a json schema. + * It uses some parameters specified in the application.properties. + * + * @param toscaFile The tosca file as String + * @param policyTypeToDecode The policy type to decode + * @return A json object being a json schema + */ + public JsonObject convertToscaToJsonSchemaObject(String toscaFile, String policyTypeToDecode) { + try { + return new JsonTemplateManager(toscaFile, + clampProperties.getFileContent("tosca.converter.default.datatypes"), + clampProperties.getFileContent("tosca.converter.json.schema.templates")) + .getJsonSchemaForPolicyType(policyTypeToDecode, Boolean.parseBoolean(clampProperties.getStringValue( + "tosca.converter.dictionary.support.enabled")) ? metadataParser : null); + } catch (IOException | UnknownComponentException e) { + logger.error("Unable to convert the tosca properly, exception caught during the decoding", + e); + return new JsonObject(); + } + } + + /** + * This method converts a tosca file to a json schema. + * It uses some parameters specified in the application.properties. + * + * @param toscaFile The tosca file as String + * @param policyTypeToDecode The policy type to decode + * @return A String containing the json schema + */ + public String convertToscaToJsonSchemaString(String toscaFile, String policyTypeToDecode) { + return JsonUtils.GSON.toJson(this.convertToscaToJsonSchemaObject(toscaFile, policyTypeToDecode)); + } +} diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/ArrayField.java b/src/main/java/org/onap/clamp/clds/tosca/update/elements/ArrayField.java index 61e40a1e6..83f792f3f 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/ArrayField.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/elements/ArrayField.java @@ -21,7 +21,7 @@ *
*/
-package org.onap.clamp.clds.tosca.update;
+package org.onap.clamp.clds.tosca.update.elements;
import com.google.gson.JsonArray;
import java.util.ArrayList;
diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/Constraint.java b/src/main/java/org/onap/clamp/clds/tosca/update/elements/Constraint.java index 4f6b27a6a..d6bd355e3 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/Constraint.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/elements/Constraint.java @@ -21,21 +21,22 @@ *
*/
-package org.onap.clamp.clds.tosca.update;
+package org.onap.clamp.clds.tosca.update.elements;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
+import org.onap.clamp.clds.tosca.update.templates.JsonTemplate;
public class Constraint {
private LinkedHashMap<String, Object> constraints;
- private Template template;
+ private JsonTemplate jsonTemplate;
- public Constraint(LinkedHashMap<String, Object> constraints, Template template) {
- this.template = template;
+ public Constraint(LinkedHashMap<String, Object> constraints, JsonTemplate jsonTemplate) {
+ this.jsonTemplate = jsonTemplate;
this.constraints = constraints;
}
@@ -120,7 +121,7 @@ public class Constraint { checkTemplateField("maxLength", jsonSchema, fieldValue);
break;
case "array":
- if (fieldValue.equals(1) && template.hasFields("uniqueItems")) {
+ if (fieldValue.equals(1) && jsonTemplate.hasFields("uniqueItems")) {
jsonSchema.addProperty("uniqueItems", true);
} else {
checkTemplateField("minItems", jsonSchema, fieldValue);
@@ -171,7 +172,7 @@ public class Constraint { * @param typeProperty Get as Enum the valid values for the property
*/
public void getValueArray(JsonObject jsonSchema, Object fieldValue, String typeProperty) {
- if (template.hasFields("enum")) {
+ if (jsonTemplate.hasFields("enum")) {
JsonArray enumeration = new JsonArray();
if (typeProperty.equals("string") || typeProperty.equals("String")) {
ArrayList<String> arrayValues = (ArrayList<String>) fieldValue;
@@ -197,7 +198,7 @@ public class Constraint { * @param fieldValue Simple way to avoid code duplication
*/
public void checkTemplateField(String field, JsonObject jsonSchema, Object fieldValue) {
- if (template.hasFields(field)) {
+ if (jsonTemplate.hasFields(field)) {
String typeField = fieldValue.getClass().getSimpleName();
switch (typeField) {
case "String":
diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/ToscaElement.java b/src/main/java/org/onap/clamp/clds/tosca/update/elements/ToscaElement.java index d702cda55..9035a5806 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/ToscaElement.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/elements/ToscaElement.java @@ -21,7 +21,7 @@ * */ -package org.onap.clamp.clds.tosca.update; +package org.onap.clamp.clds.tosca.update.elements; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -36,7 +36,7 @@ public class ToscaElement { private String version; private String typeVersion; private String description; - private LinkedHashMap<String, Property> properties; + private LinkedHashMap<String, ToscaElementProperty> properties; public ToscaElement() { } @@ -97,16 +97,16 @@ public class ToscaElement { this.description = description; } - public LinkedHashMap<String, Property> getProperties() { + public LinkedHashMap<String, ToscaElementProperty> getProperties() { return properties; } - public void setProperties(LinkedHashMap<String, Property> properties) { + public void setProperties(LinkedHashMap<String, ToscaElementProperty> properties) { this.properties = properties; } - public void addProperties(Property property) { - this.properties.put(property.getName(), property); + public void addProperties(ToscaElementProperty toscaElementProperty) { + this.properties.put(toscaElementProperty.getName(), toscaElementProperty); } public ArrayList<String> propertiesNames() { diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/Property.java b/src/main/java/org/onap/clamp/clds/tosca/update/elements/ToscaElementProperty.java index 0b6e38166..c5ab5a18e 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/Property.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/elements/ToscaElementProperty.java @@ -21,14 +21,15 @@ * */ -package org.onap.clamp.clds.tosca.update; +package org.onap.clamp.clds.tosca.update.elements; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import java.util.ArrayList; import java.util.LinkedHashMap; +import org.onap.clamp.clds.tosca.update.templates.JsonTemplate; -public class Property { +public class ToscaElementProperty { /** * name parameter is used as "key", in the LinkedHashMap of Components. @@ -42,7 +43,7 @@ public class Property { * @param name the name * @param items the items */ - public Property(String name, LinkedHashMap<String, Object> items) { + public ToscaElementProperty(String name, LinkedHashMap<String, Object> items) { super(); this.name = name; this.items = items; @@ -117,14 +118,14 @@ public class Property { * * @param json a json * @param constraints constraints - * @param template template + * @param jsonTemplate template */ @SuppressWarnings("unchecked") - public void addConstraintsAsJson(JsonObject json, ArrayList<Object> constraints, Template template) { + public void addConstraintsAsJson(JsonObject json, ArrayList<Object> constraints, JsonTemplate jsonTemplate) { for (Object constraint : constraints) { if (constraint instanceof LinkedHashMap) { LinkedHashMap<String, Object> valueConstraint = (LinkedHashMap<String, Object>) constraint; - Constraint constraintParser = new Constraint(valueConstraint, template); + Constraint constraintParser = new Constraint(valueConstraint, jsonTemplate); constraintParser.deployConstraints(json, (String) getItems().get("type")); } } diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/ToscaConverterToJson.java b/src/main/java/org/onap/clamp/clds/tosca/update/parser/ToscaConverterToJsonSchema.java index 297d568be..cfc0e42a8 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/ToscaConverterToJson.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/parser/ToscaConverterToJsonSchema.java @@ -21,7 +21,7 @@ * */ -package org.onap.clamp.clds.tosca.update; +package org.onap.clamp.clds.tosca.update.parser; import com.google.gson.JsonArray; import com.google.gson.JsonObject; @@ -29,41 +29,40 @@ import java.util.ArrayList; import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map.Entry; -import org.onap.clamp.tosca.DictionaryService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; +import org.onap.clamp.clds.tosca.update.elements.ToscaElement; +import org.onap.clamp.clds.tosca.update.elements.ToscaElementProperty; +import org.onap.clamp.clds.tosca.update.parser.metadata.ToscaMetadataParser; +import org.onap.clamp.clds.tosca.update.templates.JsonTemplate; -@Component -public class ToscaConverterToJson { +public class ToscaConverterToJsonSchema { private LinkedHashMap<String, ToscaElement> components; - private LinkedHashMap<String, Template> templates; + private LinkedHashMap<String, JsonTemplate> templates; - // if this one is set, the dictionary mechanism is enabled - @Autowired - private DictionaryService dictionaryService; + private ToscaMetadataParser metadataParser; - public ToscaConverterToJson(LinkedHashMap<String, ToscaElement> components, LinkedHashMap<String, Template> templates) { - this.components = components; - this.templates = templates; + /** + * Constructor. + * + * @param toscaElementsMap All the tosca elements found (policy type + data types + native tosca datatypes) + * @param jsonSchemaTemplates All Json schema templates to use + * @param metadataParser The metadata parser to use for metadata section + */ + public ToscaConverterToJsonSchema(LinkedHashMap<String, ToscaElement> toscaElementsMap, + LinkedHashMap<String, JsonTemplate> jsonSchemaTemplates, + ToscaMetadataParser metadataParser) { + this.components = toscaElementsMap; + this.templates = jsonSchemaTemplates; + this.metadataParser = metadataParser; } /** * For a given component, launch process to parse it in Json. * - * @param nameComponent name components + * @param toscaElementKey name components * @return return */ - public JsonObject getJsonProcess(String nameComponent, String typeComponent) { - JsonObject glob = new JsonObject(); - - if (typeComponent.equals("object")) { - glob = this.getFieldAsObject(matchComponent(nameComponent)); - } - else { - /*glob = this.getFieldAsArray(matchComponent(nameComponent));*/ - } - - return glob; + public JsonObject getJsonSchemaOfToscaElement(String toscaElementKey) { + return this.getFieldAsObject(getToscaElement(toscaElementKey)); } /** @@ -110,11 +109,11 @@ public class ToscaConverterToJson { requirements.addAll(getRequirements(toParse.getDerivedFrom())); } //Each property is checked, and add to the requirement array if it's required - Collection<Property> properties = toParse.getProperties().values(); - for (Property property : properties) { - if (property.getItems().containsKey("required") - && property.getItems().get("required").equals(true)) { - requirements.add(property.getName()); + Collection<ToscaElementProperty> properties = toParse.getProperties().values(); + for (ToscaElementProperty toscaElementProperty : properties) { + if (toscaElementProperty.getItems().containsKey("required") + && toscaElementProperty.getItems().get("required").equals(true)) { + requirements.add(toscaElementProperty.getName()); } } return requirements; @@ -137,10 +136,10 @@ public class ToscaConverterToJson { } //For each component property, check if its a complex properties (a component) or not. In that case, //launch the analyse of the property. - for (Entry<String, Property> property : toParse.getProperties().entrySet()) { - if (matchComponent((String) property.getValue().getItems().get("type")) != null) { + for (Entry<String, ToscaElementProperty> property : toParse.getProperties().entrySet()) { + if (getToscaElement((String) property.getValue().getItems().get("type")) != null) { jsonSchema.add(property.getValue().getName(), - this.getJsonProcess((String) property.getValue().getItems().get("type"), "object")); + this.getJsonSchemaOfToscaElement((String) property.getValue().getItems().get("type"))); } else { jsonSchema.add(property.getValue().getName(), this.complexParse(property.getValue())); @@ -162,27 +161,27 @@ public class ToscaConverterToJson { /** * to be done. * - * @param property property + * @param toscaElementProperty property * @return a json object */ @SuppressWarnings("unchecked") - public JsonObject complexParse(Property property) { + public JsonObject complexParse(ToscaElementProperty toscaElementProperty) { JsonObject propertiesInJson = new JsonObject(); - Template currentPropertyTemplate; - String typeProperty = (String) property.getItems().get("type"); + JsonTemplate currentPropertyJsonTemplate; + String typeProperty = (String) toscaElementProperty.getItems().get("type"); if (typeProperty.toLowerCase().equals("list") || typeProperty.toLowerCase().equals("map")) { - currentPropertyTemplate = templates.get("object"); + currentPropertyJsonTemplate = templates.get("object"); } else { - String propertyType = (String) property.getItems().get("type"); - currentPropertyTemplate = templates.get(propertyType.toLowerCase()); + String propertyType = (String) toscaElementProperty.getItems().get("type"); + currentPropertyJsonTemplate = templates.get(propertyType.toLowerCase()); } //Each "special" field is analysed, and has a specific treatment - for (String propertyField : property.getItems().keySet()) { + for (String propertyField : toscaElementProperty.getItems().keySet()) { switch (propertyField) { case "type": - if (currentPropertyTemplate.hasFields(propertyField)) { - String fieldtype = (String) property.getItems().get(propertyField); + if (currentPropertyJsonTemplate.hasFields(propertyField)) { + String fieldtype = (String) toscaElementProperty.getItems().get(propertyField); switch (fieldtype.toLowerCase()) { case "list": propertiesInJson.addProperty("type", "array"); @@ -204,48 +203,57 @@ public class ToscaConverterToJson { break; case "range": propertiesInJson.addProperty("type", "integer"); - if (!checkConstraintPresence(property, "greater_than") - && currentPropertyTemplate.hasFields("exclusiveMinimum")) { + if (!checkConstraintPresence(toscaElementProperty, "greater_than") + && currentPropertyJsonTemplate.hasFields("exclusiveMinimum")) { propertiesInJson.addProperty("exclusiveMinimum", false); } - if (!checkConstraintPresence(property, "less_than") - && currentPropertyTemplate.hasFields("exclusiveMaximum")) { + if (!checkConstraintPresence(toscaElementProperty, "less_than") + && currentPropertyJsonTemplate.hasFields("exclusiveMaximum")) { propertiesInJson.addProperty("exclusiveMaximum", false); } break; default: - propertiesInJson.addProperty("type", currentPropertyTemplate.getName()); + propertiesInJson.addProperty("type", currentPropertyJsonTemplate.getName()); break; } } break; case "metadata": - propertiesInJson.add("enum", MetadataParser.processAllMetadataElement(property, - dictionaryService)); + if (metadataParser != null) { + metadataParser.processAllMetadataElement(toscaElementProperty).entrySet() + .forEach((jsonEntry) -> { + propertiesInJson.add(jsonEntry.getKey(), + jsonEntry.getValue()); + + }); + } break; case "constraints": - property.addConstraintsAsJson(propertiesInJson, - (ArrayList<Object>) property.getItems().get("constraints"), - currentPropertyTemplate); + toscaElementProperty.addConstraintsAsJson(propertiesInJson, + (ArrayList<Object>) toscaElementProperty.getItems().get("constraints"), + currentPropertyJsonTemplate); break; case "entry_schema": //Here, a way to check if entry is a component (datatype) or a simple string - if (matchComponent(this.extractSpecificFieldFromMap(property, "entry_schema")) != null) { - String nameComponent = this.extractSpecificFieldFromMap(property, "entry_schema"); - ToscaConverterToJson child = new ToscaConverterToJson(components, templates); + if (getToscaElement(this.extractSpecificFieldFromMap(toscaElementProperty, "entry_schema")) + != null) { + String nameComponent = this.extractSpecificFieldFromMap(toscaElementProperty, "entry_schema"); + ToscaConverterToJsonSchema + child = new ToscaConverterToJsonSchema(components, templates, + metadataParser); JsonObject propertiesContainer = new JsonObject(); - switch ((String) property.getItems().get("type")) { + switch ((String) toscaElementProperty.getItems().get("type")) { case "map": // Get it as an object - JsonObject componentAsProperty = child.getJsonProcess(nameComponent, "object"); + JsonObject componentAsProperty = child.getJsonSchemaOfToscaElement(nameComponent); propertiesContainer.add(nameComponent, componentAsProperty); - if (currentPropertyTemplate.hasFields("properties")) { + if (currentPropertyJsonTemplate.hasFields("properties")) { propertiesInJson.add("properties", propertiesContainer); } break; default://list : get it as an Array - JsonObject componentAsItem = child.getJsonProcess(nameComponent, "object"); - if (currentPropertyTemplate.hasFields("properties")) { + JsonObject componentAsItem = child.getJsonSchemaOfToscaElement(nameComponent); + if (currentPropertyJsonTemplate.hasFields("properties")) { propertiesInJson.add("items", componentAsItem); } break; @@ -253,9 +261,10 @@ public class ToscaConverterToJson { } // Native cases - else if (property.getItems().get("type").equals("list")) { + else if (toscaElementProperty.getItems().get("type").equals("list")) { JsonObject itemContainer = new JsonObject(); - String valueInEntrySchema = this.extractSpecificFieldFromMap(property, "entry_schema"); + String valueInEntrySchema = + this.extractSpecificFieldFromMap(toscaElementProperty, "entry_schema"); itemContainer.addProperty("type", valueInEntrySchema); propertiesInJson.add("items", itemContainer); } @@ -264,9 +273,9 @@ public class ToscaConverterToJson { break; default: //Each classical field : type, description, default.. - if (currentPropertyTemplate.hasFields(propertyField) && !propertyField.equals("required")) { - property.addFieldToJson(propertiesInJson, propertyField, - property.getItems().get(propertyField)); + if (currentPropertyJsonTemplate.hasFields(propertyField) && !propertyField.equals("required")) { + toscaElementProperty.addFieldToJson(propertiesInJson, propertyField, + toscaElementProperty.getItems().get(propertyField)); } break; } @@ -275,12 +284,12 @@ public class ToscaConverterToJson { } /** - * Look for a matching Component for the name paramater, in the components list. + * Look for a matching Component for the name parameter, in the components list. * - * @param name the name - * @return a component + * @param name the tosca element name to search for + * @return a tosca element */ - public ToscaElement matchComponent(String name) { + public ToscaElement getToscaElement(String name) { ToscaElement correspondingToscaElement = null; if (components == null) { return null; @@ -296,28 +305,28 @@ public class ToscaConverterToJson { /** * Simple method to extract quickly a type field from particular property item. * - * @param property the property - * @param fieldName the fieldname + * @param toscaElementProperty the property + * @param fieldName the fieldname * @return a string */ @SuppressWarnings("unchecked") - public String extractSpecificFieldFromMap(Property property, String fieldName) { + public String extractSpecificFieldFromMap(ToscaElementProperty toscaElementProperty, String fieldName) { LinkedHashMap<String, String> entrySchemaFields = - (LinkedHashMap<String, String>) property.getItems().get(fieldName); + (LinkedHashMap<String, String>) toscaElementProperty.getItems().get(fieldName); return entrySchemaFields.get("type"); } /** * Check if a constraint, for a specific property, is there. * - * @param property property - * @param nameConstraint name constraint + * @param toscaElementProperty property + * @param nameConstraint name constraint * @return a flag boolean */ - public boolean checkConstraintPresence(Property property, String nameConstraint) { + public boolean checkConstraintPresence(ToscaElementProperty toscaElementProperty, String nameConstraint) { boolean presentConstraint = false; - if (property.getItems().containsKey("constraints")) { - ArrayList<Object> constraints = (ArrayList) property.getItems().get("constraints"); + if (toscaElementProperty.getItems().containsKey("constraints")) { + ArrayList<Object> constraints = (ArrayList) toscaElementProperty.getItems().get("constraints"); for (Object constraint : constraints) { if (constraint instanceof LinkedHashMap) { if (((LinkedHashMap) constraint).containsKey(nameConstraint)) { diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/ToscaItemsParser.java b/src/main/java/org/onap/clamp/clds/tosca/update/parser/ToscaElementParser.java index 443a4b0cd..090fcfcfa 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/ToscaItemsParser.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/parser/ToscaElementParser.java @@ -21,38 +21,30 @@ * */ -package org.onap.clamp.clds.tosca.update; +package org.onap.clamp.clds.tosca.update.parser; -import java.io.IOException; import java.util.LinkedHashMap; import java.util.Map.Entry; +import org.onap.clamp.clds.tosca.update.elements.ToscaElement; +import org.onap.clamp.clds.tosca.update.elements.ToscaElementProperty; import org.yaml.snakeyaml.Yaml; -public class ToscaItemsParser { - private LinkedHashMap<String, ToscaElement> allItemsFound; - +public class ToscaElementParser { /** * Constructor. - * - * @param toscaYaml The tosca to parse - * @param toscaNativeDataTypeYaml THe name of the policy type to search */ - public ToscaItemsParser(String toscaYaml, String toscaNativeDataTypeYaml) { - this.allItemsFound = searchAllToscaElements(toscaYaml, toscaNativeDataTypeYaml); - } - - public LinkedHashMap<String, ToscaElement> getAllItemsFound() { - return allItemsFound; + private ToscaElementParser() { } private static LinkedHashMap<String, Object> searchAllDataTypesAndPolicyTypes(String toscaYaml) { LinkedHashMap<String, LinkedHashMap<String, Object>> file = (LinkedHashMap<String, LinkedHashMap<String, Object>>) new Yaml().load(toscaYaml); - // Get DataTypes - LinkedHashMap<String, Object> allItemsFound = file.get("data_types"); - allItemsFound = (allItemsFound == null) ? (new LinkedHashMap<>()) : allItemsFound; + LinkedHashMap<String, Object> allDataTypesFound = file.get("data_types"); + LinkedHashMap<String, Object> allPolicyTypesFound = file.get("policy_types"); + LinkedHashMap<String, Object> allItemsFound = new LinkedHashMap<>(); // Put the policies and datatypes in the same collection - allItemsFound.putAll(file.get("policy_types")); + allItemsFound = (allDataTypesFound == null) ? (new LinkedHashMap<>()) : allDataTypesFound; + allItemsFound.putAll(allPolicyTypesFound == null ? new LinkedHashMap<>() : allPolicyTypesFound); return allItemsFound; } @@ -65,10 +57,12 @@ public class ToscaItemsParser { * Yaml Parse gets raw policies and datatypes, in different sections : necessary to extract * all entities and put them at the same level. * - * @return a map + * @param toscaYaml the tosca model content + * @param nativeToscaYaml the tosca native datatype content + * @return a map of Tosca Element containing all tosca elements found (policy types and datatypes) */ - private static LinkedHashMap<String, ToscaElement> searchAllToscaElements(String toscaYaml, - String nativeToscaYaml) { + public static LinkedHashMap<String, ToscaElement> searchAllToscaElements(String toscaYaml, + String nativeToscaYaml) { LinkedHashMap<String, Object> allItemsFound = searchAllDataTypesAndPolicyTypes(toscaYaml); allItemsFound.putAll(searchAllNativeToscaDataTypes(nativeToscaYaml)); return parseAllItemsFound(allItemsFound); @@ -97,9 +91,9 @@ public class ToscaItemsParser { LinkedHashMap<String, Object> properties = (LinkedHashMap<String, Object>) componentBody.get("properties"); for (Entry<String, Object> itemToProperty : properties.entrySet()) { - Property property = new Property(itemToProperty.getKey(), + ToscaElementProperty toscaElementProperty = new ToscaElementProperty(itemToProperty.getKey(), (LinkedHashMap<String, Object>) itemToProperty.getValue()); - toscaElement.addProperties(property); + toscaElement.addProperties(toscaElementProperty); } } allItemsFound.put(toscaElement.getName(), toscaElement); diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/MetadataParser.java b/src/main/java/org/onap/clamp/clds/tosca/update/parser/metadata/ToscaMetadataParser.java index fb70231fb..a51818e2e 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/MetadataParser.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/parser/metadata/ToscaMetadataParser.java @@ -1,11 +1,10 @@ - /*- * ============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 @@ -22,25 +21,11 @@ * */ -package org.onap.clamp.clds.tosca.update; +package org.onap.clamp.clds.tosca.update.parser.metadata; import com.google.gson.JsonObject; -import org.onap.clamp.tosca.DictionaryService; - -public class MetadataParser { +import org.onap.clamp.clds.tosca.update.elements.ToscaElementProperty; - /** - * This method is used to start the processing of the metadata field. - * - * @param property The property metadata as Json Object - * @param dictionaryService the Dictionary service, if null nothing will be done - * @return The jsonObject structure that must be added to the json schema - */ - public static JsonObject processAllMetadataElement(Property property, DictionaryService dictionaryService) { - if (dictionaryService != null) { - return null; - } else { - return null; - } - } +public interface ToscaMetadataParser { + JsonObject processAllMetadataElement(ToscaElementProperty toscaElementProperty); } diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/parser/metadata/ToscaMetadataParserWithDictionarySupport.java b/src/main/java/org/onap/clamp/clds/tosca/update/parser/metadata/ToscaMetadataParserWithDictionarySupport.java new file mode 100644 index 000000000..349ccee9e --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/tosca/update/parser/metadata/ToscaMetadataParserWithDictionarySupport.java @@ -0,0 +1,178 @@ +/*- + * ============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.parser.metadata; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Optional; +import org.json.JSONArray; +import org.onap.clamp.clds.tosca.JsonEditorSchemaConstants; +import org.onap.clamp.clds.tosca.ToscaSchemaConstants; +import org.onap.clamp.clds.tosca.update.elements.ToscaElementProperty; +import org.onap.clamp.tosca.DictionaryElement; +import org.onap.clamp.tosca.DictionaryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class ToscaMetadataParserWithDictionarySupport implements ToscaMetadataParser { + + @Autowired + private DictionaryService dictionaryService; + + /** + * This method is used to start the processing of the metadata field. + * + * @param toscaElementProperty The property metadata as Json Object + * @return The jsonObject structure that must be added to the json schema + */ + public JsonObject processAllMetadataElement(ToscaElementProperty toscaElementProperty) { + if (dictionaryService != null) { + return parseMetadataPossibleValues(toscaElementProperty.getItems(), dictionaryService); + } + else { + return null; + } + } + + private static JsonObject parseMetadataPossibleValues(LinkedHashMap<String, Object> childNodeMap, + DictionaryService dictionaryService) { + JsonObject childObject = new JsonObject(); + if (childNodeMap.containsKey(ToscaSchemaConstants.METADATA) + && childNodeMap.get(ToscaSchemaConstants.METADATA) != null) { + LinkedHashMap<String, Object> metadataMap = + (LinkedHashMap<String, Object>) childNodeMap.get(ToscaSchemaConstants.METADATA); + if (metadataMap != null) { + metadataMap.entrySet().stream().forEach(constraint -> { + if (constraint.getKey() + .equalsIgnoreCase(ToscaSchemaConstants.METADATA_CLAMP_POSSIBLE_VALUES)) { + JSONArray validValuesArray = new JSONArray(); + if (constraint.getValue() instanceof ArrayList<?>) { + boolean processDictionary = ((ArrayList<?>) constraint.getValue()) + .stream().anyMatch(value -> (value instanceof String + && ((String) value).contains(ToscaSchemaConstants.DICTIONARY))); + if (processDictionary) { + ((ArrayList<?>) constraint.getValue()).stream().forEach(value -> { + if ((value instanceof String && ((String) value) + .contains(ToscaSchemaConstants.DICTIONARY))) { + processDictionaryElements((String) value, childObject, dictionaryService); + } + + }); + } + } + } + }); + } + } + return childObject; + } + + private static void processDictionaryElements(String dictionaryReference, JsonObject childObject, + DictionaryService dictionaryService) { + String[] dictionaryKeyArray = + dictionaryReference.substring(dictionaryReference.indexOf(ToscaSchemaConstants.DICTIONARY) + 11, + dictionaryReference.length()).split("#"); + if (dictionaryKeyArray.length > 1) { + // We support only one # as of now. + List<DictionaryElement> dictionaryElements = null; + if (dictionaryKeyArray.length == 2) { + dictionaryElements = new ArrayList<>(dictionaryService.getDictionary(dictionaryKeyArray[0]) + .getDictionaryElements()); + JsonArray subDictionaryNames = new JsonArray(); + new ArrayList<DictionaryElement>(dictionaryService.getDictionary(dictionaryKeyArray[1]) + .getDictionaryElements()).forEach(elem -> subDictionaryNames.add(elem.getShortName())); + + JsonArray jsonArray = new JsonArray(); + + Optional.of(dictionaryElements).get().stream().forEach(c -> { + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty(JsonEditorSchemaConstants.TYPE, getJsonType(c.getType())); + if (c.getType() != null + && c.getType().equalsIgnoreCase(ToscaSchemaConstants.TYPE_STRING)) { + jsonObject.addProperty(JsonEditorSchemaConstants.MIN_LENGTH, 1); + + } + jsonObject.addProperty(JsonEditorSchemaConstants.ID, c.getName()); + jsonObject.addProperty(JsonEditorSchemaConstants.LABEL, c.getShortName()); + jsonObject.add(JsonEditorSchemaConstants.OPERATORS, subDictionaryNames); + jsonArray.add(jsonObject); + }); + + JsonObject filterObject = new JsonObject(); + filterObject.add(JsonEditorSchemaConstants.FILTERS, jsonArray); + + childObject.addProperty(JsonEditorSchemaConstants.TYPE, + JsonEditorSchemaConstants.TYPE_QBLDR); + // TO invoke validation on such parameters + childObject.addProperty(JsonEditorSchemaConstants.MIN_LENGTH, 1); + childObject.add(JsonEditorSchemaConstants.QSSCHEMA, filterObject); + + } + } + else { + List<DictionaryElement> dictionaryElements = + new ArrayList<>(dictionaryService.getDictionary(dictionaryKeyArray[0]).getDictionaryElements()); + JsonArray dictionaryNames = new JsonArray(); + JsonArray dictionaryFullNames = new JsonArray(); + dictionaryElements.stream().forEach(c -> { + // Json type will be translated before Policy creation + if (c.getType() != null && !c.getType().equalsIgnoreCase("json")) { + dictionaryFullNames.add(c.getName()); + } + dictionaryNames.add(c.getShortName()); + }); + + if (dictionaryFullNames.size() > 0) { + childObject.add(JsonEditorSchemaConstants.ENUM, dictionaryFullNames); + // Add Enum titles for generated translated values during JSON instance + // generation + JsonObject enumTitles = new JsonObject(); + enumTitles.add(JsonEditorSchemaConstants.ENUM_TITLES, dictionaryNames); + childObject.add(JsonEditorSchemaConstants.OPTIONS, enumTitles); + } + else { + childObject.add(JsonEditorSchemaConstants.ENUM, dictionaryNames); + } + } + } + + private static String getJsonType(String toscaType) { + String jsonType = null; + if (toscaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_INTEGER)) { + jsonType = JsonEditorSchemaConstants.TYPE_INTEGER; + } + else if (toscaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_LIST)) { + jsonType = JsonEditorSchemaConstants.TYPE_ARRAY; + } + else { + jsonType = JsonEditorSchemaConstants.TYPE_STRING; + } + return jsonType; + } + +} diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/Template.java b/src/main/java/org/onap/clamp/clds/tosca/update/templates/JsonTemplate.java index 6a531aeea..f64ba68cf 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/Template.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/templates/JsonTemplate.java @@ -21,28 +21,28 @@ * */ -package org.onap.clamp.clds.tosca.update; +package org.onap.clamp.clds.tosca.update.templates; import com.google.gson.JsonObject; import java.util.ArrayList; import java.util.List; -public class Template { +public class JsonTemplate { /** * name parameter is used as "key", in the LinkedHashMap of Templates. */ private String name; - private List<TemplateField> templateFields; + private List<JsonTemplateField> jsonTemplateFields; - public Template(String name) { + public JsonTemplate(String name) { this.name = name; - this.templateFields = new ArrayList<>(); + this.jsonTemplateFields = new ArrayList<>(); } - public Template(String name, List<TemplateField> templateFields) { + public JsonTemplate(String name, List<JsonTemplateField> jsonTemplateFields) { this.name = name; - this.templateFields = templateFields; + this.jsonTemplateFields = jsonTemplateFields; } public String getName() { @@ -53,12 +53,12 @@ public class Template { this.name = name; } - public List<TemplateField> getTemplateFields() { - return templateFields; + public List<JsonTemplateField> getJsonTemplateFields() { + return jsonTemplateFields; } - public void setTemplateFields(List<TemplateField> templateFields) { - this.templateFields = templateFields; + public void setJsonTemplateFields(List<JsonTemplateField> jsonTemplateFields) { + this.jsonTemplateFields = jsonTemplateFields; } /** @@ -68,8 +68,8 @@ public class Template { * @return Ture if it exists, false otherwise */ public boolean hasFields(String fieldName) { - for (TemplateField templateField : this.getTemplateFields()) { - if (templateField.getTitle().equals(fieldName)) { + for (JsonTemplateField jsonTemplateField : this.getJsonTemplateFields()) { + if (jsonTemplateField.getTitle().equals(fieldName)) { return true; } } @@ -82,21 +82,21 @@ public class Template { * @param fieldName The field name * @return THe Field found */ - public TemplateField getSpecificField(String fieldName) { - for (TemplateField templateField : this.getTemplateFields()) { - if (templateField.getTitle().equals(fieldName)) { - return templateField; + public JsonTemplateField getSpecificField(String fieldName) { + for (JsonTemplateField jsonTemplateField : this.getJsonTemplateFields()) { + if (jsonTemplateField.getTitle().equals(fieldName)) { + return jsonTemplateField; } } return null; } - public void addField(TemplateField templateField) { - templateFields.add(templateField); + public void addField(JsonTemplateField jsonTemplateField) { + jsonTemplateFields.add(jsonTemplateField); } - public void removeField(TemplateField templateField) { - templateFields.remove(templateField); + public void removeField(JsonTemplateField jsonTemplateField) { + jsonTemplateFields.remove(jsonTemplateField); } /** @@ -106,9 +106,9 @@ public class Template { * @param state True or false */ public void setVisibility(String nameField, boolean state) { - for (TemplateField templateField : this.templateFields) { - if (templateField.getTitle().equals(nameField)) { - templateField.setVisible(state); + for (JsonTemplateField jsonTemplateField : this.jsonTemplateFields) { + if (jsonTemplateField.getTitle().equals(nameField)) { + jsonTemplateField.setVisible(state); } } } @@ -120,9 +120,9 @@ public class Template { * @param state true or false */ public void setStatic(String nameField, boolean state) { - for (TemplateField templateField : this.templateFields) { - if (templateField.getTitle().equals(nameField)) { - templateField.setStaticValue(state); + for (JsonTemplateField jsonTemplateField : this.jsonTemplateFields) { + if (jsonTemplateField.getTitle().equals(nameField)) { + jsonTemplateField.setStaticValue(state); } } } @@ -134,9 +134,9 @@ public class Template { * @param newValue The new value as Object */ public void updateValueField(String nameField, Object newValue) { - for (TemplateField templateField : this.templateFields) { - if (templateField.getTitle().equals(nameField)) { - templateField.setValue(newValue); + for (JsonTemplateField jsonTemplateField : this.jsonTemplateFields) { + if (jsonTemplateField.getTitle().equals(nameField)) { + jsonTemplateField.setValue(newValue); } } } @@ -144,23 +144,23 @@ public class Template { /** * Compare two templates : size and their contents. * - * @param template the template + * @param jsonTemplate the template * @return a boolean */ - public boolean checkFields(Template template) { + public boolean checkFields(JsonTemplate jsonTemplate) { boolean duplicateFields = false; - if (template.getTemplateFields().size() == this.getTemplateFields().size()) { + if (jsonTemplate.getJsonTemplateFields().size() == this.getJsonTemplateFields().size()) { int countMatchingFields = 0; //loop each component of first - for (TemplateField templateFieldToCheck : template.getTemplateFields()) { - for (TemplateField templateField : this.getTemplateFields()) { - if (templateFieldToCheck.compareWithField(templateField)) { + for (JsonTemplateField jsonTemplateFieldToCheck : jsonTemplate.getJsonTemplateFields()) { + for (JsonTemplateField jsonTemplateField : this.getJsonTemplateFields()) { + if (jsonTemplateFieldToCheck.compareWithField(jsonTemplateField)) { countMatchingFields++; } } } - if (template.getTemplateFields().size() == countMatchingFields) { + if (jsonTemplate.getJsonTemplateFields().size() == countMatchingFields) { duplicateFields = true; } } @@ -212,13 +212,13 @@ public class Template { */ public void injectStaticValue(JsonObject jsonSchema, String fieldName) { if (isVisible(fieldName)) { - TemplateField toInject = this.getSpecificField(fieldName); + JsonTemplateField toInject = this.getSpecificField(fieldName); jsonSchema.addProperty(fieldName, (String) toInject.getValue()); } } @Override public String toString() { - return " templateFields : " + templateFields; + return " templateFields : " + jsonTemplateFields; } } diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/TemplateField.java b/src/main/java/org/onap/clamp/clds/tosca/update/templates/JsonTemplateField.java index 34446436a..a1e15307c 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/TemplateField.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/templates/JsonTemplateField.java @@ -21,15 +21,15 @@ * */ -package org.onap.clamp.clds.tosca.update; +package org.onap.clamp.clds.tosca.update.templates; -public class TemplateField { +public class JsonTemplateField { private String title; private Object value; private Boolean visible; private Boolean staticValue; - public TemplateField(String title) { + public JsonTemplateField(String title) { this.title = title; } @@ -41,7 +41,7 @@ public class TemplateField { * @param visible visible or not * @param staticValue The static value */ - public TemplateField(String title, Object value, Boolean visible, Boolean staticValue) { + public JsonTemplateField(String title, Object value, Boolean visible, Boolean staticValue) { this.title = title; this.value = value; this.visible = visible; @@ -98,18 +98,19 @@ public class TemplateField { return false; } - TemplateField templateField = (TemplateField) otherField; + JsonTemplateField jsonTemplateField = (JsonTemplateField) otherField; - if (title != null ? !title.equals(templateField.title) : templateField.title != null) { + if (title != null ? !title.equals(jsonTemplateField.title) : jsonTemplateField.title != null) { return false; } - if (value != null ? !value.equals(templateField.value) : templateField.value != null) { + if (value != null ? !value.equals(jsonTemplateField.value) : jsonTemplateField.value != null) { return false; } - if (visible != null ? !visible.equals(templateField.visible) : templateField.visible != null) { + if (visible != null ? !visible.equals(jsonTemplateField.visible) : jsonTemplateField.visible != null) { return false; } - return staticValue != null ? staticValue.equals(templateField.staticValue) : templateField.staticValue == null; + return staticValue != null ? staticValue.equals(jsonTemplateField.staticValue) : + jsonTemplateField.staticValue == null; } @Override @@ -121,9 +122,9 @@ public class TemplateField { return false; } - TemplateField templateField = (TemplateField) object; + JsonTemplateField jsonTemplateField = (JsonTemplateField) object; - return title != null ? title.equals(templateField.title) : templateField.title == null; + return title != null ? title.equals(jsonTemplateField.title) : jsonTemplateField.title == null; } @Override @@ -134,15 +135,15 @@ public class TemplateField { /** * This method test the entire equality. * - * @param templateField1 object one - * @param templateField2 object two + * @param jsonTemplateField1 object one + * @param jsonTemplateField2 object two * @return true if they are totally equals (all attributes, false otherwise */ - public static boolean fieldsEquals(TemplateField templateField1, TemplateField templateField2) { - return (templateField2.getTitle().equals(templateField1.getTitle()) - && templateField2.getValue().equals(templateField1.getValue()) - && templateField2.getVisible().equals(templateField1.getVisible()) - && templateField2.getStaticValue().equals(templateField1.getStaticValue())); + public static boolean fieldsEquals(JsonTemplateField jsonTemplateField1, JsonTemplateField jsonTemplateField2) { + return (jsonTemplateField2.getTitle().equals(jsonTemplateField1.getTitle()) + && jsonTemplateField2.getValue().equals(jsonTemplateField1.getValue()) + && jsonTemplateField2.getVisible().equals(jsonTemplateField1.getVisible()) + && jsonTemplateField2.getStaticValue().equals(jsonTemplateField1.getStaticValue())); } } diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/templates/JsonTemplateManager.java b/src/main/java/org/onap/clamp/clds/tosca/update/templates/JsonTemplateManager.java new file mode 100644 index 000000000..5e4b66009 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/tosca/update/templates/JsonTemplateManager.java @@ -0,0 +1,184 @@ +/*- + * ============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.templates; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import org.onap.clamp.clds.tosca.update.UnknownComponentException; +import org.onap.clamp.clds.tosca.update.elements.ToscaElement; +import org.onap.clamp.clds.tosca.update.parser.ToscaConverterToJsonSchema; +import org.onap.clamp.clds.tosca.update.parser.ToscaElementParser; +import org.onap.clamp.clds.tosca.update.parser.metadata.ToscaMetadataParser; +import org.onap.clamp.clds.util.JsonUtils; + +public class JsonTemplateManager { + private LinkedHashMap<String, JsonTemplate> jsonSchemaTemplates; + private LinkedHashMap<String, ToscaElement> toscaElements; + + /** + * Constructor. + * + * @param toscaYamlContent Policy Tosca Yaml content as string + * @param nativeToscaDatatypes The tosca yaml with tosca native datatypes + * @param jsonSchemaTemplates template properties as string + */ + public JsonTemplateManager(String toscaYamlContent, String nativeToscaDatatypes, String jsonSchemaTemplates) { + if (toscaYamlContent != null && !toscaYamlContent.isEmpty()) { + this.toscaElements = ToscaElementParser.searchAllToscaElements(toscaYamlContent, nativeToscaDatatypes); + this.jsonSchemaTemplates = initializeTemplates(jsonSchemaTemplates); + } + else { + toscaElements = null; + } + } + + //GETTERS & SETTERS + public LinkedHashMap<String, ToscaElement> getToscaElements() { + return toscaElements; + } + + public void setToscaElements(LinkedHashMap<String, ToscaElement> toscaElements) { + this.toscaElements = toscaElements; + } + + public LinkedHashMap<String, JsonTemplate> getJsonSchemaTemplates() { + return jsonSchemaTemplates; + } + + public void setJsonSchemaTemplates(LinkedHashMap<String, JsonTemplate> jsonSchemaTemplates) { + this.jsonSchemaTemplates = jsonSchemaTemplates; + } + + /** + * Add a template. + * + * @param name name + * @param jsonTemplateFields fields + */ + public void addTemplate(String name, List<JsonTemplateField> jsonTemplateFields) { + JsonTemplate jsonTemplate = new JsonTemplate(name, jsonTemplateFields); + //If it is true, the operation does not have any interest : + // replace OR put two different object with the same body + if (!jsonSchemaTemplates.containsKey(jsonTemplate.getName()) || !this.hasTemplate(jsonTemplate)) { + this.jsonSchemaTemplates.put(jsonTemplate.getName(), jsonTemplate); + } + } + + /** + * By name, find and remove a given template. + * + * @param nameTemplate name template + */ + public void removeTemplate(String nameTemplate) { + this.jsonSchemaTemplates.remove(nameTemplate); + } + + /** + * Update Template : adding with true flag, removing with false. + * + * @param nameTemplate name template + * @param jsonTemplateField field name + * @param operation operation + */ + public void updateTemplate(String nameTemplate, JsonTemplateField jsonTemplateField, Boolean operation) { + // Operation = true && field is not present => add Field + if (operation && !this.jsonSchemaTemplates.get(nameTemplate).getJsonTemplateFields().contains(jsonTemplateField)) { + this.jsonSchemaTemplates.get(nameTemplate).addField(jsonTemplateField); + } + // Operation = false && field is present => remove Field + else if (!operation && this.jsonSchemaTemplates.get(nameTemplate).getJsonTemplateFields().contains(jsonTemplateField)) { + this.jsonSchemaTemplates.get(nameTemplate).removeField(jsonTemplateField); + } + } + + /** + * Check if the JSONTemplates have the same bodies. + * + * @param jsonTemplate template + * @return a boolean + */ + public boolean hasTemplate(JsonTemplate jsonTemplate) { + boolean duplicateTemplate = false; + Collection<String> templatesName = jsonSchemaTemplates.keySet(); + if (templatesName.contains(jsonTemplate.getName())) { + JsonTemplate existingJsonTemplate = jsonSchemaTemplates.get(jsonTemplate.getName()); + duplicateTemplate = existingJsonTemplate.checkFields(jsonTemplate); + } + return duplicateTemplate; + } + + /** + * For a given policy type, get a corresponding JsonObject from the tosca model. + * + * @param policyType The policy type in the tosca + * @param toscaMetadataParser The MetadataParser class that must be used if metadata section are encountered, if null + * they will be skipped + * @return an json object defining the equivalent json schema from the tosca for a given policy type + */ + public JsonObject getJsonSchemaForPolicyType(String policyType, ToscaMetadataParser toscaMetadataParser) + throws UnknownComponentException { + ToscaConverterToJsonSchema + toscaConverterToJsonSchema = new ToscaConverterToJsonSchema(toscaElements, jsonSchemaTemplates, + toscaMetadataParser); + if (toscaConverterToJsonSchema.getToscaElement(policyType) == null) { + throw new UnknownComponentException(policyType); + } + return toscaConverterToJsonSchema.getJsonSchemaOfToscaElement(policyType); + } + + /** + * Create and complete several Templates from file.properties. + * + * @param jsonTemplates The template properties as String + * @return a map + */ + @SuppressWarnings("unused") + private LinkedHashMap<String, JsonTemplate> initializeTemplates(String jsonTemplates) { + + LinkedHashMap<String, JsonTemplate> generatedTemplates = new LinkedHashMap<>(); + JsonObject templates = JsonUtils.GSON.fromJson(jsonTemplates, JsonObject.class); + + for (Map.Entry<String, JsonElement> templateAsJson : templates.entrySet()) { + JsonTemplate jsonTemplate = new JsonTemplate(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(); + JsonTemplateField + bodyJsonTemplateField = new JsonTemplateField(fieldName, fieldValue, fieldVisible, fieldStatic); + jsonTemplate.getJsonTemplateFields().add(bodyJsonTemplateField); + } + generatedTemplates.put(jsonTemplate.getName(), jsonTemplate); + } + return generatedTemplates; + } + +} diff --git a/src/main/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilder.java b/src/main/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilder.java index 846b3ab2d..6cf342f2c 100755 --- a/src/main/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilder.java +++ b/src/main/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilder.java @@ -88,7 +88,7 @@ public class ClampGraphBuilder { public ClampGraphBuilder addLoopElementModel(LoopElementModel loopElementModel) { if (LoopElementModel.MICRO_SERVICE_TYPE.equals(loopElementModel.getLoopElementType())) { microServices.add(new MicroServicePolicy(loopElementModel.getName(), - loopElementModel.getPolicyModels().first(), false, loopElementModel)); + loopElementModel.getPolicyModels().first(), false,null,loopElementModel,null,null)); } else if (LoopElementModel.OPERATIONAL_POLICY_TYPE.equals(loopElementModel.getLoopElementType())) { policies.add(new OperationalPolicy(loopElementModel.getName(), null, null, loopElementModel.getPolicyModels().first(), loopElementModel, null, null)); diff --git a/src/main/java/org/onap/clamp/loop/Loop.java b/src/main/java/org/onap/clamp/loop/Loop.java index 2bf3decd6..dd6fbf051 100644 --- a/src/main/java/org/onap/clamp/loop/Loop.java +++ b/src/main/java/org/onap/clamp/loop/Loop.java @@ -27,6 +27,7 @@ import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonObject; import com.google.gson.annotations.Expose; +import java.io.IOException; import java.io.Serializable; import java.util.HashMap; import java.util.HashSet; @@ -48,11 +49,11 @@ import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Transient; -import org.apache.commons.lang3.RandomStringUtils; import org.hibernate.annotations.SortNatural; import org.hibernate.annotations.Type; import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDefs; +import org.onap.clamp.clds.tosca.update.ToscaConverterWithDictionarySupport; import org.onap.clamp.clds.util.drawing.SvgLoopGenerator; import org.onap.clamp.dao.model.jsontype.StringJsonUserType; import org.onap.clamp.loop.common.AuditEntity; @@ -63,7 +64,6 @@ import org.onap.clamp.loop.log.LoopLog; import org.onap.clamp.loop.service.Service; import org.onap.clamp.loop.template.LoopElementModel; import org.onap.clamp.loop.template.LoopTemplate; -import org.onap.clamp.policy.Policy; import org.onap.clamp.policy.microservice.MicroServicePolicy; import org.onap.clamp.policy.operational.OperationalPolicy; @@ -164,24 +164,29 @@ public class Loop extends AuditEntity implements Serializable { * @param name The loop name * @param loopTemplate The loop template from which a new loop instance must be created */ - public Loop(String name, LoopTemplate loopTemplate) { - this(name,""); + public Loop(String name, LoopTemplate loopTemplate, ToscaConverterWithDictionarySupport toscaConverter) { + this(name, ""); this.setLoopTemplate(loopTemplate); this.setModelService(loopTemplate.getModelService()); loopTemplate.getLoopElementModelsUsed().forEach(element -> { if (LoopElementModel.MICRO_SERVICE_TYPE.equals(element.getLoopElementModel().getLoopElementType())) { - this.addMicroServicePolicy(new MicroServicePolicy(Policy.generatePolicyName("MICROSERVICE_", - loopTemplate.getModelService().getName(),loopTemplate.getModelService().getVersion(), - RandomStringUtils.randomAlphanumeric(3),RandomStringUtils.randomAlphanumeric(3)), - element.getLoopElementModel().getPolicyModels().first(), false, element.getLoopElementModel())); - } else if (LoopElementModel.OPERATIONAL_POLICY_TYPE + try { + this.addMicroServicePolicy((MicroServicePolicy) element.getLoopElementModel() + .createPolicyInstance(this, toscaConverter)); + } catch (IOException e) { + logger.error("Exception caught when creating the microservice policy instance of the loop " + + "instance", e); + } + } + else if (LoopElementModel.OPERATIONAL_POLICY_TYPE .equals(element.getLoopElementModel().getLoopElementType())) { - this.addOperationalPolicy(new OperationalPolicy(Policy.generatePolicyName("OPERATIONAL_", - loopTemplate.getModelService().getName(),loopTemplate.getModelService().getVersion(), - RandomStringUtils.randomAlphanumeric(3),RandomStringUtils.randomAlphanumeric(3)), null, - new JsonObject(), - element.getLoopElementModel().getPolicyModels().first(), element.getLoopElementModel(), - null,null)); + try { + this.addOperationalPolicy((OperationalPolicy) element.getLoopElementModel() + .createPolicyInstance(this, toscaConverter)); + } catch (IOException e) { + logger.error("Exception caught when creating the operational policy instance of the loop instance", + e); + } } }); } @@ -379,7 +384,8 @@ public class Loop extends AuditEntity 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/loop/LoopController.java b/src/main/java/org/onap/clamp/loop/LoopController.java index 1a4ae5997..d230eb976 100644 --- a/src/main/java/org/onap/clamp/loop/LoopController.java +++ b/src/main/java/org/onap/clamp/loop/LoopController.java @@ -26,6 +26,7 @@ package org.onap.clamp.loop; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.reflect.TypeToken; +import java.io.IOException; import java.lang.reflect.Type; import java.util.List; import org.onap.clamp.clds.util.JsonUtils; @@ -105,7 +106,7 @@ public class LoopController { * @param policyVersion The policy model version * @return The loop modified */ - public Loop addOperationalPolicy(String loopName, String policyType, String policyVersion) { + public Loop addOperationalPolicy(String loopName, String policyType, String policyVersion) throws IOException { return loopService.addOperationalPolicy(loopName, policyType, policyVersion); } diff --git a/src/main/java/org/onap/clamp/loop/LoopService.java b/src/main/java/org/onap/clamp/loop/LoopService.java index 953a59471..acd125b78 100644 --- a/src/main/java/org/onap/clamp/loop/LoopService.java +++ b/src/main/java/org/onap/clamp/loop/LoopService.java @@ -24,14 +24,14 @@ package org.onap.clamp.loop; import com.google.gson.JsonObject; +import java.io.IOException; import java.util.List; import java.util.Set; import javax.persistence.EntityNotFoundException; -import org.apache.commons.lang3.RandomStringUtils; +import org.onap.clamp.clds.tosca.update.ToscaConverterWithDictionarySupport; import org.onap.clamp.loop.template.LoopTemplatesService; import org.onap.clamp.loop.template.PolicyModel; import org.onap.clamp.loop.template.PolicyModelsService; -import org.onap.clamp.policy.Policy; import org.onap.clamp.policy.microservice.MicroServicePolicy; import org.onap.clamp.policy.microservice.MicroServicePolicyService; import org.onap.clamp.policy.operational.OperationalPolicy; @@ -57,6 +57,9 @@ public class LoopService { @Autowired private LoopTemplatesService loopTemplateService; + @Autowired + private ToscaConverterWithDictionarySupport toscaConverter; + Loop saveOrUpdateLoop(Loop loop) { return loopsRepository.save(loop); } @@ -76,12 +79,13 @@ public class LoopService { /** * Creates a Loop Instance from Loop Template Name. * - * @param loopName Name of the Loop to be created + * @param loopName Name of the Loop to be created * @param templateName Loop Template to used for Loop * @return Loop Instance */ public Loop createLoopFromTemplate(String loopName, String templateName) { - return loopsRepository.save(new Loop(loopName,loopTemplateService.getLoopTemplate(templateName))); + return loopsRepository + .save(new Loop(loopName, loopTemplateService.getLoopTemplate(templateName), toscaConverter)); } /** @@ -104,22 +108,21 @@ public class LoopService { /** * This method add an operational policy to a loop instance. + * This creates an operational policy from the policy model info and not the loop element model * - * @param loopName The loop name - * @param policyType The policy model type + * @param loopName The loop name + * @param policyType The policy model type * @param policyVersion The policy model version * @return The loop modified */ - Loop addOperationalPolicy(String loopName, String policyType, String policyVersion) { + Loop addOperationalPolicy(String loopName, String policyType, String policyVersion) throws IOException { Loop loop = getLoop(loopName); PolicyModel policyModel = policyModelsService.getPolicyModel(policyType, policyVersion); if (policyModel == null) { return null; } loop.addOperationalPolicy( - new OperationalPolicy(Policy.generatePolicyName("OPERATIONAL", loop.getModelService().getName(), - loop.getModelService().getVersion(), RandomStringUtils.randomAlphanumeric(3), - RandomStringUtils.randomAlphanumeric(4)), loop, null, policyModel, null, null, null)); + new OperationalPolicy(loop,loop.getModelService(), policyModel, toscaConverter)); return loopsRepository.saveAndFlush(loop); } diff --git a/src/main/java/org/onap/clamp/loop/service/CsarServiceInstaller.java b/src/main/java/org/onap/clamp/loop/service/CsarServiceInstaller.java index b7ed1de9a..6db6d920f 100644 --- a/src/main/java/org/onap/clamp/loop/service/CsarServiceInstaller.java +++ b/src/main/java/org/onap/clamp/loop/service/CsarServiceInstaller.java @@ -27,9 +27,7 @@ package org.onap.clamp.loop.service; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonObject; - import java.util.Map.Entry; - import org.onap.clamp.clds.client.CdsServices; import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException; import org.onap.clamp.clds.model.cds.CdsBpWorkFlowListResponse; @@ -96,7 +94,8 @@ public class CsarServiceInstaller { if (SdcTypes.PNF == type || SdcTypes.VF == type) { JsonObject controllerProperties = createCdsArtifactProperties(nodeTemplate); if (controllerProperties != null) { - resourcesPropByType.getAsJsonObject(nodeTemplate.getName()).add("controllerProperties", controllerProperties); + resourcesPropByType.getAsJsonObject(nodeTemplate.getName()) + .add("controllerProperties", controllerProperties); } } } @@ -151,7 +150,8 @@ public class CsarServiceInstaller { Object artifactName = nodeTemplate.getPropertyValue("sdnc_model_name"); Object artifactVersion = nodeTemplate.getPropertyValue("sdnc_model_version"); if (artifactName != null && artifactVersion != null) { - CdsBpWorkFlowListResponse response = queryCdsToGetWorkFlowList(artifactName.toString(), artifactVersion.toString()); + CdsBpWorkFlowListResponse response = + queryCdsToGetWorkFlowList(artifactName.toString(), artifactVersion.toString()); if (response == null) { return null; } @@ -159,7 +159,7 @@ public class CsarServiceInstaller { JsonObject workFlowProps = new JsonObject(); for (String workFlow : response.getWorkflows()) { JsonObject inputs = queryCdsToGetWorkFlowInputProperties(response.getBlueprintName(), - response.getVersion(), workFlow); + response.getVersion(), workFlow); workFlowProps.add(workFlow, inputs); } @@ -176,7 +176,8 @@ public class CsarServiceInstaller { return cdsServices.getBlueprintWorkflowList(artifactName, artifactVersion); } - private JsonObject queryCdsToGetWorkFlowInputProperties(String artifactName, String artifactVersion, String workFlow) { + private JsonObject queryCdsToGetWorkFlowInputProperties(String artifactName, String artifactVersion, + String workFlow) { return cdsServices.getWorkflowInputProperties(artifactName, artifactVersion, workFlow); } } diff --git a/src/main/java/org/onap/clamp/loop/service/Service.java b/src/main/java/org/onap/clamp/loop/service/Service.java index 89c0b2d42..338032a16 100644 --- a/src/main/java/org/onap/clamp/loop/service/Service.java +++ b/src/main/java/org/onap/clamp/loop/service/Service.java @@ -27,15 +27,12 @@ import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonObject; import com.google.gson.annotations.Expose; - import java.io.Serializable; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Transient; - import org.hibernate.annotations.Type; import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDefs; @@ -44,7 +41,7 @@ import org.onap.clamp.dao.model.jsontype.StringJsonUserType; @Entity @Table(name = "services") -@TypeDefs({ @TypeDef(name = "json", typeClass = StringJsonUserType.class) }) +@TypeDefs({@TypeDef(name = "json", typeClass = StringJsonUserType.class)}) public class Service implements Serializable { /** @@ -120,6 +117,8 @@ public class Service implements Serializable { } /** + * Name getter. + * * @return the name */ public String getName() { @@ -127,6 +126,8 @@ public class Service implements Serializable { } /** + * Version getter. + * * @return the version */ public String getVersion() { @@ -157,7 +158,8 @@ public class Service implements Serializable { if (other.serviceUuid != null) { return false; } - } else if (!serviceUuid.equals(other.serviceUuid)) { + } + else if (!serviceUuid.equals(other.serviceUuid)) { return false; } return true; diff --git a/src/main/java/org/onap/clamp/loop/template/LoopElementModel.java b/src/main/java/org/onap/clamp/loop/template/LoopElementModel.java index 479605983..dfdfc42b3 100644 --- a/src/main/java/org/onap/clamp/loop/template/LoopElementModel.java +++ b/src/main/java/org/onap/clamp/loop/template/LoopElementModel.java @@ -24,6 +24,7 @@ package org.onap.clamp.loop.template; import com.google.gson.annotations.Expose; +import java.io.IOException; import java.io.Serializable; import java.util.HashSet; import java.util.Set; @@ -40,7 +41,12 @@ import javax.persistence.ManyToMany; import javax.persistence.OneToMany; import javax.persistence.Table; import org.hibernate.annotations.SortNatural; +import org.onap.clamp.clds.tosca.update.ToscaConverterWithDictionarySupport; +import org.onap.clamp.loop.Loop; import org.onap.clamp.loop.common.AuditEntity; +import org.onap.clamp.policy.Policy; +import org.onap.clamp.policy.microservice.MicroServicePolicy; +import org.onap.clamp.policy.operational.OperationalPolicy; /** * This class represents a micro service/operational/... model for a loop template. @@ -241,6 +247,24 @@ public class LoopElementModel extends AuditEntity implements Serializable { this.blueprint = blueprint; } + /** + * Create a policy instance from the current loop element model. + * + * @return A Policy object. + * @throws IOException in case of failure when creating an operational policy + */ + public Policy createPolicyInstance(Loop loop, ToscaConverterWithDictionarySupport toscaConverter) + throws IOException { + if (LoopElementModel.MICRO_SERVICE_TYPE.equals(this.getLoopElementType())) { + return new MicroServicePolicy(loop, loop.getModelService(), this, toscaConverter); + } + else if (LoopElementModel.OPERATIONAL_POLICY_TYPE.equals(this.getLoopElementType())) { + return new OperationalPolicy(loop, loop.getModelService(), this, toscaConverter); + } else { + return null; + } + } + @Override public int hashCode() { final int prime = 31; @@ -265,7 +289,8 @@ public class LoopElementModel extends AuditEntity 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/loop/template/PolicyModelsService.java b/src/main/java/org/onap/clamp/loop/template/PolicyModelsService.java index aeea55dbb..ae66c54b8 100644 --- a/src/main/java/org/onap/clamp/loop/template/PolicyModelsService.java +++ b/src/main/java/org/onap/clamp/loop/template/PolicyModelsService.java @@ -56,7 +56,7 @@ public class PolicyModelsService { * @return The Policy Model */ public PolicyModel saveOrUpdatePolicyModel(PolicyModel policyModel) { - return policyModelsRepository.save(policyModel); + return policyModelsRepository.saveAndFlush(policyModel); } /** diff --git a/src/main/java/org/onap/clamp/policy/Policy.java b/src/main/java/org/onap/clamp/policy/Policy.java index c9055bf9d..3b2206461 100644 --- a/src/main/java/org/onap/clamp/policy/Policy.java +++ b/src/main/java/org/onap/clamp/policy/Policy.java @@ -30,7 +30,6 @@ import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.annotations.Expose; -import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.Map; import javax.persistence.Column; @@ -44,9 +43,6 @@ import org.hibernate.annotations.Type; import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDefs; import org.json.JSONObject; -import org.onap.clamp.clds.tosca.update.ToscaConverterManager; -import org.onap.clamp.clds.tosca.update.UnknownComponentException; -import org.onap.clamp.clds.util.ResourceFileUtil; import org.onap.clamp.dao.model.jsontype.StringJsonUserType; import org.onap.clamp.loop.common.AuditEntity; import org.onap.clamp.loop.template.LoopElementModel; @@ -286,23 +282,4 @@ public abstract class Policy extends AuditEntity { .append(blueprintFilename.replaceAll(".yaml", "")); return buffer.toString().replace('.', '_').replaceAll(" ", ""); } - - /** - * This method can be used to generate the json Schema used by the UI. - * - * @param policyToscaModel The tosca model as String that must be converted - * @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.json file - * @throws UnknownComponentException If the policyModelType is not found in the tosca model - */ - public static JsonObject generateJsonRepresentationFromToscaModel(String policyToscaModel, - String policyModelType) - throws IOException, UnknownComponentException { - return new ToscaConverterManager(policyToscaModel,ResourceFileUtil.getResourceAsString( - "clds/tosca_update/default-tosca-types.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")) - .startConversionToJson(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 b8093ccf1..321c12f6a 100644 --- a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java +++ b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java @@ -27,7 +27,6 @@ import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonObject; import com.google.gson.annotations.Expose; -import java.io.IOException; import java.io.Serializable; import java.util.HashSet; import java.util.Set; @@ -38,11 +37,13 @@ import javax.persistence.Id; import javax.persistence.ManyToMany; import javax.persistence.Table; import javax.persistence.Transient; +import org.apache.commons.lang3.RandomStringUtils; import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDefs; -import org.onap.clamp.clds.tosca.update.UnknownComponentException; +import org.onap.clamp.clds.tosca.update.ToscaConverterWithDictionarySupport; import org.onap.clamp.dao.model.jsontype.StringJsonUserType; import org.onap.clamp.loop.Loop; +import org.onap.clamp.loop.service.Service; import org.onap.clamp.loop.template.LoopElementModel; import org.onap.clamp.loop.template.PolicyModel; import org.onap.clamp.policy.Policy; @@ -91,31 +92,10 @@ public class MicroServicePolicy extends Policy implements Serializable { @Column(name = "dcae_blueprint_id") private String dcaeBlueprintId; - public MicroServicePolicy() { - // serialization - } - /** - * The constructor that creates the json representation from the policyTosca - * using the ToscaYamlToJsonConvertor. - * - * @param name The name of the MicroService - * @param policyModel The policy model of the MicroService - * @param shared The flag indicate whether the MicroService is shared + * Constructor for serialization. */ - public MicroServicePolicy(String name, PolicyModel policyModel, Boolean shared, LoopElementModel loopElementModel) { - this.name = name; - this.setPolicyModel(policyModel); - this.shared = shared; - try { - 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()); - } - this.setLoopElementModel(loopElementModel); + public MicroServicePolicy() { } /** @@ -129,7 +109,7 @@ public class MicroServicePolicy extends Policy implements Serializable { * @param jsonRepresentation The UI representation in json format * @param loopElementModel The loop element model from which this instance should be created * @param pdpGroup The Pdp Group info - * @param pdpSubgroup The Pdp Subgrouop info + * @param pdpSubgroup The Pdp Subgroup info */ public MicroServicePolicy(String name, PolicyModel policyModel, Boolean shared, JsonObject jsonRepresentation, LoopElementModel loopElementModel, String pdpGroup, @@ -143,6 +123,25 @@ public class MicroServicePolicy extends Policy implements Serializable { this.setPdpSubgroup(pdpSubgroup); } + /** + * Constructor with tosca converter. + * + * @param loop The loop instance + * @param service The service model object + * @param loopElementModel The loop element model from which this microservice instance is created + * @param toscaConverter The tosca converter that will used to convert the tosca policy model + */ + public MicroServicePolicy(Loop loop, Service service, LoopElementModel loopElementModel, + ToscaConverterWithDictionarySupport toscaConverter) { + this(Policy.generatePolicyName("MICROSERVICE", service.getName(), service.getVersion(), + RandomStringUtils.randomAlphanumeric(3), RandomStringUtils.randomAlphanumeric(3)), + loopElementModel.getPolicyModels().first(), false, + toscaConverter.convertToscaToJsonSchemaObject( + loopElementModel.getPolicyModels().first().getPolicyModelTosca(), + loopElementModel.getPolicyModels().first().getPolicyModelType()), + loopElementModel, null, null); + } + @Override public String getName() { return name; diff --git a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java index 9cf516330..355a889e0 100644 --- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java +++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java @@ -48,11 +48,13 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Transient; +import org.apache.commons.lang3.RandomStringUtils; import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDefs; -import org.onap.clamp.clds.tosca.update.UnknownComponentException; +import org.onap.clamp.clds.tosca.update.ToscaConverterWithDictionarySupport; import org.onap.clamp.dao.model.jsontype.StringJsonUserType; import org.onap.clamp.loop.Loop; +import org.onap.clamp.loop.service.Service; import org.onap.clamp.loop.template.LoopElementModel; import org.onap.clamp.loop.template.PolicyModel; import org.onap.clamp.policy.Policy; @@ -80,54 +82,101 @@ public class OperationalPolicy extends Policy implements Serializable { @JoinColumn(name = "loop_id", nullable = false) private Loop loop; + /** + * Constructor for serialization. + */ public OperationalPolicy() { - // Serialization } /** * The constructor. * * @param name The name of the operational policy - * @param loop The loop that uses this operational policy * @param configurationsJson The operational policy property in the format of * json + * @param jsonRepresentation The jsonObject defining the json schema * @param policyModel The policy model associated if any, can be null * @param loopElementModel The loop element from which this instance is supposed to be created * @param pdpGroup The Pdp Group info * @param pdpSubgroup The Pdp Subgroup info */ - public OperationalPolicy(String name, Loop loop, JsonObject configurationsJson, PolicyModel policyModel, + public OperationalPolicy(String name, JsonObject configurationsJson, + JsonObject jsonRepresentation, PolicyModel policyModel, LoopElementModel loopElementModel, String pdpGroup, String pdpSubgroup) { this.name = name; - this.loop = loop; this.setPolicyModel(policyModel); this.setConfigurationsJson(configurationsJson); this.setPdpGroup(pdpGroup); this.setPdpSubgroup(pdpSubgroup); this.setLoopElementModel(loopElementModel); - this.setJsonRepresentation(this.generateJsonRepresentation(policyModel)); + this.setJsonRepresentation(jsonRepresentation); + + } + /** + * Create an operational policy from a loop element model. + * + * @param loop The parent loop + * @param service The loop service + * @param loopElementModel The loop element model + * @param toscaConverter The tosca converter that must be used to create the Json representation + * @throws IOException In case of issues with the legacy files (generated from resource files + */ + public OperationalPolicy(Loop loop, Service service, LoopElementModel loopElementModel, + ToscaConverterWithDictionarySupport toscaConverter) throws IOException { + this(Policy.generatePolicyName("OPERATIONAL", service.getName(), service.getVersion(), + RandomStringUtils.randomAlphanumeric(3), RandomStringUtils.randomAlphanumeric(3)), new JsonObject(), + new JsonObject(), loopElementModel.getPolicyModels().first(), loopElementModel, null, null); + this.setLoop(loop); + this.setJsonRepresentation(generateJsonRepresentation(this, toscaConverter)); + } + + /** + * Create an operational policy from a policy model. + * + * @param loop The parent loop + * @param service The loop service + * @param policyModel The policy model + * @param toscaConverter The tosca converter that must be used to create the Json representation + * @throws IOException In case of issues with the legacy files (generated from resource files + */ + public OperationalPolicy(Loop loop, Service service, PolicyModel policyModel, + ToscaConverterWithDictionarySupport toscaConverter) throws IOException { + this(Policy.generatePolicyName("OPERATIONAL", service.getName(), service.getVersion(), + RandomStringUtils.randomAlphanumeric(3), RandomStringUtils.randomAlphanumeric(3)), new JsonObject(), + new JsonObject(), policyModel, null, null, null); + this.setLoop(loop); + this.setJsonRepresentation(generateJsonRepresentation(this, toscaConverter)); } - private JsonObject generateJsonRepresentation(PolicyModel policyModel) { + /** + * This method can generate a Json representation (json schema) for an operational policy. + * This is mainly to support a legacy case and a generic case. + * + * @param operationalPolicy The operational policy + * @param toscaConverter The tosca converter + * @return The Json Object with Json schema + */ + public static JsonObject generateJsonRepresentation(OperationalPolicy operationalPolicy, + ToscaConverterWithDictionarySupport toscaConverter) + throws IOException { JsonObject jsonReturned = new JsonObject(); - if (policyModel == null) { + if (operationalPolicy.getPolicyModel() == null) { return new JsonObject(); } - try { - if (isLegacy()) { - // Op policy Legacy case - LegacyOperationalPolicy.preloadConfiguration(jsonReturned, loop); - jsonReturned = - OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(loop.getModelService()); - } else { - // Generic Case - jsonReturned = Policy.generateJsonRepresentationFromToscaModel(policyModel.getPolicyModelTosca(), - policyModel.getPolicyModelType()); - } - } catch (UnknownComponentException | IOException | NullPointerException e) { - logger.error("Unable to generate the operational policy Schema ... ", e); + if (operationalPolicy.isLegacy()) { + // Op policy Legacy case + LegacyOperationalPolicy.preloadConfiguration(jsonReturned, operationalPolicy.loop); + jsonReturned = OperationalPolicyRepresentationBuilder + .generateOperationalPolicySchema(operationalPolicy.loop.getModelService()); + } + else { + // Generic Case + jsonReturned = toscaConverter.convertToscaToJsonSchemaObject( + operationalPolicy.getPolicyModel().getPolicyModelTosca(), + operationalPolicy.getPolicyModel().getPolicyModelType()); } + return jsonReturned; } @@ -178,7 +227,8 @@ public class OperationalPolicy 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; @@ -243,7 +293,8 @@ public class OperationalPolicy extends Policy implements Serializable { String opPayload = new GsonBuilder().setPrettyPrinting().create().toJson(payload); logger.info("Operational policy payload: " + opPayload); return opPayload; - } else { + } + else { return super.createPolicyPayload(); } } @@ -261,7 +312,7 @@ public class OperationalPolicy extends Policy implements Serializable { if (guardsList != null) { for (JsonElement guardElem : guardsList.getAsJsonArray()) { result.put(guardElem.getAsJsonObject().get("policy-id").getAsString(), - new GsonBuilder().create().toJson(guardElem)); + new GsonBuilder().create().toJson(guardElem)); } } } diff --git a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java index 244f4c27a..0298cfde7 100644 --- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java +++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java @@ -28,10 +28,8 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonSyntaxException; - import java.io.IOException; import java.util.Map.Entry; - import org.onap.clamp.clds.util.JsonUtils; import org.onap.clamp.clds.util.ResourceFileUtil; import org.onap.clamp.loop.service.Service; @@ -79,7 +77,7 @@ public class OperationalPolicyRepresentationBuilder { } private static JsonObject createSchemaProperty(String title, String type, String defaultValue, String readOnlyFlag, - String[] enumArray) { + String[] enumArray) { JsonObject property = new JsonObject(); property.addProperty("title", title); property.addProperty("type", type); @@ -128,8 +126,9 @@ public class OperationalPolicyRepresentationBuilder { modelVfModules.get(entry.getKey()).getAsJsonObject().get("vfModuleModelName").getAsString(), "True", null)); properties.add("modelInvariantId", - createSchemaProperty("Model Invariant Id (ModelInvariantUUID)", "string", modelVfModules - .get(entry.getKey()).getAsJsonObject().get("vfModuleModelInvariantUUID").getAsString(), + createSchemaProperty("Model Invariant Id (ModelInvariantUUID)", "string", + modelVfModules.get(entry.getKey()).getAsJsonObject().get("vfModuleModelInvariantUUID") + .getAsString(), "True", null)); properties.add("modelVersionId", createSchemaProperty("Model Version Id (ModelUUID)", "string", @@ -144,8 +143,9 @@ public class OperationalPolicyRepresentationBuilder { "True", null)); properties .add("modelCustomizationId", - createSchemaProperty("Customization ID", "string", modelVfModules.get(entry.getKey()) - .getAsJsonObject().get("vfModuleModelCustomizationUUID").getAsString(), "True", + createSchemaProperty("Customization ID", "string", + modelVfModules.get(entry.getKey()).getAsJsonObject() + .get("vfModuleModelCustomizationUUID").getAsString(), "True", null)); vfModuleOneOfSchema.add("properties", properties); @@ -180,7 +180,7 @@ public class OperationalPolicyRepresentationBuilder { JsonObject obj = new JsonObject(); obj.addProperty("title", workflowsEntry.getKey()); obj.add("properties", createPayloadProperty(workflowsEntry.getValue().getAsJsonObject(), - controllerProperties)); + controllerProperties)); schemaArray.add(obj); } @@ -207,7 +207,8 @@ public class OperationalPolicyRepresentationBuilder { StringBuilder builder = new StringBuilder("'").append("artifact_name : ").append(artifactName).append("\n") .append("artifact_version : ").append(artifactVersion).append("\n") .append("mode : async").append("\n") - .append("data : ").append("'").append("\\").append("'").append(data).append("\\").append("'").append("'"); + .append("data : ").append("'").append("\\").append("'").append(data).append("\\").append("'") + .append("'"); return builder.toString(); } } diff --git a/src/main/resources/META-INF/resources/swagger.html b/src/main/resources/META-INF/resources/swagger.html index 29082abf1..0451f1e0d 100644 --- a/src/main/resources/META-INF/resources/swagger.html +++ b/src/main/resources/META-INF/resources/swagger.html @@ -444,236 +444,280 @@ 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="#_route61">2.1. GET /v1/healthcheck</a> +<li><a href="#_route36">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="#_route62">2.2. GET /v1/user/getUser</a> +<li><a href="#_route37">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="#_route49">2.3. GET /v2/dictionary</a> +<li><a href="#_route35">2.3. GET /v2/clampInformation</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="#_route51">2.4. PUT /v2/dictionary</a> +<li><a href="#_route21">2.4. GET /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> -<li><a href="#_consumes">2.4.3. Consumes</a></li> -<li><a href="#_produces_4">2.4.4. Produces</a></li> +<li><a href="#_responses_4">2.4.1. Responses</a></li> +<li><a href="#_produces_4">2.4.2. Produces</a></li> </ul> </li> -<li><a href="#_v2_dictionary_secondary_names_get">2.5. GET /v2/dictionary/secondary/names</a> +<li><a href="#_route23">2.5. PUT /v2/dictionary</a> <ul class="sectlevel3"> -<li><a href="#_responses_5">2.5.1. Responses</a></li> -<li><a href="#_produces_5">2.5.2. Produces</a></li> +<li><a href="#_parameters">2.5.1. Parameters</a></li> +<li><a href="#_responses_5">2.5.2. Responses</a></li> +<li><a href="#_consumes">2.5.3. Consumes</a></li> +<li><a href="#_produces_5">2.5.4. Produces</a></li> </ul> </li> -<li><a href="#_v2_dictionary_dictionaryname_get">2.6. GET /v2/dictionary/{dictionaryName}</a> +<li><a href="#_v2_dictionary_secondary_names_get">2.6. GET /v2/dictionary/secondary/names</a> <ul class="sectlevel3"> -<li><a href="#_parameters_2">2.6.1. Parameters</a></li> -<li><a href="#_responses_6">2.6.2. Responses</a></li> -<li><a href="#_produces_6">2.6.3. Produces</a></li> +<li><a href="#_responses_6">2.6.1. Responses</a></li> +<li><a href="#_produces_6">2.6.2. Produces</a></li> </ul> </li> -<li><a href="#_v2_dictionary_name_put">2.7. PUT /v2/dictionary/{name}</a> +<li><a href="#_v2_dictionary_dictionaryname_get">2.7. GET /v2/dictionary/{dictionaryName}</a> <ul class="sectlevel3"> -<li><a href="#_parameters_3">2.7.1. Parameters</a></li> +<li><a href="#_parameters_2">2.7.1. Parameters</a></li> <li><a href="#_responses_7">2.7.2. Responses</a></li> -<li><a href="#_consumes_2">2.7.3. Consumes</a></li> -<li><a href="#_produces_7">2.7.4. Produces</a></li> +<li><a href="#_produces_7">2.7.3. Produces</a></li> </ul> </li> -<li><a href="#_route53">2.8. DELETE /v2/dictionary/{name}</a> +<li><a href="#_v2_dictionary_name_put">2.8. PUT /v2/dictionary/{name}</a> <ul class="sectlevel3"> -<li><a href="#_parameters_4">2.8.1. Parameters</a></li> +<li><a href="#_parameters_3">2.8.1. Parameters</a></li> <li><a href="#_responses_8">2.8.2. Responses</a></li> -<li><a href="#_produces_8">2.8.3. Produces</a></li> +<li><a href="#_consumes_2">2.8.3. Consumes</a></li> +<li><a href="#_produces_8">2.8.4. Produces</a></li> </ul> </li> -<li><a href="#_v2_dictionary_name_elements_shortname_delete">2.9. DELETE /v2/dictionary/{name}/elements/{shortName}</a> +<li><a href="#_route25">2.9. DELETE /v2/dictionary/{name}</a> <ul class="sectlevel3"> -<li><a href="#_parameters_5">2.9.1. Parameters</a></li> +<li><a href="#_parameters_4">2.9.1. Parameters</a></li> <li><a href="#_responses_9">2.9.2. Responses</a></li> <li><a href="#_produces_9">2.9.3. Produces</a></li> </ul> </li> -<li><a href="#_route45">2.10. PUT /v2/loop/delete/{loopName}</a> +<li><a href="#_v2_dictionary_name_elements_shortname_delete">2.10. DELETE /v2/dictionary/{name}/elements/{shortName}</a> <ul class="sectlevel3"> -<li><a href="#_parameters_6">2.10.1. Parameters</a></li> +<li><a href="#_parameters_5">2.10.1. Parameters</a></li> <li><a href="#_responses_10">2.10.2. Responses</a></li> +<li><a href="#_produces_10">2.10.3. Produces</a></li> </ul> </li> -<li><a href="#_route39">2.11. PUT /v2/loop/deploy/{loopName}</a> +<li><a href="#_route16">2.11. PUT /v2/loop/addOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}</a> <ul class="sectlevel3"> -<li><a href="#_parameters_7">2.11.1. Parameters</a></li> +<li><a href="#_parameters_6">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> +<li><a href="#_produces_11">2.11.3. Produces</a></li> </ul> </li> -<li><a href="#_route33">2.12. GET /v2/loop/getAllNames</a> +<li><a href="#_route18">2.12. POST /v2/loop/create/{loopName}?templateName={templateName}</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> +<li><a href="#_parameters_7">2.12.1. Parameters</a></li> +<li><a href="#_responses_12">2.12.2. Responses</a></li> +<li><a href="#_consumes_3">2.12.3. Consumes</a></li> +<li><a href="#_produces_12">2.12.4. Produces</a></li> </ul> </li> -<li><a href="#_route46">2.13. GET /v2/loop/getstatus/{loopName}</a> +<li><a href="#_route14">2.13. PUT /v2/loop/delete/{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="#_route40">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a> +<li><a href="#_route8">2.14. PUT /v2/loop/deploy/{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="#_route43">2.15. PUT /v2/loop/restart/{loopName}</a> +<li><a href="#_route2">2.15. GET /v2/loop/getAllNames</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> +<li><a href="#_responses_15">2.15.1. Responses</a></li> +<li><a href="#_produces_14">2.15.2. Produces</a></li> </ul> </li> -<li><a href="#_route42">2.16. PUT /v2/loop/stop/{loopName}</a> +<li><a href="#_route15">2.16. GET /v2/loop/getstatus/{loopName}</a> <ul class="sectlevel3"> -<li><a href="#_parameters_11">2.16.1. Parameters</a></li> +<li><a href="#_parameters_10">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="#_route44">2.17. PUT /v2/loop/submit/{loopName}</a> +<li><a href="#_route9">2.17. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a> <ul class="sectlevel3"> -<li><a href="#_parameters_12">2.17.1. Parameters</a></li> +<li><a href="#_parameters_11">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="#_route35">2.18. GET /v2/loop/svgRepresentation/{loopName}</a> +<li><a href="#_route17">2.18. PUT /v2/loop/removeOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}</a> <ul class="sectlevel3"> -<li><a href="#_parameters_13">2.18.1. Parameters</a></li> +<li><a href="#_parameters_12">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="#_route41">2.19. PUT /v2/loop/undeploy/{loopName}</a> +<li><a href="#_route12">2.19. PUT /v2/loop/restart/{loopName}</a> <ul class="sectlevel3"> -<li><a href="#_parameters_14">2.19.1. Parameters</a></li> +<li><a href="#_parameters_13">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="#_route36">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a> +<li><a href="#_route11">2.20. PUT /v2/loop/stop/{loopName}</a> <ul class="sectlevel3"> -<li><a href="#_parameters_15">2.20.1. Parameters</a></li> +<li><a href="#_parameters_14">2.20.1. Parameters</a></li> <li><a href="#_responses_20">2.20.2. Responses</a></li> -<li><a href="#_consumes_3">2.20.3. Consumes</a></li> -<li><a href="#_produces_19">2.20.4. Produces</a></li> +<li><a href="#_produces_19">2.20.3. Produces</a></li> </ul> </li> -<li><a href="#_route38">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a> +<li><a href="#_route13">2.21. PUT /v2/loop/submit/{loopName}</a> <ul class="sectlevel3"> -<li><a href="#_parameters_16">2.21.1. Parameters</a></li> +<li><a href="#_parameters_15">2.21.1. Parameters</a></li> <li><a href="#_responses_21">2.21.2. Responses</a></li> -<li><a href="#_consumes_4">2.21.3. Consumes</a></li> -<li><a href="#_produces_20">2.21.4. Produces</a></li> +<li><a href="#_produces_20">2.21.3. Produces</a></li> </ul> </li> -<li><a href="#_route37">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a> +<li><a href="#_route4">2.22. GET /v2/loop/svgRepresentation/{loopName}</a> <ul class="sectlevel3"> -<li><a href="#_parameters_17">2.22.1. Parameters</a></li> +<li><a href="#_parameters_16">2.22.1. Parameters</a></li> <li><a href="#_responses_22">2.22.2. Responses</a></li> -<li><a href="#_consumes_5">2.22.3. Consumes</a></li> -<li><a href="#_produces_21">2.22.4. Produces</a></li> +<li><a href="#_produces_21">2.22.3. Produces</a></li> </ul> </li> -<li><a href="#_route34">2.23. GET /v2/loop/{loopName}</a> +<li><a href="#_route10">2.23. PUT /v2/loop/undeploy/{loopName}</a> <ul class="sectlevel3"> -<li><a href="#_parameters_18">2.23.1. Parameters</a></li> +<li><a href="#_parameters_17">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="#_route56">2.24. GET /v2/policyToscaModels</a> +<li><a href="#_route5">2.24. POST /v2/loop/updateGlobalProperties/{loopName}</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> +<li><a href="#_parameters_18">2.24.1. Parameters</a></li> +<li><a href="#_responses_24">2.24.2. Responses</a></li> +<li><a href="#_consumes_4">2.24.3. Consumes</a></li> +<li><a href="#_produces_23">2.24.4. Produces</a></li> </ul> </li> -<li><a href="#_v2_policytoscamodels_yaml_policymodeltype_get">2.25. GET /v2/policyToscaModels/yaml/{policyModelType}</a> +<li><a href="#_route7">2.25. POST /v2/loop/updateMicroservicePolicy/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_19">2.25.1. Parameters</a></li> <li><a href="#_responses_25">2.25.2. Responses</a></li> -<li><a href="#_produces_24">2.25.3. Produces</a></li> +<li><a href="#_consumes_5">2.25.3. Consumes</a></li> +<li><a href="#_produces_24">2.25.4. Produces</a></li> </ul> </li> -<li><a href="#_v2_policytoscamodels_policymodeltype_get">2.26. GET /v2/policyToscaModels/{policyModelType}</a> +<li><a href="#_route6">2.26. POST /v2/loop/updateOperationalPolicies/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_20">2.26.1. Parameters</a></li> <li><a href="#_responses_26">2.26.2. Responses</a></li> -<li><a href="#_produces_25">2.26.3. Produces</a></li> +<li><a href="#_consumes_6">2.26.3. Consumes</a></li> +<li><a href="#_produces_25">2.26.4. Produces</a></li> </ul> </li> -<li><a href="#_route57">2.27. PUT /v2/policyToscaModels/{policyModelType}</a> +<li><a href="#_route3">2.27. GET /v2/loop/{loopName}</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> -<li><a href="#_consumes_6">2.27.3. Consumes</a></li> -<li><a href="#_produces_26">2.27.4. Produces</a></li> +<li><a href="#_produces_26">2.27.3. Produces</a></li> </ul> </li> -<li><a href="#_route60">2.28. GET /v2/templates</a> +<li><a href="#_route29">2.28. POST /v2/policyToscaModels</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> +<li><a href="#_parameters_22">2.28.1. Parameters</a></li> +<li><a href="#_responses_28">2.28.2. Responses</a></li> +<li><a href="#_consumes_7">2.28.3. Consumes</a></li> +<li><a href="#_produces_27">2.28.4. Produces</a></li> </ul> </li> -<li><a href="#_v2_templates_names_get">2.29. GET /v2/templates/names</a> +<li><a href="#_route28">2.29. GET /v2/policyToscaModels</a> <ul class="sectlevel3"> <li><a href="#_responses_29">2.29.1. Responses</a></li> <li><a href="#_produces_28">2.29.2. Produces</a></li> </ul> </li> -<li><a href="#_v2_templates_templatename_get">2.30. GET /v2/templates/{templateName}</a> +<li><a href="#_v2_policytoscamodels_yaml_policymodeltype_policymodelversion_get">2.30. GET /v2/policyToscaModels/yaml/{policyModelType}/{policyModelVersion}</a> <ul class="sectlevel3"> -<li><a href="#_parameters_22">2.30.1. Parameters</a></li> +<li><a href="#_parameters_23">2.30.1. Parameters</a></li> <li><a href="#_responses_30">2.30.2. Responses</a></li> <li><a href="#_produces_29">2.30.3. Produces</a></li> </ul> </li> +<li><a href="#_v2_policytoscamodels_policymodeltype_policymodelversion_get">2.31. GET /v2/policyToscaModels/{policyModelType}/{policyModelVersion}</a> +<ul class="sectlevel3"> +<li><a href="#_parameters_24">2.31.1. Parameters</a></li> +<li><a href="#_responses_31">2.31.2. Responses</a></li> +<li><a href="#_produces_30">2.31.3. Produces</a></li> +</ul> +</li> +<li><a href="#_route30">2.32. PUT /v2/policyToscaModels/{policyModelType}/{policyModelVersion}</a> +<ul class="sectlevel3"> +<li><a href="#_parameters_25">2.32.1. Parameters</a></li> +<li><a href="#_responses_32">2.32.2. Responses</a></li> +<li><a href="#_consumes_8">2.32.3. Consumes</a></li> +<li><a href="#_produces_31">2.32.4. Produces</a></li> +</ul> +</li> +<li><a href="#_route34">2.33. GET /v2/templates</a> +<ul class="sectlevel3"> +<li><a href="#_responses_33">2.33.1. Responses</a></li> +<li><a href="#_produces_32">2.33.2. Produces</a></li> +</ul> +</li> +<li><a href="#_v2_templates_names_get">2.34. GET /v2/templates/names</a> +<ul class="sectlevel3"> +<li><a href="#_responses_34">2.34.1. Responses</a></li> +<li><a href="#_produces_33">2.34.2. Produces</a></li> +</ul> +</li> +<li><a href="#_v2_templates_templatename_get">2.35. GET /v2/templates/{templateName}</a> +<ul class="sectlevel3"> +<li><a href="#_parameters_26">2.35.1. Parameters</a></li> +<li><a href="#_responses_35">2.35.2. Responses</a></li> +<li><a href="#_produces_34">2.35.3. Produces</a></li> +</ul> +</li> +<li><a href="#_v2_templates_templatename_svgrepresentation_get">2.36. GET /v2/templates/{templateName}/svgRepresentation</a> +<ul class="sectlevel3"> +<li><a href="#_parameters_27">2.36.1. Parameters</a></li> +<li><a href="#_responses_36">2.36.2. Responses</a></li> +<li><a href="#_produces_35">2.36.3. Produces</a></li> +</ul> +</li> </ul> </li> <li><a href="#_definitions">3. Definitions</a> <ul class="sectlevel2"> -<li><a href="#_cldshealthcheck">3.1. CldsHealthCheck</a></li> -<li><a href="#_dictionary">3.2. Dictionary</a></li> -<li><a href="#_dictionaryelement">3.3. DictionaryElement</a></li> -<li><a href="#_externalcomponent">3.4. ExternalComponent</a></li> -<li><a href="#_externalcomponentstate">3.5. ExternalComponentState</a></li> -<li><a href="#_jsonarray">3.6. JsonArray</a></li> -<li><a href="#_jsonnull">3.7. JsonNull</a></li> -<li><a href="#_jsonobject">3.8. JsonObject</a></li> -<li><a href="#_jsonprimitive">3.9. JsonPrimitive</a></li> -<li><a href="#_loop">3.10. Loop</a></li> -<li><a href="#_loopelementmodel">3.11. LoopElementModel</a></li> -<li><a href="#_looplog">3.12. LoopLog</a></li> -<li><a href="#_looptemplate">3.13. LoopTemplate</a></li> -<li><a href="#_looptemplateloopelementmodel">3.14. LoopTemplateLoopElementModel</a></li> -<li><a href="#_microservicepolicy">3.15. MicroServicePolicy</a></li> -<li><a href="#_number">3.16. Number</a></li> -<li><a href="#_operationalpolicy">3.17. OperationalPolicy</a></li> -<li><a href="#_policymodel">3.18. PolicyModel</a></li> -<li><a href="#_service">3.19. Service</a></li> +<li><a href="#_clampinformation">3.1. ClampInformation</a></li> +<li><a href="#_cldshealthcheck">3.2. CldsHealthCheck</a></li> +<li><a href="#_dictionary">3.3. Dictionary</a></li> +<li><a href="#_dictionaryelement">3.4. DictionaryElement</a></li> +<li><a href="#_externalcomponent">3.5. ExternalComponent</a></li> +<li><a href="#_externalcomponentstate">3.6. ExternalComponentState</a></li> +<li><a href="#_jsonarray">3.7. JsonArray</a></li> +<li><a href="#_jsonnull">3.8. JsonNull</a></li> +<li><a href="#_jsonobject">3.9. JsonObject</a></li> +<li><a href="#_jsonprimitive">3.10. JsonPrimitive</a></li> +<li><a href="#_loop">3.11. Loop</a></li> +<li><a href="#_loopelementmodel">3.12. LoopElementModel</a></li> +<li><a href="#_looplog">3.13. LoopLog</a></li> +<li><a href="#_looptemplate">3.14. LoopTemplate</a></li> +<li><a href="#_looptemplateloopelementmodel">3.15. LoopTemplateLoopElementModel</a></li> +<li><a href="#_microservicepolicy">3.16. MicroServicePolicy</a></li> +<li><a href="#_number">3.17. Number</a></li> +<li><a href="#_operationalpolicy">3.18. OperationalPolicy</a></li> +<li><a href="#_policymodel">3.19. PolicyModel</a></li> +<li><a href="#_service">3.20. Service</a></li> </ul> </li> </ul> @@ -692,7 +736,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:46347<br> +<p><em>Host</em> : localhost:41607<br> <em>BasePath</em> : /restservices/clds/<br> <em>Schemes</em> : HTTP</p> </div> @@ -703,7 +747,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="_route61"><a class="anchor" href="#_route61"></a><a class="link" href="#_route61">2.1. GET /v1/healthcheck</a></h3> +<h3 id="_route36"><a class="anchor" href="#_route36"></a><a class="link" href="#_route36">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 +784,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route62"><a class="anchor" href="#_route62"></a><a class="link" href="#_route62">2.2. GET /v1/user/getUser</a></h3> +<h3 id="_route37"><a class="anchor" href="#_route37"></a><a class="link" href="#_route37">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 +818,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route49"><a class="anchor" href="#_route49"></a><a class="link" href="#_route49">2.3. GET /v2/dictionary</a></h3> +<h3 id="_route35"><a class="anchor" href="#_route35"></a><a class="link" href="#_route35">2.3. GET /v2/clampInformation</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"> @@ -794,7 +838,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <tr> <td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>200</strong></p></td> <td class="tableblock halign-left valign-middle"><p class="tableblock">Output type</p></td> -<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_dictionary">Dictionary</a></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_clampinformation">ClampInformation</a></p></td> </tr> </tbody> </table> @@ -811,9 +855,46 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route51"><a class="anchor" href="#_route51"></a><a class="link" href="#_route51">2.4. PUT /v2/dictionary</a></h3> +<h3 id="_route21"><a class="anchor" href="#_route21"></a><a class="link" href="#_route21">2.4. GET /v2/dictionary</a></h3> +<div class="sect3"> +<h4 id="_responses_4"><a class="anchor" href="#_responses_4"></a><a class="link" href="#_responses_4">2.4.1. Responses</a></h4> +<table class="tableblock frame-all grid-all stretch"> +<colgroup> +<col style="width: 10%;"> +<col style="width: 70%;"> +<col style="width: 20%;"> +</colgroup> +<thead> +<tr> +<th class="tableblock halign-left valign-middle">HTTP Code</th> +<th class="tableblock halign-left valign-middle">Description</th> +<th class="tableblock halign-left valign-middle">Schema</th> +</tr> +</thead> +<tbody> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>200</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">Output type</p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_dictionary">Dictionary</a></p></td> +</tr> +</tbody> +</table> +</div> +<div class="sect3"> +<h4 id="_produces_4"><a class="anchor" href="#_produces_4"></a><a class="link" href="#_produces_4">2.4.2. Produces</a></h4> +<div class="ulist"> +<ul> +<li> +<p><code>application/json</code></p> +</li> +</ul> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_route23"><a class="anchor" href="#_route23"></a><a class="link" href="#_route23">2.5. 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> +<h4 id="_parameters"><a class="anchor" href="#_parameters"></a><a class="link" href="#_parameters">2.5.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -838,7 +919,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_responses_4"><a class="anchor" href="#_responses_4"></a><a class="link" href="#_responses_4">2.4.2. Responses</a></h4> +<h4 id="_responses_5"><a class="anchor" href="#_responses_5"></a><a class="link" href="#_responses_5">2.5.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -862,7 +943,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_consumes"><a class="anchor" href="#_consumes"></a><a class="link" href="#_consumes">2.4.3. Consumes</a></h4> +<h4 id="_consumes"><a class="anchor" href="#_consumes"></a><a class="link" href="#_consumes">2.5.3. Consumes</a></h4> <div class="ulist"> <ul> <li> @@ -872,7 +953,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect3"> -<h4 id="_produces_4"><a class="anchor" href="#_produces_4"></a><a class="link" href="#_produces_4">2.4.4. Produces</a></h4> +<h4 id="_produces_5"><a class="anchor" href="#_produces_5"></a><a class="link" href="#_produces_5">2.5.4. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -883,9 +964,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_v2_dictionary_secondary_names_get"><a class="anchor" href="#_v2_dictionary_secondary_names_get"></a><a class="link" href="#_v2_dictionary_secondary_names_get">2.5. GET /v2/dictionary/secondary/names</a></h3> +<h3 id="_v2_dictionary_secondary_names_get"><a class="anchor" href="#_v2_dictionary_secondary_names_get"></a><a class="link" href="#_v2_dictionary_secondary_names_get">2.6. GET /v2/dictionary/secondary/names</a></h3> <div class="sect3"> -<h4 id="_responses_5"><a class="anchor" href="#_responses_5"></a><a class="link" href="#_responses_5">2.5.1. Responses</a></h4> +<h4 id="_responses_6"><a class="anchor" href="#_responses_6"></a><a class="link" href="#_responses_6">2.6.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -909,7 +990,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_5"><a class="anchor" href="#_produces_5"></a><a class="link" href="#_produces_5">2.5.2. Produces</a></h4> +<h4 id="_produces_6"><a class="anchor" href="#_produces_6"></a><a class="link" href="#_produces_6">2.6.2. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -920,9 +1001,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_v2_dictionary_dictionaryname_get"><a class="anchor" href="#_v2_dictionary_dictionaryname_get"></a><a class="link" href="#_v2_dictionary_dictionaryname_get">2.6. GET /v2/dictionary/{dictionaryName}</a></h3> +<h3 id="_v2_dictionary_dictionaryname_get"><a class="anchor" href="#_v2_dictionary_dictionaryname_get"></a><a class="link" href="#_v2_dictionary_dictionaryname_get">2.7. GET /v2/dictionary/{dictionaryName}</a></h3> <div class="sect3"> -<h4 id="_parameters_2"><a class="anchor" href="#_parameters_2"></a><a class="link" href="#_parameters_2">2.6.1. Parameters</a></h4> +<h4 id="_parameters_2"><a class="anchor" href="#_parameters_2"></a><a class="link" href="#_parameters_2">2.7.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -947,7 +1028,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_responses_6"><a class="anchor" href="#_responses_6"></a><a class="link" href="#_responses_6">2.6.2. Responses</a></h4> +<h4 id="_responses_7"><a class="anchor" href="#_responses_7"></a><a class="link" href="#_responses_7">2.7.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -971,7 +1052,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_6"><a class="anchor" href="#_produces_6"></a><a class="link" href="#_produces_6">2.6.3. Produces</a></h4> +<h4 id="_produces_7"><a class="anchor" href="#_produces_7"></a><a class="link" href="#_produces_7">2.7.3. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -982,9 +1063,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_v2_dictionary_name_put"><a class="anchor" href="#_v2_dictionary_name_put"></a><a class="link" href="#_v2_dictionary_name_put">2.7. PUT /v2/dictionary/{name}</a></h3> +<h3 id="_v2_dictionary_name_put"><a class="anchor" href="#_v2_dictionary_name_put"></a><a class="link" href="#_v2_dictionary_name_put">2.8. PUT /v2/dictionary/{name}</a></h3> <div class="sect3"> -<h4 id="_parameters_3"><a class="anchor" href="#_parameters_3"></a><a class="link" href="#_parameters_3">2.7.1. Parameters</a></h4> +<h4 id="_parameters_3"><a class="anchor" href="#_parameters_3"></a><a class="link" href="#_parameters_3">2.8.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -1015,7 +1096,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_responses_7"><a class="anchor" href="#_responses_7"></a><a class="link" href="#_responses_7">2.7.2. Responses</a></h4> +<h4 id="_responses_8"><a class="anchor" href="#_responses_8"></a><a class="link" href="#_responses_8">2.8.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -1039,7 +1120,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_consumes_2"><a class="anchor" href="#_consumes_2"></a><a class="link" href="#_consumes_2">2.7.3. Consumes</a></h4> +<h4 id="_consumes_2"><a class="anchor" href="#_consumes_2"></a><a class="link" href="#_consumes_2">2.8.3. Consumes</a></h4> <div class="ulist"> <ul> <li> @@ -1049,7 +1130,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect3"> -<h4 id="_produces_7"><a class="anchor" href="#_produces_7"></a><a class="link" href="#_produces_7">2.7.4. Produces</a></h4> +<h4 id="_produces_8"><a class="anchor" href="#_produces_8"></a><a class="link" href="#_produces_8">2.8.4. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -1060,9 +1141,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route53"><a class="anchor" href="#_route53"></a><a class="link" href="#_route53">2.8. DELETE /v2/dictionary/{name}</a></h3> +<h3 id="_route25"><a class="anchor" href="#_route25"></a><a class="link" href="#_route25">2.9. 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> +<h4 id="_parameters_4"><a class="anchor" href="#_parameters_4"></a><a class="link" href="#_parameters_4">2.9.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -1087,7 +1168,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_responses_8"><a class="anchor" href="#_responses_8"></a><a class="link" href="#_responses_8">2.8.2. Responses</a></h4> +<h4 id="_responses_9"><a class="anchor" href="#_responses_9"></a><a class="link" href="#_responses_9">2.9.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 33.3333%;"> @@ -1108,7 +1189,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_8"><a class="anchor" href="#_produces_8"></a><a class="link" href="#_produces_8">2.8.3. Produces</a></h4> +<h4 id="_produces_9"><a class="anchor" href="#_produces_9"></a><a class="link" href="#_produces_9">2.9.3. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -1119,9 +1200,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_v2_dictionary_name_elements_shortname_delete"><a class="anchor" href="#_v2_dictionary_name_elements_shortname_delete"></a><a class="link" href="#_v2_dictionary_name_elements_shortname_delete">2.9. DELETE /v2/dictionary/{name}/elements/{shortName}</a></h3> +<h3 id="_v2_dictionary_name_elements_shortname_delete"><a class="anchor" href="#_v2_dictionary_name_elements_shortname_delete"></a><a class="link" href="#_v2_dictionary_name_elements_shortname_delete">2.10. DELETE /v2/dictionary/{name}/elements/{shortName}</a></h3> <div class="sect3"> -<h4 id="_parameters_5"><a class="anchor" href="#_parameters_5"></a><a class="link" href="#_parameters_5">2.9.1. Parameters</a></h4> +<h4 id="_parameters_5"><a class="anchor" href="#_parameters_5"></a><a class="link" href="#_parameters_5">2.10.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -1152,7 +1233,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_responses_9"><a class="anchor" href="#_responses_9"></a><a class="link" href="#_responses_9">2.9.2. Responses</a></h4> +<h4 id="_responses_10"><a class="anchor" href="#_responses_10"></a><a class="link" href="#_responses_10">2.10.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 33.3333%;"> @@ -1173,7 +1254,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_9"><a class="anchor" href="#_produces_9"></a><a class="link" href="#_produces_9">2.9.3. Produces</a></h4> +<h4 id="_produces_10"><a class="anchor" href="#_produces_10"></a><a class="link" href="#_produces_10">2.10.3. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -1184,9 +1265,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route45"><a class="anchor" href="#_route45"></a><a class="link" href="#_route45">2.10. PUT /v2/loop/delete/{loopName}</a></h3> +<h3 id="_route16"><a class="anchor" href="#_route16"></a><a class="link" href="#_route16">2.11. PUT /v2/loop/addOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}</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> +<h4 id="_parameters_6"><a class="anchor" href="#_parameters_6"></a><a class="link" href="#_parameters_6">2.11.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -1207,11 +1288,157 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <em>required</em></p></td> <td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> </tr> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>Path</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>policyType</strong><br> +<em>required</em></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> +</tr> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>Path</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>policyVersion</strong><br> +<em>required</em></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> +</tr> </tbody> </table> </div> <div class="sect3"> -<h4 id="_responses_10"><a class="anchor" href="#_responses_10"></a><a class="link" href="#_responses_10">2.10.2. Responses</a></h4> +<h4 id="_responses_11"><a class="anchor" href="#_responses_11"></a><a class="link" href="#_responses_11">2.11.2. Responses</a></h4> +<table class="tableblock frame-all grid-all stretch"> +<colgroup> +<col style="width: 10%;"> +<col style="width: 70%;"> +<col style="width: 20%;"> +</colgroup> +<thead> +<tr> +<th class="tableblock halign-left valign-middle">HTTP Code</th> +<th class="tableblock halign-left valign-middle">Description</th> +<th class="tableblock halign-left valign-middle">Schema</th> +</tr> +</thead> +<tbody> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>200</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">Output type</p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_loop">Loop</a></p></td> +</tr> +</tbody> +</table> +</div> +<div class="sect3"> +<h4 id="_produces_11"><a class="anchor" href="#_produces_11"></a><a class="link" href="#_produces_11">2.11.3. Produces</a></h4> +<div class="ulist"> +<ul> +<li> +<p><code>application/json</code></p> +</li> +</ul> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_route18"><a class="anchor" href="#_route18"></a><a class="link" href="#_route18">2.12. POST /v2/loop/create/{loopName}?templateName={templateName}</a></h3> +<div class="sect3"> +<h4 id="_parameters_7"><a class="anchor" href="#_parameters_7"></a><a class="link" href="#_parameters_7">2.12.1. Parameters</a></h4> +<table class="tableblock frame-all grid-all stretch"> +<colgroup> +<col style="width: 22.2222%;"> +<col style="width: 33.3333%;"> +<col style="width: 44.4445%;"> +</colgroup> +<thead> +<tr> +<th class="tableblock halign-left valign-middle">Type</th> +<th class="tableblock halign-left valign-middle">Name</th> +<th class="tableblock halign-left valign-middle">Schema</th> +</tr> +</thead> +<tbody> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>Path</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>loopName}?templateName={templateName</strong><br> +<em>required</em></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> +</tr> +</tbody> +</table> +</div> +<div class="sect3"> +<h4 id="_responses_12"><a class="anchor" href="#_responses_12"></a><a class="link" href="#_responses_12">2.12.2. Responses</a></h4> +<table class="tableblock frame-all grid-all stretch"> +<colgroup> +<col style="width: 10%;"> +<col style="width: 70%;"> +<col style="width: 20%;"> +</colgroup> +<thead> +<tr> +<th class="tableblock halign-left valign-middle">HTTP Code</th> +<th class="tableblock halign-left valign-middle">Description</th> +<th class="tableblock halign-left valign-middle">Schema</th> +</tr> +</thead> +<tbody> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>200</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">Output type</p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_loop">Loop</a></p></td> +</tr> +</tbody> +</table> +</div> +<div class="sect3"> +<h4 id="_consumes_3"><a class="anchor" href="#_consumes_3"></a><a class="link" href="#_consumes_3">2.12.3. Consumes</a></h4> +<div class="ulist"> +<ul> +<li> +<p><code>application/json</code></p> +</li> +</ul> +</div> +</div> +<div class="sect3"> +<h4 id="_produces_12"><a class="anchor" href="#_produces_12"></a><a class="link" href="#_produces_12">2.12.4. Produces</a></h4> +<div class="ulist"> +<ul> +<li> +<p><code>application/json</code></p> +</li> +</ul> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_route14"><a class="anchor" href="#_route14"></a><a class="link" href="#_route14">2.13. PUT /v2/loop/delete/{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"> +<colgroup> +<col style="width: 22.2222%;"> +<col style="width: 33.3333%;"> +<col style="width: 44.4445%;"> +</colgroup> +<thead> +<tr> +<th class="tableblock halign-left valign-middle">Type</th> +<th class="tableblock halign-left valign-middle">Name</th> +<th class="tableblock halign-left valign-middle">Schema</th> +</tr> +</thead> +<tbody> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>Path</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>loopName</strong><br> +<em>required</em></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> +</tr> +</tbody> +</table> +</div> +<div class="sect3"> +<h4 id="_responses_13"><a class="anchor" href="#_responses_13"></a><a class="link" href="#_responses_13">2.13.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 33.3333%;"> @@ -1233,9 +1460,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route39"><a class="anchor" href="#_route39"></a><a class="link" href="#_route39">2.11. PUT /v2/loop/deploy/{loopName}</a></h3> +<h3 id="_route8"><a class="anchor" href="#_route8"></a><a class="link" href="#_route8">2.14. 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> +<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"> <colgroup> <col style="width: 22.2222%;"> @@ -1260,7 +1487,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_responses_11"><a class="anchor" href="#_responses_11"></a><a class="link" href="#_responses_11">2.11.2. Responses</a></h4> +<h4 id="_responses_14"><a class="anchor" href="#_responses_14"></a><a class="link" href="#_responses_14">2.14.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -1284,7 +1511,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_10"><a class="anchor" href="#_produces_10"></a><a class="link" href="#_produces_10">2.11.3. Produces</a></h4> +<h4 id="_produces_13"><a class="anchor" href="#_produces_13"></a><a class="link" href="#_produces_13">2.14.3. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -1295,9 +1522,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route33"><a class="anchor" href="#_route33"></a><a class="link" href="#_route33">2.12. GET /v2/loop/getAllNames</a></h3> +<h3 id="_route2"><a class="anchor" href="#_route2"></a><a class="link" href="#_route2">2.15. 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> +<h4 id="_responses_15"><a class="anchor" href="#_responses_15"></a><a class="link" href="#_responses_15">2.15.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -1321,7 +1548,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_11"><a class="anchor" href="#_produces_11"></a><a class="link" href="#_produces_11">2.12.2. Produces</a></h4> +<h4 id="_produces_14"><a class="anchor" href="#_produces_14"></a><a class="link" href="#_produces_14">2.15.2. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -1332,9 +1559,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route46"><a class="anchor" href="#_route46"></a><a class="link" href="#_route46">2.13. GET /v2/loop/getstatus/{loopName}</a></h3> +<h3 id="_route15"><a class="anchor" href="#_route15"></a><a class="link" href="#_route15">2.16. 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> +<h4 id="_parameters_10"><a class="anchor" href="#_parameters_10"></a><a class="link" href="#_parameters_10">2.16.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -1359,7 +1586,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_responses_13"><a class="anchor" href="#_responses_13"></a><a class="link" href="#_responses_13">2.13.2. Responses</a></h4> +<h4 id="_responses_16"><a class="anchor" href="#_responses_16"></a><a class="link" href="#_responses_16">2.16.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -1383,7 +1610,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_12"><a class="anchor" href="#_produces_12"></a><a class="link" href="#_produces_12">2.13.3. Produces</a></h4> +<h4 id="_produces_15"><a class="anchor" href="#_produces_15"></a><a class="link" href="#_produces_15">2.16.3. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -1394,9 +1621,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route40"><a class="anchor" href="#_route40"></a><a class="link" href="#_route40">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a></h3> +<h3 id="_route9"><a class="anchor" href="#_route9"></a><a class="link" href="#_route9">2.17. 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> +<h4 id="_parameters_11"><a class="anchor" href="#_parameters_11"></a><a class="link" href="#_parameters_11">2.17.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -1421,7 +1648,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_responses_14"><a class="anchor" href="#_responses_14"></a><a class="link" href="#_responses_14">2.14.2. Responses</a></h4> +<h4 id="_responses_17"><a class="anchor" href="#_responses_17"></a><a class="link" href="#_responses_17">2.17.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -1445,7 +1672,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_13"><a class="anchor" href="#_produces_13"></a><a class="link" href="#_produces_13">2.14.3. Produces</a></h4> +<h4 id="_produces_16"><a class="anchor" href="#_produces_16"></a><a class="link" href="#_produces_16">2.17.3. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -1456,9 +1683,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route43"><a class="anchor" href="#_route43"></a><a class="link" href="#_route43">2.15. PUT /v2/loop/restart/{loopName}</a></h3> +<h3 id="_route17"><a class="anchor" href="#_route17"></a><a class="link" href="#_route17">2.18. PUT /v2/loop/removeOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}</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> +<h4 id="_parameters_12"><a class="anchor" href="#_parameters_12"></a><a class="link" href="#_parameters_12">2.18.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -1479,11 +1706,23 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <em>required</em></p></td> <td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> </tr> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>Path</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>policyType</strong><br> +<em>required</em></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> +</tr> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>Path</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>policyVersion</strong><br> +<em>required</em></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> +</tr> </tbody> </table> </div> <div class="sect3"> -<h4 id="_responses_15"><a class="anchor" href="#_responses_15"></a><a class="link" href="#_responses_15">2.15.2. Responses</a></h4> +<h4 id="_responses_18"><a class="anchor" href="#_responses_18"></a><a class="link" href="#_responses_18">2.18.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -1507,7 +1746,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_14"><a class="anchor" href="#_produces_14"></a><a class="link" href="#_produces_14">2.15.3. Produces</a></h4> +<h4 id="_produces_17"><a class="anchor" href="#_produces_17"></a><a class="link" href="#_produces_17">2.18.3. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -1518,9 +1757,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route42"><a class="anchor" href="#_route42"></a><a class="link" href="#_route42">2.16. PUT /v2/loop/stop/{loopName}</a></h3> +<h3 id="_route12"><a class="anchor" href="#_route12"></a><a class="link" href="#_route12">2.19. PUT /v2/loop/restart/{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> +<h4 id="_parameters_13"><a class="anchor" href="#_parameters_13"></a><a class="link" href="#_parameters_13">2.19.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -1545,7 +1784,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_responses_16"><a class="anchor" href="#_responses_16"></a><a class="link" href="#_responses_16">2.16.2. Responses</a></h4> +<h4 id="_responses_19"><a class="anchor" href="#_responses_19"></a><a class="link" href="#_responses_19">2.19.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -1569,7 +1808,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_15"><a class="anchor" href="#_produces_15"></a><a class="link" href="#_produces_15">2.16.3. Produces</a></h4> +<h4 id="_produces_18"><a class="anchor" href="#_produces_18"></a><a class="link" href="#_produces_18">2.19.3. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -1580,9 +1819,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route44"><a class="anchor" href="#_route44"></a><a class="link" href="#_route44">2.17. PUT /v2/loop/submit/{loopName}</a></h3> +<h3 id="_route11"><a class="anchor" href="#_route11"></a><a class="link" href="#_route11">2.20. PUT /v2/loop/stop/{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> +<h4 id="_parameters_14"><a class="anchor" href="#_parameters_14"></a><a class="link" href="#_parameters_14">2.20.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -1607,7 +1846,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_responses_17"><a class="anchor" href="#_responses_17"></a><a class="link" href="#_responses_17">2.17.2. Responses</a></h4> +<h4 id="_responses_20"><a class="anchor" href="#_responses_20"></a><a class="link" href="#_responses_20">2.20.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -1631,7 +1870,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_16"><a class="anchor" href="#_produces_16"></a><a class="link" href="#_produces_16">2.17.3. Produces</a></h4> +<h4 id="_produces_19"><a class="anchor" href="#_produces_19"></a><a class="link" href="#_produces_19">2.20.3. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -1642,9 +1881,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route35"><a class="anchor" href="#_route35"></a><a class="link" href="#_route35">2.18. GET /v2/loop/svgRepresentation/{loopName}</a></h3> +<h3 id="_route13"><a class="anchor" href="#_route13"></a><a class="link" href="#_route13">2.21. PUT /v2/loop/submit/{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> +<h4 id="_parameters_15"><a class="anchor" href="#_parameters_15"></a><a class="link" href="#_parameters_15">2.21.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -1669,7 +1908,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_responses_18"><a class="anchor" href="#_responses_18"></a><a class="link" href="#_responses_18">2.18.2. Responses</a></h4> +<h4 id="_responses_21"><a class="anchor" href="#_responses_21"></a><a class="link" href="#_responses_21">2.21.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -1687,13 +1926,75 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <tr> <td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>200</strong></p></td> <td class="tableblock halign-left valign-middle"><p class="tableblock">Output type</p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_loop">Loop</a></p></td> +</tr> +</tbody> +</table> +</div> +<div class="sect3"> +<h4 id="_produces_20"><a class="anchor" href="#_produces_20"></a><a class="link" href="#_produces_20">2.21.3. Produces</a></h4> +<div class="ulist"> +<ul> +<li> +<p><code>application/json</code></p> +</li> +</ul> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_route4"><a class="anchor" href="#_route4"></a><a class="link" href="#_route4">2.22. GET /v2/loop/svgRepresentation/{loopName}</a></h3> +<div class="sect3"> +<h4 id="_parameters_16"><a class="anchor" href="#_parameters_16"></a><a class="link" href="#_parameters_16">2.22.1. Parameters</a></h4> +<table class="tableblock frame-all grid-all stretch"> +<colgroup> +<col style="width: 22.2222%;"> +<col style="width: 33.3333%;"> +<col style="width: 44.4445%;"> +</colgroup> +<thead> +<tr> +<th class="tableblock halign-left valign-middle">Type</th> +<th class="tableblock halign-left valign-middle">Name</th> +<th class="tableblock halign-left valign-middle">Schema</th> +</tr> +</thead> +<tbody> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>Path</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>loopName</strong><br> +<em>required</em></p></td> <td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> </tr> </tbody> </table> </div> <div class="sect3"> -<h4 id="_produces_17"><a class="anchor" href="#_produces_17"></a><a class="link" href="#_produces_17">2.18.3. Produces</a></h4> +<h4 id="_responses_22"><a class="anchor" href="#_responses_22"></a><a class="link" href="#_responses_22">2.22.2. Responses</a></h4> +<table class="tableblock frame-all grid-all stretch"> +<colgroup> +<col style="width: 10%;"> +<col style="width: 70%;"> +<col style="width: 20%;"> +</colgroup> +<thead> +<tr> +<th class="tableblock halign-left valign-middle">HTTP Code</th> +<th class="tableblock halign-left valign-middle">Description</th> +<th class="tableblock halign-left valign-middle">Schema</th> +</tr> +</thead> +<tbody> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>200</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">Output type</p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> +</tr> +</tbody> +</table> +</div> +<div class="sect3"> +<h4 id="_produces_21"><a class="anchor" href="#_produces_21"></a><a class="link" href="#_produces_21">2.22.3. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -1704,9 +2005,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route41"><a class="anchor" href="#_route41"></a><a class="link" href="#_route41">2.19. PUT /v2/loop/undeploy/{loopName}</a></h3> +<h3 id="_route10"><a class="anchor" href="#_route10"></a><a class="link" href="#_route10">2.23. 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> +<h4 id="_parameters_17"><a class="anchor" href="#_parameters_17"></a><a class="link" href="#_parameters_17">2.23.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -1731,7 +2032,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_responses_19"><a class="anchor" href="#_responses_19"></a><a class="link" href="#_responses_19">2.19.2. Responses</a></h4> +<h4 id="_responses_23"><a class="anchor" href="#_responses_23"></a><a class="link" href="#_responses_23">2.23.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -1755,7 +2056,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_18"><a class="anchor" href="#_produces_18"></a><a class="link" href="#_produces_18">2.19.3. Produces</a></h4> +<h4 id="_produces_22"><a class="anchor" href="#_produces_22"></a><a class="link" href="#_produces_22">2.23.3. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -1766,9 +2067,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route36"><a class="anchor" href="#_route36"></a><a class="link" href="#_route36">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a></h3> +<h3 id="_route5"><a class="anchor" href="#_route5"></a><a class="link" href="#_route5">2.24. 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> +<h4 id="_parameters_18"><a class="anchor" href="#_parameters_18"></a><a class="link" href="#_parameters_18">2.24.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -1799,7 +2100,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_responses_20"><a class="anchor" href="#_responses_20"></a><a class="link" href="#_responses_20">2.20.2. Responses</a></h4> +<h4 id="_responses_24"><a class="anchor" href="#_responses_24"></a><a class="link" href="#_responses_24">2.24.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -1823,7 +2124,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_consumes_3"><a class="anchor" href="#_consumes_3"></a><a class="link" href="#_consumes_3">2.20.3. Consumes</a></h4> +<h4 id="_consumes_4"><a class="anchor" href="#_consumes_4"></a><a class="link" href="#_consumes_4">2.24.3. Consumes</a></h4> <div class="ulist"> <ul> <li> @@ -1833,7 +2134,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect3"> -<h4 id="_produces_19"><a class="anchor" href="#_produces_19"></a><a class="link" href="#_produces_19">2.20.4. Produces</a></h4> +<h4 id="_produces_23"><a class="anchor" href="#_produces_23"></a><a class="link" href="#_produces_23">2.24.4. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -1844,9 +2145,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route38"><a class="anchor" href="#_route38"></a><a class="link" href="#_route38">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a></h3> +<h3 id="_route7"><a class="anchor" href="#_route7"></a><a class="link" href="#_route7">2.25. 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> +<h4 id="_parameters_19"><a class="anchor" href="#_parameters_19"></a><a class="link" href="#_parameters_19">2.25.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -1877,7 +2178,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_responses_21"><a class="anchor" href="#_responses_21"></a><a class="link" href="#_responses_21">2.21.2. Responses</a></h4> +<h4 id="_responses_25"><a class="anchor" href="#_responses_25"></a><a class="link" href="#_responses_25">2.25.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -1901,7 +2202,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_consumes_4"><a class="anchor" href="#_consumes_4"></a><a class="link" href="#_consumes_4">2.21.3. Consumes</a></h4> +<h4 id="_consumes_5"><a class="anchor" href="#_consumes_5"></a><a class="link" href="#_consumes_5">2.25.3. Consumes</a></h4> <div class="ulist"> <ul> <li> @@ -1911,7 +2212,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect3"> -<h4 id="_produces_20"><a class="anchor" href="#_produces_20"></a><a class="link" href="#_produces_20">2.21.4. Produces</a></h4> +<h4 id="_produces_24"><a class="anchor" href="#_produces_24"></a><a class="link" href="#_produces_24">2.25.4. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -1922,9 +2223,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route37"><a class="anchor" href="#_route37"></a><a class="link" href="#_route37">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a></h3> +<h3 id="_route6"><a class="anchor" href="#_route6"></a><a class="link" href="#_route6">2.26. 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> +<h4 id="_parameters_20"><a class="anchor" href="#_parameters_20"></a><a class="link" href="#_parameters_20">2.26.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -1955,7 +2256,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_responses_22"><a class="anchor" href="#_responses_22"></a><a class="link" href="#_responses_22">2.22.2. Responses</a></h4> +<h4 id="_responses_26"><a class="anchor" href="#_responses_26"></a><a class="link" href="#_responses_26">2.26.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -1979,7 +2280,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_consumes_5"><a class="anchor" href="#_consumes_5"></a><a class="link" href="#_consumes_5">2.22.3. Consumes</a></h4> +<h4 id="_consumes_6"><a class="anchor" href="#_consumes_6"></a><a class="link" href="#_consumes_6">2.26.3. Consumes</a></h4> <div class="ulist"> <ul> <li> @@ -1989,7 +2290,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect3"> -<h4 id="_produces_21"><a class="anchor" href="#_produces_21"></a><a class="link" href="#_produces_21">2.22.4. Produces</a></h4> +<h4 id="_produces_25"><a class="anchor" href="#_produces_25"></a><a class="link" href="#_produces_25">2.26.4. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -2000,9 +2301,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route34"><a class="anchor" href="#_route34"></a><a class="link" href="#_route34">2.23. GET /v2/loop/{loopName}</a></h3> +<h3 id="_route3"><a class="anchor" href="#_route3"></a><a class="link" href="#_route3">2.27. 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> +<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"> <colgroup> <col style="width: 22.2222%;"> @@ -2027,7 +2328,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_responses_23"><a class="anchor" href="#_responses_23"></a><a class="link" href="#_responses_23">2.23.2. Responses</a></h4> +<h4 id="_responses_27"><a class="anchor" href="#_responses_27"></a><a class="link" href="#_responses_27">2.27.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -2051,7 +2352,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_22"><a class="anchor" href="#_produces_22"></a><a class="link" href="#_produces_22">2.23.3. Produces</a></h4> +<h4 id="_produces_26"><a class="anchor" href="#_produces_26"></a><a class="link" href="#_produces_26">2.27.3. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -2062,9 +2363,34 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route56"><a class="anchor" href="#_route56"></a><a class="link" href="#_route56">2.24. GET /v2/policyToscaModels</a></h3> +<h3 id="_route29"><a class="anchor" href="#_route29"></a><a class="link" href="#_route29">2.28. POST /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> +<h4 id="_parameters_22"><a class="anchor" href="#_parameters_22"></a><a class="link" href="#_parameters_22">2.28.1. Parameters</a></h4> +<table class="tableblock frame-all grid-all stretch"> +<colgroup> +<col style="width: 22.2222%;"> +<col style="width: 33.3333%;"> +<col style="width: 44.4445%;"> +</colgroup> +<thead> +<tr> +<th class="tableblock halign-left valign-middle">Type</th> +<th class="tableblock halign-left valign-middle">Name</th> +<th class="tableblock halign-left valign-middle">Schema</th> +</tr> +</thead> +<tbody> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>Body</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>body</strong><br> +<em>required</em></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> +</tr> +</tbody> +</table> +</div> +<div class="sect3"> +<h4 id="_responses_28"><a class="anchor" href="#_responses_28"></a><a class="link" href="#_responses_28">2.28.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -2088,7 +2414,17 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_23"><a class="anchor" href="#_produces_23"></a><a class="link" href="#_produces_23">2.24.2. Produces</a></h4> +<h4 id="_consumes_7"><a class="anchor" href="#_consumes_7"></a><a class="link" href="#_consumes_7">2.28.3. Consumes</a></h4> +<div class="ulist"> +<ul> +<li> +<p><code>plain/text</code></p> +</li> +</ul> +</div> +</div> +<div class="sect3"> +<h4 id="_produces_27"><a class="anchor" href="#_produces_27"></a><a class="link" href="#_produces_27">2.28.4. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -2099,9 +2435,46 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_v2_policytoscamodels_yaml_policymodeltype_get"><a class="anchor" href="#_v2_policytoscamodels_yaml_policymodeltype_get"></a><a class="link" href="#_v2_policytoscamodels_yaml_policymodeltype_get">2.25. GET /v2/policyToscaModels/yaml/{policyModelType}</a></h3> +<h3 id="_route28"><a class="anchor" href="#_route28"></a><a class="link" href="#_route28">2.29. GET /v2/policyToscaModels</a></h3> <div class="sect3"> -<h4 id="_parameters_19"><a class="anchor" href="#_parameters_19"></a><a class="link" href="#_parameters_19">2.25.1. Parameters</a></h4> +<h4 id="_responses_29"><a class="anchor" href="#_responses_29"></a><a class="link" href="#_responses_29">2.29.1. Responses</a></h4> +<table class="tableblock frame-all grid-all stretch"> +<colgroup> +<col style="width: 10%;"> +<col style="width: 70%;"> +<col style="width: 20%;"> +</colgroup> +<thead> +<tr> +<th class="tableblock halign-left valign-middle">HTTP Code</th> +<th class="tableblock halign-left valign-middle">Description</th> +<th class="tableblock halign-left valign-middle">Schema</th> +</tr> +</thead> +<tbody> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>200</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">Output type</p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_policymodel">PolicyModel</a></p></td> +</tr> +</tbody> +</table> +</div> +<div class="sect3"> +<h4 id="_produces_28"><a class="anchor" href="#_produces_28"></a><a class="link" href="#_produces_28">2.29.2. Produces</a></h4> +<div class="ulist"> +<ul> +<li> +<p><code>application/json</code></p> +</li> +</ul> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_v2_policytoscamodels_yaml_policymodeltype_policymodelversion_get"><a class="anchor" href="#_v2_policytoscamodels_yaml_policymodeltype_policymodelversion_get"></a><a class="link" href="#_v2_policytoscamodels_yaml_policymodeltype_policymodelversion_get">2.30. GET /v2/policyToscaModels/yaml/{policyModelType}/{policyModelVersion}</a></h3> +<div class="sect3"> +<h4 id="_parameters_23"><a class="anchor" href="#_parameters_23"></a><a class="link" href="#_parameters_23">2.30.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -2122,11 +2495,17 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <em>required</em></p></td> <td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> </tr> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>Path</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>policyModelVersion</strong><br> +<em>required</em></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> +</tr> </tbody> </table> </div> <div class="sect3"> -<h4 id="_responses_25"><a class="anchor" href="#_responses_25"></a><a class="link" href="#_responses_25">2.25.2. Responses</a></h4> +<h4 id="_responses_30"><a class="anchor" href="#_responses_30"></a><a class="link" href="#_responses_30">2.30.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -2150,7 +2529,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_24"><a class="anchor" href="#_produces_24"></a><a class="link" href="#_produces_24">2.25.3. Produces</a></h4> +<h4 id="_produces_29"><a class="anchor" href="#_produces_29"></a><a class="link" href="#_produces_29">2.30.3. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -2161,9 +2540,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_v2_policytoscamodels_policymodeltype_get"><a class="anchor" href="#_v2_policytoscamodels_policymodeltype_get"></a><a class="link" href="#_v2_policytoscamodels_policymodeltype_get">2.26. GET /v2/policyToscaModels/{policyModelType}</a></h3> +<h3 id="_v2_policytoscamodels_policymodeltype_policymodelversion_get"><a class="anchor" href="#_v2_policytoscamodels_policymodeltype_policymodelversion_get"></a><a class="link" href="#_v2_policytoscamodels_policymodeltype_policymodelversion_get">2.31. GET /v2/policyToscaModels/{policyModelType}/{policyModelVersion}</a></h3> <div class="sect3"> -<h4 id="_parameters_20"><a class="anchor" href="#_parameters_20"></a><a class="link" href="#_parameters_20">2.26.1. Parameters</a></h4> +<h4 id="_parameters_24"><a class="anchor" href="#_parameters_24"></a><a class="link" href="#_parameters_24">2.31.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -2184,11 +2563,17 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <em>required</em></p></td> <td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> </tr> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>Path</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>policyModelVersion</strong><br> +<em>required</em></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> +</tr> </tbody> </table> </div> <div class="sect3"> -<h4 id="_responses_26"><a class="anchor" href="#_responses_26"></a><a class="link" href="#_responses_26">2.26.2. Responses</a></h4> +<h4 id="_responses_31"><a class="anchor" href="#_responses_31"></a><a class="link" href="#_responses_31">2.31.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -2212,7 +2597,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_25"><a class="anchor" href="#_produces_25"></a><a class="link" href="#_produces_25">2.26.3. Produces</a></h4> +<h4 id="_produces_30"><a class="anchor" href="#_produces_30"></a><a class="link" href="#_produces_30">2.31.3. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -2223,9 +2608,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route57"><a class="anchor" href="#_route57"></a><a class="link" href="#_route57">2.27. PUT /v2/policyToscaModels/{policyModelType}</a></h3> +<h3 id="_route30"><a class="anchor" href="#_route30"></a><a class="link" href="#_route30">2.32. PUT /v2/policyToscaModels/{policyModelType}/{policyModelVersion}</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> +<h4 id="_parameters_25"><a class="anchor" href="#_parameters_25"></a><a class="link" href="#_parameters_25">2.32.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -2247,6 +2632,12 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> </tr> <tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>Path</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>policyModelVersion</strong><br> +<em>required</em></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> +</tr> +<tr> <td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>Body</strong></p></td> <td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>body</strong><br> <em>required</em></p></td> @@ -2256,7 +2647,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_responses_27"><a class="anchor" href="#_responses_27"></a><a class="link" href="#_responses_27">2.27.2. Responses</a></h4> +<h4 id="_responses_32"><a class="anchor" href="#_responses_32"></a><a class="link" href="#_responses_32">2.32.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -2280,7 +2671,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_consumes_6"><a class="anchor" href="#_consumes_6"></a><a class="link" href="#_consumes_6">2.27.3. Consumes</a></h4> +<h4 id="_consumes_8"><a class="anchor" href="#_consumes_8"></a><a class="link" href="#_consumes_8">2.32.3. Consumes</a></h4> <div class="ulist"> <ul> <li> @@ -2290,7 +2681,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect3"> -<h4 id="_produces_26"><a class="anchor" href="#_produces_26"></a><a class="link" href="#_produces_26">2.27.4. Produces</a></h4> +<h4 id="_produces_31"><a class="anchor" href="#_produces_31"></a><a class="link" href="#_produces_31">2.32.4. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -2301,9 +2692,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route60"><a class="anchor" href="#_route60"></a><a class="link" href="#_route60">2.28. GET /v2/templates</a></h3> +<h3 id="_route34"><a class="anchor" href="#_route34"></a><a class="link" href="#_route34">2.33. 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> +<h4 id="_responses_33"><a class="anchor" href="#_responses_33"></a><a class="link" href="#_responses_33">2.33.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -2327,7 +2718,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_27"><a class="anchor" href="#_produces_27"></a><a class="link" href="#_produces_27">2.28.2. Produces</a></h4> +<h4 id="_produces_32"><a class="anchor" href="#_produces_32"></a><a class="link" href="#_produces_32">2.33.2. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -2338,9 +2729,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_v2_templates_names_get"><a class="anchor" href="#_v2_templates_names_get"></a><a class="link" href="#_v2_templates_names_get">2.29. GET /v2/templates/names</a></h3> +<h3 id="_v2_templates_names_get"><a class="anchor" href="#_v2_templates_names_get"></a><a class="link" href="#_v2_templates_names_get">2.34. GET /v2/templates/names</a></h3> <div class="sect3"> -<h4 id="_responses_29"><a class="anchor" href="#_responses_29"></a><a class="link" href="#_responses_29">2.29.1. Responses</a></h4> +<h4 id="_responses_34"><a class="anchor" href="#_responses_34"></a><a class="link" href="#_responses_34">2.34.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -2364,7 +2755,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_28"><a class="anchor" href="#_produces_28"></a><a class="link" href="#_produces_28">2.29.2. Produces</a></h4> +<h4 id="_produces_33"><a class="anchor" href="#_produces_33"></a><a class="link" href="#_produces_33">2.34.2. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -2375,9 +2766,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_v2_templates_templatename_get"><a class="anchor" href="#_v2_templates_templatename_get"></a><a class="link" href="#_v2_templates_templatename_get">2.30. GET /v2/templates/{templateName}</a></h3> +<h3 id="_v2_templates_templatename_get"><a class="anchor" href="#_v2_templates_templatename_get"></a><a class="link" href="#_v2_templates_templatename_get">2.35. GET /v2/templates/{templateName}</a></h3> <div class="sect3"> -<h4 id="_parameters_22"><a class="anchor" href="#_parameters_22"></a><a class="link" href="#_parameters_22">2.30.1. Parameters</a></h4> +<h4 id="_parameters_26"><a class="anchor" href="#_parameters_26"></a><a class="link" href="#_parameters_26">2.35.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 22.2222%;"> @@ -2402,7 +2793,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_responses_30"><a class="anchor" href="#_responses_30"></a><a class="link" href="#_responses_30">2.30.2. Responses</a></h4> +<h4 id="_responses_35"><a class="anchor" href="#_responses_35"></a><a class="link" href="#_responses_35">2.35.2. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -2426,7 +2817,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_29"><a class="anchor" href="#_produces_29"></a><a class="link" href="#_produces_29">2.30.3. Produces</a></h4> +<h4 id="_produces_34"><a class="anchor" href="#_produces_34"></a><a class="link" href="#_produces_34">2.35.3. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -2436,13 +2827,107 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> </div> +<div class="sect2"> +<h3 id="_v2_templates_templatename_svgrepresentation_get"><a class="anchor" href="#_v2_templates_templatename_svgrepresentation_get"></a><a class="link" href="#_v2_templates_templatename_svgrepresentation_get">2.36. GET /v2/templates/{templateName}/svgRepresentation</a></h3> +<div class="sect3"> +<h4 id="_parameters_27"><a class="anchor" href="#_parameters_27"></a><a class="link" href="#_parameters_27">2.36.1. Parameters</a></h4> +<table class="tableblock frame-all grid-all stretch"> +<colgroup> +<col style="width: 22.2222%;"> +<col style="width: 33.3333%;"> +<col style="width: 44.4445%;"> +</colgroup> +<thead> +<tr> +<th class="tableblock halign-left valign-middle">Type</th> +<th class="tableblock halign-left valign-middle">Name</th> +<th class="tableblock halign-left valign-middle">Schema</th> +</tr> +</thead> +<tbody> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>Path</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>templateName</strong><br> +<em>required</em></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> +</tr> +</tbody> +</table> +</div> +<div class="sect3"> +<h4 id="_responses_36"><a class="anchor" href="#_responses_36"></a><a class="link" href="#_responses_36">2.36.2. Responses</a></h4> +<table class="tableblock frame-all grid-all stretch"> +<colgroup> +<col style="width: 10%;"> +<col style="width: 70%;"> +<col style="width: 20%;"> +</colgroup> +<thead> +<tr> +<th class="tableblock halign-left valign-middle">HTTP Code</th> +<th class="tableblock halign-left valign-middle">Description</th> +<th class="tableblock halign-left valign-middle">Schema</th> +</tr> +</thead> +<tbody> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>200</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">Output type</p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> +</tr> +</tbody> +</table> +</div> +<div class="sect3"> +<h4 id="_produces_35"><a class="anchor" href="#_produces_35"></a><a class="link" href="#_produces_35">2.36.3. Produces</a></h4> +<div class="ulist"> +<ul> +<li> +<p><code>application/xml</code></p> +</li> +</ul> +</div> +</div> +</div> </div> </div> <div class="sect1"> <h2 id="_definitions"><a class="anchor" href="#_definitions"></a><a class="link" href="#_definitions">3. Definitions</a></h2> <div class="sectionbody"> <div class="sect2"> -<h3 id="_cldshealthcheck"><a class="anchor" href="#_cldshealthcheck"></a><a class="link" href="#_cldshealthcheck">3.1. CldsHealthCheck</a></h3> +<h3 id="_clampinformation"><a class="anchor" href="#_clampinformation"></a><a class="link" href="#_clampinformation">3.1. ClampInformation</a></h3> +<table class="tableblock frame-all grid-all stretch"> +<colgroup> +<col style="width: 42.8571%;"> +<col style="width: 57.1429%;"> +</colgroup> +<thead> +<tr> +<th class="tableblock halign-left valign-middle">Name</th> +<th class="tableblock halign-left valign-middle">Schema</th> +</tr> +</thead> +<tbody> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>allPermissions</strong><br> +<em>optional</em></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">< string > array</p></td> +</tr> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>cldsVersion</strong><br> +<em>optional</em></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> +</tr> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>userName</strong><br> +<em>optional</em></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> +</tr> +</tbody> +</table> +</div> +<div class="sect2"> +<h3 id="_cldshealthcheck"><a class="anchor" href="#_cldshealthcheck"></a><a class="link" href="#_cldshealthcheck">3.2. CldsHealthCheck</a></h3> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 42.8571%;"> @@ -2474,7 +2959,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect2"> -<h3 id="_dictionary"><a class="anchor" href="#_dictionary"></a><a class="link" href="#_dictionary">3.2. Dictionary</a></h3> +<h3 id="_dictionary"><a class="anchor" href="#_dictionary"></a><a class="link" href="#_dictionary">3.3. Dictionary</a></h3> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 42.8571%;"> @@ -2531,7 +3016,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect2"> -<h3 id="_dictionaryelement"><a class="anchor" href="#_dictionaryelement"></a><a class="link" href="#_dictionaryelement">3.3. DictionaryElement</a></h3> +<h3 id="_dictionaryelement"><a class="anchor" href="#_dictionaryelement"></a><a class="link" href="#_dictionaryelement">3.4. DictionaryElement</a></h3> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 42.8571%;"> @@ -2598,7 +3083,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect2"> -<h3 id="_externalcomponent"><a class="anchor" href="#_externalcomponent"></a><a class="link" href="#_externalcomponent">3.4. ExternalComponent</a></h3> +<h3 id="_externalcomponent"><a class="anchor" href="#_externalcomponent"></a><a class="link" href="#_externalcomponent">3.5. ExternalComponent</a></h3> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 42.8571%;"> @@ -2625,7 +3110,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect2"> -<h3 id="_externalcomponentstate"><a class="anchor" href="#_externalcomponentstate"></a><a class="link" href="#_externalcomponentstate">3.5. ExternalComponentState</a></h3> +<h3 id="_externalcomponentstate"><a class="anchor" href="#_externalcomponentstate"></a><a class="link" href="#_externalcomponentstate">3.6. ExternalComponentState</a></h3> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 42.8571%;"> @@ -2657,7 +3142,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect2"> -<h3 id="_jsonarray"><a class="anchor" href="#_jsonarray"></a><a class="link" href="#_jsonarray">3.6. JsonArray</a></h3> +<h3 id="_jsonarray"><a class="anchor" href="#_jsonarray"></a><a class="link" href="#_jsonarray">3.7. JsonArray</a></h3> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 42.8571%;"> @@ -2774,7 +3259,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect2"> -<h3 id="_jsonnull"><a class="anchor" href="#_jsonnull"></a><a class="link" href="#_jsonnull">3.7. JsonNull</a></h3> +<h3 id="_jsonnull"><a class="anchor" href="#_jsonnull"></a><a class="link" href="#_jsonnull">3.8. JsonNull</a></h3> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 42.8571%;"> @@ -2891,7 +3376,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect2"> -<h3 id="_jsonobject"><a class="anchor" href="#_jsonobject"></a><a class="link" href="#_jsonobject">3.8. JsonObject</a></h3> +<h3 id="_jsonobject"><a class="anchor" href="#_jsonobject"></a><a class="link" href="#_jsonobject">3.9. JsonObject</a></h3> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 42.8571%;"> @@ -3008,7 +3493,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect2"> -<h3 id="_jsonprimitive"><a class="anchor" href="#_jsonprimitive"></a><a class="link" href="#_jsonprimitive">3.9. JsonPrimitive</a></h3> +<h3 id="_jsonprimitive"><a class="anchor" href="#_jsonprimitive"></a><a class="link" href="#_jsonprimitive">3.10. JsonPrimitive</a></h3> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 42.8571%;"> @@ -3140,7 +3625,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect2"> -<h3 id="_loop"><a class="anchor" href="#_loop"></a><a class="link" href="#_loop">3.10. Loop</a></h3> +<h3 id="_loop"><a class="anchor" href="#_loop"></a><a class="link" href="#_loop">3.11. Loop</a></h3> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 42.8571%;"> @@ -3237,7 +3722,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect2"> -<h3 id="_loopelementmodel"><a class="anchor" href="#_loopelementmodel"></a><a class="link" href="#_loopelementmodel">3.11. LoopElementModel</a></h3> +<h3 id="_loopelementmodel"><a class="anchor" href="#_loopelementmodel"></a><a class="link" href="#_loopelementmodel">3.12. LoopElementModel</a></h3> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 42.8571%;"> @@ -3309,7 +3794,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect2"> -<h3 id="_looplog"><a class="anchor" href="#_looplog"></a><a class="link" href="#_looplog">3.12. LoopLog</a></h3> +<h3 id="_looplog"><a class="anchor" href="#_looplog"></a><a class="link" href="#_looplog">3.13. LoopLog</a></h3> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 42.8571%;"> @@ -3356,7 +3841,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect2"> -<h3 id="_looptemplate"><a class="anchor" href="#_looptemplate"></a><a class="link" href="#_looptemplate">3.13. LoopTemplate</a></h3> +<h3 id="_looptemplate"><a class="anchor" href="#_looptemplate"></a><a class="link" href="#_looptemplate">3.14. LoopTemplate</a></h3> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 42.8571%;"> @@ -3438,7 +3923,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect2"> -<h3 id="_looptemplateloopelementmodel"><a class="anchor" href="#_looptemplateloopelementmodel"></a><a class="link" href="#_looptemplateloopelementmodel">3.14. LoopTemplateLoopElementModel</a></h3> +<h3 id="_looptemplateloopelementmodel"><a class="anchor" href="#_looptemplateloopelementmodel"></a><a class="link" href="#_looptemplateloopelementmodel">3.15. LoopTemplateLoopElementModel</a></h3> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 42.8571%;"> @@ -3470,7 +3955,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect2"> -<h3 id="_microservicepolicy"><a class="anchor" href="#_microservicepolicy"></a><a class="link" href="#_microservicepolicy">3.15. MicroServicePolicy</a></h3> +<h3 id="_microservicepolicy"><a class="anchor" href="#_microservicepolicy"></a><a class="link" href="#_microservicepolicy">3.16. MicroServicePolicy</a></h3> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 42.8571%;"> @@ -3577,13 +4062,13 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect2"> -<h3 id="_number"><a class="anchor" href="#_number"></a><a class="link" href="#_number">3.16. Number</a></h3> +<h3 id="_number"><a class="anchor" href="#_number"></a><a class="link" href="#_number">3.17. Number</a></h3> <div class="paragraph"> <p><em>Type</em> : object</p> </div> </div> <div class="sect2"> -<h3 id="_operationalpolicy"><a class="anchor" href="#_operationalpolicy"></a><a class="link" href="#_operationalpolicy">3.17. OperationalPolicy</a></h3> +<h3 id="_operationalpolicy"><a class="anchor" href="#_operationalpolicy"></a><a class="link" href="#_operationalpolicy">3.18. OperationalPolicy</a></h3> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 42.8571%;"> @@ -3665,7 +4150,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect2"> -<h3 id="_policymodel"><a class="anchor" href="#_policymodel"></a><a class="link" href="#_policymodel">3.18. PolicyModel</a></h3> +<h3 id="_policymodel"><a class="anchor" href="#_policymodel"></a><a class="link" href="#_policymodel">3.19. PolicyModel</a></h3> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 42.8571%;"> @@ -3732,7 +4217,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect2"> -<h3 id="_service"><a class="anchor" href="#_service"></a><a class="link" href="#_service">3.19. Service</a></h3> +<h3 id="_service"><a class="anchor" href="#_service"></a><a class="link" href="#_service">3.20. Service</a></h3> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 42.8571%;"> diff --git a/src/main/resources/application-noaaf.properties b/src/main/resources/application-noaaf.properties index 3ce033f64..dbccb32de 100644 --- a/src/main/resources/application-noaaf.properties +++ b/src/main/resources/application-noaaf.properties @@ -176,7 +176,9 @@ clamp.config.security.permission.instance=dev clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal ## Tosca converter -clamp.config.tosca.converter.templates=classpath:/clds/tosca_updates/templates.json +clamp.config.tosca.converter.json.schema.templates=classpath:/clds/tosca-converter/templates.json +clamp.config.tosca.converter.default.datatypes=classpath:/clds/tosca-converter/default-tosca-types.yaml +clamp.config.tosca.converter.dictionary.support.enabled=true # Configuration settings for CDS clamp.config.cds.url=http4://blueprints-processor-http:8080 diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index a249d2d00..90c4186ef 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -189,7 +189,9 @@ 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.json +clamp.config.tosca.converter.json.schema.templates=classpath:/clds/tosca-converter/templates.json +clamp.config.tosca.converter.default.datatypes=classpath:/clds/tosca-converter/default-tosca-types.yaml +clamp.config.tosca.converter.dictionary.support.enabled=true # Configuration settings for CDS clamp.config.cds.url=http4://blueprints-processor-http:8080 diff --git a/src/main/resources/clds/tosca_update/default-tosca-types.yaml b/src/main/resources/clds/tosca-converter/default-tosca-types.yaml index a11a73698..a11a73698 100644 --- a/src/main/resources/clds/tosca_update/default-tosca-types.yaml +++ b/src/main/resources/clds/tosca-converter/default-tosca-types.yaml diff --git a/src/main/resources/clds/tosca_update/templates.json b/src/main/resources/clds/tosca-converter/templates.json index f709e2f6d..f709e2f6d 100644 --- a/src/main/resources/clds/tosca_update/templates.json +++ b/src/main/resources/clds/tosca-converter/templates.json diff --git a/src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java b/src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java index 5a1292210..7152ee11d 100644 --- a/src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java +++ b/src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java @@ -26,12 +26,12 @@ package org.onap.clamp.clds.config; +import static org.assertj.core.api.Assertions.assertThat; + import org.junit.Test; import org.onap.clamp.authorization.CldsUser; import org.onap.clamp.clds.exception.CldsUsersException; -import static org.assertj.core.api.Assertions.assertThat; - public class CldsUserJsonDecoderTest { private String user1 = "admin1"; diff --git a/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java b/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java index 4bf2de030..d985a5d72 100644 --- a/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java @@ -24,6 +24,7 @@ package org.onap.clamp.clds.it.config; import static org.junit.Assert.assertEquals; + import java.io.IOException; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java b/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java index db6fd5c03..a32d4995e 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java +++ b/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java @@ -57,7 +57,7 @@ public class ToscaYamlToJsonConvertorTestItCase { * Schema. * * @throws IOException In case of issue when opening the tosca yaml file and - * converted json file + * converted json file */ @Test public final void testParseToscaYaml() throws IOException { @@ -65,11 +65,11 @@ public class ToscaYamlToJsonConvertorTestItCase { ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor(); String parsedJsonSchema = - convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.cdap.tca.hi.lo.app"); + convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.cdap.tca.hi.lo.app"); assertNotNull(parsedJsonSchema); JSONAssert.assertEquals( - ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json.json"), - parsedJsonSchema, true); + ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json.json"), + parsedJsonSchema, true); } /** @@ -77,20 +77,20 @@ public class ToscaYamlToJsonConvertorTestItCase { * based on JSON Editor Schema. * * @throws IOException In case of issue when opening the tosca yaml file and - * converted json file + * converted json file */ @Test public final void testParseToscaYamlWithConstraints() throws IOException { String toscaModelYaml = - ResourceFileUtil.getResourceAsString("tosca/tosca-with-constraints.yaml"); + ResourceFileUtil.getResourceAsString("tosca/tosca-with-constraints.yaml"); ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor(); String parsedJsonSchema = - convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app"); + convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app"); assertNotNull(parsedJsonSchema); JSONAssert.assertEquals( - ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json-with-constraints.json"), - parsedJsonSchema, true); + ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json-with-constraints.json"), + parsedJsonSchema, true); } /** @@ -98,20 +98,20 @@ public class ToscaYamlToJsonConvertorTestItCase { * conversion based on JSON Editor Schema. * * @throws IOException In case of issue when opening the tosca yaml file and - * converted json file + * converted json file */ @Test public final void testParseToscaYamlWithTypes() throws IOException { String toscaModelYaml = - ResourceFileUtil.getResourceAsString("tosca/tosca-with-datatypes.yaml"); + ResourceFileUtil.getResourceAsString("tosca/tosca-with-datatypes.yaml"); ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor(); String parsedJsonSchema = - convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app"); + convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app"); assertNotNull(parsedJsonSchema); JSONAssert.assertEquals( - ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json-with-datatypes.json"), - parsedJsonSchema, true); + ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json-with-datatypes.json"), + parsedJsonSchema, true); } /** @@ -119,7 +119,7 @@ public class ToscaYamlToJsonConvertorTestItCase { * parameters which defines the Tosca Policy name and its short name. * * @throws IOException In case of issue when opening the tosca yaml file and - * converted json file + * converted json file */ @Test @Transactional @@ -165,24 +165,24 @@ public class ToscaYamlToJsonConvertorTestItCase { dictionaryService.saveOrUpdateDictionary(dictionaryTest2); String toscaModelYaml = - ResourceFileUtil.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml"); + ResourceFileUtil.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml"); JsonObject jsonObject = toscaYamlToJsonConvertor.validateAndConvertToJson(toscaModelYaml); assertNotNull(jsonObject); String policyModelType = toscaYamlToJsonConvertor.getValueFromMetadata(jsonObject, - ToscaSchemaConstants.METADATA_POLICY_MODEL_TYPE); + ToscaSchemaConstants.METADATA_POLICY_MODEL_TYPE); String acronym = toscaYamlToJsonConvertor.getValueFromMetadata(jsonObject, - ToscaSchemaConstants.METADATA_ACRONYM); + ToscaSchemaConstants.METADATA_ACRONYM); String parsedJsonSchema = - toscaYamlToJsonConvertor.parseToscaYaml(toscaModelYaml, policyModelType); + toscaYamlToJsonConvertor.parseToscaYaml(toscaModelYaml, policyModelType); assertNotNull(parsedJsonSchema); assertEquals("onap.policies.monitoring.cdap.tca.hi.lo.app", policyModelType); assertEquals("tca", acronym); JSONAssert.assertEquals( - ResourceFileUtil - .getResourceAsString("tosca/tosca_metadata_clamp_possible_values_json_schema.json"), - parsedJsonSchema, true); + ResourceFileUtil + .getResourceAsString("tosca/tosca_metadata_clamp_possible_values_json_schema.json"), + parsedJsonSchema, true); } } 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 83c374e9d..421bd6ab2 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 @@ -27,6 +27,10 @@ import com.google.gson.JsonArray; import java.io.IOException; import java.util.ArrayList; import junit.framework.TestCase; +import org.onap.clamp.clds.tosca.update.elements.ArrayField; +import org.onap.clamp.clds.tosca.update.elements.ToscaElement; +import org.onap.clamp.clds.tosca.update.elements.ToscaElementProperty; +import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager; import org.onap.clamp.clds.util.ResourceFileUtil; public class ArrayFieldTest extends TestCase { @@ -37,13 +41,13 @@ public class ArrayFieldTest extends TestCase { * @throws IOException in case of failure */ public void testDeploy() throws IOException { - ToscaConverterManager toscaConverterManager = new ToscaConverterManager(ResourceFileUtil.getResourceAsString( + JsonTemplateManager jsonTemplateManager = new JsonTemplateManager(ResourceFileUtil.getResourceAsString( "tosca/new-converter/sampleOperationalPoliciesEXTENTED.yaml"),ResourceFileUtil.getResourceAsString( - "clds/tosca_update/default-tosca-types.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); - ToscaElement toscaElement = toscaConverterManager.getComponents().get("onap.datatype.controlloop.Actor"); - Property property = toscaElement.getProperties().get("actor"); - ArrayField arrayParser = new ArrayField((ArrayList<Object>) property.getItems().get("default")); + "clds/tosca-converter/default-tosca-types.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json")); + ToscaElement toscaElement = jsonTemplateManager.getToscaElements().get("onap.datatype.controlloop.Actor"); + ToscaElementProperty toscaElementProperty = toscaElement.getProperties().get("actor"); + ArrayField arrayParser = new ArrayField((ArrayList<Object>) toscaElementProperty.getItems().get("default")); JsonArray toTest = arrayParser.deploy(); String reference = "[1,\"String\",5.5,true]"; assertEquals(reference, String.valueOf(toTest)); 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 a73fd6736..5215cbd4d 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 @@ -27,16 +27,20 @@ import com.google.gson.JsonObject; import java.io.IOException; import java.util.ArrayList; import junit.framework.TestCase; +import org.onap.clamp.clds.tosca.update.elements.ToscaElement; +import org.onap.clamp.clds.tosca.update.elements.ToscaElementProperty; +import org.onap.clamp.clds.tosca.update.templates.JsonTemplate; +import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager; import org.onap.clamp.clds.util.ResourceFileUtil; public class ConstraintTest extends TestCase { - ToscaConverterManager toscaConverterManager = new ToscaConverterManager( + JsonTemplateManager jsonTemplateManager = new JsonTemplateManager( ResourceFileUtil.getResourceAsString("tosca/new-converter/constraints.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/default-tosca-types.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); + ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json")); - ToscaElement toscaElement = toscaConverterManager.getComponents().get("onap.datatype.controlloop.Operation"); + ToscaElement toscaElement = jsonTemplateManager.getToscaElements().get("onap.datatype.controlloop.Operation"); public ConstraintTest() throws IOException { } @@ -45,18 +49,20 @@ public class ConstraintTest extends TestCase { * Test get value array. */ public void testGetValuesArray() { - Property property = toscaElement.getProperties().get("timeout"); - Template template = toscaConverterManager.getTemplates().get("integer"); + ToscaElementProperty toscaElementProperty = toscaElement.getProperties().get("timeout"); + JsonTemplate jsonTemplate = jsonTemplateManager.getJsonSchemaTemplates().get("integer"); JsonObject resultProcess = new JsonObject(); - property.addConstraintsAsJson(resultProcess, (ArrayList<Object>) property.getItems().get("constraints"), - template); + toscaElementProperty.addConstraintsAsJson(resultProcess, + (ArrayList<Object>) toscaElementProperty.getItems().get("constraints"), + jsonTemplate); String reference = "{\"enum\":[3,4,5.5,6,10]}"; assertEquals(reference, String.valueOf(resultProcess)); - property = toscaElement.getProperties().get("success"); - template = toscaConverterManager.getTemplates().get("string"); + toscaElementProperty = toscaElement.getProperties().get("success"); + jsonTemplate = jsonTemplateManager.getJsonSchemaTemplates().get("string"); resultProcess = new JsonObject(); - property.addConstraintsAsJson(resultProcess, (ArrayList<Object>) property.getItems().get("constraints"), - template); + toscaElementProperty.addConstraintsAsJson(resultProcess, + (ArrayList<Object>) toscaElementProperty.getItems().get("constraints"), + jsonTemplate); reference = "{\"enum\":[\"VALID\",\"TERMINATED\"]}"; assertEquals(reference, String.valueOf(resultProcess)); } @@ -66,11 +72,12 @@ public class ConstraintTest extends TestCase { */ public void testGetSpecificLength() { //Test for string type, same process for array - Property property = toscaElement.getProperties().get("id"); - Template template = toscaConverterManager.getTemplates().get("string"); + ToscaElementProperty toscaElementProperty = toscaElement.getProperties().get("id"); + JsonTemplate jsonTemplate = jsonTemplateManager.getJsonSchemaTemplates().get("string"); JsonObject resultProcess = new JsonObject(); - property.addConstraintsAsJson(resultProcess, (ArrayList<Object>) property.getItems().get("constraints"), - template); + toscaElementProperty.addConstraintsAsJson(resultProcess, + (ArrayList<Object>) toscaElementProperty.getItems().get("constraints"), + jsonTemplate); int specificLength = 8; int toTest = resultProcess.get("minLength").getAsInt(); assertEquals(specificLength, toTest); @@ -83,11 +90,12 @@ public class ConstraintTest extends TestCase { */ public void testGetLimitValue() { //Test for array type, same process for string - Property property = toscaElement.getProperties().get("description"); - Template template = toscaConverterManager.getTemplates().get("array"); + ToscaElementProperty toscaElementProperty = toscaElement.getProperties().get("description"); + JsonTemplate jsonTemplate = jsonTemplateManager.getJsonSchemaTemplates().get("array"); JsonObject resultProcess = new JsonObject(); - property.addConstraintsAsJson(resultProcess, (ArrayList<Object>) property.getItems().get("constraints"), - template); + toscaElementProperty.addConstraintsAsJson(resultProcess, + (ArrayList<Object>) toscaElementProperty.getItems().get("constraints"), + jsonTemplate); int toTest = resultProcess.get("minItems").getAsInt(); assertEquals(5, toTest); diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterManagerTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateManagerTest.java index 493841215..693377ee0 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterManagerTest.java +++ b/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateManagerTest.java @@ -28,9 +28,12 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import junit.framework.TestCase; +import org.onap.clamp.clds.tosca.update.templates.JsonTemplate; +import org.onap.clamp.clds.tosca.update.templates.JsonTemplateField; +import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager; import org.onap.clamp.clds.util.ResourceFileUtil; -public class ToscaConverterManagerTest extends TestCase { +public class JsonTemplateManagerTest extends TestCase { /** * Test the launch translation wit operational policies. @@ -39,17 +42,15 @@ public class ToscaConverterManagerTest extends TestCase { * @throws UnknownComponentException In case of failure */ public void testLaunchTranslationTca() throws IOException, UnknownComponentException { - ToscaConverterManager toscaConverterManager = - new ToscaConverterManager( + JsonTemplateManager jsonTemplateManager = + new JsonTemplateManager( ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap" + ".policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0?" + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString( - "clds/tosca_update/default-tosca-types.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); - assertNull(toscaConverterManager.getParseToJson()); + "clds/tosca-converter/default-tosca-types.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json")); String componentName = "onap.policies.monitoring.cdap.tca.hi.lo.app"; - toscaConverterManager.startConversionToJson(componentName); - assertNotNull(toscaConverterManager.getParseToJson()); + jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null); } /** @@ -59,17 +60,15 @@ public class ToscaConverterManagerTest extends TestCase { * @throws UnknownComponentException In case of failure */ public void testLaunchTranslationFrequencyLimiter() throws IOException, UnknownComponentException { - ToscaConverterManager toscaConverterManager = - new ToscaConverterManager( + JsonTemplateManager jsonTemplateManager = + new JsonTemplateManager( ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap" + ".policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0?" + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString( - "clds/tosca_update/default-tosca-types.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); - assertNull(toscaConverterManager.getParseToJson()); + "clds/tosca-converter/default-tosca-types.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json")); String componentName = "onap.policies.controlloop.guard.common.FrequencyLimiter"; - toscaConverterManager.startConversionToJson(componentName); - assertNotNull(toscaConverterManager.getParseToJson()); + jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null); } /** @@ -79,17 +78,15 @@ public class ToscaConverterManagerTest extends TestCase { * @throws UnknownComponentException In case of failure */ public void testLaunchTranslationApex() throws IOException, UnknownComponentException { - ToscaConverterManager toscaConverterManager = - new ToscaConverterManager( + JsonTemplateManager jsonTemplateManager = + new JsonTemplateManager( ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap" + ".policies.controlloop.operational.common.Apex/versions/1.0.0?" + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString( - "clds/tosca_update/default-tosca-types.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); - assertNull(toscaConverterManager.getParseToJson()); + "clds/tosca-converter/default-tosca-types.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json")); String componentName = "onap.policies.controlloop.operational.common.Apex"; - toscaConverterManager.startConversionToJson(componentName); - assertNotNull(toscaConverterManager.getParseToJson()); + jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null); } /** @@ -99,19 +96,18 @@ public class ToscaConverterManagerTest extends TestCase { * @throws UnknownComponentException In case of failure */ public void testLaunchTranslationDrools() throws IOException, UnknownComponentException { - ToscaConverterManager toscaConverterManager = - new ToscaConverterManager( + JsonTemplateManager jsonTemplateManager = + new JsonTemplateManager( ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap" + ".policies.controlloop.operational.common.Drools/versions/1.0.0?" + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString( - "clds/tosca_update/default-tosca-types.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); - assertNull(toscaConverterManager.getParseToJson()); + "clds/tosca-converter/default-tosca-types.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json")); String componentName = "onap.policies.controlloop.operational.common.Drools"; - toscaConverterManager.startConversionToJson(componentName); - assertNotNull(toscaConverterManager.getParseToJson()); + jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null); } + /** * Test the launch translation. * @@ -119,15 +115,13 @@ public class ToscaConverterManagerTest extends TestCase { * @throws UnknownComponentException In case of failure */ public void testLaunchTranslation() throws IOException, UnknownComponentException { - ToscaConverterManager toscaConverterManager = - new ToscaConverterManager( + JsonTemplateManager jsonTemplateManager = + new JsonTemplateManager( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/default-tosca-types.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); - assertNull(toscaConverterManager.getParseToJson()); + ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json")); String componentName = "onap.policies.controlloop.operational.common.Drools"; - toscaConverterManager.startConversionToJson(componentName); - assertNotNull(toscaConverterManager.getParseToJson()); + jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null); } /** @@ -136,18 +130,20 @@ public class ToscaConverterManagerTest extends TestCase { * @throws IOException In case of failure */ public void testAddTemplate() throws IOException { - ToscaConverterManager toscaConverterManager = - new ToscaConverterManager( + JsonTemplateManager jsonTemplateManager = + new JsonTemplateManager( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/default-tosca-types.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); - int count = toscaConverterManager.getTemplates().size(); - List<TemplateField> templateFields = new ArrayList<>(Arrays.asList(new TemplateField("type"), new TemplateField("description"), - new TemplateField( - "required"), - new TemplateField("metadata"), new TemplateField("constraints"))); - toscaConverterManager.addTemplate("test", templateFields); - assertNotSame(count, toscaConverterManager.getTemplates().size()); + ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json")); + int count = jsonTemplateManager.getJsonSchemaTemplates().size(); + List<JsonTemplateField> + jsonTemplateFields = + new ArrayList<>(Arrays.asList(new JsonTemplateField("type"), new JsonTemplateField("description"), + new JsonTemplateField( + "required"), + new JsonTemplateField("metadata"), new JsonTemplateField("constraints"))); + jsonTemplateManager.addTemplate("test", jsonTemplateFields); + assertNotSame(count, jsonTemplateManager.getJsonSchemaTemplates().size()); } /** @@ -156,14 +152,14 @@ public class ToscaConverterManagerTest extends TestCase { * @throws IOException In case of failure */ public void testRemoveTemplate() throws IOException { - ToscaConverterManager toscaConverterManager = - new ToscaConverterManager( + JsonTemplateManager jsonTemplateManager = + new JsonTemplateManager( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/default-tosca-types.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); - int count = toscaConverterManager.getTemplates().size(); - toscaConverterManager.removeTemplate("string"); - assertNotSame(count, toscaConverterManager.getTemplates().size()); + ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json")); + int count = jsonTemplateManager.getJsonSchemaTemplates().size(); + jsonTemplateManager.removeTemplate("string"); + assertNotSame(count, jsonTemplateManager.getJsonSchemaTemplates().size()); } /** @@ -172,14 +168,15 @@ public class ToscaConverterManagerTest extends TestCase { * @throws IOException In case of failure */ public void testUpdateTemplate() throws IOException { - ToscaConverterManager toscaConverterManager = - new ToscaConverterManager( + JsonTemplateManager jsonTemplateManager = + new JsonTemplateManager( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/default-tosca-types.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); - int count = toscaConverterManager.getTemplates().get("integer").getTemplateFields().size(); - toscaConverterManager.updateTemplate("integer", new TemplateField("type"), false); - assertNotSame(count, toscaConverterManager.getTemplates().get("integer").getTemplateFields().size()); + ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json")); + int count = jsonTemplateManager.getJsonSchemaTemplates().get("integer").getJsonTemplateFields().size(); + jsonTemplateManager.updateTemplate("integer", new JsonTemplateField("type"), false); + assertNotSame(count, + jsonTemplateManager.getJsonSchemaTemplates().get("integer").getJsonTemplateFields().size()); } /** @@ -188,17 +185,18 @@ public class ToscaConverterManagerTest extends TestCase { * @throws IOException In case of failure */ public void testHasTemplate() throws IOException { - ToscaConverterManager toscaConverterManager = - new ToscaConverterManager( + JsonTemplateManager jsonTemplateManager = + new JsonTemplateManager( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/default-tosca-types.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); + ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json")); boolean has = true; - List<TemplateField> templateFieldsString = - new ArrayList<>(Arrays.asList(new TemplateField("type"), new TemplateField("description"), new TemplateField("required"), - new TemplateField("metadata"), new TemplateField("constraints"))); - Template templateTest = new Template("String", templateFieldsString); - has = toscaConverterManager.hasTemplate(templateTest); + List<JsonTemplateField> jsonTemplateFieldsString = + new ArrayList<>(Arrays.asList(new JsonTemplateField("type"), new JsonTemplateField("description"), + new JsonTemplateField("required"), + new JsonTemplateField("metadata"), new JsonTemplateField("constraints"))); + JsonTemplate jsonTemplateTest = new JsonTemplate("String", jsonTemplateFieldsString); + has = jsonTemplateManager.hasTemplate(jsonTemplateTest); 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/JsonTemplateTest.java index 02c5747b6..fab3030ca 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/TemplateTest.java +++ b/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateTest.java @@ -27,19 +27,24 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import junit.framework.TestCase; +import org.onap.clamp.clds.tosca.update.templates.JsonTemplate; +import org.onap.clamp.clds.tosca.update.templates.JsonTemplateField; -public class TemplateTest extends TestCase { +public class JsonTemplateTest extends TestCase { /** * Test check failed. */ public void testCheckFields() { - Template toTest = new Template("toTest"); - List<TemplateField> templateFields = new ArrayList<>(Arrays.asList(new TemplateField("type"), new TemplateField("description"),new TemplateField( - "enum"))); - toTest.setTemplateFields(templateFields); - Template reference = new Template("toTest"); - reference.setTemplateFields(templateFields); + JsonTemplate toTest = new JsonTemplate("toTest"); + List<JsonTemplateField> + jsonTemplateFields = new ArrayList<>( + Arrays.asList(new JsonTemplateField("type"), new JsonTemplateField("description"), + new JsonTemplateField( + "enum"))); + toTest.setJsonTemplateFields(jsonTemplateFields); + JsonTemplate reference = new JsonTemplate("toTest"); + reference.setJsonTemplateFields(jsonTemplateFields); assertTrue(toTest.checkFields(reference)); } diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java b/src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java new file mode 100644 index 000000000..b4f8b1245 --- /dev/null +++ b/src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java @@ -0,0 +1,118 @@ +/*- + * ============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; + +import com.google.gson.JsonObject; +import java.io.IOException; +import javax.transaction.Transactional; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.clamp.clds.Application; +import org.onap.clamp.clds.tosca.update.parser.metadata.ToscaMetadataParserWithDictionarySupport; +import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager; +import org.onap.clamp.clds.util.JsonUtils; +import org.onap.clamp.clds.util.ResourceFileUtil; +import org.onap.clamp.tosca.Dictionary; +import org.onap.clamp.tosca.DictionaryElement; +import org.onap.clamp.tosca.DictionaryService; +import org.skyscreamer.jsonassert.JSONAssert; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootTest(classes = Application.class) +public class ToscaConverterWithDictionarySupportItCase { + + @Autowired + private DictionaryService dictionaryService; + + @Autowired + private ToscaMetadataParserWithDictionarySupport toscaMetadataParserWithDictionarySupport; + + /** + * This Test validates Tosca yaml with metadata tag that contains policy_model_type and acronym + * parameters which defines the Tosca Policy name and its short name. + * + * @throws IOException In case of issue when opening the tosca yaml file and + * converted json file + */ + @Test + @Transactional + public final void testMetadataClampPossibleValues() throws IOException, UnknownComponentException { + + // Set up dictionary elements + Dictionary dictionaryTest = new Dictionary(); + dictionaryTest.setName("Context"); + dictionaryTest.setSecondLevelDictionary(0); + + DictionaryElement element = new DictionaryElement(); + element.setName("PROD"); + element.setShortName("PROD"); + element.setType("string"); + element.setDescription("Production"); + dictionaryTest.addDictionaryElements(element); + + dictionaryService.saveOrUpdateDictionary(dictionaryTest); + + Dictionary dictionaryTest1 = new Dictionary(); + dictionaryTest1.setName("EventDictionary"); + dictionaryTest1.setSecondLevelDictionary(0); + + DictionaryElement element1 = new DictionaryElement(); + element1.setName("alarmCondition"); + element1.setShortName("alarmCondition"); + element1.setType("string"); + element1.setDescription("Alarm Condition"); + dictionaryTest1.addDictionaryElements(element1); + + dictionaryService.saveOrUpdateDictionary(dictionaryTest1); + + Dictionary dictionaryTest2 = new Dictionary(); + dictionaryTest2.setName("Operators"); + dictionaryTest2.setSecondLevelDictionary(0); + + DictionaryElement element2 = new DictionaryElement(); + element2.setName("equals"); + element2.setShortName("equals"); + element2.setType("string"); + element2.setDescription("equals"); + dictionaryTest2.addDictionaryElements(element2); + dictionaryService.saveOrUpdateDictionary(dictionaryTest2); + + JsonTemplateManager jsonTemplateManager = + new JsonTemplateManager( + ResourceFileUtil.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json")); + + JsonObject jsonSchema = jsonTemplateManager.getJsonSchemaForPolicyType( + "onap.policies.monitoring.cdap.tca.hi.lo.app", toscaMetadataParserWithDictionarySupport); + + JSONAssert.assertEquals( + ResourceFileUtil + .getResourceAsString("tosca/new-converter/tca-with-metadata.json"), + JsonUtils.GSON.toJson(jsonSchema), true); + } +} diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/PropertyTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementPropertyTest.java index bb1929f98..967f330dc 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/PropertyTest.java +++ b/src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementPropertyTest.java @@ -28,10 +28,14 @@ import com.google.gson.JsonObject; import java.io.IOException; import java.util.ArrayList; import junit.framework.TestCase; +import org.onap.clamp.clds.tosca.update.elements.ToscaElement; +import org.onap.clamp.clds.tosca.update.elements.ToscaElementProperty; +import org.onap.clamp.clds.tosca.update.templates.JsonTemplate; +import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager; import org.onap.clamp.clds.util.ResourceFileUtil; -public class PropertyTest extends TestCase { - public PropertyTest() throws IOException { +public class ToscaElementPropertyTest extends TestCase { + public ToscaElementPropertyTest() throws IOException { } /** @@ -40,13 +44,14 @@ public class PropertyTest extends TestCase { * @throws IOException In case of failure */ public void testParseArray() throws IOException { - ToscaConverterManager toscaConverterManager = new ToscaConverterManager( + JsonTemplateManager jsonTemplateManager = new JsonTemplateManager( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPoliciesEXTENTED.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/default-tosca-types.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); - ToscaElement toscaElement = toscaConverterManager.getComponents().get("onap.datatype.controlloop.Actor"); - Property property = toscaElement.getProperties().get("actor"); - JsonArray toTest = property.parseArray((ArrayList<Object>) property.getItems().get("default")); + ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json")); + ToscaElement toscaElement = jsonTemplateManager.getToscaElements().get("onap.datatype.controlloop.Actor"); + ToscaElementProperty toscaElementProperty = toscaElement.getProperties().get("actor"); + JsonArray toTest = + toscaElementProperty.parseArray((ArrayList<Object>) toscaElementProperty.getItems().get("default")); assertNotNull(toTest); } @@ -56,15 +61,18 @@ public class PropertyTest extends TestCase { * @throws IOException In case of failure */ public void testAddConstraintsAsJson() throws IOException { - ToscaConverterManager toscaConverterManager = new ToscaConverterManager( + JsonTemplateManager jsonTemplateManager = new JsonTemplateManager( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/default-tosca-types.yaml"), - ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json")); - ToscaElement toscaElement = toscaConverterManager.getComponents().get("onap.datatype.controlloop.operation.Failure"); - Property property = toscaElement.getProperties().get("category"); - Template template = toscaConverterManager.getTemplates().get("string"); + ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json")); + ToscaElement toscaElement = + jsonTemplateManager.getToscaElements().get("onap.datatype.controlloop.operation.Failure"); + ToscaElementProperty toscaElementProperty = toscaElement.getProperties().get("category"); + JsonTemplate jsonTemplate = jsonTemplateManager.getJsonSchemaTemplates().get("string"); JsonObject toTest = new JsonObject(); - property.addConstraintsAsJson(toTest, (ArrayList<Object>) property.getItems().get("constraints"), template); + toscaElementProperty + .addConstraintsAsJson(toTest, (ArrayList<Object>) toscaElementProperty.getItems().get("constraints"), + jsonTemplate); String test = "{\"enum\":[\"error\",\"timeout\",\"retries\",\"guard\",\"exception\"]}"; assertEquals(test, String.valueOf(toTest)); } diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementTest.java index 7ffba4e00..5f7de28ae 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementTest.java +++ b/src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementTest.java @@ -27,6 +27,8 @@ import java.io.IOException; import java.util.ArrayList;
import java.util.Arrays;
import junit.framework.TestCase;
+import org.onap.clamp.clds.tosca.update.elements.ToscaElement;
+import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager;
import org.onap.clamp.clds.util.ResourceFileUtil;
public class ToscaElementTest extends TestCase {
@@ -38,12 +40,12 @@ public class ToscaElementTest extends TestCase { */
public void testPropertiesNames() throws IOException {
ArrayList<String> reference = new ArrayList<>(Arrays.asList("actor", "operation", "target", "payload"));
- ToscaConverterManager toscaConverterManager =
- new ToscaConverterManager(
+ JsonTemplateManager jsonTemplateManager =
+ new JsonTemplateManager(
ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca_update/default-tosca-types.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json"));
- ToscaElement toscaElement = toscaConverterManager.getComponents().get("onap.datatype.controlloop.Actor");
+ ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+ ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+ ToscaElement toscaElement = jsonTemplateManager.getToscaElements().get("onap.datatype.controlloop.Actor");
assertEquals(reference, toscaElement.propertiesNames());
}
diff --git a/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java b/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java index 184a391d7..8eeba07ed 100644 --- a/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java +++ b/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java @@ -39,7 +39,6 @@ import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; -import org.onap.clamp.loop.Loop; import org.onap.clamp.loop.template.PolicyModel; import org.onap.clamp.policy.microservice.MicroServicePolicy; import org.onap.clamp.policy.operational.OperationalPolicy; @@ -65,11 +64,11 @@ public class ClampGraphBuilderTest { public void clampGraphBuilderCompleteChainTest() { String collector = "VES"; MicroServicePolicy ms1 = new MicroServicePolicy("ms1", new PolicyModel("org.onap.ms1", "", "1.0.0"), false, - null); + null, null, null, null); MicroServicePolicy ms2 = new MicroServicePolicy("ms2", new PolicyModel("org.onap.ms2", "", "1.0.0"), false, - null); + null, null, null, null); - OperationalPolicy opPolicy = new OperationalPolicy("OperationalPolicy", new Loop(), new JsonObject(), + OperationalPolicy opPolicy = new OperationalPolicy("OperationalPolicy", new JsonObject(), new JsonObject(), new PolicyModel("org.onap.opolicy", null, "1.0.0", "opolicy1"), null, null, null); final Set<OperationalPolicy> opPolicies = Set.of(opPolicy); final Set<MicroServicePolicy> microServices = Set.of(ms1, ms2); @@ -92,9 +91,11 @@ public class ClampGraphBuilderTest { public void clampGraphBuilderNoPolicyGivenTest() { String collector = "VES"; MicroServicePolicy ms1 = - new MicroServicePolicy("ms1", new PolicyModel("org.onap.ms1", "", "1.0.0"), false, null); + new MicroServicePolicy("ms1", new PolicyModel("org.onap.ms1", "", "1.0.0"), false, null, null, null, + null); MicroServicePolicy ms2 = - new MicroServicePolicy("ms2", new PolicyModel("org.onap.ms2", "", "1.0.0"), false, null); + new MicroServicePolicy("ms2", new PolicyModel("org.onap.ms2", "", "1.0.0"), false, null, null, null, + null); ClampGraphBuilder clampGraphBuilder = new ClampGraphBuilder(mockPainter); assertThat(clampGraphBuilder.collector(collector).addMicroService(ms1).addMicroService(ms2).build()) diff --git a/src/test/java/org/onap/clamp/clds/util/drawing/SvgLoopGeneratorTest.java b/src/test/java/org/onap/clamp/clds/util/drawing/SvgLoopGeneratorTest.java index a320131c4..9559fa17d 100644 --- a/src/test/java/org/onap/clamp/clds/util/drawing/SvgLoopGeneratorTest.java +++ b/src/test/java/org/onap/clamp/clds/util/drawing/SvgLoopGeneratorTest.java @@ -24,6 +24,7 @@ package org.onap.clamp.clds.util.drawing; import static org.assertj.core.api.Assertions.assertThat; + import com.google.gson.JsonObject; import java.io.IOException; import javax.xml.parsers.ParserConfigurationException; @@ -38,12 +39,11 @@ public class SvgLoopGeneratorTest { private Loop getLoop() { MicroServicePolicy ms1 = new MicroServicePolicy("ms1", new PolicyModel("org.onap.ms1", "", "1.0.0", "short.ms1"), - false, - null); + false,null,null,null,null); MicroServicePolicy ms2 = new MicroServicePolicy("ms2", new PolicyModel("org.onap.ms2", "", "1.0.0", "short.ms2"), - false, null); - OperationalPolicy opPolicy = new OperationalPolicy("OperationalPolicy", new Loop(), new JsonObject(), + false, null,null,null,null); + OperationalPolicy opPolicy = new OperationalPolicy("OperationalPolicy", new JsonObject(),new JsonObject(), new PolicyModel("org.onap.opolicy", null, "1.0.0", "short.OperationalPolicy"), null, null, null); Loop loop = new Loop(); loop.addMicroServicePolicy(ms1); diff --git a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java index a57a35ea4..d06695545 100644 --- a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java +++ b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java @@ -27,6 +27,7 @@ package org.onap.clamp.loop; import static org.assertj.core.api.Assertions.assertThat; + import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; @@ -96,7 +97,8 @@ public class CsarInstallerItCase { private CsarInstaller csarInstaller; private BlueprintArtifact buildFakeBuildprintArtifact(String instanceName, String invariantResourceUuid, - String blueprintFilePath, String artifactName, String invariantServiceUuid) throws IOException { + String blueprintFilePath, String artifactName, + String invariantServiceUuid) throws IOException { IResourceInstance resource = Mockito.mock(IResourceInstance.class); Mockito.when(resource.getResourceInstanceName()).thenReturn(instanceName); Mockito.when(resource.getResourceInvariantUUID()).thenReturn(invariantResourceUuid); diff --git a/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java b/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java index 24a9037ad..4d51bb27c 100644 --- a/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java +++ b/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java @@ -30,6 +30,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import java.io.IOException; import java.util.Set; import javax.transaction.Transactional; import org.junit.Test; @@ -46,7 +47,6 @@ import org.onap.clamp.policy.operational.OperationalPolicy; import org.onap.clamp.policy.operational.OperationalPolicyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.annotation.Commit; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @@ -77,10 +77,10 @@ public class LoopControllerTestItCase { private void saveTestLoopToDb() { Loop testLoop = createTestLoop(EXAMPLE_LOOP_NAME, "blueprint", "representation"); testLoop.setGlobalPropertiesJson(JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class)); - LoopTemplate template = new LoopTemplate(); + LoopTemplate template = new LoopTemplate(); template.setName("testTemplate"); testLoop.setLoopTemplate(template); - Service modelService = new Service("{\"name\":\"serviceName\",\"UUID\":\"uuid\"}","{}"); + Service modelService = new Service("{\"name\":\"serviceName\",\"UUID\":\"uuid\"}", "{}"); testLoop.setModelService(modelService); loopService.saveOrUpdateLoop(testLoop); } @@ -140,7 +140,7 @@ public class LoopControllerTestItCase { public void testUpdateMicroservicePolicy() { saveTestLoopToDb(); PolicyModel policyModel = new PolicyModel("testPolicyModel", - "tosca_definitions_version: tosca_simple_yaml_1_0_0","1.0.0"); + "tosca_definitions_version: tosca_simple_yaml_1_0_0", "1.0.0"); policyModelsService.saveOrUpdatePolicyModel(policyModel); MicroServicePolicy policy = new MicroServicePolicy("policyName", policyModel, false, JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, null, null); @@ -158,10 +158,10 @@ public class LoopControllerTestItCase { @Test @Transactional - public void testAddAndRemoveOperationalPolicies() { + public void testAddAndRemoveOperationalPolicies() throws IOException { saveTestLoopToDb(); PolicyModel policyModel = new PolicyModel("testPolicyModel", - "tosca_definitions_version: tosca_simple_yaml_1_0_0","1.0.0"); + null, "1.0.0"); policyModelsService.saveOrUpdatePolicyModel(policyModel); loopController.addOperationalPolicy(EXAMPLE_LOOP_NAME, "testPolicyModel", "1.0.0"); @@ -169,7 +169,7 @@ public class LoopControllerTestItCase { Loop newLoop = loopController.getLoop(EXAMPLE_LOOP_NAME); Set<OperationalPolicy> opPolicyList = newLoop.getOperationalPolicies(); assertThat(opPolicyList.size()).isEqualTo(1); - for(OperationalPolicy policy : opPolicyList) { + for (OperationalPolicy policy : opPolicyList) { assertThat(policy.getName().contains("OPERATIONAL_serviceName")).isTrue(); assertThat(policy.getPolicyModel().getPolicyModelType()).isEqualTo("testPolicyModel"); assertThat(policy.getPolicyModel().getVersion()).isEqualTo("1.0.0"); diff --git a/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java b/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java index 89d3e6172..1c9b10189 100644 --- a/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java +++ b/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java @@ -28,7 +28,6 @@ import static org.assertj.core.api.Assertions.assertThat; import com.google.gson.Gson; import com.google.gson.JsonObject; import java.io.IOException; -import java.util.HashSet; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.junit.Test; @@ -265,9 +264,12 @@ public class PolicyComponentTest { loopTest.addMicroServicePolicy(microServicePolicy); PolicyModel policyModel2 = new PolicyModel("onap.policies.controlloop.Operational", null, "1.0.0"); - OperationalPolicy opPolicy = new OperationalPolicy("opPolicy", loopTest, - new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class), policyModel2, null, "pdpGroup2", - "pdpSubgroup2"); + OperationalPolicy opPolicy = + new OperationalPolicy("opPolicy", new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class), + new Gson().fromJson("{\"jsonschema\":\"schema\"}", JsonObject.class), policyModel2, null, + "pdpGroup2", + "pdpSubgroup2"); + loopTest.addOperationalPolicy(opPolicy); LoopTemplate loopTemplate = new LoopTemplate("test", "yaml", "svg", 1, null); diff --git a/src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java b/src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java index ea1218206..01e2184a7 100644 --- a/src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java +++ b/src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java @@ -37,7 +37,7 @@ public class MicroServicePayloadTest { public void testPayloadConstruction() throws IOException { MicroServicePolicy policy = new MicroServicePolicy("testPolicy", new PolicyModel( "onap.policies.monitoring.cdap.tca.hi.lo.app", - ResourceFileUtil.getResourceAsString("tosca/tosca_example.yaml"),"1.0.0"), false, null); + ResourceFileUtil.getResourceAsString("tosca/tosca_example.yaml"),"1.0.0"), false,null,null, null,null); policy.setConfigurationsJson(JsonUtils.GSON.fromJson( ResourceFileUtil.getResourceAsString("tosca/micro-service-policy-properties.json"), JsonObject.class)); JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/micro-service-policy-payload.json"), diff --git a/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java b/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java index 4b8eee921..58a432d34 100644 --- a/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java +++ b/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java @@ -42,8 +42,8 @@ public class OperationalPolicyPayloadTest { public void testOperationalPolicyLegacyPayloadConstruction() throws IOException { JsonObject jsonConfig = new GsonBuilder().create().fromJson( ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class); - OperationalPolicy policy = new OperationalPolicy("testPolicy.legacy", null, jsonConfig, - new PolicyModel("onap.policies.controlloop.Operational.legacy","","1.0.0","test"), null,null,null); + OperationalPolicy policy = new OperationalPolicy("testPolicy.legacy", jsonConfig, null, + new PolicyModel("onap.policies.controlloop.Operational.legacy", "", "1.0.0", "test"), null, null, null); assertThat(policy.createPolicyPayloadYaml()) .isEqualTo(ResourceFileUtil.getResourceAsString("tosca/operational-policy-payload.yaml")); @@ -65,7 +65,7 @@ public class OperationalPolicyPayloadTest { JsonObject jsonConfig = new GsonBuilder().create().fromJson( ResourceFileUtil.getResourceAsString("tosca/operational-policy-no-guard-properties.json"), JsonObject.class); - OperationalPolicy policy = new OperationalPolicy("testPolicy", null, jsonConfig, null, null, null, null); + OperationalPolicy policy = new OperationalPolicy("testPolicy", jsonConfig, null, null, null, null, null); Map<String, String> guardsMap = policy.createGuardPolicyPayloads(); assertThat(guardsMap).isEmpty(); assertThat(guardsMap.entrySet()).isEmpty(); @@ -75,7 +75,7 @@ public class OperationalPolicyPayloadTest { public void testGuardPolicyPayloadConstruction() throws IOException { JsonObject jsonConfig = new GsonBuilder().create().fromJson( ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class); - OperationalPolicy policy = new OperationalPolicy("testPolicy", null, jsonConfig, null, null, null, null); + OperationalPolicy policy = new OperationalPolicy("testPolicy", jsonConfig, null, null, null, null, null); Map<String, String> guardsMap = policy.createGuardPolicyPayloads(); diff --git a/src/test/java/org/onap/clamp/util/SemanticVersioningTest.java b/src/test/java/org/onap/clamp/util/SemanticVersioningTest.java index e018f0952..88f2bbe1b 100644 --- a/src/test/java/org/onap/clamp/util/SemanticVersioningTest.java +++ b/src/test/java/org/onap/clamp/util/SemanticVersioningTest.java @@ -23,12 +23,15 @@ package org.onap.clamp.util; -import org.junit.Test; - import static org.assertj.core.api.Assertions.assertThat; +import org.junit.Test; + public class SemanticVersioningTest { + /** + * compare test. + */ @Test public void compareTest() { assertThat(SemanticVersioning.compare("1.0.0", "2.0.0")).isEqualTo(-1); @@ -53,6 +56,9 @@ public class SemanticVersioningTest { assertThat(SemanticVersioning.compare("1.2", "1")).isEqualTo(1); } + /** + * Compare test. + */ @Test public void compareEqualsTest() { assertThat(SemanticVersioning.compare("1.0.0", "1.0.0")).isEqualTo(0); @@ -62,6 +68,9 @@ public class SemanticVersioningTest { } + /** + * Compare with null. + */ @Test public void compareNullTest() { assertThat(SemanticVersioning.compare(null, null)).isEqualTo(0); @@ -69,6 +78,9 @@ public class SemanticVersioningTest { assertThat(SemanticVersioning.compare("1.0", null)).isEqualTo(1); } + /** + * Increment major version test. + */ @Test public void incrementVersionTest() { assertThat(SemanticVersioning.incrementMajorVersion("1.0")).isEqualTo("2.0.0"); diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 0e453535c..ea17836a0 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -168,4 +168,6 @@ clamp.config.cds.userName=ccsdkapps clamp.config.cds.password=ccsdkapps ## Tosca converter -clamp.config.tosca.converter.templates=classpath:/clds/tosca_updates/templates.json
\ No newline at end of file +clamp.config.tosca.converter.json.schema.templates=classpath:/clds/tosca-converter/templates.json +clamp.config.tosca.converter.default.datatypes=classpath:/clds/tosca-converter/default-tosca-types.yaml +clamp.config.tosca.converter.dictionary.support.enabled=true
\ No newline at end of file diff --git a/src/test/resources/clds/camel/rest/clamp-api-v2.xml b/src/test/resources/clds/camel/rest/clamp-api-v2.xml deleted file mode 100644 index b0a8d2fd7..000000000 --- a/src/test/resources/clds/camel/rest/clamp-api-v2.xml +++ /dev/null @@ -1,984 +0,0 @@ -<rests xmlns="http://camel.apache.org/schema/spring"> - <rest> - <get uri="/v2/loop/getAllNames" outType="java.lang.String[]" - produces="application/json"> - <route> - <removeHeaders pattern="*" /> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Loop')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" /> - <to - uri="bean:org.onap.clamp.loop.LoopController?method=getLoopNames()" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </get> - <get uri="/v2/loop/{loopName}" outType="org.onap.clamp.loop.Loop" - produces="application/json"> - <route> - <removeHeaders pattern="*" excludePattern="loopName" /> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET Loop')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" /> - <to - uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </get> - <get uri="/v2/loop/svgRepresentation/{loopName}" - outType="java.lang.String" produces="application/xml"> - <route> - <removeHeaders pattern="*" excludePattern="loopName" /> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Get SVG Representation')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" /> - <to - uri="bean:org.onap.clamp.loop.LoopController?method=getSvgRepresentation(${header.loopName})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </get> - - <post uri="/v2/loop/updateGlobalProperties/{loopName}" - type="com.google.gson.JsonObject" consumes="application/json" - outType="org.onap.clamp.loop.Loop" produces="application/json"> - <route> - <removeHeaders pattern="*" excludePattern="loopName" /> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Update the global properties')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" /> - <setHeader headerName="GlobalPropertiesJson"> - <simple>${body}</simple> - </setHeader> - <to uri="direct:load-loop" /> - <to - uri="bean:org.onap.clamp.loop.LoopController?method=updateGlobalPropertiesJson(${header.loopName},${header.GlobalPropertiesJson})" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Global Properties UPDATED','INFO',${exchangeProperty[loopObject]})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </post> - <post uri="/v2/loop/updateOperationalPolicies/{loopName}" - type="com.google.gson.JsonArray" consumes="application/json" - outType="org.onap.clamp.loop.Loop" produces="application/json"> - <route> - <removeHeaders pattern="*" excludePattern="loopName" /> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Update operational policies')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" /> - <setHeader headerName="OperationalPoliciesArray"> - <simple>${body}</simple> - </setHeader> - <to uri="direct:load-loop" /> - <to - uri="bean:org.onap.clamp.loop.LoopController?method=updateOperationalPolicies(${header.loopName},${header.OperationalPoliciesArray})" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Operational and Guard policies UPDATED','INFO',${exchangeProperty[loopObject]})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </post> - <post uri="/v2/loop/updateMicroservicePolicy/{loopName}" - type="org.onap.clamp.policy.microservice.MicroServicePolicy" - consumes="application/json" - outType="org.onap.clamp.policy.microservice.MicroServicePolicy" - produces="application/json"> - <route> - <removeHeaders pattern="*" excludePattern="loopName" /> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Update Microservice policies')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" /> - <setProperty propertyName="MicroServicePolicyObject"> - <simple>${body}</simple> - </setProperty> - - <to uri="direct:load-loop" /> - <to - uri="bean:org.onap.clamp.loop.LoopController?method=updateMicroservicePolicy(${header.loopName},${exchangeProperty[MicroServicePolicyObject]})" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Micro Service policies UPDATED','INFO',${exchangeProperty[loopObject]})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </post> - <put uri="/v2/loop/deploy/{loopName}" - outType="org.onap.clamp.loop.Loop" produces="application/json"> - <route> - <removeHeaders pattern="*" excludePattern="loopName" /> - <doTry> - <log loggingLevel="INFO" - message="DCAE DEPLOY request for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'DCAE DEPLOY request')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" /> - <to uri="direct:load-loop" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DCAE DEPLOY request','INFO',${exchangeProperty[loopObject]})" /> - - <to uri="direct:deploy-loop" /> - - <log loggingLevel="INFO" - message="DEPLOY request successfully executed for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DEPLOY request successfully executed','INFO',${exchangeProperty[loopObject]})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - <log loggingLevel="ERROR" - message="DEPLOY request failed for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DEPLOY request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> - </doCatch> - </doTry> - </route> - </put> - <put - uri="/v2/loop/refreshOpPolicyJsonSchema/{loopName}" - outType="org.onap.clamp.loop.Loop" - produces="application/json"> - <route> - <removeHeaders - pattern="*" - excludePattern="loopName" /> - <doTry> - <log - loggingLevel="INFO" - message="Refresh Operational Policy UI for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'REFRESH OP Policy UI request')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" /> - <to uri="direct:load-loop" /> - <to - uri="bean:org.onap.clamp.loop.LoopController?method=refreshOpPolicyJsonRepresentation(${header.loopName})" /> - <log - loggingLevel="INFO" - message="REFRESH request successfully executed for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('REFRESH request successfully executed','INFO',${exchangeProperty[loopObject]})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - <log - loggingLevel="ERROR" - message="REFRESH request failed for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('REFRESH request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> - </doCatch> - </doTry> - </route> - </put> - <put - uri="/v2/loop/undeploy/{loopName}" - outType="org.onap.clamp.loop.Loop" - produces="application/json"> - <route> - <removeHeaders pattern="*" excludePattern="loopName" /> - <doTry> - <log loggingLevel="INFO" - message="DCAE UNDEPLOY request for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'DCAE UNDEPLOY request')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" /> - <to uri="direct:load-loop" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DCAE UNDEPLOY request','INFO',${exchangeProperty[loopObject]})" /> - <to uri="direct:undeploy-loop" /> - - <log loggingLevel="INFO" - message="UNDEPLOY request successfully executed for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('UNDEPLOY request successfully executed','INFO',${exchangeProperty[loopObject]})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - <log loggingLevel="ERROR" - message="UNDEPLOY request failed for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('UNDEPLOY request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> - </doCatch> - </doTry> - </route> - </put> - <put uri="/v2/loop/stop/{loopName}" - outType="org.onap.clamp.loop.Loop" produces="application/json"> - <route> - <removeHeaders pattern="*" excludePattern="loopName" /> - <doTry> - <log loggingLevel="INFO" - message="STOP request for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*,'STOP request')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" /> - <to uri="direct:load-loop" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('STOP request','INFO',${exchangeProperty[loopObject]})" /> - - <to uri="direct:remove-all-policy-from-active-pdp-group" /> - <log loggingLevel="INFO" - message="STOP request successfully executed for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('STOP request successfully executed','INFO',${exchangeProperty[loopObject]})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - <log loggingLevel="ERROR" - message="STOP request failed for loop: $${header.loopName}" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('STOP request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> - </doCatch> - </doTry> - </route> - </put> - <put uri="/v2/loop/restart/{loopName}" - outType="org.onap.clamp.loop.Loop" produces="application/json"> - <route> - <removeHeaders pattern="*" excludePattern="loopName" /> - <doTry> - <log loggingLevel="INFO" - message="RESTART request for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*,'RESTART request')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" /> - <to uri="direct:load-loop" /> - - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('RESTART request','INFO',${exchangeProperty[loopObject]})" /> - - <to uri="direct:add-all-to-active-pdp-group" /> - <log loggingLevel="INFO" - message="RESTART request successfully executed for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('RESTART request successfully executed','INFO',${exchangeProperty[loopObject]})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - <log loggingLevel="ERROR" - message="RESTART request failed for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('RESTART request failed, Error reported: ${exception} - Body: ${exception.responseBody}','INFO',${exchangeProperty[loopObject]})" /> - </doCatch> - </doTry> - </route> - </put> - <put uri="/v2/loop/submit/{loopName}" - outType="org.onap.clamp.loop.Loop" produces="application/json"> - <route> - <removeHeaders pattern="*" excludePattern="loopName" /> - <doTry> - <log loggingLevel="INFO" - message="POLICY SUBMIT request for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'POLICY SUBMIT request')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" /> - <to uri="direct:load-loop" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('POLICY SUBMIT request','INFO',${exchangeProperty[loopObject]})" /> - <setProperty propertyName="raiseHttpExceptionFlag"> - <simple resultType="java.lang.Boolean">false</simple> - </setProperty> - <to uri="direct:remove-all-policy-from-active-pdp-group" /> - <log loggingLevel="INFO" - message="Processing all MICRO-SERVICES policies defined in loop ${exchangeProperty[loopObject].getName()}" /> - <split> - <simple>${exchangeProperty[loopObject].getMicroServicePolicies()} - </simple> - <setProperty propertyName="microServicePolicy"> - <simple>${body}</simple> - </setProperty> - <log loggingLevel="INFO" - message="Processing Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}" /> - <setProperty propertyName="raiseHttpExceptionFlag"> - <simple resultType="java.lang.Boolean">false</simple> - </setProperty> - <to uri="direct:delete-micro-service-policy" /> - <to uri="direct:create-micro-service-policy" /> - </split> - <log loggingLevel="INFO" - message="Processing all OPERATIONAL policies defined in loop ${exchangeProperty[loopObject].getName()}" /> - <split> - <simple>${exchangeProperty[loopObject].getOperationalPolicies()} - </simple> - <setProperty propertyName="operationalPolicy"> - <simple>${body}</simple> - </setProperty> - <log loggingLevel="INFO" - message="Processing Operational Policy: ${exchangeProperty[operationalPolicy].getName()}" /> - <setProperty propertyName="raiseHttpExceptionFlag"> - <simple resultType="java.lang.Boolean">false</simple> - </setProperty> - - <to uri="direct:delete-operational-policy" /> - <to uri="direct:create-operational-policy" /> - - <log loggingLevel="INFO" - message="Processing all GUARD policies defined in loop ${exchangeProperty[loopObject].getName()}" /> - <split> - <simple>${exchangeProperty[operationalPolicy].createGuardPolicyPayloads().entrySet()} - </simple> - <setProperty propertyName="guardPolicy"> - <simple>${body}</simple> - </setProperty> - <log loggingLevel="INFO" - message="Processing Guard Policy: ${exchangeProperty[guardPolicy].getKey()}" /> - - <setProperty propertyName="raiseHttpExceptionFlag"> - <simple resultType="java.lang.Boolean">false</simple> - </setProperty> - <to uri="direct:delete-guard-policy" /> - <to uri="direct:create-guard-policy" /> - </split> - </split> - - <delay> - <constant>3000</constant> - </delay> - - <to uri="direct:add-all-to-active-pdp-group" /> - - <log loggingLevel="INFO" - message="SUBMIT request successfully executed for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('SUBMIT request successfully executed','INFO',${exchangeProperty[loopObject]})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - <log loggingLevel="ERROR" - message="SUBMIT request failed for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('SUBMIT request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> - </doCatch> - </doTry> - </route> - </put> - <put uri="/v2/loop/delete/{loopName}"> - <route> - <removeHeaders pattern="*" excludePattern="loopName" /> - <doTry> - <log loggingLevel="INFO" - message="DELETE request for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*,'DELETE request')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" /> - <to uri="direct:load-loop" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DELETE request','INFO',${exchangeProperty[loopObject]})" /> - <to uri="direct:undeploy-loop" /> - <to uri="direct:remove-all-policy-from-active-pdp-group" /> - <split> - <simple>${exchangeProperty[loopObject].getMicroServicePolicies()} - </simple> - <setProperty propertyName="microServicePolicy"> - <simple>${body}</simple> - </setProperty> - <log loggingLevel="INFO" - message="Processing Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}" /> - <to uri="direct:delete-micro-service-policy" /> - </split> - - <log loggingLevel="INFO" - message="Processing all OPERATIONAL policies defined in loop ${exchangeProperty[loopObject].getName()}" /> - <split> - <simple>${exchangeProperty[loopObject].getOperationalPolicies()} - </simple> - <setProperty propertyName="operationalPolicy"> - <simple>${body}</simple> - </setProperty> - <log loggingLevel="INFO" - message="Processing Operational Policy: ${exchangeProperty[operationalPolicy].getName()}" /> - <to uri="direct:delete-operational-policy" /> - <log loggingLevel="INFO" - message="Processing all GUARD policies defined in loop ${exchangeProperty[loopObject].getName()}" /> - <split> - <simple>${exchangeProperty[operationalPolicy].createGuardPolicyPayloads().entrySet()} - </simple> - <setProperty propertyName="guardPolicy"> - <simple>${body}</simple> - </setProperty> - <log loggingLevel="INFO" - message="Processing Guard Policy: ${exchangeProperty[guardPolicy].getKey()}" /> - <to uri="direct:delete-guard-policy" /> - </split> - </split> - <to - uri="bean:org.onap.clamp.loop.log.LoopService?method=deleteLoop(${header.loopName})" /> - <log loggingLevel="INFO" - message="DELETE request successfully executed for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DELETE request successfully executed','INFO',${exchangeProperty[loopObject]})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - <log loggingLevel="ERROR" - message="DELETE request failed for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DELETE request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> - </doCatch> - </doTry> - </route> - </put> - <get uri="/v2/loop/getstatus/{loopName}" - outType="org.onap.clamp.loop.Loop" produces="application/json"> - <route> - <removeHeaders pattern="*" excludePattern="loopName" /> - <doTry> - <log loggingLevel="INFO" - message="GET STATUS request for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET STATUS request')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" /> - <to uri="direct:load-loop" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('GET STATUS request','INFO',${exchangeProperty[loopObject]})" /> - <doTry> - <to uri="direct:update-policy-status-for-loop" /> - <to uri="direct:update-dcae-status-for-loop" /> - <to uri="direct:update-loop-state" /> - - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Get Status request successfully executed','INFO',${exchangeProperty[loopObject]})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - </doTry> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - <log loggingLevel="ERROR" - message="Get Status request failed for loop: ${header.loopName}" /> - <to - uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Get Status request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> - </doCatch> - <doFinally> - <setBody> - <simple>${exchangeProperty[loopObject]}</simple> - </setBody> - </doFinally> - </doTry> - </route> - </get> - - <get uri="/v2/dictionary" - outType="org.onap.clamp.tosca.Dictionary" produces="application/json"> - <route> - <removeHeaders pattern="*" /> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Dictionaries')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','read')" /> - <to - uri="bean:org.onap.clamp.tosca.DictionaryService?method=getAllDictionaries()" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </get> - - <get uri="/v2/dictionary/secondary/names" - outType="java.lang.String[]" produces="application/json"> - <route> - <removeHeaders pattern="*" /> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Secondary Dictionary Level Names')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','read')" /> - <to - uri="bean:org.onap.clamp.tosca.DictionaryService?method=getAllSecondaryLevelDictionaryNames()" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </get> - <get uri="/v2/dictionary/{dictionaryName}" - outType="org.onap.clamp.tosca.Dictionary" produces="application/json"> - <route> - <removeHeaders pattern="*" - excludePattern="dictionaryName" /> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Dictionary Elements for a Dictionary Name')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','read')" /> - <to - uri="bean:org.onap.clamp.tosca.DictionaryService?method=getDictionary(${header.dictionaryName})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </get> - <put uri="/v2/dictionary" type="org.onap.clamp.tosca.Dictionary" - outType="org.onap.clamp.tosca.Dictionary" consumes="application/json" - produces="application/json"> - <route> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Add New or Update Dictionary')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','update')" /> - <setProperty propertyName="DictionaryObject"> - <simple>${body}</simple> - </setProperty> - <to - uri="bean:org.onap.clamp.tosca.DictionaryService?method=saveOrUpdateDictionary(${exchangeProperty[DictionaryObject]})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </put> - - <put uri="/v2/dictionary/{name}" - type="org.onap.clamp.tosca.Dictionary" - outType="org.onap.clamp.tosca.Dictionary" consumes="application/json" - produces="application/json"> - <route> - <removeHeaders pattern="*" excludePattern="name" /> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Add New or Update Dictionary Element')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','update')" /> - <setProperty propertyName="DictionaryObject"> - <simple>${body}</simple> - </setProperty> - <to - uri="bean:org.onap.clamp.tosca.DictionaryService?method=saveOrUpdateDictionaryElement(${header.name}, ${exchangeProperty[DictionaryObject]})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </put> - - <delete uri="/v2/dictionary/{name}" produces="application/json"> - <route> - <removeHeaders pattern="*" excludePattern="name" /> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Delete Dictionary')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','update')" /> - <to - uri="bean:org.onap.clamp.tosca.DictionaryService?method=deleteDictionary(${header.name})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </delete> - - <delete uri="/v2/dictionary/{name}/elements/{shortName}" - produces="application/json"> - <route> - <removeHeaders pattern="*" - excludePattern="name|shortName" /> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Delete Dictionary Element')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','update')" /> - <to - uri="bean:org.onap.clamp.tosca.DictionaryService?method=deleteDictionaryElement(${header.name}, ${header.shortName})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </delete> - - <get uri="/v2/policyToscaModels" - outType="org.onap.clamp.loop.template.PolicyModel" - produces="application/json"> - <route> - <removeHeaders pattern="*" /> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Tosca Policy Models')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','read')" /> - <to - uri="bean:org.onap.clamp.loop.template.PolicyModelsService?method=getAllPolicyModels()" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>true</constant> - </handled> - <setHeader headerName="CamelHttpResponseCode"> - <constant>500</constant> - </setHeader> - <transform> - <simple>ERROR: ${exception.message}</simple> - </transform> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </get> - <get uri="/v2/policyToscaModels/{policyModelType}" - outType="org.onap.clamp.loop.template.PolicyModel" - produces="application/json"> - <route> - <removeHeaders pattern="*" - excludePattern="policyModelType" /> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET Tosca Policy Model by Name')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','read')" /> - <to - uri="bean:org.onap.clamp.loop.template.PolicyModelsService?method=getPolicyModelByType(${header.policyModelType})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>true</constant> - </handled> - <setHeader headerName="CamelHttpResponseCode"> - <constant>500</constant> - </setHeader> - <transform> - <simple>ERROR: ${exception.message}</simple> - </transform> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </get> - <get uri="/v2/policyToscaModels/yaml/{policyModelType}" - outType="java.lang.String" produces="application/json"> - <route> - <removeHeaders pattern="*" - excludePattern="policyModelType" /> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET Tosca Policy Model Yaml String by Name')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','read')" /> - <to - uri="bean:org.onap.clamp.loop.template.PolicyModelsService?method=getPolicyModelTosca(${header.policyModelType})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>true</constant> - </handled> - <setHeader headerName="CamelHttpResponseCode"> - <constant>500</constant> - </setHeader> - <transform> - <simple>ERROR: ${exception.message}</simple> - </transform> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </get> - - <put uri="/v2/policyToscaModels/{policyModelType}" - type="java.lang.String" - outType="org.onap.clamp.loop.template.PolicyModel" - consumes="plain/text" produces="application/json"> - <route> - <removeHeaders pattern="*" - excludePattern="policyModelType" /> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Upload New or Update Tosca Policy Model')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','update')" /> - <setProperty propertyName="PolicyModelObject"> - <simple>${body}</simple> - </setProperty> - <to - uri="bean:org.onap.clamp.loop.template.PolicyModelsService?method=saveOrUpdateByPolicyModelType(${header.policyModelType},${exchangeProperty[PolicyModelObject]})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>true</constant> - </handled> - <setHeader headerName="CamelHttpResponseCode"> - <constant>404</constant> - </setHeader> - <transform> - <simple>ERROR: ${exception.message}</simple> - </transform> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </put> - - - <get uri="/v2/templates" - outType="org.onap.clamp.loop.template.LoopTemplate" - produces="application/json"> - <route> - <removeHeaders pattern="*" /> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Templates')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'template','','read')" /> - <to - uri="bean:org.onap.clamp.loop.template.LoopTemplatesService?method=getAllLoopTemplates()" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>true</constant> - </handled> - <setHeader headerName="CamelHttpResponseCode"> - <constant>500</constant> - </setHeader> - <transform> - <simple>ERROR: ${exception.message}</simple> - </transform> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </get> - <get uri="/v2/templates/{templateName}" - outType="org.onap.clamp.loop.template.LoopTemplate" - produces="application/json"> - <route> - <removeHeaders pattern="*" - excludePattern="templateName" /> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET a Template by NAME')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'template','','read')" /> - <to - uri="bean:org.onap.clamp.loop.template.LoopTemplatesService?method=getLoopTemplate(${header.templateName})" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>true</constant> - </handled> - <setHeader headerName="CamelHttpResponseCode"> - <constant>500</constant> - </setHeader> - <transform> - <simple>ERROR: ${exception.message}</simple> - </transform> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </get> - <get uri="/v2/templates/names" outType="java.lang.String[]" - produces="application/json"> - <route> - <removeHeaders pattern="*" /> - <doTry> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Loop Template Names')" /> - <to - uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'template','','read')" /> - <to - uri="bean:org.onap.clamp.loop.template.LoopTemplatesService?method=getLoopTemplateNames()" /> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" /> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> - </doCatch> - </doTry> - </route> - </get> - </rest> -</rests> diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file index 44f55879e..64ba559c1 100644 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file @@ -91,7 +91,7 @@ data_types: description: The resource the operation should be performed on. required: true metadata: - clamp_possible_values: <string:see clamp project for syntax> + clamp_possible_values: test payload: type: map description: Name/value pairs of payload information passed by Policy to the actor @@ -116,7 +116,7 @@ data_types: description: The definition of the operation to be performed. required: true metadata: - clamp_possible_values: <string:see clamp project for syntax> + clamp_possible_values: test timeout: type: integer description: The amount of time for the actor to perform the operation. diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.file index 72897be07..1c082b1ee 100644 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.file +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.file @@ -79,7 +79,7 @@ data_types: description: The resource the operation should be performed on. required: true metadata: - clamp_possible_values: <string:see clamp project for syntax> + clamp_possible_values: test payload: type: map description: Name/value pairs of payload information passed by Policy to the actor @@ -104,7 +104,7 @@ data_types: description: The definition of the operation to be performed. required: true metadata: - clamp_possible_values: <string:see clamp project for syntax> + clamp_possible_values: test timeout: type: integer description: The amount of time for the actor to perform the operation. diff --git a/src/test/resources/tosca/new-converter/tca-with-metadata.json b/src/test/resources/tosca/new-converter/tca-with-metadata.json new file mode 100644 index 000000000..1b95f8c95 --- /dev/null +++ b/src/test/resources/tosca/new-converter/tca-with-metadata.json @@ -0,0 +1,222 @@ +{ + "title": "onap.policies.monitoring.cdap.tca.hi.lo.app", + "type": "object", + "required": [], + "properties": { + "tca_policy": { + "type": "object", + "description": "TCA Policy JSON", + "properties": { + "onap.datatypes.monitoring.tca_policy": { + "title": "onap.datatypes.monitoring.tca_policy", + "type": "object", + "required": [ + "domain", + "metricsPerEventName" + ], + "properties": { + "domain": { + "type": "string", + "description": "Domain name to which TCA needs to be applied", + "default": "measurementsForVfScaling", + "const": "measurementsForVfScaling" + }, + "metricsPerEventName": { + "type": "array", + "description": "Contains eventName and threshold details that need to be applied to given eventName", + "items": { + "title": "onap.datatypes.monitoring.metricsPerEventName", + "type": "object", + "required": [ + "controlLoopSchemaType", + "eventName", + "policyName", + "policyScope", + "policyVersion", + "thresholds", + "context", + "signature" + ], + "properties": { + "controlLoopSchemaType": { + "type": "string", + "description": "Specifies Control Loop Schema Type for the event Name e.g. VNF, VM", + "enum": [ + "VM", + "VNF" + ] + }, + "eventName": { + "type": "string", + "description": "Event name to which thresholds need to be applied" + }, + "policyName": { + "type": "string", + "description": "TCA Policy Scope Name" + }, + "policyScope": { + "type": "string", + "description": "TCA Policy Scope" + }, + "policyVersion": { + "type": "string", + "description": "TCA Policy Scope Version" + }, + "thresholds": { + "type": "array", + "description": "Thresholds associated with eventName", + "items": { + "title": "onap.datatypes.monitoring.thresholds", + "type": "object", + "required": [ + "closedLoopControlName", + "closedLoopEventStatus", + "direction", + "fieldPath", + "severity", + "thresholdValue", + "version" + ], + "properties": { + "closedLoopControlName": { + "type": "string", + "description": "Closed Loop Control Name associated with the threshold" + }, + "closedLoopEventStatus": { + "type": "string", + "description": "Closed Loop Event Status of the threshold", + "enum": [ + "ONSET", + "ABATED" + ] + }, + "direction": { + "type": "string", + "description": "Direction of the threshold", + "enum": [ + "LESS", + "LESS_OR_EQUAL", + "GREATER", + "GREATER_OR_EQUAL", + "EQUAL" + ] + }, + "fieldPath": { + "type": "string", + "description": "Json field Path as per CEF message which needs to be analyzed for TCA", + "enum": [ + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage", + "$.event.measurementsForVfScalingFields.meanRequestLatency", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed", + "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value" + ] + }, + "severity": { + "type": "string", + "description": "Threshold Event Severity", + "enum": [ + "CRITICAL", + "MAJOR", + "MINOR", + "WARNING", + "NORMAL" + ] + }, + "thresholdValue": { + "type": "integer", + "description": "Threshold value for the field Path inside CEF message" + }, + "version": { + "type": "string", + "description": "Version number associated with the threshold" + } + } + } + }, + "context": { + "type": "string", + "description": "TCA Policy Dummy Context", + "enum": [ + "PROD" + ], + "options": { + "enum_titles": [ + "PROD" + ] + } + }, + "signature": { + "title": "onap.datatypes.monitoring.Dummy_Signature", + "type": "object", + "required": [ + "filter_clause" + ], + "properties": { + "filter_clause": { + "type": "qbldr", + "description": "Filter Clause", + "minLength": 1, + "qschema": { + "filters": [ + { + "type": "string", + "minLength": 1, + "id": "alarmCondition", + "label": "alarmCondition", + "operators": [ + "equals" + ] + } + ] + } + } + } + } + } + } + } + } + } + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/tosca/new-converter/tca-with-metadata.yaml b/src/test/resources/tosca/new-converter/tca-with-metadata.yaml new file mode 100644 index 000000000..c0d2a86e0 --- /dev/null +++ b/src/test/resources/tosca/new-converter/tca-with-metadata.yaml @@ -0,0 +1,184 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +policy_types: + onap.policies.Monitoring: + derived_from: tosca.policies.Root + description: a base policy type for all policies that governs monitoring provisioning + onap.policies.monitoring.cdap.tca.hi.lo.app: + derived_from: onap.policies.Monitoring + version: 1.0.0 + properties: + tca_policy: + type: map + description: TCA Policy JSON + entry_schema: + type: onap.datatypes.monitoring.tca_policy + metadata: + policy_model_type: onap.policies.monitoring.cdap.tca.hi.lo.app + acronym: tca + +data_types: + onap.datatypes.monitoring.metricsPerEventName: + derived_from: tosca.datatypes.Root + properties: + controlLoopSchemaType: + type: string + required: true + description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM + constraints: + - valid_values: + - VM + - VNF + eventName: + type: string + required: true + description: Event name to which thresholds need to be applied + policyName: + type: string + required: true + description: TCA Policy Scope Name + policyScope: + type: string + required: true + description: TCA Policy Scope + policyVersion: + type: string + required: true + description: TCA Policy Scope Version + thresholds: + type: list + required: true + description: Thresholds associated with eventName + entry_schema: + type: onap.datatypes.monitoring.thresholds + context: + type: string + required: true + description: TCA Policy Dummy Context + metadata: + clamp_possible_values: "Dictionary:Context" + + signature: + type: onap.datatypes.monitoring.Dummy_Signature + description: Signature + required: true + + onap.datatypes.monitoring.Dummy_Signature: + derived_from: tosca.datatypes.Root + properties: + filter_clause: + type: string + description: Filter Clause + required: true + metadata: + clamp_possible_values: "Dictionary:EventDictionary#Operators" + + onap.datatypes.monitoring.tca_policy: + derived_from: tosca.datatypes.Root + properties: + domain: + type: string + required: true + description: Domain name to which TCA needs to be applied + default: measurementsForVfScaling + constraints: + - equal: measurementsForVfScaling + metricsPerEventName: + type: list + required: true + description: Contains eventName and threshold details that need to be applied to given eventName + entry_schema: + type: onap.datatypes.monitoring.metricsPerEventName + onap.datatypes.monitoring.thresholds: + derived_from: tosca.datatypes.Root + properties: + closedLoopControlName: + type: string + required: true + description: Closed Loop Control Name associated with the threshold + closedLoopEventStatus: + type: string + required: true + description: Closed Loop Event Status of the threshold + constraints: + - valid_values: + - ONSET + - ABATED + direction: + type: string + required: true + description: Direction of the threshold + constraints: + - valid_values: + - LESS + - LESS_OR_EQUAL + - GREATER + - GREATER_OR_EQUAL + - EQUAL + fieldPath: + type: string + required: true + description: Json field Path as per CEF message which needs to be analyzed for TCA + constraints: + - valid_values: + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated + - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle + - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt + - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice + - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq + - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal + - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem + - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait + - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage + - $.event.measurementsForVfScalingFields.meanRequestLatency + - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered + - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached + - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured + - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree + - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed + - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value + severity: + type: string + required: true + description: Threshold Event Severity + constraints: + - valid_values: + - CRITICAL + - MAJOR + - MINOR + - WARNING + - NORMAL + thresholdValue: + type: integer + required: true + description: Threshold value for the field Path inside CEF message + version: + type: string + required: true + description: Version number associated with the threshold |