Skip to content
Snippets Groups Projects
Commit c29ba673 authored by carignani's avatar carignani
Browse files

metadata as object (not array), empty sections are not outputted, no version number in filename

parent bd520050
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,7 @@ from docx.text.paragraph import Paragraph
from example import generate_examples_between
BASE_FILENAME = "etsi_nfv_sol001_{}_{}_types.yaml"
BASE_FILENAME = "etsi_nfv_sol001_{}_types.yaml"
TOSCA_VERSION = "tosca_simple_yaml_1_3"
DEFAULT_TOSCA_VERSION = "tosca_simple_yaml_1_3"
SPEC_VERSION = "v2.6.1"
......@@ -27,9 +27,9 @@ MODEL_NAMES = ['vnfd', 'nsd', 'pnfd', 'common']
HDR = '''tosca_definitions_version: {tosca_version}
description: ETSI NFV SOL 001 {model} types definitions version {spec_version}
metadata:
- template_name: etsi_nfv_sol001_{model}_types
- template_name: ETSI_NFV
- template_version: {spec_version}
template_name: etsi_nfv_sol001_{model}_types
template_author: ETSI_NFV
template_version: {spec_version}
imports:
{imports}
......@@ -119,7 +119,7 @@ def tosca_model_info(name, version, imports):
'''
return {
'name': name,
'fn': BASE_FILENAME.format(version.replace(".", "-"), name),
'fn': BASE_FILENAME.format(name),
'fd': None,
'imports': imports,
'buf': StringIO()
......@@ -246,6 +246,7 @@ def gen_tables_btwn(a_id, b_id, content, buf):
fdesc file. Returns the number of written definitions
'''
definitions_count = 0
subsection = None
for idx in range(a_id, b_id):
......@@ -259,10 +260,13 @@ def gen_tables_btwn(a_id, b_id, content, buf):
if isinstance(tmp_elem, Paragraph) and \
is_lvl2_section_hdn(tmp_elem.text):
logging.info(tmp_elem.text)
write_subsection_to_file(tmp_elem.text.split("\t")[1], buf)
definitions_count = definitions_count + 1
subsection = tmp_elem.text.split("\t")[1]
if isinstance(tmp_elem, Table) and is_tosca_def(tmp_elem):
if subsection is not None:
write_subsection_to_file(subsection, buf)
definitions_count = definitions_count + 1
subsection = None
write_table_to_file(tmp_elem, buf)
definitions_count = definitions_count + 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment