From c1b82d85dcf815764cb4247bedfee4ca491e2d57 Mon Sep 17 00:00:00 2001
From: spisarski <s.pisarski@cablelabs.com>
Date: Wed, 22 Jun 2016 08:49:24 -0600
Subject: Scripts for running smoke tests on the undercloud VM. Tested against
 Apex Brahmaputra as I have had many issues getting a Colorado environment up
 and running.

Moved Ansible playbooks and scripts from ci/smoke_tests/ to tests/smoke_tests/
Rebase to master...

Change-Id: I09273de659c76d32ccfb74a548dabf7f84c65d6d
Signed-off-by: spisarski <s.pisarski@cablelabs.com>
---
 lib/utility-functions.sh | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

(limited to 'lib')

diff --git a/lib/utility-functions.sh b/lib/utility-functions.sh
index 93050701..f73a2d85 100644
--- a/lib/utility-functions.sh
+++ b/lib/utility-functions.sh
@@ -15,14 +15,19 @@ function undercloud_connect {
   fi
 
   if [ -z "$2" ]; then
-    ssh ${SSH_OPTIONS[@]} ${user}@$(arp -a | grep $(virsh domiflist undercloud | grep default |\
-    awk '{print $5}') | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+")
+    ssh ${SSH_OPTIONS[@]} ${user}@$(get_undercloud_ip)
   else
-    ssh ${SSH_OPTIONS[@]} -T ${user}@$(arp -a | grep $(virsh domiflist undercloud | grep default \
-    | awk '{print $5}') | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") "$2"
+    ssh ${SSH_OPTIONS[@]} -T ${user}@$(get_undercloud_ip) "$2"
   fi
 }
 
+##outputs the Undercloud's IP address
+##params: none
+function get_undercloud_ip {
+  echo $(arp -a | grep $(virsh domiflist undercloud | grep default |\
+    awk '{print $5}') | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+")
+}
+
 ##connects to overcloud nodes
 ##params: node to login to, command to execute on overcloud (optional)
 function overcloud_connect {
-- 
cgit