Commit fb075c17 authored by Spiros Koulouzis's avatar Spiros Koulouzis

get relationships

parent 9a3a26eb
...@@ -8,30 +8,32 @@ import os ...@@ -8,30 +8,32 @@ import os
import os.path import os.path
from os.path import expanduser from os.path import expanduser
import pika import pika
from winery.service import *
import sys import sys
import tempfile import tempfile
import time import time
from winery.service import *
if __name__ == "__main__": if __name__ == "__main__":
tosca_reposetory_api_base_url = "http://localhost:8080/winery" tosca_reposetory_api_base_url = "http://localhost:8080/winery"
namespace = "http%253A%252F%252Fsne.uva.nl%252Fservicetemplates" namespace = "http%253A%252F%252Fsne.uva.nl%252Fservicetemplates"
servicetemplate_id = "wordpress_w1-wip1" servicetemplate_id = "wordpress_w1-wip1"
repo = Service(tosca_reposetory_api_base_url) repo = Service(tosca_reposetory_api_base_url)
servicetemplates = repo.get_servicetemplates(namespace,servicetemplate_id) servicetemplates = repo.get_servicetemplates(namespace, servicetemplate_id)
tt= repo.get_topology_template(servicetemplates) tt = repo.get_topology_template(servicetemplates)
node_templates = repo.get_node_templates(tt) node_templates = repo.get_node_templates(tt)
relationships = repo.get_relationships(tt)
requrements = repo.get_all_requirements(node_templates[1]) print(relationships)
# print(requrements)
# requrements = repo.get_all_requirements(node_templates[1])
capabilities = repo.get_all_capabilities(node_templates[1]) # unmet_requrements = repo.get_unmet_requrements(node_templates[1], tt)
print(capabilities) # capabilities = repo.get_all_capabilities(node_templates[1])
# print(capabilities)
......
...@@ -84,6 +84,10 @@ class Service: ...@@ -84,6 +84,10 @@ class Service:
requrements_types.add(p_req['requirementType']) requrements_types.add(p_req['requirementType'])
return requrements return requrements
def get_relationships(self,topology_template):
return self.find(topology_template,self.relationships_names)
def get_all_capabilities(self,node_template): def get_all_capabilities(self,node_template):
parents = self.get_parents(node_template) parents = self.get_parents(node_template)
node_type = self.get_object(node_template['type'])['serviceTemplateOrNodeTypeOrNodeTypeImplementation'][0] node_type = self.get_object(node_template['type'])['serviceTemplateOrNodeTypeOrNodeTypeImplementation'][0]
......
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