def __init__(self, configfile=None): if configfile is None: if os.path.exists(CONF_FILE): configfile = CONF_FILE else: configfile = find_config(os.path.abspath( os.path.dirname(__file__))) if configfile is None: raise Exception("Configuration file \"%s\" doesn't exist" % (configfile)) LOG.debug("Using configuration file: %s" % configfile) conf = config.parse(configfile) options = {"sql_connection": conf.DATABASE.sql_connection} reconnect_interval = conf.DATABASE.reconnect_interval options.update({"reconnect_interval": reconnect_interval}) db.configure_db(options) self.vmap = VlanMap() # Populate the map with anything that is already present in the # database vlans = ovs_db.get_vlans() for x in vlans: vlan_id, network_id = x LOG.debug("Adding already populated vlan %s -> %s" % (vlan_id, network_id)) self.vmap.already_used(vlan_id, network_id)
def __init__(self, configfile=None): if configfile is None: if os.path.exists(CONF_FILE): configfile = CONF_FILE else: configfile = find_config( os.path.abspath(os.path.dirname(__file__))) if configfile is None: raise Exception("Configuration file \"%s\" doesn't exist" % (configfile)) LOG.debug("Using configuration file: %s" % configfile) conf = config.parse(configfile) options = {"sql_connection": conf.DATABASE.sql_connection} reconnect_interval = conf.DATABASE.reconnect_interval options.update({"reconnect_interval": reconnect_interval}) db.configure_db(options) vlan_min = conf.OVS.vlan_min vlan_max = conf.OVS.vlan_max if vlan_min > vlan_max: LOG.warn("Using default VLAN values! vlan_min = %s is larger" " than vlan_max = %s!" % (vlan_min, vlan_max)) vlan_min = 1 vlan_max = 4094 self.vmap = VlanMap(vlan_min, vlan_max) # Populate the map with anything that is already present in the # database vlans = ovs_db.get_vlans() for x in vlans: vlan_id, network_id = x LOG.debug("Adding already populated vlan %s -> %s" % (vlan_id, network_id)) self.vmap.already_used(vlan_id, network_id)
def __init__(self, configfile=None): conf = config.parse(CONF_FILE) options = {"sql_connection": conf.DATABASE.sql_connection} reconnect_interval = conf.DATABASE.reconnect_interval options.update({"reconnect_interval": reconnect_interval}) db.configure_db(options) self.vmap = VlanMap(conf.OVS.vlan_min, conf.OVS.vlan_max) # Populate the map with anything that is already present in the # database self.vmap.populate_already_used(ovs_db.get_vlans())
def __init__(self, configfile=None): options = {"sql_connection": cfg.CONF.DATABASE.sql_connection} sql_max_retries = cfg.CONF.DATABASE.sql_max_retries options.update({"sql_max_retries": sql_max_retries}) reconnect_interval = cfg.CONF.DATABASE.reconnect_interval options.update({"reconnect_interval": reconnect_interval}) db.configure_db(options) self.vmap = VlanMap(cfg.CONF.OVS.vlan_min, cfg.CONF.OVS.vlan_max) # Populate the map with anything that is already present in the # database self.vmap.populate_already_used(ovs_db.get_vlans())