blob: 19aeb60328bbc1a5987cb211b87d14a8e82864c6 [file] [log] [blame]
{% for m in proto.messages %}
tosca_definitions_version: tosca_simple_yaml_1_0
node_types:
# Example usage:
#
# <node-name>:
# type: tosca.nodes.{{ m.name }}
# properties:
# must-exist: true # optional to reference models created in other recipes
{%- for f in (m.fields + xproto_base_fields(m, proto.message_table)) | sort(attribute='name') %}
{%- if not f.link and xproto_tosca_required(f.options.null, f.options.blank, f.options.default, f.options.modifier) %}
# {{ f.name }}: <value>
{%- endif -%}
{%- endfor %}
tosca.nodes.{{ m.name }}:
derived_from: tosca.nodes.Root
description: {% if m.options.description -%}{{ m.options.description}}{% else%}"An XOS {{ m.name }}"{%- endif %}
capabilities:
{{ m.name|lower }}:
type: tosca.capabilities.xos.{{ m.name }}
properties:
must-exist:
type: boolean
default: false
description: Allow to reference existing models in TOSCA recipes
{% for f in (m.fields + xproto_base_fields(m, proto.message_table)) | sort(attribute='name') %}
{%- if not f.link -%}
{{ f.name }}:
type: {{ xproto_tosca_field_type(f.type) }}
required: {{ xproto_tosca_required(f.options.null, f.options.blank, f.options.default, f.options.modifier) }}
description: {{ f.options.help_text }}
{% endif %}
{%- endfor %}
{% for l in m.links %}
{%- if l.link_type == "manytoone" -%}
# Identify a {{ l.peer.name }} that belongs to a {{ m.name }}
#
# example usage:
# requirements:
# - {{ l.src_port }}:
# node: <node-name>:
# relationship: tosca.relationships.BelongsToOne
tosca.relationships.BelongsToOne:
derived_from: tosca.relationships.Root
valid_target_types: [ tosca.capabilities.xos.{{ l.peer.name }} ]
{%- endif%}
{%- if l.link_type == "manytomany" -%}
tosca.relationships.BelongsToMany:
derived_from: tosca.relationships.Root
valid_target_types: [ tosca.capabilities.xos.{{ l.peer.name }} ]
{%- endif%}
{% endfor %}
tosca.capabilities.xos.{{ m.name }}:
derived_from: tosca.capabilities.Root
description: {{ m.name }}
+++ {{ m.name }}.yaml
{%- endfor %}