Example #1
0
def commands(request):
    """
    Parse the commands.yml file to get a commands dictionary
    """
    device_under_test = request.config.getoption("test_device")
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    test_platform = device["device_type"]

    commands_yml = parse_yaml(PWD + "/etc/commands.yml")
    return commands_yml[test_platform]
Example #2
0
def commands(request):
    '''
    Parse the commands.yml file to get a commands dictionary
    '''
    device_under_test = request.config.getoption('test_device')
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    test_platform = device['device_type']

    commands_yml = parse_yaml(PWD + "/etc/commands.yml")
    return commands_yml[test_platform]
Example #3
0
def commands(request):
    '''
    Parse the commands.yml file to get a commands dictionary
    '''

    device_under_test = request.config.getoption('test_device')
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    test_platform = device['device_type']
     
    commands = parse_yaml(PWD + "/etc/commands.yml")
    return commands[test_platform]
Example #4
0
def expected_responses(request):
    '''
    Parse the responses.yml file to get a responses dictionary
    '''
    device_under_test = request.config.getoption('test_device')
    responses = parse_yaml(PWD + "/etc/responses.yml")
    return responses[device_under_test]
Example #5
0
def tcl_fixture(request):
    """
    Create an InLineTransfer object.

    Return a tuple (ssh_conn, tcl_handle)
    """
    device_under_test = request.config.getoption('test_device')
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device['verbose'] = False
    ssh_conn = ConnectHandler(**device)

    dest_file_system = 'flash:'
    source_file = 'test9.txt'
    dest_file = 'test9.txt'
    local_file = 'testx.txt'
    direction = 'put'

    tcl_transfer = InLineTransfer(ssh_conn,
                                  source_file=source_file,
                                  dest_file=dest_file,
                                  file_system=dest_file_system,
                                  direction=direction)

    # Delete the test transfer files
    if tcl_transfer.check_file_exists():
        delete_file_ios(ssh_conn, dest_file_system, dest_file)
    if os.path.exists(local_file):
        os.remove(local_file)

    return (ssh_conn, tcl_transfer)
Example #6
0
def scp_fixture_get(request):
    """
    Create an FileTransfer object (direction=get)

    Return a tuple (ssh_conn, scp_handle)
    """
    device_under_test = request.config.getoption('test_device')
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device['verbose'] = False
    ssh_conn = ConnectHandler(**device)

    dest_file_system = 'flash:'
    source_file = 'test9.txt'
    local_file = 'testx.txt'
    dest_file = local_file
    direction = 'get'

    scp_transfer = FileTransfer(ssh_conn,
                                source_file=source_file,
                                dest_file=dest_file,
                                file_system=dest_file_system,
                                direction=direction)
    scp_transfer.establish_scp_conn()

    # Make sure SCP is enabled
    scp_transfer.enable_scp()

    # Delete the test transfer files
    if os.path.exists(local_file):
        os.remove(local_file)

    return (ssh_conn, scp_transfer)
Example #7
0
def scp_fixture(request):
    """
    Create an FileTransfer object.

    Return a tuple (ssh_conn, scp_handle)
    """
    device_under_test = request.config.getoption('test_device')
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device['verbose'] = False
    ssh_conn = ConnectHandler(**device)

    dest_file_system = 'flash:'
    source_file = 'test9.txt'
    dest_file = 'test9.txt'
    local_file = 'testx.txt'
    direction = 'put'

    scp_transfer = FileTransfer(ssh_conn, source_file=source_file, dest_file=dest_file,
                                file_system=dest_file_system, direction=direction)
    scp_transfer.establish_scp_conn()

    # Make sure SCP is enabled
    scp_transfer.enable_scp()

    # Delete the test transfer files
    if scp_transfer.check_file_exists():
        delete_file_ios(ssh_conn, dest_file_system, dest_file)
    if os.path.exists(local_file):
        os.remove(local_file)

    return (ssh_conn, scp_transfer)
