本文整理汇总了Python中nca47.common.i18n._LI函数的典型用法代码示例。如果您正苦于以下问题:Python _LI函数的具体用法?Python _LI怎么用?Python _LI使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_LI函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: create_gmember
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()
开发者ID:WosunOO,项目名称:nca_xianshu,代码行数:25,代码来源:zdns_driver.py
示例2: report_agent_state
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
开发者ID:WosunOO,项目名称:nca_xianshu,代码行数:33,代码来源:service.py
示例3: update_operation_history
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
开发者ID:WosunOO,项目名称:nca47,代码行数:8,代码来源:db_common.py
示例4: create_syngroup
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
开发者ID:WosunOO,项目名称:nca_xianshu,代码行数:15,代码来源:fake_driver.py
示例5: create_gmember
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"}
开发者ID:WosunOO,项目名称:nca_xianshu,代码行数:16,代码来源:fake_driver.py
示例6: list
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)
开发者ID:willowd878,项目名称:nca47,代码行数:28,代码来源:securityZone.py
示例7: show
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)
开发者ID:WosunOO,项目名称:nca47,代码行数:27,代码来源:net_service.py
示例8: update_gmap
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
开发者ID:WosunOO,项目名称:nca_xianshu,代码行数:16,代码来源:fake_driver.py
示例9: create
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)
开发者ID:WosunOO,项目名称:nca47,代码行数:28,代码来源:vlan.py
示例10: remove
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)
开发者ID:WosunOO,项目名称:nca_xianshu,代码行数:26,代码来源:vrf.py
示例11: remove
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)
开发者ID:WosunOO,项目名称:nca47,代码行数:29,代码来源:snat.py
示例12: create
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)
开发者ID:willowd878,项目名称:nca47,代码行数:30,代码来源:securityZone.py
示例13: get_rrs
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
开发者ID:WosunOO,项目名称:nca_xianshu,代码行数:32,代码来源:fake_driver.py
示例14: list
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)
开发者ID:WosunOO,项目名称:nca_xianshu,代码行数:26,代码来源:dns_gslb_zone.py
示例15: remove
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)
开发者ID:WosunOO,项目名称:nca_xianshu,代码行数:31,代码来源:dns_gslb_zone.py
示例16: list
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)
开发者ID:WosunOO,项目名称:nca_xianshu,代码行数:32,代码来源:staticnat.py
示例17: create
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)
开发者ID:WosunOO,项目名称:nca47,代码行数:27,代码来源:vrf.py
示例18: list
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)
开发者ID:WosunOO,项目名称:nca_xianshu,代码行数:26,代码来源:vlan.py
示例19: create_record
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
开发者ID:WosunOO,项目名称:nca47,代码行数:59,代码来源:dns_manager.py
示例20: create_gpool
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
开发者ID:WosunOO,项目名称:nca_xianshu,代码行数:18,代码来源:fake_driver.py
注:本文中的nca47.common.i18n._LI函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论