summaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/vnf/ims/heat_ims.py
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-16 19:28:11 +0100
commit7bc4e13a4c5409ed7d869ae5c0220feba70dbf65 (patch)
tree5bd8b9d7969dc660cc6f6a069ae2b8a19d5705b2 /functest/opnfv_tests/vnf/ims/heat_ims.py
parent49dd51392ced7555c59d94a21c7b2632e4cfe8e9 (diff)
Print monit summary before running IMS testing
Change-Id: I94310aa609d2c56609e0a5f0e46932af4aee02eb Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/opnfv_tests/vnf/ims/heat_ims.py')
-rw-r--r--functest/opnfv_tests/vnf/ims/heat_ims.py25
1 files changed, 24 insertions, 1 deletions
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"])