Example #1
0
def cleanup_tacacs(ptfhost, tacacs_creds, duthost):
    # stop tacacs server
    stop_tacacs_server(ptfhost)

    # reset tacacs client configuration
    remove_all_tacacs_server(duthost)
    duthost.shell("sudo config tacacs default passkey")
    duthost.shell("sudo config aaa authentication login default")
    duthost.shell("sudo config aaa authentication failthrough default")

    (skip, _) = check_skip_release(duthost, per_command_check_skip_versions)
    if not skip:
        duthost.shell("sudo config aaa authorization local")
        duthost.shell("sudo config aaa accounting disable")

    duthost.user(name=tacacs_creds['tacacs_ro_user'],
                 state='absent',
                 remove='yes',
                 force='yes',
                 module_ignore_errors=True)
    duthost.user(name=tacacs_creds['tacacs_rw_user'],
                 state='absent',
                 remove='yes',
                 force='yes',
                 module_ignore_errors=True)
    duthost.user(name=tacacs_creds['tacacs_jit_user'],
                 state='absent',
                 remove='yes',
                 force='yes',
                 module_ignore_errors=True)
Example #2
0
def setup_tacacs_client(duthost, tacacs_creds, tacacs_server_ip):
    """setup tacacs client"""

    # configure tacacs client
    duthost.shell("sudo config tacacs passkey %s" %
                  tacacs_creds[duthost.hostname]['tacacs_passkey'])

    # get default tacacs servers
    config_facts = duthost.config_facts(host=duthost.hostname,
                                        source="running")['ansible_facts']
    for tacacs_server in config_facts.get('TACPLUS_SERVER', {}):
        duthost.shell("sudo config tacacs delete %s" % tacacs_server)
    duthost.shell("sudo config tacacs add %s" % tacacs_server_ip)
    duthost.shell("sudo config tacacs authtype login")

    # enable tacacs+
    duthost.shell("sudo config aaa authentication login tacacs+")

    (skip, _) = check_skip_release(duthost, per_command_check_skip_versions)
    if not skip:
        duthost.shell("sudo config aaa authorization local")
        duthost.shell("sudo config aaa accounting disable")

    # setup local user
    setup_local_user(duthost, tacacs_creds)
def is_route_flow_counter_supported(duthosts, enum_rand_one_per_hwsku_hostname):
    """Check if route flow counter is supported on this platform

    Args:
        dut (object): DUT object

    Returns:
        bool: True if supported
    """
    rand_selected_dut = duthosts[enum_rand_one_per_hwsku_hostname]
    if rand_selected_dut.facts['asic_type'] == 'vs':
        # vs platform always set SAI capability to enabled, however, it does not really support all SAI atrributes.
        # Currently, vs platform does not support route flow counter.
        return False
    skip, _ = check_skip_release(rand_selected_dut, skip_versions)
    if skip:
        logger.info('Route flow counter is not supported on these versions: {}'.format(skip_versions))
        return False

    route_flow_counter_capability = [] # Use a list to store the capability
    if not wait_until(CAPABILITY_WAIT_TIME_IN_SEC, CAPABILITY_CHECK_INTERVAL_IN_SEC, 0, get_route_flow_counter_capability, rand_selected_dut, route_flow_counter_capability):
        pytest_assert(False, 'Failed to get route flow counter capability')
    if not route_flow_counter_capability[0]:
        logger.info('Route flow counter is not supported on this platform')
    return route_flow_counter_capability[0]