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
c9b781be
Commit
c9b781be
authored
5 years ago
by
carignani
Browse files
Options
Downloads
Patches
Plain Diff
select import root path
parent
8374ed65
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/doc2tosca.py
+5
-2
5 additions, 2 deletions
src/doc2tosca.py
src/templates/home.html
+6
-0
6 additions, 0 deletions
src/templates/home.html
src/web_app.py
+2
-1
2 additions, 1 deletion
src/web_app.py
with
13 additions
and
3 deletions
src/doc2tosca.py
+
5
−
2
View file @
c9b781be
...
...
@@ -155,7 +155,7 @@ def dump_header(model_name, buf, spec_version=SPEC_VERSION, imports=None):
MODELS
=
{}
def
generate_templates
(
filename
,
spec_version
=
SPEC_VERSION
):
def
generate_templates
(
filename
,
spec_version
=
SPEC_VERSION
,
yaml_root_path
=
'
uri
'
):
'''
Takes a filename or file object and loads the definition into the MODELS dictionary
'''
...
...
@@ -163,9 +163,12 @@ def generate_templates(filename, spec_version=SPEC_VERSION):
print
(
"
Opening
"
+
filename
)
for
mn
in
MODEL_NAMES
:
import_stmt
=
'
etsi_nfv_sol001_common_types.yaml
'
if
yaml_root_path
!=
'
local
'
:
import_stmt
=
'
https://forge.etsi.org/rep/nfv/SOL001/raw/{}/
'
.
format
(
spec_version
)
+
import_stmt
MODELS
[
mn
]
=
tosca_model_info
(
mn
,
'
-
https://forge.etsi.org/rep/nfv/SOL001/raw/{}/etsi_nfv_sol001_common_types.yaml
'
.
format
(
spec_version
)
'
-
'
+
import_stmt
)
try
:
...
...
This diff is collapsed.
Click to expand it.
src/templates/home.html
+
6
−
0
View file @
c9b781be
...
...
@@ -86,6 +86,12 @@ For any other inquiry, contact <a href="mailto:cti_support@etsi.org">ETSI CTI</a
<br
/>
Custom version (overrides the selector):
<input
type=
"text"
name=
"custom-doc-version"
>
<br
/>
Root of import statements:
<select
class=
"form-control form-control-sm"
form=
"doc2tosca-form"
name=
"yaml-root-path"
>
<option
value=
"uri"
>
Forge URL
</option>
<option
value=
"local"
>
Local (no path)
</option>
</select>
<br
/><br
/>
<center>
<input
type=
"submit"
class=
"btn btn-primary"
value=
"Upload"
/>
...
...
This diff is collapsed.
Click to expand it.
src/web_app.py
+
2
−
1
View file @
c9b781be
...
...
@@ -174,6 +174,7 @@ def mk_doc2tosca():
print
(
request
.
form
)
doc_version
=
request
.
form
.
get
(
'
doc-version
'
)
custom_doc_version
=
request
.
form
.
get
(
'
custom-doc-version
'
)
yaml_root_path
=
request
.
form
.
get
(
'
yaml-root-path
'
)
except
:
flash
(
"
Something went wrong :/
"
)
return
redirect
(
"
/tosca-ie
"
)
...
...
@@ -187,7 +188,7 @@ def mk_doc2tosca():
if
custom_doc_version
!=
""
:
doc_version
=
custom_doc_version
try
:
doc2tosca
.
generate_templates
(
sol001_file
,
doc_version
)
doc2tosca
.
generate_templates
(
sol001_file
,
doc_version
,
yaml_root_path
)
except
ValueError
as
e
:
flash
(
str
(
e
))
return
redirect
(
"
/tosca-ie
"
)
...
...
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