當前位置: 首頁>>代碼示例>>Python>>正文


Python Mgmt.get_value方法代碼示例

本文整理匯總了Python中Mgmt.get_value方法的典型用法代碼示例。如果您正苦於以下問題:Python Mgmt.get_value方法的具體用法?Python Mgmt.get_value怎麽用?Python Mgmt.get_value使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mgmt的用法示例。


在下文中一共展示了Mgmt.get_value方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: getTACACSAccountingCfged

# 需要導入模塊: import Mgmt [as 別名]
# 或者: from Mgmt import get_value [as 別名]
def getTACACSAccountingCfged():
    """
    @returns true if TACACS+ is configured as an accounting method
             and that there is a valid TACACS+ server configured.
    """
    acct = [Mgmt.get_value("/aaa/cmd_audit_method/1/name"),
            Mgmt.get_value("/aaa/cmd_audit_method/2/name")]

    return ('tacacs+' in acct)
開發者ID:akkmzack,項目名稱:RIOS-8.5,代碼行數:11,代碼來源:fwk_heartbeat.py

示例2: getTACACSAuthorizationCfged

# 需要導入模塊: import Mgmt [as 別名]
# 或者: from Mgmt import get_value [as 別名]
def getTACACSAuthorizationCfged():
    """
    @returns true if TACACS+ is configured as an authorization method
             and that there is a valid TACACS+ server configured.
    """
    author = [Mgmt.get_value("/aaa/cmd_author_method/1/name"),
              Mgmt.get_value("/aaa/cmd_author_method/2/name")]

    return ('tacacs+' in author)
開發者ID:akkmzack,項目名稱:RIOS-8.5,代碼行數:11,代碼來源:fwk_heartbeat.py

示例3: __set_user_password

# 需要導入模塊: import Mgmt [as 別名]
# 或者: from Mgmt import get_value [as 別名]
    def __set_user_password(self, username, password):
        # XXX/jshilkaitis: lame, should be an action on the mgmtd side

        # XXX/jshilkaitis: why doesn't the framework do validation?

        valid_password = common.lc_password_validate(password)

        if not valid_password:
            # XXX/jshilkaitis: hardcode the reason for now, since we know
            # length is the only criterion, but that may not be true in the
            # future.
            raise ServiceError, 'Password must contain at least 6 characters'

        use_sha512 = Mgmt.get_value('/rbt/support/config/sha_password/enable')

        if use_sha512:
            crypted_password = common.sha_encrypt_password(False, password)
        else:
            crypted_password = common.ltc_encrypt_password(password)

        password_node_name = '/auth/passwd/user/%s/password' % username

        code, msg = Mgmt.set((password_node_name, 'string', crypted_password))

        if code != 0:
            raise ServiceError, msg
開發者ID:akkmzack,項目名稱:RIOS-8.5,代碼行數:28,代碼來源:fwk_service.py

示例4: get_pfs_stats

# 需要導入模塊: import Mgmt [as 別名]
# 或者: from Mgmt import get_value [as 別名]
    def get_pfs_stats(self, start_time, end_time, share_name):
        """
        get_pfs_stats(auth, start_time, end_time, share_name) ->
        [
            [share size],
            [bytes received],
            [bytes sent]
        ]

        Fetch the system's PFS statistics.

        Parameters:
        start_time (datetime) - start of the stats query period
        end_time (datetime) - end of the stats query period
        share_name (string) - share whose stats are desired or 'all' for the
                               sum of all shares

        Exceptions:
        get_pfs_statsFault - Datetime not in known format
        get_pfs_statsFault - Unknown share name
        """
        if share_name == 'all':
            share_id = 0
        else:
            share_id = Mgmt.get_value('/rbt/rcu/share/%s/config/id'
                                      % share_name)

            if share_id is None:
                raise ServiceError, 'Unknown share name: %s' % share_name

        return self.get_stats_internal('pfs', 3,
                                       start_time, end_time, share_id)
開發者ID:akkmzack,項目名稱:RIOS-8.5,代碼行數:34,代碼來源:rbt_service.py

示例5: getNTPAuthEnabled

# 需要導入模塊: import Mgmt [as 別名]
# 或者: from Mgmt import get_value [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
開發者ID:akkmzack,項目名稱:RIOS-8.5,代碼行數:19,代碼來源:fwk_heartbeat.py

示例6: is_memlock_enabled

