blob: 5faafee687703f187ae52cf07fef5a96153fc251 [file] [log] [blame]
Matteo Scandolocb92e162017-10-03 13:12:30 -07001
2{% for m in proto.messages %}
3
Matteo Scandolo9ce18252017-06-22 10:48:25 -07004tosca_definitions_version: tosca_simple_yaml_1_0
5
6node_types:
Matteo Scandolocb92e162017-10-03 13:12:30 -07007
Matteo Scandolo9ce18252017-06-22 10:48:25 -07008 tosca.nodes.{{ m.name }}:
9 derived_from: tosca.nodes.Root
Matteo Scandolo4c14b622017-08-17 12:25:18 -070010 description: {% if m.options.description -%}{{ m.options.description}}{% else%}"An XOS {{ m.name }}"{%- endif %}
Matteo Scandolo485b7132017-06-30 11:46:47 -070011 capabilities:
12 {{ m.name|lower }}:
13 type: tosca.capabilities.xos.{{ m.name }}
Matteo Scandolo9ce18252017-06-22 10:48:25 -070014 properties:
Matteo Scandolod12be212017-07-07 10:44:34 -070015 must-exist:
Matteo Scandolo9ce18252017-06-22 10:48:25 -070016 type: boolean
17 default: false
Matteo Scandolod12be212017-07-07 10:44:34 -070018 description: Allow to reference existing models in TOSCA recipes
Matteo Scandolocb92e162017-10-03 13:12:30 -070019 {% for f in (m.fields + xproto_base_fields(m, proto.message_table)) | sort(attribute='name') %}
Matteo Scandolo485b7132017-06-30 11:46:47 -070020 {%- if not f.link -%}
Matteo Scandolo9ce18252017-06-22 10:48:25 -070021 {{ f.name }}:
Matteo Scandolo485b7132017-06-30 11:46:47 -070022 type: {{ xproto_tosca_field_type(f.type) }}
Matteo Scandolo9ce18252017-06-22 10:48:25 -070023 required: {{ xproto_tosca_required(f.options.null, f.options.blank, f.options.default) }}
24 description: {{ f.options.help_text }}
Matteo Scandolo485b7132017-06-30 11:46:47 -070025 {% endif %}
Matteo Scandolo9ce18252017-06-22 10:48:25 -070026 {%- endfor %}
Matteo Scandolo485b7132017-06-30 11:46:47 -070027
28 {% for l in m.links %}
29 {%- if l.link_type == "manytoone" -%}
30 tosca.relationships.BelongsToOne:
31 derived_from: tosca.relationships.Root
32 valid_target_types: [ tosca.capabilities.xos.{{ l.peer.name }} ]
33 {%- endif%}
34 {%- if l.link_type == "manytomany" -%}
35 tosca.relationships.BelongsToMany:
36 derived_from: tosca.relationships.Root
37 valid_target_types: [ tosca.capabilities.xos.{{ l.peer.name }} ]
38 {%- endif%}
39 {% endfor %}
40
41 tosca.capabilities.xos.{{ m.name }}:
42 derived_from: tosca.capabilities.Root
43 description: {{ m.name }}
Matteo Scandolocb92e162017-10-03 13:12:30 -070044
45+++ {{ m.name }}.yaml
46
47{%- endfor %}
48