Commit 8f218e37 authored by Spiros Koulouzis's avatar Spiros Koulouzis

added lifewatch tosca

parent 632a6a56
tosca_definitions_version: "tosca_simple_yaml_1_0"
description: "TOSCA example"
imports:
- nodes: "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/nodes.yaml"
- data: "https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/data.yml"
- capabilities: "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/capabilities.yaml"
- policies: "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/policies.yaml"
- interfaces: "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/interfaces.yml"
tosca_definitions_version: tosca_simple_yaml_1_0
topology_template:
node_templates:
kubernetes:
properties:
min_masters_num: 1
min_workers_num: 1
#requirements:
#- host:
#capability: "tosca.capabilities.ARTICONF.VM.topology"
#node: "topology"
#relationship: "tosca.relationships.HostedOn"
interfaces:
Kubernetes:
create:
inputs:
playbook: "https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/create_k8s.yml"
install:
inputs:
playbook: "https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/install_k8s.yml"
type: "tosca.nodes.ARTICONF.Orchestrator.Kubernetes"
#mysql:
#type: "tosca.nodes.ARTICONF.Container.Application.Docker"
#properties:
#environment:
#MYSQL_DATABASE: "wordpress"
#MYSQL_PASSWORD: "wordpress"
#MYSQL_ROOT_PASSWORD: "somewordpress"
#MYSQL_USER: "wordpress"
#ports:
#- "3306:3306"
#volumes:
#- "db_data:/var/lib/mysql"
#requirements:
#- host:
#capability: "tosca.capabilities.ARTICONF.docker.Orchestrator"
#node: "kubernetes"
#relationship: "tosca.relationships.HostedOn"
#artifacts:
#image:
#file: "mysql:5.7"
#repository: "docker_hub"
#type: "tosca.artifacts.Deployment.Image.Container.Docker"
#topology:
#properties:
#domain: "Frankfurt"
#provider: "EC2"
#interfaces:
#CloudsStorm:
#provision:
#inputs:
#code_type: "SEQ"
#object_type: "SubTopology"
#type: "tosca.nodes.ARTICONF.VM.topology"
imports:
- nodes: https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/nodes.yaml
- data: https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/data.yml
- capabilities: https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/capabilities.yaml
- policies: https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/policies.yaml
- interfaces: https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/interfaces.yml
repositories:
docker_hub: https://hub.docker.com/
description: >
TOSCA example
topology_template:
node_templates:
ws-pema:
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
topology:
type: tosca.nodes.ARTICONF.VM.topology
interfaces:
CloudsStorm:
provision:
inputs:
code_type: SEQ
object_type: SubTopology
properties:
domain: UvA (Amsterdam, The Netherlands) XO Rack
provider: ExoGENI
......@@ -258,13 +258,9 @@ class Planner:
for req in all_requirements:
if 'capability' in req[next(iter(req))]:
capability = req[next(iter(req))]['capability']
# Find nodes in node_templates that have the capability
logger.info(' Looking for nodes in node_templates with capability: ' + capability)
capable_nodes = self.get_node_templates_by_capability(capability)
if not capable_nodes:
# Find all nodes in the definitions that have the capability: capability
logger.info(' Looking for nodes in node types with capability: ' + capability)
capable_nodes = self.get_node_types_by_capability(capability)
# Find all nodes in the definitions that have the capability: capability
logger.info(' Looking for nodes in node types with capability: ' + capability)
capable_nodes = self.get_node_types_by_capability(capability)
if capable_nodes:
# Add number of matching capabilities for each node.
# Try to score matching_nodes to return one. The more requirements a node meets the better
......@@ -299,10 +295,3 @@ class Planner:
if parent_node_type_name == self.all_node_types[tosca_node_type]['derived_from']:
child_nodes[tosca_node_type] = self.all_node_types[tosca_node_type]
return child_nodes
def get_node_templates_by_capability(self, capability):
# capable_nodes = []
# for node_template in self.tosca_template.nodetemplates:
# for node_capability in node_template.get_capabilities():
# print(node_capability)
return None
......@@ -40,12 +40,10 @@ class MyTestCase(unittest.TestCase):
input_tosca_file_path = self.get_input_tosca_file_path(file_name)
self.run_test(input_tosca_file_path)
# def test_lifeWatch(self):
# file_name = 'lifeWatch_vre1.yaml'
# input_tosca_file_path = self.get_input_tosca_file_path(file_name)
# self.run_test(input_tosca_file_path)
def test_lifeWatch(self):
file_name = 'lifeWatch_vre1.yaml'
input_tosca_file_path = self.get_input_tosca_file_path(file_name)
self.run_test(input_tosca_file_path)
def get_input_tosca_file_path(self, file_name):
tosca_path = "../../TOSCA/"
......
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