Commit 4a537284 authored by Spiros Koulouzis's avatar Spiros Koulouzis

added plan check

parent 973a393b
...@@ -12,14 +12,6 @@ repositories: ...@@ -12,14 +12,6 @@ repositories:
description: > description: >
TOSCA example TOSCA example
interface_types:
tosca.interfaces.TEST.test:
description: test
derived_from: tosca.interfaces.node.lifecycle.Standard
create:
description: creates
configure:
description: configures
topology_template: topology_template:
......
<?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$/../TOSCA/application_example_updated.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../TOSCA/application_example_updated.yaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/__main__.py" beforeDir="false" afterPath="$PROJECT_DIR$/__main__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/planner/planner.py" beforeDir="false" afterPath="$PROJECT_DIR$/planner/planner.py" afterDir="false" />
</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" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
...@@ -21,7 +26,7 @@ ...@@ -21,7 +26,7 @@
<component name="ProjectId" id="1TI7vNZs1Z3y1uB6wXCH5F47r0F" /> <component name="ProjectId" id="1TI7vNZs1Z3y1uB6wXCH5F47r0F" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" /> <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../DevOpsTutorial/python-flask-server-generated" /> <property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" /> <property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
</component> </component>
<component name="RecentsManager"> <component name="RecentsManager">
...@@ -59,7 +64,7 @@ ...@@ -59,7 +64,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/__main__.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/__main__.py" />
<option name="PARAMETERS" value="test_local" /> <option name="PARAMETERS" value="localhost planner" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" /> <option name="MODULE_MODE" value="false" />
...@@ -230,12 +235,12 @@ ...@@ -230,12 +235,12 @@
<breakpoints> <breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line"> <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/planner/planner.py</url> <url>file://$PROJECT_DIR$/planner/planner.py</url>
<line>66</line> <line>71</line>
<option name="timeStamp" value="8" /> <option name="timeStamp" value="8" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line"> <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/planner/planner.py</url> <url>file://$PROJECT_DIR$/planner/planner.py</url>
<line>61</line> <line>66</line>
<option name="timeStamp" value="9" /> <option name="timeStamp" value="9" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line"> <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
...@@ -243,6 +248,11 @@ ...@@ -243,6 +248,11 @@
<line>22</line> <line>22</line>
<option name="timeStamp" value="21" /> <option name="timeStamp" value="21" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/__main__.py</url>
<line>102</line>
<option name="timeStamp" value="22" />
</line-breakpoint>
</breakpoints> </breakpoints>
</breakpoint-manager> </breakpoint-manager>
</component> </component>
......
...@@ -95,10 +95,12 @@ def handle_delivery(message): ...@@ -95,10 +95,12 @@ def handle_delivery(message):
conf = {'url': "http://host"} conf = {'url': "http://host"}
spec_service = SpecService(conf) spec_service = SpecService(conf)
test_planner = Planner(input_tosca_file_path, spec_service) test_planner = Planner(tosca_path=input_tosca_file_path,spec_service=spec_service)
tosca_template = test_planner.resolve_requirements() tosca_template = test_planner.resolve_requirements()
tosca_template = test_planner.set_infrastructure_specifications() tosca_template = test_planner.set_infrastructure_specifications()
template_dict = tosca_helper.get_tosca_template_2_topology_template_dictionary(tosca_template) template_dict = tosca_helper.get_tosca_template_2_topology_template_dictionary(tosca_template)
Planner(yaml_dict_tpl=template_dict, spec_service=spec_service)
logger.info("template ----: \n" + yaml.dump(template_dict)) logger.info("template ----: \n" + yaml.dump(template_dict))
response = {'toscaTemplate': template_dict} response = {'toscaTemplate': template_dict}
......
...@@ -12,9 +12,14 @@ from util import tosca_helper ...@@ -12,9 +12,14 @@ from util import tosca_helper
class Planner: class Planner:
def __init__(self, path, spec_service): def __init__(self, tosca_path=None, yaml_dict_tpl=None, spec_service=spec_service):
self.path = path if tosca_path:
self.tosca_template = ToscaTemplate(path) self.path = tosca_path
self.tosca_template = ToscaTemplate(tosca_path)
elif yaml_dict_tpl:
self.yaml_dict_tpl = yaml_dict_tpl
self.tosca_template = ToscaTemplate(yaml_dict_tpl=yaml_dict_tpl)
self.tosca_node_types = self.tosca_template.nodetemplates[0].type_definition.TOSCA_DEF self.tosca_node_types = self.tosca_template.nodetemplates[0].type_definition.TOSCA_DEF
self.all_custom_def = self.tosca_template.nodetemplates[0].custom_def self.all_custom_def = self.tosca_template.nodetemplates[0].custom_def
self.all_node_types = {} self.all_node_types = {}
......
swagger: "2.0" swagger: "2.0"
info: info:
description: "The Dynamic Real-time infrastructure planner (DRIP) allows application developers to seamlessly plan a customized virtual infrastructure based on application level constraints on QoS and resource budgets, provisioning the virtual infrastructure, deploy application components onto the virtual infrastructure, and start execution on demand using TOSCA." description: "CONF allows application developers to seamlessly plan a customized virtual infrastructure based on application level constraints on QoS and resource budgets, provisioning the virtual infrastructure, deploy application components onto the virtual infrastructure, and start execution on demand using TOSCA."
version: "3.0.0" version: "3.0.0"
title: "DRIP" title: "CONF"
contact: contact:
email: "z.zhao@uva.nl" email: "z.zhao@uva.nl"
license: license:
...@@ -40,7 +40,7 @@ paths: ...@@ -40,7 +40,7 @@ paths:
/tosca_template/ids: /tosca_template/ids:
get: get:
summary: "Get all topolog template IDs" summary: "Get all topolog template IDs"
description: "Returns all IDss " description: "Returns all IDs"
operationId: "getToscaTemplateIDs" operationId: "getToscaTemplateIDs"
produces: produces:
- "application/json" - "application/json"
...@@ -172,7 +172,8 @@ paths: ...@@ -172,7 +172,8 @@ paths:
security: security:
- auth: - auth:
- "write:ToscaTemplate" - "write:ToscaTemplate"
- "read:ToscaTemplate" - "read:ToscaTemplate"
/provisioner/provision/{id}: /provisioner/provision/{id}:
get: get:
summary: "provision tosca template" summary: "provision tosca template"
...@@ -218,7 +219,7 @@ paths: ...@@ -218,7 +219,7 @@ paths:
200: 200:
description: "successful operation" description: "successful operation"
schema: schema:
$ref: "https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/openAPI/Provisioner.yml#/Provisioner" $ref: "https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/Provisioner.yml#/Provisioner"
400: 400:
description: "Invalid ID supplied" description: "Invalid ID supplied"
404: 404:
...@@ -272,7 +273,7 @@ paths: ...@@ -272,7 +273,7 @@ paths:
description: "Created user object" description: "Created user object"
required: true required: true
schema: schema:
$ref: "https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/openAPI/TOSCA/Credentials.yml#/Credentials" $ref: "https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/TOSCA/Credentials.yml#/Credentials"
responses: responses:
200: 200:
description: "successful operation" description: "successful operation"
...@@ -325,7 +326,7 @@ paths: ...@@ -325,7 +326,7 @@ paths:
description: "Created user object" description: "Created user object"
required: true required: true
schema: schema:
$ref: "https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/openAPI/User.yml#/User" $ref: "https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/User.yml#/User"
responses: responses:
200: 200:
description: "successful operation" description: "successful operation"
...@@ -423,7 +424,7 @@ paths: ...@@ -423,7 +424,7 @@ paths:
description: "Updated user object" description: "Updated user object"
required: true required: true
schema: schema:
$ref: "https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/openAPI/User.yml#/User" $ref: "https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/User.yml#/User"
responses: responses:
400: 400:
description: "Invalid user supplied" description: "Invalid user supplied"
...@@ -462,17 +463,14 @@ securityDefinitions: ...@@ -462,17 +463,14 @@ securityDefinitions:
admin:User: "Grants access to admin operations" admin:User: "Grants access to admin operations"
write:Credentials: "modify cloud credentials in your account" write:Credentials: "modify cloud credentials in your account"
read:Credentials: "read your cloud credentials" read:Credentials: "read your cloud credentials"
externalDocs:
description: "Find out more about DRIP"
url: "https://github.com/QCAPI-DRIP/DRIP-integration/wiki"
definitions: definitions:
User: User:
$ref: "https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/openAPI/User.yml#/User" $ref: "https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/User.yml#/User"
Credentials: Credentials:
$ref: "https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/openAPI/TOSCA/Credentials.yml#/Credentials" $ref: "https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/TOSCA/Credentials.yml#/Credentials"
NodeTemplate: NodeTemplate:
$ref: "https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/openAPI/TOSCA/NodeTemplate.yml#/NodeTemplate" $ref: "https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/TOSCA/NodeTemplate.yml#/NodeTemplate"
TopologyTemplate: TopologyTemplate:
$ref: "https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/openAPI/TOSCA/TopologyTemplate.yml#/TopologyTemplate" $ref: "https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/TOSCA/TopologyTemplate.yml#/TopologyTemplate"
ToscaTemplate: ToscaTemplate:
$ref: "https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/openAPI/TOSCA/ToscaTemplate.yml#/ToscaTemplate" $ref: "https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/TOSCA/ToscaTemplate.yml#/ToscaTemplate"
\ No newline at end of file \ No newline at end of file
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