From 9bdb8955ba266abc34e1ab069ad0ee013dcf57ba Mon Sep 17 00:00:00 2001 From: vitikkan Date: Mon, 16 May 2016 08:05:45 +0300 Subject: BGPVPN test case refactored BGPVPN test case is refactored and moved into bgpvpn.py module. JIRA: FUNCTEST-234 Change-Id: Ib0dd6e11f3c568470d9c3837ca192da767c64843 Signed-off-by: vitikkan --- utils/functest_utils.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'utils') diff --git a/utils/functest_utils.py b/utils/functest_utils.py index 2d871615..8ee5346c 100644 --- a/utils/functest_utils.py +++ b/utils/functest_utils.py @@ -18,6 +18,7 @@ import socket import subprocess import sys import urllib2 +import yaml from git import Repo @@ -235,3 +236,28 @@ def execute_command(cmd, logger=None, sys.exit(1) return p.returncode + + +def get_deployment_dir(logger=None): + """ + Returns current Rally deployment directory + """ + with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f: + functest_yaml = yaml.safe_load(f) + f.close() + deployment_name = functest_yaml.get("rally").get("deployment_name") + rally_dir = functest_yaml.get("general").get("directories").get( + "dir_rally_inst") + cmd = ("rally deployment list | awk '/" + deployment_name + + "/ {print $2}'") + p = subprocess.Popen(cmd, shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + deployment_uuid = p.stdout.readline().rstrip() + if deployment_uuid == "": + if logger: + logger.error("Rally deployment not found.") + exit(-1) + deployment_dir = (rally_dir + "/tempest/for-deployment-" + + deployment_uuid) + return deployment_dir -- cgit 1.2.3-korg