Commit b11f9e1e authored by Spiros Koulouzis's avatar Spiros Koulouzis

added cloud provider requirement

parent 91eb69c0
tosca_definitions_version: tosca_simple_yaml_1_0
imports:
- nodes: https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/nodes.yaml
- data: https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/TOSCA/types/data.yml
- capabilities: https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/capabilities.yaml
- policies: https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/policies.yaml
- interfaces: https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/interfaces.yml
repositories:
docker_hub: https://hub.docker.com/
description: >
TOSCA example
topology_template:
node_templates:
ws-pema-lifewatch:
type: tosca.nodes.ARTICONF.Container.Application.Docker
properties:
ports:
- "30001:8080"
artifacts:
image:
type: tosca.artifacts.Deployment.Image.Container.Docker
file: alogo53/ws-pema-lifewatch
repository: docker_hub
policies:
- location:
type: tosca.policies.ARTICONF.Placement.Requirement.Provider
targets: [ ws-pema-lifewatch ]
properties:
accepted_providers:
- ExoGENI
......@@ -39,3 +39,14 @@ policy_types:
type: integer
required: false
description: the minimum acceptable value
tosca.policies.ARTICONF.Placement.Requirement.Provider:
derived_from: tosca.policies.Placement
description: defines cloud providr where vm topology can be deployed
properties:
accepted_providers:
type: list
description: list of the acceptable providers
schema_entry:
type: string
......@@ -15,16 +15,49 @@ from service.spec_service import SpecService
from util import tosca_helper
def get_tosca_files_path(file_name):
tosca_path = "../../TOSCA/"
input_tosca_file_path = tosca_path + file_name
if not os.path.exists(input_tosca_file_path):
tosca_path = "../TOSCA/"
input_tosca_file_path = tosca_path + file_name
return input_tosca_file_path
class MyTestCase(unittest.TestCase):
def test_planner(self):
# def test_planner1(self):
# logger = logging.getLogger(__name__)
#
# input_tosca_file_path = get_tosca_files_path('application_example_updated.yaml')
#
# self.assertEqual(True, os.path.exists(input_tosca_file_path),
# "Input TOSCA file: " + input_tosca_file_path + " not found")
#
# conf = {'url': "http://host"}
# spec_service = SpecService(conf)
# test_planner = Planner(input_tosca_file_path, spec_service)
# test_tosca_template = test_planner.resolve_requirements()
# test_tosca_template = test_planner.set_infrastructure_specifications()
# template_dict = tosca_helper.get_tosca_template_2_topology_template_dictionary(test_tosca_template)
# logger.info("template ----: \n" + yaml.dump(template_dict))
# ToscaTemplate(yaml_dict_tpl=copy.deepcopy(template_dict))
#
# test_response = {'toscaTemplate': template_dict}
#
# response = {'toscaTemplate': template_dict}
# output_current_milli_time = int(round(time.time() * 1000))
# response["creationDate"] = output_current_milli_time
# response["parameters"] = []
# print("Output message:" + json.dumps(response))
# self.assertEqual(True, True)
def test_planner2(self):
logger = logging.getLogger(__name__)
tosca_path = "../../TOSCA/"
input_tosca_file_path = tosca_path + '/application_example_updated.yaml'
if not os.path.exists(input_tosca_file_path):
tosca_path = "../TOSCA/"
input_tosca_file_path = tosca_path + '/application_example_updated.yaml'
input_tosca_file_path = get_tosca_files_path('lifeWatch_vre1.yaml')
self.assertEqual(True, os.path.exists(input_tosca_file_path),
"Input TOSCA file: " + input_tosca_file_path + " not found")
......@@ -36,7 +69,6 @@ class MyTestCase(unittest.TestCase):
test_tosca_template = test_planner.set_infrastructure_specifications()
template_dict = tosca_helper.get_tosca_template_2_topology_template_dictionary(test_tosca_template)
logger.info("template ----: \n" + yaml.dump(template_dict))
ToscaTemplate(yaml_dict_tpl=copy.deepcopy(template_dict))
test_response = {'toscaTemplate': template_dict}
......
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