diff options
author | Cédric Ollivier <ollivier.cedric@gmail.com> | 2018-07-09 22:09:39 +0200 |
---|---|---|
committer | Cédric Ollivier <ollivier.cedric@gmail.com> | 2018-07-10 08:49:22 +0200 |
commit | 4c32f394e4ca9058ca69571754ff15156149251d (patch) | |
tree | 8fa005580d1409ad565717981a188018e2d9c90c | |
parent | 7666aadc3d8b2075e001df55e5d2fd7389d765df (diff) |
Publish cloudify scenario
It eases deploying any vnf via Cloudify.
It also stops duplicating code between vims and vrouter.
Co-Authored-By: Valentin Boucher <valentin.boucher@kontron.com>
Change-Id: I5fe06d91804f4781f6b1301da12862bac793ffbb
Signed-off-by: Cédric Ollivier <ollivier.cedric@gmail.com>
-rw-r--r-- | docker/vnf/testcases.yaml | 13 | ||||
-rw-r--r-- | functest/ci/testcases.yaml | 13 | ||||
-rw-r--r-- | functest/core/cloudify.py | 77 |
3 files changed, 103 insertions, 0 deletions
diff --git a/docker/vnf/testcases.yaml b/docker/vnf/testcases.yaml index 938f0b309..bc2a425cc 100644 --- a/docker/vnf/testcases.yaml +++ b/docker/vnf/testcases.yaml @@ -8,6 +8,19 @@ tiers: Collection of VNF test cases. testcases: - + case_name: cloudify + project_name: functest + criteria: 100 + blocking: false + description: >- + This test case deploys the Cloudify orchestrator. + dependencies: + installer: '' + scenario: 'os-.*-nofeature-.*ha' + run: + module: 'functest.core.cloudify' + class: 'Cloudify' + - case_name: cloudify_ims project_name: functest criteria: 80 diff --git a/functest/ci/testcases.yaml b/functest/ci/testcases.yaml index 2f5c8c09e..30e1c68c7 100644 --- a/functest/ci/testcases.yaml +++ b/functest/ci/testcases.yaml @@ -532,6 +532,19 @@ tiers: Collection of VNF test cases. testcases: - + case_name: cloudify + project_name: functest + criteria: 100 + blocking: false + description: >- + This test case deploys the Cloudify orchestrator. + dependencies: + installer: '' + scenario: 'os-.*-nofeature-.*ha' + run: + module: 'functest.core.cloudify' + class: 'Cloudify' + - case_name: cloudify_ims project_name: functest criteria: 80 diff --git a/functest/core/cloudify.py b/functest/core/cloudify.py new file mode 100644 index 000000000..954491f6c --- /dev/null +++ b/functest/core/cloudify.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python + +# Copyright (c) 2018 Orange and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 + +"""Cloudify testcase implementation.""" + +from __future__ import division + +import logging +import time + +from cloudify_rest_client import CloudifyClient + +from functest.core import singlevm + + +class Cloudify(singlevm.SingleVm2): + """Cloudify Orchestrator Case.""" + + __logger = logging.getLogger(__name__) + + filename = ('/home/opnfv/functest/images/' + 'cloudify-manager-premium-4.0.1.qcow2') + flavor_ram = 4096 + flavor_vcpus = 2 + flavor_disk = 50 + username = 'centos' + ssh_connect_loops = 12 + ports = [80, 443, 5671, 53333] + + def __init__(self, **kwargs): + """Initialize Cloudify testcase object.""" + if "case_name" not in kwargs: + kwargs["case_name"] = "cloudify" + super(Cloudify, self).__init__(**kwargs) + self.cfy_client = None + + def prepare(self): + super(Cloudify, self).prepare() + for port in self.ports: + self.cloud.create_security_group_rule( + self.sec.id, port_range_min=port, port_range_max=port, + protocol='tcp', direction='ingress') + + def execute(self): + """ + Deploy Cloudify Manager. + """ + self.cfy_client = CloudifyClient( + host=self.fip.floating_ip_address, + username='admin', password='admin', tenant='default_tenant', + api_version='v3') + self.__logger.info("Attemps running status of the Manager") + for loop in range(10): + try: + self.__logger.debug( + "status %s", self.cfy_client.manager.get_status()) + cfy_status = self.cfy_client.manager.get_status()['status'] + self.__logger.info( + "The current manager status is %s", cfy_status) + if str(cfy_status) != 'running': + raise Exception("Cloudify Manager isn't up and running") + break + except Exception: # pylint: disable=broad-except + self.__logger.info( + "try %s: Cloudify Manager isn't up and running", loop + 1) + time.sleep(30) + else: + self.__logger.error("Cloudify Manager isn't up and running") + return 1 + self.__logger.info("Cloudify Manager is up and running") + return 0 |