From b5a9b04871868633f5c92005b7665bfb76ee6eec Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Tue, 17 Apr 2018 23:59:32 +0200 Subject: Check app workload in juju_epc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It avoids interpreting rsync errors in case of deployment failures. Mysql is still unchecked. Change-Id: I01b4470b86637d0fc322c422f05240a928305158 Signed-off-by: Cédric Ollivier --- functest/opnfv_tests/vnf/epc/juju_epc.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/functest/opnfv_tests/vnf/epc/juju_epc.py b/functest/opnfv_tests/vnf/epc/juju_epc.py index bf7a37541..a60d4f51e 100644 --- a/functest/opnfv_tests/vnf/epc/juju_epc.py +++ b/functest/opnfv_tests/vnf/epc/juju_epc.py @@ -13,6 +13,7 @@ import logging import os import time import json +import re import subprocess import sys import uuid @@ -305,6 +306,18 @@ class JujuEpc(vnf.VnfOnBoarding): self.__logger.info("%s\n%s", " ".join(cmd), output) return True + def check_app(self, name='abot-epc-basic', status='active'): + """Check application status.""" + cmd = ['juju', 'status', '--format', 'short', name] + output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) + self.__logger.info("%s\n%s", " ".join(cmd), output) + ret = re.search(r'(?=workload:({})\))'.format(status), output) + if ret: + self.__logger.info("%s workload is %s", name, status) + return True + self.__logger.error("%s workload differs from %s", name, status) + return False + def deploy_vnf(self): """Deploy ABOT-OAI-EPC.""" self.__logger.info("Upload VNFD") @@ -345,6 +358,9 @@ class JujuEpc(vnf.VnfOnBoarding): cmd = ['juju', 'status'] output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) self.__logger.debug("%s\n%s", " ".join(cmd), output) + for app in ['abot-epc-basic', 'oai-epc', 'oai-hss']: + if not self.check_app(app): + return False self.__logger.info("Copying the feature files to Abot_node ") cmd = ['juju', 'scp', '--', '-r', '-v', '{}/featureFiles'.format(self.case_dir), 'abot-epc-basic/0:~/'] @@ -356,22 +372,6 @@ class JujuEpc(vnf.VnfOnBoarding): '/etc/rebaca-test-suite/featureFiles'] output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) self.__logger.info("%s\n%s", " ".join(cmd), output) - count = 0 - epcstatus = 1 - while count < 10: - epcstatus = os.system( - 'juju status oai-epc | grep {} | grep {} | grep {}'.format( - 'EPC', 'is', 'running')) - if epcstatus == 0: - break - else: - time.sleep(60) - count = count + 1 - if epcstatus != 0: - return False - cmd = ['juju-wait'] - output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) - self.__logger.info("%s\n%s", " ".join(cmd), output) return True def test_vnf(self): -- cgit 1.2.3-korg