I'm using code from GitHub for mitigation of DDoS attacks using reactive flow rules in Floodlight Controller. I can't run the program because the global variable attacked_switches
is not defined, but I don't know how to do that. Can anybody help me?
def start():
try:
number_of_switches, number_of_hosts = topology_info()
switch_dpids = list()
hosts = dict()
switch_dpids = switch_info(number_of_switches, switch_dpids)
hosts = host_info(number_of_hosts, hosts)
dpid = switch_byte(number_of_switches, switch_dpids)
print 'dpid= ', dpid
if dpid != 0:
print'calling flow pusher'
global attack
attack = True
attacked_switches.add(dpid)
T2 = threading.Thread(target=Flowpusher, args=[dpid])
T2.start()
elif attack:
T3 = threading.Thread(target=Flowremover, args=[dpid])
T3.start()
except Exception as e:
print'Error occured:', e