Skip to content

Commit 3d87c6e

Browse files
committed
Integrated Codel into DRR
1 parent 866f141 commit 3d87c6e

File tree

4 files changed

+144
-133
lines changed

4 files changed

+144
-133
lines changed

bessctl/conf/testing/module_tests/drr.py

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import scapy.all as scapy
22

33
#ensures that given infinite input that the module does not crash.
4-
def crash_test():
5-
return [DRR(), 1, 1]
4+
def crash_test(queue_type, queue_dict):
5+
if queue_type == 1:
6+
return [DRR(codel=queue_dict), 1, 1]
7+
else:
8+
return [DRR(queue=queue_dict), 1, 1]
69

7-
# tests to make that inividual packets gets through the module
8-
def basic_output_test():
10+
# tests to make that individual packets gets through the module
11+
def basic_output_test(queue_type, queue_dict):
912

1013
# produces the number of duplicate packets specified by num_pkts and uses the provided
1114
# the specifications in the packet along with dummy ports.
@@ -16,16 +19,23 @@ def gen_packet_list(protocol, input_ip, output_ip, num_pkts):
1619
packet_list.append({'input_port': 0, 'input_packet': cur_pkt,
1720
'output_port': 0, "output_packet": cur_pkt})
1821
return packet_list
19-
20-
single_basic = DRR(num_flows=2, max_flow_queue_size=100)
22+
if queue_type== 1:
23+
single_basic = DRR(num_flows=2, max_flow_queue_size= 100, codel=queue_dict);
24+
else:
25+
single_basic = DRR(num_flows=2, max_flow_queue_size= 100, queue=queue_dict);
26+
2127
monitor_task(single_basic, 0)
2228

2329
out = []
2430
single_packet = gen_packet_list(scapy.TCP, '22.22.22.22', '22.22.22.22', 1)
2531
out.append([single_basic, # test this module
2632
1, 1, # it has one input port and one output port
2733
single_packet])
28-
batch_basic = DRR(num_flows=4, max_flow_queue_size=100)
34+
if queue_type== 1:
35+
batch_basic = DRR(num_flows=4, max_flow_queue_size= 100, codel=queue_dict);
36+
else:
37+
batch_basic = DRR(num_flows=4, max_flow_queue_size= 100, queue=queue_dict);
38+
2939
monitor_task(batch_basic, 0)
3040
packet_list = gen_packet_list(scapy.TCP, '22.22.22.1', '22.22.22.1', 2)
3141
packet_list += gen_packet_list(scapy.TCP, '22.22.11.1', '22.22.11.1', 2)
@@ -41,7 +51,7 @@ def fairness_test():
4151
# Takes the number of flows n, the quantum to give drr, the list packet rates for each flow
4252
# and the packet rate for the module. runs this setup for five seconds and tests that
4353
# throughput for each flow had a jaine fairness of atleast .95.
44-
def fairness_n_flow_test(n, quantum, rates, module_rate):
54+
def fairness_n_flow_test(n, quantum, rates, module_rate, queue_type, queue_dict):
4555
err = bess.reset_all()
4656

4757
packets = []
@@ -62,7 +72,11 @@ def fairness_n_flow_test(n, quantum, rates, module_rate):
6272

6373
me_out = Measure()
6474
snk = Sink()
65-
q = DRR(num_flows= n+1, quantum=quantum)
75+
if queue_type == 1:
76+
q = DRR(num_flows= n+1, quantum=quantum, codel=queue_dict)
77+
else:
78+
q = DRR(num_flows= n+1, quantum=quantum, queue=queue_dict)
79+
6680
me_in -> q -> me_out -> exm
6781

6882
measure_out = []
@@ -93,12 +107,16 @@ def fairness_n_flow_test(n, quantum, rates, module_rate):
93107
else:
94108
fair = f(me_out)/square_sum
95109
assert abs(.99 - fair) <=.05
96-
97-
fairness_n_flow_test(2, 1000, [80000, 20000], 30000)
98-
fairness_n_flow_test(5, 1000, [110000, 200000, 70000, 60000, 40000], 150000)
110+
llqueue_dict = {} # all default values
111+
codel_dict = {} # all default values
112+
fairness_n_flow_test(2, 1000, [80000, 20000], 30000, 0, llqueue_dict)
113+
fairness_n_flow_test(2, 1000, [80000, 20000], 30000, 1, codel_dict)
114+
fairness_n_flow_test(5, 1000, [110000, 200000, 70000, 60000, 40000], 150000, 0, llqueue_dict)
115+
fairness_n_flow_test(5, 1000, [110000, 200000, 70000, 60000, 40000], 150000, 1, codel_dict)
99116

100117
ten_flows = [210000, 120000, 130000, 160000, 100000, 105000, 90000, 70000, 60000, 40000]
101-
fairness_n_flow_test(10, 1000, ten_flows , 300000)
118+
fairness_n_flow_test(10, 1000, ten_flows , 300000, 0, llqueue_dict)
119+
fairness_n_flow_test(10, 1000, ten_flows , 300000, 1, codel_dict)
102120

103121
# hund_flows= []
104122
# cur = 200000
@@ -107,6 +125,10 @@ def fairness_n_flow_test(n, quantum, rates, module_rate):
107125
# cur -= 1600
108126
# fairness_n_flow_test(100, 1000, hund_flows, 300000)
109127

110-
OUTPUT_TEST_INPUTS += basic_output_test()
128+
llqueue_dict = {} # all default values llqueue queue type: 0
129+
codel_dict = {} # all default values codel queue type: 1
130+
OUTPUT_TEST_INPUTS += basic_output_test(0, llqueue_dict)
131+
OUTPUT_TEST_INPUTS += basic_output_test(1, codel_dict)
111132
CUSTOM_TEST_FUNCTIONS.append(fairness_test)
112-
CRASH_TEST_INPUTS.append(crash_test())
133+
CRASH_TEST_INPUTS.append(crash_test(0, llqueue_dict))
134+
CRASH_TEST_INPUTS.append(crash_test(1, codel_dict))

0 commit comments

Comments
 (0)