diff options
author | Krishnaram Karthick Ramdoss <kramdoss@redhat.com> | 2018-01-09 13:13:07 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.host.prod.eng.bos.redhat.com> | 2018-01-09 13:13:07 +0000 |
commit | 2136768ac35c558c06acc6b5b370724820f4e1a2 (patch) | |
tree | b8c762a0fd7eda608159a19d11c28f20c5cba8de | |
parent | 07b3da9c25f2907047402373273443eacbbd8c8b (diff) | |
parent | a9a3165d0e39b38364df8b5f3c55d535008d294f (diff) |
Merge "Added code for initializing pod_name if deployment_type is cns"
-rw-r--r-- | cns-libs/cnslibs/common/heketi_libs.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cns-libs/cnslibs/common/heketi_libs.py b/cns-libs/cnslibs/common/heketi_libs.py index 868b7281..0e913c29 100644 --- a/cns-libs/cnslibs/common/heketi_libs.py +++ b/cns-libs/cnslibs/common/heketi_libs.py @@ -12,6 +12,8 @@ from cnslibs.common.exceptions import ExecutionError, ConfigError from cnslibs.common.heketi_ops import (setup_heketi_ssh_key, modify_heketi_executor, export_heketi_cli_server, hello_heketi) +from cnslibs.common.openshift_ops import (oc_login, switch_oc_project, + get_ocp_gluster_pod_names) class HeketiBaseClass(unittest.TestCase): @@ -29,6 +31,12 @@ class HeketiBaseClass(unittest.TestCase): super(HeketiBaseClass, cls).setUpClass() # Initializes heketi config variables + cls.cns_username = g.config['cns']['setup']['cns_username'] + cls.cns_password = g.config['cns']['setup']['cns_password'] + cls.cns_project_name = g.config['cns']['setup']['cns_project_name'] + cls.ocp_master_nodes = g.config['ocp_servers']['master'].keys() + cls.ocp_master_node = cls.ocp_master_nodes[0] + cls.deployment_type = g.config['cns']['deployment_type'] cls.executor = g.config['cns']['executor'] cls.executor_user = g.config['cns']['executor_user'] @@ -67,6 +75,20 @@ class HeketiBaseClass(unittest.TestCase): raise ConfigError("Heketi server %s is not alive" % cls.heketi_server_url) + if cls.deployment_type == "cns": + if not oc_login(cls.ocp_master_node, cls.cns_username, + cls.cns_password): + raise ExecutionError("Failed to do oc login on node %s" + % cls.ocp_master_node) + + if not switch_oc_project(cls.ocp_master_node, + cls.cns_project_name): + raise ExecutionError("Failed to switch oc project on node %s" + % cls.ocp_master_node) + + cls.gluster_pods = get_ocp_gluster_pod_names(cls.ocp_master_node) + g.pod_name = cls.gluster_pods[0] + # Have a unique string to recognize the test run for logging if 'glustotest_run_id' not in g.config: g.config['glustotest_run_id'] = ( |