COPY clearwater-heat-singlenet-deps.patch /tmp/clearwater-heat-singlenet-deps.patch
RUN apk --no-cache add --update \
- ruby ruby-bundler ruby-irb ruby-rdoc dnsmasq \
+ ruby ruby-bundler ruby-irb ruby-rdoc \
procps libxslt libxml2 zlib libffi python3 go musl-dev && \
apk --no-cache add --virtual .build-deps --update \
ruby-dev g++ make libxslt-dev libxml2-dev zlib-dev libffi-dev g++ make && \
import logging
import os
import re
-import shlex
-import shutil
-import subprocess
import time
import pkg_resources
class ClearwaterTesting(object):
"""vIMS clearwater base usable by several orchestrators"""
- def __init__(self, case_name, ellis_ip):
+ def __init__(self, case_name, bono_ip, ellis_ip):
self.logger = logging.getLogger(__name__)
self.case_dir = pkg_resources.resource_filename(
'functest', 'opnfv_tests/vnf/ims')
os.makedirs(self.result_dir)
self.ellis_ip = ellis_ip
+ self.bono_ip = bono_ip
def availability_check(self, signup_code='secret', two_numbers=False):
"""Create one or two numbers"""
time.sleep(25)
raise Exception('Failed to create a number')
- def run_clearwater_live_test(self, dns_ip, public_domain,
- bono_ip=None, ellis_ip=None,
- signup_code='secret'):
+ def run_clearwater_live_test(self, public_domain, signup_code='secret'):
"""Run the Clearwater live tests
It first runs dnsmasq to reach clearwater services by FQDN and then the
"""
# pylint: disable=too-many-locals,too-many-arguments
self.logger.info('Run Clearwater live test')
- dns_file = '/etc/resolv.conf'
- dns_file_bak = '/etc/resolv.conf.bak'
- self.logger.debug('Backup %s -> %s', dns_file, dns_file_bak)
- shutil.copy(dns_file, dns_file_bak)
- cmd = ("dnsmasq -d -u root --server=/clearwater.opnfv/{0} "
- "-r /etc/resolv.conf.bak".format(dns_ip))
- dnsmasq_process = subprocess.Popen(shlex.split(cmd))
- script = ('echo -e "nameserver {0}" > {1};'
- 'cd {2};'
- 'rake test[{3}] SIGNUP_CODE={4}'
- .format('127.0.0.1',
- dns_file,
- self.test_dir,
+ script = ('cd {0};'
+ 'rake test[{1}] SIGNUP_CODE={2}'
+ .format(self.test_dir,
public_domain,
signup_code))
- if bono_ip and ellis_ip:
- subscript = ' PROXY={0} ELLIS={1}'.format(bono_ip, ellis_ip)
+ if self.bono_ip and self.ellis_ip:
+ subscript = ' PROXY={0} ELLIS={1}'.format(
+ self.bono_ip, self.ellis_ip)
script = '{0}{1}'.format(script, subscript)
script = ('{0}{1}'.format(script, ' --trace'))
cmd = "/bin/bash -c '{0}'".format(script)
ft_utils.execute_command(cmd,
error_msg='Clearwater live test failed',
output_file=output_file)
- dnsmasq_process.kill()
- with open(dns_file_bak, 'r') as bak_file:
- result = bak_file.read()
- with open(dns_file, 'w') as dfile:
- dfile.write(result)
with open(output_file, 'r') as ofile:
result = ofile.read()
ellis_ip = self.cfy_client.deployments.outputs.get(
self.vnf['descriptor'].get('name'))['outputs']['ellis_ip']
- self.clearwater = clearwater.ClearwaterTesting(self.case_name,
- ellis_ip)
+ bono_ip = self.cfy_client.deployments.outputs.get(
+ self.vnf['descriptor'].get('name'))['outputs']['bono_ip']
+ self.clearwater = clearwater.ClearwaterTesting(
+ self.case_name, bono_ip, ellis_ip)
self.clearwater.availability_check()
self.details['vnf'].update(status='PASS',
if not dns_ip:
return False
short_result, vnf_test_rate = self.clearwater.run_clearwater_live_test(
- dns_ip=dns_ip, public_domain=self.vnf['inputs']["public_domain"])
+ public_domain=self.vnf['inputs']["public_domain"])
duration = time.time() - start_time
self.__logger.info(short_result)
self.details['test_vnf'].update(result=short_result, duration=duration)
server.name, regex='Cloud-init .* finished at ', loop=1):
return False
if 'ellis' in server.name:
- self.__logger.debug("server: %s", server)
+ self.__logger.debug("ellis: %s", server)
ellis_ip = server.public_v4
+ elif 'bono' in server.name:
+ self.__logger.debug("bono: %s", server)
+ bono_ip = server.public_v4
assert ellis_ip
- self.clearwater = clearwater.ClearwaterTesting(self.case_name,
- ellis_ip)
+ assert bono_ip
+ self.clearwater = clearwater.ClearwaterTesting(
+ self.case_name, bono_ip, ellis_ip)
# This call can take time and many retry because Heat is
# an infrastructure orchestrator so when Heat say "stack created"
# it means that all OpenStack ressources are created but not that
if not dns_ip:
return False
short_result, vnf_test_rate = self.clearwater.run_clearwater_live_test(
- dns_ip=dns_ip, public_domain=self.vnf['parameters']["zone"])
+ public_domain=self.vnf['parameters']["zone"])
duration = time.time() - start_time
self.__logger.info(short_result)
self.details['test_vnf'] = dict(result=short_result, duration=duration)
def setUp(self):
with mock.patch('functest.opnfv_tests.vnf.ims.cloudify_ims.'
'os.makedirs'):
- self.ims_vnf = clearwater.ClearwaterTesting("foo", "0.0.0.0")
+ self.ims_vnf = clearwater.ClearwaterTesting(
+ "foo", "0.0.0.0", "0.0.0.0")
self.mock_post = mock.Mock()
attrs = {'status_code': 201,