summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2019-03-16 19:28:11 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2019-03-17 10:30:01 +0100
commit360b8c3e09ecf900f15a293d8889ea4fd51c3cc4 (patch)
tree7ca4c4efd07cb7b46284c359360baa25831dca1a
parent1a673a0e5e1114082ab22930bbdd8d4b7c457d59 (diff)
Print monit summary before running IMS testing
Change-Id: I94310aa609d2c56609e0a5f0e46932af4aee02eb Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit 7bc4e13a4c5409ed7d869ae5c0220feba70dbf65)
-rw-r--r--docker/vnf/clearwater-heat-singlenet-deps.patch4
-rw-r--r--functest/core/singlevm.py7
-rw-r--r--functest/opnfv_tests/vnf/ims/heat_ims.py25
3 files changed, 30 insertions, 6 deletions
diff --git a/docker/vnf/clearwater-heat-singlenet-deps.patch b/docker/vnf/clearwater-heat-singlenet-deps.patch
index dfc9fe20b..8d0433f6d 100644
--- a/docker/vnf/clearwater-heat-singlenet-deps.patch
+++ b/docker/vnf/clearwater-heat-singlenet-deps.patch
@@ -742,7 +742,7 @@ index 825ede1..11a833b 100644
description: DNS zone
value: { get_param: zone }
diff --git a/ellis.yaml b/ellis.yaml
-index 963352d..a7ce50b 100644
+index 963352d..ee7e505 100644
--- a/ellis.yaml
+++ b/ellis.yaml
@@ -44,9 +44,6 @@ parameters:
@@ -817,7 +817,7 @@ index 963352d..a7ce50b 100644
echo 'RESOLV_CONF=/etc/dnsmasq.resolv.conf' >> /etc/default/dnsmasq
service dnsmasq force-reload
-+ sleep 60
++ sleep 180
+ monit summary
+ clearwater-etcdctl cluster-health
+ clearwater-etcdctl member list
diff --git a/functest/core/singlevm.py b/functest/core/singlevm.py
index 16c066ef6..521eb1484 100644
--- a/functest/core/singlevm.py
+++ b/functest/core/singlevm.py
@@ -227,12 +227,13 @@ class VmReady1(tenantnetwork.TenantNetwork1):
console = self.cloud.get_server_console(name)
self.__logger.debug("console: \n%s", console)
if re.search(regex, console):
- self.__logger.debug("regex found: ''%s' in console", regex)
+ self.__logger.debug(
+ "regex found: '%s' in console\n%s", regex, console)
return True
else:
self.__logger.debug(
- "try %s: cannot find regex '%s' in console",
- iloop + 1, regex)
+ "try %s: cannot find regex '%s' in console\n%s",
+ iloop + 1, regex, console)
time.sleep(10)
self.__logger.error("cannot find regex '%s' in console", regex)
return False
diff --git a/functest/opnfv_tests/vnf/ims/heat_ims.py b/functest/opnfv_tests/vnf/ims/heat_ims.py
index ad2682dd9..ff93e9850 100644
--- a/functest/opnfv_tests/vnf/ims/heat_ims.py
+++ b/functest/opnfv_tests/vnf/ims/heat_ims.py
@@ -15,7 +15,9 @@ import logging
import os
import re
import time
+import tempfile
+import paramiko
import pkg_resources
from xtesting.core import testcase
@@ -86,6 +88,7 @@ class HeatIms(singlevm.VmReady2):
self.stack = None
self.clearwater = None
self.role = None
+ (_, self.key_filename) = tempfile.mkstemp()
def create_network_resources(self):
pass
@@ -111,6 +114,8 @@ class HeatIms(singlevm.VmReady2):
self.keypair = self.cloud.create_keypair(
'{}-kp_{}'.format(self.case_name, self.guid))
self.__logger.info("keypair:\n%s", self.keypair.private_key)
+ with open(self.key_filename, 'w') as private_key_file:
+ private_key_file.write(self.keypair.private_key)
if self.deploy_vnf() and self.test_vnf():
self.result = 100
@@ -144,6 +149,22 @@ class HeatIms(singlevm.VmReady2):
self.stop_time = time.time()
return status
+ def _monit(self, username="ubuntu", timeout=60):
+ servers = self.cloud.list_servers(detailed=True)
+ self.__logger.debug("servers: %s", servers)
+ for server in servers:
+ if 'ns' in server.name:
+ break
+ self.__logger.info("server:\n%s", server.name)
+ ssh = paramiko.SSHClient()
+ ssh.set_missing_host_key_policy(paramiko.client.AutoAddPolicy())
+ ssh.connect(
+ server.public_v4, username=username,
+ key_filename=self.key_filename, timeout=timeout)
+ (_, stdout, _) = ssh.exec_command('sudo monit summary')
+ self.__logger.info("output:\n%s", stdout.read())
+ ssh.close()
+
def deploy_vnf(self):
"""Deploy Clearwater IMS."""
start_time = time.time()
@@ -168,7 +189,7 @@ class HeatIms(singlevm.VmReady2):
self.__logger.debug("servers: %s", servers)
for server in servers:
if not self.check_regex_in_console(
- server.name, regex='Cloud-init .* finished at ', loop=1):
+ server.name, regex='Cloud-init .* finished at ', loop=60):
return False
if 'ellis' in server.name:
self.__logger.debug("server: %s", server)
@@ -201,6 +222,8 @@ class HeatIms(singlevm.VmReady2):
if not dns_ip:
return False
+ self._monit()
+
short_result = self.clearwater.run_clearwater_live_test(
dns_ip=dns_ip,
public_domain=self.vnf['parameters']["zone"])