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
007132eb
Commit
007132eb
authored
Oct 31, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generated json schema
parent
de852d8e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
310 additions
and
62 deletions
+310
-62
application_example_2_topologies.yaml
TOSCA/application_example_2_topologies.yaml
+13
-27
workspace.xml
drip_planner2/.idea/workspace.xml
+2
-9
TOSCA-v1.0.json
openAPI/TOSCA-v1.0.json
+230
-0
Outputs.yml
openAPI/TOSCA/Outputs.yml
+11
-0
ParameterDefinition.yml
openAPI/TOSCA/ParameterDefinition.yml
+26
-0
TopologyTemplate.yml
openAPI/TOSCA/TopologyTemplate.yml
+2
-2
topology_template.py
...tosca-flask-server/sure_tosca/models/topology_template.py
+4
-4
tosca_template_service.py
...flask-server/sure_tosca/service/tosca_template_service.py
+17
-11
swagger.yaml
sure_tosca-flask-server/sure_tosca/swagger/swagger.yaml
+5
-9
No files found.
TOSCA/application_example_2_topologies.yaml
View file @
007132eb
...
...
@@ -16,12 +16,11 @@ topology_template:
create
:
dumy.yaml
properties
:
disk_size
:
50000 MB
host_name
:
vm
mem_size
:
6000 MB
num_cores
:
2
os
:
ubuntu 16
role
:
master
user_name
:
vm_user
attributes
:
private_ip
:
192.168.1.10
type
:
tosca.nodes.ARTICONF.VM.Compute
compute_1
:
interfaces
:
...
...
@@ -29,12 +28,11 @@ topology_template:
create
:
dumy.yaml
properties
:
disk_size
:
50000 MB
host_name
:
vm
mem_size
:
6000 MB
num_cores
:
2
os
:
ubuntu 16
role
:
worker
user_name
:
vm_user
attributes
:
private_ip
:
192.168.1.11
type
:
tosca.nodes.ARTICONF.VM.Compute
compute_2
:
interfaces
:
...
...
@@ -42,12 +40,9 @@ topology_template:
create
:
dumy.yaml
properties
:
disk_size
:
50000 MB
host_name
:
vm
mem_size
:
6000 MB
num_cores
:
2
os
:
ubuntu 16
role
:
worker
user_name
:
vm_user
type
:
tosca.nodes.ARTICONF.VM.Compute
kubernetes
:
interfaces
:
...
...
@@ -89,9 +84,6 @@ topology_template:
interfaces
:
Standard
:
create
:
dumy.yaml
properties
:
domain
:
UvA (Amsterdam, The Netherlands) XO Rack
provider
:
ExoGeni
requirements
:
-
vm
:
capability
:
tosca.capabilities.ARTICONF.VM
...
...
@@ -101,20 +93,17 @@ topology_template:
capability
:
tosca.capabilities.ARTICONF.VM
node
:
compute_1
relationship
:
tosca.relationships.DependsOn
type
:
tosca.nodes.ARTICONF.VM.topology
topology
:
type
:
tosca.nodes.ARTICONF.VM.topology
topology
_1
:
interfaces
:
Standard
:
create
:
dumy.yaml
properties
:
domain
:
Some other Rack
provider
:
ExoGeni
requirements
:
-
vm
:
capability
:
tosca.capabilities.ARTICONF.VM
node
:
compute_2
relationship
:
tosca.relationships.DependsOn
type
:
tosca.nodes.ARTICONF.VM.topology
type
:
tosca.nodes.ARTICONF.VM.topology
wordpress
:
artifacts
:
image
:
...
...
@@ -150,13 +139,10 @@ topology_template:
outputs
:
private_ip_compute
:
description
:
The private IP address of the application’s first tier.
value
:
{
get_attribute
:
[
compute
,
private_address
]
}
private_ip_compute_1
:
description
:
The private IP address of the application’s second tier.
value
:
{
get_attribute
:
[
compute_1
,
private_address
]
}
private_ip_compute_2
:
description
:
The private IP address of the application’s second tier.
value
:
{
get_attribute
:
[
compute_2
,
private_address
]
}
private_ip
:
description
:
The private IP address of the application’s first tier.
value
:
{
get_attribute
:
[
compute
,
private_ip
]
}
private_ip_1
:
description
:
The private IP address of the application’s first tier.
value
:
{
get_attribute
:
[
compute_1
,
private_ip
]
}
drip_planner2/.idea/workspace.xml
View file @
007132eb
...
...
@@ -2,18 +2,11 @@
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"462ede19-adfe-472b-975e-fefefa973fe0"
name=
"Default Changelist"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/../TOSCA/application_example_output.yaml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../TOSCA/application_example_output.yaml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../TOSCA/application_example_updated.yaml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../TOSCA/application_example_updated.yaml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../TOSCA/types/nodes.yaml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../TOSCA/types/nodes.yaml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
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/models/base_model_.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/models/base_model_.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/models/node_template.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/models/node_template.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../TOSCA/application_example_2_topologies.yaml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../TOSCA/application_example_2_topologies.yaml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../openAPI/TOSCA/TopologyTemplate.yml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../openAPI/TOSCA/TopologyTemplate.yml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/models/topology_template.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/models/topology_template.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/models/tosca_template.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/models/tosca_template.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"
/>
<change
beforePath=
"$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/swagger/swagger.yaml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/swagger/swagger.yaml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/test/test_default_controller.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/test/test_default_controller.py"
afterDir=
"false"
/>
</list>
<option
name=
"EXCLUDED_CONVERTED_TO_IGNORED"
value=
"true"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
...
...
openAPI/TOSCA-v1.0.json
0 → 100644
View file @
007132eb
{
"definitions"
:
{
"docsoasisopenorgtoscans201112:maxInstances"
:
{
"type"
:
"string"
},
"docsoasisopenorgtoscans201112:upperBound"
:
{
"type"
:
"string"
},
"docsoasisopenorgtoscans201112:tBoolean"
:
{
"enum"
:
[
"yes"
,
"no"
],
"type"
:
"string"
},
"docsoasisopenorgtoscans201112:tTags"
:
{
"required"
:
[
"Tag"
],
"type"
:
"object"
,
"properties"
:
{
"Tag"
:
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"docsoasisopenorgtoscans201112:tTag"
},
"minItems"
:
1
}
}
},
"docsoasisopenorgtoscans201112:tBoundaryDefinitions"
:
{
"type"
:
"object"
,
"properties"
:
{
"Properties"
:
{
"type"
:
"docsoasisopenorgtoscans201112:Properties"
},
"PropertyConstraints"
:
{
"$ref"
:
"#/definitions/docsoasisopenorgtoscans201112:PropertyConstraints"
},
"Requirements"
:
{
"$ref"
:
"#/definitions/docsoasisopenorgtoscans201112:Requirements"
},
"Capabilities"
:
{
"$ref"
:
"#/definitions/docsoasisopenorgtoscans201112:Capabilities"
},
"Policies"
:
{
"$ref"
:
"#/definitions/docsoasisopenorgtoscans201112:Policies"
},
"Interfaces"
:
{
"$ref"
:
"#/definitions/docsoasisopenorgtoscans201112:Interfaces"
}
}
},
"docsoasisopenorgtoscans201112:tDeploymentArtifacts"
:
{
"required"
:
[
"DeploymentArtifact"
],
"type"
:
"object"
,
"properties"
:
{
"DeploymentArtifact"
:
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"docsoasisopenorgtoscans201112:tDeploymentArtifact"
},
"minItems"
:
1
}
}
},
"docsoasisopenorgtoscans201112:tImplementationArtifacts"
:
{
"required"
:
[
"ImplementationArtifact"
],
"type"
:
"object"
,
"properties"
:
{
"ImplementationArtifact"
:
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"docsoasisopenorgtoscans201112:ImplementationArtifact"
},
"minItems"
:
1
}
}
},
"docsoasisopenorgtoscans201112:tAppliesTo"
:
{
"required"
:
[
"NodeTypeReference"
],
"type"
:
"object"
,
"properties"
:
{
"NodeTypeReference"
:
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"docsoasisopenorgtoscans201112:NodeTypeReference"
},
"minItems"
:
1
}
}
},
"docsoasisopenorgtoscans201112:tTopologyElementInstanceStates"
:
{
"required"
:
[
"InstanceState"
],
"type"
:
"object"
,
"properties"
:
{
"InstanceState"
:
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"docsoasisopenorgtoscans201112:InstanceState"
},
"minItems"
:
1
}
}
},
"docsoasisopenorgtoscans201112:tRequiredContainerFeatures"
:
{
"required"
:
[
"RequiredContainerFeature"
],
"type"
:
"object"
,
"properties"
:
{
"RequiredContainerFeature"
:
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"docsoasisopenorgtoscans201112:tRequiredContainerFeature"
},
"minItems"
:
1
}
}
},
"docsoasisopenorgtoscans201112:Extensions"
:
{
"required"
:
[
"Extension"
],
"type"
:
"object"
,
"properties"
:
{
"Extension"
:
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"docsoasisopenorgtoscans201112:tExtension"
},
"minItems"
:
1
}
}
},
"docsoasisopenorgtoscans201112:PropertyConstraints"
:
{
"required"
:
[
"PropertyConstraint"
],
"type"
:
"object"
,
"properties"
:
{
"PropertyConstraint"
:
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"docsoasisopenorgtoscans201112:tPropertyConstraint"
},
"minItems"
:
1
}
}
},
"docsoasisopenorgtoscans201112:Requirements"
:
{
"required"
:
[
"Requirement"
],
"type"
:
"object"
,
"properties"
:
{
"Requirement"
:
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"docsoasisopenorgtoscans201112:tRequirementRef"
},
"minItems"
:
1
}
}
},
"docsoasisopenorgtoscans201112:Capabilities"
:
{
"required"
:
[
"Capability"
],
"type"
:
"object"
,
"properties"
:
{
"Capability"
:
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"docsoasisopenorgtoscans201112:tCapabilityRef"
},
"minItems"
:
1
}
}
},
"docsoasisopenorgtoscans201112:Policies"
:
{
"required"
:
[
"Policy"
],
"type"
:
"object"
,
"properties"
:
{
"Policy"
:
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"docsoasisopenorgtoscans201112:tPolicy"
},
"minItems"
:
1
}
}
},
"docsoasisopenorgtoscans201112:Interfaces"
:
{
"required"
:
[
"Interface"
],
"type"
:
"object"
,
"properties"
:
{
"Interface"
:
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"docsoasisopenorgtoscans201112:tExportedInterface"
},
"minItems"
:
1
}
}
},
"lang"
:
{
"type"
:
"string"
},
"space"
:
{
"enum"
:
[
"default"
,
"preserve"
],
"type"
:
"string"
}
}
}
openAPI/TOSCA/Outputs.yml
0 → 100644
View file @
007132eb
Outputs
:
type
:
"
object"
properties
:
<parameter_name>
:
type
:
"
array"
items
:
$ref
:
'
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/openAPI/TOSCA/ParameterDefinition.yml#/ParameterDefinition'
openAPI/TOSCA/ParameterDefinition.yml
0 → 100644
View file @
007132eb
ParameterDefinition.yml
:
type
:
"
object"
properties
:
type
:
type
:
"
string"
description
:
type
:
"
string"
value
:
type
:
object
additionalProperties
:
type
:
object
required
:
type
:
boolean
default
:
type
:
"
string"
status
:
type
:
"
string"
constraints
:
type
:
object
additionalProperties
:
type
:
object
entry_schema
:
type
:
object
additionalProperties
:
type
:
object
openAPI/TOSCA/TopologyTemplate.yml
View file @
007132eb
...
...
@@ -12,13 +12,13 @@
node_templates
:
type
:
object
additionalProperties
:
$ref
:
'
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/openAPI/TOSCA/NodeTemplate.yml#/NodeTemplate'
$ref
:
'
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/openAPI/TOSCA/NodeTemplate.yml#/NodeTemplate'
relationship_templates
:
type
:
object
additionalProperties
:
type
:
object
outputs
:
type
:
object
type
:
string
additionalProperties
:
type
:
object
groups
:
...
...
sure_tosca-flask-server/sure_tosca/models/topology_template.py
View file @
007132eb
...
...
@@ -28,7 +28,7 @@ class TopologyTemplate(Model):
:param relationship_templates: The relationship_templates of this TopologyTemplate. # noqa: E501
:type relationship_templates: Dict[str, object]
:param outputs: The outputs of this TopologyTemplate. # noqa: E501
:type outputs:
List[Dict[str, object]
]
:type outputs:
Dict[str, object
]
:param groups: The groups of this TopologyTemplate. # noqa: E501
:type groups: Dict[str, object]
:param substitution_mappings: The substitution_mappings of this TopologyTemplate. # noqa: E501
...
...
@@ -41,7 +41,7 @@ class TopologyTemplate(Model):
'inputs'
:
List
[
Dict
[
str
,
object
]],
'node_templates'
:
Dict
[
str
,
NodeTemplate
],
'relationship_templates'
:
Dict
[
str
,
object
],
'outputs'
:
List
[
Dict
[
str
,
object
]
],
'outputs'
:
Dict
[
str
,
object
],
'groups'
:
Dict
[
str
,
object
],
'substitution_mappings'
:
Dict
[
str
,
object
],
'policies'
:
List
[
Dict
[
str
,
object
]]
...
...
@@ -168,7 +168,7 @@ class TopologyTemplate(Model):
:return: The outputs of this TopologyTemplate.
:rtype:
List[Dict[str, object]
]
:rtype:
Dict[str, object
]
"""
return
self
.
_outputs
...
...
@@ -178,7 +178,7 @@ class TopologyTemplate(Model):
:param outputs: The outputs of this TopologyTemplate.
:type outputs:
List[Dict[str, object]
]
:type outputs:
Dict[str, object
]
"""
self
.
_outputs
=
outputs
...
...
sure_tosca-flask-server/sure_tosca/service/tosca_template_service.py
View file @
007132eb
import
os
import
sys
import
uuid
import
yaml
...
...
@@ -17,6 +18,7 @@ from toscaparser.topology_template import TopologyTemplate
from
tinydb.storages
import
MemoryStorage
from
functools
import
reduce
from
sure_tosca.service
import
tosca_helper
import
logging
# db = TinyDB(storage=CachingMiddleware(MemoryStorage))
db_dir_path
=
tempfile
.
gettempdir
()
...
...
@@ -73,18 +75,22 @@ def get_tosca_template_dict_by_id(id):
def
save
(
file
):
# tosca_template_file_path = os.path.join(db_dir_path, file.filename)
tosca_template_dict
=
yaml
.
safe_load
(
file
.
stream
)
tosca_template_model
=
ToscaTemplateModel
.
from_dict
(
tosca_template_dict
)
tosca_template
=
ToscaTemplate
(
yaml_dict_tpl
=
tosca_template_dict
)
try
:
# tosca_template_file_path = os.path.join(db_dir_path, file.filename)
tosca_template_dict
=
yaml
.
safe_load
(
file
.
stream
)
tosca_template_model
=
ToscaTemplateModel
.
from_dict
(
tosca_template_dict
)
tosca_template
=
ToscaTemplate
(
yaml_dict_tpl
=
tosca_template_dict
)
doc_id
=
str
(
uuid
.
uuid4
())
tosca_template_dict_with_id
=
{
model_id_names
[
0
]:
doc_id
}
doc_id
=
str
(
uuid
.
uuid4
())
tosca_template_dict_with_id
=
{
model_id_names
[
0
]:
doc_id
}
tosca_template_dict_with_id
.
update
(
tosca_template_model
.
to_dict
())
tosca_templates_db
.
insert
(
tosca_template_dict_with_id
)
# tosca_templates_db.close()
return
doc_id
tosca_template_dict_with_id
.
update
(
tosca_template_model
.
to_dict
())
tosca_templates_db
.
insert
(
tosca_template_dict_with_id
)
# tosca_templates_db.close()
return
doc_id
except
Exception
as
e
:
logging
.
error
(
str
(
e
))
return
str
(
e
),
400
def
get_interface_types
(
id
,
interface_type
=
None
):
...
...
@@ -238,4 +244,4 @@ def get_parent_type_name(id, node_root_key):
def
get_node_outputs
(
id
,
name_key
):
outputs
=
get_tosca_template_model_by_id
(
id
)
.
topology_template
.
outputs
return
None
\ No newline at end of file
return
None
sure_tosca-flask-server/sure_tosca/swagger/swagger.yaml
View file @
007132eb
...
...
@@ -737,8 +737,7 @@ definitions:
key
:
"
policy_types"
topology_template
:
outputs
:
-
key
:
"
{}"
-
key
:
"
{}"
key
:
"
{}"
substitution_mappings
:
key
:
"
{}"
inputs
:
...
...
@@ -822,12 +821,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
:
...
...
@@ -847,8 +844,7 @@ definitions:
properties
:
{}
example
:
outputs
:
-
key
:
"
{}"
-
key
:
"
{}"
key
:
"
{}"
substitution_mappings
:
key
:
"
{}"
inputs
:
...
...
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