Adapt BW limit tests to traffic shaping
With recent neutron changes, traffic shaping is applied when network type is either vlan or flat when BW limit is configured. BW limit tests have been adapted to the new algoritm to avoid dropping iperf control packets that make tests fail. Those packets could be dropped because shaper buffers drop packets when bitrate exceeds the configured BW limit. In order to avoid this: - Injected bitrate, which exceeds the configured BW limit, is limitted to 1.5 * bwlimit - iperf tests duration is limitted to 6 seconds (the shorted the iperf tests, the less likely shaper buffers get full) Change-Id: Icc1e1eb333a8844d7ddcf7a17ccc48886b3889e1
This commit is contained in:
parent
2ad8456264
commit
d43e56466a
@ -176,7 +176,8 @@ class QosBaseTest(test_qos.QoSTestMixin, base.TrafficFlowTest):
|
||||
raise ValueError('Unsupported protocol %s' % protocol)
|
||||
|
||||
def _test_egress_bw(
|
||||
self, ssh_client, ssh_server, server_ip, protocol, timeout=10):
|
||||
self, ssh_client, ssh_server, server_ip, protocol, maxbitrate,
|
||||
timeout=6):
|
||||
utils.kill_iperf_process(ssh_server)
|
||||
utils.kill_iperf_process(ssh_client)
|
||||
|
||||
@ -196,7 +197,7 @@ class QosBaseTest(test_qos.QoSTestMixin, base.TrafficFlowTest):
|
||||
port=self.IPERF_PORT,
|
||||
protocol_param=protocol_param,
|
||||
timeout=timeout,
|
||||
maxbitrate=self.MIN_KBPS_NO_BWLIMIT * 2000))
|
||||
maxbitrate=maxbitrate))
|
||||
LOG.debug('Run iperf3 command on client: %s', client_cmd)
|
||||
ssh_client.exec_command(client_cmd)
|
||||
time.sleep(0.1)
|
||||
@ -204,7 +205,8 @@ class QosBaseTest(test_qos.QoSTestMixin, base.TrafficFlowTest):
|
||||
ssh_server, iperf_server_filename))
|
||||
|
||||
def _test_ingress_bw(
|
||||
self, ssh_client, ssh_server, server_ip, protocol, timeout=10):
|
||||
self, ssh_client, ssh_server, server_ip, protocol, maxbitrate,
|
||||
timeout=6):
|
||||
utils.kill_iperf_process(ssh_server)
|
||||
utils.kill_iperf_process(ssh_client)
|
||||
|
||||
@ -220,7 +222,7 @@ class QosBaseTest(test_qos.QoSTestMixin, base.TrafficFlowTest):
|
||||
'-R -J > {output_file}'.format(
|
||||
server_ip=server_ip, port=self.IPERF_PORT,
|
||||
protocol_param=protocol_param, timeout=timeout,
|
||||
maxbitrate=self.MIN_KBPS_NO_BWLIMIT * 2000,
|
||||
maxbitrate=maxbitrate,
|
||||
output_file=iperf_client_filename))
|
||||
LOG.debug('Run iperf3 command on client: %s', client_cmd)
|
||||
ssh_client.exec_command(client_cmd)
|
||||
@ -229,6 +231,13 @@ class QosBaseTest(test_qos.QoSTestMixin, base.TrafficFlowTest):
|
||||
ssh_client, iperf_client_filename))
|
||||
|
||||
def _calculate_bw(self, perf_measures):
|
||||
# For rocky images, final interval is ignored
|
||||
# TODO(eolivare): provide link to iperf/rocky bug
|
||||
intervals_end = (len(perf_measures['intervals'])
|
||||
if self.username != "rocky"
|
||||
else len(perf_measures['intervals']) - 1)
|
||||
intervals = perf_measures['intervals'][:intervals_end]
|
||||
|
||||
# First 3 for ovs envs, 2 for ovn sriov envs and 1 for normal ovn
|
||||
# intervals are removed because BW measured during it is not
|
||||
# limited - it takes ~2-4 seconds to traffic shaping algorithm to apply
|
||||
@ -240,14 +249,8 @@ class QosBaseTest(test_qos.QoSTestMixin, base.TrafficFlowTest):
|
||||
intervals_start = 2
|
||||
else:
|
||||
intervals_start = 1
|
||||
|
||||
# For rocky images, final interval is ignored
|
||||
# TODO(eolivare): provide link to iperf/rocky bug
|
||||
intervals_end = (len(perf_measures['intervals'])
|
||||
if self.username != "rocky"
|
||||
else len(perf_measures['intervals']) - 1)
|
||||
|
||||
intervals = perf_measures['intervals'][intervals_start:intervals_end]
|
||||
if len(intervals) > intervals_start + 1:
|
||||
intervals = intervals[intervals_start:]
|
||||
|
||||
bits_received = sum([interval['sum']['bytes'] * 8
|
||||
for interval in intervals])
|
||||
@ -284,12 +287,20 @@ class QosBaseTest(test_qos.QoSTestMixin, base.TrafficFlowTest):
|
||||
test_bw_method = self._test_ingress_bw
|
||||
direction = 'ingress'
|
||||
|
||||
# NOTE: with traffic shaping, if the bitrate exceeds the BW limit, the
|
||||
# excees traffic is buffered and sent once the iperf3 client has ended
|
||||
# sending traffic, but this could lead to an iperf error:
|
||||
# "control socket has closed unexpectedly"
|
||||
# due to this we limit the bitrate to 1.5 * bw_limit
|
||||
maxbitrate = (bw_limit * 1.5 if bw_limit is not None
|
||||
else self.MIN_KBPS_NO_BWLIMIT * 2000)
|
||||
|
||||
# egress: send payload from client to server
|
||||
# ingress: download payload from server to client
|
||||
for server_ip in server_ips:
|
||||
perf_measures = test_bw_method(
|
||||
client['ssh_client'], server['ssh_client'],
|
||||
server_ip, protocol)
|
||||
server_ip, protocol, maxbitrate=maxbitrate)
|
||||
LOG.debug('perf_measures = %s', perf_measures)
|
||||
|
||||
# verify bw limit
|
||||
|
Loading…
x
Reference in New Issue
Block a user