aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-04-17 23:59:32 +0200
committerCedric Ollivier <cedric.ollivier@orange.com>2018-04-17 22:32:09 +0000
commit78d628c929b02112dfb86dc9dfe9830ed1d5f975 (patch)
treeaf202069891e15aa1d1cb359616c1e3763c6e0d4
parent15bed392750c02152ca10fed056a63b1eaee7cf2 (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):