예제 #1
0
 def create_network_bulk(self, context, networks):
     """
     Perform this operation in the context of the configured device
     plugins.
     """
     LOG.debug("create_network_bulk() called\n")
     try:
         args = [context, networks]
         ovs_output = self._plugins[
             const.VSWITCH_PLUGIN].create_network_bulk(context, networks)
         vlan_ids = odb.get_vlans()
         vlanids = ''
         for v_id in vlan_ids:
             vlanids = str(v_id[0]) + ',' + vlanids
         vlanids = vlanids.strip(',')
         LOG.debug("ovs_output: %s\n " % ovs_output)
         ovs_networks = ovs_output
         for ovs_network in ovs_networks:
             vlan_id = odb.get_vlan(ovs_network['id'])
             vlan_name = conf.VLAN_NAME_PREFIX + str(vlan_id)
             args = [ovs_network['tenant_id'], ovs_network['name'],
                     ovs_network['id'], vlan_name, vlan_id,
                     {'vlan_ids':vlanids}]
             nexus_output = self._invoke_plugin_per_device(
                 const.NEXUS_PLUGIN, "create_network", args)
         return ovs_output
     except:
         # TODO (Sumit): Check if we need to perform any rollback here
         raise
예제 #2
0
 def create_network_bulk(self, context, networks):
     """
     Perform this operation in the context of the configured device
     plugins.
     """
     LOG.debug("create_network_bulk() called\n")
     try:
         args = [context, networks]
         ovs_output = self._plugins[
             const.VSWITCH_PLUGIN].create_network_bulk(context, networks)
         vlan_ids = odb.get_vlans()
         vlanids = ''
         for v_id in vlan_ids:
             vlanids = str(v_id[0]) + ',' + vlanids
         vlanids = vlanids.strip(',')
         LOG.debug("ovs_output: %s\n " % ovs_output)
         ovs_networks = ovs_output
         for ovs_network in ovs_networks:
             vlan_id = odb.get_vlan(ovs_network['id'])
             vlan_name = conf.VLAN_NAME_PREFIX + str(vlan_id)
             args = [ovs_network['tenant_id'], ovs_network['name'],
                     ovs_network['id'], vlan_name, vlan_id,
                     {'vlan_ids':vlanids}]
             nexus_output = self._invoke_plugin_per_device(
                 const.NEXUS_PLUGIN, "create_network", args)
         return ovs_output
     except:
         # TODO (Sumit): Check if we need to perform any rollback here
         raise
예제 #3
0
    def __init__(self, configfile=None):
        conf = config.parse(CONF_FILE)
        options = {"sql_connection": conf.DATABASE.sql_connection}
        options.update({'base': models_v2.model_base.BASEV2})
        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)
        self.vmap.populate_already_used(ovs_db_v2.get_vlans())
예제 #4
0
    def __init__(self, configfile=None):
        conf = config.parse(CONF_FILE)
        options = {"sql_connection": conf.DATABASE.sql_connection}
        options.update({'base': models_v2.model_base.BASEV2})
        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)
        self.vmap.populate_already_used(ovs_db_v2.get_vlans())
예제 #5
0
    def __init__(self, configfile=None):
        self.enable_tunneling = cfg.CONF.OVS.enable_tunneling
        options = {"sql_connection": cfg.CONF.DATABASE.sql_connection}
        options.update({'base': models_v2.model_base.BASEV2})
        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)
        self.vmap.populate_already_used(ovs_db_v2.get_vlans())
예제 #6
0
 def update_network(self, context, id, network):
     """
     Perform this operation in the context of the configured device
     plugins.
     """
     LOG.debug("update_network() called\n")
     args = [context, id, network]
     ovs_output = self._invoke_plugin_per_device(const.VSWITCH_PLUGIN,
                                                 self._func_name(),
                                                 args)
     vlan_id = odb.get_vlan(ovs_output[0]['id'])
     vlan_ids = ','.join(str(vlan[0]) for vlan in odb.get_vlans())
     args = [ovs_output[0]['tenant_id'], id, {'vlan_id': vlan_id},
             {'net_admin_state': ovs_output[0]['admin_state_up']},
             {'vlan_ids': vlan_ids}]
     nexus_output = self._invoke_plugin_per_device(const.NEXUS_PLUGIN,
                                                   self._func_name(),
                                                   args)
     return ovs_output[0]