[CORD-2022] Adding inherited fields to TOSCA definition
Change-Id: I76140526fe9c40980a614213b25b9fe424118bd7
diff --git a/src/tosca/generator.py b/src/tosca/generator.py
index 065170c..12e2442 100644
--- a/src/tosca/generator.py
+++ b/src/tosca/generator.py
@@ -43,8 +43,7 @@
args.output = TOSCA_DEFS_DIR
args.inputs = str(xproto.xproto)
args.target = os.path.join(current_dir, 'xtarget/tosca.xtarget')
- args.write_to_file = 'model'
- args.dest_extension = 'yaml'
+ args.write_to_file = 'target'
XOSGenerator.generate(args)
print "[XOS-TOSCA] Recipes generated in %s" % args.output
except Exception as e:
diff --git a/src/tosca/xtarget/tosca.xtarget b/src/tosca/xtarget/tosca.xtarget
index d162d30..5faafee 100644
--- a/src/tosca/xtarget/tosca.xtarget
+++ b/src/tosca/xtarget/tosca.xtarget
@@ -1,7 +1,10 @@
+
+{% for m in proto.messages %}
+
tosca_definitions_version: tosca_simple_yaml_1_0
node_types:
-{% for m in proto.messages %}
+
tosca.nodes.{{ m.name }}:
derived_from: tosca.nodes.Root
description: {% if m.options.description -%}{{ m.options.description}}{% else%}"An XOS {{ m.name }}"{%- endif %}
@@ -13,7 +16,7 @@
type: boolean
default: false
description: Allow to reference existing models in TOSCA recipes
- {% for f in m.fields %}
+ {% 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) }}
@@ -38,4 +41,8 @@
tosca.capabilities.xos.{{ m.name }}:
derived_from: tosca.capabilities.Root
description: {{ m.name }}
-{%- endfor %}
\ No newline at end of file
+
++++ {{ m.name }}.yaml
+
+{%- endfor %}
+