# 需要導入模塊: import Mgmt [as 別名]
# 或者: from Mgmt import get_value [as 別名]
def is_memlock_enabled():
    """!
    Queries mgmtd to determine if workstation memlock is turned on
    """
    memlock_node = "/rbt/vsp/config/memlock/enable"
    memlocked = Mgmt.get_value(memlock_node)
    if not memlocked or memlocked == "":
        Logging.log(Logging.LOG_ERR, "Cannot determine if memlock is enabled")
        memlocked = "false"
    return memlocked == "true"
開發者ID:akkmzack,項目名稱:RIOS-8.5,代碼行數:12,代碼來源:Vsp.py

示例7: get_node_value

# 需要導入模塊: import Mgmt [as 別名]
# 或者: from Mgmt import get_value [as 別名]
    def get_node_value(node_name):
        """get value of a specified node
        
        takes one argument:
            node_name -> name of the node you want the value of
        returns:
            (value) -> value of the node_name
        """
	import Mgmt
        value = Mgmt.get_value(node_name)
        return value
開發者ID:akkmzack,項目名稱:RIOS-8.5,代碼行數:13,代碼來源:easyConfig.py

示例8: is_interceptor_in_cluster

# 需要導入模塊: import Mgmt [as 別名]
# 或者: from Mgmt import get_value [as 別名]
def is_interceptor_in_cluster():
    RSI = '/rbt/sport/intercept'
    names = Mgmt.get_children(RSI + '/config/neighbor/name')[0]
    
    for name in names:
        is_interceptor = Mgmt.get_value(RSI + '/neighbor/' + \
		         name + '/is_interceptor') == 'true'
        if is_interceptor:
            return True
    
    return False;
開發者ID:akkmzack,項目名稱:RIOS-8.5,代碼行數:13,代碼來源:sh_heartbeat.py

示例9: __start_sport

# 需要導入模塊: import Mgmt [as 別名]
# 或者: from Mgmt import get_value [as 別名]
    def __start_sport(self):
        val = Mgmt.get_value('/pm/monitor/process/sport/state')

        if val is None:
            raise ServiceError, "Could not determine the service's state"

        if val != 'running':
            code, msg, bindings = Mgmt.action(
                '/rbt/sport/main/action/restart_service')

            if code != 0:
                raise ServiceError, msg
開發者ID:akkmzack,項目名稱:RIOS-8.5,代碼行數:14,代碼來源:rbt_service.py

示例10: get_rios_manage_esxi_ip

# 需要導入模塊: import Mgmt [as 別名]
# 或者: from Mgmt import get_value [as 別名]
def get_rios_manage_esxi_ip():
    """!
    Queries mgmtd for the current RiOS manage ESXi IP address and returns it

    Any callers of this function MUST have an open Mgmt GCL session

    If failed, the function returns None.
    """
    current_rios_mgmt_esxi_ip_node = "/rbt/vsp/state/network/rios_manage_esxi/ip"
    current_rios_mgmt_esxi_ip = Mgmt.get_value(current_rios_mgmt_esxi_ip_node)
    if not current_rios_mgmt_esxi_ip or current_rios_mgmt_esxi_ip == "0.0.0.0":
        Logging.log(Logging.LOG_INFO, "Failed to get RiOS manage ESXi IP address")
        current_rios_mgmt_esxi_ip = None
    return current_rios_mgmt_esxi_ip
開發者ID:akkmzack,項目名稱:RIOS-8.5,代碼行數:16,代碼來源:Vsp.py

示例11: getAuthenticationCfged

# 需要導入模塊: import Mgmt [as 別名]
# 或者: from Mgmt import get_value [as 別名]
def getAuthenticationCfged(auth_method):
    """
    @params auth_method: The authentication method to look for.
                         local, radius or tacacs.

    @returns bool indicating whether the specified authentication
             method is configured.  In the case of TACACS+ and RADIUS,
             true is only returned if the authentication method is
             configured AND a valid RADIUS/TACACS+ server is configured.
    """
    auth = [Mgmt.get_value("/aaa/auth_method/1/name"),
            Mgmt.get_value("/aaa/auth_method/2/name"),
            Mgmt.get_value("/aaa/auth_method/3/name")]

    if auth_method == radius:
        configured = ('radius' in auth)
    elif auth_method == tacacs:
        configured = ('tacacs+' in auth)
    elif auth_method == local:
        configured = ('local' in auth)
    else:
        configured = False

    return configured
開發者ID:akkmzack,項目名稱:RIOS-8.5,代碼行數:26,代碼來源:fwk_heartbeat.py

示例12: get_debug_option

