本文整理汇总了Python中Mgmt.get_pattern方法的典型用法代码示例。如果您正苦于以下问题:Python Mgmt.get_pattern方法的具体用法?Python Mgmt.get_pattern怎么用?Python Mgmt.get_pattern使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mgmt
的用法示例。
在下文中一共展示了Mgmt.get_pattern方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getValidServersCount
# 需要导入模块: import Mgmt [as 别名]
# 或者: from Mgmt import get_pattern [as 别名]
def getValidServersCount(method):
"""
@param method: tacacs or radius, the server type to check.
@returns number of enabled servers configured for the
specified method
"""
configured = False
if method == tacacs:
servers = Mgmt.get_pattern('/tacacs/server/*/enable')
elif method == radius:
servers = Mgmt.get_pattern('/radius/server/*/enable')
else:
servers = None
count = 0
for server in servers:
if server[2] == 'true':
count = count + 1
return count
示例2: getNTPAuthEnabled
# 需要导入模块: import Mgmt [as 别名]
# 或者: from Mgmt import get_pattern [as 别名]
def getNTPAuthEnabled():
"""
@returns true if any enabled NTP server has a valid key configured.
"""
auth_enabled = False
ntp_hosts = Mgmt.get_pattern('/ntp/server/address/*')
for host in ntp_hosts:
key = Mgmt.get_value('/ntp/server/address/%s/key' % host[2])
enable = Mgmt.get_value('/ntp/server/address/%s/enable' % host[2])
if (key != '0') and (enable == 'true'):
if Mgmt.get_value('/ntp/keys/%s' % key):
auth_enabled = True
break
return auth_enabled
示例3: getRBMUsersCount
# 需要导入模块: import Mgmt [as 别名]
# 或者: from Mgmt import get_pattern [as 别名]
def getRBMUsersCount():
"""
@returns the number of RBM users on the system.
"""
return countValues(Mgmt.get_pattern("/rbm/config/user/*"))