Github user ran-z commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/191#discussion_r137211470 --- Diff: aria/modeling/service_instance.py --- @@ -228,6 +228,80 @@ def service_template_fk(cls): :type: :class:`~datetime.datetime` """) + def get_node_by_type(self, type_name): + """ + Finds the first node of a type (or descendent type). + """ + service_template = self.service_template + + if service_template is not None: + node_types = service_template.node_types + if node_types is not None: + for node in self.nodes.itervalues(): + if node_types.is_descendant(type_name, node.type.name): + return node + + return None + + def get_policy_by_type(self, type_name): + """ + Finds the first policy of a type (or descendent type). + """ + service_template = self.service_template + + if service_template is not None: + policy_types = service_template.policy_types + if policy_types is not None: + for policy in self.policies.itervalues(): + if policy_types.is_descendant(type_name, policy.type.name): + return policy + + return None + + def satisfy_requirements(self): --- End diff -- I agree, those indeed seem useful - But I was actually referring to the `satisfy_requirements` and other methods, which I now see are the result of a merge issue - Note that they have been moved to `topology.py`, and should no longer be in `service_instance.py`.
---