Skip to content

Commit aac0ccc

Browse files
committed
Integrated Codel into DRR
1 parent 8fd4deb commit aac0ccc

File tree

4 files changed

+149
-144
lines changed

4 files changed

+149
-144
lines changed

bessctl/conf/testing/module_tests/drr.py

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,15 @@
3030

3131
import scapy.all as scapy
3232

33-
# ensures that given infinite input that the module does not crash.
33+
#ensures that given infinite input that the module does not crash.
34+
def crash_test(queue_type, queue_dict):
35+
if queue_type == 1:
36+
return [DRR(codel=queue_dict), 1, 1]
37+
else:
38+
return [DRR(queue=queue_dict), 1, 1]
3439

35-
36-
def crash_test():
37-
return [DRR(), 1, 1]
38-
39-
# tests to make that inividual packets gets through the module
40-
41-
42-
def basic_output_test():
40+
# tests to make that individual packets gets through the module
41+
def basic_output_test(queue_type, queue_dict):
4342

4443
# produces the number of duplicate packets specified by num_pkts and uses the provided
4544
# the specifications in the packet along with dummy ports.
@@ -50,16 +49,23 @@ def gen_packet_list(protocol, input_ip, output_ip, num_pkts):
5049
packet_list.append({'input_port': 0, 'input_packet': cur_pkt,
5150
'output_port': 0, "output_packet": cur_pkt})
5251
return packet_list
53-
54-
single_basic = DRR(num_flows=2, max_flow_queue_size=100)
52+
if queue_type== 1:
53+
single_basic = DRR(num_flows=2, max_flow_queue_size= 100, codel=queue_dict);
54+
else:
55+
single_basic = DRR(num_flows=2, max_flow_queue_size= 100, queue=queue_dict);
56+
5557
monitor_task(single_basic, 0)
5658

5759
out = []
5860
single_packet = gen_packet_list(scapy.TCP, '22.22.22.22', '22.22.22.22', 1)
5961
out.append([single_basic, # test this module
6062
1, 1, # it has one input port and one output port
6163
single_packet])
62-
batch_basic = DRR(num_flows=4, max_flow_queue_size=100)
64+
if queue_type== 1:
65+
batch_basic = DRR(num_flows=4, max_flow_queue_size= 100, codel=queue_dict);
66+
else:
67+
batch_basic = DRR(num_flows=4, max_flow_queue_size= 100, queue=queue_dict);
68+
6369
monitor_task(batch_basic, 0)
6470
packet_list = gen_packet_list(scapy.TCP, '22.22.22.1', '22.22.22.1', 2)
6571
packet_list += gen_packet_list(scapy.TCP, '22.22.11.1', '22.22.11.1', 2)
@@ -75,7 +81,7 @@ def fairness_test():
7581
# Takes the number of flows n, the quantum to give drr, the list packet rates for each flow
7682
# and the packet rate for the module. runs this setup for five seconds and tests that
7783
# throughput for each flow had a jaine fairness of atleast .95.
78-
def fairness_n_flow_test(n, quantum, rates, module_rate):
84+
def fairness_n_flow_test(n, quantum, rates, module_rate, queue_type, queue_dict):
7985
err = bess.reset_all()
8086

8187
packets = []
@@ -98,7 +104,11 @@ def fairness_n_flow_test(n, quantum, rates, module_rate):
98104

99105
me_out = Measure()
100106
snk = Sink()
101-
q = DRR(num_flows=n + 1, quantum=quantum)
107+
if queue_type == 1:
108+
q = DRR(num_flows= n+1, quantum=quantum, codel=queue_dict)
109+
else:
110+
q = DRR(num_flows= n+1, quantum=quantum, queue=queue_dict)
111+
102112
me_in -> q -> me_out -> exm
103113

104114
measure_out = []
@@ -127,16 +137,18 @@ def fairness_n_flow_test(n, quantum, rates, module_rate):
127137
if square_sum == 0:
128138
fair = 0
129139
else:
130-
fair = f(me_out) / square_sum
131-
assert abs(.99 - fair) <= .05
132-
133-
fairness_n_flow_test(2, 1000, [80000, 20000], 30000)
134-
fairness_n_flow_test(
135-
5, 1000, [110000, 200000, 70000, 60000, 40000], 150000)
136-
137-
ten_flows = [210000, 120000, 130000, 160000,
138-
100000, 105000, 90000, 70000, 60000, 40000]
139-
fairness_n_flow_test(10, 1000, ten_flows, 300000)
140+
fair = f(me_out)/square_sum
141+
assert abs(.99 - fair) <=.05
142+
llqueue_dict = {} # all default values
143+
codel_dict = {} # all default values
144+
fairness_n_flow_test(2, 1000, [80000, 20000], 30000, 0, llqueue_dict)
145+
fairness_n_flow_test(2, 1000, [80000, 20000], 30000, 1, codel_dict)
146+
fairness_n_flow_test(5, 1000, [110000, 200000, 70000, 60000, 40000], 150000, 0, llqueue_dict)
147+
fairness_n_flow_test(5, 1000, [110000, 200000, 70000, 60000, 40000], 150000, 1, codel_dict)
148+
149+
ten_flows = [210000, 120000, 130000, 160000, 100000, 105000, 90000, 70000, 60000, 40000]
150+
fairness_n_flow_test(10, 1000, ten_flows , 300000, 0, llqueue_dict)
151+
fairness_n_flow_test(10, 1000, ten_flows , 300000, 1, codel_dict)
140152

141153
# hund_flows= []
142154
# cur = 200000
@@ -145,6 +157,10 @@ def fairness_n_flow_test(n, quantum, rates, module_rate):
145157
# cur -= 1600
146158
# fairness_n_flow_test(100, 1000, hund_flows, 300000)
147159

148-
OUTPUT_TEST_INPUTS += basic_output_test()
160+
llqueue_dict = {} # all default values llqueue queue type: 0
161+
codel_dict = {} # all default values codel queue type: 1
162+
OUTPUT_TEST_INPUTS += basic_output_test(0, llqueue_dict)
163+
OUTPUT_TEST_INPUTS += basic_output_test(1, codel_dict)
149164
CUSTOM_TEST_FUNCTIONS.append(fairness_test)
150-
CRASH_TEST_INPUTS.append(crash_test())
165+
CRASH_TEST_INPUTS.append(crash_test(0, llqueue_dict))
166+
CRASH_TEST_INPUTS.append(crash_test(1, codel_dict))

0 commit comments

Comments
 (0)