Commit 66eecd36 authored by Spiros Koulouzis's avatar Spiros Koulouzis

renamed Orchestrator type

parent c545cb6e
...@@ -28,16 +28,17 @@ topology_template: ...@@ -28,16 +28,17 @@ topology_template:
file: alogo53/ws-pema-lifewatch file: alogo53/ws-pema-lifewatch
repository: docker_hub repository: docker_hub
policies: #policies:
- location: #- location:
type: tosca.policies.ARTICONF.Placement.Requirement.Provider #type: tosca.policies.ARTICONF.Requirement.Provider
targets: [ ws-pema-lifewatch ] #targets: [ ws-pema-lifewatch ]
properties: #properties:
accepted_providers: #accepted_providers:
- ExoGENI #- ExoGENI
- docker_orchestrator: #- orchestrator:
type: tosca.policies.ARTICONF.Requirement.docker.Orchestrator #type: tosca.policies.ARTICONF.Requirement.docker.Orchestrator
targets: [ ws-pema-lifewatch ] #targets: [ ws-pema-lifewatch ]
properties: #properties:
accepted_orchestrator_types: #accepted_orchestrator_types:
- tosca.nodes.ARTICONF.docker.Orchestrator.Kubernetes #- tosca.nodes.ARTICONF.docker.Orchestrator.Kubernetes
...@@ -33,7 +33,7 @@ node_types: ...@@ -33,7 +33,7 @@ node_types:
- host: - host:
capability: tosca.capabilities.ARTICONF.docker.Orchestrator capability: tosca.capabilities.ARTICONF.docker.Orchestrator
node: tosca.nodes.ARTICONF.docker.Orchestrator node: tosca.nodes.ARTICONF.docker.Orchestrator
relationship: tosca.relationships.HostedOn relationship: tosca.relationships.HostedOn
tosca.nodes.ARTICONF.docker.Orchestrator: tosca.nodes.ARTICONF.docker.Orchestrator:
derived_from: tosca.nodes.ARTICONF.Root derived_from: tosca.nodes.ARTICONF.Root
...@@ -84,13 +84,13 @@ node_types: ...@@ -84,13 +84,13 @@ node_types:
type: tosca.interfaces.ARTICONF.Kubernetes type: tosca.interfaces.ARTICONF.Kubernetes
install: install:
inputs: inputs:
playbook: https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/ansible_playbooks/install_k8s.yml playbook: https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/install_k8s.yml
create: create:
inputs: inputs:
playbook: https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/ansible_playbooks/create_k8s.yml playbook: https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/create_k8s.yml
configure: configure:
inputs: inputs:
playbook: https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/ansible_playbooks/dashboard.yaml playbook: https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/dashboard.yaml
tosca.nodes.ARTICONF.docker.Orchestrator.Swarm: tosca.nodes.ARTICONF.docker.Orchestrator.Swarm:
......
...@@ -179,6 +179,9 @@ class Planner: ...@@ -179,6 +179,9 @@ class Planner:
def find_best_node_for_requirements(self, all_requirements): def find_best_node_for_requirements(self, all_requirements):
"""Returns the 'best' node for a set of requirements. Here we count the number of requiremets that the node """Returns the 'best' node for a set of requirements. Here we count the number of requiremets that the node
can cover and return the one which covers the most """ can cover and return the one which covers the most """
# Check if we have a preference from policies
matching_nodes = {} matching_nodes = {}
number_of_matching_requirement = {} number_of_matching_requirement = {}
# Loop requirements to find nodes per requirement # Loop requirements to find nodes per requirement
......
...@@ -19,7 +19,7 @@ class SimpleAnalyzer(SpecificationAnalyzer): ...@@ -19,7 +19,7 @@ class SimpleAnalyzer(SpecificationAnalyzer):
return_nodes = [] return_nodes = []
# nodes_with_occurrences_in_requirements = tosca_util.get_nodes_with_occurrences_in_requirements( # nodes_with_occurrences_in_requirements = tosca_util.get_nodes_with_occurrences_in_requirements(
# self.tosca_template.nodetemplates) # self.tosca_template.nodetemplates)
orchestrator_nodes = tosca_helper.get_nodes_by_type('tosca.nodes.ARTICONF.Orchestrator', orchestrator_nodes = tosca_helper.get_nodes_by_type('tosca.nodes.ARTICONF.docker.Orchestrator',
self.tosca_template.nodetemplates, self.all_node_types, self.tosca_template.nodetemplates, self.all_node_types,
self.all_custom_def) self.all_custom_def)
...@@ -115,7 +115,7 @@ class SimpleAnalyzer(SpecificationAnalyzer): ...@@ -115,7 +115,7 @@ class SimpleAnalyzer(SpecificationAnalyzer):
logging.info('Setting properties for: ' + str(affected_node.type)) logging.info('Setting properties for: ' + str(affected_node.type))
# ancestors_types = tosca_helper.get_all_ancestors_types(affected_node, self.all_node_types, self.all_custom_def) # ancestors_types = tosca_helper.get_all_ancestors_types(affected_node, self.all_node_types, self.all_custom_def)
# if 'tosca.nodes.ARTICONF.Orchestrator' in ancestors_types: # if 'tosca.nodes.ARTICONF.docker.Orchestrator' in ancestors_types:
# logging.info('Do Something') # logging.info('Do Something')
ancestors_properties = tosca_helper.get_all_ancestors_properties(affected_node, self.all_node_types, ancestors_properties = tosca_helper.get_all_ancestors_properties(affected_node, self.all_node_types,
self.all_custom_def) self.all_custom_def)
......
...@@ -67,8 +67,9 @@ class MyTestCase(unittest.TestCase): ...@@ -67,8 +67,9 @@ class MyTestCase(unittest.TestCase):
test_tosca_template = test_planner.set_infrastructure_specifications() test_tosca_template = test_planner.set_infrastructure_specifications()
template_dict = tosca_helper.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))
ToscaTemplate(yaml_dict_tpl=copy.deepcopy(template_dict))
print(yaml.dump(template_dict)) print(yaml.dump(template_dict))
ToscaTemplate(yaml_dict_tpl=copy.deepcopy(template_dict))
test_response = {'toscaTemplate': template_dict} test_response = {'toscaTemplate': template_dict}
response = {'toscaTemplate': template_dict} response = {'toscaTemplate': template_dict}
......
...@@ -121,8 +121,8 @@ def node_type_2_node_template(node_type, all_custom_def): ...@@ -121,8 +121,8 @@ def node_type_2_node_template(node_type, all_custom_def):
node_type[next(iter(node_type))].pop('type') node_type[next(iter(node_type))].pop('type')
node_template = NodeTemplate(name, node_template_dict, node_type) node_template = NodeTemplate(name, node_template_dict, node_type)
# For some reason the tosca.nodes.ARTICONF.Orchestrator doesn't have all definitions so we need to add them # For some reason the tosca.nodes.ARTICONF.docker.Orchestrator doesn't have all definitions so we need to add them
# manually. We get 'toscaparser.common.exception.InvalidTypeError: Type "tosca.nodes.ARTICONF.Orchestrator" # manually. We get 'toscaparser.common.exception.InvalidTypeError: Type "tosca.nodes.ARTICONF.docker.Orchestrator"
# is not a valid type.' # is not a valid type.'
if len(node_template.custom_def) < len(all_custom_def): if len(node_template.custom_def) < len(all_custom_def):
for def_key in all_custom_def: for def_key in all_custom_def:
......
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