def run(): try: ClusterManager.init() result = ClusterManager.createCluster(CLUSTER_NAME, write_DB=False) if result.code == "succeed": dup_result = ClusterManager.createCluster(CLUSTER_NAME, write_DB=False) if dup_result.code == "succeed": return False else: return True else: return False except Exception as e: print "UT_Create_Duplicate_Cluster Except:" + str(e) return False
def run(): ClusterManager.init() cluster_id = ClusterManager.createCluster(CLUSTER_NAME, write_DB=False) cluster_id = cluster_id.data.get("cluster_id") try: result = ClusterManager.addNode(cluster_id, NODE_NAME, write_DB=False) if result.code == "succeed": return True else: return False except Exception as e: print "UT_Add_Node Except:" + str(e) return False finally: ClusterManager.deleteNode(cluster_id, NODE_NAME[0], write_DB=False)
def run(): ClusterManager.init() cluster_id = ClusterManager.createCluster(CLUSTER_NAME, write_DB=False) cluster_id = cluster_id.data.get("cluster_id") ClusterManager.addNode(cluster_id, NODE_NAME, write_DB=False) wrong_cluster_id = "wrong id" try: result = ClusterManager.listNode(wrong_cluster_id) if result.code == "succeed": return False return True except Exception as e: print "UT_List_Node_Wrong_Cluster_ID Except:" + str(e) return False finally: ClusterManager.deleteNode(cluster_id, NODE_NAME[0], write_DB=False)
def run(): ClusterManager.init() cluster_id = ClusterManager.createCluster(CLUSTER_NAME, write_DB=False) cluster_id = cluster_id.data.get("cluster_id") ClusterManager.addNode(cluster_id, NODE_NAME, write_DB=False) ipmi_operator = Operator() try: result = ipmi_operator.shutOffNode(HOST) if result.code == "succeed": return False else: return True except Exception as e: print "UT_ShutOff_Node_In_Cluster Except:" + str(e) return False finally: ClusterManager.deleteNode(cluster_id, NODE_NAME[0], write_DB=False)
def run(): ClusterManager.init() cluster = ClusterManager.createCluster(CLUSTER_NAME, write_DB=False) cluster_id = cluster.data.get("cluster_id") ClusterManager.addNode(cluster_id, NODE_NAME, write_DB=False) try: result = ClusterManager.addInstance(cluster_id, WRONG_INSTANCE_ID, write_DB=False, send_flag=False) if result.code == "succeed": return False else: return True except Exception as e: print "UT_Add_Wrong_Instance Except:" + str(e) return False
def run(): ClusterManager.init() cluster_id = ClusterManager.createCluster(CLUSTER_NAME, write_DB=False) cluster_id = cluster_id.data.get("cluster_id") ClusterManager.addNode(cluster_id, NODE_NAME, write_DB=False) try: result = ClusterManager.listNode(cluster_id) node_list = result.data.get("node_list") if len(node_list) == 1: return True else: return False except Exception as e: print "UT_List_Node Except:" + str(e) return False finally: ClusterManager.deleteNode(cluster_id, NODE_NAME[0], write_DB=False)
def run(): ClusterManager.init() instance_id = Preprocess.create_with_provider_instance() cluster = ClusterManager.createCluster(CLUSTER_NAME, write_DB=False) cluster_id = cluster.data.get("cluster_id") ClusterManager.addNode(cluster_id, NODE_NAME, write_DB=False) ClusterManager.addInstance(cluster_id, instance_id, write_DB=False, send_flag=False) wrong_cluster_id = "wrong id" try: result = ClusterManager.deleteInstance(wrong_cluster_id, instance_id, write_DB=False, send_flag=False) if result.code == "failed": return True else: return False except Exception as e: print "UT_Delete_Instance_Wrong_Cluster_ID Except:" + str(e) return False finally: ClusterManager.deleteNode(cluster_id, NODE_NAME[0], write_DB=False) Postprocess.deleteInstance()
def run(): ClusterManager.init() instance_id = Preprocess.create_with_provider_instance() cluster_id = ClusterManager.createCluster(CLUSTER_NAME, write_DB=False) cluster_id = cluster_id.data.get("cluster_id") ClusterManager.addNode(cluster_id, NODE_NAME, write_DB=False) ClusterManager.addInstance(cluster_id, instance_id, write_DB=False, send_flag=False) try: result = ClusterManager.listInstance(cluster_id, send_flag=False) instance_list = result.data.get("instance_list") if len(instance_list) == 1: return True else: return False except Exception as e: print "UT_List_Instance Except:" + str(e) return False finally: ClusterManager.deleteNode(cluster_id, NODE_NAME[0], write_DB=False) Postprocess.deleteInstance()