Commit 08010adf authored by Spiros Koulouzis's avatar Spiros Koulouzis

tests

parent fcddcef3
tosca_definitions_version: tosca_simple_yaml_1_0
description: TOSCA template
topology_template:
node_templates:
compute:
properties:
disk_size: "120 GB"
mem_size: "7 GB"
num_cores: 4
os: Ubuntu 18.04
user_name: vm_user
interfaces:
Standard:
create: dumy.yaml
type: tosca.nodes.QC.VM.Compute
compute_1:
properties:
disk_size: "120 GB"
mem_size: "7 GB"
num_cores: 4
os: Ubuntu 18.04
user_name: vm_user
interfaces:
Standard:
create: dumy.yaml
type: tosca.nodes.QC.VM.Compute
topology:
properties:
domain: Ireland
provider: EC2
requirements:
- vm:
capability: tosca.capabilities.QC.VM
node: compute
relationship: tosca.relationships.DependsOn
- vm:
capability: tosca.capabilities.QC.VM
node: compute_1
relationship: tosca.relationships.DependsOn
interfaces:
CloudsStorm:
delete:
inputs:
code_type: SEQ
object_type: SubTopology
hscale:
inputs:
code_type: SEQ
object_type: SubTopology
provision:
inputs:
code_type: SEQ
object_type: SubTopology
start:
inputs:
code_type: SEQ
object_type: SubTopology
stop:
inputs:
code_type: SEQ
object_type: SubTopology
type: tosca.nodes.QC.VM.topology
artifacts:
provisioned_files:
required: false
type: "string"
imports:
- nodes: https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/nodes.yaml
- data: https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/data.yml
- capabilities: https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/capabilities.yaml
- policies: https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/policies.yaml
- interfaces: https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/interfaces.yml
tosca_definitions_version: tosca_simple_yaml_1_0
description: TOSCA template
topology_template:
node_templates:
compute:
properties:
disk_size: "40 GB"
mem_size: "17500 MB"
num_cores: 2
os: Ubuntu 18.04
user_name: vm_user
interfaces:
Standard:
create: dumy.yaml
type: tosca.nodes.QC.VM.Compute
compute_1:
properties:
disk_size: "40 GB"
mem_size: "17500 MB"
num_cores: 2
os: Ubuntu 18.04
user_name: vm_user
interfaces:
Standard:
create: dumy.yaml
type: tosca.nodes.QC.VM.Compute
topology:
properties:
domain: Ireland
provider: EC2
requirements:
- vm:
capability: tosca.capabilities.QC.VM
node: compute
relationship: tosca.relationships.DependsOn
- vm:
capability: tosca.capabilities.QC.VM
node: compute_1
relationship: tosca.relationships.DependsOn
interfaces:
CloudsStorm:
delete:
inputs:
code_type: SEQ
object_type: SubTopology
hscale:
inputs:
code_type: SEQ
object_type: SubTopology
provision:
inputs:
code_type: SEQ
object_type: SubTopology
start:
inputs:
code_type: SEQ
object_type: SubTopology
stop:
inputs:
code_type: SEQ
object_type: SubTopology
type: tosca.nodes.QC.VM.topology
artifacts:
provisioned_files:
required: false
type: "string"
imports:
- nodes: https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/nodes.yaml
- data: https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/data.yml
- capabilities: https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/capabilities.yaml
- policies: https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/policies.yaml
- interfaces: https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/interfaces.yml
tosca_definitions_version: "tosca_simple_yaml_1_0"
topology_template:
node_templates:
compute:
properties:
disk_size: "120 GB"
mem_size: "7 GB"
num_cores: 4
os: "Ubuntu 18.04"
user_name: "vm_user"
interfaces:
Standard:
create: dumy.yaml
type: tosca.nodes.QC.VM.Compute
#compute_1:
#properties:
#disk_size: "40000 MB"
#mem_size: "1000 MB"
#num_cores: 1
#os: "Ubuntu 18.04"
#user_name: "vm_user"
#interfaces:
#Standard:
#create: "dumy.yaml"
#type: "tosca.nodes.QC.VM.Compute"
topology:
properties:
domain: "Ireland"
provider: "EC2"
requirements:
#- vm:
#capability: "tosca.capabilities.QC.VM"
#node: "compute"
#relationship: "tosca.relationships.DependsOn"
- vm:
capability: "tosca.capabilities.QC.VM"
node: "compute_1"
relationship: "tosca.relationships.DependsOn"
interfaces:
CloudsStorm:
delete:
inputs:
code_type: "SEQ"
object_type: "SubTopology"
hscale:
inputs:
code_type: "SEQ"
object_type: "SubTopology"
provision:
inputs:
code_type: "SEQ"
object_type: "SubTopology"
start:
inputs:
code_type: "SEQ"
object_type: "SubTopology"
stop:
inputs:
code_type: "SEQ"
object_type: "SubTopology"
type: "tosca.nodes.QC.VM.topology"
artifacts:
provisioned_files:
required: false
type: "string"
description: "TOSCA example"
imports:
- nodes: "https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/nodes.yaml"
- data: "https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/data.yml"
- capabilities: "https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/capabilities.yaml"
- policies: "https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/policies.yaml"
- interfaces: "https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/interfaces.yml"
tosca_definitions_version: tosca_simple_yaml_1_0
topology_template:
node_templates:
compute:
properties:
num_cores: 2
disk_size: 20 GB
mem_size: 4098 MB
os: Ubuntu 18.04
user_name: vm_user
interfaces:
Standard:
create: dumy.yaml
type: tosca.nodes.QC.VM.Compute
topology:
properties:
domain: Iraland
provider: EC2
requirements:
- vm:
capability: tosca.capabilities.QC.VM
node: compute
relationship: tosca.relationships.DependsOn
interfaces:
CloudsStorm:
delete:
inputs:
code_type: SEQ
object_type: SubTopology
hscale:
inputs:
code_type: SEQ
object_type: SubTopology
provision:
inputs:
code_type: SEQ
object_type: SubTopology
start:
inputs:
code_type: SEQ
object_type: SubTopology
stop:
inputs:
code_type: SEQ
object_type: SubTopology
type: tosca.nodes.QC.VM.topology
description: TOSCA template
imports:
- nodes: https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/nodes.yaml
- data: https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/data.yml
- capabilities: https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/capabilities.yaml
- policies: https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/policies.yaml
- interfaces: https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/interfaces.yml
#!/bin/bash
TOSCA_ID="5f8eb46c8ff9431bd55e931a"
BASE_URL="https://fry.lab.uvalight.net:30001/manager/"
USERNAME=deploy_tester
PASSWORD=edvbafeabvafdb
#
# # curl -s -D - -k -u $USERNAME:$PASSWORD -X GET "$BASE_URL/tosca_template/$TOSCA_ID" &> tosca_output
# RESPONSE=`cat tosca_output | head -n 1 | cut '-d ' '-f2'`
#
# if [ $RESPONSE != "200" ];
# then
# cat tosca_output
# exit -1
# fi
# TOSCA_CONTENTS=`cat tosca_output | tail -n +11`
# echo $TOSCA_CONTENTS
#
#
# # curl -s -D - -k -u $USERNAME:$PASSWORD -X GET "$BASE_URL/provisioner/provision/$TOSCA_ID" &> provision_output
# RESPONSE=`cat provision_output | head -n 1 | cut '-d ' '-f2'`
#
# if [ $RESPONSE != "200" ];
# then
# cat provision_output
# exit -1
# fi
# PROVISION_ID=`cat provision_output | tail -n +11`
# PROVISION_ID=5f8ec0a68ff9431bd55e931e
# echo $PROVISION_ID
#
#
# curl -s -D - -k -u $USERNAME:$PASSWORD -X GET "$BASE_URL/deployer/deploy/$PROVISION_ID" &> deploy_output
# RESPONSE=`cat deploy_output | head -n 1 | cut '-d ' '-f2'`
#
# if [ $RESPONSE != "200" ];
# then
# cat deploy_output
# exit -1
# fi
# DEPLOY_ID=`cat deploy_output | tail -n +11`
# echo $DEPLOY_ID
#
# #
#
# # curl -u $USERNAME:$PASSWORD -X GET "$BASE_URL/tosca_template/$DEPLOY_ID"
# #
# # curl -u $USERNAME:$PASSWORD -X DELETE "$BASE_URL/tosca_template/$DEPLOY_ID"
#
#
......@@ -40,7 +40,7 @@ services:
#ipv4_address: 172.20.0.4
semaphore:
image: qcdis/docker_ansible_semaphore:2.4.1-2.9.9
image: ss
environment:
SEMAPHORE_DB_USER: semaphore
SEMAPHORE_DB_PASS: semaphore
......
......@@ -82,12 +82,12 @@ services:
#- "3001:3000"
manager:
sdia-orchestrator:
depends_on:
- rabbit
- mongo
- sure-tosca
image: qcdis/manager
image: qcdis/sdia-orchestrator
environment:
RABBITMQ_HOST: rabbit
MONGO_HOST: mongo
......@@ -120,15 +120,15 @@ services:
CLOUD_STORM_SECRET: 456
CREDENTIAL_SECRET: top_secret
#deployer:
#depends_on:
#- rabbit
#- sure-tosca
#image: qcdis/deployer
#environment:
#RABBITMQ_HOST: rabbit
#SURE_TOSCA_BASE_PATH: http://sure-tosca:8081/tosca-sure/1.0.0
#SEMAPHORE_BASE_PATH: http://semaphore:3000/api
deployer:
depends_on:
- rabbit
- sure-tosca
image: qcdis/deployer
environment:
RABBITMQ_HOST: rabbit
SURE_TOSCA_BASE_PATH: http://sure-tosca:8081/tosca-sure/1.0.0
SEMAPHORE_BASE_PATH: http://semaphore:3000/api
#cadvisor:
#image: gcr.io/google-containers/cadvisor:latest
......
......@@ -198,19 +198,19 @@
"description": "TOSCA example",
"imports": [
{
"nodes": "https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/types/nodes.yaml"
"nodes": "https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/nodes.yaml"
},
{
"data": "https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/types/data.yml"
"data": "https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/data.yml"
},
{
"capabilities": "https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/types/capabilities.yaml"
"capabilities": "https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/capabilities.yaml"
},
{
"policies": "https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/types/policies.yaml"
"policies": "https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/policies.yaml"
},
{
"interfaces": "https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/types/interfaces.yml"
"interfaces": "https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/interfaces.yml"
}
],
"dsl_definitions": null,
......
......@@ -362,11 +362,11 @@
" repository: \"docker_hub\"\n",
"description: \"TOSCA example\\n\"\n",
"imports:\n",
"- nodes: \"https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/types/nodes.yaml\"\n",
"- data: \"https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/types/data.yml\"\n",
"- capabilities: \"https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/types/capabilities.yaml\"\n",
"- policies: \"https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/types/policies.yaml\"\n",
"- interfaces: \"https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/types/interfaces.yml\"\n",
"- nodes: \"https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/nodes.yaml\"\n",
"- data: \"https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/data.yml\"\n",
"- capabilities: \"https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/capabilities.yaml\"\n",
"- policies: \"https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/policies.yaml\"\n",
"- interfaces: \"https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/types/interfaces.yml\"\n",
"repositories:\n",
" docker_hub: \"https://hub.docker.com/\"\n",
"\n"
......
......@@ -130,7 +130,7 @@ if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
if sys.argv[1] == "test_local":
tosca_path = "../TOSCA/"
input_tosca_file_path = tosca_path + '/application_example_updated.yaml'
input_tosca_file_path = tosca_path + '/generated_tosca_description_a8a061322c3b4b5593c289df841727af.yaml'
conf = {'url': "http://host"}
spec_service = SpecService(conf)
test_planner = Planner(input_tosca_file_path, spec_service)
......
import logging
import yaml
from toscaparser.nodetemplate import NodeTemplate
from toscaparser.tosca_template import ToscaTemplate
from toscaparser.topology_template import TopologyTemplate
import operator
from service.simple_spec_alayzer import SimpleAnalyzer
from util import tosca_helper
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
def add_requirements(node, missing_requirements, capable_node_name):
"""Add the requirements to the node """
for req in missing_requirements:
req[next(iter(req))]['node'] = capable_node_name
if isinstance(node, NodeTemplate):
contains_requirement = False
for node_requirement in node.requirements:
if node_requirement == req:
contains_requirement = True
break
if not contains_requirement:
node.requirements.append(req)
elif isinstance(node, dict):
type_name = next(iter(node))
if 'requirements' not in node[type_name]:
node[type_name]['requirements'] = []
node_requirements = node[type_name]['requirements']
contains_requirement = False
for node_requirement in node_requirements:
if node_requirement == req:
contains_requirement = True
break
if not contains_requirement:
node[type_name]['requirements'].append(req)
return node
def get_default_value(node_property):
if node_property and node_property.required and isinstance(node_property.value, dict) and 'required' in \
node_property.value and 'type' in node_property.value:
if node_property.default:
return {node_property.name: node_property.default}
if node_property.constraints:
for constraint in node_property.constraints:
print(constraint)
if node_property and node_property.required and node_property.value:
return {node_property.name: node_property.value}
return None
class Planner:
def __init__(self, tosca_path=None, yaml_dict_tpl=None, spec_service=None):
if tosca_path:
self.path = tosca_path
self.tosca_template = ToscaTemplate(tosca_path)
elif yaml_dict_tpl:
self.yaml_dict_tpl = yaml_dict_tpl
logger.info('yaml_dict_tpl:\n' + str(yaml.dump(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 = {}
self.all_node_types.update(self.tosca_node_types.items())
self.all_node_types.update(self.all_custom_def.items())
self.required_nodes = []
self.spec_service = spec_service
def add_required_nodes_to_template(self, required_nodes):
for req_node in required_nodes:
node_template = tosca_helper.node_type_2_node_template(req_node, self.all_custom_def)
self.tosca_template.nodetemplates.append(node_template)
return self.tosca_template
def set_default_node_properties(self, node):
logger.info('Setting properties for: ' + str(node.type))
ancestors_properties = tosca_helper.get_all_ancestors_properties(node, self.all_node_types,
self.all_custom_def)
default_properties = {}
if ancestors_properties:
for ancestors_property in ancestors_properties:
for node_prop in node.get_properties_objects():
if ancestors_property.name == node_prop.name and isinstance(node_prop.value,dict) \
and 'required' in node_prop.value and 'type' in node_prop.value:
default_property = get_default_value(ancestors_property)
if default_property:
node_prop.value = default_property
default_properties[next(iter(default_property))] = default_property[
next(iter(default_property))]
if default_properties:
for default_property in default_properties:
for node_prop_obj in node.get_properties_objects():
if default_property == node_prop_obj.name and not node_prop_obj.value:
node.get_properties_objects().append(default_property)
node_name = next(iter(node.templates))
if 'properties' in node.templates[node_name]:
for prop_name in node.templates[node_name]['properties']:
if isinstance(node.templates[node_name]['properties'][prop_name], dict) or \
isinstance(node.templates[node_name]['properties'][prop_name], str):
if 'required' in node.templates[node_name]['properties'][prop_name] and \
node.templates[node_name]['properties'][prop_name]['required'] and \
'default' in node.templates[node_name]['properties'][prop_name] and \
prop_name not in default_properties:
default_properties[prop_name] = node.templates[node_name]['properties'][prop_name][
'default']
logger.info(
'Adding to : ' + str(node.templates[node_name]) + ' properties: ' + str(default_properties))
node.templates[node_name]['properties'] = default_properties
return node
def set_node_templates_properties(self):
for node_template in self.tosca_template.nodetemplates:
self.set_default_node_properties(node_template)
specification_analyzer = SimpleAnalyzer(self.tosca_template)
nodes_with_new_relationship_occurrences = specification_analyzer.set_relationship_occurrences()
added_node_names = []
for new_spec_occurrences in nodes_with_new_relationship_occurrences:
for index, node_in_temple in enumerate(self.tosca_template.nodetemplates):
if new_spec_occurrences.name == node_in_temple.name:
added_node_names.append(new_spec_occurrences.name)
self.tosca_template.nodetemplates[index] = new_spec_occurrences
break
for new_spec_occurrences in nodes_with_new_relationship_occurrences:
if new_spec_occurrences.name not in added_node_names:
self.tosca_template.nodetemplates.append(new_spec_occurrences)
return self.tosca_template
def get_node_template_property(self, prop_key, node_prop_dict):
prop_value = self.spec_service.get_property(prop_key)
if prop_value:
return {prop_key: node_prop_dict}
else:
if 'required' in node_prop_dict and 'default' in node_prop_dict:
return node_prop_dict['default']
if 'constraints' in node_prop_dict:
constraints = node_prop_dict['constraints']
for constraint in constraints:
if next(iter(constraint)) == 'greater_or_equal':
return constraint[next(iter(constraint))]
return None
def resolve_requirements(self):
""" Resolve requirements. Go over all nodes and recursively resolve requirements till node has no
requirements e.g. docker -> k8s -> cluster -> vm """
for node in self.tosca_template.nodetemplates:
self.add_interfaces(node)
self.add_required_nodes(node)
return self.add_required_nodes_to_template(self.required_nodes)
def add_required_nodes(self, node):
"""Adds the required nodes in self.required_nodes for an input node."""
if isinstance(node, NodeTemplate):
logger.info('Resolving requirements for: ' + node.name)
elif isinstance(node, dict):
logger.info('Resolving requirements for: ' + str(next(iter(node))))
# Get all requirements for node.
all_requirements = self.get_all_requirements(node)
if not all_requirements:
logger.debug('Node: ' + tosca_helper.get_node_type_name(node) + ' has no requirements')
return
matching_node = self.find_best_node_for_requirements(all_requirements)
# Only add node that is not in node_templates
matching_node_type_name = next(iter(matching_node))
matching_node_template = tosca_helper.node_type_2_node_template(matching_node, self.all_custom_def)
# Add the requirements to the node we analyzed. e.g. docker needed host now we added the type and name of host
node = add_requirements(node, all_requirements, matching_node_template.name)
if not tosca_helper.contains_node_type(self.required_nodes, matching_node_type_name) and \
not tosca_helper.contains_node_type(self.tosca_template.nodetemplates, matching_node_type_name):
logger.info(' Adding: ' + str(matching_node_template.name))
self.required_nodes.append(matching_node)
# Find matching nodes for the new node's requirements
self.add_required_nodes(matching_node)
def get_all_requirements(self, node):
"""Returns all requirements for an input node including all parents requirements"""
node_type_name = tosca_helper.get_node_type_name(node)
logger.info(' Looking for requirements for node: ' + node_type_name)
# Get the requirements for this node from its definition e.g. docker: hostedOn k8s
def_type = self.all_node_types[node_type_name]
all_requirements = []
if 'requirements' in def_type.keys():
all_requirements = def_type['requirements']
logger.info(' Found requirements: ' + str(all_requirements) + ' for node: ' + node_type_name)
# Get the requirements for this node from the template. e.g. wordpress: connectsTo mysql
# node_requirements = tosca_helper.get_node_requirements(node)
# if node_requirements:
# all_requirements += node_requirements
# Put them all together
parent_requirements = tosca_helper.get_ancestors_requirements(node, self.all_node_types, self.all_custom_def)
parent_type = tosca_helper.get_node_type_name(node)
if parent_type and parent_requirements:
logger.info(
' Adding to : ' + str(node_type_name) + ' parent requirements from: ' + str(parent_type))
if not all_requirements:
all_requirements += parent_requirements
else:
for all_requirement in all_requirements:
for parent_requirement in parent_requirements:
all_requirement_key = next(iter(all_requirement))
parent_requirement_key = next(iter(parent_requirement))
if all_requirement_key != parent_requirement_key and all_requirement[all_requirement_key][
'capability'] != parent_requirement[parent_requirement_key]['capability']:
all_requirements.append(parent_requirement)
logger.debug(' all_requirements: ' + str(all_requirements))
return all_requirements
def get_node_types_by_capability(self, cap):
"""Returns all nodes that have the capability: cap and have interfaces. This way we distinguish between
'abstract' and 'concrete' """
candidate_nodes = {}
for tosca_node_type in self.all_node_types:
if tosca_node_type.startswith('tosca.nodes') and 'capabilities' in self.all_node_types[tosca_node_type]:
logger.debug(' Node: ' + str(tosca_node_type))
for caps in self.all_node_types[tosca_node_type]['capabilities']:
logger.debug(' ' + str(
self.all_node_types[tosca_node_type]['capabilities'][caps]['type']) + ' == ' + cap)
if self.all_node_types[tosca_node_type]['capabilities'][caps]['type'] == cap:
candidate_nodes[tosca_node_type] = self.all_node_types[tosca_node_type]
logger.debug(' candidate_node: ' + str(tosca_node_type))
candidate_child_nodes = {}
for node in candidate_nodes:
candidate_child_nodes.update(self.get_child_nodes(node))
candidate_nodes.update(candidate_child_nodes)
capable_nodes = {}
# Only return the nodes that have interfaces. This means that they are not "abstract"
nodes_type_names_with_interface = tosca_helper.get_node_types_with_interface(candidate_nodes)
for type_name in nodes_type_names_with_interface:
capable_nodes[type_name] = candidate_nodes[type_name]
return capable_nodes
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
can cover and return the one which covers the most """
matching_nodes = {}
number_of_matching_requirement = {}
# Loop requirements to find nodes per requirement
for req in all_requirements:
key = next(iter(req))
if not req[key]:
raise Exception('Requirement: '+str(req)+ ' is not properly defined')
if 'capability' in req[key]:
capability = req[key]['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
for node_type in capable_nodes:
matching_requirement_count = 1
if node_type not in number_of_matching_requirement:
number_of_matching_requirement[node_type] = matching_requirement_count
else:
matching_requirement_count = number_of_matching_requirement[node_type]
matching_requirement_count += 1
number_of_matching_requirement[node_type] = matching_requirement_count
logger.info(' Found: ' + str(node_type))
matching_nodes.update(capable_nodes)
else:
logger.error('Did not find any node with required capability: ' + str(capability))
raise Exception('Did not find any node with required capability: ' + str(capability))
# if we only found 1 return it
if len(matching_nodes) == 1:
return matching_nodes
sorted_number_of_matching_requirement = sorted(number_of_matching_requirement.items(),
key=operator.itemgetter(1))
index = len(sorted_number_of_matching_requirement) - 1
winner_type = next(iter(sorted_number_of_matching_requirement[index]))
return {winner_type: matching_nodes[winner_type]}
def get_child_nodes(self, parent_node_type_name):
child_nodes = {}
for tosca_node_type in self.all_node_types:
if tosca_node_type.startswith('tosca.nodes') and 'derived_from' in self.all_node_types[tosca_node_type]:
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 add_interfaces(self, node):
# node_type_interfaces = tosca_helper.get_node_type_interfaces(node)
# node_template_interfaces = tosca_helper.get_node_template_interfaces(node)
# if not node_template_interfaces and node_type_interfaces:
# tosca_helper.add_interfaces(node,node_type_interfaces)
return node
import copy
from toscaparser.nodetemplate import NodeTemplate
from toscaparser.properties import Property
import networkx as nx
import logging
from service.specification_analyzer import SpecificationAnalyzer
from util import tosca_helper
def get_default_value(node_property):
if node_property and node_property.required and isinstance(node_property.value, dict) and 'required' in \
node_property.value and 'type' in node_property.value:
if node_property.default:
return {node_property.name: node_property.default}
if node_property.constraints:
for constraint in node_property.constraints:
print(constraint)
if node_property and node_property.required and node_property.value:
return {node_property.name: node_property.value}
return None
class SimpleAnalyzer(SpecificationAnalyzer):
def __init__(self, tosca_template):
super(SimpleAnalyzer, self).__init__(tosca_template)
def set_relationship_occurrences(self):
return_nodes = []
nodes_with_min_vms = tosca_helper.get_nodes_by_type('tosca.nodes.QC.docker.Orchestrator',
self.tosca_template.nodetemplates, self.all_node_types,
self.all_custom_def)
nodes_with_min_vms = nodes_with_min_vms + tosca_helper.get_nodes_by_type('tosca.nodes.QC.Application.GlusterFS',
self.tosca_template.nodetemplates,
self.all_node_types,
self.all_custom_def)
min_masters_num = 0
workers_num = 0
if nodes_with_min_vms:
for node_with_min_vms in nodes_with_min_vms:
if 'properties' in node_with_min_vms.entity_tpl:
if 'min_masters_num' in node_with_min_vms.entity_tpl['properties']:
min_masters_num = min_masters_num + node_with_min_vms.entity_tpl['properties'][
'min_masters_num']
if 'min_workers_num' in node_with_min_vms.entity_tpl['properties']:
workers_num = workers_num + node_with_min_vms.entity_tpl['properties']['min_workers_num']
else:
min_masters_num = min_masters_num + node_with_min_vms.get_property_value('min_masters_num')
workers_num = workers_num + node_with_min_vms.get_property_value('min_workers_num')
if min_masters_num < 0:
min_masters_num = 1
topology_nodes = tosca_helper.get_nodes_by_type('tosca.nodes.QC.VM.topology',
self.tosca_template.nodetemplates, self.all_node_types,
self.all_custom_def)
if topology_nodes:
vm_nodes = tosca_helper.get_nodes_by_type('tosca.nodes.QC.VM.Compute',
self.tosca_template.nodetemplates, self.all_node_types,
self.all_custom_def)
if vm_nodes:
for i in range(len(vm_nodes), min_masters_num):
old_vm_name = vm_nodes[0].name
new_vm = copy.deepcopy(vm_nodes[0])
new_vm_name = new_vm.name + '_' + str(i)
new_vm.name = new_vm_name
templates = new_vm.templates.pop(old_vm_name)
new_vm.templates[new_vm_name] = templates
return_nodes.append(new_vm)
for requirement in topology_nodes[0].requirements:
requirement_key = next(iter(requirement))
requirement_value = requirement[requirement_key]
if requirement_value['capability'] == 'tosca.capabilities.QC.VM':
new_requirement = copy.deepcopy(requirement)
new_requirement[requirement_key]['node'] = new_vm.name
topology_nodes[0].requirements.append(new_requirement)
return_nodes.append(topology_nodes[0])
break
for i in range(len(vm_nodes), workers_num + 1):
old_vm_name = vm_nodes[0].name
new_vm = copy.deepcopy(vm_nodes[0])
new_vm_name = new_vm.name + '_' + str(i)
new_vm.name = new_vm_name
templates = new_vm.templates.pop(old_vm_name)
new_vm.templates[new_vm_name] = templates
return_nodes.append(new_vm)
for requirement in topology_nodes[0].requirements:
requirement_key = next(iter(requirement))
requirement_value = requirement[requirement_key]
if requirement_value['capability'] == 'tosca.capabilities.QC.VM':
new_requirement = copy.deepcopy(requirement)
new_requirement[requirement_key]['node'] = new_vm.name
topology_nodes[0].requirements.append(new_requirement)
return_nodes.append(topology_nodes[0])
break
return return_nodes
def set_node_specifications(self):
nodes = []
for node_template in self.tosca_template.nodetemplates:
nodes.append(self.set_default_node_properties(node_template))
return nodes
# def set_default_node_properties(self, node):
# logging.info('Setting properties for: ' + str(node.type))
# ancestors_properties = tosca_helper.get_all_ancestors_properties(node, self.all_node_types,
# self.all_custom_def)
# default_properties = {}
# for ancestors_property in ancestors_properties:
# default_property = get_default_value(ancestors_property)
# if default_property:
# default_properties[next(iter(default_property))] = default_property[next(iter(default_property))]
#
# if default_properties:
# for default_property in default_properties:
# node.get_properties_objects().append(default_property)
# node_name = next(iter(node.templates))
# if 'properties' in node.templates[node_name]:
# for prop_name in node.templates[node_name]['properties']:
# if isinstance(node.templates[node_name]['properties'][prop_name], dict) or \
# isinstance(node.templates[node_name]['properties'][prop_name], str):
# if 'required' in node.templates[node_name]['properties'][prop_name] and \
# node.templates[node_name]['properties'][prop_name]['required'] and \
# 'default' in node.templates[node_name]['properties'][prop_name] and \
# prop_name not in default_properties:
# default_properties[prop_name] = node.templates[node_name]['properties'][prop_name][
# 'default']
#
# logging.info(
# 'Adding to : ' + str(node.templates[node_name]) + ' properties: ' + str(default_properties))
# node.templates[node_name]['properties'] = default_properties
# return node
class SpecService:
def __init__(self, conf):
self.configuration = conf
def get_property(self, prop_key):
return None
from abc import abstractmethod, ABCMeta
from toscaparser.tosca_template import ToscaTemplate
import networkx as nx
# import matplotlib.pyplot as plt
class SpecificationAnalyzer(metaclass=ABCMeta):
def __init__(self, tosca_template):
self.tosca_template = tosca_template
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 = {}
self.all_node_types.update(self.tosca_node_types.items())
self.all_node_types.update(self.all_custom_def.items())
self.required_nodes = []
self.g = self.build_graph(self.tosca_template.nodetemplates)
self.root_nodes = []
self.leaf_nodes = []
for node_name, degree in self.g.in_degree():
if degree == 0:
self.root_nodes.append(node_name)
for node_name, degree in self.g.out_degree():
if degree == 0:
self.leaf_nodes.append(node_name)
def build_graph(self, node_templates):
graph = nx.DiGraph()
for node in node_templates:
graph.add_node(node.name, attr_dict=node.entity_tpl)
for req in node.requirements:
req_name = next(iter(req))
req_node_name = req[req_name]['node']
if 'relationship' in req[req_name] and 'type' in req[req_name]['relationship']:
relationship_type = req[req_name]['relationship']['type']
else:
if 'relationship' not in req[req_name]:
relationship_type = 'tosca.relationships.DependsOn'
else:
relationship_type = req[req_name]['relationship']
graph.add_edge(node.name, req_node_name, relationship=relationship_type)
# nx.draw(graph, with_labels=True)
# plt.savefig("/tmp/graph.png")
# plt.show()
return graph
@abstractmethod
def set_node_specifications(self):
raise NotImplementedError('Must implement upload in subclasses')
@abstractmethod
def set_relationship_occurrences(self):
raise NotImplementedError('Must implement upload in subclasses')
import copy
import json
import logging
import os
import os.path
import tempfile
import time
import unittest
import requests
import yaml
from toscaparser.tosca_template import ToscaTemplate
from planner.planner import Planner
from service.spec_service import SpecService
from util import tosca_helper
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
class MyTestCase(unittest.TestCase):
# def test_tic_gluster_fs(self):
# url = 'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/glusterFS.yaml'
# input_tosca_file_path = self.get_remote_tosca_file(url)
# self.run_test(input_tosca_file_path)
def test_tic(self):
url = 'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/TIC.yaml'
input_tosca_file_path = self.get_remote_tosca_file(url)
self.run_test(input_tosca_file_path)
def test_docker(self):
url = 'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_updated.yaml'
input_tosca_file_path = self.get_remote_tosca_file(url)
self.run_test(input_tosca_file_path)
url = 'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/lifeWatch_vre1.yaml'
input_tosca_file_path = self.get_remote_tosca_file(url)
self.run_test(input_tosca_file_path)
def test_kubernetes(self):
url = 'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/kubernetes.yaml'
input_tosca_file_path = self.get_remote_tosca_file(url)
self.run_test(input_tosca_file_path)
def test_topology(self):
url = 'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/topology.yaml'
input_tosca_file_path = self.get_remote_tosca_file(url)
self.run_test(input_tosca_file_path)
def test_compute(self):
url = 'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/compute.yaml'
input_tosca_file_path = self.get_remote_tosca_file(url)
self.run_test(input_tosca_file_path)
def test_lifeWatch(self):
url = 'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/lifeWatch_vre1.yaml'
tic_tosca = requests.get(url)
input_tosca_file_path = os.path.join(tempfile.gettempdir(),'TIC.yaml')
open( input_tosca_file_path, 'wb').write(tic_tosca.content)
self.run_test(input_tosca_file_path)
def get_input_tosca_file_path(self, 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
self.assertEqual(True, os.path.exists(input_tosca_file_path),
"Input TOSCA file: " + input_tosca_file_path + " not found")
return input_tosca_file_path
def run_test(self, input_tosca_file_path):
conf = {'url': "http://host"}
spec_service = SpecService(conf)
test_planner = Planner(input_tosca_file_path, spec_service)
test_tosca_template = test_planner.resolve_requirements()
template_dict = tosca_helper.get_tosca_template_2_topology_template_dictionary(test_tosca_template)
test_tosca_template = test_planner.set_node_templates_properties()
template_dict = tosca_helper.get_tosca_template_2_topology_template_dictionary(test_tosca_template)
logger.info("template ----: \n" + yaml.dump(template_dict))
print(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 get_remote_tosca_file(self, url):
tosca = requests.get(url)
input_tosca_file_path = os.path.join(tempfile.gettempdir(),'test_tosca_file.yaml')
open( input_tosca_file_path, 'wb').write(tosca.content)
return input_tosca_file_path
import copy
from itertools import chain
from toscaparser import tosca_template
from toscaparser.elements.nodetype import NodeType
from toscaparser.nodetemplate import NodeTemplate
import yaml
import logging
# TOSCA template key names
SECTIONS = (DEFINITION_VERSION, DEFAULT_NAMESPACE, TEMPLATE_NAME,
TOPOLOGY_TEMPLATE, TEMPLATE_AUTHOR, TEMPLATE_VERSION,
DESCRIPTION, IMPORTS, DSL_DEFINITIONS, NODE_TYPES,
RELATIONSHIP_TYPES, RELATIONSHIP_TEMPLATES,
CAPABILITY_TYPES, ARTIFACT_TYPES, DATA_TYPES, INTERFACE_TYPES,
POLICY_TYPES, GROUP_TYPES, REPOSITORIES, INPUTS, NODE_TEMPLATES,
OUTPUTS, GROUPS, SUBSTITUION_MAPPINGS, POLICIES, TYPE, REQUIREMENTS,
ARTIFACTS, PROPERTIES, INTERFACES) = \
('tosca_definitions_version', 'tosca_default_namespace',
'template_name', 'tosca_template', 'template_author',
'template_version', 'description', 'imports', 'dsl_definitions',
'node_types', 'relationship_types', 'relationship_templates',
'capability_types', 'artifact_types', 'data_types',
'interface_types', 'policy_types', 'group_types', 'repositories',
'inputs', 'node_templates', 'outputs', 'groups', 'substitution_mappings',
'policies', 'type', 'requirements', 'artifacts', 'properties', 'interfaces')
node_type_key_names_to_remove = ['capabilities', 'derived_from']
def get_node_type_name(node):
"""Returns the node's type name as string"""
if isinstance(node, NodeTemplate):
if node.type:
if node.type and isinstance(node.type, str):
node_type = node.type
elif isinstance(node.type, NodeTemplate):
node_type = node.type.type
else:
node_type = None
elif isinstance(node, dict):
node_type = next(iter(node))
return node_type
def get_node_requirements(node):
if isinstance(node, NodeTemplate):
node_requirements = node.requirements
elif isinstance(node, dict):
node_type_name = get_node_type_name(node)
if 'requirements' not in node[node_type_name]:
node[node_type_name]['requirements'] = {}
node_requirements = node[node_type_name]['requirements']
return node_requirements
def get_parent_type(node):
if isinstance(node, NodeTemplate):
if node.parent_type:
parent_type = node.parent_type.type
else:
parent_type = None
elif isinstance(node, dict):
parent_type = node[next(iter(node))]['derived_from']
return parent_type
def get_node_type_requirements(type_name, all_nodes):
"""Returns the requirements for an input node as described in the template not in the node's definition """
def_type = all_nodes[type_name]
if 'requirements' in def_type.keys():
return def_type['requirements']
return None
def get_ancestors_requirements(node, all_nodes, all_custom_def, parent_requirements=None):
"""Recursively get all requirements all the way to the ROOT including the input node's"""
if not parent_requirements:
parent_requirements = []
if isinstance(node, NodeTemplate):
# If node has parent and parent has requirements add them
if node.parent_type and node.parent_type.requirements:
if isinstance(node.parent_type.requirements, dict):
parent_requirements.append(node.parent_type.requirements)
elif isinstance(node.parent_type.requirements, list):
parent_requirements.extend(node.parent_type.requirements)
# Make parent type to NodeTemplate to continue
if node.parent_type.type:
parent_template = node_type_2_node_template({'name': all_nodes[node.parent_type.type]}, all_custom_def)
if parent_template:
get_ancestors_requirements(parent_template, all_nodes, parent_requirements)
elif isinstance(node, dict):
node_type_name = get_node_type_name(node)
node_template = node_type_2_node_template({'name': all_nodes[node_type_name]}, all_custom_def)
return get_ancestors_requirements(node_template, all_nodes, all_custom_def, parent_requirements)
return parent_requirements
def get_node_types_with_interface(nodes):
node_types_with_interface = []
for node_name in nodes:
if 'interfaces' in nodes[node_name].keys() and 'tosca.nodes.Root' != node_name:
node_types_with_interface.append(node_name)
return node_types_with_interface
def node_type_2_node_template(node_type, all_custom_def):
node_template_dict = {}
type_name = next(iter(node_type))
node_type_array = type_name.split(".")
name = node_type_array[len(node_type_array) - 1].lower()
node_template_dict[name] = node_type[next(iter(node_type))].copy()
node_template_dict[name]['type'] = type_name
for name_to_remove in node_type_key_names_to_remove:
if name_to_remove in node_template_dict[name]:
node_template_dict[name].pop(name_to_remove)
if 'type' in node_type[next(iter(node_type))]:
node_type[next(iter(node_type))].pop('type')
node_template = NodeTemplate(name, node_template_dict, node_type)
# For some reason the tosca.capabilities.QC.docker.Orchestrator doesn't have all definitions so we need to add them
# manually. We get 'toscaparser.common.exception.InvalidTypeError: Type "tosca.capabilities.QC.docker.Orchestrator"
# is not a valid type.'
if len(node_template.custom_def) < len(all_custom_def):
for def_key in all_custom_def:
if isinstance(def_key, dict):
node_template.custom_def.update(def_key)
else:
node_template.custom_def[def_key] = all_custom_def[def_key]
return node_template
def get_tosca_template_2_topology_template_dictionary(template):
yaml_str = tosca_template2_yaml(template)
tosca_template_dict = yaml.load(yaml_str, Loader=yaml.FullLoader)
this_tosca_template = tosca_template_dict['tosca_template']
tosca_template_dict.pop('tosca_template')
tosca_template_dict['topology_template'] = this_tosca_template
if template.policies and 'policies' not in tosca_template_dict['topology_template']:
policies_list = []
for policy in template.policies:
policy_dict = {policy.name: policy.entity_tpl}
policies_list.append(policy_dict)
tosca_template_dict['topology_template']['policies'] = policies_list
return tosca_template_dict
def contains_node_type(node_types_list, node_type_name):
if not node_types_list:
return False
for node_type in node_types_list:
if isinstance(node_type, NodeTemplate):
type_name = node_type.type
elif isinstance(node_type, dict):
type_name = next(iter(node_type))
if type_name == node_type_name:
return True
return False
def get_node_properties(node):
node_type_name = get_node_type_name(node)
return node[node_type_name]['properties']
def set_node_properties(node, properties):
node_type_name = get_node_type_name(node)
node[node_type_name]['properties'] = properties
return node
def get_nodes_by_type(node_type, nodes, all_node_types, all_custom_def):
nodes_by_type = []
for node in nodes:
if node.type == node_type:
nodes_by_type.append(node)
break
elif node_type in get_all_ancestors_types(node, all_node_types, all_custom_def):
nodes_by_type.append(node)
return nodes_by_type
def get_all_ancestors_types(child_node, all_node_types, all_custom_def, ancestors_types=None):
if not ancestors_types:
ancestors_types = [get_node_type_name(child_node)]
parent_type = get_parent_type(child_node)
if parent_type:
ancestors_types.append(parent_type)
parent_type = node_type_2_node_template({'name': all_node_types[parent_type]}, all_custom_def)
get_all_ancestors_types(parent_type, all_node_types, all_custom_def, ancestors_types)
return ancestors_types
def get_all_ancestors_properties(node, all_nodes, all_custom_def, ancestors_properties=None, ancestors_types=None):
if not ancestors_properties:
ancestors_properties = []
ancestors_properties_names = []
node_prop_names = []
if node.get_properties_objects():
for node_prop in node.get_properties_objects():
node_prop_names.append(node_prop.name)
ancestors_properties.append(node_prop)
if not ancestors_types:
ancestors_types = get_all_ancestors_types(node, all_nodes, all_custom_def)
for ancestors_type in ancestors_types:
ancestor = node_type_2_node_template({'name': all_nodes[ancestors_type]}, all_custom_def)
if ancestor.get_properties_objects():
for ancestor_prop in ancestor.get_properties_objects():
if ancestor_prop.name not in ancestors_properties_names and ancestor_prop.name not in node_prop_names:
ancestors_properties_names.append(ancestor_prop.name)
ancestors_properties.append(ancestor_prop)
return ancestors_properties
def get_nodes_with_occurrences_in_requirements(topology_nodes):
nodes_with_occurrences_in_requirement = []
for node in topology_nodes:
for requirement in node.requirements:
requirement_dict = requirement[next(iter(requirement))]
if 'occurrences' in requirement_dict:
nodes_with_occurrences_in_requirement.append(node)
break
return nodes_with_occurrences_in_requirement
def tosca_template2_yaml(tosca_template):
topology_dict = {DEFINITION_VERSION: tosca_template.version, IMPORTS: tosca_template._tpl_imports(),
DESCRIPTION: tosca_template.description, TOPOLOGY_TEMPLATE: {}}
topology_dict[TOPOLOGY_TEMPLATE][NODE_TEMPLATES] = {}
node_templates = tosca_template.nodetemplates
for node_template in node_templates:
node_template_dict = get_node_template_dict(node_template)
topology_dict[TOPOLOGY_TEMPLATE][NODE_TEMPLATES][node_template.name] = node_template_dict
# If we don't add this then dump uses references for the same dictionary entries i.e. '&id001'
yaml.Dumper.ignore_aliases = lambda *args: True
return yaml.dump(topology_dict, default_flow_style=False)
def get_node_template_dict(node_template):
node_template_dict = {TYPE: node_template.type}
# node_template_dict[REQUIREMENTS] = {}
if node_template.requirements:
node_template_dict[REQUIREMENTS] = node_template.requirements
# if node_template.interfaces:
# interfaces = {}
# for interface in node_template.interfaces:
# interfaces[interface.type] = {}
# interfaces[interface.type][interface.name] = interface.implementation
# print( node_template.templates[node_template.name] )
if ARTIFACTS in node_template.templates[node_template.name].keys():
node_template_dict[ARTIFACTS] = node_template.templates[node_template.name][ARTIFACTS]
if PROPERTIES in node_template.templates[node_template.name].keys():
node_template_dict[PROPERTIES] = node_template.templates[node_template.name][PROPERTIES]
if INTERFACES in node_template.templates[node_template.name].keys():
interfaces = copy.deepcopy(node_template.templates[node_template.name][INTERFACES])
for interface_name in interfaces:
if 'type' in interfaces[interface_name]:
interfaces[interface_name].pop('type')
node_template_dict[INTERFACES] = interfaces
# print(dir(node_template))
# print(node_template.templates)
return node_template_dict
def get_node_type_interfaces(node):
node_type_interfaces = node.type_definition.interfaces
return node_type_interfaces
def get_node_template_interfaces(node):
node_template_interfaces = node.interfaces
return node_template_interfaces
def add_interfaces(node, node_type_interfaces):
# node.interfaces = node_type_interfaces
return node
Metadata-Version: 1.0
Name: drip-planner2
Version: 0.1
Summary: UNKNOWN
Home-page: UNKNOWN
Author: S. Koulouzis
Author-email: UNKNOWN
License: UNKNOWN
Description: Long description of the package
Platform: UNKNOWN
setup.py
drip_planner2.egg-info/PKG-INFO
drip_planner2.egg-info/SOURCES.txt
drip_planner2.egg-info/dependency_links.txt
drip_planner2.egg-info/requires.txt
drip_planner2.egg-info/top_level.txt
planner/__init__.py
planner/planner.py
service/__init__.py
service/simple_spec_alayzer.py
service/spec_service.py
service/specification_analyzer.py
test/__init__.py
test/test_planner.py
util/__init__.py
util/tosca_helper.py
\ No newline at end of file
matplotlib==3.1.1
matplotlib==3.1.1
names==0.3.0
networkx==2.4
pika==1.1.0
tosca-parser==1.6.0
......@@ -3,5 +3,5 @@ pika==1.1.0
names==0.3.0
networkx==2.4
pyyaml==5.3.1
tosca-parser==2.0.0
tosca-parser==2.1.1
matplotlib==3.2.1
\ No newline at end of file
......@@ -20,46 +20,51 @@ logger.setLevel(logging.DEBUG)
class MyTestCase(unittest.TestCase):
def test_open_stack(self):
url = 'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/openstack.yaml'
input_tosca_file_path = self.get_remote_tosca_file(url)
self.run_test(input_tosca_file_path)
def test_tic_gluster_fs(self):
url = 'https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/glusterFS.yaml'
url = 'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/glusterFS.yaml'
input_tosca_file_path = self.get_remote_tosca_file(url)
self.run_test(input_tosca_file_path)
def test_tic(self):
url = 'https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/TIC.yaml'
url = 'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/TIC.yaml'
input_tosca_file_path = self.get_remote_tosca_file(url)
self.run_test(input_tosca_file_path)
def test_docker(self):
url = 'https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_updated.yaml'
url = 'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_updated.yaml'
input_tosca_file_path = self.get_remote_tosca_file(url)
self.run_test(input_tosca_file_path)
url = 'https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/lifeWatch_vre1.yaml'
url = 'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/lifeWatch_vre1.yaml'
input_tosca_file_path = self.get_remote_tosca_file(url)
self.run_test(input_tosca_file_path)
def test_kubernetes(self):
url = 'https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/kubernetes.yaml'
url = 'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/kubernetes.yaml'
input_tosca_file_path = self.get_remote_tosca_file(url)
self.run_test(input_tosca_file_path)
def test_topology(self):
url = 'https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/topology.yaml'
url = 'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/topology.yaml'
input_tosca_file_path = self.get_remote_tosca_file(url)
self.run_test(input_tosca_file_path)
def test_compute(self):
url = 'https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/compute.yaml'
url = 'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/compute.yaml'
input_tosca_file_path = self.get_remote_tosca_file(url)
self.run_test(input_tosca_file_path)
def test_lifeWatch(self):
url = 'https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/lifeWatch_vre1.yaml'
url = 'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/lifeWatch_vre1.yaml'
tic_tosca = requests.get(url)
input_tosca_file_path = os.path.join(tempfile.gettempdir(),'TIC.yaml')
input_tosca_file_path = os.path.join(tempfile.gettempdir(),'lifeWatch_vre1.yaml')
open( input_tosca_file_path, 'wb').write(tic_tosca.content)
self.run_test(input_tosca_file_path)
......
{
"info": {
"_postman_id": "413f892b-e0d4-4300-a556-7dfcea38cb10",
"name": "CONF test deploy",
"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.\n\n",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Find topolog template by ID",
"event": [
{
"listen": "test",
"script": {
"id": "291160c7-0f44-42cf-84cc-240f8ef6b7e6",
"exec": [
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"",
"",
"",
"// var data = {",
"// \"data\" : [",
"// {",
"// \"name\" : \"Postmany\"",
"// }",
"// ]",
"// };",
"// var template = `",
"// <table>",
"// <tr>",
"// <th>Name</th>",
"// </tr>",
"",
"// {{#each response.data}}",
"// <tr>",
"// <td>{{name}}</td>",
"// </tr>",
"// {{/each}}",
"// </table>",
"// `;",
"// pm.visualizer.set(template, {",
"// // Pass the responses you need in a single JSON as data",
"// response: data",
"// });",
""
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "edvbafeabvafdb",
"type": "string"
},
{
"key": "username",
"value": "deploy_tester",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "accept",
"value": "text/plain",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {}
}
},
"url": {
"raw": "{{baseUrl}}/tosca_template/{{tosca_id}}",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"{{tosca_id}}"
]
},
"description": "Returns a single topology template. "
},
"response": [
{
"name": "Invalid input",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "Method Not Allowed",
"code": 405,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "Invalid ID supplied",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "ToscaTemplate not found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "successful operation",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": "<string>"
}
]
},
{
"name": "PLAN tosca template",
"event": [
{
"listen": "test",
"script": {
"id": "3a4a1b37-9f1e-4ff1-8f10-e72639631533",
"exec": [
"// tests[\"Status code is 200\"] = responseCode.code === 200;",
"tests[\"Response Body is not empty\"] = responseBody !== 200;",
"postman.setEnvironmentVariable(\"planed_tosca_id\", responseBody);"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "username",
"value": "deploy_tester",
"type": "string"
},
{
"key": "password",
"value": "edvbafeabvafdb",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "accept",
"value": " text/plain",
"type": "text"
},
{
"key": "accept",
"value": "text/plain",
"type": "text",
"disabled": true
}
],
"url": {
"raw": "{{baseUrl}}/planner/plan/{{tosca_id}}",
"host": [
"{{baseUrl}}"
],
"path": [
"planner",
"plan",
"{{tosca_id}}"
]
},
"description": "Planns and returns the ID of the planed topolog template"
},
"response": [
{
"name": "successful operation",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/planner/plan/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"planner",
"plan",
"<string>"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": "<string>"
},
{
"name": "Invalid ID supplied",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/planner/plan/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"planner",
"plan",
"<string>"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "ToscaTemplate not found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/planner/plan/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"planner",
"plan",
"<string>"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "Invalid input",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/planner/plan/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"planner",
"plan",
"<string>"
]
}
},
"status": "Method Not Allowed",
"code": 405,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Find planed topolog template by ID",
"event": [
{
"listen": "test",
"script": {
"id": "a566254b-f701-4d5f-af1a-5b479f31532c",
"exec": [
"// tests[\"Status code is 200\"] = responseCode.code === 200;",
"tests[\"Response Body is not empty\"] = responseBody !== 200;"
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "username",
"value": "deploy_tester",
"type": "string"
},
{
"key": "password",
"value": "edvbafeabvafdb",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "accept",
"value": "text/plain",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {}
}
},
"url": {
"raw": "{{baseUrl}}/tosca_template/{{planed_tosca_id}}",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"{{planed_tosca_id}}"
]
},
"description": "Returns a single topolog template"
},
"response": [
{
"name": "ToscaTemplate not found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "Invalid input",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "Method Not Allowed",
"code": 405,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "Invalid ID supplied",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "successful operation",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": "<string>"
}
]
},
{
"name": "PROVISION tosca template",
"event": [
{
"listen": "test",
"script": {
"id": "083634e0-93a7-4f4d-aa66-39c851d2436c",
"exec": [
"postman.setEnvironmentVariable(\"provisioned_tosca_id\", responseBody);"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "username",
"value": "deploy_tester",
"type": "string"
},
{
"key": "password",
"value": "edvbafeabvafdb",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Accept",
"value": "text/plain",
"type": "text"
}
],
"url": {
"raw": "{{baseUrl}}/provisioner/provision/{{planed_tosca_id}}",
"host": [
"{{baseUrl}}"
],
"path": [
"provisioner",
"provision",
"{{planed_tosca_id}}"
]
},
"description": "provosions the operationId: Plan Tosca Template Returns the provision ID"
},
"response": [
{
"name": "successful operation",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/provisioner/provision/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"provisioner",
"provision",
"<string>"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": "<string>"
},
{
"name": "Invalid ID supplied",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/provisioner/provision/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"provisioner",
"provision",
"<string>"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "ToscaTemplate not found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/provisioner/provision/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"provisioner",
"provision",
"<string>"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "Invalid input",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/provisioner/provision/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"provisioner",
"provision",
"<string>"
]
}
},
"status": "Method Not Allowed",
"code": 405,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Find provisioned topolog template by ID",
"event": [
{
"listen": "test",
"script": {
"id": "a8e9d158-341d-4344-bd79-ecf0a61984e6",
"exec": [
"// tests[\"Status code is 200\"] = responseCode.code === 200;",
"tests[\"Response Body is not empty\"] = responseBody !== 200;"
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "username",
"value": "deploy_tester",
"type": "string"
},
{
"key": "password",
"value": "edvbafeabvafdb",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "accept",
"value": "text/plain",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {}
}
},
"url": {
"raw": "{{baseUrl}}/tosca_template/{{provisioned_tosca_id}}",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"{{provisioned_tosca_id}}"
]
},
"description": "Returns a single topolog template"
},
"response": [
{
"name": "Invalid input",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "Method Not Allowed",
"code": 405,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "ToscaTemplate not found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "successful operation",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": "<string>"
},
{
"name": "Invalid ID supplied",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "DEPLOY the software tosca template",
"event": [
{
"listen": "test",
"script": {
"id": "020d63ca-7845-492a-96d8-d36d9f330dfd",
"exec": [
"postman.setEnvironmentVariable(\"deployed_tosca_id\", responseBody);"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "username",
"value": "deploy_tester",
"type": "string"
},
{
"key": "password",
"value": "edvbafeabvafdb",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/deployer/deploy/{{provisioned_tosca_id}}",
"host": [
"{{baseUrl}}"
],
"path": [
"deployer",
"deploy",
"{{provisioned_tosca_id}}"
]
},
"description": "Returns the deployment ID"
},
"response": [
{
"name": "successful operation",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/deployer/deploy/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"deployer",
"deploy",
"<string>"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": "<string>"
},
{
"name": "Invalid input",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/deployer/deploy/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"deployer",
"deploy",
"<string>"
]
}
},
"status": "Method Not Allowed",
"code": 405,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "Invalid ID supplied",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/deployer/deploy/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"deployer",
"deploy",
"<string>"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "ToscaTemplate not found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/deployer/deploy/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"deployer",
"deploy",
"<string>"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Find deployed topolog template by ID",
"event": [
{
"listen": "test",
"script": {
"id": "98e68ae8-9e40-4bd2-bdf6-10699ba589e1",
"exec": [
"// tests[\"Status code is 200\"] = responseCode.code === 200;",
"tests[\"Response Body is not empty\"] = responseBody !== 200;"
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "edvbafeabvafdb",
"type": "string"
},
{
"key": "username",
"value": "deploy_tester",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "accept",
"type": "text",
"value": "text/plain"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {}
}
},
"url": {
"raw": "{{baseUrl}}/tosca_template/{{deployed_tosca_id}}",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"{{deployed_tosca_id}}"
]
},
"description": "Returns a single topolog template"
},
"response": [
{
"name": "Invalid input",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "Method Not Allowed",
"code": 405,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "ToscaTemplate not found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "successful operation",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": "<string>"
},
{
"name": "Invalid ID supplied",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Delete provisioned topolog template by ID",
"event": [
{
"listen": "test",
"script": {
"id": "40be57b1-b0de-4fab-86da-0a568f403d48",
"exec": [
"// tests[\"Status code is 200\"] = responseCode.code === 200;",
"tests[\"Response Body is not empty\"] = responseBody !== 200;",
"postman.setEnvironmentVariable(\"deleted_tosca_id\", responseBody);"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "username",
"value": "deploy_tester",
"type": "string"
},
{
"key": "password",
"value": "edvbafeabvafdb",
"type": "string"
}
]
},
"method": "DELETE",
"header": [
{
"key": "accept",
"type": "text",
"value": "text/plain"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {}
}
},
"url": {
"raw": "{{baseUrl}}/tosca_template/{{provisioned_tosca_id}}",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"{{provisioned_tosca_id}}"
]
},
"description": "Returns a single topolog template"
},
"response": [
{
"name": "successful operation",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": "<string>"
},
{
"name": "ToscaTemplate not found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "Invalid ID supplied",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "Invalid input",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/tosca_template/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"tosca_template",
"<string>"
]
}
},
"status": "Method Not Allowed",
"code": 405,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
}
]
}
],
"event": [
{
"listen": "prerequest",
"script": {
"id": "c8620248-6b77-4e71-a078-5ce2397e6eef",
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"id": "ca112a09-3e91-4ad9-8fe8-857d59a75ccc",
"type": "text/javascript",
"exec": [
""
]
}
}
],
"variable": [
{
"id": "123752b8-f664-4303-a32d-96684daad374",
"key": "baseUrl",
"value": "/conf-api/3.0"
}
],
"protocolProfileBehavior": {}
}
......@@ -2,7 +2,12 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="3f84153d-6ed1-4691-94d6-53105266f15e" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/../k8s/CONF/manager-deployment.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../k8s/CONF/manager-deployment.yaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../k8s/CONF/nginx-configmap.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../k8s/CONF/nginx-configmap.yaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../k8s/CONF/provisioner-deployment.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../k8s/CONF/provisioner-deployment.yaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../sure_tosca-flask-server/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../sure_tosca-flask-server/.idea/misc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../sure_tosca-flask-server/.idea/sure_tosca-flask-server.iml" beforeDir="false" afterPath="$PROJECT_DIR$/../sure_tosca-flask-server/.idea/sure_tosca-flask-server.iml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -20,9 +25,14 @@
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../playbooks/install_nfs.yaml" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../sdia-tosca" />
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/../../sdia-tosca/examples" />
</key>
</component>
<component name="RunManager">
<configuration name="Unittests in test_default_api.py" type="tests" factoryName="Unittests" temporary="true" nameIsGenerated="true">
<module name="sure_tosca-client_python_stubs" />
......@@ -58,49 +68,60 @@
<servers />
</component>
<component name="WindowStateProjectService">
<state x="723" y="257" width="770" height="700" key="FileChooserDialogImpl" timestamp="1587904825236">
<state x="723" y="257" width="770" height="700" key="FileChooserDialogImpl" timestamp="1594637033414">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state x="723" y="257" width="770" height="700" key="FileChooserDialogImpl/67.34.1853.1046@67.34.1853.1046" timestamp="1587904825236" />
<state width="1825" height="255" key="GridCell.Tab.0.bottom" timestamp="1587047773485">
<state x="723" y="257" width="770" height="700" key="FileChooserDialogImpl/67.34.1853.1046@67.34.1853.1046" timestamp="1594637033414" />
<state width="1825" height="255" key="GridCell.Tab.0.bottom" timestamp="1592388772726">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state width="1825" height="255" key="GridCell.Tab.0.bottom/67.34.1853.1046@67.34.1853.1046" timestamp="1587047773485" />
<state width="1825" height="255" key="GridCell.Tab.0.center" timestamp="1587047773484">
<state width="1825" height="255" key="GridCell.Tab.0.bottom/67.34.1853.1046@67.34.1853.1046" timestamp="1592388772726" />
<state width="1825" height="255" key="GridCell.Tab.0.center" timestamp="1592388772725">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state width="1825" height="255" key="GridCell.Tab.0.center/67.34.1853.1046@67.34.1853.1046" timestamp="1587047773484" />
<state width="1825" height="255" key="GridCell.Tab.0.left" timestamp="1587047773484">
<state width="1825" height="255" key="GridCell.Tab.0.center/67.34.1853.1046@67.34.1853.1046" timestamp="1592388772725" />
<state width="1825" height="255" key="GridCell.Tab.0.left" timestamp="1592388772725">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state width="1825" height="255" key="GridCell.Tab.0.left/67.34.1853.1046@67.34.1853.1046" timestamp="1587047773484" />
<state width="1825" height="255" key="GridCell.Tab.0.right" timestamp="1587047773485">
<state width="1825" height="255" key="GridCell.Tab.0.left/67.34.1853.1046@67.34.1853.1046" timestamp="1592388772725" />
<state width="1825" height="255" key="GridCell.Tab.0.right" timestamp="1592388772725">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state width="1825" height="255" key="GridCell.Tab.0.right/67.34.1853.1046@67.34.1853.1046" timestamp="1587047773485" />
<state width="1825" height="383" key="GridCell.Tab.1.bottom" timestamp="1585306552969">
<state width="1825" height="255" key="GridCell.Tab.0.right/67.34.1853.1046@67.34.1853.1046" timestamp="1592388772725" />
<state width="1825" height="264" key="GridCell.Tab.1.bottom" timestamp="1592388772719">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state width="1825" height="383" key="GridCell.Tab.1.bottom/67.34.1853.1046@67.34.1853.1046" timestamp="1585306552969" />
<state width="1825" height="383" key="GridCell.Tab.1.center" timestamp="1585306552966">
<state width="1825" height="264" key="GridCell.Tab.1.bottom/67.34.1853.1046@67.34.1853.1046" timestamp="1592388772719" />
<state width="1825" height="264" key="GridCell.Tab.1.center" timestamp="1592388772719">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state width="1825" height="383" key="GridCell.Tab.1.center/67.34.1853.1046@67.34.1853.1046" timestamp="1585306552966" />
<state width="1825" height="383" key="GridCell.Tab.1.left" timestamp="1585306552965">
<state width="1825" height="264" key="GridCell.Tab.1.center/67.34.1853.1046@67.34.1853.1046" timestamp="1592388772719" />
<state width="1825" height="264" key="GridCell.Tab.1.left" timestamp="1592388772719">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state width="1825" height="383" key="GridCell.Tab.1.left/67.34.1853.1046@67.34.1853.1046" timestamp="1585306552965" />
<state width="1825" height="383" key="GridCell.Tab.1.right" timestamp="1585306552968">
<state width="1825" height="264" key="GridCell.Tab.1.left/67.34.1853.1046@67.34.1853.1046" timestamp="1592388772719" />
<state width="1825" height="264" key="GridCell.Tab.1.right" timestamp="1592388772719">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state width="1825" height="383" key="GridCell.Tab.1.right/67.34.1853.1046@67.34.1853.1046" timestamp="1585306552968" />
<state width="1825" height="264" key="GridCell.Tab.1.right/67.34.1853.1046@67.34.1853.1046" timestamp="1592388772719" />
<state x="359" y="103" key="SettingsEditor" timestamp="1587036749389">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state x="359" y="103" key="SettingsEditor/67.34.1853.1046@67.34.1853.1046" timestamp="1587036749389" />
<state x="563" y="235" width="1053" height="732" key="find.popup" timestamp="1584900160970">
<state x="563" y="235" width="1053" height="732" key="find.popup" timestamp="1590670239704">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state x="563" y="235" width="1053" height="732" key="find.popup/67.34.1853.1046@67.34.1853.1046" timestamp="1584900160970" />
<state x="563" y="235" width="1053" height="732" key="find.popup/67.34.1853.1046@67.34.1853.1046" timestamp="1590670239704" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/test/test_default_api.py</url>
<line>33</line>
<option name="timeStamp" value="7" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (sure_tosca-flask-server)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6 (sure_tosca-flask-server)" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" />
</component>
......
......@@ -5,7 +5,7 @@
<excludeFolder url="file://$MODULE_DIR$/venv" />
<excludeFolder url="file://$MODULE_DIR$/venv3-7" />
</content>
<orderEntry type="jdk" jdkName="Python 3.7 (sure_tosca-flask-server)" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.6 (sure_tosca-flask-server)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
......@@ -21,30 +21,30 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/TIC.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/TIC.yaml')
doc_id = int(id_example)
self.assertIsInstance(doc_id,int)
# id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_planed.yaml')
# id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_planed.yaml')
# doc_id = int(id_example)
self.assertIsInstance(doc_id,int)
id_example = self.upload_file(
'https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_provisioned.yaml')
'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_provisioned.yaml')
doc_id = int(id_example)
self.assertIsInstance(doc_id,int)
id_example = self.upload_file(
'https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/glusterFS.yaml')
'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/glusterFS.yaml')
doc_id = int(id_example)
self.assertIsInstance(doc_id,int)
id_example = self.upload_file(
'https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/kubernetes.yaml')
'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/kubernetes.yaml')
doc_id = int(id_example)
self.assertIsInstance(doc_id,int)
id_example = self.upload_file(
'https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/lifeWatch_vre1.yaml')
'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/lifeWatch_vre1.yaml')
doc_id = int(id_example)
self.assertIsInstance(doc_id,int)
id_example = self.upload_file(
'https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/topology.yaml')
'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/topology.yaml')
doc_id = int(id_example)
self.assertIsInstance(doc_id,int)
......@@ -54,7 +54,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_2_topologies.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_2_topologies.yaml')
self.assertTrue(id_example.strip().isdigit())
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_properties'.format(
......@@ -69,7 +69,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_2_topologies.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_2_topologies.yaml')
self.assertTrue(id_example.strip().isdigit())
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_types'.format(
......@@ -84,7 +84,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_2_topologies.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_2_topologies.yaml')
self.assertTrue(id_example.strip().isdigit())
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_requirements'.format(
......@@ -100,7 +100,7 @@ class TestDefaultController(BaseTestCase):
"""
# query_string = [('anchors', 'anchors_example'), ('derived_from', 'derived_from_example')]
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_2_topologies.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_2_topologies.yaml')
self.assertTrue(id_example.strip().isdigit())
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/dsl_definitions'.format(id=id_example),
......@@ -112,7 +112,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_2_topologies.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_2_topologies.yaml')
self.assertTrue(id_example.strip().isdigit())
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/imports'.format(id=id_example),
......@@ -124,7 +124,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_outputs.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_outputs.yaml')
self.assertTrue(id_example.strip().isdigit())
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/outputs'.format(
......@@ -139,7 +139,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_2_topologies.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_2_topologies.yaml')
self.assertTrue(id_example.strip().isdigit())
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/properties'.format(
......@@ -154,7 +154,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_2_topologies.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_2_topologies.yaml')
self.assertTrue(id_example.strip().isdigit())
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/requirements'.format(
......@@ -169,7 +169,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_2_topologies.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_2_topologies.yaml')
self.assertTrue(id_example.strip().isdigit())
query_string = [('type_name', None),
('node_name', 'compute'),
......@@ -240,7 +240,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_2_topologies.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_2_topologies.yaml')
self.assertTrue(id_example.strip().isdigit())
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/type_name'.format(
......@@ -255,7 +255,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_2_topologies.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_2_topologies.yaml')
self.assertTrue(id_example.strip().isdigit())
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/derived_from'.format(
......@@ -270,7 +270,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_2_topologies.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_2_topologies.yaml')
self.assertTrue(id_example.strip().isdigit())
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/related'.format(
......@@ -285,7 +285,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_2_topologies.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_2_topologies.yaml')
self.assertTrue(id_example.strip().isdigit())
query_string = [('type_name', None),
('derived_from', None)]
......@@ -300,7 +300,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_2_topologies.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_2_topologies.yaml')
self.assertTrue(id_example.strip().isdigit())
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template'.format(id=id_example),
......@@ -314,7 +314,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_2_topologies.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_2_topologies.yaml')
self.assertTrue(id_example.strip().isdigit())
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}'.format(id=id_example),
......@@ -328,7 +328,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_2_topologies.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_2_topologies.yaml')
self.assertTrue(id_example.strip().isdigit())
query_string = [('kind_of_type', 'interface_types'),
('has_interfaces', None),
......@@ -368,7 +368,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_2_topologies.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_2_topologies.yaml')
self.assertTrue(id_example.strip().isdigit())
properties = {'properties': {'cpu_frequency': '2 GHz'}}
response = self.client.open(
......@@ -388,7 +388,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_2_topologies.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_2_topologies.yaml')
self.assertTrue(id_example.strip().isdigit())
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates'.format(id=id_example),
......@@ -404,7 +404,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file('https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/application_example_2_topologies.yaml')
id_example = self.upload_file('https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/application_example_2_topologies.yaml')
self.assertTrue(id_example.strip().isdigit())
query_string = [('instance_name', 'instance_name_example'),
('operation_name', 'provision')]
......
......@@ -18,7 +18,7 @@ formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(messag
h.setFormatter(formatter)
logger.addHandler(h)
logger.handler_set = True
base_url = 'https://raw.githubusercontent.com/QCDIS/sdia-tosca/master/examples/'
base_url = 'https://raw.githubusercontent.com/qcdis-sdia/sdia-tosca/master/examples/'
class Test(TestCase):
def test_upload(self):
......
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