Commit 6a79de67 by Bach Dániel

firewall: add openvswitch support

parent 95ef0c6d
...@@ -436,3 +436,11 @@ def dhcp(): ...@@ -436,3 +436,11 @@ def dhcp():
}) })
return DHCP return DHCP
def vlan():
obj = models.Vlan.objects.values('vid', 'name', 'network4', 'network6')
return {x['name']: {'tag': x['vid'],
'addresses': [str(x['network4']),
str(x['network6'])]}
for x in obj}
...@@ -29,6 +29,12 @@ def periodic_task(): ...@@ -29,6 +29,12 @@ def periodic_task():
queue='firewall') queue='firewall')
print "firewall ujratoltese kesz" print "firewall ujratoltese kesz"
if cache.get('firewall_vlan_lock'):
cache.delete("firewall_vlan_lock")
remote_tasks.reload_firewall_vlan.apply_async(args=[vlan()],
queue='firewall')
print "firewall_vlan ujratoltese kesz"
if cache.get('blacklist_lock'): if cache.get('blacklist_lock'):
cache.delete("blacklist_lock") cache.delete("blacklist_lock")
remote_tasks.reload_blacklist.apply_async(args=[list(ipset())], remote_tasks.reload_blacklist.apply_async(args=[list(ipset())],
...@@ -50,4 +56,7 @@ def reloadtask(type='Host'): ...@@ -50,4 +56,7 @@ def reloadtask(type='Host'):
if type == "Blacklist": if type == "Blacklist":
cache.add("blacklist_lock", "true", 30) cache.add("blacklist_lock", "true", 30)
if type == "Vlan":
cache.add("firewall_vlan_lock", "true", 30)
print type print type
...@@ -11,6 +11,11 @@ def reload_firewall(data4, data6): ...@@ -11,6 +11,11 @@ def reload_firewall(data4, data6):
pass pass
@celery.task(name='firewall.reload_firewall_vlan')
def reload_firewall_vlan(data):
pass
@celery.task(name='firewall.reload_dhcp') @celery.task(name='firewall.reload_dhcp')
def reload_dhcp(data): def reload_dhcp(data):
pass pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment