diff options
author | sebdet <sebastien.determe@intl.att.com> | 2020-03-04 15:47:39 -0800 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2020-03-09 09:07:45 -0700 |
commit | 2dd4e997c1ccf5dab4dfb7665ce74c0fd1f13e49 (patch) | |
tree | ddea40175352505c75e8eac343587e62c99a49dc /src/main | |
parent | 897a3e004a858ef68d989dad15dde91a69e151a5 (diff) |
Rework tosca converter
New code to convert the Policy Tosca Yaml to Json Schema for the Clamp
UI
Issue-ID: CLAMP-647
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: Id15ddedc1910f6a40bf6e407b34e343e00135571
Diffstat (limited to 'src/main')
8 files changed, 249 insertions, 87 deletions
diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/Extractor.java b/src/main/java/org/onap/clamp/clds/tosca/update/Extractor.java index 032edbaa8..b0bf82780 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/Extractor.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/Extractor.java @@ -23,19 +23,24 @@ package org.onap.clamp.clds.tosca.update; +import java.io.IOException; import java.util.LinkedHashMap; import java.util.Map.Entry; import org.yaml.snakeyaml.Yaml; public class Extractor { - - private LinkedHashMap<String, Component> allItems = new LinkedHashMap<>(); + private LinkedHashMap<String, Component> allItems; private String source; + private String nativeComponent; @SuppressWarnings("unchecked") - public Extractor(String toParse) { + public Extractor(String toParse, String nativeComponent) throws IOException { + this.source = toParse; + this.nativeComponent = nativeComponent; + allItems = new LinkedHashMap<String, Component>(); getAllAsMaps(); + } public LinkedHashMap<String, Component> getAllItems() { @@ -60,10 +65,17 @@ public class Extractor { (LinkedHashMap<String, LinkedHashMap<String, Object>>) contentFile; // Get DataTypes LinkedHashMap<String, Object> dataTypes = file.get("data_types"); + dataTypes = (dataTypes == null) ? (new LinkedHashMap<>()) : dataTypes; // Get Policies : first, get topology and after extract policies from it LinkedHashMap<String, Object> policyTypes = file.get("policy_types"); // Put the policies and datatypes in the same collection dataTypes.putAll(policyTypes); + + Object contentNativeFile = yaml.load(nativeComponent); + LinkedHashMap<String, Object> dataTypesEmbedded = + ((LinkedHashMap<String, LinkedHashMap<String, Object>>) contentNativeFile).get("data_types"); + dataTypes.putAll(dataTypesEmbedded); + parseInComponent(dataTypes); return dataTypes; } diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/ParserToJson.java b/src/main/java/org/onap/clamp/clds/tosca/update/ParserToJson.java index 6da55eaec..7bf629d61 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/ParserToJson.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/ParserToJson.java @@ -45,14 +45,16 @@ public class ParserToJson { * @param nameComponent name components * @return return */ - public JsonObject getJsonProcess(String nameComponent) { - JsonObject glob = this.getGeneralField(matchComponent(nameComponent)); - if (templates.get("object").hasFields("required")) { - glob.add("required", this.getRequirements(nameComponent)); + public JsonObject getJsonProcess(String nameComponent, String typeComponent) { + JsonObject glob = new JsonObject(); + + if (typeComponent.equals("object")) { + glob = this.getFieldAsObject(matchComponent(nameComponent)); } - if (templates.get("object").hasFields("properties")) { - glob.add("properties", this.deploy(nameComponent)); + else { + /*glob = this.getFieldAsArray(matchComponent(nameComponent));*/ } + return glob; } @@ -62,7 +64,7 @@ public class ParserToJson { * @param component the compo * @return a json object */ - public JsonObject getGeneralField(Component component) { + public JsonObject getFieldAsObject(Component component) { JsonObject globalFields = new JsonObject(); if (templates.get("object").hasFields("title")) { @@ -76,6 +78,12 @@ public class ParserToJson { globalFields.addProperty("description", component.getDescription()); } } + if (templates.get("object").hasFields("required")) { + globalFields.add("required", this.getRequirements(component.getName())); + } + if (templates.get("object").hasFields("properties")) { + globalFields.add("properties", this.deploy(component.getName())); + } return globalFields; } @@ -124,7 +132,7 @@ public class ParserToJson { for (Entry<String, Property> property : toParse.getProperties().entrySet()) { if (matchComponent((String) property.getValue().getItems().get("type")) != null) { jsonSchema.add(property.getValue().getName(), - this.getJsonProcess((String) property.getValue().getItems().get("type"))); + this.getJsonProcess((String) property.getValue().getItems().get("type"), "object")); } else { jsonSchema.add(property.getValue().getName(), this.complexParse(property.getValue())); @@ -166,8 +174,11 @@ public class ParserToJson { switch (propertyField) { case "type": if (currentPropertyTemplate.hasFields(propertyField)) { - switch ((String) property.getItems().get(propertyField)) { + String fieldtype = (String) property.getItems().get(propertyField); + switch (fieldtype.toLowerCase()) { case "list": + propertiesInJson.addProperty("type", "array"); + break; case "map": propertiesInJson.addProperty("type", "object"); break; @@ -180,6 +191,9 @@ public class ParserToJson { propertiesInJson.addProperty("type", "string"); propertiesInJson.addProperty("format", "date-time"); break; + case "float": + propertiesInJson.addProperty("type", "number"); + break; case "range": propertiesInJson.addProperty("type", "integer"); if (!checkConstraintPresence(property, "greater_than") @@ -205,16 +219,38 @@ public class ParserToJson { currentPropertyTemplate); 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"); ParserToJson child = new ParserToJson(components, templates); - JsonObject componentAsProperty = - child.getJsonProcess(this.extractSpecificFieldFromMap(property, "entry_schema")); JsonObject propertiesContainer = new JsonObject(); - propertiesContainer - .add(this.extractSpecificFieldFromMap(property, "entry_schema"), componentAsProperty); - if (currentPropertyTemplate.hasFields("properties")) { - propertiesInJson.add("properties", propertiesContainer); + + switch ((String) property.getItems().get("type")) { + case "map": // Get it as an object + JsonObject componentAsProperty = child.getJsonProcess(nameComponent,"object"); + propertiesContainer.add(nameComponent, componentAsProperty); + if (currentPropertyTemplate.hasFields("properties")) { + propertiesInJson.add("properties", propertiesContainer); + } + break; + default://list : get it as an Array + JsonObject componentAsItem = child.getJsonProcess(nameComponent, "object"); + if (currentPropertyTemplate.hasFields("properties")) { + propertiesInJson.add("items", componentAsItem); + } + break; } + + } + // Native cases + else if (property.getItems().get("type").equals("list")) { + JsonObject itemContainer = new JsonObject(); + String valueInEntrySchema = this.extractSpecificFieldFromMap(property, "entry_schema"); + itemContainer.addProperty("type", valueInEntrySchema); + propertiesInJson.add("items", itemContainer); + } + else {//map + // propertiesInJson.add("key?", valueInEntrySchema); } break; default://Each classical field : type, description, default.. @@ -236,8 +272,10 @@ public class ParserToJson { */ public Component matchComponent(String name) { Component correspondingComponent = null; - Collection<Component> listofComponent = components.values(); - for (Component component : listofComponent) { + if (components == null) { + return null; + } + for (Component component : components.values()) { if (component.getName().equals(name)) { correspondingComponent = component; } diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/TemplateManagement.java b/src/main/java/org/onap/clamp/clds/tosca/update/TemplateManagement.java index 4b510cb75..ce5cdb817 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/TemplateManagement.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/TemplateManagement.java @@ -46,9 +46,10 @@ public class TemplateManagement { * @param templateProperties template properties as string * @throws IOException in case of failure */ - public TemplateManagement(String yamlContent, String templateProperties) throws IOException { + public TemplateManagement(String yamlContent, String nativeComponent, String templateProperties) + throws IOException { if (yamlContent != null && !yamlContent.isEmpty()) { - this.extractor = new Extractor(yamlContent); + this.extractor = new Extractor(yamlContent, nativeComponent); this.components = extractor.getAllItems(); this.templates = initializeTemplates(templateProperties); } @@ -155,7 +156,7 @@ public class TemplateManagement { if (parserToJson.matchComponent(componentName) == null) { throw new UnknownComponentException(componentName); } - return parserToJson.getJsonProcess(componentName); + return parserToJson.getJsonProcess(componentName, "object"); } /** diff --git a/src/main/java/org/onap/clamp/policy/Policy.java b/src/main/java/org/onap/clamp/policy/Policy.java index ebeb84fd6..004c450af 100644 --- a/src/main/java/org/onap/clamp/policy/Policy.java +++ b/src/main/java/org/onap/clamp/policy/Policy.java @@ -30,7 +30,7 @@ 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,6 +44,9 @@ 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.TemplateManagement; +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; @@ -284,4 +287,22 @@ public abstract class Policy extends AuditEntity { 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.properties 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 TemplateManagement(policyToscaModel,ResourceFileUtil.getResourceAsString( + "clds/tosca_update/defaultToscaTypes.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")) + .launchTranslation(policyModelType); + } } diff --git a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java index c4037ffb6..96b3a09bd 100644 --- a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java +++ b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.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.HashSet; import java.util.Set; @@ -39,8 +40,7 @@ import javax.persistence.Table; import javax.persistence.Transient; import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDefs; -import org.onap.clamp.clds.tosca.ToscaYamlToJsonConvertor; -import org.onap.clamp.clds.util.JsonUtils; +import org.onap.clamp.clds.tosca.update.UnknownComponentException; import org.onap.clamp.dao.model.jsontype.StringJsonUserType; import org.onap.clamp.loop.Loop; import org.onap.clamp.loop.template.LoopElementModel; @@ -104,9 +104,16 @@ public class MicroServicePolicy extends Policy implements Serializable { * @param shared The flag indicate whether the MicroService is shared */ public MicroServicePolicy(String name, PolicyModel policyModel, Boolean shared, LoopElementModel loopElementModel) { - this(name, policyModel, shared, JsonUtils.GSON_JPA_MODEL - .fromJson(new ToscaYamlToJsonConvertor().parseToscaYaml(policyModel.getPolicyModelTosca(), - policyModel.getPolicyModelType()), JsonObject.class), loopElementModel,null,null); + 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); } /** @@ -116,7 +123,7 @@ public class MicroServicePolicy extends Policy implements Serializable { * @param name The name of the MicroService * @param policyModel The policy model type of the MicroService * @param shared The flag indicate whether the MicroService is - * shared + * shared * @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 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 82cfcf4ef..975674266 100644 --- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java +++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java @@ -44,14 +44,12 @@ import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; -import javax.persistence.JoinColumns; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Transient; import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDefs; -import org.onap.clamp.clds.tosca.ToscaYamlToJsonConvertor; -import org.onap.clamp.clds.util.JsonUtils; +import org.onap.clamp.clds.tosca.update.UnknownComponentException; import org.onap.clamp.dao.model.jsontype.StringJsonUserType; import org.onap.clamp.loop.Loop; import org.onap.clamp.loop.template.LoopElementModel; @@ -119,17 +117,15 @@ public class OperationalPolicy extends Policy implements Serializable { if (isLegacy()) { // Op policy Legacy case LegacyOperationalPolicy.preloadConfiguration(jsonReturned, loop); - this.setJsonRepresentation( - OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(loop.getModelService())); + jsonReturned = + OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(loop.getModelService()); } else { // Generic Case - this.setJsonRepresentation(JsonUtils.GSON - .fromJson(new ToscaYamlToJsonConvertor().parseToscaYaml(policyModel.getPolicyModelTosca(), - policyModel.getPolicyModelType()), JsonObject.class)); + jsonReturned = Policy.generateJsonRepresentationFromToscaModel(policyModel.getPolicyModelTosca(), + policyModel.getPolicyModelType()); } - } catch (JsonSyntaxException | IOException | NullPointerException e) { + } catch (UnknownComponentException | IOException | NullPointerException e) { logger.error("Unable to generate the operational policy Schema ... ", e); - this.setJsonRepresentation(new JsonObject()); } return jsonReturned; } diff --git a/src/main/resources/META-INF/resources/swagger.html b/src/main/resources/META-INF/resources/swagger.html index 9c4c9fff2..62f30005c 100644 --- a/src/main/resources/META-INF/resources/swagger.html +++ b/src/main/resources/META-INF/resources/swagger.html @@ -444,25 +444,25 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </li> <li><a href="#_paths">2. Paths</a> <ul class="sectlevel2"> -<li><a href="#_route61">2.1. GET /v1/healthcheck</a> +<li><a href="#_route92">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="#_route93">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="#_route80">2.3. GET /v2/dictionary</a> <ul class="sectlevel3"> <li><a href="#_responses_3">2.3.1. Responses</a></li> <li><a href="#_produces_3">2.3.2. Produces</a></li> </ul> </li> -<li><a href="#_route51">2.4. PUT /v2/dictionary</a> +<li><a href="#_route82">2.4. PUT /v2/dictionary</a> <ul class="sectlevel3"> <li><a href="#_parameters">2.4.1. Parameters</a></li> <li><a href="#_responses_4">2.4.2. Responses</a></li> @@ -491,7 +491,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_7">2.7.4. Produces</a></li> </ul> </li> -<li><a href="#_route53">2.8. DELETE /v2/dictionary/{name}</a> +<li><a href="#_route84">2.8. DELETE /v2/dictionary/{name}</a> <ul class="sectlevel3"> <li><a href="#_parameters_4">2.8.1. Parameters</a></li> <li><a href="#_responses_8">2.8.2. Responses</a></li> @@ -505,75 +505,75 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_9">2.9.3. Produces</a></li> </ul> </li> -<li><a href="#_route45">2.10. PUT /v2/loop/delete/{loopName}</a> +<li><a href="#_route76">2.10. PUT /v2/loop/delete/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_6">2.10.1. Parameters</a></li> <li><a href="#_responses_10">2.10.2. Responses</a></li> </ul> </li> -<li><a href="#_route39">2.11. PUT /v2/loop/deploy/{loopName}</a> +<li><a href="#_route70">2.11. PUT /v2/loop/deploy/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_7">2.11.1. Parameters</a></li> <li><a href="#_responses_11">2.11.2. Responses</a></li> <li><a href="#_produces_10">2.11.3. Produces</a></li> </ul> </li> -<li><a href="#_route33">2.12. GET /v2/loop/getAllNames</a> +<li><a href="#_route64">2.12. GET /v2/loop/getAllNames</a> <ul class="sectlevel3"> <li><a href="#_responses_12">2.12.1. Responses</a></li> <li><a href="#_produces_11">2.12.2. Produces</a></li> </ul> </li> -<li><a href="#_route46">2.13. GET /v2/loop/getstatus/{loopName}</a> +<li><a href="#_route77">2.13. GET /v2/loop/getstatus/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_8">2.13.1. Parameters</a></li> <li><a href="#_responses_13">2.13.2. Responses</a></li> <li><a href="#_produces_12">2.13.3. Produces</a></li> </ul> </li> -<li><a href="#_route40">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a> +<li><a href="#_route71">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_9">2.14.1. Parameters</a></li> <li><a href="#_responses_14">2.14.2. Responses</a></li> <li><a href="#_produces_13">2.14.3. Produces</a></li> </ul> </li> -<li><a href="#_route43">2.15. PUT /v2/loop/restart/{loopName}</a> +<li><a href="#_route74">2.15. PUT /v2/loop/restart/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_10">2.15.1. Parameters</a></li> <li><a href="#_responses_15">2.15.2. Responses</a></li> <li><a href="#_produces_14">2.15.3. Produces</a></li> </ul> </li> -<li><a href="#_route42">2.16. PUT /v2/loop/stop/{loopName}</a> +<li><a href="#_route73">2.16. PUT /v2/loop/stop/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_11">2.16.1. Parameters</a></li> <li><a href="#_responses_16">2.16.2. Responses</a></li> <li><a href="#_produces_15">2.16.3. Produces</a></li> </ul> </li> -<li><a href="#_route44">2.17. PUT /v2/loop/submit/{loopName}</a> +<li><a href="#_route75">2.17. PUT /v2/loop/submit/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_12">2.17.1. Parameters</a></li> <li><a href="#_responses_17">2.17.2. Responses</a></li> <li><a href="#_produces_16">2.17.3. Produces</a></li> </ul> </li> -<li><a href="#_route35">2.18. GET /v2/loop/svgRepresentation/{loopName}</a> +<li><a href="#_route66">2.18. GET /v2/loop/svgRepresentation/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_13">2.18.1. Parameters</a></li> <li><a href="#_responses_18">2.18.2. Responses</a></li> <li><a href="#_produces_17">2.18.3. Produces</a></li> </ul> </li> -<li><a href="#_route41">2.19. PUT /v2/loop/undeploy/{loopName}</a> +<li><a href="#_route72">2.19. PUT /v2/loop/undeploy/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_14">2.19.1. Parameters</a></li> <li><a href="#_responses_19">2.19.2. Responses</a></li> <li><a href="#_produces_18">2.19.3. Produces</a></li> </ul> </li> -<li><a href="#_route36">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a> +<li><a href="#_route67">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_15">2.20.1. Parameters</a></li> <li><a href="#_responses_20">2.20.2. Responses</a></li> @@ -581,7 +581,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_19">2.20.4. Produces</a></li> </ul> </li> -<li><a href="#_route38">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a> +<li><a href="#_route69">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_16">2.21.1. Parameters</a></li> <li><a href="#_responses_21">2.21.2. Responses</a></li> @@ -589,7 +589,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_20">2.21.4. Produces</a></li> </ul> </li> -<li><a href="#_route37">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a> +<li><a href="#_route68">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_17">2.22.1. Parameters</a></li> <li><a href="#_responses_22">2.22.2. Responses</a></li> @@ -597,14 +597,14 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_21">2.22.4. Produces</a></li> </ul> </li> -<li><a href="#_route34">2.23. GET /v2/loop/{loopName}</a> +<li><a href="#_route65">2.23. GET /v2/loop/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_18">2.23.1. Parameters</a></li> <li><a href="#_responses_23">2.23.2. Responses</a></li> <li><a href="#_produces_22">2.23.3. Produces</a></li> </ul> </li> -<li><a href="#_route56">2.24. GET /v2/policyToscaModels</a> +<li><a href="#_route87">2.24. GET /v2/policyToscaModels</a> <ul class="sectlevel3"> <li><a href="#_responses_24">2.24.1. Responses</a></li> <li><a href="#_produces_23">2.24.2. Produces</a></li> @@ -624,7 +624,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_25">2.26.3. Produces</a></li> </ul> </li> -<li><a href="#_route57">2.27. PUT /v2/policyToscaModels/{policyModelType}</a> +<li><a href="#_route88">2.27. PUT /v2/policyToscaModels/{policyModelType}</a> <ul class="sectlevel3"> <li><a href="#_parameters_21">2.27.1. Parameters</a></li> <li><a href="#_responses_27">2.27.2. Responses</a></li> @@ -632,7 +632,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_26">2.27.4. Produces</a></li> </ul> </li> -<li><a href="#_route60">2.28. GET /v2/templates</a> +<li><a href="#_route91">2.28. GET /v2/templates</a> <ul class="sectlevel3"> <li><a href="#_responses_28">2.28.1. Responses</a></li> <li><a href="#_produces_27">2.28.2. Produces</a></li> @@ -692,7 +692,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <div class="sect2"> <h3 id="_uri_scheme"><a class="anchor" href="#_uri_scheme"></a><a class="link" href="#_uri_scheme">1.2. URI scheme</a></h3> <div class="paragraph"> -<p><em>Host</em> : localhost:39099<br> +<p><em>Host</em> : localhost:40597<br> <em>BasePath</em> : /restservices/clds/<br> <em>Schemes</em> : HTTP</p> </div> @@ -703,7 +703,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <h2 id="_paths"><a class="anchor" href="#_paths"></a><a class="link" href="#_paths">2. Paths</a></h2> <div class="sectionbody"> <div class="sect2"> -<h3 id="_route61"><a class="anchor" href="#_route61"></a><a class="link" href="#_route61">2.1. GET /v1/healthcheck</a></h3> +<h3 id="_route92"><a class="anchor" href="#_route92"></a><a class="link" href="#_route92">2.1. GET /v1/healthcheck</a></h3> <div class="sect3"> <h4 id="_responses"><a class="anchor" href="#_responses"></a><a class="link" href="#_responses">2.1.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -740,7 +740,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route62"><a class="anchor" href="#_route62"></a><a class="link" href="#_route62">2.2. GET /v1/user/getUser</a></h3> +<h3 id="_route93"><a class="anchor" href="#_route93"></a><a class="link" href="#_route93">2.2. GET /v1/user/getUser</a></h3> <div class="sect3"> <h4 id="_responses_2"><a class="anchor" href="#_responses_2"></a><a class="link" href="#_responses_2">2.2.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -774,7 +774,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route49"><a class="anchor" href="#_route49"></a><a class="link" href="#_route49">2.3. GET /v2/dictionary</a></h3> +<h3 id="_route80"><a class="anchor" href="#_route80"></a><a class="link" href="#_route80">2.3. GET /v2/dictionary</a></h3> <div class="sect3"> <h4 id="_responses_3"><a class="anchor" href="#_responses_3"></a><a class="link" href="#_responses_3">2.3.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -811,7 +811,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route51"><a class="anchor" href="#_route51"></a><a class="link" href="#_route51">2.4. PUT /v2/dictionary</a></h3> +<h3 id="_route82"><a class="anchor" href="#_route82"></a><a class="link" href="#_route82">2.4. PUT /v2/dictionary</a></h3> <div class="sect3"> <h4 id="_parameters"><a class="anchor" href="#_parameters"></a><a class="link" href="#_parameters">2.4.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1060,7 +1060,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route53"><a class="anchor" href="#_route53"></a><a class="link" href="#_route53">2.8. DELETE /v2/dictionary/{name}</a></h3> +<h3 id="_route84"><a class="anchor" href="#_route84"></a><a class="link" href="#_route84">2.8. DELETE /v2/dictionary/{name}</a></h3> <div class="sect3"> <h4 id="_parameters_4"><a class="anchor" href="#_parameters_4"></a><a class="link" href="#_parameters_4">2.8.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1184,7 +1184,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route45"><a class="anchor" href="#_route45"></a><a class="link" href="#_route45">2.10. PUT /v2/loop/delete/{loopName}</a></h3> +<h3 id="_route76"><a class="anchor" href="#_route76"></a><a class="link" href="#_route76">2.10. PUT /v2/loop/delete/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_6"><a class="anchor" href="#_parameters_6"></a><a class="link" href="#_parameters_6">2.10.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1233,7 +1233,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route39"><a class="anchor" href="#_route39"></a><a class="link" href="#_route39">2.11. PUT /v2/loop/deploy/{loopName}</a></h3> +<h3 id="_route70"><a class="anchor" href="#_route70"></a><a class="link" href="#_route70">2.11. PUT /v2/loop/deploy/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_7"><a class="anchor" href="#_parameters_7"></a><a class="link" href="#_parameters_7">2.11.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1295,7 +1295,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route33"><a class="anchor" href="#_route33"></a><a class="link" href="#_route33">2.12. GET /v2/loop/getAllNames</a></h3> +<h3 id="_route64"><a class="anchor" href="#_route64"></a><a class="link" href="#_route64">2.12. GET /v2/loop/getAllNames</a></h3> <div class="sect3"> <h4 id="_responses_12"><a class="anchor" href="#_responses_12"></a><a class="link" href="#_responses_12">2.12.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1332,7 +1332,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route46"><a class="anchor" href="#_route46"></a><a class="link" href="#_route46">2.13. GET /v2/loop/getstatus/{loopName}</a></h3> +<h3 id="_route77"><a class="anchor" href="#_route77"></a><a class="link" href="#_route77">2.13. GET /v2/loop/getstatus/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_8"><a class="anchor" href="#_parameters_8"></a><a class="link" href="#_parameters_8">2.13.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1394,7 +1394,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route40"><a class="anchor" href="#_route40"></a><a class="link" href="#_route40">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a></h3> +<h3 id="_route71"><a class="anchor" href="#_route71"></a><a class="link" href="#_route71">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_9"><a class="anchor" href="#_parameters_9"></a><a class="link" href="#_parameters_9">2.14.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1456,7 +1456,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route43"><a class="anchor" href="#_route43"></a><a class="link" href="#_route43">2.15. PUT /v2/loop/restart/{loopName}</a></h3> +<h3 id="_route74"><a class="anchor" href="#_route74"></a><a class="link" href="#_route74">2.15. PUT /v2/loop/restart/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_10"><a class="anchor" href="#_parameters_10"></a><a class="link" href="#_parameters_10">2.15.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1518,7 +1518,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route42"><a class="anchor" href="#_route42"></a><a class="link" href="#_route42">2.16. PUT /v2/loop/stop/{loopName}</a></h3> +<h3 id="_route73"><a class="anchor" href="#_route73"></a><a class="link" href="#_route73">2.16. PUT /v2/loop/stop/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_11"><a class="anchor" href="#_parameters_11"></a><a class="link" href="#_parameters_11">2.16.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1580,7 +1580,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route44"><a class="anchor" href="#_route44"></a><a class="link" href="#_route44">2.17. PUT /v2/loop/submit/{loopName}</a></h3> +<h3 id="_route75"><a class="anchor" href="#_route75"></a><a class="link" href="#_route75">2.17. PUT /v2/loop/submit/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_12"><a class="anchor" href="#_parameters_12"></a><a class="link" href="#_parameters_12">2.17.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1642,7 +1642,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route35"><a class="anchor" href="#_route35"></a><a class="link" href="#_route35">2.18. GET /v2/loop/svgRepresentation/{loopName}</a></h3> +<h3 id="_route66"><a class="anchor" href="#_route66"></a><a class="link" href="#_route66">2.18. GET /v2/loop/svgRepresentation/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_13"><a class="anchor" href="#_parameters_13"></a><a class="link" href="#_parameters_13">2.18.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1704,7 +1704,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route41"><a class="anchor" href="#_route41"></a><a class="link" href="#_route41">2.19. PUT /v2/loop/undeploy/{loopName}</a></h3> +<h3 id="_route72"><a class="anchor" href="#_route72"></a><a class="link" href="#_route72">2.19. PUT /v2/loop/undeploy/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_14"><a class="anchor" href="#_parameters_14"></a><a class="link" href="#_parameters_14">2.19.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1766,7 +1766,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route36"><a class="anchor" href="#_route36"></a><a class="link" href="#_route36">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a></h3> +<h3 id="_route67"><a class="anchor" href="#_route67"></a><a class="link" href="#_route67">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_15"><a class="anchor" href="#_parameters_15"></a><a class="link" href="#_parameters_15">2.20.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1844,7 +1844,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route38"><a class="anchor" href="#_route38"></a><a class="link" href="#_route38">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a></h3> +<h3 id="_route69"><a class="anchor" href="#_route69"></a><a class="link" href="#_route69">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_16"><a class="anchor" href="#_parameters_16"></a><a class="link" href="#_parameters_16">2.21.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1922,7 +1922,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route37"><a class="anchor" href="#_route37"></a><a class="link" href="#_route37">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a></h3> +<h3 id="_route68"><a class="anchor" href="#_route68"></a><a class="link" href="#_route68">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_17"><a class="anchor" href="#_parameters_17"></a><a class="link" href="#_parameters_17">2.22.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2000,7 +2000,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route34"><a class="anchor" href="#_route34"></a><a class="link" href="#_route34">2.23. GET /v2/loop/{loopName}</a></h3> +<h3 id="_route65"><a class="anchor" href="#_route65"></a><a class="link" href="#_route65">2.23. GET /v2/loop/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_18"><a class="anchor" href="#_parameters_18"></a><a class="link" href="#_parameters_18">2.23.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2062,7 +2062,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route56"><a class="anchor" href="#_route56"></a><a class="link" href="#_route56">2.24. GET /v2/policyToscaModels</a></h3> +<h3 id="_route87"><a class="anchor" href="#_route87"></a><a class="link" href="#_route87">2.24. GET /v2/policyToscaModels</a></h3> <div class="sect3"> <h4 id="_responses_24"><a class="anchor" href="#_responses_24"></a><a class="link" href="#_responses_24">2.24.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2223,7 +2223,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route57"><a class="anchor" href="#_route57"></a><a class="link" href="#_route57">2.27. PUT /v2/policyToscaModels/{policyModelType}</a></h3> +<h3 id="_route88"><a class="anchor" href="#_route88"></a><a class="link" href="#_route88">2.27. PUT /v2/policyToscaModels/{policyModelType}</a></h3> <div class="sect3"> <h4 id="_parameters_21"><a class="anchor" href="#_parameters_21"></a><a class="link" href="#_parameters_21">2.27.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2301,7 +2301,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route60"><a class="anchor" href="#_route60"></a><a class="link" href="#_route60">2.28. GET /v2/templates</a></h3> +<h3 id="_route91"><a class="anchor" href="#_route91"></a><a class="link" href="#_route91">2.28. GET /v2/templates</a></h3> <div class="sect3"> <h4 id="_responses_28"><a class="anchor" href="#_responses_28"></a><a class="link" href="#_responses_28">2.28.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -3544,7 +3544,7 @@ 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>pdpSubGroup</strong><br> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>pdpSubgroup</strong><br> <em>optional</em></p></td> <td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> </tr> @@ -3642,7 +3642,7 @@ 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>pdpSubGroup</strong><br> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>pdpSubgroup</strong><br> <em>optional</em></p></td> <td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> </tr> diff --git a/src/main/resources/clds/tosca_update/defaultToscaTypes.yaml b/src/main/resources/clds/tosca_update/defaultToscaTypes.yaml new file mode 100644 index 000000000..a11a73698 --- /dev/null +++ b/src/main/resources/clds/tosca_update/defaultToscaTypes.yaml @@ -0,0 +1,87 @@ +tosca_definitions_version: tosca_simple_yaml_1_1_0 +data_types: + tosca.datatypes.Root: + description: The TOSCA root Data Type all other TOSCA base Data Types derive from + tosca.datatypes.Credential: + derived_from: tosca.datatypes.Root + properties: + protocol: + type: string + required: false + token_type: + type: string + default: password + token: + type: string + keys: + type: map + required: false + entry_schema: + type: string + user: + type: string + required: false + tosca.datatypes.TimeInterval: + derived_from: tosca.datatypes.Root + properties: + start_time: + type: timestamp + required: true + end_time: + type: timestamp + required: true + tosca.datatypes.network.NetworkInfo: + derived_from: tosca.datatypes.Root + properties: + network_name: + type: string + network_id: + type: string + addresses: + type: list + entry_schema: + type: string + tosca.datatypes.network.PortInfo: + derived_from: tosca.datatypes.Root + properties: + port_name: + type: string + port_id: + type: string + network_id: + type: string + mac_address: + type: string + addresses: + type: list + entry_schema: + type: string + # tosca.datatypes.network.PortDef: + # derived_from: integer + # constraints: + # - in_range: [ 1, 65535 ] + # tosca.datatypes.network.PortSpec: + # derived_from: tosca.datatypes.Root + # properties: + # protocol: + # type: string + # required: true + # default: tcp + # constraints: + # - valid_values: [ udp, tcp, igmp ] + # target: + # type: PortDef + # required: false + # target_range: + # type: range + # required: false + # constraints: + # - in_range: [ 1, 65535 ] + # source: + # type: PortDef + # required: false + # source_range: + # type: range + # required: false + # constraints: + # - in_range: [ 1, 65535 ]
\ No newline at end of file |