summaryrefslogtreecommitdiffstats
path: root/utils/functest_utils.py
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-05-17 13:27:40 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-05-17 13:27:40 +0000
commitd338cc665efc9a2d73d6dff1567dc6de6bc63bd8 (patch)
treec64a765136c0330ec72872166af1a7fe57f73a32 /utils/functest_utils.py
parent8f645a8d931da93f99c15593e2bd1f4d93a6d987 (diff)
parent9bdb8955ba266abc34e1ab069ad0ee013dcf57ba (diff)
Merge "BGPVPN test case refactored"
Diffstat (limited to 'utils/functest_utils.py')
-rw-r--r--utils/functest_utils.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/utils/functest_utils.py b/utils/functest_utils.py
index 2d871615a..8ee5346c1 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