Beispiel #1
0
def setup_test_session(global_setup):
    """
    Setup primary tenant and Nax Box ssh before the first test gets executed.
    STX ssh was already set up at collecting phase.
    """
    LOG.fixture_step("(session) Setting up test session...")
    setups.setup_primary_tenant(ProjVar.get_var('PRIMARY_TENANT'))

    global con_ssh
    if not con_ssh:
        con_ssh = ControllerClient.get_active_controller()
    # set build id to be used to upload/write test results
    setups.set_build_info(con_ssh)

    # Ensure tis and natbox (if applicable) ssh are connected
    con_ssh.connect(retry=True, retry_interval=3, retry_timeout=300)

    # set up natbox connection and copy keyfile
    natbox_dict = ProjVar.get_var('NATBOX')
    global natbox_ssh
    natbox_ssh = setups.setup_natbox_ssh(natbox_dict, con_ssh=con_ssh)

    # set global var for sys_type
    setups.set_sys_type(con_ssh=con_ssh)

    # rsync files between controllers
    setups.copy_test_files()
Beispiel #2
0
def setup_test_session():
    """
    Setup primary tenant and Nax Box ssh before the first test gets executed.
    TIS ssh was already set up at collecting phase
    Args:

    Returns:

    """
    patch_dir = PatchingVars.get_patching_var('PATCH_DIR')
    if not patch_dir:
        patch_base_dir = PatchingVars.get_patching_var('PATCH_BASE_DIR')
        build_id = system_helper.get_build_info()['BUILD_ID']
        if build_id:
            patch_dir = patch_base_dir + '/' + build_id
        else:
            patch_dir = patch_base_dir + '/latest_build'

        PatchingVars.set_patching_var(PATCH_DIR=patch_dir)

    ProjVar.set_var(SOURCE_OPENRC=True)
    setups.copy_test_files()

    global natbox_client
    natbox_client = setups.setup_natbox_ssh(ProjVar.get_var('NATBOX'), con_ssh=con_ssh)

    # set build id to be used to upload/write test results
    setups.set_build_info(con_ssh)
    setups.set_session(con_ssh=con_ssh)
Beispiel #3
0
    def set_build_vars():
        try:
            setups.copy_test_files()

            # set build id to be used to upload/write test results
            setups.set_build_info(con_ssh)
        except:
            LOG.warning('Unable to set BUILD info')
            pass
Beispiel #4
0
def setup_test_session(global_setup):
    """
    Setup primary tenant  before the first test gets executed.
    TIS ssh was already set up at collecting phase.
    """

    ProjVar.set_var(PRIMARY_TENANT=Tenant.get('admin'))
    ProjVar.set_var(SOURCE_OPENRC=True)
    setups.setup_primary_tenant(ProjVar.get_var('PRIMARY_TENANT'))
    setups.copy_test_files()

    # set build id to be used to upload/write test results
    setups.set_build_info(con_ssh)
    setups.set_session(con_ssh=con_ssh)
Beispiel #5
0
def setup_test_session(global_setup):
    """
    Setup primary tenant and Nax Box ssh before the first test gets executed.
    TIS ssh was already set up at collecting phase.
    """
    ProjVar.set_var(SOURCE_OPENRC=True)
    setups.copy_test_files()

    global natbox_ssh
    natbox = ProjVar.get_var('NATBOX')
    natbox_ssh = setups.setup_natbox_ssh(natbox)

    # set build id to be used to upload/write test results
    setups.set_build_info(con_ssh)
    setups.set_session(con_ssh=con_ssh)
Beispiel #6
0
def setup_test_session(global_setup, request):
    """
    Setup primary tenant and Nax Box ssh before the first test gets executed.
    TIS ssh was already set up at collecting phase.
    """
    LOG.fixture_step("(session) Setting up test session...")
    setups.setup_primary_tenant(ProjVar.get_var('PRIMARY_TENANT'))

    global con_ssh
    if not con_ssh:
        con_ssh = ControllerClient.get_active_controller()
    # set build id to be used to upload/write test results
    setups.set_build_info(con_ssh)

    # Set global vars
    setups.set_session(con_ssh=con_ssh)

    # Ensure tis and natbox (if applicable) ssh are connected
    con_ssh.connect(retry=True, retry_interval=3, retry_timeout=300)

    # set up natbox connection and copy keyfile
    natbox_dict = ProjVar.get_var('NATBOX')
    global natbox_ssh
    try:
        natbox_ssh = setups.setup_natbox_ssh(natbox_dict, con_ssh=con_ssh)
    except:
        if ProjVar.get_var('COLLECT_SYS_NET_INFO'):
            setups.collect_sys_net_info(lab=ProjVar.get_var('LAB'))
        raise

    # Enable keystone debug
    if ProjVar.get_var('KEYSTONE_DEBUG'):
        setups.enable_disable_keystone_debug(enable=True, con_ssh=con_ssh)

    # collect telnet logs for all hosts
    if ProjVar.get_var('COLLECT_TELNET'):
        end_event = Event()
        threads = setups.collect_telnet_logs_for_nodes(end_event=end_event)
        ProjVar.set_var(TELNET_THREADS=(threads, end_event))

    # set global var for sys_type
    setups.set_sys_type(con_ssh=con_ssh)

    # rsync files between controllers
    setups.copy_test_files()

    # set up remote cli clients
    client = con_ssh
    if ProjVar.get_var('REMOTE_CLI'):
        LOG.fixture_step("(session) Install remote cli clients in virtualenv")
        client = setups.setup_remote_cli_client()
        ProjVar.set_var(USER_FILE_DIR=ProjVar.get_var('TEMP_DIR'))

        def remove_remote_cli():
            LOG.fixture_step("(session) Remove remote cli clients")
            client.exec_cmd('rm -rf {}/*'.format(ProjVar.get_var('TEMP_DIR')))
            client.close()
            from utils.clients.local import RemoteCLIClient
            RemoteCLIClient.remove_remote_cli_clients()
            ProjVar.set_var(REMOTE_CLI=None)
            ProjVar.set_var(USER_FILE_DIR=HostLinuxUser.get_home())
        request.addfinalizer(remove_remote_cli)