Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tosca2doc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CTI Tools
tosca2doc
Commits
c29ba673
Commit
c29ba673
authored
4 years ago
by
carignani
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/doc2tosca.py
+11
-7
11 additions, 7 deletions
src/doc2tosca.py
with
11 additions
and
7 deletions
src/doc2tosca.py
+
11
−
7
View file @
c29ba673
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment