summaryrefslogtreecommitdiffstats
path: root/doctor_tests/installer/mcp.py
diff options
context:
space:
mode:
authorTomi Juvonen <tomi.juvonen@nokia.com>2019-11-28 12:31:51 +0200
committerTomi Juvonen <tomi.juvonen@nokia.com>2020-01-08 12:22:50 +0200
commitd8eb12f4200c21f569df5bc01d378a846b4c0db0 (patch)
treeacf0a67ef2a9a0e89d63e5863e9dc7bc53190478 /doctor_tests/installer/mcp.py
parent7822d631bc2fd2e8faf36d2b809e1e5b69f5251c (diff)
DevStack support
Support running Doctor testing is DevStack multi-node controller JIRA: DOCTOR-136 Signed-off-by: Tomi Juvonen <tomi.juvonen@nokia.com> Change-Id: I1569f3f77d889420b3b8f3c2724c10253e509c28
Diffstat (limited to 'doctor_tests/installer/mcp.py')
-rw-r--r--doctor_tests/installer/mcp.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/doctor_tests/installer/mcp.py b/doctor_tests/installer/mcp.py
index 65c8ed70..f8f33c83 100644
--- a/doctor_tests/installer/mcp.py
+++ b/doctor_tests/installer/mcp.py
@@ -7,6 +7,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
from os.path import isfile
+import re
import time
from doctor_tests.common.constants import is_fenix
@@ -60,6 +61,45 @@ class McpInstaller(BaseInstaller):
mcp_key = '/var/lib/opnfv/mcp.rsa'
return mcp_key if isfile(mcp_key) else ssh_key
+ def get_transport_url(self):
+ client = SSHClient(self.controllers[0], self.node_user_name,
+ key_filename=self.key_file)
+ try:
+ cmd = 'sudo grep -m1 "^transport_url" /etc/nova/nova.conf'
+ ret, url = client.ssh(cmd)
+
+ if ret:
+ raise Exception('Exec command to get transport from '
+ 'controller(%s) in MCP installer failed, '
+ 'ret=%s, output=%s'
+ % (self.controllers[0], ret, url))
+ elif self.controllers[0] not in url:
+ # need to use ip instead of hostname
+ url = (re.sub("@.*:", "@%s:" % self.controllers[0],
+ url[0].split("=", 1)[1]))
+ except Exception:
+ cmd = 'grep -i "^rabbit" /etc/nova/nova.conf'
+ ret, lines = client.ssh(cmd)
+ if ret:
+ raise Exception('Exec command to get transport from '
+ 'controller(%s) in MCP installer failed, '
+ 'ret=%s, output=%s'
+ % (self.controllers[0], ret, url))
+ else:
+ for line in lines.split('\n'):
+ if line.startswith("rabbit_userid"):
+ rabbit_userid = line.split("=")
+ if line.startswith("rabbit_port"):
+ rabbit_port = line.split("=")
+ if line.startswith("rabbit_password"):
+ rabbit_password = line.split("=")
+ url = "rabbit://%s:%s@%s:%s/?ssl=0" % (rabbit_userid,
+ rabbit_password,
+ self.controllers[0],
+ rabbit_port)
+ self.log.info('get_transport_url %s' % url)
+ return url
+
def _copy_overcloudrc_to_controllers(self):
for ip in self.controllers:
cmd = "scp overcloudrc %s@%s:" % (self.node_user_name, ip)