aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorboucherv <valentin.boucher@orange.com>2017-07-12 18:18:37 +0200
committerboucherv <valentin.boucher@orange.com>2017-07-13 14:28:53 +0200
commitaa3f9d4677170b24b72c9c5c7c5987b5a4b64f0d (patch)
treecd36f232b7e37a44d29a90c7617b33ef4448e18e
parent0323218afb7500bac979e46aafc9c33d614c99d5 (diff)
Fix some issues in cloudify_ims
- Blocking ssh - Timeout for SCP - Debug in clearwater-ims-base - Flavor with snaps Change-Id: Ib11a4ebf20e698caccbb16920ae7d715f931fc58 Signed-off-by: boucherv <valentin.boucher@orange.com>
-rw-r--r--functest/opnfv_tests/vnf/ims/clearwater_ims_base.py14
-rw-r--r--functest/opnfv_tests/vnf/ims/cloudify_ims.py58
-rw-r--r--functest/opnfv_tests/vnf/ims/cloudify_ims.yaml2
3 files changed, 43 insertions, 31 deletions
diff --git a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py
index 25ddca216..5a5c12bee 100644
--- a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py
+++ b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py
@@ -43,7 +43,7 @@ class ClearwaterOnBoardingBase(vnf.VnfOnBoarding):
def config_ellis(self, ellis_ip, signup_code='secret', two_numbers=False):
output_dict = {}
- self.logger.info('Configure Ellis: %s', ellis_ip)
+ self.logger.debug('Configure Ellis: %s', ellis_ip)
output_dict['ellis_ip'] = ellis_ip
account_url = 'http://{0}/accounts'.format(ellis_ip)
params = {"password": "functest",
@@ -54,7 +54,7 @@ class ClearwaterOnBoardingBase(vnf.VnfOnBoarding):
output_dict['login'] = params
if rq.status_code != 201 and rq.status_code != 409:
raise Exception("Unable to create an account for number provision")
- self.logger.info('Account is created on Ellis: %s', params)
+ self.logger.debug('Account is created on Ellis: %s', params)
session_url = 'http://{0}/session'.format(ellis_ip)
session_data = {
@@ -66,13 +66,13 @@ class ClearwaterOnBoardingBase(vnf.VnfOnBoarding):
if rq.status_code != 201:
raise Exception('Failed to get cookie for Ellis')
cookies = rq.cookies
- self.logger.info('Cookies: %s', cookies)
+ self.logger.debug('Cookies: %s', cookies)
number_url = 'http://{0}/accounts/{1}/numbers'.format(
ellis_ip,
params['email'])
- self.logger.info('Create 1st calling number on Ellis')
- i = 24
+ self.logger.debug('Create 1st calling number on Ellis')
+ i = 30
while rq.status_code != 200 and i > 0:
try:
number_res = self.create_ellis_number(number_url, cookies)
@@ -86,7 +86,7 @@ class ClearwaterOnBoardingBase(vnf.VnfOnBoarding):
output_dict['number'] = number_res
if two_numbers:
- self.logger.info('Create 2nd calling number on Ellis')
+ self.logger.debug('Create 2nd calling number on Ellis')
number_res = self.create_ellis_number(number_url, cookies)
output_dict['number2'] = number_res
@@ -131,7 +131,7 @@ class ClearwaterOnBoardingBase(vnf.VnfOnBoarding):
script = '{0}{1}'.format(script, subscript)
script = ('{0}{1}'.format(script, ' --trace'))
cmd = "/bin/bash -c '{0}'".format(script)
- self.logger.info('Live test cmd: %s', cmd)
+ self.logger.debug('Live test cmd: %s', cmd)
output_file = os.path.join(self.result_dir, "ims_test_output.txt")
ft_utils.execute_command(cmd,
error_msg='Clearwater live test failed',
diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
index fafc77e13..8f6fcec89 100644
--- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py
+++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-# Copyright (c) 2016 Orange and others.
+# Copyright (c) 2017 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
@@ -25,16 +25,16 @@ from functest.utils.constants import CONST
import functest.utils.openstack_utils as os_utils
from snaps.openstack.os_credentials import OSCreds
-from snaps.openstack.create_network import NetworkSettings, SubnetSettings, \
- OpenStackNetwork
-from snaps.openstack.create_security_group import SecurityGroupSettings, \
- SecurityGroupRuleSettings,\
- Direction, Protocol, \
- OpenStackSecurityGroup
+from snaps.openstack.create_network import (NetworkSettings, SubnetSettings,
+ OpenStackNetwork)
+from snaps.openstack.create_security_group import (SecurityGroupSettings,
+ SecurityGroupRuleSettings,
+ Direction, Protocol,
+ OpenStackSecurityGroup)
from snaps.openstack.create_router import RouterSettings, OpenStackRouter
-from snaps.openstack.create_instance import VmInstanceSettings, \
- FloatingIpSettings, \
- OpenStackVmInstance
+from snaps.openstack.create_instance import (VmInstanceSettings,
+ FloatingIpSettings,
+ OpenStackVmInstance)
from snaps.openstack.create_flavor import FlavorSettings, OpenStackFlavor
from snaps.openstack.create_image import ImageSettings, OpenStackImage
from snaps.openstack.create_keypairs import KeypairSettings, OpenStackKeypair
@@ -239,6 +239,8 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase):
while str(cfy_status) != 'running' and retry:
try:
cfy_status = cfy_client.manager.get_status()['status']
+ self.__logger.debug("The current manager status is %s",
+ cfy_status)
except Exception: # pylint: disable=broad-except
self.__logger.warning("Cloudify Manager isn't " +
"up and running. Retrying ...")
@@ -263,14 +265,15 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase):
self.__logger.info("Put private keypair in manager")
if manager_creator.vm_ssh_active(block=True):
ssh = manager_creator.ssh_client()
- scp = SCPClient(ssh.get_transport())
+ scp = SCPClient(ssh.get_transport(), socket_timeout=15.0)
scp.put(kp_file, '~/')
cmd = "sudo cp ~/cloudify_ims.pem /etc/cloudify/"
- ssh.exec_command(cmd)
+ run_blocking_ssh_command(ssh, cmd)
cmd = "sudo chmod 444 /etc/cloudify/cloudify_ims.pem"
- ssh.exec_command(cmd)
+ run_blocking_ssh_command(ssh, cmd)
cmd = "sudo yum install -y gcc python-devel"
- ssh.exec_command(cmd)
+ run_blocking_ssh_command(ssh, cmd, "Unable to install packages \
+ on manager")
self.details['orchestrator'].update(status='PASS', duration=duration)
@@ -292,15 +295,17 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase):
descriptor.get('file_name'))
self.__logger.info("Get or create flavor for all clearwater vm")
- self.exist_obj['flavor2'], flavor_id = os_utils.get_or_create_flavor(
- self.vnf['requirements']['flavor']['name'],
- self.vnf['requirements']['flavor']['ram_min'],
- '30',
- '1',
- public=True)
+ flavor_settings = FlavorSettings(
+ name=self.vnf['requirements']['flavor']['name'],
+ ram=self.vnf['requirements']['flavor']['ram_min'],
+ disk=25,
+ vcpus=1)
+ flavor_creator = OpenStackFlavor(self.snaps_creds, flavor_settings)
+ flavor_creator.create()
+ self.created_object.append(flavor_creator)
self.vnf['inputs'].update(dict(
- flavor_id=flavor_id,
+ flavor_id=self.vnf['requirements']['flavor']['name'],
))
self.__logger.info("Create VNF Instance")
@@ -371,7 +376,7 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase):
try:
cfy_client.executions.cancel(execution['id'],
force=True)
- except:
+ except: # pylint: disable=broad-except
self.__logger.warn("Can't cancel the current exec")
execution = cfy_client.executions.start(
@@ -383,7 +388,7 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase):
wait_for_execution(cfy_client, execution, self.__logger)
cfy_client.deployments.delete(self.vnf['descriptor'].get('name'))
cfy_client.blueprints.delete(self.vnf['descriptor'].get('name'))
- except:
+ except: # pylint: disable=broad-except
self.__logger.warn("Some issue during the undeployment ..")
self.__logger.warn("Tenant clean continue ..")
@@ -507,3 +512,10 @@ def sig_test_format(sig_test):
total_sig_test_result['failures'] = nb_failures
total_sig_test_result['skipped'] = nb_skipped
return total_sig_test_result
+
+
+def run_blocking_ssh_command(ssh, cmd, error_msg="Unable to run this command"):
+ """Command to run ssh command with the exit status."""
+ stdin, stdout, stderr = ssh.exec_command(cmd)
+ if stdout.channel.recv_exit_status() != 0:
+ raise Exception(error_msg)
diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml b/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml
index f1028ce73..743c6ddd8 100644
--- a/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml
+++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml
@@ -19,7 +19,7 @@ vnf:
version: '122'
requirements:
flavor:
- name: m1.medium
+ name: m1.small
ram_min: 2048
inputs:
image_id: 'ubuntu_14.04'