Commit b1757b8c by Bach Dániel

allow BRIDGE_TYPE=NONE option

parent bbcea33e
......@@ -4,8 +4,7 @@ import re
import json
import logging
from ovs import Switch, Bridge
from utils import (ns_exec, sudo, ADDRESSES,
from utils import (ns_exec, sudo, ADDRESSES, get_network_type,
dhcp_no_free_re, dhcp_ack_re)
DHCP_LOGFILE = getenv('DHCP_LOGFILE', '/var/log/syslog')
......@@ -26,12 +25,6 @@ celery.conf.update(CELERY_CACHE_BACKEND=CACHE_URI,
logger = logging.getLogger(__name__)
if getenv('BRIDGE_TYPE', 'OVS') == 'BRIDGE':
network_type = Bridge
network_type = Switch
def reload_firewall(data4, data6, save_config=True):
......@@ -50,6 +43,11 @@ def reload_firewall(data4, data6, save_config=True):
def reload_firewall_vlan(data, save_config=True):
network_type = get_network_type()
if network_type is None:"Ignored reload_firewall_vlan() network type=%s",
# Add additional addresses from config
for k, v in ADDRESSES.items():
data[k]['addresses'] += v
......@@ -13,6 +13,16 @@ MAC = getenv('MAC')
ADDRESSES = json.loads(getenv('ADDRESSES', '{}'))
HA = bool(getenv('HA', False))
def get_network_type():
from ovs import Switch, Bridge
if getenv('BRIDGE_TYPE', 'OVS') == 'BRIDGE':
return Bridge
elif getenv('BRIDGE_TYPE', 'OVS') == 'NONE':
return None
return Switch
# 2013-06-26 12:16:59 DHCPACK on to 5c:b5:24:e6:5c:81
# (android_b555bfdba7c837d) via vlan0004
......@@ -45,5 +55,8 @@ def sudo(args, stdin=None):
def ns_exec(args, stdin=None):
return sudo(('/sbin/ip', 'netns', 'exec',
NETNS) + args, stdin)
if get_network_type() is None:
return sudo(args, stdin)
return sudo(('/sbin/ip', 'netns', 'exec',
NETNS) + args, stdin)
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