Example #1
0
 def test_add_tc_qdisc_tbf(self):
     tc_lib.add_tc_qdisc('device', 'tbf', parent='root', max_kbps=10000,
                         burst_kb=1500, latency_ms=70, kernel_hz=250,
                         namespace=self.namespace)
     burst = tc_lib._get_tbf_burst_value(10000, 1500, 70) * 1024 / 8
     self.mock_add_tc_qdisc.assert_called_once_with(
         'device', parent=rtnl.TC_H_ROOT, kind='tbf', rate=10000 * 128,
         burst=burst, latency=70000, namespace=self.namespace)
Example #2
0
 def test_add_tc_qdisc_tbf(self):
     tc_lib.add_tc_qdisc('device', 'tbf', parent='root', max_kbps=10000,
                         burst_kb=1500, latency_ms=70, kernel_hz=250,
                         namespace=self.namespace)
     burst = tc_lib._get_tbf_burst_value(10000, 1500, 70) * 1024 / 8
     self.mock_add_tc_qdisc.assert_called_once_with(
         'device', parent=rtnl.TC_H_ROOT, kind='tbf', rate=10000 * 128,
         burst=burst, latency=70000, namespace=self.namespace)
Example #3
0
 def test__get_tbf_burst_value_when_burst_smaller_then_minimal(self):
     result = tc_lib._get_tbf_burst_value(BW_LIMIT, 0, KERNEL_HZ_VALUE)
     self.assertEqual(2, result)
Example #4
0
 def test__get_tbf_burst_value_when_burst_bigger_then_minimal(self):
     result = tc_lib._get_tbf_burst_value(BW_LIMIT, BURST, KERNEL_HZ_VALUE)
     self.assertEqual(BURST, result)
Example #5
0
 def test__get_tbf_burst_value_when_burst_smaller_then_minimal(self):
     result = tc_lib._get_tbf_burst_value(BW_LIMIT, 0, KERNEL_HZ_VALUE)
     self.assertEqual(2, result)
Example #6
0
 def test__get_tbf_burst_value_when_burst_bigger_then_minimal(self):
     result = tc_lib._get_tbf_burst_value(BW_LIMIT, BURST, KERNEL_HZ_VALUE)
     self.assertEqual(BURST, result)