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
c354a862
Commit
c354a862
authored
Dec 11, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed serialization error
parent
a6e38c65
Changes
11
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
493 additions
and
591 deletions
+493
-591
NodeTemplate.java
...ons/src/main/java/nl/uva/sne/drip/model/NodeTemplate.java
+14
-26
ToscaHelperTest.java
...t/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java
+52
-19
DefaultApiTest.java
...ava/nl/uva/sne/drip/sure_tosca/client/DefaultApiTest.java
+10
-2
CONF-3.0.0-swagger.yaml
openAPI/API/CONF-3.0.0-swagger.yaml
+376
-494
sure_tosca-1.0.0-swagger.yaml
openAPI/API/sure_tosca-1.0.0-swagger.yaml
+2
-0
NodeTemplate.yml
openAPI/schema/TOSCA/NodeTemplate.yml
+0
-2
base_model_.py
sure_tosca-flask-server/sure_tosca/models/base_model_.py
+0
-9
node_template.py
sure_tosca-flask-server/sure_tosca/models/node_template.py
+4
-3
topology_template.py
...tosca-flask-server/sure_tosca/models/topology_template.py
+11
-16
tosca_template.py
sure_tosca-flask-server/sure_tosca/models/tosca_template.py
+10
-19
tosca_template_service.py
...flask-server/sure_tosca/service/tosca_template_service.py
+14
-1
No files found.
drip-commons/src/main/java/nl/uva/sne/drip/model/NodeTemplate.java
View file @
c354a862
package
nl
.
uva
.
sne
.
drip
.
model
;
package
nl
.
uva
.
sne
.
drip
.
model
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
java.util.Objects
;
import
java.util.Objects
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonCreator
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -10,29 +11,16 @@ import java.util.List;
...
@@ -10,29 +11,16 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
import
javax.validation.constraints.*
;
/**
/**
* NodeTemplate
* NodeTemplate
*/
*/
@Validated
@Validated
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-12-10T1
5:39:04.296
Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-12-10T1
6:27:40.329
Z"
)
public
class
NodeTemplate
{
public
class
NodeTemplate
{
public
String
getId
()
{
return
name
;
}
/**
* @param id the id to set
*/
public
void
setId
(
String
id
)
{
this
.
name
=
id
;
}
@JsonIgnore
private
String
name
;
@JsonProperty
(
"derived_from"
)
@JsonProperty
(
"derived_from"
)
private
String
derivedFrom
=
null
;
private
String
derivedFrom
=
null
;
...
...
drip-commons/src/test/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java
View file @
c354a862
...
@@ -24,12 +24,17 @@ import java.io.FileInputStream;
...
@@ -24,12 +24,17 @@ import java.io.FileInputStream;
import
java.nio.file.Files
;
import
java.nio.file.Files
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.HttpURLConnection
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.nio.file.Paths
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Properties
;
import
java.util.Properties
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
nl.uva.sne.drip.model.NodeTemplate
;
import
nl.uva.sne.drip.model.NodeTemplate
;
import
nl.uva.sne.drip.model.ToscaTemplate
;
import
nl.uva.sne.drip.model.ToscaTemplate
;
import
org.junit.After
;
import
org.junit.After
;
...
@@ -50,12 +55,14 @@ public class ToscaHelperTest {
...
@@ -50,12 +55,14 @@ public class ToscaHelperTest {
private
static
final
String
testUpdatedApplicationExampleToscaFilePath
=
".."
+
File
.
separator
+
"TOSCA"
+
File
.
separator
+
"application_example_2_topologies.yaml"
;
private
static
final
String
testUpdatedApplicationExampleToscaFilePath
=
".."
+
File
.
separator
+
"TOSCA"
+
File
.
separator
+
"application_example_2_topologies.yaml"
;
private
static
ToscaHelper
instance
;
private
static
ToscaHelper
instance
;
private
static
ToscaTemplate
toscaTemplate
;
private
static
ToscaTemplate
toscaTemplate
;
private
static
Boolean
serviceUp
;
public
ToscaHelperTest
()
{
public
ToscaHelperTest
()
{
}
}
@BeforeClass
@BeforeClass
public
static
void
setUpClass
()
throws
UnsupportedEncodingException
,
JsonProcessingException
,
IOException
,
ApiException
{
public
static
void
setUpClass
()
throws
UnsupportedEncodingException
,
JsonProcessingException
,
IOException
,
ApiException
{
Properties
prop
=
new
Properties
();
Properties
prop
=
new
Properties
();
String
resourceName
=
"src/test/resources/application.properties"
;
String
resourceName
=
"src/test/resources/application.properties"
;
prop
.
load
(
new
FileInputStream
(
resourceName
));
prop
.
load
(
new
FileInputStream
(
resourceName
));
...
@@ -63,7 +70,11 @@ public class ToscaHelperTest {
...
@@ -63,7 +70,11 @@ public class ToscaHelperTest {
String
ymlStr
=
new
String
(
bytes
,
"UTF-8"
);
String
ymlStr
=
new
String
(
bytes
,
"UTF-8"
);
objectMapper
=
new
ObjectMapper
(
new
YAMLFactory
().
disable
(
YAMLGenerator
.
Feature
.
WRITE_DOC_START_MARKER
));
objectMapper
=
new
ObjectMapper
(
new
YAMLFactory
().
disable
(
YAMLGenerator
.
Feature
.
WRITE_DOC_START_MARKER
));
toscaTemplate
=
objectMapper
.
readValue
(
ymlStr
,
ToscaTemplate
.
class
);
toscaTemplate
=
objectMapper
.
readValue
(
ymlStr
,
ToscaTemplate
.
class
);
instance
=
new
ToscaHelper
(
toscaTemplate
,
prop
.
getProperty
(
"sure-tosca.base.path"
));
String
serviceBasePath
=
prop
.
getProperty
(
"sure-tosca.base.path"
);
serviceUp
=
isServiceUp
(
serviceBasePath
);
if
(
serviceUp
)
{
instance
=
new
ToscaHelper
(
toscaTemplate
,
serviceBasePath
);
}
}
}
...
@@ -84,16 +95,21 @@ public class ToscaHelperTest {
...
@@ -84,16 +95,21 @@ public class ToscaHelperTest {
*/
*/
@Test
@Test
public
void
testGetId
()
{
public
void
testGetId
()
{
if
(
serviceUp
)
{
System
.
out
.
println
(
"getId"
);
System
.
out
.
println
(
"getId"
);
Integer
result
=
instance
.
getId
();
Integer
result
=
instance
.
getId
();
assertNotNull
(
result
);
assertNotNull
(
result
);
}
}
}
/**
/**
* Test of getProvisionInterfaceDefinitions method, of class ToscaHelper.
* Test of getProvisionInterfaceDefinitions method, of class ToscaHelper.
*
* @throws nl.uva.sne.drip.sure_tosca.client.ApiException
*/
*/
@Test
@Test
public
void
testGetProvisionInterfaceDefinitions
()
throws
Exception
{
public
void
testGetProvisionInterfaceDefinitions
()
throws
ApiException
{
if
(
serviceUp
)
{
System
.
out
.
println
(
"getProvisionInterfaceDefinitions"
);
System
.
out
.
println
(
"getProvisionInterfaceDefinitions"
);
List
<
String
>
toscaInterfaceTypes
=
new
ArrayList
<>();
List
<
String
>
toscaInterfaceTypes
=
new
ArrayList
<>();
String
expected
=
"tosca.interfaces.ARTICONF.CloudsStorm"
;
String
expected
=
"tosca.interfaces.ARTICONF.CloudsStorm"
;
...
@@ -103,12 +119,16 @@ public class ToscaHelperTest {
...
@@ -103,12 +119,16 @@ public class ToscaHelperTest {
String
key
=
result
.
get
(
0
).
keySet
().
iterator
().
next
();
String
key
=
result
.
get
(
0
).
keySet
().
iterator
().
next
();
assertEquals
(
expected
,
key
);
assertEquals
(
expected
,
key
);
}
}
}
/**
/**
* Test of getVMTopologyTemplates method, of class ToscaHelper.
* Test of getVMTopologyTemplates method, of class ToscaHelper.
*
* @throws nl.uva.sne.drip.sure_tosca.client.ApiException
*/
*/
@Test
@Test
public
void
testGetVMTopologyTemplates
()
throws
Exception
{
public
void
testGetVMTopologyTemplates
()
throws
ApiException
{
if
(
serviceUp
)
{
System
.
out
.
println
(
"getVMTopologyTemplates"
);
System
.
out
.
println
(
"getVMTopologyTemplates"
);
List
<
NodeTemplate
>
result
=
instance
.
getVMTopologyTemplates
();
List
<
NodeTemplate
>
result
=
instance
.
getVMTopologyTemplates
();
assertNotNull
(
result
);
assertNotNull
(
result
);
...
@@ -116,5 +136,18 @@ public class ToscaHelperTest {
...
@@ -116,5 +136,18 @@ public class ToscaHelperTest {
assertEquals
(
nodeTemplate
.
getType
(),
"tosca.nodes.ARTICONF.VM.topology"
);
assertEquals
(
nodeTemplate
.
getType
(),
"tosca.nodes.ARTICONF.VM.topology"
);
}
}
}
}
}
public
static
Boolean
isServiceUp
(
String
serviceBasePath
)
{
try
{
URL
serviceUrl
=
new
URL
(
serviceBasePath
);
HttpURLConnection
connection
=
(
HttpURLConnection
)
serviceUrl
.
openConnection
();
//Set request to header to reduce load as Subirkumarsao said.
connection
.
setRequestMethod
(
"HEAD"
);
int
code
=
connection
.
getResponseCode
();
}
catch
(
IOException
ex
)
{
return
false
;
}
return
true
;
}
}
}
drip-commons/src/test/java/nl/uva/sne/drip/sure_tosca/client/DefaultApiTest.java
View file @
c354a862
...
@@ -15,15 +15,24 @@ import java.io.File;
...
@@ -15,15 +15,24 @@ import java.io.File;
import
org.junit.Test
;
import
org.junit.Test
;
import
java.util.List
;
import
java.util.List
;
import
static
nl
.
uva
.
sne
.
drip
.
commons
.
utils
.
ToscaHelperTest
.
isServiceUp
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
org.junit.Ignore
;
/**
/**
* API tests for DefaultApi
* API tests for DefaultApi
*/
*/
@Ignore
public
class
DefaultApiTest
{
public
class
DefaultApiTest
{
// private final DefaultApi api = new DefaultApi();
private
String
serviceBasePath
;
private
final
Boolean
serviceUp
;
public
DefaultApiTest
()
{
serviceUp
=
isServiceUp
(
serviceBasePath
);
}
// private final DefaultApi api = new DefaultApi();
/**
/**
*
*
*
*
...
@@ -330,5 +339,4 @@ public class DefaultApiTest {
...
@@ -330,5 +339,4 @@ public class DefaultApiTest {
//
//
// // TODO: test validations
// // TODO: test validations
// }
// }
}
}
openAPI/API/CONF-3.0.0-swagger.yaml
View file @
c354a862
This diff is collapsed.
Click to expand it.
openAPI/API/sure_tosca-1.0.0-swagger.yaml
View file @
c354a862
...
@@ -746,6 +746,8 @@ definitions:
...
@@ -746,6 +746,8 @@ definitions:
NodeTemplate
:
NodeTemplate
:
type
:
object
type
:
object
properties
:
properties
:
name
:
type
:
string
derived_from
:
derived_from
:
type
:
string
type
:
string
properties
:
properties
:
...
...
openAPI/schema/TOSCA/NodeTemplate.yml
View file @
c354a862
NodeTemplate
:
NodeTemplate
:
type
:
"
object"
type
:
"
object"
properties
:
properties
:
name
:
type
:
"
string"
derived_from
:
derived_from
:
type
:
"
string"
type
:
"
string"
properties
:
properties
:
...
...
sure_tosca-flask-server/sure_tosca/models/base_model_.py
View file @
c354a862
...
@@ -64,12 +64,3 @@ class Model(object):
...
@@ -64,12 +64,3 @@ class Model(object):
def
__ne__
(
self
,
other
):
def
__ne__
(
self
,
other
):
"""Returns true if both objects are not equal"""
"""Returns true if both objects are not equal"""
return
not
self
==
other
return
not
self
==
other
# def __hash__(self):
# return hash(self.__dict__.keys())
def
__key
(
self
):
return
tuple
(
sorted
(
self
.
to_dict
()))
def
__hash__
(
self
):
return
hash
(
self
.
__key
())
\ No newline at end of file
sure_tosca-flask-server/sure_tosca/models/node_template.py
View file @
c354a862
...
@@ -15,8 +15,7 @@ class NodeTemplateModel(Model):
...
@@ -15,8 +15,7 @@ class NodeTemplateModel(Model):
Do not edit the class manually.
Do not edit the class manually.
"""
"""
def
__init__
(
self
,
derived_from
=
None
,
properties
=
None
,
requirements
=
None
,
interfaces
=
None
,
capabilities
=
None
,
def
__init__
(
self
,
derived_from
=
None
,
properties
=
None
,
requirements
=
None
,
interfaces
=
None
,
capabilities
=
None
,
type
=
None
,
description
=
None
,
directives
=
None
,
attributes
=
None
,
artifacts
=
None
):
# noqa: E501
type
=
None
,
description
=
None
,
directives
=
None
,
attributes
=
None
,
artifacts
=
None
):
# noqa: E501
"""NodeTemplate - a model defined in Swagger
"""NodeTemplate - a model defined in Swagger
:param derived_from: The derived_from of this NodeTemplate. # noqa: E501
:param derived_from: The derived_from of this NodeTemplate. # noqa: E501
...
@@ -84,10 +83,12 @@ class NodeTemplateModel(Model):
...
@@ -84,10 +83,12 @@ class NodeTemplateModel(Model):
:param dikt: A dict.
:param dikt: A dict.
:type: dict
:type: dict
:return: The NodeTemplate of this NodeTemplate. # noqa: E501
:return: The NodeTemplate of this NodeTemplate. # noqa: E501
:rtype: NodeTemplate
Model
:rtype: NodeTemplate
"""
"""
return
util
.
deserialize_model
(
dikt
,
cls
)
return
util
.
deserialize_model
(
dikt
,
cls
)
@
property
@
property
def
derived_from
(
self
):
def
derived_from
(
self
):
"""Gets the derived_from of this NodeTemplate.
"""Gets the derived_from of this NodeTemplate.
...
...
sure_tosca-flask-server/sure_tosca/models/topology_template.py
View file @
c354a862
...
@@ -5,9 +5,9 @@ from datetime import date, datetime # noqa: F401
...
@@ -5,9 +5,9 @@ from datetime import date, datetime # noqa: F401
from
typing
import
List
,
Dict
# noqa: F401
from
typing
import
List
,
Dict
# noqa: F401
from
sure_tosca.models
import
NodeTemplateModel
from
sure_tosca.models.base_model_
import
Model
from
sure_tosca.models.base_model_
import
Model
from
sure_tosca
import
util
from
sure_tosca
import
util
from
sure_tosca.models.node_template
import
NodeTemplateModel
class
TopologyTemplateModel
(
Model
):
class
TopologyTemplateModel
(
Model
):
...
@@ -22,9 +22,9 @@ class TopologyTemplateModel(Model):
...
@@ -22,9 +22,9 @@ class TopologyTemplateModel(Model):
:param description: The description of this TopologyTemplate. # noqa: E501
:param description: The description of this TopologyTemplate. # noqa: E501
:type description: str
:type description: str
:param inputs: The inputs of this TopologyTemplate. # noqa: E501
:param inputs: The inputs of this TopologyTemplate. # noqa: E501
:type inputs:
List[Dict[str, object]
]
:type inputs:
Dict[str, str
]
:param node_templates: The node_templates of this TopologyTemplate. # noqa: E501
:param node_templates: The node_templates of this TopologyTemplate. # noqa: E501
:type node_templates: Dict[str, NodeTemplate
Model
]
:type node_templates: Dict[str, NodeTemplate]
:param relationship_templates: The relationship_templates of this TopologyTemplate. # noqa: E501
:param relationship_templates: The relationship_templates of this TopologyTemplate. # noqa: E501
:type relationship_templates: Dict[str, object]
:type relationship_templates: Dict[str, object]
:param outputs: The outputs of this TopologyTemplate. # noqa: E501
:param outputs: The outputs of this TopologyTemplate. # noqa: E501
...
@@ -38,7 +38,7 @@ class TopologyTemplateModel(Model):
...
@@ -38,7 +38,7 @@ class TopologyTemplateModel(Model):
"""
"""
self
.
swagger_types
=
{
self
.
swagger_types
=
{
'description'
:
str
,
'description'
:
str
,
'inputs'
:
List
[
Dict
[
str
,
object
]
],
'inputs'
:
Dict
[
str
,
str
],
'node_templates'
:
Dict
[
str
,
NodeTemplateModel
],
'node_templates'
:
Dict
[
str
,
NodeTemplateModel
],
'relationship_templates'
:
Dict
[
str
,
object
],
'relationship_templates'
:
Dict
[
str
,
object
],
'outputs'
:
Dict
[
str
,
object
],
'outputs'
:
Dict
[
str
,
object
],
...
@@ -74,7 +74,7 @@ class TopologyTemplateModel(Model):
...
@@ -74,7 +74,7 @@ class TopologyTemplateModel(Model):
:param dikt: A dict.
:param dikt: A dict.
:type: dict
:type: dict
:return: The TopologyTemplate of this TopologyTemplate. # noqa: E501
:return: The TopologyTemplate of this TopologyTemplate. # noqa: E501
:rtype: TopologyTemplate
Model
:rtype: TopologyTemplate
"""
"""
return
util
.
deserialize_model
(
dikt
,
cls
)
return
util
.
deserialize_model
(
dikt
,
cls
)
...
@@ -105,7 +105,7 @@ class TopologyTemplateModel(Model):
...
@@ -105,7 +105,7 @@ class TopologyTemplateModel(Model):
:return: The inputs of this TopologyTemplate.
:return: The inputs of this TopologyTemplate.
:rtype:
List[Dict[str, object]
]
:rtype:
Dict[str, str
]
"""
"""
return
self
.
_inputs
return
self
.
_inputs
...
@@ -115,7 +115,7 @@ class TopologyTemplateModel(Model):
...
@@ -115,7 +115,7 @@ class TopologyTemplateModel(Model):
:param inputs: The inputs of this TopologyTemplate.
:param inputs: The inputs of this TopologyTemplate.
:type inputs:
List[Dict[str, object]
]
:type inputs:
Dict[str, str
]
"""
"""
self
.
_inputs
=
inputs
self
.
_inputs
=
inputs
...
@@ -126,7 +126,7 @@ class TopologyTemplateModel(Model):
...
@@ -126,7 +126,7 @@ class TopologyTemplateModel(Model):
:return: The node_templates of this TopologyTemplate.
:return: The node_templates of this TopologyTemplate.
:rtype: Dict[str, NodeTemplate
Model
]
:rtype: Dict[str, NodeTemplate]
"""
"""
return
self
.
_node_templates
return
self
.
_node_templates
...
@@ -136,7 +136,7 @@ class TopologyTemplateModel(Model):
...
@@ -136,7 +136,7 @@ class TopologyTemplateModel(Model):
:param node_templates: The node_templates of this TopologyTemplate.
:param node_templates: The node_templates of this TopologyTemplate.
:type node_templates: Dict[str, NodeTemplate
Model
]
:type node_templates: Dict[str, NodeTemplate]
"""
"""
self
.
_node_templates
=
node_templates
self
.
_node_templates
=
node_templates
...
@@ -168,7 +168,7 @@ class TopologyTemplateModel(Model):
...
@@ -168,7 +168,7 @@ class TopologyTemplateModel(Model):
:return: The outputs of this TopologyTemplate.
:return: The outputs of this TopologyTemplate.
:rtype:
str
:rtype:
Dict[str, object]
"""
"""
return
self
.
_outputs
return
self
.
_outputs
...
@@ -178,7 +178,7 @@ class TopologyTemplateModel(Model):
...
@@ -178,7 +178,7 @@ class TopologyTemplateModel(Model):
:param outputs: The outputs of this TopologyTemplate.
:param outputs: The outputs of this TopologyTemplate.
:type outputs:
str
:type outputs:
Dict[str, object]
"""
"""
self
.
_outputs
=
outputs
self
.
_outputs
=
outputs
...
@@ -245,8 +245,3 @@ class TopologyTemplateModel(Model):
...
@@ -245,8 +245,3 @@ class TopologyTemplateModel(Model):
"""
"""
self
.
_policies
=
policies
self
.
_policies
=
policies
def
__eq__
(
self
,
other
):
if
isinstance
(
other
,
TopologyTemplateModel
):
return
self
.
__key
()
==
other
.
__key
()
return
NotImplemented
\ No newline at end of file
sure_tosca-flask-server/sure_tosca/models/tosca_template.py
View file @
c354a862
...
@@ -5,9 +5,9 @@ from datetime import date, datetime # noqa: F401
...
@@ -5,9 +5,9 @@ from datetime import date, datetime # noqa: F401
from
typing
import
List
,
Dict
# noqa: F401
from
typing
import
List
,
Dict
# noqa: F401
from
sure_tosca.models
import
TopologyTemplateModel
from
sure_tosca.models.base_model_
import
Model
from
sure_tosca.models.base_model_
import
Model
from
sure_tosca
import
util
from
sure_tosca
import
util
from
sure_tosca.models.topology_template
import
TopologyTemplateModel
class
ToscaTemplateModel
(
Model
):
class
ToscaTemplateModel
(
Model
):
...
@@ -16,11 +16,7 @@ class ToscaTemplateModel(Model):
...
@@ -16,11 +16,7 @@ class ToscaTemplateModel(Model):
Do not edit the class manually.
Do not edit the class manually.
"""
"""
def
__init__
(
self
,
tosca_definitions_version
=
None
,
tosca_default_namespace
=
None
,
template_name
=
None
,
def
__init__
(
self
,
tosca_definitions_version
=
None
,
tosca_default_namespace
=
None
,
template_name
=
None
,
topology_template
=
None
,
template_author
=
None
,
template_version
=
None
,
description
=
None
,
imports
=
None
,
dsl_definitions
=
None
,
node_types
=
None
,
relationship_types
=
None
,
relationship_templates
=
None
,
capability_types
=
None
,
artifact_types
=
None
,
data_types
=
None
,
interface_types
=
None
,
policy_types
=
None
,
group_types
=
None
,
repositories
=
None
):
# noqa: E501
topology_template
=
None
,
template_author
=
None
,
template_version
=
None
,
description
=
None
,
imports
=
None
,
dsl_definitions
=
None
,
node_types
=
None
,
relationship_types
=
None
,
relationship_templates
=
None
,
capability_types
=
None
,
artifact_types
=
None
,
data_types
=
None
,
interface_types
=
None
,
policy_types
=
None
,
group_types
=
None
,
repositories
=
None
):
# noqa: E501
"""ToscaTemplate - a model defined in Swagger
"""ToscaTemplate - a model defined in Swagger
:param tosca_definitions_version: The tosca_definitions_version of this ToscaTemplate. # noqa: E501
:param tosca_definitions_version: The tosca_definitions_version of this ToscaTemplate. # noqa: E501
...
@@ -30,7 +26,7 @@ class ToscaTemplateModel(Model):
...
@@ -30,7 +26,7 @@ class ToscaTemplateModel(Model):
:param template_name: The template_name of this ToscaTemplate. # noqa: E501
:param template_name: The template_name of this ToscaTemplate. # noqa: E501
:type template_name: str
:type template_name: str
:param topology_template: The topology_template of this ToscaTemplate. # noqa: E501
:param topology_template: The topology_template of this ToscaTemplate. # noqa: E501
:type topology_template: TopologyTemplate
Model
:type topology_template: TopologyTemplate
:param template_author: The template_author of this ToscaTemplate. # noqa: E501
:param template_author: The template_author of this ToscaTemplate. # noqa: E501
:type template_author: str
:type template_author: str
:param template_version: The template_version of this ToscaTemplate. # noqa: E501
:param template_version: The template_version of this ToscaTemplate. # noqa: E501
...
@@ -56,7 +52,7 @@ class ToscaTemplateModel(Model):
...
@@ -56,7 +52,7 @@ class ToscaTemplateModel(Model):
:param interface_types: The interface_types of this ToscaTemplate. # noqa: E501
:param interface_types: The interface_types of this ToscaTemplate. # noqa: E501
:type interface_types: Dict[str, object]
:type interface_types: Dict[str, object]
:param policy_types: The policy_types of this ToscaTemplate. # noqa: E501
:param policy_types: The policy_types of this ToscaTemplate. # noqa: E501
:type policy_types: Dict[str,
str
]
:type policy_types: Dict[str,
object
]
:param group_types: The group_types of this ToscaTemplate. # noqa: E501
:param group_types: The group_types of this ToscaTemplate. # noqa: E501
:type group_types: Dict[str, object]
:type group_types: Dict[str, object]
:param repositories: The repositories of this ToscaTemplate. # noqa: E501
:param repositories: The repositories of this ToscaTemplate. # noqa: E501
...
@@ -79,7 +75,7 @@ class ToscaTemplateModel(Model):
...
@@ -79,7 +75,7 @@ class ToscaTemplateModel(Model):
'artifact_types'
:
Dict
[
str
,
object
],
'artifact_types'
:
Dict
[
str
,
object
],
'data_types'
:
Dict
[
str
,
object
],
'data_types'
:
Dict
[
str
,
object
],
'interface_types'
:
Dict
[
str
,
object
],
'interface_types'
:
Dict
[
str
,
object
],
'policy_types'
:
Dict
[
str
,
str
],
'policy_types'
:
Dict
[
str
,
object
],
'group_types'
:
Dict
[
str
,
object
],
'group_types'
:
Dict
[
str
,
object
],
'repositories'
:
Dict
[
str
,
object
]
'repositories'
:
Dict
[
str
,
object
]
}
}
...
@@ -133,7 +129,7 @@ class ToscaTemplateModel(Model):
...
@@ -133,7 +129,7 @@ class ToscaTemplateModel(Model):
:param dikt: A dict.
:param dikt: A dict.
:type: dict
:type: dict
:return: The ToscaTemplate of this ToscaTemplate. # noqa: E501
:return: The ToscaTemplate of this ToscaTemplate. # noqa: E501
:rtype: ToscaTemplate
Model
:rtype: ToscaTemplate
"""
"""
return
util
.
deserialize_model
(
dikt
,
cls
)
return
util
.
deserialize_model
(
dikt
,
cls
)
...
@@ -206,7 +202,7 @@ class ToscaTemplateModel(Model):
...
@@ -206,7 +202,7 @@ class ToscaTemplateModel(Model):
:return: The topology_template of this ToscaTemplate.
:return: The topology_template of this ToscaTemplate.
:rtype: TopologyTemplate
Model
:rtype: TopologyTemplate
"""
"""
return
self
.
_topology_template
return
self
.
_topology_template
...
@@ -216,7 +212,7 @@ class ToscaTemplateModel(Model):
...
@@ -216,7 +212,7 @@ class ToscaTemplateModel(Model):
:param topology_template: The topology_template of this ToscaTemplate.
:param topology_template: The topology_template of this ToscaTemplate.
:type topology_template: TopologyTemplate
Model
:type topology_template: TopologyTemplate
"""
"""
self
.
_topology_template
=
topology_template
self
.
_topology_template
=
topology_template
...
@@ -479,7 +475,7 @@ class ToscaTemplateModel(Model):
...
@@ -479,7 +475,7 @@ class ToscaTemplateModel(Model):
:return: The policy_types of this ToscaTemplate.
:return: The policy_types of this ToscaTemplate.
:rtype: Dict[str,
str
]
:rtype: Dict[str,
object
]
"""
"""
return
self
.
_policy_types
return
self
.
_policy_types
...
@@ -489,7 +485,7 @@ class ToscaTemplateModel(Model):
...
@@ -489,7 +485,7 @@ class ToscaTemplateModel(Model):
:param policy_types: The policy_types of this ToscaTemplate.
:param policy_types: The policy_types of this ToscaTemplate.
:type policy_types: Dict[str,
str
]
:type policy_types: Dict[str,
object
]
"""
"""
self
.
_policy_types
=
policy_types
self
.
_policy_types
=
policy_types
...
@@ -535,8 +531,3 @@ class ToscaTemplateModel(Model):
...
@@ -535,8 +531,3 @@ class ToscaTemplateModel(Model):
"""
"""
self
.
_repositories
=
repositories
self
.
_repositories
=
repositories
def
__eq__
(
self
,
other
):
if
isinstance
(
other
,
ToscaTemplateModel
):
return
self
.
__key
()
==
other
.
__key
()
return
NotImplemented
sure_tosca-flask-server/sure_tosca/service/tosca_template_service.py
View file @
c354a862
...
@@ -3,6 +3,7 @@ import logging
...
@@ -3,6 +3,7 @@ import logging
import
os
import
os
import
tempfile
import
tempfile
import
uuid
import
uuid
from
builtins
import
print
from
functools
import
reduce
from
functools
import
reduce
import
copy
import
copy
...
@@ -115,6 +116,17 @@ def get_interface_types(id, interface_type=None):
...
@@ -115,6 +116,17 @@ def get_interface_types(id, interface_type=None):
return
query_db
(
queries
,
db
=
interface_types_db
)
return
query_db
(
queries
,
db
=
interface_types_db
)
def
change_to_nodeTemplateModel
(
query_results
):
res
=
[]
for
node_template
in
query_results
:
# copy.deepcopy()
name
=
next
(
iter
(
node_template
))
node_template
=
node_template
[
name
]
node_template
[
'name'
]
=
name
res
.
append
(
NodeTemplateModel
.
from_dict
(
node_template
))
return
res
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_attributes
=
None
,
has_requirements
=
None
,
has_capabilities
=
None
,
has_artifacts
=
None
):
has_requirements
=
None
,
has_capabilities
=
None
,
has_artifacts
=
None
):
...
@@ -173,7 +185,8 @@ def get_node_templates(id, type_name=None, node_name=None, has_interfaces=None,
...
@@ -173,7 +185,8 @@ def get_node_templates(id, type_name=None, node_name=None, has_interfaces=None,
queries
.
append
(
query
.
artifacts
!=
prop
)
queries
.
append
(
query
.
artifacts
!=
prop
)
query_results
=
query_db
(
queries
,
db
=
node_template_db
)
query_results
=
query_db
(
queries
,
db
=
node_template_db
)
return
query_results
return
change_to_nodeTemplateModel
(
query_results
)
def
get_tosca_template_get_dsl_definitions
(
id
,
anchors
,
derived_from
):
def
get_tosca_template_get_dsl_definitions
(
id
,
anchors
,
derived_from
):
...
...
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