Exemplo n.º 1
0
    def test_dst_net_packet_duplicate(self, device_option, dst_host_option,
                                      transmitter, pingparser, option, value):
        if typepy.is_null_string(dst_host_option):
            pytest.skip("destination host is null")

        for tc_target in [device_option, "--device {}".format(device_option)]:
            execute_tcdel(tc_target)
            transmitter.destination_host = dst_host_option

            # w/o packet duplicate tc ---
            ping_result = transmitter.ping()
            assert ping_result.returncode == 0
            without_tc_duplicate_rate = pingparser.parse(
                ping_result).packet_duplicate_rate

            # w/ packet duplicate tc ---
            runner_helper(" ".join(
                [Tc.Command.TCSET, tc_target, "{:s} {}".format(option,
                                                               value)]))

            ping_result = transmitter.ping()
            assert ping_result.returncode == 0
            with_tc_duplicate_rate = pingparser.parse(
                ping_result).packet_duplicate_rate

            # assertion ---
            duplicate_rate_diff = with_tc_duplicate_rate - without_tc_duplicate_rate
            assert duplicate_rate_diff > (convert_rate_to_f(value) *
                                          ASSERT_MARGIN)

            # finalize ---
            execute_tcdel(tc_target)
Exemplo n.º 2
0
 def test_exception(self, value, expected):
     with pytest.raises(expected):
         convert_rate_to_f(value)
Exemplo n.º 3
0
 def test_normal(self, value, expected):
     assert convert_rate_to_f(value) == expected