Example #8
0
def expected_responses(request):
    '''
    Parse the responses.yml file to get a responses dictionary
    '''
    device_under_test = request.config.getoption('test_device')
    responses = parse_yaml(PWD + "/etc/responses.yml")
    return responses[device_under_test]
Example #9
0
def commands(request):
    """
    Parse the commands.yml file to get a commands dictionary
    """
    device_under_test = request.config.getoption("test_device")
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    test_platform = device["device_type"]

    commands_yml = parse_yaml(PWD + "/etc/commands.yml")

    # Nokia SR-OS driver is overloaded with both classical-CLI and MD-CLI
    # Swap out the commands to be the MD-CLI commands
    if device_under_test == "sros1_md":
        test_platform = "nokia_sros_md"

    return commands_yml[test_platform]
def scp_fixture(request):
    """
    Create an FileTransfer object.

    Return a tuple (ssh_conn, scp_handle)
    """
    platform_args = get_platform_args()

    # Create the files
    with open("test9.txt", "w") as f:
        # Not important what it is in the file
        f.write("no logging console\n")

    with open("test2_src.txt", "w") as f:
        # Not important what it is in the file
        f.write("no logging console\n")
        f.write("logging buffered 10000\n")

    device_under_test = request.config.getoption("test_device")
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device["verbose"] = False
    ssh_conn = ConnectHandler(**device)

    platform = device["device_type"]
    dest_file_system = platform_args[platform]["file_system"]
    if "ciena_saos" in platform and ssh_conn.username:
        dest_file_system = f"/tmp/users/{ssh_conn.username}"

    source_file = "test9.txt"
    dest_file = "test9.txt"
    local_file = "testx.txt"
    direction = "put"

    scp_transfer = FileTransfer(
        ssh_conn,
        source_file=source_file,
        dest_file=dest_file,
        file_system=dest_file_system,
        direction=direction,
    )
    scp_transfer.establish_scp_conn()

    # Make sure SCP is enabled
    if platform_args[platform]["enable_scp"]:
        scp_transfer.enable_scp()

    # Delete the test transfer files
    if scp_transfer.check_file_exists():
        func = platform_args[platform]["delete_file"]
        func(ssh_conn, dest_file_system, dest_file)
    if os.path.exists(local_file):
        os.remove(local_file)
    return (ssh_conn, scp_transfer)
Example #11
0
def device_slog(request):
    """
    Create the SSH connection to the remote device. Modify session_log init arguments.

    Return the netmiko device (not connected)
    """
    device_under_test = request.config.getoption("test_device")
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device["verbose"] = False
    device["session_log_file_mode"] = "append"
    return device
Example #12
0
def net_connect(request):
    """
    Create the SSH connection to the remote device

    Return the netmiko connection object
    """
    device_under_test = request.config.getoption("test_device")
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device["verbose"] = False
    conn = ConnectHandler(**device)
    return conn
def device_slog(request):
    """
    Create the SSH connection to the remote device. Modify session_log init arguments.

    Return the netmiko device (not connected)
    """
    device_under_test = request.config.getoption("test_device")
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device["verbose"] = False
    device["session_log_file_mode"] = "append"
    return device
Example #14
0
def net_connect(request):
    """
    Create the SSH connection to the remote device

    Return the netmiko connection object
    """
    device_under_test = request.config.getoption('test_device')
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device['verbose'] = False
    conn = ConnectHandler(**device)
    return conn
def net_connect_newconn(request):
    """
    Create the SSH connection to the remote device

    Return the netmiko connection object.
    Force a new connection for each test.
    """
    device_under_test = request.config.getoption("test_device")
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device["verbose"] = False
    conn = ConnectHandler(**device)
    return conn
Example #16
0
def ssh_autodetect(request):
    """Create an SSH autodetect object. 

    return (ssh_conn, real_device_type)
    """
    device_under_test = request.config.getoption('test_device')
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device['verbose'] = False
    my_device_type = device.pop('device_type')
    device['device_type'] = 'autodetect'
    conn = SSHDetect(**device)
    return (conn, my_device_type)
