def __init__(self, admin_node_ip, **kwargs): url = "http://{0}:8000".format(admin_node_ip) logger.info('Initiate Nailgun client with url %s', url) self.keystone_url = "http://{0}:5000/v2.0".format(admin_node_ip) self._client = HTTPClient(url=url, keystone_url=self.keystone_url, credentials=KEYSTONE_CREDS, **kwargs) super(NailgunClient, self).__init__()
def ostf_run_singe_test(self, cluster_id, test_sets_list, test_name): # get tests otherwise 500 error will be thrown self.get_ostf_tests(cluster_id) logger.info('Get tests finish with success') data = [] for test_set in test_sets_list: data.append( { 'metadata': {'cluster_id': str(cluster_id), 'config': {}}, 'tests': [test_name], 'testset': test_set } ) return self.client.post("/ostf/testruns", data)
def ostf_run_tests(self, cluster_id, test_sets_list): logger.info('Run OSTF tests at cluster #%s: %s', cluster_id, test_sets_list) data = [] for test_set in test_sets_list: data.append( { 'metadata': {'cluster_id': str(cluster_id), 'config': {}}, 'testset': test_set } ) # get tests otherwise 500 error will be thrown self.get_ostf_tests(cluster_id) return self.client.post("/ostf/testruns", data)
def ostf_run_singe_test(self, cluster_id, test_sets_list, test_name): # get tests otherwise 500 error will be thrown self.get_ostf_tests(cluster_id) logger.info('Get tests finish with success') data = [] for test_set in test_sets_list: data.append({ 'metadata': { 'cluster_id': str(cluster_id), 'config': {} }, 'tests': [test_name], 'testset': test_set }) return self.client.post("/ostf/testruns", data)
def ostf_run_tests(self, cluster_id, test_sets_list): logger.info('Run OSTF tests at cluster #%s: %s', cluster_id, test_sets_list) data = [] for test_set in test_sets_list: data.append({ 'metadata': { 'cluster_id': str(cluster_id), 'config': {} }, 'testset': test_set }) # get tests otherwise 500 error will be thrown self.get_ostf_tests(cluster_id) return self.client.post("/ostf/testruns", data)
def get_cluster_id(self, name): for cluster in self.list_clusters(): if cluster["name"] == name: logger.info('cluster name is %s' % name) logger.info('cluster id is %s' % cluster["id"]) return cluster["id"]
def create_cluster(self, data): logger.info('Before post to nailgun') return self.client.post( "/api/clusters", data=data)
def create_cluster(self, data): logger.info('Before post to nailgun') return self.client.post("/api/clusters", data=data)