3 # Copyright (c) 2018 Orange and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 """Cloudify testcase implementation."""
12 from __future__ import division
17 from cloudify_rest_client import CloudifyClient
19 from functest.core import singlevm
22 class Cloudify(singlevm.SingleVm2):
23 """Cloudify Orchestrator Case."""
25 __logger = logging.getLogger(__name__)
27 filename = ('/home/opnfv/functest/images/'
28 'cloudify-manager-premium-4.0.1.qcow2')
33 ssh_connect_loops = 12
34 ports = [80, 443, 5671, 53333]
36 def __init__(self, **kwargs):
37 """Initialize Cloudify testcase object."""
38 if "case_name" not in kwargs:
39 kwargs["case_name"] = "cloudify"
40 super(Cloudify, self).__init__(**kwargs)
41 self.cfy_client = None
44 super(Cloudify, self).prepare()
45 for port in self.ports:
46 self.cloud.create_security_group_rule(
47 self.sec.id, port_range_min=port, port_range_max=port,
48 protocol='tcp', direction='ingress')
52 Deploy Cloudify Manager.
54 self.cfy_client = CloudifyClient(
55 host=self.fip.floating_ip_address,
56 username='admin', password='admin', tenant='default_tenant',
58 self.__logger.info("Attemps running status of the Manager")
59 for loop in range(10):
62 "status %s", self.cfy_client.manager.get_status())
63 cfy_status = self.cfy_client.manager.get_status()['status']
65 "The current manager status is %s", cfy_status)
66 if str(cfy_status) != 'running':
67 raise Exception("Cloudify Manager isn't up and running")
69 except Exception: # pylint: disable=broad-except
71 "try %s: Cloudify Manager isn't up and running", loop + 1)
74 self.__logger.error("Cloudify Manager isn't up and running")
76 self.__logger.info("Cloudify Manager is up and running")