Example #17
0
def net_connect_cm(request):
    """
    Create the SSH connection to the remote device using a context manager 
    retrieve the find_prompt() data and close the connection.
    """
    device_under_test = request.config.getoption('test_device')
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device['verbose'] = False
    my_prompt = ""
    with ConnectHandler(**device) as conn:
        my_prompt = conn.find_prompt()
    return my_prompt
Example #18
0
def ssh_autodetect(request):
    """Create an SSH autodetect object. 

    return (ssh_conn, real_device_type)
    """
    device_under_test = request.config.getoption("test_device")
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device["verbose"] = False
    my_device_type = device.pop("device_type")
    device["device_type"] = "autodetect"
    conn = SSHDetect(**device)
    return (conn, my_device_type)
Example #19
0
def net_connect_slog_wr(request):
    """
    Create the SSH connection to the remote device. Modify session_log init arguments.

    Return the netmiko connection object.
    """
    device_under_test = request.config.getoption('test_device')
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device['verbose'] = False
    device['session_log_record_writes'] = True
    conn = ConnectHandler(**device)
    return conn
Example #20
0
def net_connect_cm(request):
    """
    Create the SSH connection to the remote device using a context manager 
    retrieve the find_prompt() data and close the connection.
    """
    device_under_test = request.config.getoption("test_device")
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device["verbose"] = False
    my_prompt = ""
    with ConnectHandler(**device) as conn:
        my_prompt = conn.find_prompt()
    return my_prompt
Example #21
0
def net_connect_slog_wr(request):
    """
    Create the SSH connection to the remote device. Modify session_log init arguments.

    Return the netmiko connection object.
    """
    device_under_test = request.config.getoption("test_device")
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device["verbose"] = False
    device["session_log_record_writes"] = True
    conn = ConnectHandler(**device)
    return conn
def scp_file_transfer(request):
    """
    Testing file_transfer

    Return the netmiko connection object
    """
    platform_args = get_platform_args()

    # Create the files
    with open("test9.txt", "w") as f:
        # Not important what it is in the file
        f.write("no logging console\n")

    with open("test2_src.txt", "w") as f:
        # Not important what it is in the file
        f.write("no logging console\n")
        f.write("logging buffered 10000\n")

    device_under_test = request.config.getoption("test_device")
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device["verbose"] = False
    ssh_conn = ConnectHandler(**device)

    platform = device["device_type"]
    file_system = platform_args[platform]["file_system"]
    source_file = "test9.txt"
    dest_file = "test9.txt"
    local_file = "testx.txt"
    alt_file = "test2.txt"
    direction = "put"

    scp_transfer = FileTransfer(
        ssh_conn,
        source_file=source_file,
        dest_file=dest_file,
        file_system=file_system,
        direction=direction,
    )
    scp_transfer.establish_scp_conn()

    # Delete the test transfer files
    if scp_transfer.check_file_exists():
        func = platform_args[platform]["delete_file"]
        func(ssh_conn, file_system, dest_file)
    if os.path.exists(local_file):
        os.remove(local_file)
    if os.path.exists(alt_file):
        os.remove(alt_file)

    return (ssh_conn, file_system)
