Commit 483595ad authored by Spiros Koulouzis's avatar Spiros Koulouzis

get requirements

parent 602c11f5
......@@ -28,3 +28,4 @@
/winery_service/nbproject/private/
/winery_service/src/winery/__pycache__/
/tosca_service/nbproject/private/
/tosca_service/src/winery/__pycache__/
\ No newline at end of file
......@@ -24,7 +24,16 @@ if __name__ == "__main__":
node_templates = repo.get_node_templates(tt)
parents = repo.get_parents(node_templates[1])
print(parents)
requrements=[]
requrements_types = set()
for parent in parents:
parent_requrements = repo.get_requirements(parent)
for p_req in parent_requrements:
if not p_req['requirementType'] in requrements_types:
requrements.append(p_req)
requrements_types.add(p_req['requirementType'])
print(requrements)
......
......@@ -11,13 +11,12 @@ class Service:
service_template_names = ['serviceTemplateOrNodeTypeOrNodeTypeImplementation']
topology_template_names = ['topologyTemplate']
node_template_names = ['nodeTemplates']
requirement_names = ['requirements']
requirement_deff_names = ['requirementDefinitions']
type_names = ['type']
relationships_names = ['relationshipTemplates']
service_templates = None
topology_templates = []
node_templates = []
requirements = {}
def __init__(self, tosca_reposetory_api_base_url):
self.tosca_reposetory_api_base_url = tosca_reposetory_api_base_url
......@@ -60,6 +59,9 @@ class Service:
return parents
def get_requirements(self,node_type):
requirements = self.find(node_type,self.requirement_deff_names)
return requirements['requirementDefinition']
def get_object(self,type_str):
regex = r"\{(.*?)\}"
......
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