byte_total = sum([int(size) * weight
for size, weight in imix_dip.items()])
- return {size: (int(size) * weight) / byte_total
+ return {size: (int(size) * weight * 100) / byte_total
for size, weight in imix_dip.items()}
def _create_vm(self, packet_definition):
data = {'64B': 25, '128B': 25, '512B': 25, '1518B': 25}
byte_total = 64 * 25 + 128 * 25 + 512 * 25 + 1518 * 25
self.assertEqual(
- {'64': 64 * 25.0 / byte_total, '128': 128 * 25.0 / byte_total,
- '512': 512 * 25.0 / byte_total, '1518': 1518 * 25.0 / byte_total},
+ {'64': 64 * 25.0 * 100 / byte_total,
+ '128': 128 * 25.0 * 100 / byte_total,
+ '512': 512 * 25.0 * 100 / byte_total,
+ '1518': 1518 * 25.0 * 100/ byte_total},
rfc2544_profile._create_imix_data(
data, weight_mode=constants.DISTRIBUTION_IN_PACKETS))
data = {}
{},
rfc2544_profile._create_imix_data(
data, weight_mode=constants.DISTRIBUTION_IN_PACKETS))
+ data = {'64B': 100}
+ self.assertEqual(
+ {'64': 100.0},
+ rfc2544_profile._create_imix_data(
+ data, weight_mode=constants.DISTRIBUTION_IN_PACKETS))
def test__create_vm(self):
packet = {'outer_l2': 'l2_definition'}