summaryrefslogtreecommitdiffstats
path: root/sdnvpn/lib/utils.py
diff options
context:
space:
mode:
authorRomanos Skiadas <rski@intracom-telecom.com>2017-03-14 10:11:54 +0200
committerRomanos Skiadas <rski@intracom-telecom.com>2017-03-16 11:18:09 +0200
commit6674049b09d02fe0dc7e11e007e710643cdd49ca (patch)
tree4935a0089507b42189b8fc3fa89d257b794bfa93 /sdnvpn/lib/utils.py
parent1ad4cd4d35bcd0d4d9898650eb0452b184b55f77 (diff)
Fix most end-to-end issues with testcase 3 and reenable it
- Make the test work end-to-end on Fuel - Use the instance log to verify quagga started - Don't attempt to check for peering, as that is for a future release - Use the external IP of the controller for peering - Fix not getting the output of OpenDaylight commands Change-Id: Ia7bb533ab65e0fca6b7f48bb64133f6d8f3ff8ae JIRA: SDNVPN-114 Signed-off-by: Romanos Skiadas <rski@intracom-telecom.com>
Diffstat (limited to 'sdnvpn/lib/utils.py')
-rw-r--r--sdnvpn/lib/utils.py36
1 files changed, 33 insertions, 3 deletions
diff --git a/sdnvpn/lib/utils.py b/sdnvpn/lib/utils.py
index 8c4aebf..d085111 100644
--- a/sdnvpn/lib/utils.py
+++ b/sdnvpn/lib/utils.py
@@ -386,12 +386,42 @@ def check_odl_fib(ip, controller_ip):
def run_odl_cmd(odl_node, cmd):
- '''
- Run a command in the OpenDaylight Karaf shell
+ '''Run a command in the OpenDaylight Karaf shell
This is a bit flimsy because of shell quote escaping, make sure that
the cmd passed does not have any top level double quotes or this
function will break.
+
+ The /dev/null is used because client works, but outputs something
+ that contains "ERROR" and run_cmd doesn't like that.
+
'''
- karaf_cmd = '/opt/opendaylight/bin/client "%s" ' % cmd
+ karaf_cmd = '/opt/opendaylight/bin/client "%s" 2>/dev/null' % cmd
return odl_node.run_cmd(karaf_cmd)
+
+
+def wait_for_cloud_init(instance):
+ success = True
+ # ubuntu images take a long time to start
+ tries = 20
+ sleep_time = 30
+ while tries > 0:
+ instance_log = instance.get_console_output()
+ if "Failed to run module" in instance_log:
+ success = False
+ logger.error("Cloud init failed to run. Reason: %s",
+ instance_log)
+ break
+ if re.search(r"Cloud-init v. .+ finished at" in instance_log):
+ success = True
+ break
+ time.sleep(sleep_time)
+ tries = tries - 1
+
+ if tries == 0:
+ logger.error("Cloud init timed out"
+ ". Reason: %s",
+ instance_log)
+ success = False
+
+ return success