本文整理匯總了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/*"))