def create_gmember(self, context, obj_dic): values = ["ip", "port", "enable", "name"] driver_dic = tools.input_dic(values, obj_dic) gslb_obj = {} gslb_obj["gmember_name"] = obj_dic['name'] gslb_obj["current_user"] = self.auth_name dic = tools.dict_merge(driver_dic, gslb_obj) dic.pop('name') LOG.info(_LI("create the gmember values with dic format" "is %(json)s of dervice"), {"json": dic}) url = (self.host + ":" + str(self.port) + '/dc/' + obj_dic["gslb_zone_name"] + "/gmember") LOG.info(_LI("create gmember url:" + url)) headers = {'Content-type': 'application/json'} data = json.dumps(dic) auth = (self.auth_name, self.auth_pw) LOG.info(_LI("create gmember url:" + url)) response = requests.post(url, data=data, headers=headers, auth=auth, verify=False) if response.status_code is None: raise NonExistDevices if response.status_code is not 200: raise ZdnsErrMessage(self.zdns_error.getMessage(response. status_code)) return response.json()
def report_agent_state(self, context, agent_info): LOG.info(_LI("updating agent state: Replying rpc client's " "report_agent_state.")) agent_obj = objects.Agent(context, **agent_info) # Check the target agent object whether exist in DB conditions = {} conditions['dc_name'] = agent_info['dc_name'] conditions['network_zone'] = agent_info['network_zone'] conditions['agent_ip'] = agent_info['agent_ip'] conditions['agent_nat_ip'] = agent_info['agent_nat_ip'] conditions['agent_type'] = agent_info['agent_type'] conditions['deleted'] = False target_agent = None try: target_agent = agent_obj.get_object(context, **conditions) except: LOG.info(_LI('cannot find related agent record in DB, so think ' 'this agent info as new, need to save in DB')) pass if target_agent: update_agent = {} update_agent['update_time'] = timeutils.utcnow() update_agent['availiable'] = 'yes' update_agent['status'] = 'OK' update_infos = objects.Agent(context, **update_agent) agent_obj.update(context, target_agent['id'], update_infos.as_dict()) else: agent_obj.availiable = 'yes' agent_obj.status = 'OK' agent_obj.update_time = timeutils.utcnow() agent_obj.create(context, agent_obj.as_dict()) return agent
def update_operation_history(self, context, id_, **kwargs): opt_params = {} opt_params['operation_status'] = kwargs['status'] opt_obj = objects.OperationHistory(context, **opt_params) LOG.info(_LI("updating operation history record in DB")) opt_obj.update(context, id_, opt_obj.as_dict()) LOG.info(_LI("update operation history record in DB successful!")) return None
def create_syngroup(self, context, obj_dic): gslb_obj = ["name", "dcs", "probe_range", "pass"] driver_dic = tools.input_dic(gslb_obj, obj_dic) driver_dic["current_user"] = self.auth_name LOG.info(_LI("create the syngroup values with dic format\ is %(json)s of dervice"), {"json": driver_dic}) url = (self.host + ":" + str(self.port) + '/syngroup') headers = {'Content-type': 'application/json'} data = json.dumps(driver_dic) auth = (self.auth_name, self.auth_pw) LOG.info(_LI("create syngroup url:" + url)) obj_dic['id'] = obj_dic['name'] return obj_dic
def create_gmember(self, context, obj_dic): values = ["ip", "port", "enable", "name"] driver_dic = tools.input_dic(values, obj_dic) gslb_obj = {} gslb_obj["gmember_name"] = obj_dic['name'] gslb_obj["current_user"] = self.auth_name dic = tools.dict_merge(driver_dic, gslb_obj) dic.pop('name') LOG.info(_LI("create the gmember values with dic format" "is %(json)s of dervice"), {"json": dic}) url = (self.host + ":" + str(self.port) + '/dc/' + obj_dic["gslb_zone_name"] + "/gmember") LOG.info(_LI("create gmember url:" + url)) return {"refcnt": "10", "id": "test_gmember_id"}
def list(self, req, *args, **kwargs): try: url = req.url if len(args) > 1: raise BadRequest(resource="SecurityZone getAll", msg=url) context = req.context body_values = json.loads(req.body) valid_attributes = ["tenant_id", "dc_name", "network_zone"] values = tools.validat_values(body_values, valid_attributes) # get_all the SecurityZone values with dic format LOG.info(_LI("get_all SecurityZone body is %(json)s"), {"json": body_values}) response = self.manager.get_securityZones(context, values) return response except Nca47Exception as e: self.response.status = e.code LOG.error(_LE("Error exception! error info: %" + e.message)) LOG.exception(e) self.response.status = e.code return tools.ret_info(e.code, e.message) except MessagingException as exception: self.response.status = 500 message = exception.value return tools.ret_info(self.response.status, message) except Exception as exception: LOG.exception(exception) self.response.status = 500 message = "the values of the body format error" return tools.ret_info(self.response.status, message)
def show(self, req, *args, **kwargs): try: url = req.url if len(args) != 1: raise BadRequest(resource="netservice operation", msg=url) json_body = req.body context = req.context dic = json.loads(json_body) list_ = ['id'] dic_body = tools.firewall_params(dic, list_) LOG.info(_LI("get_vlan body is %(json)s, args is %(args)s," "kwargs is %(kwargs)s"), {"json": dic, "args": args, "kwargs": kwargs}) response = self.manager.get_netservice(context, dic_body) return response except Nca47Exception as e: LOG.error(_LE('Nca47Exception! error info: ' + e.message)) self.response.status = e.code return tools.ret_info(e.code, e.message) except MessagingException as e: self.response.status = 500 return tools.ret_info(self.response.status, e.value) except Exception as e: LOG.error(_LE('Exception! error info: ' + e.message)) self.response.status = 500 message = "the values of the body format is error" return tools.ret_info(self.response.status, message)
def create(self, req, *args, **kwargs): try: url = req.url if len(args) > 1: raise BadRequest(resource="SecurityZone create", msg=url) context = req.context body_values = json.loads(req.body) # ADTEC_COMMENT: 需要加上vfwname 参数 valid_attributes = ["tenant_id", "dc_name", "network_zone", "name", "ifnames", "priority"] values = tools.validat_values(body_values, valid_attributes) # input the SecurityZone values with dic format LOG.info(_LI("input add_SecurityZone body is %(json)s"), {"json": body_values}) values["name"] = values["tenant_id"] + "_" + values["network_zone"] + "_" + values["name"] response = self.manager.create_securityZone(context, values) return response except Nca47Exception as e: self.response.status = e.code LOG.error(_LE("Error exception! error info: %" + e.message)) LOG.exception(e) self.response.status = e.code return tools.ret_info(e.code, e.message) except MessagingException as exception: self.response.status = 500 message = exception.value return tools.ret_info(self.response.status, message) except Exception as exception: LOG.exception(exception) self.response.status = 500 message = "the values of the body format error" return tools.ret_info(self.response.status, message)
def get_rrs(self, context, zone_id): url = (self.host + ":" + str(self.port) + '/views/' + self.view_id + '/zones/' + zone_id + '/rrs') LOG.info(_LI("get_rrs :" + url)) res = { "total_size": 2, "page_num": 1, "resources": [ { "comment": "", "name": "www.baidu.", "type": "NS", "ttl": 3600, "state": "", "href": "/views/default/zones/www.baidu/rrs/" "www.baidu.$3600$NS$bnMud3d3LmJhaWR1Lg==", "klass": "IN", "rdata": "ns.www.baidu.", "reverse_name": "baidu.www", "id": "www.baidu.$3600$NS$bnMud3d3LmJhaWR1Lg==", "is_shared": "" }, { "comment": "", "name": "ns.www.baidu.", "type": "A", "ttl": 3600, "state": "", "href": "/views/default/zones/www.baidu/rrs/" "ns.www.baidu.$3600$A$MTI3LjAuMC4x", "klass": "IN", "rdata": "127.0.0.1", "reverse_name": "baidu.www.ns", "id": "ns.www.baidu.$3600$A$MTI3LjAuMC4x", "is_shared": "" } ], "page_size": 2 } return res
def list(self, req, *args, **kwargs): try: url = req.url # if len(args) > 1: # raise BadRequest(resource="gslb_zone getAll", msg=url) context = req.context search_opts = {} search_opts.update(req.GET) # input the staticnat values with dic format LOG.info(_LI("get_all the gslb_zone")) response = self.manager.get_gslb_zones(context, search_opts) return response except Nca47Exception as e: self.response.status = e.code LOG.error(_LE('Error exception! error info: %' + e.message)) LOG.exception(e) self.response.status = e.code return tools.ret_info(e.code, e.message) except RemoteError as exception: self.response.status = 500 message = exception.value return tools.ret_info(self.response.status, message) except Exception as e: LOG.exception(e) self.response.status = 500 return tools.ret_info(self.response.status, e.message)
def remove(self, req, id, *args, **kwargs): try: url = req.url # if len(args) > 1: # raise BadRequest(resource="gslb_zone del", msg=url) context = req.context body_values={} # body_values = json.loads(req.body) gslb_zone_id = id body_values["id"] = gslb_zone_id # input the gslb_zone values with dic format LOG.info(_LI("delete the gslb_zone values with dic format\ is %(json)s"), {"json": body_values}) response = self.manager.del_gslb_zone(context, body_values) return response except Nca47Exception as e: self.response.status = e.code LOG.error(_LE('Error exception! error info: %' + e.message)) LOG.exception(e) self.response.status = e.code return tools.ret_info(e.code, e.message) except RemoteError as exception: self.response.status = 500 message = exception.value return tools.ret_info(self.response.status, message) except Exception as e: LOG.exception(e) self.response.status = 500 return tools.ret_info(self.response.status, e.message)
def create(self, req, *args, **kwargs): try: url = req.url if len(args) > 1: raise BadRequest(resource="VRF create", msg=url) context = req.context body_values = json.loads(req.body) valid_attributes = ['tenant_id', 'dc_name', 'network_zone', 'name', 'vrfInterface'] values = tools.validat_values(body_values, valid_attributes) # input the staticnat values with dic format LOG.info(_LI("input add_vrf body is %(json)s"), {"json": body_values}) response = self.manager.create_vrf(context, values) return response except Nca47Exception as e: LOG.error(_LE('Nca47Exception! error info: ' + e.message)) self.response.status = e.code return tools.ret_info(e.code, e.message) except MessagingException as e: self.response.status = 500 return tools.ret_info(self.response.status, e.value) except Exception as e: LOG.error(_LE('Exception! error info: ' + e.message)) self.response.status = 500 message = "the values of the body format is error" return tools.ret_info(self.response.status, message)
def remove(self, req, *args, **kwargs): try: url = req.url if len(args) > 1: raise BadRequest(resource="SNAT del", msg=url) context = req.context body_values = json.loads(req.body) valid_attributes = ['tenant_id', 'dc_name', 'network_zone', 'id'] values = tools.validat_values(body_values, valid_attributes) # input the snat values with dic format LOG.info(_LI("delete Staticnat body is %(json)s"), {"json": body_values}) response = self.manager.del_snat(context, values) return response except Nca47Exception as e: self.response.status = e.code LOG.error(_LE('Error exception! error info: %' + e.message)) LOG.exception(e) self.response.status = e.code return tools.ret_info(e.code, e.message) except MessagingException as exception: self.response.status = 500 message = exception.value return tools.ret_info(self.response.status, message) except Exception as exception: LOG.exception(exception) self.response.status = 500 message = "the values of the body format error" return tools.ret_info(self.response.status, message)
def update_gmap(self, context, obj_dic): name = obj_dic["name"] gslb_obj = ["enable", "algorithm", "last_resort_pool", "gpool_list"] driver_dic = tools.input_dic(gslb_obj, obj_dic) driver_dic["current_user"] = self.auth_name LOG.info(_LI("update the gmap values with dic format\ is %(json)s of dervice"), {"json": driver_dic}) url = (self.host + ":" + str(self.port) + '/gmap/' + name) headers = {'Content-type': 'application/json'} data = json.dumps(driver_dic) auth = (self.auth_name, self.auth_pw) LOG.info(_LI("create gmap url:" + url)) return obj_dic
def list(self, req, *args, **kwargs): try: url = req.url if len(args) != 1: raise BadRequest(resource="vlan operation", msg=url) context = req.context json_body = req.body dic = json.loads(json_body) LOG.info(_LI("get_all_vlan body is %(json)s, args is %(args)s," "kwargs is %(kwargs)s"), {"json": dic, "args": args, "kwargs": kwargs}) list_ = ['tenant_id', 'dc_name', 'network_zone'] dic_body = self.firewall_params(dic, list_) response = self.manager.get_vlans(context, dic_body) return response except Nca47Exception as e: LOG.error(_LE('Nca47Exception! error info: ' + e.message)) self.response.status = e.code return tools.ret_info(e.code, e.message) except RemoteError as e: self.response.status = 500 return tools.ret_info(self.response.status, e.value) except Exception as e: LOG.error(_LE('Exception! error info: ' + e.message)) self.response.status = 500 return tools.ret_info(self.response.status, e.message)
def create(self, req, *args, **kwargs): try: url = req.url if len(args) != 1: raise BadRequest(resource="vlan operation", msg=url) json_body = req.body context = req.context dic = json.loads(json_body) list_ = ['tenant_id', 'dc_name', 'vlan_id', 'network_zone', 'ipaddr', "ifnames"] dic_body = tools.firewall_params(dic, list_) LOG.info(_LI("add_vlan body is %(json)s,args is %(args)s," "kwargs is %(kwargs)s"), {"json": dic, "args": args, "kwargs": kwargs}) response = self.manager.create_vlan(context, dic_body) return response except Nca47Exception as e: LOG.error(_LE('Nca47Exception! error info: ' + e.message)) self.response.status = e.code return tools.ret_info(e.code, e.message) except MessagingException as e: self.response.status = 500 return tools.ret_info(self.response.status, e.value) except Exception as e: LOG.error(_LE('Exception! error info: ' + e.message)) self.response.status = 500 message = "the values of the body format is error" return tools.ret_info(self.response.status, message)
def list(self, req, *args, **kwargs): try: url = req.url if len(args) > 1: raise BadRequest(resource="staticnat getAll", msg=url) context = req.context body_values = json.loads(req.body) valid_attributes = ['tenant_id', 'dc_name', 'network_zone', 'vfwname'] values = tools.validat_values(body_values, valid_attributes) # input the staticnat values with dic format LOG.info(_LI("get_all the staticnat values with dic format\ is %(json)s"), {"json": body_values}) response = self.manager.get_staticnats(context, values) return response except Nca47Exception as e: self.response.status = e.code LOG.error(_LE('Error exception! error info: %' + e.message)) LOG.exception(e) self.response.status = e.code return tools.ret_info(e.code, e.message) except RemoteError as exception: self.response.status = 500 message = exception.value return tools.ret_info(self.response.status, message) except Exception as e: LOG.exception(e) self.response.status = 500 return tools.ret_info(self.response.status, e.message)
def remove(self, req, *args, **kwargs): try: url = req.url if len(args) > 1: raise BadRequest(resource="VRF del", msg=url) context = req.context body_values = json.loads(req.body) valid_attributes = ['tenant_id', 'dc_name', 'network_zone', 'id'] values = tools.validat_values(body_values, valid_attributes) # input the vrf values with dic format LOG.info(_LI("delete the vrf values with dic format\ is %(json)s"), {"json": body_values}) response = self.manager.del_vrf(context, values) return response except Nca47Exception as e: LOG.error(_LE('Nca47Exception! error info: ' + e.message)) self.response.status = e.code return tools.ret_info(e.code, e.message) except RemoteError as e: self.response.status = 500 return tools.ret_info(self.response.status, e.value) except Exception as e: LOG.error(_LE('Exception! error info: ' + e.message)) self.response.status = 500 return tools.ret_info(self.response.status, e.message)
def create_record(self, context, record, zone_id): # insert operation history type with Creating in DB input_str = json.dumps(record) input_operation_history = {} input_operation_history['input'] = input_str input_operation_history['method'] = 'CREATE' input_operation_history['status'] = 'FAILED' history = self.db_common.insert_operation_history( context, **input_operation_history) # check zone_record is or not exsit target_record = self.is_exist_zone_record(context, record) if target_record is not None: LOG.warning(_LW("the record object with name = %(record)s" " already exists in DB"), {"record": record['name']}) raise exception.HaveSameObject(object_name=record['name']) # check zone is or not exsit target_zone = self.is_exist_zone(context, zone_id) # dev_zone_id is zone_id of device if target_zone is None: raise exception.IsNotExistError(param_name=zone_id) dev_zone_id = target_zone["zone_id"] LOG.info(_LI("the zone object with id=%(zone_id)s is existed"), {"zone_id": zone_id}) json_name = record['name'] zones = self.get_zone_name_bytenant_id(context, record['tenant_id']) if len(zones) == 0: raise exception.IsNotExistError(param_name="tenant_id") flag = True for zone in zones: dev_zone_name = zone["zone_name"] dev_zone_name = '%s%s' % ('.', dev_zone_name) if json_name.endswith(dev_zone_name): flag = False break if flag: raise exception.ZoneOfRecordIsError(json_name=json_name) record_values = self._make_dns_record_object(record, zone_id) record_obj = objects.DnsZoneRrs(context, **record_values) # return response from DB response = self._create_in_storage(context, record_obj) new_name = tools.clean_end_str(dev_zone_name, record['name']) record['name'] = new_name try: response_dev = self.rpc_api.create_record(context, record, dev_zone_id) except Exception as e: LOG.error(_LE("Create response on device failed")) # since create failed in device, so delete object in DB self.delete_rrs_info(context, response["id"]) raise e # update dns_rrs_info table, since record id would be changed response = self.update_rrs_info(context, response["id"], None, response_dev) # update operation history type with Failed in DB input_operation_history['status'] = 'SUCCESS' self.db_common.update_operation_history( context, history.id, **input_operation_history) return response
def create_gpool(self, context, obj_dic): gslb_obj = ["name", "enable", "ttl", "max_addr_ret", "cname", "first_algorithm", "second_algorithm", "fallback_ip", "hms", "pass", "gmember_list", "warning"] driver_dic = tools.input_dic(gslb_obj, obj_dic) driver_dic["current_user"] = self.auth_name LOG.info(_LI("create the gpool values with dic format\ is %(json)s of dervice"), {"json": driver_dic}) url = (self.host + ":" + str(self.port) + '/gpool') headers = {'Content-type': 'application/json'} data = json.dumps(driver_dic) auth = (self.auth_name, self.auth_pw) LOG.info(_LI("create gpool url:" + url)) obj_dic['refcnt'] = 12 obj_dic['id'] = obj_dic['name'] return obj_dic
def insert_operation_history(self, context, **kwargs): current_time = timeutils.utcnow() opt_params = {} if 'vres_id' in kwargs: opt_params['config_id'] = kwargs['vres_id'] elif CONF.zdns.dns_vres_id: opt_params['config_id'] = CONF.zdns.dns_vres_id else: LOG.error(_LE("The Resource(with target vres_id) " "could not be found!")) raise NotFound() opt_params['input'] = kwargs['input'] opt_params['operation_type'] = kwargs['method'] opt_params['operation_time'] = current_time opt_params['operation_status'] = kwargs['status'] opt_obj = objects.OperationHistory(context, **opt_params) LOG.info(_LI("Inserting operation history record in DB")) operation_history = self.create_in_storage(context, opt_obj) LOG.info(_LI("Insert operation history record in DB successful")) return operation_history
def delete_gmap(self, context, obj_dic): name = obj_dic["name"] driver_dic = {} driver_dic["current_user"] = self.auth_name url = (self.host + ":" + str(self.port) + '/gmap/' + name) headers = {'Content-type': 'application/json'} data = json.dumps(driver_dic) auth = (self.auth_name, self.auth_pw) LOG.info(_LI("delete gmap url :" + url)) return obj_dic
def create_hm_template(self, context, obj_dic): gslb_obj = ["name", "types", "check_interval", "timeout", "max_retries", "max_retries", "sendstring", "recvstring", "username", "password"] driver_dic = tools.input_dic(gslb_obj, obj_dic) driver_dic["current_user"] = self.auth_name LOG.info(_LI("create the hm_template values with dic format" "is %(json)s of dervice"), {"json": driver_dic}) url = (self.host + ":" + str(self.port) + '/hm_template') return {"refcnt": "10", "id": "test_hm_template_id"}
def create_region(self, context, obj_dic): gslb_obj = ["name"] driver_dic = tools.input_dic(gslb_obj, obj_dic) driver_dic["current_user"] = self.auth_name LOG.info(_LI("create the region values with dic format\ is %(json)s of dervice"), {"json": driver_dic}) url = (self.host + ":" + str(self.port) + '/region') headers = {'Content-type': 'application/json'} data = json.dumps(driver_dic) auth = (self.auth_name, self.auth_pw) LOG.info(_LI("create region url:" + url)) response = requests.post(url, data=data, headers=headers, auth=auth, verify=False) if response.status_code is None: raise NonExistDevices if response.status_code is not 200: raise ZdnsErrMessage(self.zdns_error.getMessage(response. status_code)) return response.json()
def update_gmember(self, context, obj_dic): name = obj_dic["gmember_name"] gslb_obj = ["enable"] driver_dic = tools.input_dic(gslb_obj, obj_dic) driver_dic["current_user"] = self.auth_name LOG.info(_LI("update the gmember values with dic format\ is %(json)s of dervice"), {"json": driver_dic}) url = (self.host + ":" + str(self.port) + '/dc/' + obj_dic["gslb_zone_name"] + "/gmember/" + name) return {"update": "successed"}
def create_hm_template(self, context, obj_dic): gslb_obj = ["name", "types", "check_interval", "timeout", "max_retries", "max_retries", "sendstring", "recvstring", "username", "password"] driver_dic = tools.input_dic(gslb_obj, obj_dic) driver_dic["current_user"] = self.auth_name LOG.info(_LI("create the hm_template values with dic format" "is %(json)s of dervice"), {"json": driver_dic}) url = (self.host + ":" + str(self.port) + '/hm_template') headers = {'Content-type': 'application/json'} data = json.dumps(driver_dic) auth = (self.auth_name, self.auth_pw) LOG.info(_LI("create hm_template url:" + url)) response = requests.post(url, data=data, headers=headers, auth=auth, verify=False) if response.status_code is None: raise NonExistDevices if response.status_code is not 200: raise ZdnsErrMessage(self.zdns_error.getMessage(response. status_code)) return response.json()
def del_cache(self, context, cache_dic): """ delete cache """ url = (self.host + ":" + str(self.port) + '/cache/clean') LOG.info(_LI("delete cache :" + url)) headers = {'Content-type': 'application/json'} auth = (self.auth_name, self.auth_pw) response = requests.post(url, data=cache_dic, headers=headers, auth=auth, verify=False) if response.status_code is None: raise NonExistDevices if response.status_code is not 200: raise ZdnsErrMessage(self.zdns_error.getMessage(response. status_code)) return response.json()
def update_gmap(self, context, obj_dic): name = obj_dic["name"] gslb_obj = ["enable", "algorithm", "last_resort_pool", "gpool_list"] driver_dic = tools.input_dic(gslb_obj, obj_dic) driver_dic["current_user"] = self.auth_name LOG.info(_LI("update the gmap values with dic format\ is %(json)s of dervice"), {"json": driver_dic}) url = (self.host + ":" + str(self.port) + '/gmap/' + name) headers = {'Content-type': 'application/json'} data = json.dumps(driver_dic) auth = (self.auth_name, self.auth_pw) LOG.info(_LI("create gmap url:" + url)) response = requests.put(url=url, data=data, headers=headers, auth=auth, verify=False) if response.status_code is None: raise NonExistDevices if response.status_code is not 200: raise ZdnsErrMessage(self.zdns_error.getMessage(response. status_code)) return response.json()
def create_gpool(self, context, obj_dic): gslb_obj = ["name", "enable", "ttl", "max_addr_ret", "cname", "first_algorithm", "second_algorithm", "fallback_ip", "hms", "pass", "gmember_list", "warning"] driver_dic = tools.input_dic(gslb_obj, obj_dic) driver_dic["current_user"] = self.auth_name LOG.info(_LI("create the gpool values with dic format\ is %(json)s of dervice"), {"json": driver_dic}) url = (self.host + ":" + str(self.port) + '/gpool') headers = {'Content-type': 'application/json'} data = json.dumps(driver_dic) auth = (self.auth_name, self.auth_pw) LOG.info(_LI("create gpool url:" + url)) response = requests.post(url, data=data, headers=headers, auth=auth, verify=False) if response.status_code is None: raise NonExistDevices if response.status_code is not 200: raise ZdnsErrMessage(self.zdns_error.getMessage(response. status_code)) return response.json()
def get_rrs(self, context, zone_id): """ view rrs """ url = (self.host + ":" + str(self.port) + '/views/' + self.view_id + '/zones/' + zone_id + '/rrs') params = {'current_user': '******'} auth = (self.auth_name, self.auth_pw) LOG.info(_LI("get_rrs :" + url)) response = requests.get(url, data=params, auth=auth, verify=False) if response.status_code is None: raise NonExistDevices if response.status_code is not 200: raise ZdnsErrMessage(self.zdns_error.getMessage(response. status_code)) return response.json()
def create_zone(self, context, zone): LOG.info(_LI("create_zone: Replying rpc client's create_zone.")) print 'create_zone' return 'create_zone'
def get_zone(self, context, zone_id): LOG.info(_LI("get_zone: Replying rpc client's get_zone.")) print 'get_zone' return 'get_zone'
def update_zone(self, context, zone): LOG.info(_LI("update_zone: Replying rpc client's update_zone.")) return 'update_zone' return 'update_zone'
def delete_zone(self, context, zone_id): LOG.info(_LI("delete_zone: Calling central's delete_zone.")) return self.client.call(context, 'delete_zone', zone_id=zone_id)
def update_zone(self, context, zone): LOG.info(_LI("update_zone: Calling central's update_zone.")) return self.client.call(context, 'update_zone', zone=zone)
def get_zone(self, context, zone_id): LOG.info(_LI("get_zone: Calling central's get_zone.")) return self.client.call(context, 'get_zone', zone_id=zone_id)
def create_zone(self, context, zone): LOG.info(_LI("create_zone: Calling central's create_zone.")) return self.client.cast(context, 'create_zone', zone=zone)
def delete_zone(self, context, zone_id): LOG.info(_LI("delete_zone: Replying rpc client's delete_zone.")) return 'delete_zone' return 'delete_zone'