def __request(self, method, url, headers, body, error): """ Launch a request and returns its response :param method: method used ex: POST, GET, DELETE, etc :param url: <IP>:<port>/<path> :param headers: headers used :param body: body in case of POST method :param error: error types :return: response """ headers['X-Auth-Token'] = utils.errorLabel (headers['X-Auth-Token'], error) url = utils.errorUrl(url, error) if error == "GET" or error == "PUT" or error == "POST" or error == "DELETE": method = error if method == "GET": response = http.get(url, headers) elif method == "POST": response = http.post(url, headers, body) elif method == "PUT": response = http.put(url, headers, body) elif method == "DELETE": response = http.delete(url, headers) #utils.printRequest(method,url,headers,body) # show request #utils.printResponse(response) # show response return response
def __delete_environment(self, url): headers = { 'X-Auth-Token': self.token, 'Tenant-Id': self.vdc, 'Accept': "application/json" } return http.delete(url, headers)
def __delete_node(self, url): headers = { 'X-Auth-Token': self.token, 'Tenant-Id': self.vdc, 'Content-Type': "application/xml" } return http.delete(url, headers)
def __request(self, method, url, headers, body, error): """ Launch a request and returns its response :param method: method used ex: POST, GET, DELETE, etc :param url: <IP>:<port>/<path> :param headers: headers used :param body: body in case of POST method :param error: error types :return: response """ headers['X-Auth-Token'] = utils.errorLabel(headers['X-Auth-Token'], error) url = utils.errorUrl(url, error) if error == "GET" or error == "PUT" or error == "POST" or error == "DELETE": method = error if method == "GET": response = http.get(url, headers) elif method == "POST": response = http.post(url, headers, body) elif method == "PUT": response = http.put(url, headers, body) elif method == "DELETE": response = http.delete(url, headers) #utils.printRequest(method,url,headers,body) # show request #utils.printResponse(response) # show response return response
def delete_claimed_msgs(*claim_response): """ Deletes claimed messages. Verifies that the deletes were successful by doing a GET on the deleted msg """ test_result_flag = False urllist = create_urllist_fromhref(*claim_response) header = common.functionlib.create_marconi_headers() for url in urllist: delete_response = http.delete(url, header) if delete_response.status_code == 204: print url get_deleted = http.get(url, header) if get_deleted.status_code == 404: test_result_flag = True else: print "GET deleted message: {}".format(url) print get_deleted.status_code print get_deleted.headers print get_deleted.text else: print "DELETE message with claim ID: {}".format(url) print delete_response.status_code print delete_response.headers print delete_response.text if not test_result_flag: assert test_result_flag, "DELETE message with claim ID failed"
def __delete_product_sdc(self, url): """ Delete product from SDC catalog """ headers = { 'X-Auth-Token': self.token, 'Tenant-Id': self.vdc, 'Content-Type': "application/xml" } return http.delete(url, headers)
def __delete_environments(self, url): #url="%s/%s" %(self.paasmanager_url,"catalog/org/FIWARE/environment") headers = {'X-Auth-Token': self.token, 'Tenant-Id': self.vdc, 'Accept': "application/json"} response = http.delete(url, headers) ## Si la respuesta es la adecuada, creo el diccionario de los datos en JSON. if response.status != 200 and response.status != 204: print 'error to delete the environment ' + str(response.status) sys.exit(1)
def delete_env (self, env_id): url = "http://{0}/v1/environments/{1}".format(self.murano_url, env_id) headers = {'X-Auth-Token': self.token, 'Accept': "application/json", 'Content-Type': 'application/json'} print "Deleting the environment " + url response = http.delete(url, headers) if response.status != 200: print 'error to delete the env ' + str(response.status) exit()
def delete_template(self, template_id): url = "http://{0}/v1/templates/{1}".format(self.murano_url, template_id) headers = {'X-Auth-Token': self.token, 'Accept': "application/json", 'Content-Type': 'application/json'} print "Deleting a blueprint template " + url response = http.delete(url, headers) if response.status != 200: print 'error deleting the template' + str(response.status) exit()
def delete_env(self, env_id): url = "http://{0}/v1/environments/{1}".format(self.murano_url, env_id) headers = { 'X-Auth-Token': self.token, 'Accept': "application/json", 'Content-Type': 'application/json' } print "Deleting the environment " + url response = http.delete(url, headers) if response.status != 200: print 'error to delete the env ' + str(response.status) exit()
def delete_vm(self): url = "%s/%s/%s/%s" % (self.url_openstack, self.id_tenant, "servers", self.id) headers = {'X-Auth-Token': self.token, 'Content-Type': "application/json"} response = http.delete(url, headers) ## Si la respuesta es la adecuada, creo el diccionario de los datos en JSON. if response.status != 204: print 'error deleting vm' + str(response.status) + response.reason sys.exit(1) else: print 'Deleting VM ........' print response.msg
def delete_product_release(self, product_name, version): #headers={'X-Auth-Token': self.token, # 'Accept': "application/json"} headers = {'Accept': "application/json"} #get product release url = "%s/%s/%s/%s/%s" % (self.sdc_url, "catalog/product", product_name, "release", version) response = http.delete(url, headers) if response.status != 200 and response.status != 204: print 'error to delete the product release ' + product_name + ' ' + str(response.status) sys.exit(1) else: pass
def delete_product(self, product_name): version = self.get_product_release(product_name); if version != None: self.delete_product_release(product_name, version); #headers={'X-Auth-Token': self.token, # 'Accept': "application/json"} headers = {'Accept': "application/json"} #get product release url = "%s/%s" % (self.sdc_url, "catalog/product/" + product_name) response = http.delete(url, headers) if response.status != 200 and response.status != 204: print 'error to delete the product ' + product_name + ' ' + str(response.status) sys.exit(1)
def delete_template(self, template_id): url = "http://{0}/v1/templates/{1}".format(self.murano_url, template_id) headers = { 'X-Auth-Token': self.token, 'Accept': "application/json", 'Content-Type': 'application/json' } print "Deleting a blueprint template " + url response = http.delete(url, headers) if response.status != 200: print 'error deleting the template' + str(response.status) exit()
def delete_product_release(self, product_name, version): #headers={'X-Auth-Token': self.token, # 'Accept': "application/json"} headers = {'Accept': "application/json"} #get product release url = "%s/%s/%s/%s/%s" % (self.sdc_url, "catalog/product", product_name, "release", version) response = http.delete(url, headers) if response.status != 200 and response.status != 204: print 'error to delete the product release ' + product_name + ' ' + str( response.status) sys.exit(1) else: pass
def delete_vm(self): url = "%s/%s/%s/%s" % (self.url_openstack, self.id_tenant, "servers", self.id) headers = { 'X-Auth-Token': self.token, 'Content-Type': "application/json" } response = http.delete(url, headers) ## Si la respuesta es la adecuada, creo el diccionario de los datos en JSON. if response.status != 204: print 'error deleting vm' + str(response.status) + response.reason sys.exit(1) else: print 'Deleting VM ........' print response.msg
def delete_product(self, product_name): version = self.get_product_release(product_name) if version != None: self.delete_product_release(product_name, version) #headers={'X-Auth-Token': self.token, # 'Accept': "application/json"} headers = {'Accept': "application/json"} #get product release url = "%s/%s" % (self.sdc_url, "catalog/product/" + product_name) response = http.delete(url, headers) if response.status != 200 and response.status != 204: print 'error to delete the product ' + product_name + ' ' + str( response.status) sys.exit(1)
def request(method, url, headers, body, error): headers['X-Auth-Token'] = errorLabel (headers['X-Auth-Token'], error) url = errorUrl(url, error) if error == "GET" or error == "PUT" or error == "POST" or error == "DELETE": method = error if method == "GET": response = http.get(url, headers) elif method == "POST": response = http.post(url, headers, body) elif method == "PUT": response = http.put(url, headers, body) elif method == "DELETE": response = http.delete(url, headers) printRequest(method,url,headers,body) #printResponse(response) return response
def request(method, url, headers, body, error): headers['X-Auth-Token'] = errorLabel(headers['X-Auth-Token'], error) url = errorUrl(url, error) if error == "GET" or error == "PUT" or error == "POST" or error == "DELETE": method = error if method == "GET": response = http.get(url, headers) elif method == "POST": response = http.post(url, headers, body) elif method == "PUT": response = http.put(url, headers, body) elif method == "DELETE": response = http.delete(url, headers) printRequest(method, url, headers, body) #printResponse(response) return response
def delete_msg(*postresponse): """Post DELETE message & verifies that a subsequent GET returns 404""" test_result_flag = False headers = str(postresponse[0]) headers = headers.replace("'", '"') headers = json.loads(headers) location = headers["location"] url = common.functionlib.create_url_from_appender(location) header = common.functionlib.create_marconi_headers() deletemsg = http.delete(url, header) if deletemsg.status_code == 204: test_result_flag = verify_delete(url, header) else: print ("DELETE message failed") print ("URL") print url print ("headers") print header print ("Response Body") print deletemsg.text assert test_result_flag, "DELETE Response Code {}".format(deletemsg.status_code)
def __delete_node(self, url): headers = {'X-Auth-Token': self.token, 'Tenant-Id': self.vdc, 'Content-Type': "application/xml"} return http.delete(url, headers)
def __delete_product_sdc(self, url): """ Delete product from SDC catalog """ headers = {'X-Auth-Token': self.token, 'Tenant-Id': self.vdc, 'Content-Type': "application/xml"} return http.delete(url, headers)
def __delete_tier_environment(self, url): headers = {'X-Auth-Token': self.token, 'Tenant-Id': self.vdc, 'Accept': "application/json"} return http.delete(url, headers)
def delete(self, sysNam, id): return http.delete(sysNam, '%s/%d' % (self.path, id))
def del_member(self, sysNam, objId, userId): return http.delete(sysNam, '%s/%d/members/%d' % (self.path, objId, userId))
def remove_index(es_url, index): http.delete(es_url, index, "\nThe index below has been removed successfully:\n")
def remove(auth): r = http.get("%s/authorizations" % GITHUB_ROOT, cache = False, auth = auth) for i in r: if i["note"] == "airstrip2": http.delete("%s/authorizations/%s" % (GITHUB_ROOT, i["id"]), auth = auth)
def del_member(self, sysNam, objId, userId): return http.delete(sysNam, "%s/%d/members/%d" % (self.path, objId, userId))