# 需要導入模塊: import Mgmt [as 別名]
# 或者: from Mgmt import get_value [as 別名]
def get_debug_option():
    """!
    Note: requires an existing Mgmt connection
    Returns either "release", "debug", "stats"
    """

    node_name = "/rbt/vsp/config/esxi/vmx/debug_option"

    ret_option = "release"

    option = Mgmt.get_value(node_name)

    # If somehow the node does not exist, we'll assume the release binary
    if option:
        ret_option = option

    return ret_option
開發者ID:akkmzack,項目名稱:RIOS-8.5,代碼行數:19,代碼來源:vsp_vmware_vmx_wrapper.py

示例13: get_rsp_vni_stats

# 需要導入模塊: import Mgmt [as 別名]
# 或者: from Mgmt import get_value [as 別名]
    def get_rsp_vni_stats(self, start_time, end_time, opt_vni, side):
        """
        get_rsp_vni_stats(auth, start_time, end_time, opt_vni, side) ->
        [
            [ingress bytes],
            [egress bytes],
            [ingress packets],
            [egress packets]
        ]

        Fetch the system's RSP VNI statistics.

        Parameters:
        start_time (datetime) - start of the stats query period
        end_time (datetime) - end of the stats query period
        opt_vni (string) - name of vni whose stats are desired
        side (string) - side of the vni whose stats are desired
                        (lan, wan, or pkg)

        Exceptions:
        get_rsp_vni_statsFault - Datetime not in known format
        get_rsp_vni_statsFault - Invalid optimization VNI side
        get_rsp_vni_statsFault - Invalid optimization VNI
        """
        offset_dict = {
            'lan' : 0,
            'wan' : 10,
            'pkg' : 20,
            }

        try:
            offset = offset_dict[side]
        except KeyError:
            raise ServiceError, '%s is not a valid optimization VNI side' % side

        id = Mgmt.get_value('/rbt/rsp2/state/vni/opt/%s/stats_id' % opt_vni)

        if id is None:
            raise ServiceError, '%s is not a valid optimization vni' % opt_vni

        vni_id = int(id) + offset

        return self.get_stats_internal('rsp', 4, start_time, end_time, vni_id)
開發者ID:akkmzack,項目名稱:RIOS-8.5,代碼行數:45,代碼來源:rbt_service.py

示例14: __stop_sport

# 需要導入模塊: import Mgmt [as 別名]
# 或者: from Mgmt import get_value [as 別名]
    def __stop_sport(self):
        val = Mgmt.get_value('/pm/monitor/process/sport/state')

        if val is None:
            raise ServiceError, "Could not determine the service's state"

        if val == 'running':
            code, msg, bindings = Mgmt.action(
                '/rbt/sport/status/action/unset_restart_needed')

            if code != 0:
                raise ServiceError, msg

            code, msg, bindings = Mgmt.action(
                '/pm/actions/terminate_process',
                ('process_name', 'string', 'sport'))

            if code != 0:
                raise ServiceError, msg
開發者ID:akkmzack,項目名稱:RIOS-8.5,代碼行數:21,代碼來源:rbt_service.py

示例15: get_alarm_status

# 需要導入模塊: import Mgmt [as 別名]
# 或者: from Mgmt import get_value [as 別名]
    def get_alarm_status(self, alarm):
        """
        get_alarm_status(auth, alarm) -> string

        Get an alarm's status.

        Parameters:
        alarm (string) - name of the alarm whose status will be returned

        Exceptions:
        get_alarm_statusFault - Alarm does not exist
        get_alarm_statusFault - Server Error.  Contact Support.
        """
        alarm = alarm.lower()

        alarm_enabled = Mgmt.get_value('/stats/config/alarm/%s/enable'
                                       % alarm)

        if alarm_enabled is None:
            raise ServiceError, 'Alarm %s does not exist' % alarm
        elif alarm_enabled == 'false':
            return 'disabled'
        elif alarm_enabled == 'true':
            # XXX/jshilkaitis: use mdc_iterate_binding_pattern one day, but
            # need to expose it first, and since it's non-trivial, I'm
            # punting on that for now.
            alarm_pfx = '/stats/state/alarm/' + alarm
            alarm_nodes = Mgmt.iterate(alarm_pfx, subtree=True)

            for node in alarm_nodes:
                if ((Mgmt.bn_name_pattern_match(
                    node[0], alarm_pfx + '/node/*/rising/error') or
                     Mgmt.bn_name_pattern_match(
                    node[0], alarm_pfx + '/node/*/falling/error')) and
                    node[2] == 'true'):
                    return 'ERROR'
        else:
            raise ServiceError, 'Server error. Contact Support.'

        return 'ok'
開發者ID:akkmzack,項目名稱:RIOS-8.5,代碼行數:42,代碼來源:fwk_service.py


注:本文中的Mgmt.get_value方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。