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
adf701b9
Commit
adf701b9
authored
Dec 28, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added method to get interface instance with default values
parent
95ab9ebe
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
224 additions
and
23 deletions
+224
-23
ToscaHelper.java
.../main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
+18
-6
ToscaHelperTest.java
...t/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java
+5
-2
DRIPService.java
...er/src/main/java/nl/uva/sne/drip/service/DRIPService.java
+4
-3
workspace.xml
drip-planner/.idea/workspace.xml
+9
-1
CloudStormService.java
...n/java/nl/uva/sne/drip/provisioner/CloudStormService.java
+0
-1
default_controller.py
...flask-server/sure_tosca/controllers/default_controller.py
+42
-2
tosca_helper.py
sure_tosca-flask-server/sure_tosca/service/tosca_helper.py
+10
-7
tosca_template_service.py
...flask-server/sure_tosca/service/tosca_template_service.py
+62
-1
swagger.yaml
sure_tosca-flask-server/sure_tosca/swagger/swagger.yaml
+74
-0
No files found.
drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
View file @
adf701b9
...
@@ -66,10 +66,6 @@ public class ToscaHelper {
...
@@ -66,10 +66,6 @@ public class ToscaHelper {
return
id
;
return
id
;
}
}
// public ToscaHelper(ToscaTemplate toscaTemplate, String sureToscaBasePath) throws JsonProcessingException, IOException, ApiException {
// init(sureToscaBasePath);
// uploadToscaTemplate(toscaTemplate);
// }
private
void
init
(
String
sureToscaBasePath
)
{
private
void
init
(
String
sureToscaBasePath
)
{
Configuration
.
getDefaultApiClient
().
setBasePath
(
sureToscaBasePath
);
Configuration
.
getDefaultApiClient
().
setBasePath
(
sureToscaBasePath
);
api
=
new
DefaultApi
(
Configuration
.
getDefaultApiClient
());
api
=
new
DefaultApi
(
Configuration
.
getDefaultApiClient
());
...
@@ -223,12 +219,28 @@ public class ToscaHelper {
...
@@ -223,12 +219,28 @@ public class ToscaHelper {
return
toscaTemplate
;
return
toscaTemplate
;
}
}
public
NodeTemplateMap
setProvisionerInterfaceInVMTopology
(
NodeTemplateMap
vmTopologyMap
,
Provisioner
provisioner
)
throws
ApiException
{
public
NodeTemplateMap
setProvisionerInterfaceInVMTopology
(
NodeTemplateMap
vmTopologyMap
,
Provisioner
provisioner
,
String
operation
)
throws
ApiException
{
List
<
String
>
toscaInterfaceTypes
=
new
ArrayList
<>();
List
<
String
>
toscaInterfaceTypes
=
new
ArrayList
<>();
toscaInterfaceTypes
.
add
(
provisioner
.
getToscaInterfaceType
());
toscaInterfaceTypes
.
add
(
provisioner
.
getToscaInterfaceType
());
List
<
Map
<
String
,
Object
>>
definitions
=
getProvisionInterfaceDefinitions
(
toscaInterfaceTypes
);
List
<
Map
<
String
,
Object
>>
definitions
=
getProvisionInterfaceDefinitions
(
toscaInterfaceTypes
);
Map
<
String
,
Object
>
definition
=
getBestProvisionInterfaceDefinition
(
definitions
);
Map
<
String
,
Object
>
provisionInterface
=
getProvisionInterfaceInstance
(
definition
,
operation
);
return
null
;
return
null
;
}
}
private
Map
<
String
,
Object
>
getBestProvisionInterfaceDefinition
(
List
<
Map
<
String
,
Object
>>
definitions
)
{
for
(
Map
<
String
,
Object
>
def
:
definitions
)
{
if
(
def
.
containsKey
(
"tosca.interfaces.ARTICONF.CloudsStorm"
))
{
return
def
;
}
}
return
null
;
}
private
Map
<
String
,
Object
>
getProvisionInterfaceInstance
(
Map
<
String
,
Object
>
definition
,
String
operation
)
{
Map
<
String
,
Object
>
provisionInterface
=
new
HashMap
<>();
Map
<
String
,
Object
>
inputs
=
(
Map
<
String
,
Object
>)
definition
.
get
(
"inputs"
);
}
}
}
drip-commons/src/test/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java
View file @
adf701b9
...
@@ -100,7 +100,8 @@ public class ToscaHelperTest {
...
@@ -100,7 +100,8 @@ public class ToscaHelperTest {
}
}
/**
/**
* Test of getSupportedProvisionInterfaceDefinitions method, of class ToscaHelper.
* Test of getSupportedProvisionInterfaceDefinitions method, of class
* ToscaHelper.
*
*
* @throws nl.uva.sne.drip.sure.tosca.client.ApiException
* @throws nl.uva.sne.drip.sure.tosca.client.ApiException
*/
*/
...
@@ -109,7 +110,9 @@ public class ToscaHelperTest {
...
@@ -109,7 +110,9 @@ public class ToscaHelperTest {
if
(
serviceUp
)
{
if
(
serviceUp
)
{
System
.
out
.
println
(
"getProvisionInterfaceDefinitions"
);
System
.
out
.
println
(
"getProvisionInterfaceDefinitions"
);
String
expected
=
"tosca.interfaces.ARTICONF.CloudsStorm"
;
String
expected
=
"tosca.interfaces.ARTICONF.CloudsStorm"
;
List
<
Map
<
String
,
Object
>>
result
=
instance
.
getSupportedProvisionInterfaceDefinitions
();
List
<
String
>
toscaInterfaceTypes
=
new
ArrayList
<>();
toscaInterfaceTypes
.
add
(
expected
);
List
<
Map
<
String
,
Object
>>
result
=
instance
.
getProvisionInterfaceDefinitions
(
toscaInterfaceTypes
);
assertNotNull
(
result
);
assertNotNull
(
result
);
String
key
=
result
.
get
(
0
).
keySet
().
iterator
().
next
();
String
key
=
result
.
get
(
0
).
keySet
().
iterator
().
next
();
// assertEquals(expected, key);
// assertEquals(expected, key);
...
...
drip-manager/src/main/java/nl/uva/sne/drip/service/DRIPService.java
View file @
adf701b9
...
@@ -48,6 +48,7 @@ public class DRIPService {
...
@@ -48,6 +48,7 @@ public class DRIPService {
@Autowired
@Autowired
ProvisionerService
provisionerService
;
ProvisionerService
provisionerService
;
private
static
final
String
OPERATION_PROVISION
=
"provision"
;
private
String
execute
(
ToscaTemplate
toscaTemplate
)
throws
JsonProcessingException
,
ApiException
,
Exception
{
private
String
execute
(
ToscaTemplate
toscaTemplate
)
throws
JsonProcessingException
,
ApiException
,
Exception
{
...
@@ -120,11 +121,11 @@ public class DRIPService {
...
@@ -120,11 +121,11 @@ public class DRIPService {
String
ymlToscaTemplate
=
toscaTemplateService
.
findByID
(
id
);
String
ymlToscaTemplate
=
toscaTemplateService
.
findByID
(
id
);
ToscaTemplate
toscaTemplate
=
toscaTemplateService
.
getYaml2ToscaTemplate
(
ymlToscaTemplate
);
ToscaTemplate
toscaTemplate
=
toscaTemplateService
.
getYaml2ToscaTemplate
(
ymlToscaTemplate
);
toscaTemplate
=
addCredentials
(
toscaTemplate
);
toscaTemplate
=
addCredentials
(
toscaTemplate
);
toscaTemplate
=
addProvisionInterface
(
toscaTemplate
);
toscaTemplate
=
addProvisionInterface
(
toscaTemplate
,
OPERATION_PROVISION
);
return
execute
(
toscaTemplate
);
return
execute
(
toscaTemplate
);
}
}
private
ToscaTemplate
addProvisionInterface
(
ToscaTemplate
toscaTemplate
)
throws
IOException
,
JsonProcessingException
,
ApiException
,
Exception
{
private
ToscaTemplate
addProvisionInterface
(
ToscaTemplate
toscaTemplate
,
String
operation
)
throws
IOException
,
JsonProcessingException
,
ApiException
,
Exception
{
helper
.
uploadToscaTemplate
(
toscaTemplate
);
helper
.
uploadToscaTemplate
(
toscaTemplate
);
List
<
NodeTemplateMap
>
vmTopologies
=
helper
.
getVMTopologyTemplates
();
List
<
NodeTemplateMap
>
vmTopologies
=
helper
.
getVMTopologyTemplates
();
List
<
Provisioner
>
provisioners
=
null
;
List
<
Provisioner
>
provisioners
=
null
;
...
@@ -132,7 +133,7 @@ public class DRIPService {
...
@@ -132,7 +133,7 @@ public class DRIPService {
provisioners
=
provisionerService
.
findAll
();
provisioners
=
provisionerService
.
findAll
();
if
(
provisioners
!=
null
&&
provisioners
.
size
()
>
0
)
{
if
(
provisioners
!=
null
&&
provisioners
.
size
()
>
0
)
{
Provisioner
provisioner
=
getBestProvisioners
(
vmTopologyMap
.
getNodeTemplate
(),
provisioners
);
Provisioner
provisioner
=
getBestProvisioners
(
vmTopologyMap
.
getNodeTemplate
(),
provisioners
);
vmTopologyMap
=
helper
.
setProvisionerInterfaceInVMTopology
(
vmTopologyMap
,
provisioner
);
vmTopologyMap
=
helper
.
setProvisionerInterfaceInVMTopology
(
vmTopologyMap
,
provisioner
,
operation
);
toscaTemplate
=
helper
.
setVMTopologyInToscaTemplate
(
toscaTemplate
,
vmTopologyMap
);
toscaTemplate
=
helper
.
setVMTopologyInToscaTemplate
(
toscaTemplate
,
vmTopologyMap
);
}
}
}
}
...
...
drip-planner/.idea/workspace.xml
View file @
adf701b9
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"e478ccae-5352-4e8e-9efb-3f5cda44e877"
name=
"Default Changelist"
comment=
""
/>
<list
default=
"true"
id=
"e478ccae-5352-4e8e-9efb-3f5cda44e877"
name=
"Default Changelist"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../drip-commons/src/test/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../drip-commons/src/test/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/controllers/default_controller.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/controllers/default_controller.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/service/tosca_helper.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/service/tosca_helper.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/service/tosca_template_service.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/service/tosca_template_service.py"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
...
...
drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java
View file @
adf701b9
...
@@ -159,7 +159,6 @@ class CloudStormService {
...
@@ -159,7 +159,6 @@ class CloudStormService {
}
}
cloudsStormMap
.
put
(
"cloud_storm_vm"
,
cloudsStormVMsList
);
cloudsStormMap
.
put
(
"cloud_storm_vm"
,
cloudsStormVMsList
);
cloudsStormMap
.
put
(
"cloud_storm_subtopologies"
,
cloudsStormSubTopologies
);
cloudsStormMap
.
put
(
"cloud_storm_subtopologies"
,
cloudsStormSubTopologies
);
return
cloudsStormMap
;
return
cloudsStormMap
;
}
}
...
...
sure_tosca-flask-server/sure_tosca/controllers/default_controller.py
View file @
adf701b9
...
@@ -62,6 +62,46 @@ def get_ancestors_requirements(id, node_name): # noqa: E501
...
@@ -62,6 +62,46 @@ def get_ancestors_requirements(id, node_name): # noqa: E501
return
'Not Found'
,
404
return
'Not Found'
,
404
def
get_default_interface
(
id
,
interface_type
,
instance_name
,
operation_name
):
# noqa: E501
"""
returns an interface instance with the default required values. # noqa: E501
:param id: ID of topolog template uplodaed
:type id: str
:param interface_type: type to instantiate
:type interface_type: str
:param instance_name: the name of the instance to retrun
:type instance_name: str
:param operation_name: the name of operation
:type operation_name: str
:rtype: Dict[str, object]
"""
res
=
tosca_template_service
.
get_default_interface
(
id
,
interface_type
,
instance_name
,
operation_name
)
if
res
:
return
res
return
'Not Found'
,
404
def
get_default_node_type
(
id
,
node_type
,
instance_name
):
# noqa: E501
"""
returns an node templaye instance with the default required values. # noqa: E501
:param id: ID of topolog template uplodaed
:type id: str
:param node_type: type to instantiate
:type node_type: str
:param instance_name: the name of tghe instance to retrun
:type instance_name: str
:rtype: NodeTemplateMap
"""
return
'do some magic!'
def
get_dsl_definitions
(
id
,
anchors
=
None
,
derived_from
=
None
):
# noqa: E501
def
get_dsl_definitions
(
id
,
anchors
=
None
,
derived_from
=
None
):
# noqa: E501
"""
"""
...
@@ -153,7 +193,8 @@ def get_node_requirements(id, node_name): # noqa: E501
...
@@ -153,7 +193,8 @@ 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
,
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
):
# noqa: E501
has_attributes
=
None
,
has_requirements
=
None
,
has_capabilities
=
None
,
has_artifacts
=
None
):
# noqa: E501
"""get_node_templates
"""get_node_templates
returns nodes templates in topology # noqa: E501
returns nodes templates in topology # noqa: E501
...
@@ -402,4 +443,3 @@ def get_node_attributes(id, node_name): # noqa: E501
...
@@ -402,4 +443,3 @@ def get_node_attributes(id, node_name): # noqa: E501
if
res
:
if
res
:
return
res
return
res
return
'Not Found'
,
404
return
'Not Found'
,
404
sure_tosca-flask-server/sure_tosca/service/tosca_helper.py
View file @
adf701b9
...
@@ -55,7 +55,7 @@ def get_node_requirements(node):
...
@@ -55,7 +55,7 @@ def get_node_requirements(node):
return
node_requirements
return
node_requirements
def
get_parent_type
(
node
):
def
get_
node_template_
parent_type
(
node
):
if
isinstance
(
node
,
NodeTemplate
):
if
isinstance
(
node
,
NodeTemplate
):
if
node
.
parent_type
:
if
node
.
parent_type
:
parent_type
=
node
.
parent_type
.
type
parent_type
=
node
.
parent_type
.
type
...
@@ -106,9 +106,8 @@ def get_node_types_with_interface(nodes):
...
@@ -106,9 +106,8 @@ def get_node_types_with_interface(nodes):
return
node_types_with_interface
return
node_types_with_interface
def
node_dict_2_node_template
(
node_name
,
node_dict
,
all_custom_def
):
def
node_dict_2_node_template
(
node_name
,
node_dict
,
all_custom_def
):
node_dict
=
{
node_name
:
node_dict
}
node_dict
=
{
node_name
:
node_dict
}
# node_type = node_dict[node_name]['type']
# node_type = node_dict[node_name]['type']
# for name_to_remove in node_type_key_names_to_remove:
# for name_to_remove in node_type_key_names_to_remove:
...
@@ -216,7 +215,7 @@ def get_nodes_by_type(node_type, nodes, all_node_types, all_custom_def):
...
@@ -216,7 +215,7 @@ def get_nodes_by_type(node_type, nodes, all_node_types, all_custom_def):
def
get_all_ancestors_types
(
child_node
,
all_node_types
,
all_custom_def
,
ancestors_types
=
None
):
def
get_all_ancestors_types
(
child_node
,
all_node_types
,
all_custom_def
,
ancestors_types
=
None
):
if
not
ancestors_types
:
if
not
ancestors_types
:
ancestors_types
=
[
get_node_type_name
(
child_node
)]
ancestors_types
=
[
get_node_type_name
(
child_node
)]
parent_type
=
get_parent_type
(
child_node
)
parent_type
=
get_
node_template_
parent_type
(
child_node
)
if
parent_type
:
if
parent_type
:
ancestors_types
.
append
(
parent_type
)
ancestors_types
.
append
(
parent_type
)
parent_type
=
node_type_2_node_template
({
'name'
:
all_node_types
[
parent_type
]},
all_custom_def
)
parent_type
=
node_type_2_node_template
({
'name'
:
all_node_types
[
parent_type
]},
all_custom_def
)
...
@@ -224,7 +223,8 @@ def get_all_ancestors_types(child_node, all_node_types, all_custom_def, ancestor
...
@@ -224,7 +223,8 @@ def get_all_ancestors_types(child_node, all_node_types, all_custom_def, ancestor
return
ancestors_types
return
ancestors_types
def
get_all_ancestors_properties
(
node
,
all_nodes_templates
,
all_custom_def
,
ancestors_properties
=
None
,
ancestors_types
=
None
):
def
get_all_ancestors_properties
(
node
,
all_nodes_templates
,
all_custom_def
,
ancestors_properties
=
None
,
ancestors_types
=
None
):
if
not
ancestors_properties
:
if
not
ancestors_properties
:
ancestors_properties
=
[]
ancestors_properties
=
[]
ancestors_properties_names
=
[]
ancestors_properties_names
=
[]
...
@@ -294,3 +294,6 @@ def get_node_template_dict(node_template):
...
@@ -294,3 +294,6 @@ def get_node_template_dict(node_template):
# print(node_template.templates)
# print(node_template.templates)
return
node_template_dict
return
node_template_dict
sure_tosca-flask-server/sure_tosca/service/tosca_template_service.py
View file @
adf701b9
...
@@ -285,7 +285,7 @@ def get_parent_type_name(id, node_root_key):
...
@@ -285,7 +285,7 @@ def get_parent_type_name(id, node_root_key):
the_node
,
all_node_types
,
all_custom_def
=
node_dict_2_node_template
(
id
,
node_root_key
)
the_node
,
all_node_types
,
all_custom_def
=
node_dict_2_node_template
(
id
,
node_root_key
)
except
Exception
as
e
:
except
Exception
as
e
:
return
None
return
None
return
tosca_helper
.
get_parent_type
(
the_node
)
return
tosca_helper
.
get_
node_template_
parent_type
(
the_node
)
def
get_node_outputs
(
id
,
node_name
):
def
get_node_outputs
(
id
,
node_name
):
...
@@ -385,3 +385,64 @@ def get_types(id, kind_of_type, has_interfaces, type_name, has_properties, has_a
...
@@ -385,3 +385,64 @@ def get_types(id, kind_of_type, has_interfaces, type_name, has_properties, has_a
if
kind_of_type
==
'interface_types'
:
if
kind_of_type
==
'interface_types'
:
return
get_interface_types
(
id
,
interface_type
=
type_name
)
return
get_interface_types
(
id
,
interface_type
=
type_name
)
return
None
return
None
def
get_default_entry_value
(
entry
):
if
'default'
in
entry
and
'required'
in
entry
and
entry
[
'required'
]:
return
entry
[
'default'
]
return
None
def
get_all_interface_types
(
id
,
interface_type
,
parent_interfaces
=
None
):
if
parent_interfaces
is
None
:
parent_interfaces
=
[]
interface
=
get_interface_types
(
id
,
interface_type
=
interface_type
)[
0
]
parent_interfaces
.
append
(
interface
)
if
'derived_from'
in
interface
[
interface_type
]:
return
get_all_interface_types
(
id
,
interface
[
interface_type
][
'derived_from'
],
parent_interfaces
)
else
:
return
parent_interfaces
def
merge_interfaces
(
id
,
interface_type
):
all_interfaces
=
get_all_interface_types
(
id
,
interface_type
=
interface_type
)
if
all_interfaces
is
None
:
return
None
all_inputs
=
{}
all_operations
=
{}
for
interface
in
all_interfaces
:
interface
=
interface
[
next
(
iter
(
interface
))]
if
'inputs'
in
interface
:
all_inputs
.
update
(
interface
[
'inputs'
])
for
op
in
interface
:
if
op
!=
'description'
and
op
!=
'derived_from'
and
op
!=
'inputs'
:
all_operations
[
op
]
=
interface
[
op
]
the_interface
=
{
interface_type
:
all_operations
}
the_interface
[
interface_type
][
'inputs'
]
=
all_inputs
return
the_interface
def
get_default_interface
(
id
,
interface_type
,
instance_name
,
operation_name
):
the_interface
=
merge_interfaces
(
id
,
interface_type
)
if
the_interface
is
None
:
return
None
interface
=
the_interface
[
next
(
iter
(
the_interface
))]
if
operation_name
not
in
interface
:
raise
Exception
(
'Operation: '
+
operation_name
+
' not in interface: '
+
interface_type
+
' definition: '
+
str
(
the_interface
))
inputs
=
interface
[
'inputs'
]
instance_inputs_list
=
[]
for
key
in
inputs
:
default_value
=
get_default_entry_value
(
inputs
[
key
])
default_entry
=
{
key
:
default_value
}
instance_inputs_list
.
append
(
default_entry
)
instance_inputs
=
{
'inputs'
:
instance_inputs_list
}
operation
=
{
operation_name
:
instance_inputs
}
instance
=
{
instance_name
:
operation
}
return
instance
sure_tosca-flask-server/sure_tosca/swagger/swagger.yaml
View file @
adf701b9
...
@@ -126,6 +126,80 @@ paths:
...
@@ -126,6 +126,80 @@ paths:
"
405"
:
"
405"
:
description
:
"
Invalid
input"
description
:
"
Invalid
input"
x-swagger-router-controller
:
"
sure_tosca.controllers.default_controller"
x-swagger-router-controller
:
"
sure_tosca.controllers.default_controller"
/tosca_template/{id}/interface/{interface_type}/defaults
:
get
:
summary
:
"
"
description
:
"
returns
an
interface
instance
with
the
default
required
values."
operationId
:
"
get_default_interface"
produces
:
-
"
application/json"
parameters
:
-
name
:
"
id"
in
:
"
path"
description
:
"
ID
of
topolog
template
uplodaed"
required
:
true
type
:
"
string"
-
name
:
"
interface_type"
in
:
"
path"
description
:
"
type
to
instantiate"
required
:
true
type
:
"
string"
-
name
:
"
instance_name"
in
:
"
query"
description
:
"
the
name
of
the
instance
to
retrun"
required
:
true
type
:
"
string"
-
name
:
"
operation_name"
in
:
"
query"
description
:
"
the
name
of
operation"
required
:
true
type
:
"
string"
responses
:
"
200"
:
description
:
"
successful
operation"
schema
:
type
:
"
object"
additionalProperties
:
type
:
"
object"
properties
:
{}
"
404"
:
description
:
"
Not
found"
"
405"
:
description
:
"
Invalid
input"
x-swagger-router-controller
:
"
sure_tosca.controllers.default_controller"
/tosca_template/{id}/node_types/{node_type}/defaults
:
get
:
summary
:
"
"
description
:
"
returns
an
node
templaye
instance
with
the
default
required
values."
operationId
:
"
get_default_node_type"
produces
:
-
"
application/json"
parameters
:
-
name
:
"
id"
in
:
"
path"
description
:
"
ID
of
topolog
template
uplodaed"
required
:
true
type
:
"
string"
-
name
:
"
node_type"
in
:
"
path"
description
:
"
type
to
instantiate"
required
:
true
type
:
"
string"
-
name
:
"
instance_name"
in
:
"
query"
description
:
"
the
name
of
tghe
instance
to
retrun"
required
:
true
type
:
"
string"
responses
:
"
200"
:
description
:
"
successful
operation"
schema
:
$ref
:
"
#/definitions/NodeTemplateMap"
"
404"
:
description
:
"
Not
found"
"
405"
:
description
:
"
Invalid
input"
x-swagger-router-controller
:
"
sure_tosca.controllers.default_controller"
/tosca_template/{id}/types
:
/tosca_template/{id}/types
:
get
:
get
:
summary
:
"
"
summary
:
"
"
...
...
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