summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-04-17 23:59:32 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2018-04-18 00:00:21 +0200
commitb5a9b04871868633f5c92005b7665bfb76ee6eec (patch)
tree42901602d445603562a3a5dad21297605be3b794
parentc789cca4a6e9afefba0c1622d49a181dd35437f7 (diff)
Check app workload in juju_epc
It avoids interpreting rsync errors in case of deployment failures. Mysql is still unchecked. Change-Id: I01b4470b86637d0fc322c422f05240a928305158 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r--functest/opnfv_tests/vnf/epc/juju_epc.py32
1 files 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):