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
efd233d6
Commit
efd233d6
authored
3 years ago
by
Miguel Angel Reina Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Bug 261 - Fixes for the imports in nsp and common yaml files
Signed-off-by:
reinaortega
<
miguelangel.reinaortega@etsi.org
>
parent
dfb3933e
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
+36
-12
36 additions, 12 deletions
src/doc2tosca.py
with
36 additions
and
12 deletions
src/doc2tosca.py
+
36
−
12
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
(
...
...
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