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

added plan check

parent 973a393b
......@@ -12,14 +12,6 @@ repositories:
description: >
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:
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<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="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -21,7 +26,7 @@
<component name="ProjectId" id="1TI7vNZs1Z3y1uB6wXCH5F47r0F" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<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" />
</component>
<component name="RecentsManager">
......@@ -59,7 +64,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<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="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
......@@ -230,12 +235,12 @@
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/planner/planner.py</url>
<line>66</line>
<line>71</line>
<option name="timeStamp" value="8" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/planner/planner.py</url>
<line>61</line>
<line>66</line>
<option name="timeStamp" value="9" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
......@@ -243,6 +248,11 @@
<line>22</line>
<option name="timeStamp" value="21" />
</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>
</breakpoint-manager>
</component>
......
......@@ -95,10 +95,12 @@ def handle_delivery(message):
conf = {'url': "http://host"}
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.set_infrastructure_specifications()
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))
response = {'toscaTemplate': template_dict}
......
......@@ -12,9 +12,14 @@ from util import tosca_helper
class Planner:
def __init__(self, path, spec_service):
self.path = path
self.tosca_template = ToscaTemplate(path)
def __init__(self, tosca_path=None, yaml_dict_tpl=None, spec_service=spec_service):
if tosca_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.all_custom_def = self.tosca_template.nodetemplates[0].custom_def
self.all_node_types = {}
......
swagger: "2.0"
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"
title: "DRIP"
title: "CONF"
contact:
email: "z.zhao@uva.nl"
license:
......@@ -40,7 +40,7 @@ paths:
/tosca_template/ids:
get:
summary: "Get all topolog template IDs"
description: "Returns all IDss "
description: "Returns all IDs"
operationId: "getToscaTemplateIDs"
produces:
- "application/json"
......@@ -172,7 +172,8 @@ paths:
security:
- auth:
- "write:ToscaTemplate"
- "read:ToscaTemplate"
- "read:ToscaTemplate"
/provisioner/provision/{id}:
get:
summary: "provision tosca template"
......@@ -218,7 +219,7 @@ paths:
200:
description: "successful operation"
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:
description: "Invalid ID supplied"
404:
......@@ -272,7 +273,7 @@ paths:
description: "Created user object"
required: true
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:
200:
description: "successful operation"
......@@ -325,7 +326,7 @@ paths:
description: "Created user object"
required: true
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:
200:
description: "successful operation"
......@@ -423,7 +424,7 @@ paths:
description: "Updated user object"
required: true
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:
400:
description: "Invalid user supplied"
......@@ -462,17 +463,14 @@ securityDefinitions:
admin:User: "Grants access to admin operations"
write:Credentials: "modify cloud credentials in your account"
read:Credentials: "read your cloud credentials"
externalDocs:
description: "Find out more about DRIP"
url: "https://github.com/QCAPI-DRIP/DRIP-integration/wiki"
definitions:
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:
$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:
$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:
$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:
$ref: "https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/openAPI/TOSCA/ToscaTemplate.yml#/ToscaTemplate"
\ No newline at end of file
$ref: "https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/TOSCA/ToscaTemplate.yml#/ToscaTemplate"
\ 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