Example #23
0
def scp_file_transfer(request):
    """
    Testing file_transfer

    Return the netmiko connection object
    """
    platform_args = get_platform_args()

    # Create the files
    with open("test9.txt", "w") as f:
        # Not important what it is in the file
        f.write("no logging console\n")

    with open("test2_src.txt", "w") as f:
        # Not important what it is in the file
        f.write("no logging console\n")
        f.write("logging buffered 10000\n")

    device_under_test = request.config.getoption("test_device")
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device["verbose"] = False
    ssh_conn = ConnectHandler(**device)

    platform = device["device_type"]
    file_system = platform_args[platform]["file_system"]
    source_file = "test9.txt"
    dest_file = "test9.txt"
    local_file = "testx.txt"
    alt_file = "test2.txt"
    direction = "put"

    scp_transfer = FileTransfer(
        ssh_conn,
        source_file=source_file,
        dest_file=dest_file,
        file_system=file_system,
        direction=direction,
    )
    scp_transfer.establish_scp_conn()

    # Delete the test transfer files
    if scp_transfer.check_file_exists():
        func = platform_args[platform]["delete_file"]
        func(ssh_conn, file_system, dest_file)
    if os.path.exists(local_file):
        os.remove(local_file)
    if os.path.exists(alt_file):
        os.remove(alt_file)

    return (ssh_conn, file_system)
Example #24
0
def scp_fixture(request):
    """
    Create an FileTransfer object.

    Return a tuple (ssh_conn, scp_handle)
    """
    platform_args = get_platform_args()

    # Create the files
    with open("test9.txt", "w") as f:
        # Not important what it is in the file
        f.write("no logging console\n")

    with open("test2_src.txt", "w") as f:
        # Not important what it is in the file
        f.write("no logging console\n")
        f.write("logging buffered 10000\n")

    device_under_test = request.config.getoption('test_device')
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device['verbose'] = False
    ssh_conn = ConnectHandler(**device)

    platform = device['device_type']
    dest_file_system = platform_args[platform]['file_system']
    source_file = 'test9.txt'
    dest_file = 'test9.txt'
    local_file = 'testx.txt'
    direction = 'put'

    scp_transfer = FileTransfer(ssh_conn,
                                source_file=source_file,
                                dest_file=dest_file,
                                file_system=dest_file_system,
                                direction=direction)
    scp_transfer.establish_scp_conn()

    # Make sure SCP is enabled
    if platform_args[platform]['enable_scp']:
        scp_transfer.enable_scp()

    # Delete the test transfer files
    if scp_transfer.check_file_exists():
        func = platform_args[platform]['delete_file']
        func(ssh_conn, dest_file_system, dest_file)
    if os.path.exists(local_file):
        os.remove(local_file)
    return (ssh_conn, scp_transfer)
def net_connect_cmd_verify(request):
    """
    Create the SSH connection to the remote device

    Return the netmiko connection object

    Set global_cmd_verify = False
    """
    device_under_test = request.config.getoption("test_device")
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device["verbose"] = False
    device["global_cmd_verify"] = False
    conn = ConnectHandler(**device)
    return conn
def net_connect_slog_wr(request):
    """
    Create the SSH connection to the remote device. Modify session_log init arguments.

    Return the netmiko connection object.
    """
    device_under_test = request.config.getoption("test_device")
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device["verbose"] = False
    # Overwrite default session_log location
    device["session_log"] = "SLOG/cisco881_slog_wr.log"
    device["session_log_record_writes"] = True
    conn = ConnectHandler(**device)
    return conn
def tcl_fixture(request):
    """
    Create an InLineTransfer object.

    Return a tuple (ssh_conn, tcl_handle)
    """
    # Create the files
    with open("test9.txt", "w") as f:
        # Not important what it is in the file
        f.write("no logging console\n")

    device_under_test = request.config.getoption("test_device")
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device["verbose"] = False
    ssh_conn = ConnectHandler(**device)

    dest_file_system = "flash:"
    source_file = "test9.txt"
    dest_file = "test9.txt"
    local_file = "testx.txt"
    direction = "put"

    tcl_transfer = InLineTransfer(
        ssh_conn,
        source_file=source_file,
        dest_file=dest_file,
        file_system=dest_file_system,
        direction=direction,
    )

    # Delete the test transfer files
    if tcl_transfer.check_file_exists():
        delete_file_ios(ssh_conn, dest_file_system, dest_file)
    if os.path.exists(local_file):
        os.remove(local_file)

    return (ssh_conn, tcl_transfer)
