本文整理汇总了Python中pynipap.VRF.description方法的典型用法代码示例。如果您正苦于以下问题:Python VRF.description方法的具体用法?Python VRF.description怎么用?Python VRF.description使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pynipap.VRF
的用法示例。
在下文中一共展示了VRF.description方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_vrf
# 需要导入模块: from pynipap import VRF [as 别名]
# 或者: from pynipap.VRF import description [as 别名]
def add_vrf(self):
""" Add a new VRF to NIPAP and return its data.
"""
v = VRF()
if 'rt' in request.params:
if request.params['rt'].strip() != '':
v.rt = request.params['rt'].strip()
if 'name' in request.params:
if request.params['name'].strip() != '':
v.name = request.params['name'].strip()
if 'description' in request.params:
v.description = request.params['description']
try:
v.save()
except NipapError, e:
return json.dumps({'error': 1, 'message': e.args, 'type': type(e).__name__})
示例2: add
# 需要导入模块: from pynipap import VRF [as 别名]
# 或者: from pynipap.VRF import description [as 别名]
def add(self):
""" Add a new VRF.
"""
c.action = "add"
if "action" in request.params:
if request.params["action"] == "add":
v = VRF()
if request.params["rt"].strip() != "":
v.rt = request.params["rt"]
if request.params["name"].strip() != "":
v.name = request.params["name"]
v.description = request.params["description"]
v.save()
redirect(url(controller="vrf", action="list"))
return render("/vrf_add.html")
示例3: add_vrf
# 需要导入模块: from pynipap import VRF [as 别名]
# 或者: from pynipap.VRF import description [as 别名]
def add_vrf(self):
""" Add a new VRF to NIPAP and return its data.
"""
v = VRF()
if 'rt' in request.json:
v.rt = validate_string(request.json, 'rt')
if 'name' in request.json:
v.name = validate_string(request.json, 'name')
if 'description' in request.json:
v.description = validate_string(request.json, 'description')
if 'tags' in request.json:
v.tags = request.json['tags']
if 'avps' in request.json:
v.avps = request.json['avps']
try:
v.save()
except NipapError, e:
return json.dumps({'error': 1, 'message': e.args, 'type': type(e).__name__})