Exemple #1
0
def test_wifi_throughput_vs_rssi(env, extra_data):
    """
    steps: |
      1. build with best performance config
      2. switch on one router
      3. set attenuator value from 0-60 for each router
      4. test TCP tx rx and UDP tx rx throughput
    """
    att_port = env.get_variable("attenuator_port")
    ap_list = env.get_variable("ap_list")
    pc_nic_ip = env.get_pc_nic_info("pc_nic", "ipv4")["addr"]
    apc_ip = env.get_variable("apc_ip")
    pc_iperf_log_file = os.path.join(env.log_path, "pc_iperf_log.md")

    test_result = {
        "tcp_tx": TestResult("tcp", "tx", BEST_PERFORMANCE_CONFIG),
        "tcp_rx": TestResult("tcp", "rx", BEST_PERFORMANCE_CONFIG),
        "udp_tx": TestResult("udp", "tx", BEST_PERFORMANCE_CONFIG),
        "udp_rx": TestResult("udp", "rx", BEST_PERFORMANCE_CONFIG),
    }

    # 1. get DUT and download
    dut = env.get_dut("iperf",
                      "examples/wifi/iperf",
                      dut_class=ttfw_idf.ESP32DUT,
                      app_config_name=BEST_PERFORMANCE_CONFIG)
    dut.start_app()
    dut.expect("esp32>")

    # 2. run test for each required att value
    for ap_info in ap_list:
        test_utility = IperfTestUtility(dut, BEST_PERFORMANCE_CONFIG,
                                        ap_info["ssid"], ap_info["password"],
                                        pc_nic_ip, pc_iperf_log_file,
                                        test_result)

        PowerControl.Control.control_rest(apc_ip, ap_info["outlet"], "OFF")
        PowerControl.Control.control(apc_ip, {ap_info["outlet"]: "ON"})
        Attenuator.set_att(att_port, 0)

        if not test_utility.wait_ap_power_on():
            Utility.console_log(
                "[{}] failed to power on, skip testing this AP".format(
                    ap_info["ssid"]),
                color="red")
            continue

        for atten_val in ATTEN_VALUE_LIST:
            assert Attenuator.set_att(att_port, atten_val) is True
            test_utility.run_all_cases(atten_val)

    # 3. check test results
    env.close_dut("iperf")

    # 4. generate report
    report = TestReport.ThroughputVsRssiReport(
        os.path.join(env.log_path, "ThroughputVsRssiReport"), test_result)
    report.generate_report()
Exemple #2
0
def test_wifi_throughput_vs_rssi(env, extra_data):
    """
    steps: |
      1. build with best performance config
      2. switch on one router
      3. set attenuator value from 0-60 for each router
      4. test TCP tx rx and UDP tx rx throughput
    """
    att_port = env.get_variable('attenuator_port')
    ap_list = env.get_variable('ap_list')
    pc_nic_ip = env.get_pc_nic_info('pc_nic', 'ipv4')['addr']
    apc_ip = env.get_variable('apc_ip')
    pc_iperf_log_file = os.path.join(env.log_path, 'pc_iperf_log.md')

    test_result = {
        'tcp_tx': TestResult('tcp', 'tx', BEST_PERFORMANCE_CONFIG),
        'tcp_rx': TestResult('tcp', 'rx', BEST_PERFORMANCE_CONFIG),
        'udp_tx': TestResult('udp', 'tx', BEST_PERFORMANCE_CONFIG),
        'udp_rx': TestResult('udp', 'rx', BEST_PERFORMANCE_CONFIG),
    }

    # 1. get DUT and download
    dut = env.get_dut('iperf',
                      'examples/wifi/iperf',
                      dut_class=ttfw_idf.ESP32DUT,
                      app_config_name=BEST_PERFORMANCE_CONFIG)
    dut.start_app()
    dut.expect_any('iperf>', 'esp32>')

    # 2. run test for each required att value
    for ap_info in ap_list:
        test_utility = IperfTestUtility(dut, BEST_PERFORMANCE_CONFIG,
                                        ap_info['ssid'], ap_info['password'],
                                        pc_nic_ip, pc_iperf_log_file,
                                        test_result)

        PowerControl.Control.control_rest(apc_ip, ap_info['outlet'], 'OFF')
        PowerControl.Control.control(apc_ip, {ap_info['outlet']: 'ON'})
        Attenuator.set_att(att_port, 0)

        if not test_utility.wait_ap_power_on():
            Utility.console_log(
                '[{}] failed to power on, skip testing this AP'.format(
                    ap_info['ssid']),
                color='red')
            continue

        for atten_val in ATTEN_VALUE_LIST:
            assert Attenuator.set_att(att_port, atten_val) is True
            test_utility.run_all_cases(atten_val)

    # 3. check test results
    env.close_dut('iperf')

    # 4. generate report
    report = TestReport.ThroughputVsRssiReport(
        os.path.join(env.log_path, 'STAThroughputVsRssiReport'), test_result)
    report.generate_report()
