diff options
author | Arthy Loganathan <aloganat@redhat.com> | 2017-12-13 00:01:57 +0530 |
---|---|---|
committer | Arthy Loganathan <aloganat@redhat.com> | 2017-12-13 00:02:29 +0530 |
commit | a9a3165d0e39b38364df8b5f3c55d535008d294f (patch) | |
tree | 0e20fe39af20c9d535c3121c6ab66317d7474b20 /cns-libs | |
parent | 2af212ebbe85b1ad58b6bc546e3c19db4be17b9d (diff) |
Added code for initializing pod_name if deployment_type is cns
Change-Id: I033e2faa9400aed5c6b293fdfc5f0c327562f206
Signed-off-by: Arthy Loganathan <aloganat@redhat.com>
Diffstat (limited to 'cns-libs')
-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'] = ( |