Example #28
0
def tcl_fixture(request):
    """
    Create an InLineTransfer object.

    Return a tuple (ssh_conn, tcl_handle)
    """
    # Create the files
    with open("test9.txt", "w") as f:
        # Not important what it is in the file
        f.write("no logging console\n")

    device_under_test = request.config.getoption("test_device")
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device["verbose"] = False
    ssh_conn = ConnectHandler(**device)

    dest_file_system = "flash:"
    source_file = "test9.txt"
    dest_file = "test9.txt"
    local_file = "testx.txt"
    direction = "put"

    tcl_transfer = InLineTransfer(
        ssh_conn,
        source_file=source_file,
        dest_file=dest_file,
        file_system=dest_file_system,
        direction=direction,
    )

    # Delete the test transfer files
    if tcl_transfer.check_file_exists():
        delete_file_ios(ssh_conn, dest_file_system, dest_file)
    if os.path.exists(local_file):
        os.remove(local_file)

    return (ssh_conn, tcl_transfer)
def scp_fixture_get(request):
    """
    Create an FileTransfer object (direction=get)

    Return a tuple (ssh_conn, scp_handle)
    """
    platform_args = get_platform_args()
    device_under_test = request.config.getoption("test_device")
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device["verbose"] = False
    ssh_conn = ConnectHandler(**device)

    platform = device["device_type"]
    dest_file_system = platform_args[platform]["file_system"]
    source_file = "test9.txt"
    local_file = "testx.txt"
    dest_file = local_file
    direction = "get"

    scp_transfer = FileTransfer(
        ssh_conn,
        source_file=source_file,
        dest_file=dest_file,
        file_system=dest_file_system,
        direction=direction,
    )
    scp_transfer.establish_scp_conn()

    # Make sure SCP is enabled
    if platform_args[platform]["enable_scp"]:
        scp_transfer.enable_scp()

    # Delete the test transfer files
    if os.path.exists(local_file):
        os.remove(local_file)
    return (ssh_conn, scp_transfer)
Example #30
0
def scp_fixture_get(request):
    """
    Create an FileTransfer object (direction=get)

    Return a tuple (ssh_conn, scp_handle)
    """
    platform_args = get_platform_args()
    device_under_test = request.config.getoption("test_device")
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device["verbose"] = False
    ssh_conn = ConnectHandler(**device)

    platform = device["device_type"]
    dest_file_system = platform_args[platform]["file_system"]
    source_file = "test9.txt"
    local_file = "testx.txt"
    dest_file = local_file
    direction = "get"

    scp_transfer = FileTransfer(
        ssh_conn,
        source_file=source_file,
        dest_file=dest_file,
        file_system=dest_file_system,
        direction=direction,
    )
    scp_transfer.establish_scp_conn()

    # Make sure SCP is enabled
    if platform_args[platform]["enable_scp"]:
        scp_transfer.enable_scp()

    # Delete the test transfer files
    if os.path.exists(local_file):
        os.remove(local_file)
    return (ssh_conn, scp_transfer)
Example #31
0
#!/usr/bin/env python
from os import path
from datetime import datetime
import pytest
from netmiko import ConnectHandler
from netmiko import NetmikoTimeoutException
from tests.test_utils import parse_yaml

PWD = path.dirname(path.realpath(__file__))
DEVICE_DICT = parse_yaml(PWD + "/etc/test_devices_exc.yml")


def test_valid_conn():
    """Verify device without modifications works."""
    device = DEVICE_DICT["cisco3_invalid"]
    conn = ConnectHandler(**device)
    assert conn.find_prompt() == "cisco3#"


def test_invalid_port():
    device = DEVICE_DICT["cisco3_invalid"]
    device["port"] = 8022
    with pytest.raises(NetmikoTimeoutException):
        ConnectHandler(**device)


def test_conn_timeout():
    device = DEVICE_DICT["cisco3_invalid"]
    device["conn_timeout"] = 5
    device["port"] = 8022
    start_time = datetime.now()
