Commit 39ca2902 authored by Spiros Koulouzis's avatar Spiros Koulouzis

refactor planner

parent 2d9a56f4
...@@ -2,24 +2,10 @@ ...@@ -2,24 +2,10 @@
<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 afterPath="$PROJECT_DIR$/.idea/drip-planner.iml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/__main__.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/__main__.py" beforeDir="false" afterPath="$PROJECT_DIR$/__main__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/planner/__init__.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/test/test_planner.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/test_planner.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/planner/planner.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/service/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/service/simple_spec_alayzer.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/service/spec_service.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/service/specification_analyzer.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/setup.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/test/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/test/test_planner.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/util/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/util/tosca_helper.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip_planner2/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../drip_planner2/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../drip_planner2/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../drip_planner2/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip_planner2/src/planner/planner.py" beforeDir="false" afterPath="$PROJECT_DIR$/../drip_planner2/src/planner/planner.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip_planner2/src/planner/simple_spec_alayzer.py" beforeDir="false" afterPath="$PROJECT_DIR$/../drip_planner2/src/planner/simple_spec_alayzer.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip_planner2/src/tests/test_planner.py" beforeDir="false" afterPath="$PROJECT_DIR$/../drip_planner2/src/tests/test_planner.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../jenkins_pipeline" beforeDir="false" afterPath="$PROJECT_DIR$/../jenkins_pipeline" 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" />
...@@ -122,6 +108,14 @@ ...@@ -122,6 +108,14 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1573135985084</updated> <updated>1573135985084</updated>
</task> </task>
<task id="LOCAL-00001" summary="refactor planner">
<created>1573136717037</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1573136717037</updated>
</task>
<option name="localTasksCounter" value="2" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
...@@ -135,4 +129,8 @@ ...@@ -135,4 +129,8 @@
</map> </map>
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration">
<MESSAGE value="refactor planner" />
<option name="LAST_COMMIT_MESSAGE" value="refactor planner" />
</component>
</project> </project>
\ No newline at end of file
...@@ -11,8 +11,11 @@ import pika ...@@ -11,8 +11,11 @@ import pika
import yaml import yaml
import sys import sys
from toscaparser.tosca_template import ToscaTemplate
from planner.planner import Planner from planner.planner import Planner
from service.spec_service import SpecService from service.spec_service import SpecService
from util import tosca_helper
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -94,7 +97,7 @@ def handle_delivery(message): ...@@ -94,7 +97,7 @@ def handle_delivery(message):
test_planner = Planner(input_tosca_file_path, spec_service) test_planner = Planner(input_tosca_file_path, 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_util.get_tosca_template_2_topology_template_dictionary(tosca_template) template_dict = tosca_helper.get_tosca_template_2_topology_template_dictionary(tosca_template)
logger.info("template ----: \n" + yaml.dump(template_dict)) logger.info("template ----: \n" + yaml.dump(template_dict))
response = {'toscaTemplate': template_dict} response = {'toscaTemplate': template_dict}
...@@ -118,7 +121,7 @@ if __name__ == "__main__": ...@@ -118,7 +121,7 @@ if __name__ == "__main__":
test_planner = Planner(input_tosca_file_path, spec_service) test_planner = Planner(input_tosca_file_path, spec_service)
test_tosca_template = test_planner.resolve_requirements() test_tosca_template = test_planner.resolve_requirements()
test_tosca_template = test_planner.set_infrastructure_specifications() test_tosca_template = test_planner.set_infrastructure_specifications()
template_dict = tosca_util.get_tosca_template_2_topology_template_dictionary(test_tosca_template) template_dict = tosca_helper.get_tosca_template_2_topology_template_dictionary(test_tosca_template)
logger.info("template ----: \n" + yaml.dump(template_dict)) logger.info("template ----: \n" + yaml.dump(template_dict))
try: try:
......
...@@ -11,13 +11,14 @@ from toscaparser.tosca_template import ToscaTemplate ...@@ -11,13 +11,14 @@ from toscaparser.tosca_template import ToscaTemplate
from planner.planner import Planner from planner.planner import Planner
from service.spec_service import SpecService from service.spec_service import SpecService
from util import tosca_helper
class MyTestCase(unittest.TestCase): class MyTestCase(unittest.TestCase):
def test_something(self): def test_something(self):
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
tosca_path = "../../TOSCA/" tosca_path = "../TOSCA/"
input_tosca_file_path = tosca_path + '/application_example_2_topologies.yaml' input_tosca_file_path = tosca_path + '/application_example_2_topologies.yaml'
dir_path = os.path.dirname(os.path.realpath(__file__)) dir_path = os.path.dirname(os.path.realpath(__file__))
...@@ -31,7 +32,7 @@ class MyTestCase(unittest.TestCase): ...@@ -31,7 +32,7 @@ class MyTestCase(unittest.TestCase):
test_planner = Planner(input_tosca_file_path, spec_service) test_planner = Planner(input_tosca_file_path, spec_service)
test_tosca_template = test_planner.resolve_requirements() test_tosca_template = test_planner.resolve_requirements()
test_tosca_template = test_planner.set_infrastructure_specifications() test_tosca_template = test_planner.set_infrastructure_specifications()
template_dict = tosca_util.get_tosca_template_2_topology_template_dictionary(test_tosca_template) template_dict = tosca_helper.get_tosca_template_2_topology_template_dictionary(test_tosca_template)
logger.info("template ----: \n" + yaml.dump(template_dict)) logger.info("template ----: \n" + yaml.dump(template_dict))
try: try:
...@@ -57,7 +58,3 @@ class MyTestCase(unittest.TestCase): ...@@ -57,7 +58,3 @@ class MyTestCase(unittest.TestCase):
response["parameters"] = [] response["parameters"] = []
print("Output message:" + json.dumps(response)) print("Output message:" + json.dumps(response))
self.assertEqual(True, True) self.assertEqual(True, True)
if __name__ == '__main__':
unittest.main()
...@@ -2,24 +2,10 @@ ...@@ -2,24 +2,10 @@
<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 afterPath="$PROJECT_DIR$/../drip-planner/.idea/drip-planner.iml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../drip-planner/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-planner/.idea/workspace.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../drip-planner/__main__.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../drip-planner/__main__.py" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-planner/__main__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../drip-planner/planner/__init__.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../drip-planner/test/test_planner.py" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-planner/test/test_planner.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../drip-planner/planner/planner.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../drip-planner/service/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../drip-planner/service/simple_spec_alayzer.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../drip-planner/service/spec_service.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../drip-planner/service/specification_analyzer.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../drip-planner/setup.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../drip-planner/test/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../drip-planner/test/test_planner.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../drip-planner/util/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../drip-planner/util/tosca_helper.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/planner/planner.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/planner/planner.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/planner/simple_spec_alayzer.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/planner/simple_spec_alayzer.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/test_planner.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/test_planner.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../jenkins_pipeline" beforeDir="false" afterPath="$PROJECT_DIR$/../jenkins_pipeline" 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" />
......
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