summaryrefslogtreecommitdiffstats
path: root/testcases/VIM/OpenStack
diff options
context:
space:
mode:
Diffstat (limited to 'testcases/VIM/OpenStack')
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/run_tempest.py59
1 files changed, 25 insertions, 34 deletions
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
index 02d9b331a..4c8e61a72 100644
--- a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
@@ -20,7 +20,6 @@ import re
import requests
import shutil
import subprocess
-import sys
import time
import yaml
import ConfigParser
@@ -68,14 +67,16 @@ f.close()
TEST_DB = functest_yaml.get("results").get("test_db_url")
MODE = "smoke"
+PRIVATE_NET_NAME = functest_yaml.get("tempest").get("private_net_name")
+PRIVATE_SUBNET_NAME = functest_yaml.get("tempest").get("private_subnet_name")
+PRIVATE_SUBNET_CIDR = functest_yaml.get("tempest").get("private_subnet_cidr")
+ROUTER_NAME = functest_yaml.get("tempest").get("router_name")
TENANT_NAME = functest_yaml.get("tempest").get("identity").get("tenant_name")
TENANT_DESCRIPTION = functest_yaml.get("tempest").get("identity").get(
"tenant_description")
USER_NAME = functest_yaml.get("tempest").get("identity").get("user_name")
USER_PASSWORD = functest_yaml.get("tempest").get("identity").get(
"user_password")
-SSH_USER_REGEX = functest_yaml.get("tempest").get("input-scenario").get(
- "ssh_user_regex")
DEPLOYMENT_MAME = functest_yaml.get("rally").get("deployment_name")
RALLY_INSTALLATION_DIR = functest_yaml.get("general").get("directories").get(
"dir_rally_inst")
@@ -133,7 +134,7 @@ def push_results_to_db(case, payload, criteria):
def create_tempest_resources():
ks_creds = os_utils.get_credentials("keystone")
- logger.info("Creating tenant and user for Tempest suite")
+ logger.debug("Creating tenant and user for Tempest suite")
keystone = ksclient.Client(**ks_creds)
tenant_id = os_utils.create_tenant(keystone,
TENANT_NAME,
@@ -146,25 +147,26 @@ def create_tempest_resources():
if user_id == '':
logger.error("Error : Failed to create %s user" % USER_NAME)
-
-def free_tempest_resources():
- ks_creds = os_utils.get_credentials("keystone")
- logger.info("Deleting tenant and user for Tempest suite)")
- keystone = ksclient.Client(**ks_creds)
-
- user_id = os_utils.get_user_id(keystone, USER_NAME)
- if user_id == '':
- logger.error("Error : Failed to get id of %s user" % USER_NAME)
- else:
- if not os_utils.delete_user(keystone, user_id):
- logger.error("Error : Failed to delete %s user" % USER_NAME)
-
- tenant_id = os_utils.get_tenant_id(keystone, TENANT_NAME)
- if tenant_id == '':
- logger.error("Error : Failed to get id of %s tenant" % TENANT_NAME)
+ logger.debug("Creating private network for Tempest suite")
+ creds_neutron = os_utils.get_credentials("neutron")
+ neutron_client = neutronclient.Client(**creds_neutron)
+ network_dic = os_utils.create_network_full(logger,
+ neutron_client,
+ PRIVATE_NET_NAME,
+ PRIVATE_SUBNET_NAME,
+ ROUTER_NAME,
+ PRIVATE_SUBNET_CIDR)
+ if network_dic:
+ if not os_utils.update_neutron_net(neutron_client,
+ network_dic['net_id'],
+ shared=True):
+ logger.error("Failed to update private network...")
+ exit(-1)
+ else:
+ logger.debug("Network '%s' is available..." % PRIVATE_NET_NAME)
else:
- if not os_utils.delete_tenant(keystone, tenant_id):
- logger.error("Error : Failed to delete %s tenant" % TENANT_NAME)
+ logger.error("Private network creation failed")
+ exit(-1)
def configure_tempest(mode):
@@ -207,16 +209,7 @@ def configure_tempest(mode):
logger.debug("Updating selected tempest.conf parameters...")
config = ConfigParser.RawConfigParser()
config.read(tempest_conf_file)
- private_net_name = ""
- creds_neutron = os_utils.get_credentials("neutron")
- neutron_client = neutronclient.Client(**creds_neutron)
- private_net = os_utils.get_private_net(neutron_client)
- if private_net is None:
- logger.error("No shared private networks found.")
- sys.exit(1)
- else:
- private_net_name = private_net['name']
- config.set('compute', 'fixed_network_name', private_net_name)
+ config.set('compute', 'fixed_network_name', PRIVATE_NET_NAME)
config.set('identity', 'tenant_name', TENANT_NAME)
config.set('identity', 'username', USER_NAME)
config.set('identity', 'password', USER_PASSWORD)
@@ -331,8 +324,6 @@ def main():
if args.noclean:
exit(0)
- free_tempest_resources()
-
if __name__ == '__main__':
main()