Пример #1
0
def install_setup(request):
    lab = InstallVars.get_install_var("LAB")
    install_type = ProjVar.get_var('SYS_TYPE')
    if install_type != SysType.AIO_PLUS:
        skip(
            "The specified lab is not {} type. It is {} and use the appropriate test install script"
            .format(SysType.AIO_PLUS, install_type))

    hosts = vlm_helper.get_hostnames_from_consts(lab)
    lab["hosts"] = [h for h in hosts if 'storage' not in h]
    barcodes = vlm_helper.get_barcodes_from_hostnames(lab["hosts"])

    active_con = lab["controller-0"]

    LOG.tc_setup_start("{} install".format(install_type))

    LOG.fixture_step("Reserve hosts")
    hosts = lab["hosts"]
    LOG.info("Un-reserving {}".format(hosts))
    vlm_helper.force_unreserve_hosts(hosts)
    LOG.info("Reserving {}".format(hosts))
    for barcode in barcodes:
        vlm_helper._reserve_vlm_console(barcode, "AUTO: lab installation")

    unused_barcodes = vlm_helper.get_unused_barcodes(lab=lab)
    if len(unused_barcodes) > 0:
        vlm_helper.power_off_unused_nodes(unused_barcodes)

    LOG.fixture_step("Attempt to reset port on controller-0")
    fresh_install_helper.reset_controller_telnet_port(active_con)

    def install_cleanup():
        fresh_install_helper.install_teardown(lab, active_con)

    request.addfinalizer(install_cleanup)

    is_subcloud = InstallVars.get_install_var("INSTALL_SUBCLOUD") is not None

    _install_setup = fresh_install_helper.setup_fresh_install(
        lab, subcloud=is_subcloud)
    if InstallVars.get_install_var("RESUME"):
        try:
            if active_con.ssh_conn is None:
                active_con.ssh_conn = install_helper.establish_ssh_connection(
                    active_con.host_ip)
        except:
            pass

    return _install_setup
Пример #2
0
def install_setup(request):
    lab = InstallVars.get_install_var("LAB")
    install_type = ProjVar.get_var('SYS_TYPE')
    if install_type != SysType.AIO_DX:
        skip(
            "The specified lab is not {} type. It is {} and use the appropriate test install script"
            .format(SysType.AIO_DX, install_type))

    lab["hosts"] = vlm_helper.get_hostnames_from_consts(lab)
    barcodes = vlm_helper.get_barcodes_from_hostnames(lab["hosts"])

    active_con = lab["controller-0"]

    LOG.tc_setup_start("{} install".format(install_type))

    LOG.fixture_step("Reserve hosts")
    hosts = lab["hosts"]
    LOG.info("Un-reserving {}".format(hosts))
    vlm_helper.force_unreserve_hosts(hosts)
    LOG.info("Reserving {}".format(hosts))
    for barcode in barcodes:
        vlm_helper._reserve_vlm_console(barcode, "AUTO: lab installation")

    LOG.fixture_step("Attempt to reset port on controller-0")
    fresh_install_helper.reset_controller_telnet_port(active_con)

    def install_cleanup():
        fresh_install_helper.install_teardown(lab, active_con)

    request.addfinalizer(install_cleanup)

    is_subcloud = InstallVars.get_install_var("INSTALL_SUBCLOUD") is not None

    _install_setup = fresh_install_helper.setup_fresh_install(
        lab, subcloud=is_subcloud)
    resume_step = InstallVars.get_install_var("RESUME")
    if resume_step and resume_step not in \
            ["setup", "install_controller", "configure_controller", "download_lab_files"]:
        try:
            if active_con.ssh_conn is None:
                active_con.ssh_conn = install_helper.ssh_to_controller(
                    active_con.host_ip)
        except:
            pass

    return _install_setup
Пример #3
0
def testcase_log(msg, nodeid, separator=None, log_type=None):
    if separator is None:
        separator = '-----------'

    print_msg = separator + '\n' + msg
    logging_msg = '\n{}{} {}'.format(separator, msg, nodeid)
    if console_log:
        print(print_msg)
    if log_type == 'tc_res':
        global tc_end_time
        tc_end_time = strftime("%Y%m%d %H:%M:%S", gmtime())
        LOG.tc_result(msg=msg, tc_name=nodeid)
    elif log_type == 'tc_start':
        LOG.tc_func_start(nodeid)
    elif log_type == 'tc_setup':
        LOG.tc_setup_start(nodeid)
    elif log_type == 'tc_teardown':
        LOG.tc_teardown_start(nodeid)
    else:
        LOG.debug(logging_msg)
def install_setup(request):
    lab = InstallVars.get_install_var("LAB")
    subclouds = []
    dist_cloud = InstallVars.get_install_var("DISTRIBUTED_CLOUD")
    if not dist_cloud:
        pytest.skip(
            "The specified lab {} is not a distributed cloud system".format(
                lab['short_name']))

    subclouds.extend([k for k in lab if 'subcloud' in k])
    central_lab = lab['central_region']

    lab['central_region']['hosts'] = vlm_helper.get_hostnames_from_consts(
        central_lab)
    barcodes = vlm_helper.get_barcodes_from_hostnames(
        lab['central_region']["hosts"], lab=central_lab)

    for subcloud in subclouds:
        lab[subcloud]["hosts"] = vlm_helper.get_hostnames_from_consts(
            lab[subcloud])
        barcodes.extend(
            vlm_helper.get_barcodes_from_hostnames(lab[subcloud]["hosts"],
                                                   lab=lab[subcloud]))

    active_con = central_lab["controller-0"]
    install_type = ProjVar.get_var('SYS_TYPE')

    LOG.tc_setup_start("{} install".format(install_type))
    LOG.fixture_step("Reserve hosts")

    LOG.tc_setup_start("{} install".format(install_type))
    LOG.fixture_step("Reserve hosts")

    hosts = {'central_region': central_lab['hosts']}
    for subcloud in subclouds:
        hosts[subcloud] = lab[subcloud]["hosts"]

    LOG.info("Un-reserving {}".format(hosts))

    vlm_helper.force_unreserve_hosts(barcodes, val="barcodes")

    LOG.info("Reserving {}".format(hosts))
    for barcode in barcodes:
        vlm_helper._reserve_vlm_console(barcode, "AUTO: lab installation")

    LOG.fixture_step("Attempt to reset port on controller-0")
    fresh_install_helper.reset_controller_telnet_port(active_con)

    def install_cleanup():
        fresh_install_helper.install_teardown(lab, active_con, central_lab)

    request.addfinalizer(install_cleanup)

    _install_setup = fresh_install_helper.setup_fresh_install(lab, dist_cloud)
    resume_step = InstallVars.get_install_var("RESUME")
    if resume_step and resume_step not in \
            ["setup", "install_controller", "configure_controller", "download_lab_files"]:
        try:
            if active_con.ssh_conn is None:
                active_con.ssh_conn = install_helper.ssh_to_controller(
                    active_con.host_ip)
        except:
            pass

    return _install_setup