diff options
author | Pavel Aharoni <pa0916@att.com> | 2017-04-06 18:56:11 +0300 |
---|---|---|
committer | Pavel Aharoni <pa0916@att.com> | 2017-04-06 18:56:11 +0300 |
commit | 9fc2ad8285866c5d45391f9c9f4f49a87a36763a (patch) | |
tree | c36fa770a85d68a5f976051e8c930abb5b1668e3 /jython-tosca-parser | |
parent | 1df0b72a316dcc7f913061706db165d78d2c3a03 (diff) |
[SDC-8] implementing the tosca stubs
Change-Id: Icadc0cc0dadce98e36eaffed0fe551c1387f6f8f
Signed-off-by: Pavel Aharoni <pa0916@att.com>
Diffstat (limited to 'jython-tosca-parser')
21 files changed, 157 insertions, 31 deletions
diff --git a/jython-tosca-parser/pom.xml b/jython-tosca-parser/pom.xml index 7e29249..01507cc 100644 --- a/jython-tosca-parser/pom.xml +++ b/jython-tosca-parser/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.openecomp.sdc.sdc-distribution-client</groupId> <artifactId>sdc-main-distribution-client</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.6-SNAPSHOT</version> </parent> <artifactId>jython-tosca-parser</artifactId> diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java index a6f9868..5a928e0 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java @@ -2,12 +2,15 @@ package org.openecomp.sdc.toscaparser.api; import static com.google.common.collect.ImmutableList.toImmutableList; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; import org.openecomp.sdc.toscaparser.api.elements.StatefulEntityType; +import org.openecomp.sdc.toscaparser.jython.JyCapability; import org.openecomp.sdc.toscaparser.jython.JyEntityTemplate; +import org.openecomp.sdc.toscaparser.jython.JyProperty; import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects.ToStringHelper; @@ -36,17 +39,19 @@ public abstract class EntityTemplate { } public List<Property> getProperties() { - return jyEntityTemplate.getJyProperties() + List<JyProperty> jyProperties = jyEntityTemplate.getJyProperties(); + return jyProperties != null ? jyProperties .stream() .map(Property::new) - .collect(toImmutableList()); + .collect(toImmutableList()) : new ArrayList<>(); } public List<Capability> getCapabilities() { - return jyEntityTemplate.getJyCapabilities() + List<JyCapability> jyCapabilities = jyEntityTemplate.getJyCapabilities(); + return jyCapabilities != null ? jyCapabilities .stream() .map(Capability::new) - .collect(toImmutableList()); + .collect(toImmutableList()) : new ArrayList<>(); } public List<Map<String, Map<String, Object>>> getRequirements() { diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Group.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Group.java index 65f6857..0fa0d9c 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Group.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Group.java @@ -1,10 +1,32 @@ package org.openecomp.sdc.toscaparser.api; +import java.util.List; + import org.openecomp.sdc.toscaparser.jython.JyGroup; +import com.google.common.base.MoreObjects.ToStringHelper; + public class Group extends EntityTemplate { + private final JyGroup jyGroup; + public Group(JyGroup jyGroup) { super(jyGroup); + this.jyGroup = jyGroup; + } + + public List<String> getMembers(){ + return jyGroup.getJyMembers(); } + + public Metadata getMetadata(){ + return jyGroup.getJyMetadata() != null ? new Metadata(jyGroup.getJyMetadata()) : null; + } + + @Override + protected ToStringHelper toStringHelper() { + return super.toStringHelper() + .add("members", getMembers()) + .add("metadata", getMetadata()); + } } diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Metadata.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Metadata.java new file mode 100644 index 0000000..4fa3646 --- /dev/null +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Metadata.java @@ -0,0 +1,28 @@ +package org.openecomp.sdc.toscaparser.api;
+
+import java.util.Map;
+
+import com.google.common.base.MoreObjects;
+
+public class Metadata {
+
+ private final Map<String, Object> metadataMap;
+
+ public Metadata(Map<String, Object> metadataMap) {
+ this.metadataMap = metadataMap;
+ }
+
+ public String getValue(String key) {
+ return !isEmpty() ? String.valueOf(this.metadataMap.get(key)) : null;
+ }
+
+ private boolean isEmpty() {
+ return this.metadataMap == null || this.metadataMap.size() == 0;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("metadataMap", metadataMap).toString();
+ }
+}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/NodeTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/NodeTemplate.java index d8cac9e..3592a69 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/NodeTemplate.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/NodeTemplate.java @@ -1,8 +1,7 @@ package org.openecomp.sdc.toscaparser.api; -import java.util.Map; - import org.openecomp.sdc.toscaparser.jython.JyNodeTemplate; +import org.openecomp.sdc.toscaparser.jython.JySubstitutionMappings; import com.google.common.base.MoreObjects.ToStringHelper; @@ -15,13 +14,19 @@ public class NodeTemplate extends EntityTemplate { this.jyNodeTemplate = jyNodeTemplate; } - public Map<String, String> getMetadata() { - return jyNodeTemplate.getJyMetadata(); + public Metadata getMetadata() { + return jyNodeTemplate.getJyMetadata() != null ? new Metadata(jyNodeTemplate.getJyMetadata()) : null; + } + + public SubstitutionMappings getSubstitutionMappings(){ + JySubstitutionMappings jySubstitutionMappings = jyNodeTemplate.getJySubstitutionMappings(); + return jySubstitutionMappings != null ? new SubstitutionMappings(jySubstitutionMappings) : null; } @Override protected ToStringHelper toStringHelper() { return super.toStringHelper() - .add("metadata", getMetadata()); + .add("metadata", getMetadata()) + .add("substitutionMappings", getSubstitutionMappings()); } } diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/SubstitutionMappings.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/SubstitutionMappings.java index 526a0e3..30de2a8 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/SubstitutionMappings.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/SubstitutionMappings.java @@ -2,12 +2,15 @@ package org.openecomp.sdc.toscaparser.api; import static com.google.common.collect.ImmutableList.toImmutableList; +import java.util.ArrayList; import java.util.List; import java.util.Objects; import org.openecomp.sdc.toscaparser.api.elements.NodeType; import org.openecomp.sdc.toscaparser.api.parameters.Input; +import org.openecomp.sdc.toscaparser.jython.JyGroup; import org.openecomp.sdc.toscaparser.jython.JySubstitutionMappings; +import org.openecomp.sdc.toscaparser.jython.parameters.JyInput; import com.google.common.base.MoreObjects; @@ -25,12 +28,21 @@ public class SubstitutionMappings { .map(NodeTemplate::new) .collect(toImmutableList()); } + + public List<Group> getGroups() { + List<JyGroup> jyGroups = jySubstitutionMappings.getJyGroups(); + return jyGroups != null ? jyGroups + .stream() + .map(Group::new) + .collect(toImmutableList()) : new ArrayList<>(); + } public List<Input> getInputs() { - return jySubstitutionMappings.getJyInputs() + List<JyInput> jyInputs = jySubstitutionMappings.getJyInputs(); + return jyInputs != null ? jyInputs .stream() .map(Input::new) - .collect(toImmutableList()); + .collect(toImmutableList()) : new ArrayList<>(); } public NodeType getNodeDefinition() { diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java index 5c9db48..0d0dd10 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java @@ -2,13 +2,17 @@ package org.openecomp.sdc.toscaparser.api; import static com.google.common.collect.ImmutableList.toImmutableList; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; import org.openecomp.sdc.toscaparser.api.parameters.Input; +import org.openecomp.sdc.toscaparser.jython.JyGroup; +import org.openecomp.sdc.toscaparser.jython.JyNodeTemplate; import org.openecomp.sdc.toscaparser.jython.JySubstitutionMappings; import org.openecomp.sdc.toscaparser.jython.JyTopologyTemplate; +import org.openecomp.sdc.toscaparser.jython.parameters.JyInput; import com.google.common.base.MoreObjects; @@ -25,24 +29,27 @@ public class TopologyTemplate { } public List<NodeTemplate> getNodeTemplates() { - return jyTopologyTemplate.getJyNodeTemplates() + List<JyNodeTemplate> jyNodeTemplates = jyTopologyTemplate.getJyNodeTemplates(); + return jyNodeTemplates != null ? jyNodeTemplates .stream() .map(NodeTemplate::new) - .collect(toImmutableList()); + .collect(toImmutableList()) : new ArrayList<>(); } public List<Input> getInputs() { - return jyTopologyTemplate.getJyInputs() + List<JyInput> jyInputs = jyTopologyTemplate.getJyInputs(); + return jyInputs != null ? jyInputs .stream() .map(Input::new) - .collect(toImmutableList()); + .collect(toImmutableList()) : new ArrayList<>(); } public List<Group> getGroups() { - return jyTopologyTemplate.getJyGroups() + List<JyGroup> jyGroups = jyTopologyTemplate.getJyGroups(); + return jyGroups != null ? jyGroups .stream() .map(Group::new) - .collect(toImmutableList()); + .collect(toImmutableList()) : new ArrayList<>(); } public SubstitutionMappings getSubstitutionMappings() { @@ -50,7 +57,7 @@ public class TopologyTemplate { return jySubstitutionMappings != null ? new SubstitutionMappings(jySubstitutionMappings) : null; } - public Map<String, String> getMetadata() { + public Metadata getMetadata() { return jyTopologyTemplate.getJyMetadata(); } diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java index abf1b53..0aaafff 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java @@ -23,6 +23,10 @@ public class ToscaTemplate { public String getVersion() { return jyToscaTemplate.getJyVersion(); } + + public Metadata getMetadata() { + return jyToscaTemplate.getJyMetadata() != null ? new Metadata(jyToscaTemplate.getJyMetadata()) : null; + } public String getDescription() { return jyToscaTemplate.getJyDescription(); @@ -37,7 +41,7 @@ public class ToscaTemplate { } public List<TopologyTemplate> getNestedTopologyTemplates() { - return jyToscaTemplate.getNestedTopologyTemplates() + return jyToscaTemplate.getJyNestedTopologyTemplates() .stream() .map(TopologyTemplate::new) .collect(toImmutableList()); @@ -53,6 +57,7 @@ public class ToscaTemplate { .add("version", getVersion()) .add("description", getDescription()) .add("topologyTemplate", topologyTemplate) + .add("nestedTopologyTemplates", getNestedTopologyTemplates()) .toString(); } }
\ No newline at end of file diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java index 0b9ad7d..2339bb4 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java @@ -22,8 +22,6 @@ public class Input { return jyInput.getJyType(); } - - public boolean isRequired() { return jyInput.isJyRequired(); } @@ -31,6 +29,10 @@ public class Input { public String getDescription() { return jyInput.getJyDescription(); } + + public Object getDefault() { + return jyInput.getJyDefault(); + } @Override public String toString() { @@ -39,6 +41,7 @@ public class Input { .add("type", getType()) .add("required", isRequired()) .add("description", getDescription()) + .add("default", getDefault()) .toString(); } } diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyGroup.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyGroup.java index c155dc6..e12a31e 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyGroup.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyGroup.java @@ -1,5 +1,10 @@ package org.openecomp.sdc.toscaparser.jython; -public interface JyGroup extends JyEntityTemplate { +import java.util.List; +import java.util.Map; +public interface JyGroup extends JyEntityTemplate { + + List<String> getJyMembers(); + Map<String, Object> getJyMetadata(); } diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyNodeTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyNodeTemplate.java index a837137..620cc1c 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyNodeTemplate.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyNodeTemplate.java @@ -4,5 +4,6 @@ import java.util.Map; public interface JyNodeTemplate extends JyEntityTemplate { - Map<String, String> getJyMetadata(); + Map<String, Object> getJyMetadata(); + JySubstitutionMappings getJySubstitutionMappings(); } diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JySubstitutionMappings.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JySubstitutionMappings.java index bd95cdc..1130e8c 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JySubstitutionMappings.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JySubstitutionMappings.java @@ -9,5 +9,6 @@ public interface JySubstitutionMappings { List<JyNodeTemplate> getJyNodeTemplates(); List<JyInput> getJyInputs(); + List<JyGroup> getJyGroups(); JyNodeType getJyNodeDefinition(); } diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyTopologyTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyTopologyTemplate.java index 9cdc38b..d16ef5c 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyTopologyTemplate.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyTopologyTemplate.java @@ -1,8 +1,8 @@ package org.openecomp.sdc.toscaparser.jython; import java.util.List; -import java.util.Map; +import org.openecomp.sdc.toscaparser.api.Metadata; import org.openecomp.sdc.toscaparser.jython.parameters.JyInput; public interface JyTopologyTemplate { @@ -12,5 +12,5 @@ public interface JyTopologyTemplate { List<JyInput> getJyInputs(); List<JyGroup> getJyGroups(); JySubstitutionMappings getJySubstitutionMappings(); - Map<String, String> getJyMetadata(); + Metadata getJyMetadata(); } diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java index 7cba568..a2180c7 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java @@ -1,12 +1,14 @@ package org.openecomp.sdc.toscaparser.jython; import java.util.List; +import java.util.Map; public interface JyToscaTemplate { String getJyVersion(); String getJyDescription(); List<JyNodeTemplate> getJyNodeTemplates(); - List<JyTopologyTemplate> getNestedTopologyTemplates(); + List<JyTopologyTemplate> getJyNestedTopologyTemplates(); JyTopologyTemplate getJyTopologyTemplate(); + Map<String, Object> getJyMetadata(); } diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java index 253805b..c1614ce 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java @@ -4,7 +4,7 @@ public interface JyInput { String getJyName(); String getJyType(); - String getJyDefault(); + Object getJyDefault(); boolean isJyRequired(); String getJyDescription(); } diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/groups.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/groups.py index f1da5b0..cb9c20d 100644 --- a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/groups.py +++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/groups.py @@ -37,6 +37,12 @@ class Group(EntityTemplate, JyGroup): self.member_nodes = member_nodes self._validate_keys() + def getJyMembers(self): + return self.members + + def getJyMetadata(self): + return self.meta_data + @property def members(self): return self.entity_tpl.get('members') diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/nodetemplate.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/nodetemplate.py index ee7622c..fadc8d0 100644 --- a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/nodetemplate.py +++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/nodetemplate.py @@ -61,6 +61,10 @@ class NodeTemplate(EntityTemplate, JyNodeTemplate): def getJyMetadata(self): return self.meta_data + def getJySubstitutionMappings(self): + return self.sub_mapping_tosca_template + + @property def relationships(self): if not self._relationships: diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/parameters.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/parameters.py index 1bb58be..765ccb7 100644 --- a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/parameters.py +++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/parameters.py @@ -44,7 +44,7 @@ class Input(JyInput): return self.name def getJyType(self): - return self.name + return self.type def isJyRequired(self): return self.required @@ -93,7 +93,8 @@ class Input(JyInput): def validate_type(self, input_type): if input_type not in Schema.PROPERTY_TYPES: ExceptionCollector.appendException( - ValueError(_('Invalid type "%s".') % type)) + #ValueError(_('Invalid type "%s".') % type)) + ValueError(_('Invalid type "%s".') % input_type)) # TODO(anyone) Need to test for any built-in datatype not just network # that is, tosca.datatypes.* and not assume tosca.datatypes.network.* diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/substitution_mappings.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/substitution_mappings.py index 859b7a4..9a14f6f 100644 --- a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/substitution_mappings.py +++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/substitution_mappings.py @@ -38,12 +38,13 @@ class SubstitutionMappings(JySubstitutionMappings): OPTIONAL_OUTPUTS = ['tosca_id', 'tosca_name', 'state'] - def __init__(self, sub_mapping_def, nodetemplates, inputs, outputs, + def __init__(self, sub_mapping_def, nodetemplates, inputs, outputs, groups, #ATT sub_mapped_node_template, custom_defs): self.nodetemplates = nodetemplates self.sub_mapping_def = sub_mapping_def self.inputs = inputs or [] self.outputs = outputs or [] + self.groups = groups or [] #ATT self.sub_mapped_node_template = sub_mapped_node_template self.custom_defs = custom_defs or {} self._validate() @@ -57,6 +58,9 @@ class SubstitutionMappings(JySubstitutionMappings): def getJyInputs(self): return self.inputs + def getJyGroups(self): #ATT + return self.groups + def getJyNodeDefinition(self): return self.node_definition diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/topology_template.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/topology_template.py index c56e7b9..a64c561 100644 --- a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/topology_template.py +++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/topology_template.py @@ -146,6 +146,7 @@ class TopologyTemplate(JyTopologyTemplate): self.nodetemplates, self.inputs, self.outputs, + self.groups, #ATT self.sub_mapped_node_template, self.custom_defs) diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/tosca_template.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/tosca_template.py index 6b3ea87..c2c3f36 100644 --- a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/tosca_template.py +++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/tosca_template.py @@ -13,6 +13,7 @@ import logging import os +#import shutil from copy import deepcopy from toscaparser.common.exception import ExceptionCollector @@ -73,6 +74,7 @@ class ToscaTemplate(JyToscaTemplate): self.input_path = None self.path = None self.tpl = None + self.csar_tempdir = None self.nested_tosca_tpls_with_topology = {} self.nested_tosca_templates_with_topology = [] if path: @@ -97,6 +99,7 @@ class ToscaTemplate(JyToscaTemplate): self.parsed_params = parsed_params self._validate_field() self.version = self._tpl_version() + self.metadata = self._tpl_metadata() self.relationship_types = self._tpl_relationship_types() self.description = self._tpl_description() self.topology_template = self._topology_template() @@ -109,12 +112,19 @@ class ToscaTemplate(JyToscaTemplate): self._handle_nested_tosca_templates_with_topology() self.graph = ToscaGraph(self.nodetemplates) + if self.csar_tempdir: + #shutil.rmtree(self.csar_tempdir) + csar_tempdir = None + ExceptionCollector.stop() self.verify_template() def getJyVersion(self): return self.version + def getJyMetadata(self): + return self.metadata + def getJyDescription(self): return self.description @@ -146,6 +156,9 @@ class ToscaTemplate(JyToscaTemplate): def _tpl_version(self): return self.tpl.get(DEFINITION_VERSION) + def _tpl_metadata(self): + return self.tpl.get(METADATA) + def _tpl_description(self): desc = self.tpl.get(DESCRIPTION) if desc: @@ -290,6 +303,7 @@ class ToscaTemplate(JyToscaTemplate): if csar.validate(): csar.decompress() self.a_file = True # the file has been decompressed locally + self.csar_tempdir = csar.temp_dir return os.path.join(csar.temp_dir, csar.get_main_template()) else: ExceptionCollector.appendException( |