本文整理汇总了Python中pynipap.VRF.list方法的典型用法代码示例。如果您正苦于以下问题:Python VRF.list方法的具体用法?Python VRF.list怎么用?Python VRF.list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pynipap.VRF
的用法示例。
在下文中一共展示了VRF.list方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: list_vrf
# 需要导入模块: from pynipap import VRF [as 别名]
# 或者: from pynipap.VRF import list [as 别名]
def list_vrf(self):
""" List VRFs and return JSON encoded result.
"""
try:
vrfs = VRF.list()
except NipapError, e:
return json.dumps({'error': 1, 'message': e.args, 'type': type(e).__name__})
示例2: edit
# 需要导入模块: from pynipap import VRF [as 别名]
# 或者: from pynipap.VRF import list [as 别名]
def edit(self, id):
""" Edit a prefix.
"""
# find prefix
c.prefix = Prefix.get(int(id))
# we got a HTTP POST - edit object
if request.method == 'POST':
c.prefix.prefix = request.params['prefix_prefix']
c.prefix.description = request.params['prefix_description']
if request.params['prefix_node'].strip() == '':
c.prefix.node = None
else:
c.prefix.node = request.params['prefix_node']
if request.params['prefix_country'].strip() == '':
c.prefix.country = None
else:
c.prefix.country = request.params['prefix_country']
if request.params['prefix_comment'].strip() == '':
c.prefix.comment = None
else:
c.prefix.comment = request.params['prefix_comment']
if request.params['prefix_order_id'].strip() == '':
c.prefix.order_id = None
else:
c.prefix.order_id = request.params['prefix_order_id']
if request.params['prefix_customer_id'].strip() == '':
c.prefix.customer_id = None
else:
c.prefix.customer_id = request.params['prefix_customer_id']
if request.params['prefix_vrf'].strip() == '':
c.prefix.vrf = None
else:
# TODO: handle non-existent VRF...
c.prefix.vrf = VRF.list({ 'rt': request.params['prefix_vrf'] })[0]
if request.params.get('prefix_monitor') is not None:
c.prefix.monitor = True
else:
c.prefix.monitor = False
c.prefix.alarm_priority = request.params['prefix_alarm_priority']
c.prefix.save()
redirect(url(controller='prefix', action='list'))
return render('/prefix_edit.html')
示例3: AuthOptions
# 需要导入模块: from pynipap import VRF [as 别名]
# 或者: from pynipap.VRF import list [as 别名]
pynipap.xmlrpc_uri = "http://dev:[email protected]:1337"
o = AuthOptions({"authoritative_source": "nipap"})
# set to a string if you want the customerid populated
DEFAULT_CUSTOMER = None
# set this to true if any of the network blocks
# are unclean and are really assignments or hosts.
# use with caution.
detect_hosts = False
# this is for network blocks that are misrepresented
# it might not be needed for your network
hosts = []
for vrf in VRF.list():
if vrf.id == 0:
DEFAULT_VRF = vrf
break
else:
raise ValueError("No default VRF")
def export_tags(obj):
def f():
for name, attr in obj["extattrs"].items():
# skip inherited attributes
if attr.get("inheritance_source"):
continue
yield name, attr["value"]
示例4: raw_input
# 需要导入模块: from pynipap import VRF [as 别名]
# 或者: from pynipap.VRF import list [as 别名]
pynipap.xmlrpc_uri = xmlrpc_uri
if args.clear_vrfs:
remove_confirmed = args.force
if not remove_confirmed:
res = raw_input("Are you sure you want to remove all VRFs? Note how all" +
" prefixes in these VRFs WILL BE DELETED. The default VRF" +
" will NOT be deleted nor will it be emptied. [y/N]")
if len(res) > 0 and res.lower()[0] == 'y':
remove_confirmed = True
else:
print "Aborted"
if remove_confirmed:
print "Removing: ",
for v in VRF.list():
if v.id == 0:
continue
v.remove()
sys.stdout.write(".")
sys.stdout.flush()
print " done!"
if args.clear_pools:
remove_confirmed = args.force
if not remove_confirmed:
res = raw_input("Are you sure you want to remove all pools? [y/N]")
if len(res) > 0 and res.lower()[0] == 'y':
remove_confirmed = True
else:
print "Operation aborted."
示例5: list
# 需要导入模块: from pynipap import VRF [as 别名]
# 或者: from pynipap.VRF import list [as 别名]
def list(self):
""" List VRFs.
"""
c.vrfs = VRF.list()
return render("/vrf_list.html")