Commit 007132eb authored by Spiros Koulouzis's avatar Spiros Koulouzis

generated json schema

parent de852d8e
...@@ -16,12 +16,11 @@ topology_template: ...@@ -16,12 +16,11 @@ topology_template:
create: dumy.yaml create: dumy.yaml
properties: properties:
disk_size: 50000 MB disk_size: 50000 MB
host_name: vm
mem_size: 6000 MB mem_size: 6000 MB
num_cores: 2 num_cores: 2
os: ubuntu 16 os: ubuntu 16
role: master attributes:
user_name: vm_user private_ip: 192.168.1.10
type: tosca.nodes.ARTICONF.VM.Compute type: tosca.nodes.ARTICONF.VM.Compute
compute_1: compute_1:
interfaces: interfaces:
...@@ -29,12 +28,11 @@ topology_template: ...@@ -29,12 +28,11 @@ topology_template:
create: dumy.yaml create: dumy.yaml
properties: properties:
disk_size: 50000 MB disk_size: 50000 MB
host_name: vm
mem_size: 6000 MB mem_size: 6000 MB
num_cores: 2 num_cores: 2
os: ubuntu 16 os: ubuntu 16
role: worker attributes:
user_name: vm_user private_ip: 192.168.1.11
type: tosca.nodes.ARTICONF.VM.Compute type: tosca.nodes.ARTICONF.VM.Compute
compute_2: compute_2:
interfaces: interfaces:
...@@ -42,12 +40,9 @@ topology_template: ...@@ -42,12 +40,9 @@ topology_template:
create: dumy.yaml create: dumy.yaml
properties: properties:
disk_size: 50000 MB disk_size: 50000 MB
host_name: vm
mem_size: 6000 MB mem_size: 6000 MB
num_cores: 2 num_cores: 2
os: ubuntu 16 os: ubuntu 16
role: worker
user_name: vm_user
type: tosca.nodes.ARTICONF.VM.Compute type: tosca.nodes.ARTICONF.VM.Compute
kubernetes: kubernetes:
interfaces: interfaces:
...@@ -89,9 +84,6 @@ topology_template: ...@@ -89,9 +84,6 @@ topology_template:
interfaces: interfaces:
Standard: Standard:
create: dumy.yaml create: dumy.yaml
properties:
domain: UvA (Amsterdam, The Netherlands) XO Rack
provider: ExoGeni
requirements: requirements:
- vm: - vm:
capability: tosca.capabilities.ARTICONF.VM capability: tosca.capabilities.ARTICONF.VM
...@@ -102,13 +94,10 @@ topology_template: ...@@ -102,13 +94,10 @@ topology_template:
node: compute_1 node: compute_1
relationship: tosca.relationships.DependsOn relationship: tosca.relationships.DependsOn
type: tosca.nodes.ARTICONF.VM.topology type: tosca.nodes.ARTICONF.VM.topology
topology: topology_1:
interfaces: interfaces:
Standard: Standard:
create: dumy.yaml create: dumy.yaml
properties:
domain: Some other Rack
provider: ExoGeni
requirements: requirements:
- vm: - vm:
capability: tosca.capabilities.ARTICONF.VM capability: tosca.capabilities.ARTICONF.VM
...@@ -150,13 +139,10 @@ topology_template: ...@@ -150,13 +139,10 @@ topology_template:
outputs: outputs:
private_ip_compute: 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. description: The private IP address of the application’s first tier.
value: { get_attribute: [compute, private_address] } value: { get_attribute: [compute_1, private_ip] }
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] }
...@@ -2,18 +2,11 @@ ...@@ -2,18 +2,11 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="462ede19-adfe-472b-975e-fefefa973fe0" name="Default Changelist" comment=""> <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_2_topologies.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../TOSCA/application_example_2_topologies.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$/../openAPI/TOSCA/TopologyTemplate.yml" beforeDir="false" afterPath="$PROJECT_DIR$/../openAPI/TOSCA/TopologyTemplate.yml" 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$/../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/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/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/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> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
......
{
"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"
}
}
}
Outputs:
type: "object"
properties:
<parameter_name>:
type: "array"
items:
$ref: 'https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/openAPI/TOSCA/ParameterDefinition.yml#/ParameterDefinition'
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
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
additionalProperties: additionalProperties:
type: object type: object
outputs: outputs:
type: object type: string
additionalProperties: additionalProperties:
type: object type: object
groups: groups:
......
...@@ -28,7 +28,7 @@ class TopologyTemplate(Model): ...@@ -28,7 +28,7 @@ class TopologyTemplate(Model):
: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
:type outputs: List[Dict[str, object]] :type outputs: Dict[str, object]
:param groups: The groups of this TopologyTemplate. # noqa: E501 :param groups: The groups of this TopologyTemplate. # noqa: E501
:type groups: Dict[str, object] :type groups: Dict[str, object]
:param substitution_mappings: The substitution_mappings of this TopologyTemplate. # noqa: E501 :param substitution_mappings: The substitution_mappings of this TopologyTemplate. # noqa: E501
...@@ -41,7 +41,7 @@ class TopologyTemplate(Model): ...@@ -41,7 +41,7 @@ class TopologyTemplate(Model):
'inputs': List[Dict[str, object]], 'inputs': List[Dict[str, object]],
'node_templates': Dict[str, NodeTemplate], 'node_templates': Dict[str, NodeTemplate],
'relationship_templates': Dict[str, object], 'relationship_templates': Dict[str, object],
'outputs': List[Dict[str, object]], 'outputs': Dict[str, object],
'groups': Dict[str, object], 'groups': Dict[str, object],
'substitution_mappings': Dict[str, object], 'substitution_mappings': Dict[str, object],
'policies': List[Dict[str, object]] 'policies': List[Dict[str, object]]
...@@ -168,7 +168,7 @@ class TopologyTemplate(Model): ...@@ -168,7 +168,7 @@ class TopologyTemplate(Model):
:return: The outputs of this TopologyTemplate. :return: The outputs of this TopologyTemplate.
:rtype: List[Dict[str, object]] :rtype: Dict[str, object]
""" """
return self._outputs return self._outputs
...@@ -178,7 +178,7 @@ class TopologyTemplate(Model): ...@@ -178,7 +178,7 @@ class TopologyTemplate(Model):
:param outputs: The outputs of this TopologyTemplate. :param outputs: The outputs of this TopologyTemplate.
:type outputs: List[Dict[str, object]] :type outputs: Dict[str, object]
""" """
self._outputs = outputs self._outputs = outputs
......
import os import os
import sys
import uuid import uuid
import yaml import yaml
...@@ -17,6 +18,7 @@ from toscaparser.topology_template import TopologyTemplate ...@@ -17,6 +18,7 @@ from toscaparser.topology_template import TopologyTemplate
from tinydb.storages import MemoryStorage from tinydb.storages import MemoryStorage
from functools import reduce from functools import reduce
from sure_tosca.service import tosca_helper from sure_tosca.service import tosca_helper
import logging
# db = TinyDB(storage=CachingMiddleware(MemoryStorage)) # db = TinyDB(storage=CachingMiddleware(MemoryStorage))
db_dir_path = tempfile.gettempdir() db_dir_path = tempfile.gettempdir()
...@@ -73,6 +75,7 @@ def get_tosca_template_dict_by_id(id): ...@@ -73,6 +75,7 @@ def get_tosca_template_dict_by_id(id):
def save(file): def save(file):
try:
# tosca_template_file_path = os.path.join(db_dir_path, file.filename) # tosca_template_file_path = os.path.join(db_dir_path, file.filename)
tosca_template_dict = yaml.safe_load(file.stream) tosca_template_dict = yaml.safe_load(file.stream)
tosca_template_model = ToscaTemplateModel.from_dict(tosca_template_dict) tosca_template_model = ToscaTemplateModel.from_dict(tosca_template_dict)
...@@ -85,6 +88,9 @@ def save(file): ...@@ -85,6 +88,9 @@ def save(file):
tosca_templates_db.insert(tosca_template_dict_with_id) tosca_templates_db.insert(tosca_template_dict_with_id)
# tosca_templates_db.close() # tosca_templates_db.close()
return doc_id return doc_id
except Exception as e:
logging.error(str(e))
return str(e), 400
def get_interface_types(id, interface_type=None): def get_interface_types(id, interface_type=None):
......
...@@ -737,8 +737,7 @@ definitions: ...@@ -737,8 +737,7 @@ definitions:
key: "policy_types" key: "policy_types"
topology_template: topology_template:
outputs: outputs:
- key: "{}" key: "{}"
- key: "{}"
substitution_mappings: substitution_mappings:
key: "{}" key: "{}"
inputs: inputs:
...@@ -822,8 +821,6 @@ definitions: ...@@ -822,8 +821,6 @@ definitions:
type: "object" type: "object"
properties: {} properties: {}
outputs: outputs:
type: "array"
items:
type: "object" type: "object"
additionalProperties: additionalProperties:
type: "object" type: "object"
...@@ -847,8 +844,7 @@ definitions: ...@@ -847,8 +844,7 @@ definitions:
properties: {} properties: {}
example: example:
outputs: outputs:
- key: "{}" key: "{}"
- key: "{}"
substitution_mappings: substitution_mappings:
key: "{}" key: "{}"
inputs: inputs:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment