ariatosca-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tliron <...@git.apache.org>
Subject [GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...
Date Tue, 05 Sep 2017 18:01:44 GMT
Github user tliron commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/191#discussion_r137070505
  
    --- 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):
    +        satisfied = True
    +        for node in self.nodes.itervalues():
    +            if not node.satisfy_requirements():
    +                satisfied = False
    +        return satisfied
    +
    +    def validate_capabilities(self):
    +        satisfied = True
    +        for node in self.nodes.itervalues():
    +            if not node.validate_capabilities():
    +                satisfied = False
    +        return satisfied
    +
    +    def find_hosts(self):
    +        for node in self.nodes.itervalues():
    +            node.find_host()
    +
    +    def configure_operations(self):
    +        for node in self.nodes.itervalues():
    +            node.configure_operations()
    +        for group in self.groups.itervalues():
    +            group.configure_operations()
    +        for operation in self.workflows.itervalues():
    +            operation.configure()
    +
    +    def is_node_a_target(self, target_node):
    +        for node in self.nodes.itervalues():
    +            if self._is_node_a_target(node, target_node):
    +                return True
    +        return False
    +
    +    def _is_node_a_target(self, source_node, target_node):
    --- End diff --
    
    This is a leftover utility function from a previous experiment of mine (for solving an
SMTP config challenge). It's not needed anymore, so I will just remove it.


---

Mime
View raw message