示例#1
0
def copy_hosts_file():
    LOG.info("Begin copying hosts file to Bottlenecks-Yardstick")
    os.system('cp /etc/hosts /tmp/hosts')
    yardstick_docker = docker_env.docker_find('Bottlenecks-Yardstick')
    cp_cmd = 'sudo cp -f /tmp/hosts /etc/hosts'
    docker_env.docker_exec_cmd(yardstick_docker, cp_cmd)
    LOG.info("Done with copying hosts file to Bottlenecks-Yardstick")
def do_test(con_dic):
    out_file = ("/tmp/yardstick_" + str(uuid.uuid4()) + ".out")
    parameter_info = dict(test_time=con_dic["scenarios"]["vim_pair_ttl"])
    yardstick_container = docker_env.yardstick_info['container']
    cmd = runner_yardstick.yardstick_command_parser(debug=runner_DEBUG,
                                                    cidr=cidr,
                                                    outfile=out_file,
                                                    parameter=parameter_info)
    stdout = docker_env.docker_exec_cmd(yardstick_container, cmd)
    LOG.info(stdout)
    out_value = 0
    loop_value = 0
    while loop_value < 60:
        time.sleep(2)
        loop_value = loop_value + 1
        with open(out_file) as f:
            data = json.load(f)
            if data["result"]["criteria"] == "PASS":
                LOG.info("Success run yardstick netperf_soak test!")
                out_value = 1
                break
            elif data["result"]["criteria"] == "FAIL":
                LOG.error("Failed run yardstick netperf_soak test!")
                out_value = 0
                break
    q.put((out_value, data["result"]["testcases"]))
    return out_value
示例#3
0
def do_test():
    func_name = sys._getframe().f_code.co_name
    out_file = ("/tmp/yardstick_" + str(uuid.uuid4()) + ".out")
    yardstick_container = docker_env.yardstick_info['container']
    cmd = ('yardstick task start /home/opnfv/repos/yardstick/'
           'samples/ping_bottlenecks.yaml --output-file ' + out_file)
    stdout = docker_env.docker_exec_cmd(yardstick_container, cmd)
    LOG.info(stdout)
    out_value = 0
    loop_value = 0
    while loop_value < 60:
        time.sleep(2)
        loop_value = loop_value + 1
        with open(out_file) as f:
            data = json.load(f)
            if data["status"] == 1:
                LOG.info("yardstick run success")
                out_value = 1
                break
            elif data["status"] == 2:
                LOG.error("yardstick error exit")
                out_value = 0
                break
    q.put((out_value, func_name))
    return out_value
def do_test(runner_conf, test_config, Use_Dashboard, context_conf):
    yardstick_container = docker_env.yardstick_info['container']
    out_file = ("/tmp/yardstick_" + str(uuid.uuid4()) + ".out")
    cmd = testcase_parser(runner_conf, out_file=out_file, **test_config)
    print(cmd)
    stdout = docker_env.docker_exec_cmd(yardstick_container, cmd)
    LOG.info(stdout)
    loop_value = 0
    while loop_value < 60:
        time.sleep(2)
        loop_value = loop_value + 1
        with open(out_file) as f:
            data = json.load(f)
            if data["status"] == 1:
                LOG.info("yardstick run success")
                break
            elif data["status"] == 2:
                LOG.error("yardstick error exit")
                exit()

    save_data = config_to_result(test_config, data)
    if Use_Dashboard is True:
        print("use dashboard")
        DashBoard.dashboard_send_data(context_conf, save_data)
    return save_data
示例#5
0
def do_test():
    func_name = sys._getframe().f_code.co_name
    out_file = ("/tmp/yardstick_" + str(uuid.uuid4()) + ".out")
    parameter_info = {}
    yardstick_container = docker_env.yardstick_info['container']
    cmd = runner_yardstick.yardstick_command_parser(debug=runner_DEBUG,
                                                    cidr=cidr,
                                                    outfile=out_file,
                                                    parameter=parameter_info)
    stdout = docker_env.docker_exec_cmd(yardstick_container, cmd)
    LOG.info(stdout)
    out_value = 0
    loop_value = 0
    while loop_value < 60:
        time.sleep(2)
        loop_value = loop_value + 1
        with open(out_file) as f:
            data = json.load(f)
            if data["result"]["criteria"] == "PASS":
                LOG.info("yardstick run success")
                out_value = 1
                break
            else:
                LOG.error("yardstick error exit")
                out_value = 0
                break
    q.put((out_value, func_name))
    return out_value
示例#6
0
def do_test(runner_conf, test_config, Use_Dashboard, context_conf):
    yardstick_container = docker_env.yardstick_info['container']
    out_file = ("/tmp/yardstick_" + str(uuid.uuid4()) + ".out")
    cmd = testcase_parser(runner_conf, out_file=out_file, **test_config)
    print(cmd)
    stdout = docker_env.docker_exec_cmd(yardstick_container, cmd)
    LOG.info(stdout)
    switch.value += 1
    save_date = []
    return save_date
