Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CTI Tools
tosca2doc
Commits
efd233d6
Commit
efd233d6
authored
Jul 30, 2021
by
Miguel Angel Reina Ortega
Browse files
Bug 261 - Fixes for the imports in nsp and common yaml files
Signed-off-by:
reinaortega
<
miguelangel.reinaortega@etsi.org
>
parent
dfb3933e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/doc2tosca.py
View file @
efd233d6
...
...
@@ -30,7 +30,9 @@ metadata:
template_name: etsi_nfv_sol001_{model}_types
template_author: ETSI_NFV
template_version: {spec_version}
'''
IMPORTS
=
'''
imports:
{imports}
...
...
@@ -113,7 +115,7 @@ def is_tosca_def(table):
match_definition_incipit
(
txt
)
def
tosca_model_info
(
name
,
version
,
imports
):
def
tosca_model_info
(
name
,
version
,
imports
=
None
):
'''
Returns a dictionary to hold information on the model
'''
...
...
@@ -291,25 +293,47 @@ def generate_header(
buf
.
write
(
HDR
.
format
(
tosca_version
=
tosca_version
,
model
=
model_name
,
spec_version
=
spec_version
,
imports
=
imports
))
spec_version
=
spec_version
))
if
imports
is
not
None
:
buf
.
write
(
IMPORTS
.
format
(
imports
=
imports
))
def
init_models
(
yaml_root
,
spec_ver
,
tosc_ver
):
for
model
in
MODEL_NAMES
:
import_stmt
=
'etsi_nfv_sol001_common_types.yaml'
import_common_stmt
=
'etsi_nfv_sol001_common_types.yaml'
import_vnfd_stmt
=
'etsi_nfv_sol001_vnfd_types.yaml'
import_pnfd_stmt
=
'etsi_nfv_sol001_pnfd_types.yaml'
if
yaml_root
!=
'local'
:
import_stmt
=
\
import_
common_
stmt
=
\
'https://forge.etsi.org/rep/nfv/SOL001/raw/{}/{}'
.
format
(
spec_ver
,
import_stmt
spec_ver
,
import_
common_
stmt
)
MODELS
[
model
]
=
tosca_model_info
(
model
,
spec_ver
,
'- '
+
import_stmt
)
import_vnfd_stmt
=
\
'https://forge.etsi.org/rep/nfv/SOL001/raw/{}/{}'
.
format
(
spec_ver
,
import_vnfd_stmt
)
import_pnfd_stmt
=
\
'https://forge.etsi.org/rep/nfv/SOL001/raw/{}/{}'
.
format
(
spec_ver
,
import_pnfd_stmt
)
imports
=
'- '
+
import_common_stmt
if
model
!=
'common'
:
if
model
==
'nsd'
:
imports
=
imports
+
'
\n
'
+
' - '
+
import_vnfd_stmt
+
'
\n
'
+
' - '
+
import_pnfd_stmt
MODELS
[
model
]
=
tosca_model_info
(
model
,
spec_ver
,
imports
)
else
:
MODELS
[
model
]
=
tosca_model_info
(
model
,
spec_ver
)
for
mod
in
MODELS
:
generate_header
(
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment