Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
ba7158ba
Commit
ba7158ba
authored
Nov 08, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrote tests
parent
ad992d3a
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
281 additions
and
227 deletions
+281
-227
default_controller.py
...flask-server/sure_tosca/controllers/default_controller.py
+2
-4
tosca_template_service.py
...flask-server/sure_tosca/service/tosca_template_service.py
+1
-4
swagger.yaml
sure_tosca-flask-server/sure_tosca/swagger/swagger.yaml
+20
-31
test_default_controller.py
...a-flask-server/sure_tosca/test/test_default_controller.py
+258
-188
No files found.
sure_tosca-flask-server/sure_tosca/controllers/default_controller.py
View file @
ba7158ba
...
...
@@ -153,8 +153,7 @@ def get_node_requirements(id, node_name): # noqa: E501
def
get_node_templates
(
id
,
type_name
=
None
,
node_name
=
None
,
has_interfaces
=
None
,
has_properties
=
None
,
has_attributes
=
None
,
has_requirements
=
None
,
has_capabilities
=
None
,
has_artifacts
=
None
,
derived_from
=
None
):
# noqa: E501
has_attributes
=
None
,
has_requirements
=
None
,
has_capabilities
=
None
,
has_artifacts
=
None
):
# noqa: E501
"""get_node_templates
returns nodes templates in topology # noqa: E501
...
...
@@ -185,8 +184,7 @@ def get_node_templates(id, type_name=None, node_name=None, has_interfaces=None,
res
=
tosca_template_service
.
get_node_templates
(
id
,
type_name
=
type_name
,
node_name
=
node_name
,
has_interfaces
=
has_interfaces
,
has_properties
=
has_properties
,
has_attributes
=
has_attributes
,
has_requirements
=
has_requirements
,
has_capabilities
=
has_capabilities
,
has_artifacts
=
has_artifacts
,
derived_from
=
derived_from
)
has_capabilities
=
has_capabilities
,
has_artifacts
=
has_artifacts
)
if
res
:
return
res
return
'Not Found'
,
404
...
...
sure_tosca-flask-server/sure_tosca/service/tosca_template_service.py
View file @
ba7158ba
...
...
@@ -117,7 +117,7 @@ def get_interface_types(id, interface_type=None):
def
get_node_templates
(
id
,
type_name
=
None
,
node_name
=
None
,
has_interfaces
=
None
,
has_properties
=
None
,
has_attributes
=
None
,
has_requirements
=
None
,
has_capabilities
=
None
,
has_artifacts
=
None
,
derived_from
=
None
):
has_requirements
=
None
,
has_capabilities
=
None
,
has_artifacts
=
None
):
if
len
(
node_template_db
)
<=
1
:
tosca_template_model
=
get_tosca_template_model_by_id
(
id
)
object_list
=
tosca_template_model
.
topology_template
.
node_templates
...
...
@@ -147,9 +147,6 @@ def get_node_templates(id, type_name=None, node_name=None, has_interfaces=None,
if
type_name
:
query
=
Query
()
queries
.
append
(
query
.
type
==
type_name
)
if
derived_from
:
query
=
Query
()
queries
.
append
(
query
.
derived_from
==
derived_from
)
if
has_properties
:
query
=
Query
()
prop
=
None
...
...
sure_tosca-flask-server/sure_tosca/swagger/swagger.yaml
View file @
ba7158ba
...
...
@@ -161,7 +161,7 @@ paths:
type
:
"
boolean"
-
name
:
"
type_name"
in
:
"
query"
description
:
"
The
relationship
typ
e"
description
:
"
The
type_nam
e"
required
:
false
type
:
"
string"
-
name
:
"
has_properties"
...
...
@@ -321,11 +321,6 @@ paths:
description
:
"
filter
if
has
artifacts"
required
:
false
type
:
"
boolean"
-
name
:
"
derived_from"
in
:
"
query"
description
:
"
derived
from"
required
:
false
type
:
"
string"
responses
:
200
:
description
:
"
successful
operation"
...
...
@@ -582,7 +577,7 @@ paths:
200
:
description
:
"
successful
operation"
schema
:
$ref
:
"
#/definitions/NodeTemplate
"
type
:
"
string
"
404
:
description
:
"
Not
found"
405
:
...
...
@@ -610,10 +605,12 @@ paths:
200
:
description
:
"
successful
operation"
schema
:
type
:
"
object
"
additionalPropertie
s
:
type
:
"
array
"
item
s
:
type
:
"
object"
properties
:
{}
additionalProperties
:
type
:
"
object"
properties
:
{}
404
:
description
:
"
Not
found"
405
:
...
...
@@ -717,7 +714,8 @@ definitions:
policy_types
:
type
:
"
object"
additionalProperties
:
type
:
"
string"
type
:
"
object"
properties
:
{}
group_types
:
type
:
"
object"
additionalProperties
:
...
...
@@ -732,16 +730,14 @@ definitions:
node_types
:
key
:
"
{}"
policy_types
:
key
:
"
policy_types
"
key
:
"
{}
"
topology_template
:
outputs
:
-
key
:
"
{}"
-
key
:
"
{}"
key
:
"
{}"
substitution_mappings
:
key
:
"
{}"
inputs
:
-
key
:
"
{}"
-
key
:
"
{}"
key
:
"
inputs"
node_templates
:
key
:
requirements
:
...
...
@@ -804,12 +800,9 @@ definitions:
description
:
type
:
"
string"
inputs
:
type
:
"
array"
items
:
type
:
"
object"
additionalProperties
:
type
:
"
object"
properties
:
{}
type
:
"
object"
additionalProperties
:
type
:
"
string"
node_templates
:
type
:
"
object"
additionalProperties
:
...
...
@@ -820,12 +813,10 @@ definitions:
type
:
"
object"
properties
:
{}
outputs
:
type
:
"
array
"
item
s
:
type
:
"
object
"
additionalPropertie
s
:
type
:
"
object"
additionalProperties
:
type
:
"
object"
properties
:
{}
properties
:
{}
groups
:
type
:
"
object"
additionalProperties
:
...
...
@@ -845,13 +836,11 @@ definitions:
properties
:
{}
example
:
outputs
:
-
key
:
"
{}"
-
key
:
"
{}"
key
:
"
{}"
substitution_mappings
:
key
:
"
{}"
inputs
:
-
key
:
"
{}"
-
key
:
"
{}"
key
:
"
inputs"
node_templates
:
key
:
requirements
:
...
...
sure_tosca-flask-server/sure_tosca/test/test_default_controller.py
View file @
ba7158ba
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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