Hello,
I'm currently trying to make a controller aplication in POX that, after a
switch connects, floods the switch with stats_requests. My idea is just to
make it so it looks like a "Denial of Service".
I'm currently trying to use python's thread library, like the below:
"
for i in range(number_threads):
thread.start_new_thread( stress_function, (connection, i+1,
request_rate/number_threads) )
"
And every thread is trying to do something like the following, and this is
where I actually try to flood with stats_requests:
"
while(elapsed_time < test_duration):
time.sleep(time_step)
connection.send(of.ofp_stats_request(body=of.ofp_flow_stats_request()))
"
The problem is that I get the following error when running with multiple
threads:
"
Unhandled exception in thread started by <function stress_function at
0x20ccc80>
Traceback (most recent call last):
File "/root/pox/ext/dos_test.py", line 45, in stress_function
connection.send(of.ofp_stats_request(body=of.ofp_flow_stats_request()))
File "/root/pox/pox/openflow/of_01.py", line 687, in send
data = data.pack()
File "/root/pox/pox/openflow/libopenflow_01.py", line 2470, in pack
packed += ofp_header.pack(self)
File "/root/pox/pox/openflow/libopenflow_01.py", line 554, in pack
len(self), self.xid)
File "/root/pox/pox/openflow/libopenflow_01.py", line 537, in xid
self._xid = generate_xid()
ValueError: generator already executing
"
It seems that the concurrent stats_request callings is generating this
problem. Can anyone give me any advice on how to properly do this in an
effective way? I doesn't need to use POX itself, I just need to have
control over the request rate.
Thanks in advance!
Victor T.