示例#7
0
def env_pre(test_config):
    test_yardstick = False
    if "yardstick" in test_config["contexts"].keys():
        test_yardstick = True
    stack_prepare._prepare_env_daemon(test_yardstick)
    quota_prepare.quota_env_prepare()
    cmd = ('yardstick env prepare')
    LOG.info("yardstick environment prepare!")
    if (test_config["contexts"]['yardstick_envpre']):
        yardstick_container = docker_env.yardstick_info['container']
        stdout = docker_env.docker_exec_cmd(yardstick_container, cmd)
        LOG.debug(stdout)
示例#8
0
def _prepare_env_daemon(test_yardstick):

    rc_file = config.bottlenecks_config["rc_dir"]

    if not os.path.exists(rc_file):
        installer_ip = os.environ.get('INSTALLER_IP', 'undefined')
        installer_type = os.environ.get('INSTALLER_TYPE', 'undefined')
        _get_remote_rc_file(rc_file, installer_ip, installer_type)

    _source_file(rc_file)

    if not os.environ.get("EXTERNAL_NETWORK"):
        _append_external_network(rc_file)
    if test_yardstick:
        yardstick_contain = docker_env.yardstick_info["container"]
        cmd = "cp %s %s" % (rc_file,
                            config.bottlenecks_config["yardstick_rc_dir"])
        docker_env.docker_exec_cmd(yardstick_contain, cmd)
        file_orig = ("/home/opnfv/repos/yardstick/etc"
                     "/yardstick/yardstick.conf.sample")
        file_after = "/etc/yardstick/yardstick.conf"
        cmd = "cp %s %s" % (file_orig, file_after)
        docker_env.docker_exec_cmd(yardstick_contain, cmd)
        cmd = "sed -i '12s/http/file/g' /etc/yardstick/yardstick.conf"
        docker_env.docker_exec_cmd(yardstick_contain, cmd)

    # update the external_network
    _source_file(rc_file)
示例#9
0
def _prepare_env_daemon(test_yardstick):

    rc_file = config.bottlenecks_config["rc_dir"]

    if not os.path.exists(rc_file):
        installer_ip = os.environ.get('INSTALLER_IP', 'undefined')
        installer_type = os.environ.get('INSTALLER_TYPE', 'undefined')
        _get_remote_rc_file(rc_file, installer_ip, installer_type)

    _source_file(rc_file)

    if not os.environ.get("EXTERNAL_NETWORK"):
        _append_external_network(rc_file)
    if test_yardstick:
        yardstick_contain = docker_env.yardstick_info["container"]
        cmd = "cp %s %s" % (rc_file,
                            config.bottlenecks_config["yardstick_rc_dir"])
        docker_env.docker_exec_cmd(yardstick_contain,
                                   cmd)

    # update the external_network
    _source_file(rc_file)
示例#10
0
def do_test(test_config):
    out_file = ("/tmp/yardstick_" + str(uuid.uuid4()) + ".out")
    yardstick_container = docker_env.yardstick_info['container']
    cmd = testcase_parser(out_file=out_file, **test_config)
    print(cmd)
    stdout = docker_env.docker_exec_cmd(yardstick_container, cmd)
    LOG.info(stdout)
    loop_value = 0
    while loop_value < 60:
        time.sleep(2)
        loop_value = loop_value + 1
        with open(out_file) as f:
            data = json.load(f)
            if data["result"]["criteria"] == "PASS":
                LOG.info("yardstick run success")
                LOG.info("%s" % data["result"]["testcases"])
                break
            else:
                LOG.error("yardstick error exit")
                break

    save_data = final_config_to_result(test_config, data)
    return save_data
示例#11
0
def do_test(test_config, Use_Dashboard, context_conf):
    yardstick_container = docker_env.yardstick_info['container']
    out_file = ("/tmp/yardstick_" + str(uuid.uuid4()) + ".out")
    cmd = testcase_parser(out_file=out_file, **test_config)
    stdout = docker_env.docker_exec_cmd(yardstick_container, cmd)
    LOG.info(stdout)
    loop_value = 0
    while loop_value < 60:
        time.sleep(2)
        loop_value = loop_value + 1
        with open(out_file) as f:
            data = json.load(f)
            if data["status"] == 1:
                LOG.info("Success run yardstick netperf_bottlenecks test!")
                break
            elif data["status"] == 2:
                LOG.error("Failed to run yardstick netperf_bottlenecks test!")
                exit()

    save_data = config_to_result(test_config, data['result'][1])
    if Use_Dashboard is True:
        DashBoard.dashboard_send_data(context_conf, save_data)

    return save_data["data_body"]