def test_heketi_node_list(self): """Test node list operation """ h_client, h_server = self.heketi_client_node, self.heketi_server_url # List heketi nodes node_ips = [] heketi_node_id_list = heketi_ops.heketi_node_list(h_client, h_server) for node_id in heketi_node_id_list: node_info = heketi_ops.heketi_node_info( h_client, h_server, node_id, json=True) node_ips.append(node_info["hostnames"]["storage"]) # Compare the node listed in previous step hostnames = [] list_of_pools = peer_ops.get_pool_list('auto_get_gluster_endpoint') self.assertTrue( list_of_pools, "Failed to get the pool list from gluster pods/nodes") for pool in list_of_pools: hostnames.append(pool["hostname"]) self.assertEqual( len(heketi_node_id_list), len(list_of_pools), "Heketi volume list %s is not equal to gluster volume list %s" % (node_ips, hostnames))
def test_to_get_list_of_nodes(self): """ Listing all nodes and compare the node listed in previous step """ # List all list ip = [] g.log.info("Listing the node id") heketi_node_id_list = heketi_ops.heketi_node_list( self.heketi_client_node, self.heketi_server_url) g.log.info("Successfully listed the node") if (len(heketi_node_id_list) == 0): raise ExecutionError("Node list empty") for node_id in heketi_node_id_list: g.log.info("Retrieve the node info") node_info = heketi_ops.heketi_node_info(self.heketi_client_node, self.heketi_server_url, node_id, json=True) self.assertTrue(node_info, ("Failed to " "retrieve the node info")) g.log.info("Successfully retrieved the node info %s" % node_id) ip.append(node_info["hostnames"]["storage"]) # Compare the node listed in previous step hostname = [] g.log.info("Get the pool list") list_of_pools = get_pool_list('auto_get_gluster_endpoint') self.assertTrue(list_of_pools, ("Failed to get the " "pool list from gluster pods/nodes")) g.log.info("Successfully got the pool list from gluster pods/nodes") for pool in list_of_pools: hostname.append(pool["hostname"]) if (len(heketi_node_id_list) != len(list_of_pools)): raise ExecutionError("Heketi volume list %s is not equal " "to gluster volume list %s" % ((ip), (hostname))) g.log.info("The node IP's from node info and list" " is : %s/n and pool list from gluster" " pods/nodes is %s" % ((ip), (hostname)))
def test_to_get_list_of_nodes(self): """ Listing all nodes and compare the node listed in previous step """ # List all list ip = [] g.log.info("Listing the node id") heketi_node_id_list = heketi_ops.heketi_node_list( self.heketi_client_node, self.heketi_server_url) g.log.info("Successfully listed the node") if (len(heketi_node_id_list) == 0): raise ExecutionError("Node list empty") for node_id in heketi_node_id_list: g.log.info("Retrieve the node info") node_info = heketi_ops.heketi_node_info( self.heketi_client_node, self.heketi_server_url, node_id, json=True) self.assertTrue(node_info, ("Failed to " "retrieve the node info")) g.log.info("Successfully retrieved the node info %s" % node_id) ip.append(node_info["hostnames"]["storage"]) # Compare the node listed in previous step hostname = [] g.log.info("Get the pool list") list_of_pools = get_pool_list('auto_get_gluster_endpoint') self.assertTrue(list_of_pools, ("Failed to get the " "pool list from gluster pods/nodes")) g.log.info("Successfully got the pool list from gluster pods/nodes") for pool in list_of_pools: hostname.append(pool["hostname"]) if (len(heketi_node_id_list) != len(list_of_pools)): raise ExecutionError( "Heketi volume list %s is not equal " "to gluster volume list %s" % ((ip), (hostname))) g.log.info("The node IP's from node info and list" " is : %s/n and pool list from gluster" " pods/nodes is %s" % ((ip), (hostname)))
def test_get_pool_list(self): # Get pool list """ Example output of pool list [{'uuid': 'a2b88b10-eba2-4f97-add2-8dc37df08b27', 'hostname': 'abc.lab.eng.xyz.com', 'state': '3', 'connected': '1', 'stateStr': 'Peer in Cluster'}, {'uuid': 'b15b8337-9f8e-4ec3-8bdb-200d6a67ae12', 'hostname': 'def.lab.eng.xyz.com', 'state': '3', 'hostnames': ['def.lab.eng.xyz.com'], 'connected': '1', 'stateStr': 'Peer in Cluster'} ] """ g.log.info("Get pool list --xml output as python dict from node %s", self.mnode) pool_list_data = get_pool_list(self.mnode) self.assertIsNotNone(pool_list_data, ("Failed to get pool list --xml " "output as python dict on " "node %s", self.mnode)) g.log.info( "Successful in getting Pool list --xml output from node " "%s as python dict:\n %s", self.mnode, pool_list_data) # Log connected state of the peer for item in pool_list_data: node = item['hostname'] if node == self.mnode: continue connected_status = item['connected'] state_str = item['stateStr'] g.log.info("Node %s status: \n%s", node, ("Connected: %s\nStateStr:%s\n" % (connected_status, state_str)))