Exemple #3
0
def test_softap_throughput_vs_rssi(env, extra_data):
    """
    steps: |
      1. build with best performance config
      2. switch on one router
      3. set attenuator value from 0-60 for each router
      4. test TCP tx rx and UDP tx rx throughput
    """
    att_port = env.get_variable('attenuator_port')

    test_result = {
        'tcp_tx': IperfUtility.TestResult('tcp', 'tx',
                                          BEST_PERFORMANCE_CONFIG),
        'tcp_rx': IperfUtility.TestResult('tcp', 'rx',
                                          BEST_PERFORMANCE_CONFIG),
        'udp_tx': IperfUtility.TestResult('udp', 'tx',
                                          BEST_PERFORMANCE_CONFIG),
        'udp_rx': IperfUtility.TestResult('udp', 'rx',
                                          BEST_PERFORMANCE_CONFIG),
    }

    # 1. get DUT and download
    softap_dut = env.get_dut('softap_iperf', 'examples/wifi/iperf')
    softap_dut.start_app()
    softap_dut.expect_any('iperf>', 'esp32>')

    sta_dut = env.get_dut('sta_iperf',
                          'examples/wifi/iperf',
                          app_config_name=BEST_PERFORMANCE_CONFIG)
    sta_dut.start_app()
    sta_dut.expect_any('iperf>', 'esp32>')

    # 2. run test for each required att value
    test_utility = IperfTestUtilitySoftap(sta_dut, softap_dut,
                                          BEST_PERFORMANCE_CONFIG, test_result)

    Attenuator.set_att(att_port, 0)

    for atten_val in ATTEN_VALUE_LIST:
        assert Attenuator.set_att(att_port, atten_val) is True
        try:
            test_utility.run_all_cases(atten_val, NO_BANDWIDTH_LIMIT)
        except AssertionError:
            break

    env.close_dut('softap_iperf')
    env.close_dut('sta_iperf')

    # 3. generate report
    report = TestReport.ThroughputVsRssiReport(
        os.path.join(env.log_path, 'Performance',
                     'SoftAPThroughputVsRssiReport'), test_result)
    report.generate_report()
def test_softap_throughput_vs_rssi(env, extra_data):
    """
    steps: |
      1. build with best performance config
      2. switch on one router
      3. set attenuator value from 0-60 for each router
      4. test TCP tx rx and UDP tx rx throughput
    """
    att_port = env.get_variable("attenuator_port")

    test_result = {
        "tcp_tx": TestResult("tcp", "tx", BEST_PERFORMANCE_CONFIG),
        "tcp_rx": TestResult("tcp", "rx", BEST_PERFORMANCE_CONFIG),
        "udp_tx": TestResult("udp", "tx", BEST_PERFORMANCE_CONFIG),
        "udp_rx": TestResult("udp", "rx", BEST_PERFORMANCE_CONFIG),
    }

    # 1. get DUT and download
    softap_dut = env.get_dut("softap_iperf", "examples/wifi/iperf", dut_class=ttfw_idf.ESP32DUT,
                             app_config_name=BEST_PERFORMANCE_CONFIG)
    softap_dut.start_app()
    softap_dut.expect_any("iperf>", "esp32>")

    sta_dut = env.get_dut("sta_iperf", "examples/wifi/iperf", dut_class=ttfw_idf.ESP32DUT,
                          app_config_name=BEST_PERFORMANCE_CONFIG)
    sta_dut.start_app()
    sta_dut.expect_any("iperf>", "esp32>")

    # 2. run test for each required att value
    test_utility = IperfTestUtilitySoftap(sta_dut, softap_dut, BEST_PERFORMANCE_CONFIG, test_result)

    Attenuator.set_att(att_port, 0)

    for atten_val in ATTEN_VALUE_LIST:
        assert Attenuator.set_att(att_port, atten_val) is True
        test_utility.run_all_cases(atten_val)

    env.close_dut("softap_iperf")
    env.close_dut("sta_iperf")

    # 3. generate report
    report = TestReport.ThroughputVsRssiReport(os.path.join(env.log_path, "SoftAPThroughputVsRssiReport"),
                                               test_result)
    report.generate_report()