diff options
author | shangxdy <shang.xiaodong@zte.com.cn> | 2017-09-26 20:40:39 +0800 |
---|---|---|
committer | shangxdy <shang.xiaodong@zte.com.cn> | 2017-09-26 20:47:53 +0800 |
commit | 000ea52b78b072435f01d67dd799023117e67a2e (patch) | |
tree | 1f14cdb4485e2184904b553b82afd9e7139a18e5 /nfvparser/toscaparser/elements | |
parent | 53065490134870ead778bff590cfd9e43ddd9f77 (diff) |
Sync code from nfv-toscaprser
Currently nfv-toscaparser has published the regular version of 0.5.1
the patch will synchronize the code.
JIRA: MODELING-23
Change-Id: If95579fc366b69b2b14b2e441ff9a3e6807e3820
Signed-off-by: shangxdy <shang.xiaodong@zte.com.cn>
Diffstat (limited to 'nfvparser/toscaparser/elements')
6 files changed, 33 insertions, 8 deletions
diff --git a/nfvparser/toscaparser/elements/TOSCA_definition_1_0.yaml b/nfvparser/toscaparser/elements/TOSCA_definition_1_0.yaml index 9f3369e..57c9bf9 100644 --- a/nfvparser/toscaparser/elements/TOSCA_definition_1_0.yaml +++ b/nfvparser/toscaparser/elements/TOSCA_definition_1_0.yaml @@ -339,6 +339,26 @@ node_types: relationship: tosca.relationships.network.LinksTo node: tosca.nodes.network.Network + tosca.nodes.network.FloatingIP: + derived_from: tosca.nodes.Root + description: > + The TOSCA FloatingIP node represents a floating IP that can associate to a Port. + properties: + floating_network: + type: string + required: true + floating_ip_address: + type: string + required: false + port_id: + type: string + required: false + requirements: + - link: + capability: tosca.capabilities.network.Linkable + relationship: tosca.relationships.network.LinksTo + node: tosca.nodes.network.Port + tosca.nodes.ObjectStorage: derived_from: tosca.nodes.Root description: > @@ -928,6 +948,11 @@ policy_types: description: The TOSCA Policy Type definition that is used to govern scaling of TOSCA nodes or groups of nodes. + tosca.policies.Monitoring: + derived_from: tosca.policies.Root + description: The TOSCA Policy Type definition that is used to govern + monitoring of TOSCA nodes or groups of nodes. + tosca.policies.Update: derived_from: tosca.policies.Root description: The TOSCA Policy Type definition that is used to govern diff --git a/nfvparser/toscaparser/elements/capabilitytype.py b/nfvparser/toscaparser/elements/capabilitytype.py index 5fa9661..23c5afc 100644 --- a/nfvparser/toscaparser/elements/capabilitytype.py +++ b/nfvparser/toscaparser/elements/capabilitytype.py @@ -25,7 +25,7 @@ class CapabilityTypeDef(StatefulEntityType): self.nodetype = ntype self.properties = None self.custom_def = custom_def - if self.PROPERTIES in self.defs: + if self.defs and self.PROPERTIES in self.defs: self.properties = self.defs[self.PROPERTIES] self.parent_capabilities = self._get_parent_capabilities(custom_def) diff --git a/nfvparser/toscaparser/elements/nodetype.py b/nfvparser/toscaparser/elements/nodetype.py index 7f3da2d..4889ed8 100644 --- a/nfvparser/toscaparser/elements/nodetype.py +++ b/nfvparser/toscaparser/elements/nodetype.py @@ -83,8 +83,6 @@ class NodeType(StatefulEntityType): captype = value['capability'] value = (self. _get_node_type_by_cap(captype)) - # _get_node_type_by_cap(key, captype)) - # relation = self._get_relation(key, value) keyword = key node_type = value rtype = RelationshipType(relation, keyword, self.custom_def) diff --git a/nfvparser/toscaparser/elements/policytype.py b/nfvparser/toscaparser/elements/policytype.py index a922d26..82aed0a 100644 --- a/nfvparser/toscaparser/elements/policytype.py +++ b/nfvparser/toscaparser/elements/policytype.py @@ -113,7 +113,7 @@ class PolicyType(StatefulEntityType): for entry_schema, entry_schema_type in meta_data.items(): if isinstance(entry_schema_type, dict) and not \ - entry_schema_type.get('type') == 'string': + entry_schema_type.get('type') == 'string': ExceptionCollector.appendException( InvalidTypeError(what='"%s" defined in policy for ' 'metadata "%s"' diff --git a/nfvparser/toscaparser/elements/statefulentitytype.py b/nfvparser/toscaparser/elements/statefulentitytype.py index 2f221b3..28ee697 100644 --- a/nfvparser/toscaparser/elements/statefulentitytype.py +++ b/nfvparser/toscaparser/elements/statefulentitytype.py @@ -46,7 +46,8 @@ class StatefulEntityType(EntityType): elif custom_def and entitytype in list(custom_def.keys()): self.defs = custom_def[entitytype] else: - self.defs = None + # avoid errors if self.defs = none + self.defs = {} ExceptionCollector.appendException( InvalidTypeError(what=entitytype)) self.type = entitytype diff --git a/nfvparser/toscaparser/elements/tosca_type_validation.py b/nfvparser/toscaparser/elements/tosca_type_validation.py index 82b0b46..89a6a03 100644 --- a/nfvparser/toscaparser/elements/tosca_type_validation.py +++ b/nfvparser/toscaparser/elements/tosca_type_validation.py @@ -23,13 +23,14 @@ class TypeValidation(object): DATA_TYPES, ARTIFACT_TYPES, GROUP_TYPES, RELATIONSHIP_TYPES, CAPABILITY_TYPES, INTERFACE_TYPES, POLICY_TYPES, - TOPOLOGY_TEMPLATE) = \ + TOPOLOGY_TEMPLATE, METADATA) = \ ('tosca_definitions_version', 'description', 'imports', 'dsl_definitions', 'node_types', 'repositories', 'data_types', 'artifact_types', 'group_types', 'relationship_types', 'capability_types', - 'interface_types', 'policy_types', 'topology_template') - VALID_TEMPLATE_VERSIONS = ['tosca_simple_yaml_1_0'] + 'interface_types', 'policy_types', 'topology_template', 'metadata') + VALID_TEMPLATE_VERSIONS = ['tosca_simple_yaml_1_0', + 'tosca_simple_yaml_1_1'] exttools = ExtTools() VALID_TEMPLATE_VERSIONS.extend(exttools.get_versions()) |