summaryrefslogtreecommitdiffstats
path: root/testcases/features/bgpvpn.py
diff options
context:
space:
mode:
authorvitikkan <viktor.tikkanen@nokia.com>2016-05-16 08:05:45 +0300
committervitikkan <viktor.tikkanen@nokia.com>2016-05-16 08:28:11 +0300
commit9bdb8955ba266abc34e1ab069ad0ee013dcf57ba (patch)
tree573772f8a5961bda3cbdd1d2a0fec4aa9cac0186 /testcases/features/bgpvpn.py
parent24165377a66c8aeab28872cbc281b863092e1237 (diff)
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 <viktor.tikkanen@nokia.com>
Diffstat (limited to 'testcases/features/bgpvpn.py')
-rw-r--r--testcases/features/bgpvpn.py58
1 files changed, 58 insertions, 0 deletions
diff --git a/testcases/features/bgpvpn.py b/testcases/features/bgpvpn.py
new file mode 100644
index 000000000..a6e66b1f5
--- /dev/null
+++ b/testcases/features/bgpvpn.py
@@ -0,0 +1,58 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2015 All rights reserved
+# This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Execute BGPVPN Tempest test cases
+#
+
+import os
+import yaml
+import ConfigParser
+
+import functest.utils.functest_logger as ft_logger
+import functest.utils.functest_utils as ft_utils
+
+with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f:
+ functest_yaml = yaml.safe_load(f)
+
+dirs = functest_yaml.get('general').get('directories')
+FUNCTEST_REPO = dirs.get('dir_repo_functest')
+BGPVPN_REPO = dirs.get('dir_repo_bgpvpn')
+TEST_DB_URL = functest_yaml.get('results').get('test_db_url')
+
+logger = ft_logger.Logger("bgpvpn").getLogger()
+
+
+def main():
+ logger.info("Running BGPVPN Tempest test case...")
+
+ cmd = 'cd ' + BGPVPN_REPO + ';pip install --no-deps -e .'
+ ft_utils.execute_command(cmd, logger, exit_on_error=False)
+
+ src_tempest_dir = ft_utils.get_deployment_dir(logger)
+ if not src_tempest_dir:
+ logger.error("Rally deployment not found.")
+ exit(-1)
+
+ src_tempest_conf = src_tempest_dir + '/tempest.conf'
+ dst_tempest_conf = src_tempest_dir + '/etc/tempest.conf'
+
+ config = ConfigParser.RawConfigParser()
+ config.read(src_tempest_conf)
+ config.set('service_available', 'bgpvpn', 'True')
+ with open(dst_tempest_conf, 'wb') as config_file:
+ config.write(config_file)
+
+ cmd = (src_tempest_dir +
+ '/run_tempest.sh -t -N -- networking_bgpvpn_tempest;'
+ 'rm -rf ' + dst_tempest_conf)
+ ft_utils.execute_command(cmd, logger, exit_on_error=False)
+
+
+if __name__ == '__main__':
+ main()