Example #32
0
def scp_file_transfer(request):
    """
    Testing file_transfer

    Return the netmiko connection object
    """
    platform_args = {
        'cisco_ios': {
            'file_system': 'flash:',
            'enable_scp': True,
            'delete_file': delete_file_ios,
        },
        'juniper_junos': {
            'file_system': '/var/tmp',
            'enable_scp': False,
            'delete_file': delete_file_generic,
        },
        'arista_eos': {
            'file_system': '/mnt/flash',
            'enable_scp': False,
            'delete_file': delete_file_generic,
        },
        'cisco_nxos': {
            'file_system': 'bootflash:',
            'enable_scp': False,
            'delete_file': delete_file_nxos,
        },
        'cisco_xr': {
            'file_system': 'disk0:',
            'enable_scp': False,
            # Delete pattern is the same on IOS-XR
            'delete_file': delete_file_ios,
        },
    }

    # Create the files
    with open("test9.txt", "w") as f:
        # Not important what it is in the file
        f.write("no logging console\n")

    with open("test2_src.txt", "w") as f:
        # Not important what it is in the file
        f.write("no logging console\n")
        f.write("logging buffered 10000\n")

    device_under_test = request.config.getoption('test_device')
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device['verbose'] = False
    ssh_conn = ConnectHandler(**device)

    platform = device['device_type']
    file_system = platform_args[platform]['file_system']
    source_file = 'test9.txt'
    dest_file = 'test9.txt'
    local_file = 'testx.txt'
    alt_file = 'test2.txt'
    direction = 'put'

    scp_transfer = FileTransfer(ssh_conn,
                                source_file=source_file,
                                dest_file=dest_file,
                                file_system=file_system,
                                direction=direction)
    scp_transfer.establish_scp_conn()

    # Delete the test transfer files
    if scp_transfer.check_file_exists():
        func = platform_args[platform]['delete_file']
        func(ssh_conn, file_system, dest_file)
    if os.path.exists(local_file):
        os.remove(local_file)
    if os.path.exists(alt_file):
        os.remove(alt_file)

    return (ssh_conn, file_system)
Example #33
0
def scp_fixture_get(request):
    """
    Create an FileTransfer object (direction=get)

    Return a tuple (ssh_conn, scp_handle)
    """
    platform_args = {
        'cisco_ios': {
            'file_system': 'flash:',
            'enable_scp': True,
            'delete_file': delete_file_ios,
        },
        'juniper_junos': {
            'file_system': '/var/tmp',
            'enable_scp': False,
            'delete_file': delete_file_generic,
        },
        'arista_eos': {
            'file_system': '/mnt/flash',
            'enable_scp': False,
            'delete_file': delete_file_generic,
        },
        'cisco_nxos': {
            'file_system': 'bootflash:',
            'enable_scp': False,
            'delete_file': delete_file_nxos,
        },
        'cisco_xr': {
            'file_system': 'disk0:',
            'enable_scp': False,
            # Delete pattern is the same on IOS-XR
            'delete_file': delete_file_ios,
        },
    }

    device_under_test = request.config.getoption('test_device')
    test_devices = parse_yaml(PWD + "/etc/test_devices.yml")
    device = test_devices[device_under_test]
    device['verbose'] = False
    ssh_conn = ConnectHandler(**device)

    platform = device['device_type']
    dest_file_system = platform_args[platform]['file_system']
    source_file = 'test9.txt'
    local_file = 'testx.txt'
    dest_file = local_file
    direction = 'get'

    scp_transfer = FileTransfer(ssh_conn,
                                source_file=source_file,
                                dest_file=dest_file,
                                file_system=dest_file_system,
                                direction=direction)
    scp_transfer.establish_scp_conn()

    # Make sure SCP is enabled
    if platform_args[platform]['enable_scp']:
        scp_transfer.enable_scp()

    # Delete the test transfer files
    if os.path.exists(local_file):
        os.remove(local_file)
    return (ssh_conn, scp_transfer)