blob: f0eb78bf442d530c89787be512428797a7b163a4 [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 Scandolo1fedfae2017-10-09 13:57:00 -07008 # Example usage:
9 #
10 # <node-name>:
11 # type: tosca.nodes.{{ m.name }}
12 # properties:
13 # must-exist: true # optional to reference models created in other recipes
14{%- for f in (m.fields + xproto_base_fields(m, proto.message_table)) | sort(attribute='name') %}
15{%- if not f.link and xproto_tosca_required(f.options.null, f.options.blank, f.options.default) %}
16 # {{ f.name }}: <value>
17{%- endif -%}
18{%- endfor %}
19
20
21
Matteo Scandolo9ce18252017-06-22 10:48:25 -070022 tosca.nodes.{{ m.name }}:
23 derived_from: tosca.nodes.Root
Matteo Scandolo4c14b622017-08-17 12:25:18 -070024 description: {% if m.options.description -%}{{ m.options.description}}{% else%}"An XOS {{ m.name }}"{%- endif %}
Matteo Scandolo485b7132017-06-30 11:46:47 -070025 capabilities:
26 {{ m.name|lower }}:
27 type: tosca.capabilities.xos.{{ m.name }}
Matteo Scandolo9ce18252017-06-22 10:48:25 -070028 properties:
Matteo Scandolod12be212017-07-07 10:44:34 -070029 must-exist:
Matteo Scandolo9ce18252017-06-22 10:48:25 -070030 type: boolean
31 default: false
Matteo Scandolod12be212017-07-07 10:44:34 -070032 description: Allow to reference existing models in TOSCA recipes
Matteo Scandolocb92e162017-10-03 13:12:30 -070033 {% for f in (m.fields + xproto_base_fields(m, proto.message_table)) | sort(attribute='name') %}
Matteo Scandolo485b7132017-06-30 11:46:47 -070034 {%- if not f.link -%}
Matteo Scandolo9ce18252017-06-22 10:48:25 -070035 {{ f.name }}:
Matteo Scandolo485b7132017-06-30 11:46:47 -070036 type: {{ xproto_tosca_field_type(f.type) }}
Matteo Scandolo9ce18252017-06-22 10:48:25 -070037 required: {{ xproto_tosca_required(f.options.null, f.options.blank, f.options.default) }}
38 description: {{ f.options.help_text }}
Matteo Scandolo485b7132017-06-30 11:46:47 -070039 {% endif %}
Matteo Scandolo9ce18252017-06-22 10:48:25 -070040 {%- endfor %}
Matteo Scandolo485b7132017-06-30 11:46:47 -070041
42 {% for l in m.links %}
43 {%- if l.link_type == "manytoone" -%}
Matteo Scandolo1fedfae2017-10-09 13:57:00 -070044
45
46 # Identify a {{ l.peer.name }} that belongs to a {{ m.name }}
47 #
48 # example usage:
49 # requirements:
50 # - {{ l.src_port }}:
51 # node: <node-name>:
52 # relationship: tosca.relationships.BelongsToOne
53
Matteo Scandolo485b7132017-06-30 11:46:47 -070054 tosca.relationships.BelongsToOne:
55 derived_from: tosca.relationships.Root
56 valid_target_types: [ tosca.capabilities.xos.{{ l.peer.name }} ]
57 {%- endif%}
58 {%- if l.link_type == "manytomany" -%}
59 tosca.relationships.BelongsToMany:
60 derived_from: tosca.relationships.Root
61 valid_target_types: [ tosca.capabilities.xos.{{ l.peer.name }} ]
62 {%- endif%}
63 {% endfor %}
64
65 tosca.capabilities.xos.{{ m.name }}:
66 derived_from: tosca.capabilities.Root
67 description: {{ m.name }}
Matteo Scandolocb92e162017-10-03 13:12:30 -070068
69+++ {{ m.name }}.yaml
70
71{%- endfor %}
72