From: Ann Kamyshnikova Date: Tue, 2 Jun 2015 15:45:51 +0000 (+0300) Subject: Juno_initial migration X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=fca84f69659e4e81790de405213f31e80fd8c239;p=openstack-build%2Fneutron-build.git Juno_initial migration Havana was deprecated with the kilo release, and icehouse will be deprecated with the liberty release, so havana_inital migration should be removed and replaced with juno_initial. Closes-bug: #1461103 Change-Id: I2e6802c9ab64d164bd888278d555dfeeaf47257b --- diff --git a/neutron/db/migration/alembic_migrations/agent_init_ops.py b/neutron/db/migration/alembic_migrations/agent_init_ops.py index 5390ee618..f71ea87e2 100644 --- a/neutron/db/migration/alembic_migrations/agent_init_ops.py +++ b/neutron/db/migration/alembic_migrations/agent_init_ops.py @@ -30,10 +30,13 @@ def upgrade(): sa.Column('binary', sa.String(length=255), nullable=False), sa.Column('topic', sa.String(length=255), nullable=False), sa.Column('host', sa.String(length=255), nullable=False), - sa.Column('admin_state_up', sa.Boolean(), nullable=False), + sa.Column('admin_state_up', sa.Boolean(), nullable=False, + server_default=sa.sql.true()), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('started_at', sa.DateTime(), nullable=False), sa.Column('heartbeat_timestamp', sa.DateTime(), nullable=False), sa.Column('description', sa.String(length=255), nullable=True), sa.Column('configurations', sa.String(length=4095), nullable=False), - sa.PrimaryKeyConstraint('id')) + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('agent_type', 'host', + name='uniq_agents0agent_type0host')) diff --git a/neutron/db/migration/alembic_migrations/brocade_init_ops.py b/neutron/db/migration/alembic_migrations/brocade_init_ops.py index 8a42cbb2b..e85333c11 100644 --- a/neutron/db/migration/alembic_migrations/brocade_init_ops.py +++ b/neutron/db/migration/alembic_migrations/brocade_init_ops.py @@ -28,7 +28,8 @@ def upgrade(): op.create_table( 'brocadeports', - sa.Column('port_id', sa.String(length=36), nullable=False), + sa.Column('port_id', sa.String(length=36), nullable=False, + server_default=''), sa.Column('network_id', sa.String(length=36), nullable=False), sa.Column('admin_state_up', sa.Boolean(), nullable=False), sa.Column('physical_interface', sa.String(length=36), nullable=True), @@ -36,3 +37,23 @@ def upgrade(): sa.Column('tenant_id', sa.String(length=36), nullable=True), sa.ForeignKeyConstraint(['network_id'], ['brocadenetworks.id'], ), sa.PrimaryKeyConstraint('port_id')) + + op.create_table( + 'ml2_brocadenetworks', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('vlan', sa.String(length=10), nullable=True), + sa.Column('segment_id', sa.String(length=36), nullable=True), + sa.Column('network_type', sa.String(length=10), nullable=True), + sa.Column('tenant_id', sa.String(length=255), nullable=True), + sa.PrimaryKeyConstraint('id')) + + op.create_table( + 'ml2_brocadeports', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('network_id', sa.String(length=36), nullable=False), + sa.Column('admin_state_up', sa.Boolean(), nullable=False), + sa.Column('physical_interface', sa.String(length=36), nullable=True), + sa.Column('vlan_id', sa.String(length=36), nullable=True), + sa.Column('tenant_id', sa.String(length=255), nullable=True), + sa.PrimaryKeyConstraint('id'), + sa.ForeignKeyConstraint(['network_id'], ['ml2_brocadenetworks.id'])) diff --git a/neutron/db/migration/alembic_migrations/cisco_init_ops.py b/neutron/db/migration/alembic_migrations/cisco_init_ops.py index b5031c4d8..7df02a931 100644 --- a/neutron/db/migration/alembic_migrations/cisco_init_ops.py +++ b/neutron/db/migration/alembic_migrations/cisco_init_ops.py @@ -18,6 +18,7 @@ from alembic import op import sqlalchemy as sa +from neutron.plugins.cisco.common import cisco_constants segment_type = sa.Enum('vlan', 'overlay', 'trunk', 'multi-segment', name='segment_type') @@ -31,15 +32,6 @@ def upgrade(): sa.Column('name', sa.String(length=255), nullable=True), sa.PrimaryKeyConstraint('id')) - op.create_table( - 'cisco_n1kv_vlan_allocations', - sa.Column('physical_network', sa.String(length=64), nullable=False), - sa.Column('vlan_id', sa.Integer(), autoincrement=False, - nullable=False), - sa.Column('allocated', sa.Boolean(), autoincrement=False, - nullable=False), - sa.PrimaryKeyConstraint('physical_network', 'vlan_id')) - op.create_table( 'cisco_network_profiles', sa.Column('id', sa.String(length=36), nullable=False), @@ -47,7 +39,8 @@ def upgrade(): sa.Column('segment_type', segment_type, nullable=False), sa.Column('sub_type', sa.String(length=255), nullable=True), sa.Column('segment_range', sa.String(length=255), nullable=True), - sa.Column('multicast_ip_index', sa.Integer(), nullable=True), + sa.Column('multicast_ip_index', sa.Integer(), nullable=True, + server_default='0'), sa.Column('multicast_ip_range', sa.String(length=255), nullable=True), sa.Column('physical_network', sa.String(length=255), nullable=True), sa.PrimaryKeyConstraint('id')) @@ -56,9 +49,29 @@ def upgrade(): 'cisco_n1kv_vxlan_allocations', sa.Column('vxlan_id', sa.Integer(), autoincrement=False, nullable=False), - sa.Column('allocated', sa.Boolean(), nullable=False), + sa.Column('allocated', sa.Boolean(), nullable=False, + server_default=sa.sql.false()), + sa.Column('network_profile_id', sa.String(length=36), nullable=False), + sa.ForeignKeyConstraint(['network_profile_id'], + ['cisco_network_profiles.id'], + ondelete='CASCADE', + name='cisco_n1kv_vxlan_allocations_ibfk_1'), sa.PrimaryKeyConstraint('vxlan_id')) + op.create_table( + 'cisco_n1kv_vlan_allocations', + sa.Column('physical_network', sa.String(length=64), nullable=False), + sa.Column('vlan_id', sa.Integer(), autoincrement=False, + nullable=False), + sa.Column('allocated', sa.Boolean(), autoincrement=False, + nullable=False, server_default=sa.sql.false()), + sa.Column('network_profile_id', sa.String(length=36), nullable=False), + sa.PrimaryKeyConstraint('physical_network', 'vlan_id'), + sa.ForeignKeyConstraint(['network_profile_id'], + ['cisco_network_profiles.id'], + ondelete='CASCADE', + name='cisco_n1kv_vlan_allocations_ibfk_1')) + op.create_table( 'cisco_credentials', sa.Column('credential_id', sa.String(length=255), nullable=True), @@ -76,19 +89,11 @@ def upgrade(): sa.Column('qos_desc', sa.String(length=255), nullable=True), sa.PrimaryKeyConstraint('tenant_id', 'qos_name')) - op.create_table( - 'cisco_nexusport_bindings', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('port_id', sa.String(length=255), nullable=True), - sa.Column('vlan_id', sa.Integer(), nullable=False), - sa.Column('switch_ip', sa.String(length=255), nullable=False), - sa.Column('instance_id', sa.String(length=255), nullable=False), - sa.PrimaryKeyConstraint('id')) - op.create_table( 'cisco_n1kv_profile_bindings', sa.Column('profile_type', profile_type, nullable=True), - sa.Column('tenant_id', sa.String(length=36), nullable=False), + sa.Column('tenant_id', sa.String(length=36), nullable=False, + server_default=cisco_constants.TENANT_ID_NOT_SET), sa.Column('profile_id', sa.String(length=36), nullable=False), sa.PrimaryKeyConstraint('tenant_id', 'profile_id')) @@ -153,3 +158,82 @@ def upgrade(): ondelete='CASCADE'), sa.ForeignKeyConstraint(['profile_id'], ['cisco_policy_profiles.id']), sa.PrimaryKeyConstraint('port_id')) + + op.create_table( + 'cisco_csr_identifier_map', + sa.Column('tenant_id', sa.String(length=255), nullable=True), + sa.Column('ipsec_site_conn_id', sa.String(length=64), + primary_key=True), + sa.Column('csr_tunnel_id', sa.Integer(), nullable=False), + sa.Column('csr_ike_policy_id', sa.Integer(), nullable=False), + sa.Column('csr_ipsec_policy_id', sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(['ipsec_site_conn_id'], + ['ipsec_site_connections.id'], + ondelete='CASCADE') + ) + + op.create_table( + 'cisco_ml2_apic_host_links', + sa.Column('host', sa.String(length=255), nullable=False), + sa.Column('ifname', sa.String(length=64), nullable=False), + sa.Column('ifmac', sa.String(length=32), nullable=True), + sa.Column('swid', sa.String(length=32), nullable=False), + sa.Column('module', sa.String(length=32), nullable=False), + sa.Column('port', sa.String(length=32), nullable=False), + sa.PrimaryKeyConstraint('host', 'ifname')) + + op.create_table( + 'cisco_ml2_apic_names', + sa.Column('neutron_id', sa.String(length=36), nullable=False), + sa.Column('neutron_type', sa.String(length=32), nullable=False), + sa.Column('apic_name', sa.String(length=255), nullable=False), + sa.PrimaryKeyConstraint('neutron_id', 'neutron_type')) + + op.create_table( + 'cisco_ml2_apic_contracts', + sa.Column('tenant_id', sa.String(length=255)), + sa.Column('router_id', sa.String(length=64), nullable=False), + sa.ForeignKeyConstraint(['router_id'], ['routers.id']), + sa.PrimaryKeyConstraint('router_id')) + + op.create_table('cisco_hosting_devices', + sa.Column('tenant_id', sa.String(length=255), nullable=True), + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('complementary_id', sa.String(length=36), nullable=True), + sa.Column('device_id', sa.String(length=255), nullable=True), + sa.Column('admin_state_up', sa.Boolean(), nullable=False), + sa.Column('management_port_id', sa.String(length=36), nullable=True), + sa.Column('protocol_port', sa.Integer(), nullable=True), + sa.Column('cfg_agent_id', sa.String(length=36), nullable=True), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('status', sa.String(length=16), nullable=True), + sa.ForeignKeyConstraint(['cfg_agent_id'], ['agents.id'], ), + sa.ForeignKeyConstraint(['management_port_id'], ['ports.id'], + ondelete='SET NULL'), + sa.PrimaryKeyConstraint('id') + ) + op.create_table('cisco_port_mappings', + sa.Column('logical_resource_id', sa.String(length=36), nullable=False), + sa.Column('logical_port_id', sa.String(length=36), nullable=False), + sa.Column('port_type', sa.String(length=32), nullable=True), + sa.Column('network_type', sa.String(length=32), nullable=True), + sa.Column('hosting_port_id', sa.String(length=36), nullable=True), + sa.Column('segmentation_id', sa.Integer(), autoincrement=False, + nullable=True), + sa.ForeignKeyConstraint(['hosting_port_id'], ['ports.id'], + ondelete='CASCADE'), + sa.ForeignKeyConstraint(['logical_port_id'], ['ports.id'], + ondelete='CASCADE'), + sa.PrimaryKeyConstraint('logical_resource_id', 'logical_port_id') + ) + op.create_table('cisco_router_mappings', + sa.Column('router_id', sa.String(length=36), nullable=False), + sa.Column('auto_schedule', sa.Boolean(), nullable=False), + sa.Column('hosting_device_id', sa.String(length=36), nullable=True), + sa.ForeignKeyConstraint(['hosting_device_id'], + ['cisco_hosting_devices.id'], + ondelete='SET NULL'), + sa.ForeignKeyConstraint(['router_id'], ['routers.id'], + ondelete='CASCADE'), + sa.PrimaryKeyConstraint('router_id') + ) diff --git a/neutron/db/migration/alembic_migrations/core_init_ops.py b/neutron/db/migration/alembic_migrations/core_init_ops.py index df27e2869..031366a72 100644 --- a/neutron/db/migration/alembic_migrations/core_init_ops.py +++ b/neutron/db/migration/alembic_migrations/core_init_ops.py @@ -54,6 +54,14 @@ def upgrade(): sa.Column('gateway_ip', sa.String(length=64), nullable=True), sa.Column('enable_dhcp', sa.Boolean(), nullable=True), sa.Column('shared', sa.Boolean(), nullable=True), + sa.Column('ipv6_ra_mode', + sa.Enum('slaac', 'dhcpv6-stateful', 'dhcpv6-stateless', + name='ipv6_ra_modes'), + nullable=True), + sa.Column('ipv6_address_mode', + sa.Enum('slaac', 'dhcpv6-stateful', 'dhcpv6-stateless', + name='ipv6_address_modes'), + nullable=True), sa.ForeignKeyConstraint(['network_id'], ['networks.id'], ), sa.PrimaryKeyConstraint('id')) diff --git a/neutron/db/migration/alembic_migrations/versions/2026156eab2f_l2_dvr_models.py b/neutron/db/migration/alembic_migrations/dvr_init_opts.py similarity index 72% rename from neutron/db/migration/alembic_migrations/versions/2026156eab2f_l2_dvr_models.py rename to neutron/db/migration/alembic_migrations/dvr_init_opts.py index a906dd66b..0a6a6c402 100644 --- a/neutron/db/migration/alembic_migrations/versions/2026156eab2f_l2_dvr_models.py +++ b/neutron/db/migration/alembic_migrations/dvr_init_opts.py @@ -1,4 +1,4 @@ -# Copyright 2014 OpenStack Foundation +# Copyright 2015 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain @@ -13,18 +13,7 @@ # under the License. # -"""L2 models to support DVR - -Revision ID: 2026156eab2f -Revises: 3927f7f7c456 -Create Date: 2014-06-23 19:12:43.392912 - -""" - -# revision identifiers, used by Alembic. -revision = '2026156eab2f' -down_revision = '3927f7f7c456' - +# Initial operations for dvr from alembic import op import sqlalchemy as sa @@ -60,3 +49,17 @@ def upgrade(): ondelete='SET NULL'), sa.PrimaryKeyConstraint('port_id', 'host') ) + op.create_table( + 'csnat_l3_agent_bindings', + sa.Column('router_id', sa.String(length=36), nullable=False), + sa.Column('l3_agent_id', sa.String(length=36), nullable=False), + sa.Column('host_id', sa.String(length=255), nullable=True), + sa.Column('csnat_gw_port_id', sa.String(length=36), nullable=True), + sa.ForeignKeyConstraint(['l3_agent_id'], ['agents.id'], + ondelete='CASCADE'), + sa.ForeignKeyConstraint(['router_id'], ['routers.id'], + ondelete='CASCADE'), + sa.ForeignKeyConstraint(['csnat_gw_port_id'], ['ports.id'], + ondelete='CASCADE'), + sa.PrimaryKeyConstraint('router_id') + ) diff --git a/neutron/db/migration/alembic_migrations/heal_script.py b/neutron/db/migration/alembic_migrations/heal_script.py deleted file mode 100644 index 71bd21d05..000000000 --- a/neutron/db/migration/alembic_migrations/heal_script.py +++ /dev/null @@ -1,290 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -import logging - -import alembic -from alembic import autogenerate as autogen -from alembic import context -from alembic import op - -import six -import sqlalchemy -from sqlalchemy import schema as sa_schema -import sqlalchemy.sql.expression as expr -from sqlalchemy.sql import text -from sqlalchemy import types - -from neutron.db.migration.models import frozen as frozen_models -from neutron.i18n import _LI, _LW - -LOG = logging.getLogger(__name__) - -METHODS = {} - - -def heal(): - # This is needed else the heal script will start spewing - # a lot of pointless warning messages from alembic. - LOG.setLevel(logging.INFO) - if context.is_offline_mode(): - return - models_metadata = frozen_models.get_metadata() - # Compare metadata from models and metadata from migrations - # Diff example: - # [ ( 'add_table', - # Table('bat', MetaData(bind=None), - # Column('info', String(), table=), schema=None)), - # ( 'remove_table', - # Table(u'bar', MetaData(bind=None), - # Column(u'data', VARCHAR(), table=), schema=None)), - # ( 'add_column', - # None, - # 'foo', - # Column('data', Integer(), table=)), - # ( 'remove_column', - # None, - # 'foo', - # Column(u'old_data', VARCHAR(), table=None)), - # [ ( 'modify_nullable', - # None, - # 'foo', - # u'x', - # { 'existing_server_default': None, - # 'existing_type': INTEGER()}, - # True, - # False)]] - opts = { - 'compare_type': _compare_type, - 'compare_server_default': _compare_server_default, - } - mc = alembic.migration.MigrationContext.configure(op.get_bind(), opts=opts) - set_storage_engine(op.get_bind(), "InnoDB") - diff = autogen.compare_metadata(mc, models_metadata) - for el in diff: - execute_alembic_command(el) - - -def execute_alembic_command(command): - # Commands like add_table, remove_table, add_index, add_column, etc is a - # tuple and can be handle after running special functions from alembic for - # them. - if isinstance(command, tuple): - # Here methods add_table, drop_index, etc is running. Name of method is - # the first element of the tuple, arguments to this method comes from - # the next element(s). - if command[0] in METHODS: - METHODS[command[0]](*command[1:]) - else: - LOG.warning(_LW("Ignoring alembic command %s"), command[0]) - else: - # For all commands that changing type, nullable or other parameters - # of the column is used alter_column method from alembic. - parse_modify_command(command) - - -def parse_modify_command(command): - # From arguments of command is created op.alter_column() that has the - # following syntax: - # alter_column(table_name, column_name, nullable=None, - # server_default=False, new_column_name=None, type_=None, - # autoincrement=None, existing_type=None, - # existing_server_default=False, existing_nullable=None, - # existing_autoincrement=None, schema=None, **kw) - bind = op.get_bind() - for modified, schema, table, column, existing, old, new in command: - if modified.endswith('type'): - modified = 'type_' - elif modified.endswith('nullable'): - modified = 'nullable' - insp = sqlalchemy.engine.reflection.Inspector.from_engine(bind) - if column in insp.get_primary_keys(table) and new: - return - elif modified.endswith('default'): - modified = 'server_default' - if isinstance(new, six.string_types): - new = text(new) - kwargs = {modified: new, 'schema': schema} - default = existing.get('existing_server_default') - if default and isinstance(default, sa_schema.DefaultClause): - if isinstance(default.arg, six.string_types): - existing['existing_server_default'] = default.arg - else: - existing['existing_server_default'] = default.arg.text - kwargs.update(existing) - op.alter_column(table, column, **kwargs) - - -def alembic_command_method(f): - METHODS[f.__name__] = f - return f - - -@alembic_command_method -def add_table(table): - # Check if table has already exists and needs just to be renamed - if not rename(table.name): - table.create(bind=op.get_bind(), checkfirst=True) - - -@alembic_command_method -def add_index(index): - bind = op.get_bind() - insp = sqlalchemy.engine.reflection.Inspector.from_engine(bind) - if index.name not in [idx['name'] for idx in - insp.get_indexes(index.table.name)]: - op.create_index(index.name, index.table.name, column_names(index)) - - -@alembic_command_method -def remove_table(table): - # Tables should not be removed - pass - - -@alembic_command_method -def remove_index(index): - bind = op.get_bind() - insp = sqlalchemy.engine.reflection.Inspector.from_engine(bind) - index_names = [idx['name'] for idx in insp.get_indexes(index.table.name)] - fk_names = [i['name'] for i in insp.get_foreign_keys(index.table.name)] - if index.name in index_names and index.name not in fk_names: - op.drop_index(index.name, index.table.name) - - -@alembic_command_method -def remove_column(schema, table_name, column): - op.drop_column(table_name, column.name, schema=schema) - - -@alembic_command_method -def add_column(schema, table_name, column): - op.add_column(table_name, column.copy(), schema=schema) - - -@alembic_command_method -def add_constraint(constraint): - op.create_unique_constraint(constraint.name, constraint.table.name, - column_names(constraint)) - - -@alembic_command_method -def remove_constraint(constraint): - op.drop_constraint(constraint.name, constraint.table.name, type_='unique') - - -@alembic_command_method -def remove_fk(fk): - op.drop_constraint(fk.name, fk.parent.name, type_='foreignkey') - - -@alembic_command_method -def add_fk(fk): - fk_name = fk.name - # As per Mike Bayer's comment, using _fk_spec method is preferable to - # direct access to ForeignKeyConstraint attributes - fk_spec = alembic.ddl.base._fk_spec(fk) - fk_table = fk_spec[1] - fk_ref = fk_spec[4] - fk_local_cols = fk_spec[2] - fk_remote_cols = fk_spec[5] - op.create_foreign_key(fk_name, fk_table, fk_ref, fk_local_cols, - fk_remote_cols) - - -def check_if_table_exists(table): - # This functions checks if table exists or not - bind = op.get_bind() - insp = sqlalchemy.engine.reflection.Inspector.from_engine(bind) - return (table in insp.get_table_names() and - table not in frozen_models.renamed_tables) - - -def rename(table): - # For tables that were renamed checks if the previous table exists - # if it does the previous one will be renamed. - # Returns True/False if it is needed to create new table - if table in frozen_models.renamed_tables: - if check_if_table_exists(frozen_models.renamed_tables[table]): - op.rename_table(frozen_models.renamed_tables[table], table) - LOG.info(_LI("Table %(old_t)r was renamed to %(new_t)r"), { - 'old_t': table, 'new_t': frozen_models.renamed_tables[table]}) - return True - return False - - -def column_names(obj): - return [col.name for col in obj.columns if hasattr(col, 'name')] - - -def _compare_type(ctxt, insp_col, meta_col, insp_type, meta_type): - """Return True if types are different, False if not. - - Return None to allow the default implementation to compare these types. - - :param ctxt: alembic MigrationContext instance - :param insp_col: reflected column - :param meta_col: column from model - :param insp_type: reflected column type - :param meta_type: column type from model - - """ - - # some backends (e.g. mysql) don't provide native boolean type - BOOLEAN_METADATA = (types.BOOLEAN, types.Boolean) - BOOLEAN_SQL = BOOLEAN_METADATA + (types.INTEGER, types.Integer) - - if isinstance(meta_type, BOOLEAN_METADATA): - return not isinstance(insp_type, BOOLEAN_SQL) - - return None # tells alembic to use the default comparison method - - -def _compare_server_default(ctxt, ins_col, meta_col, insp_def, meta_def, - rendered_meta_def): - """Compare default values between model and db table. - - Return True if the defaults are different, False if not, or None to - allow the default implementation to compare these defaults. - - :param ctxt: alembic MigrationContext instance - :param insp_col: reflected column - :param meta_col: column from model - :param insp_def: reflected column default value - :param meta_def: column default value from model - :param rendered_meta_def: rendered column default value (from model) - - """ - - if (ctxt.dialect.name == 'mysql' and - isinstance(meta_col.type, sqlalchemy.Boolean)): - - if meta_def is None or insp_def is None: - return meta_def != insp_def - - return not ( - isinstance(meta_def.arg, expr.True_) and insp_def == "'1'" or - isinstance(meta_def.arg, expr.False_) and insp_def == "'0'" - ) - - return None # tells alembic to use the default comparison method - - -def set_storage_engine(bind, engine): - insp = sqlalchemy.engine.reflection.Inspector.from_engine(bind) - if bind.dialect.name == 'mysql': - for table in insp.get_table_names(): - if insp.get_table_options(table)['mysql_engine'] != engine: - op.execute("ALTER TABLE %s ENGINE=%s" % (table, engine)) diff --git a/neutron/db/migration/alembic_migrations/l3_init_ops.py b/neutron/db/migration/alembic_migrations/l3_init_ops.py index fd5799841..94a54d3a9 100644 --- a/neutron/db/migration/alembic_migrations/l3_init_ops.py +++ b/neutron/db/migration/alembic_migrations/l3_init_ops.py @@ -18,6 +18,8 @@ from alembic import op import sqlalchemy as sa +l3_ha_states = sa.Enum('active', 'standby', name='l3_ha_states') + def create_routerroutes(): op.create_table( @@ -61,6 +63,8 @@ def upgrade(): sa.Column('fixed_port_id', sa.String(length=36), nullable=True), sa.Column('fixed_ip_address', sa.String(length=64), nullable=True), sa.Column('router_id', sa.String(length=36), nullable=True), + sa.Column('last_known_router_id', sa.String(length=36), nullable=True), + sa.Column('status', sa.String(length=16), nullable=True), sa.ForeignKeyConstraint(['fixed_port_id'], ['ports.id'], ), sa.ForeignKeyConstraint(['floating_port_id'], ['ports.id'], ), sa.ForeignKeyConstraint(['router_id'], ['routers.id'], ), @@ -70,11 +74,76 @@ def upgrade(): op.create_table( 'routerl3agentbindings', - sa.Column('id', sa.String(length=36), nullable=False), sa.Column('router_id', sa.String(length=36), nullable=True), sa.Column('l3_agent_id', sa.String(length=36), nullable=True), sa.ForeignKeyConstraint(['l3_agent_id'], ['agents.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['router_id'], ['routers.id'], ondelete='CASCADE'), - sa.PrimaryKeyConstraint('id')) + sa.PrimaryKeyConstraint('router_id', 'l3_agent_id')) + op.create_table( + 'router_extra_attributes', + sa.Column('router_id', sa.String(length=36), nullable=False), + sa.Column('distributed', sa.Boolean(), nullable=False, + server_default=sa.sql.false()), + sa.Column('service_router', sa.Boolean(), nullable=False, + server_default=sa.sql.false()), + sa.Column('ha', sa.Boolean(), nullable=False, + server_default=sa.sql.false()), + sa.Column('ha_vr_id', sa.Integer()), + sa.ForeignKeyConstraint( + ['router_id'], ['routers.id'], ondelete='CASCADE'), + sa.PrimaryKeyConstraint('router_id') + ) + op.create_table('ha_router_agent_port_bindings', + sa.Column('port_id', sa.String(length=36), + nullable=False), + sa.Column('router_id', sa.String(length=36), + nullable=False), + sa.Column('l3_agent_id', sa.String(length=36), + nullable=True), + sa.Column('state', l3_ha_states, + server_default='standby'), + sa.PrimaryKeyConstraint('port_id'), + sa.ForeignKeyConstraint(['port_id'], ['ports.id'], + ondelete='CASCADE'), + sa.ForeignKeyConstraint(['router_id'], ['routers.id'], + ondelete='CASCADE'), + sa.ForeignKeyConstraint(['l3_agent_id'], ['agents.id'], + ondelete='CASCADE')) + + op.create_table('ha_router_networks', + sa.Column('tenant_id', sa.String(length=255), + nullable=False, primary_key=True), + sa.Column('network_id', sa.String(length=36), + nullable=False, + primary_key=True), + sa.ForeignKeyConstraint(['network_id'], ['networks.id'], + ondelete='CASCADE')) + + op.create_table('ha_router_vrid_allocations', + sa.Column('network_id', sa.String(length=36), + nullable=False, + primary_key=True), + sa.Column('vr_id', sa.Integer(), + nullable=False, + primary_key=True), + sa.ForeignKeyConstraint(['network_id'], ['networks.id'], + ondelete='CASCADE')) + op.create_table( + 'routerports', + sa.Column('router_id', sa.String(length=36), nullable=False), + sa.Column('port_id', sa.String(length=36), nullable=False), + sa.Column('port_type', sa.String(length=255)), + sa.PrimaryKeyConstraint('router_id', 'port_id'), + sa.ForeignKeyConstraint( + ['router_id'], + ['routers.id'], + ondelete='CASCADE' + ), + sa.ForeignKeyConstraint( + ['port_id'], + ['ports.id'], + ondelete='CASCADE' + ), + ) diff --git a/neutron/db/migration/alembic_migrations/loadbalancer_init_ops.py b/neutron/db/migration/alembic_migrations/loadbalancer_init_ops.py index f3ed1db65..111bcf64b 100644 --- a/neutron/db/migration/alembic_migrations/loadbalancer_init_ops.py +++ b/neutron/db/migration/alembic_migrations/loadbalancer_init_ops.py @@ -108,12 +108,13 @@ def upgrade(): sa.Column('weight', sa.Integer(), nullable=False), sa.Column('admin_state_up', sa.Boolean(), nullable=False), sa.ForeignKeyConstraint(['pool_id'], ['pools.id'], ), - sa.PrimaryKeyConstraint('id')) + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('pool_id', 'address', 'protocol_port', + name='uniq_member0pool_id0address0port')) op.create_table( 'poolmonitorassociations', - sa.Column('status', sa.String(length=16), nullable=False, - server_default=''), + sa.Column('status', sa.String(length=16), nullable=False), sa.Column('status_description', sa.String(length=255), nullable=True), sa.Column('pool_id', sa.String(length=36), nullable=False), sa.Column('monitor_id', sa.String(length=36), nullable=False), @@ -124,9 +125,19 @@ def upgrade(): op.create_table( 'poolstatisticss', sa.Column('pool_id', sa.String(length=36), nullable=False), - sa.Column('bytes_in', sa.Integer(), nullable=False), - sa.Column('bytes_out', sa.Integer(), nullable=False), - sa.Column('active_connections', sa.Integer(), nullable=False), - sa.Column('total_connections', sa.Integer(), nullable=False), + sa.Column('bytes_in', sa.BigInteger(), nullable=False), + sa.Column('bytes_out', sa.BigInteger(), nullable=False), + sa.Column('active_connections', sa.BigInteger(), nullable=False), + sa.Column('total_connections', sa.BigInteger(), nullable=False), sa.ForeignKeyConstraint(['pool_id'], ['pools.id'], ), sa.PrimaryKeyConstraint('pool_id')) + + op.create_table( + u'embrane_pool_port', + sa.Column(u'pool_id', sa.String(length=36), nullable=False), + sa.Column(u'port_id', sa.String(length=36), nullable=False), + sa.ForeignKeyConstraint(['pool_id'], [u'pools.id'], + name=u'embrane_pool_port_ibfk_1'), + sa.ForeignKeyConstraint(['port_id'], [u'ports.id'], + name=u'embrane_pool_port_ibfk_2'), + sa.PrimaryKeyConstraint(u'pool_id')) diff --git a/neutron/db/migration/alembic_migrations/metering_init_ops.py b/neutron/db/migration/alembic_migrations/metering_init_ops.py index 64edbbd3e..d493c1668 100644 --- a/neutron/db/migration/alembic_migrations/metering_init_ops.py +++ b/neutron/db/migration/alembic_migrations/metering_init_ops.py @@ -31,6 +31,8 @@ def create_meteringlabels(): sa.Column('id', sa.String(length=36), nullable=False), sa.Column('name', sa.String(length=255), nullable=True), sa.Column('description', sa.String(length=1024), nullable=True), + sa.Column('shared', sa.Boolean(), server_default=sa.sql.false(), + nullable=True), sa.PrimaryKeyConstraint('id')) @@ -43,7 +45,8 @@ def upgrade(): sa.Column('direction', direction, nullable=True), sa.Column('remote_ip_prefix', sa.String(length=64), nullable=True), sa.Column('metering_label_id', sa.String(length=36), nullable=False), - sa.Column('excluded', sa.Boolean(), nullable=True), + sa.Column('excluded', sa.Boolean(), nullable=True, + server_default=sa.sql.false()), sa.ForeignKeyConstraint(['metering_label_id'], ['meteringlabels.id'], ondelete='CASCADE'), diff --git a/neutron/db/migration/alembic_migrations/ml2_init_ops.py b/neutron/db/migration/alembic_migrations/ml2_init_ops.py index dc9f5d281..fb6b04cd2 100644 --- a/neutron/db/migration/alembic_migrations/ml2_init_ops.py +++ b/neutron/db/migration/alembic_migrations/ml2_init_ops.py @@ -20,18 +20,6 @@ from alembic import op import sqlalchemy as sa -def create_cisco_ml2_credentials(): - op.create_table( - 'cisco_ml2_credentials', - sa.Column('credential_id', sa.String(length=255), nullable=True), - sa.Column('tenant_id', sa.String(length=255), nullable=False), - sa.Column('credential_name', sa.String(length=255), nullable=False), - sa.Column('user_name', sa.String(length=255), nullable=True), - sa.Column('password', sa.String(length=255), nullable=True), - sa.PrimaryKeyConstraint('tenant_id', 'credential_name'), - ) - - def upgrade(): op.create_table( 'ml2_vlan_allocations', @@ -46,7 +34,7 @@ def upgrade(): sa.Column('ip_address', sa.String(length=64), nullable=False), sa.Column('udp_port', sa.Integer(), autoincrement=False, nullable=False), - sa.PrimaryKeyConstraint('ip_address', 'udp_port')) + sa.PrimaryKeyConstraint('ip_address')) op.create_table( 'ml2_gre_endpoints', @@ -57,14 +45,16 @@ def upgrade(): 'ml2_vxlan_allocations', sa.Column('vxlan_vni', sa.Integer(), autoincrement=False, nullable=False), - sa.Column('allocated', sa.Boolean(), nullable=False), + sa.Column('allocated', sa.Boolean(), nullable=False, + server_default=sa.sql.false()), sa.PrimaryKeyConstraint('vxlan_vni')) op.create_table( 'ml2_gre_allocations', sa.Column('gre_id', sa.Integer(), autoincrement=False, nullable=False), - sa.Column('allocated', sa.Boolean(), nullable=False), + sa.Column('allocated', sa.Boolean(), nullable=False, + server_default=sa.sql.false()), sa.PrimaryKeyConstraint('gre_id')) op.create_table( @@ -79,6 +69,8 @@ def upgrade(): sa.Column('network_type', sa.String(length=32), nullable=False), sa.Column('physical_network', sa.String(length=64), nullable=True), sa.Column('segmentation_id', sa.Integer(), nullable=True), + sa.Column('is_dynamic', sa.Boolean(), nullable=False, + server_default=sa.sql.false()), sa.ForeignKeyConstraint(['network_id'], ['networks.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id')) @@ -86,11 +78,17 @@ def upgrade(): op.create_table( 'ml2_port_bindings', sa.Column('port_id', sa.String(length=36), nullable=False), - sa.Column('host', sa.String(length=255), nullable=False), + sa.Column('host', sa.String(length=255), nullable=False, + server_default=''), sa.Column('vif_type', sa.String(length=64), nullable=False), - sa.Column('cap_port_filter', sa.Boolean(), nullable=False), sa.Column('driver', sa.String(length=64), nullable=True), sa.Column('segment', sa.String(length=36), nullable=True), + sa.Column('vnic_type', sa.String(length=64), nullable=False, + server_default='normal'), + sa.Column('profile', sa.String(length=4095), nullable=False, + server_default=''), + sa.Column('vif_details', sa.String(length=4095), nullable=False, + server_default=''), sa.ForeignKeyConstraint(['port_id'], ['ports.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['segment'], ['ml2_network_segments.id'], @@ -108,8 +106,6 @@ def upgrade(): sa.PrimaryKeyConstraint('binding_id'), ) - create_cisco_ml2_credentials() - op.create_table( 'arista_provisioned_nets', sa.Column('tenant_id', sa.String(length=255), nullable=True), diff --git a/neutron/db/migration/alembic_migrations/mlnx_init_ops.py b/neutron/db/migration/alembic_migrations/mlnx_init_ops.py index 676585f01..50fdfd9e8 100644 --- a/neutron/db/migration/alembic_migrations/mlnx_init_ops.py +++ b/neutron/db/migration/alembic_migrations/mlnx_init_ops.py @@ -25,7 +25,8 @@ def upgrade(): sa.Column('physical_network', sa.String(length=64), nullable=False), sa.Column('segmentation_id', sa.Integer(), autoincrement=False, nullable=False), - sa.Column('allocated', sa.Boolean(), nullable=False), + sa.Column('allocated', sa.Boolean(), nullable=False, + server_default=sa.sql.false()), sa.PrimaryKeyConstraint('physical_network', 'segmentation_id')) op.create_table( diff --git a/neutron/db/migration/alembic_migrations/nec_init_ops.py b/neutron/db/migration/alembic_migrations/nec_init_ops.py index 9d02495a8..6e78e0f4a 100644 --- a/neutron/db/migration/alembic_migrations/nec_init_ops.py +++ b/neutron/db/migration/alembic_migrations/nec_init_ops.py @@ -24,15 +24,15 @@ def upgrade(): op.create_table( 'ofcportmappings', sa.Column('ofc_id', sa.String(length=255), nullable=False), - sa.Column('quantum_id', sa.String(length=36), nullable=False), - sa.PrimaryKeyConstraint('quantum_id'), + sa.Column('neutron_id', sa.String(length=36), nullable=False), + sa.PrimaryKeyConstraint('neutron_id'), sa.UniqueConstraint('ofc_id')) op.create_table( 'ofcroutermappings', sa.Column('ofc_id', sa.String(length=255), nullable=False), - sa.Column('quantum_id', sa.String(length=36), nullable=False), - sa.PrimaryKeyConstraint('quantum_id'), + sa.Column('neutron_id', sa.String(length=36), nullable=False), + sa.PrimaryKeyConstraint('neutron_id'), sa.UniqueConstraint('ofc_id')) op.create_table( @@ -43,51 +43,27 @@ def upgrade(): ondelete='CASCADE'), sa.PrimaryKeyConstraint('router_id')) - op.create_table( - 'ofcnetworks', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('quantum_id', sa.String(length=36), nullable=False), - sa.PrimaryKeyConstraint('id')) - op.create_table( 'ofctenantmappings', sa.Column('ofc_id', sa.String(length=255), nullable=False), - sa.Column('quantum_id', sa.String(length=36), nullable=False), - sa.PrimaryKeyConstraint('quantum_id'), + sa.Column('neutron_id', sa.String(length=36), nullable=False), + sa.PrimaryKeyConstraint('neutron_id'), sa.UniqueConstraint('ofc_id')) op.create_table( 'ofcfiltermappings', sa.Column('ofc_id', sa.String(length=255), nullable=False), - sa.Column('quantum_id', sa.String(length=36), nullable=False), - sa.PrimaryKeyConstraint('quantum_id'), + sa.Column('neutron_id', sa.String(length=36), nullable=False), + sa.PrimaryKeyConstraint('neutron_id'), sa.UniqueConstraint('ofc_id')) op.create_table( 'ofcnetworkmappings', sa.Column('ofc_id', sa.String(length=255), nullable=False), - sa.Column('quantum_id', sa.String(length=36), nullable=False), - sa.PrimaryKeyConstraint('quantum_id'), + sa.Column('neutron_id', sa.String(length=36), nullable=False), + sa.PrimaryKeyConstraint('neutron_id'), sa.UniqueConstraint('ofc_id')) - op.create_table( - 'ofcfilters', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('quantum_id', sa.String(length=36), nullable=False), - sa.PrimaryKeyConstraint('id')) - - op.create_table( - 'ofcports', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('quantum_id', sa.String(length=36), nullable=False), - sa.PrimaryKeyConstraint('id')) - - op.create_table( - 'ofctenants', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('quantum_id', sa.String(length=36), nullable=False), - sa.PrimaryKeyConstraint('id')) - op.create_table( 'packetfilters', sa.Column('tenant_id', sa.String(length=255), nullable=True), diff --git a/neutron/db/migration/alembic_migrations/versions/e766b19a3bb_nuage_initial.py b/neutron/db/migration/alembic_migrations/nuage_init_opts.py similarity index 56% rename from neutron/db/migration/alembic_migrations/versions/e766b19a3bb_nuage_initial.py rename to neutron/db/migration/alembic_migrations/nuage_init_opts.py index 4fb6b3c59..681811bc8 100644 --- a/neutron/db/migration/alembic_migrations/versions/e766b19a3bb_nuage_initial.py +++ b/neutron/db/migration/alembic_migrations/nuage_init_opts.py @@ -1,4 +1,4 @@ -# Copyright 2014 OpenStack Foundation +# Copyright 2015 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain @@ -13,33 +13,16 @@ # under the License. # -"""nuage_initial - -Revision ID: e766b19a3bb -Revises: 1b2580001654 -Create Date: 2014-02-14 18:03:14.841064 - -""" - -# revision identifiers, used by Alembic. -revision = 'e766b19a3bb' -down_revision = '1b2580001654' +# Initial operations for Nuage plugin from alembic import op import sqlalchemy as sa -from neutron.db import migration - def upgrade(): - if not migration.schema_has_table('routers'): - # In the database we are migrating from, the configured plugin - # did not create the routers table. - return - op.create_table( - 'net_partitions', + 'nuage_net_partitions', sa.Column('id', sa.String(length=36), nullable=False), sa.Column('name', sa.String(length=64), nullable=True), sa.Column('l3dom_tmplt_id', sa.String(length=36), nullable=True), @@ -47,17 +30,7 @@ def upgrade(): sa.PrimaryKeyConstraint('id'), ) op.create_table( - 'port_mapping', - sa.Column('port_id', sa.String(length=36), nullable=False), - sa.Column('nuage_vport_id', sa.String(length=36), nullable=True), - sa.Column('nuage_vif_id', sa.String(length=36), nullable=True), - sa.Column('static_ip', sa.Boolean(), nullable=True), - sa.ForeignKeyConstraint(['port_id'], ['ports.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('port_id'), - ) - op.create_table( - 'subnet_l2dom_mapping', + 'nuage_subnet_l2dom_mapping', sa.Column('subnet_id', sa.String(length=36), nullable=False), sa.Column('net_partition_id', sa.String(length=36), nullable=True), sa.Column('nuage_subnet_id', sa.String(length=36), nullable=True), @@ -67,28 +40,30 @@ def upgrade(): sa.Column('nuage_group_id', sa.String(length=36), nullable=True), sa.ForeignKeyConstraint(['subnet_id'], ['subnets.id'], ondelete='CASCADE'), - sa.ForeignKeyConstraint(['net_partition_id'], ['net_partitions.id'], + sa.ForeignKeyConstraint(['net_partition_id'], + ['nuage_net_partitions.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('subnet_id'), ) op.create_table( - 'net_partition_router_mapping', + 'nuage_net_partition_router_mapping', sa.Column('net_partition_id', sa.String(length=36), nullable=False), sa.Column('router_id', sa.String(length=36), nullable=False), sa.Column('nuage_router_id', sa.String(length=36), nullable=True), - sa.ForeignKeyConstraint(['net_partition_id'], ['net_partitions.id'], + sa.ForeignKeyConstraint(['net_partition_id'], + ['nuage_net_partitions.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['router_id'], ['routers.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('net_partition_id', 'router_id'), ) op.create_table( - 'router_zone_mapping', - sa.Column('router_id', sa.String(length=36), nullable=False), - sa.Column('nuage_zone_id', sa.String(length=36), nullable=True), - sa.Column('nuage_user_id', sa.String(length=36), nullable=True), - sa.Column('nuage_group_id', sa.String(length=36), nullable=True), - sa.ForeignKeyConstraint(['router_id'], ['routers.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('router_id'), + 'nuage_provider_net_bindings', + sa.Column('network_id', sa.String(length=36), nullable=False), + sa.Column('network_type', sa.String(length=32), nullable=False), + sa.Column('physical_network', sa.String(length=64), nullable=False), + sa.Column('vlan_id', sa.Integer(), nullable=False), + sa.ForeignKeyConstraint( + ['network_id'], ['networks.id'], ondelete='CASCADE'), + sa.PrimaryKeyConstraint('network_id') ) diff --git a/neutron/db/migration/alembic_migrations/other_extensions_init_ops.py b/neutron/db/migration/alembic_migrations/other_extensions_init_ops.py index e45526f40..0906145ba 100644 --- a/neutron/db/migration/alembic_migrations/other_extensions_init_ops.py +++ b/neutron/db/migration/alembic_migrations/other_extensions_init_ops.py @@ -37,7 +37,8 @@ def upgrade(): op.create_table( 'quotas', sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('tenant_id', sa.String(length=255), nullable=True), + sa.Column('tenant_id', sa.String(length=255), nullable=True, + index=True), sa.Column('resource', sa.String(length=255), nullable=True), sa.Column('limit', sa.Integer(), nullable=True), sa.PrimaryKeyConstraint('id')) diff --git a/neutron/db/migration/alembic_migrations/other_plugins_init_ops.py b/neutron/db/migration/alembic_migrations/other_plugins_init_ops.py index 9d72b5d14..2d70f23eb 100644 --- a/neutron/db/migration/alembic_migrations/other_plugins_init_ops.py +++ b/neutron/db/migration/alembic_migrations/other_plugins_init_ops.py @@ -79,3 +79,9 @@ def upgrade(): sa.ForeignKeyConstraint(['rule_id'], ['routerrules.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('rule_id', 'nexthop')) + + op.create_table( + 'consistencyhashes', + sa.Column('hash_id', sa.String(255), primary_key=True), + sa.Column('hash', sa.String(255), nullable=False) + ) diff --git a/neutron/db/migration/alembic_migrations/versions/10cd28e692e9_nuage_extraroute.py b/neutron/db/migration/alembic_migrations/versions/10cd28e692e9_nuage_extraroute.py deleted file mode 100644 index 6ef617f24..000000000 --- a/neutron/db/migration/alembic_migrations/versions/10cd28e692e9_nuage_extraroute.py +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""nuage_extraroute - -Revision ID: 10cd28e692e9 -Revises: 1b837a7125a9 -Create Date: 2014-05-14 14:47:53.148132 - -""" - -# revision identifiers, used by Alembic. -revision = '10cd28e692e9' -down_revision = '1b837a7125a9' - - -from alembic import op -import sqlalchemy as sa - -from neutron.db import migration -from neutron.db.migration.alembic_migrations import l3_init_ops - - -def upgrade(): - - if not migration.schema_has_table('routers'): - # In the database we are migrating from, the configured plugin - # did not create the routers table. - return - - op.create_table( - 'routerroutes_mapping', - sa.Column('router_id', sa.String(length=36), nullable=False), - sa.Column('nuage_route_id', sa.String(length=36), nullable=True), - sa.ForeignKeyConstraint(['router_id'], ['routers.id'], - ondelete='CASCADE'), - ) - # This table might already exist as it might have been created - # if another plugin was configured before the nuage one - if not migration.schema_has_table('routerroutes'): - l3_init_ops.create_routerroutes() diff --git a/neutron/db/migration/alembic_migrations/versions/117643811bca_nec_delete_ofc_mapping.py b/neutron/db/migration/alembic_migrations/versions/117643811bca_nec_delete_ofc_mapping.py deleted file mode 100644 index 3e8e15cd0..000000000 --- a/neutron/db/migration/alembic_migrations/versions/117643811bca_nec_delete_ofc_mapping.py +++ /dev/null @@ -1,174 +0,0 @@ -# Copyright 2014 NEC Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""nec: delete old ofc mapping tables - -Revision ID: 117643811bca -Revises: 81c553f3776c -Create Date: 2014-03-02 05:26:47.073318 - -""" - -# revision identifiers, used by Alembic. -revision = '117643811bca' -down_revision = '81c553f3776c' - -from alembic import op -import sqlalchemy as sa -from sqlalchemy.ext import compiler as sa_compiler -from sqlalchemy.sql import expression as sa_expr - -from neutron.db import migration - - -# sqlalchemy does not support the expression: -# INSERT INTO (, ...) (SELECT ...) -# The following class is to support this expression. -# Reference: http://docs.sqlalchemy.org/en/rel_0_9/core/compiler.html -# section: "Compiling sub-elements of a custom expression construct" - -class InsertFromSelect(sa_expr.Executable, sa_expr.ClauseElement): - _execution_options = (sa_expr.Executable._execution_options. - union({'autocommit': True})) - - def __init__(self, insert_spec, select): - self.insert_spec = insert_spec - self.select = select - - -@sa_compiler.compiles(InsertFromSelect) -def visit_insert_from_select(element, compiler, **kw): - if type(element.insert_spec) == list: - columns = [] - for column in element.insert_spec: - columns.append(column.name) - table = compiler.process(element.insert_spec[0].table, asfrom=True) - columns = ", ".join(columns) - sql = ("INSERT INTO %s (%s) (%s)" % - (table, columns, compiler.process(element.select))) - else: - sql = ("INSERT INTO %s (%s)" % - (compiler.process(element.insert_spec, asfrom=True), - compiler.process(element.select))) - return sql - - -def upgrade(): - # Table definitions below are only used for sqlalchemy to generate - # SQL statements, so in networks/ports tables only required field - # are declared. Note that 'quantum_id' in OFC ID mapping tables - # will be renamed in a later patch (bug 1287432). - - if not migration.schema_has_table('ofctenants'): - # Assume that, in the database we are migrating from, the - # configured plugin did not create any ofc tables. - return - - ofctenants = sa_expr.table( - 'ofctenants', - sa_expr.column('id'), - sa_expr.column('quantum_id')) - ofcnetworks = sa_expr.table( - 'ofcnetworks', - sa_expr.column('id'), - sa_expr.column('quantum_id')) - ofcports = sa_expr.table( - 'ofcports', - sa_expr.column('id'), - sa_expr.column('quantum_id')) - ofcfilters = sa_expr.table( - 'ofcfilters', - sa_expr.column('id'), - sa_expr.column('quantum_id')) - - ofctenantmappings = sa_expr.table( - 'ofctenantmappings', - sa_expr.column('ofc_id'), - sa_expr.column('quantum_id')) - ofcnetworkmappings = sa_expr.table( - 'ofcnetworkmappings', - sa_expr.column('ofc_id'), - sa_expr.column('quantum_id')) - ofcportmappings = sa_expr.table( - 'ofcportmappings', - sa_expr.column('ofc_id'), - sa_expr.column('quantum_id')) - ofcfiltermappings = sa_expr.table( - 'ofcfiltermappings', - sa_expr.column('ofc_id'), - sa_expr.column('quantum_id')) - - networks = sa_expr.table( - 'networks', - sa_expr.column('id'), - sa_expr.column('tenant_id')) - ports = sa_expr.table( - 'ports', - sa_expr.column('id'), - sa_expr.column('network_id')) - - # ofctenants -> ofctenantmappings - select_obj = sa.select([ofctenants.c.quantum_id, - op.inline_literal('/tenants/') + ofctenants.c.id]) - stmt = InsertFromSelect([ofctenantmappings.c.quantum_id, - ofctenantmappings.c.ofc_id], - select_obj) - op.execute(stmt) - - # ofcnetworks -> ofcnetworkmappings - select_obj = ofcnetworks.join( - networks, - ofcnetworks.c.quantum_id == networks.c.id) - select_obj = select_obj.join( - ofctenantmappings, - ofctenantmappings.c.quantum_id == networks.c.tenant_id) - select_obj = sa.select( - [ofcnetworks.c.quantum_id, - (ofctenantmappings.c.ofc_id + - op.inline_literal('/networks/') + ofcnetworks.c.id)], - from_obj=select_obj) - stmt = InsertFromSelect([ofcnetworkmappings.c.quantum_id, - ofcnetworkmappings.c.ofc_id], - select_obj) - op.execute(stmt) - - # ofcports -> ofcportmappings - select_obj = ofcports.join(ports, ofcports.c.quantum_id == ports.c.id) - select_obj = select_obj.join( - ofcnetworkmappings, - ofcnetworkmappings.c.quantum_id == ports.c.network_id) - select_obj = sa.select( - [ofcports.c.quantum_id, - (ofcnetworkmappings.c.ofc_id + - op.inline_literal('/ports/') + ofcports.c.id)], - from_obj=select_obj) - stmt = InsertFromSelect([ofcportmappings.c.quantum_id, - ofcportmappings.c.ofc_id], - select_obj) - op.execute(stmt) - - # ofcfilters -> ofcfiltermappings - select_obj = sa.select([ofcfilters.c.quantum_id, - op.inline_literal('/filters/') + ofcfilters.c.id]) - stmt = InsertFromSelect([ofcfiltermappings.c.quantum_id, - ofcfiltermappings.c.ofc_id], - select_obj) - op.execute(stmt) - - # drop old mapping tables - op.drop_table('ofctenants') - op.drop_table('ofcnetworks') - op.drop_table('ofcports') - op.drop_table('ofcfilters') diff --git a/neutron/db/migration/alembic_migrations/versions/1421183d533f_nsx_dhcp_metadata.py b/neutron/db/migration/alembic_migrations/versions/1421183d533f_nsx_dhcp_metadata.py deleted file mode 100644 index 6b8630c0d..000000000 --- a/neutron/db/migration/alembic_migrations/versions/1421183d533f_nsx_dhcp_metadata.py +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright 2014 VMware, Inc. - -# All Rights Reserved -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""NSX DHCP/metadata support - -Revision ID: 1421183d533f -Revises: 50e86cb2637a -Create Date: 2013-10-11 14:33:37.303215 - -""" - -revision = '1421183d533f' -down_revision = '50e86cb2637a' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.create_table( - 'lsn', - sa.Column('net_id', - sa.String(length=36), nullable=False), - sa.Column('lsn_id', - sa.String(length=36), nullable=False), - sa.PrimaryKeyConstraint('lsn_id')) - - op.create_table( - 'lsn_port', - sa.Column('lsn_port_id', - sa.String(length=36), nullable=False), - sa.Column('lsn_id', - sa.String(length=36), nullable=False), - sa.Column('sub_id', - sa.String(length=36), nullable=False, unique=True), - sa.Column('mac_addr', - sa.String(length=32), nullable=False, unique=True), - sa.ForeignKeyConstraint(['lsn_id'], ['lsn.lsn_id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('lsn_port_id')) diff --git a/neutron/db/migration/alembic_migrations/versions/157a5d299379_ml2_binding_profile.py b/neutron/db/migration/alembic_migrations/versions/157a5d299379_ml2_binding_profile.py deleted file mode 100644 index e127ff919..000000000 --- a/neutron/db/migration/alembic_migrations/versions/157a5d299379_ml2_binding_profile.py +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""ml2 binding:profile - -Revision ID: 157a5d299379 -Revises: 50d5ba354c23 -Create Date: 2014-02-13 23:48:25.147279 - -""" - -# revision identifiers, used by Alembic. -revision = '157a5d299379' -down_revision = '50d5ba354c23' - -from alembic import op -import sqlalchemy as sa - -from neutron.db import migration - - -def upgrade(): - if migration.schema_has_table('ml2_port_bindings'): - op.add_column('ml2_port_bindings', - sa.Column('profile', sa.String(length=4095), - nullable=False, server_default='')) diff --git a/neutron/db/migration/alembic_migrations/versions/1680e1f0c4dc_remove_cisco_nexus_plugin.py b/neutron/db/migration/alembic_migrations/versions/1680e1f0c4dc_remove_cisco_nexus_plugin.py deleted file mode 100644 index ff85cb133..000000000 --- a/neutron/db/migration/alembic_migrations/versions/1680e1f0c4dc_remove_cisco_nexus_plugin.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""Remove Cisco Nexus Monolithic Plugin - -Revision ID: 1680e1f0c4dc -Revises: 3c346828361e -Create Date: 2014-08-31 08:58:37.123992 - -""" - -# revision identifiers, used by Alembic. -revision = '1680e1f0c4dc' -down_revision = '3c346828361e' - -from alembic import op - - -def upgrade(): - op.execute('INSERT INTO cisco_ml2_nexusport_bindings (port_id, ' - 'vlan_id, switch_ip, instance_id) SELECT ' - 'port_id, vlan_id, switch_ip, instance_id FROM ' - 'cisco_nexusport_bindings') - op.drop_table('cisco_nexusport_bindings') diff --git a/neutron/db/migration/alembic_migrations/versions/16a27a58e093_ext_l3_ha_mode.py b/neutron/db/migration/alembic_migrations/versions/16a27a58e093_ext_l3_ha_mode.py deleted file mode 100644 index 63d304d99..000000000 --- a/neutron/db/migration/alembic_migrations/versions/16a27a58e093_ext_l3_ha_mode.py +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""ext_l3_ha_mode - -Revision ID: 16a27a58e093 -Revises: 86d6d9776e2b -Create Date: 2014-02-01 10:24:12.412733 - -""" - -# revision identifiers, used by Alembic. -revision = '16a27a58e093' -down_revision = '86d6d9776e2b' - - -from alembic import op -import sqlalchemy as sa - -l3_ha_states = sa.Enum('active', 'standby', name='l3_ha_states') - - -def upgrade(active_plugins=None, options=None): - op.add_column('router_extra_attributes', - sa.Column('ha', sa.Boolean(), - nullable=False, - server_default=sa.sql.false())) - op.add_column('router_extra_attributes', - sa.Column('ha_vr_id', sa.Integer())) - - op.create_table('ha_router_agent_port_bindings', - sa.Column('port_id', sa.String(length=36), - nullable=False), - sa.Column('router_id', sa.String(length=36), - nullable=False), - sa.Column('l3_agent_id', sa.String(length=36), - nullable=True), - sa.Column('state', l3_ha_states, - server_default='standby'), - sa.PrimaryKeyConstraint('port_id'), - sa.ForeignKeyConstraint(['port_id'], ['ports.id'], - ondelete='CASCADE'), - sa.ForeignKeyConstraint(['router_id'], ['routers.id'], - ondelete='CASCADE'), - sa.ForeignKeyConstraint(['l3_agent_id'], ['agents.id'], - ondelete='CASCADE')) - - op.create_table('ha_router_networks', - sa.Column('tenant_id', sa.String(length=255), - nullable=False, primary_key=True), - sa.Column('network_id', sa.String(length=36), - nullable=False, - primary_key=True), - sa.ForeignKeyConstraint(['network_id'], ['networks.id'], - ondelete='CASCADE')) - - op.create_table('ha_router_vrid_allocations', - sa.Column('network_id', sa.String(length=36), - nullable=False, - primary_key=True), - sa.Column('vr_id', sa.Integer(), - nullable=False, - primary_key=True), - sa.ForeignKeyConstraint(['network_id'], ['networks.id'], - ondelete='CASCADE')) diff --git a/neutron/db/migration/alembic_migrations/versions/19180cf98af6_nsx_gw_devices.py b/neutron/db/migration/alembic_migrations/versions/19180cf98af6_nsx_gw_devices.py deleted file mode 100644 index b556d541a..000000000 --- a/neutron/db/migration/alembic_migrations/versions/19180cf98af6_nsx_gw_devices.py +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""nsx_gw_devices - -Revision ID: 19180cf98af6 -Revises: 117643811bca -Create Date: 2014-02-26 02:46:26.151741 - -""" - -# revision identifiers, used by Alembic. -revision = '19180cf98af6' -down_revision = '117643811bca' - -from alembic import op -import sqlalchemy as sa - -from neutron.db import migration - - -def upgrade(): - - if not migration.schema_has_table('networkgatewaydevices'): - # Assume that, in the database we are migrating from, the - # configured plugin did not create any nsx tables. - return - - op.create_table( - 'networkgatewaydevicereferences', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('network_gateway_id', sa.String(length=36), nullable=True), - sa.Column('interface_name', sa.String(length=64), nullable=True), - sa.ForeignKeyConstraint(['network_gateway_id'], ['networkgateways.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('id', 'network_gateway_id', 'interface_name')) - # Copy data from networkgatewaydevices into networkgatewaydevicereference - op.execute("INSERT INTO networkgatewaydevicereferences SELECT " - "id, network_gateway_id, interface_name FROM " - "networkgatewaydevices") - # drop networkgatewaydevices - op.drop_table('networkgatewaydevices') - op.create_table( - 'networkgatewaydevices', - sa.Column('tenant_id', sa.String(length=255), nullable=True), - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('nsx_id', sa.String(length=36), nullable=True), - sa.Column('name', sa.String(length=255), nullable=True), - sa.Column('connector_type', sa.String(length=10), nullable=True), - sa.Column('connector_ip', sa.String(length=64), nullable=True), - sa.Column('status', sa.String(length=16), nullable=True), - sa.PrimaryKeyConstraint('id')) - # Create a networkgatewaydevice for each existing reference. - # For existing references nsx_id == neutron_id - # Do not fill conenctor info as they would be unknown - op.execute("INSERT INTO networkgatewaydevices (id, nsx_id, tenant_id) " - "SELECT gw_dev_ref.id, gw_dev_ref.id as nsx_id, tenant_id " - "FROM networkgatewaydevicereferences AS gw_dev_ref " - "INNER JOIN networkgateways AS net_gw ON " - "gw_dev_ref.network_gateway_id=net_gw.id") diff --git a/neutron/db/migration/alembic_migrations/versions/1b2580001654_nsx_sec_group_mappin.py b/neutron/db/migration/alembic_migrations/versions/1b2580001654_nsx_sec_group_mappin.py deleted file mode 100644 index 33976dec8..000000000 --- a/neutron/db/migration/alembic_migrations/versions/1b2580001654_nsx_sec_group_mappin.py +++ /dev/null @@ -1,50 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""nsx_sec_group_mapping - -Revision ID: 1b2580001654 -Revises: abc88c33f74f -Create Date: 2013-12-27 13:02:42.894648 - -""" - -# revision identifiers, used by Alembic. -revision = '1b2580001654' -down_revision = 'abc88c33f74f' - -from alembic import op -import sqlalchemy as sa - -from neutron.db import migration - - -def upgrade(): - - if not migration.schema_has_table('securitygroups'): - # Assume that, in the database we are migrating from, the - # configured plugin did not create the securitygroups table. - return - - # Create table for security group mappings - op.create_table( - 'neutron_nsx_security_group_mappings', - sa.Column('neutron_id', sa.String(length=36), nullable=False), - sa.Column('nsx_id', sa.String(length=36), nullable=False), - sa.ForeignKeyConstraint(['neutron_id'], ['securitygroups.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('neutron_id', 'nsx_id')) - # Execute statement to add a record in security group mappings for - # each record in securitygroups - op.execute("INSERT INTO neutron_nsx_security_group_mappings SELECT id,id " - "from securitygroups") diff --git a/neutron/db/migration/alembic_migrations/versions/1b837a7125a9_cisco_apic_driver.py b/neutron/db/migration/alembic_migrations/versions/1b837a7125a9_cisco_apic_driver.py deleted file mode 100644 index fb4b75f61..000000000 --- a/neutron/db/migration/alembic_migrations/versions/1b837a7125a9_cisco_apic_driver.py +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""Cisco APIC Mechanism Driver - -Revision ID: 1b837a7125a9 -Revises: 6be312499f9 -Create Date: 2014-02-13 09:35:19.147619 - -""" - -# revision identifiers, used by Alembic. -revision = '1b837a7125a9' -down_revision = '6be312499f9' - - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.create_table( - 'cisco_ml2_apic_epgs', - sa.Column('network_id', sa.String(length=255), nullable=False), - sa.Column('epg_id', sa.String(length=64), nullable=False), - sa.Column('segmentation_id', sa.String(length=64), nullable=False), - sa.Column('provider', sa.Boolean(), default=False, nullable=False), - sa.PrimaryKeyConstraint('network_id')) - - op.create_table( - 'cisco_ml2_apic_port_profiles', - sa.Column('node_id', sa.String(length=255), nullable=False), - sa.Column('profile_id', sa.String(length=64), nullable=False), - sa.Column('hpselc_id', sa.String(length=64), nullable=False), - sa.Column('module', sa.String(length=10), nullable=False), - sa.Column('from_port', sa.Integer(), nullable=False), - sa.Column('to_port', sa.Integer(), nullable=False), - sa.PrimaryKeyConstraint('node_id')) - - op.create_table( - 'cisco_ml2_apic_contracts', - sa.Column('tenant_id', sa.String(length=255), nullable=False), - sa.Column('contract_id', sa.String(length=64), nullable=False), - sa.Column('filter_id', sa.String(length=64), nullable=False), - sa.PrimaryKeyConstraint('tenant_id')) diff --git a/neutron/db/migration/alembic_migrations/versions/1d6ee1ae5da5_db_healing.py b/neutron/db/migration/alembic_migrations/versions/1d6ee1ae5da5_db_healing.py deleted file mode 100644 index 404309685..000000000 --- a/neutron/db/migration/alembic_migrations/versions/1d6ee1ae5da5_db_healing.py +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""Include all tables and make migrations unconditional. - -Revision ID: db_healing -Revises: 5446f2a45467 -Create Date: 2014-05-29 10:52:43.898980 - -""" - -# revision identifiers, used by Alembic. -revision = 'db_healing' -down_revision = '5446f2a45467' - -from neutron.db.migration.alembic_migrations import heal_script - - -def upgrade(): - heal_script.heal() diff --git a/neutron/db/migration/alembic_migrations/versions/1e5dd1d09b22_set_not_null_fields_lb_stats.py b/neutron/db/migration/alembic_migrations/versions/1e5dd1d09b22_set_not_null_fields_lb_stats.py deleted file mode 100644 index feadfdc93..000000000 --- a/neutron/db/migration/alembic_migrations/versions/1e5dd1d09b22_set_not_null_fields_lb_stats.py +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""set_not_null_fields_lb_stats - -Revision ID: 1e5dd1d09b22 -Revises: 54f7549a0e5f -Create Date: 2014-03-17 11:00:35.370618 - -""" - -# revision identifiers, used by Alembic. -revision = '1e5dd1d09b22' -down_revision = '54f7549a0e5f' - -import sqlalchemy as sa - -from neutron.db import migration - - -@migration.skip_if_offline -def upgrade(): - migration.alter_column_if_exists( - 'poolstatisticss', 'bytes_in', - nullable=False, - existing_type=sa.BigInteger()) - migration.alter_column_if_exists( - 'poolstatisticss', 'bytes_out', - nullable=False, - existing_type=sa.BigInteger()) - migration.alter_column_if_exists( - 'poolstatisticss', 'active_connections', - nullable=False, - existing_type=sa.BigInteger()) - migration.alter_column_if_exists( - 'poolstatisticss', 'total_connections', - nullable=False, - existing_type=sa.BigInteger()) diff --git a/neutron/db/migration/alembic_migrations/versions/1fcfc149aca4_agents_unique_by_type_and_host.py b/neutron/db/migration/alembic_migrations/versions/1fcfc149aca4_agents_unique_by_type_and_host.py deleted file mode 100644 index f0291c42a..000000000 --- a/neutron/db/migration/alembic_migrations/versions/1fcfc149aca4_agents_unique_by_type_and_host.py +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 2013 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""Add a unique constraint on (agent_type, host) columns to prevent a race -condition when an agent entry is 'upserted'. - -Revision ID: 1fcfc149aca4 -Revises: e197124d4b9 -Create Date: 2013-11-27 18:35:28.148680 - -""" - -revision = '1fcfc149aca4' -down_revision = 'e197124d4b9' - -from alembic import op - -from neutron.db import migration - - -TABLE_NAME = 'agents' -UC_NAME = 'uniq_agents0agent_type0host' - - -def upgrade(): - - if not migration.schema_has_table(TABLE_NAME): - # Assume that, in the database we are migrating from, the - # configured plugin did not create the agents table. - return - - op.create_unique_constraint( - name=UC_NAME, - source=TABLE_NAME, - local_cols=['agent_type', 'host'] - ) diff --git a/neutron/db/migration/alembic_migrations/versions/236b90af57ab_ml2_refactor_for_dynamic_segments.py b/neutron/db/migration/alembic_migrations/versions/236b90af57ab_ml2_refactor_for_dynamic_segments.py deleted file mode 100644 index fa883778b..000000000 --- a/neutron/db/migration/alembic_migrations/versions/236b90af57ab_ml2_refactor_for_dynamic_segments.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""ml2_type_driver_refactor_dynamic_segments - -Revision ID: 236b90af57ab -Revises: 58fe87a01143 -Create Date: 2014-08-14 16:22:14.293788 - -""" - -# revision identifiers, used by Alembic. -revision = '236b90af57ab' -down_revision = '58fe87a01143' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - - op.add_column('ml2_network_segments', - sa.Column('is_dynamic', sa.Boolean(), nullable=False, - server_default=sa.sql.false())) diff --git a/neutron/db/migration/alembic_migrations/versions/2447ad0e9585_add_ipv6_mode_props.py b/neutron/db/migration/alembic_migrations/versions/2447ad0e9585_add_ipv6_mode_props.py deleted file mode 100644 index f6df6c4eb..000000000 --- a/neutron/db/migration/alembic_migrations/versions/2447ad0e9585_add_ipv6_mode_props.py +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -"""Add IPv6 Subnet properties - -Revision ID: 2447ad0e9585 -Revises: 33dd0a9fa487 -Create Date: 2013-10-23 16:36:44.188904 - -""" - -# revision identifiers, used by Alembic. -revision = '2447ad0e9585' -down_revision = '33dd0a9fa487' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - # Workaround for Alembic bug #89 - # https://bitbucket.org/zzzeek/alembic/issue/89 - context = op.get_context() - if context.bind.dialect.name == 'postgresql': - op.execute("CREATE TYPE ipv6_ra_modes AS ENUM ('%s', '%s', '%s')" - % ('slaac', 'dhcpv6-stateful', 'dhcpv6-stateless')) - op.execute("CREATE TYPE ipv6_address_modes AS ENUM ('%s', '%s', '%s')" - % ('slaac', 'dhcpv6-stateful', 'dhcpv6-stateless')) - op.add_column('subnets', - sa.Column('ipv6_ra_mode', - sa.Enum('slaac', - 'dhcpv6-stateful', - 'dhcpv6-stateless', - name='ipv6_ra_modes'), - nullable=True) - ) - op.add_column('subnets', - sa.Column('ipv6_address_mode', - sa.Enum('slaac', - 'dhcpv6-stateful', - 'dhcpv6-stateless', - name='ipv6_address_modes'), - nullable=True) - ) diff --git a/neutron/db/migration/alembic_migrations/versions/24c7ea5160d7_cisco_csr_vpnaas.py b/neutron/db/migration/alembic_migrations/versions/24c7ea5160d7_cisco_csr_vpnaas.py deleted file mode 100644 index 74a3b62d3..000000000 --- a/neutron/db/migration/alembic_migrations/versions/24c7ea5160d7_cisco_csr_vpnaas.py +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2014 Cisco Systems, Inc. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -"""Cisco CSR VPNaaS - - Revision ID: 24c7ea5160d7 - Revises: 492a106273f8 - Create Date: 2014-02-03 13:06:50.407601 -""" - -# revision identifiers, used by Alembic. -revision = '24c7ea5160d7' -down_revision = '492a106273f8' - -from alembic import op -import sqlalchemy as sa - -from neutron.db import migration - - -def upgrade(): - if not migration.schema_has_table('ipsec_site_connections'): - # The vpnaas service plugin was not configured. - return - op.create_table( - 'cisco_csr_identifier_map', - sa.Column('tenant_id', sa.String(length=255), nullable=True), - sa.Column('ipsec_site_conn_id', sa.String(length=64), - primary_key=True), - sa.Column('csr_tunnel_id', sa.Integer(), nullable=False), - sa.Column('csr_ike_policy_id', sa.Integer(), nullable=False), - sa.Column('csr_ipsec_policy_id', sa.Integer(), nullable=False), - sa.ForeignKeyConstraint(['ipsec_site_conn_id'], - ['ipsec_site_connections.id'], - ondelete='CASCADE') - ) diff --git a/neutron/db/migration/alembic_migrations/versions/27cc183af192_ml2_vnic_type.py b/neutron/db/migration/alembic_migrations/versions/27cc183af192_ml2_vnic_type.py deleted file mode 100644 index 1a302ff11..000000000 --- a/neutron/db/migration/alembic_migrations/versions/27cc183af192_ml2_vnic_type.py +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""ml2_vnic_type - -Revision ID: 27cc183af192 -Revises: 4ca36cfc898c -Create Date: 2014-02-09 12:19:21.362967 - -""" - -# revision identifiers, used by Alembic. -revision = '27cc183af192' -down_revision = '4ca36cfc898c' - -from alembic import op -import sqlalchemy as sa - -from neutron.db import migration - - -def upgrade(): - if migration.schema_has_table('ml2_port_bindings'): - op.add_column('ml2_port_bindings', - sa.Column('vnic_type', sa.String(length=64), - nullable=False, - server_default='normal')) diff --git a/neutron/db/migration/alembic_migrations/versions/2db5203cb7a9_nuage_floatingip.py b/neutron/db/migration/alembic_migrations/versions/2db5203cb7a9_nuage_floatingip.py deleted file mode 100644 index cdd18c217..000000000 --- a/neutron/db/migration/alembic_migrations/versions/2db5203cb7a9_nuage_floatingip.py +++ /dev/null @@ -1,80 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""nuage_floatingip - -Revision ID: 2db5203cb7a9 -Revises: 10cd28e692e9 -Create Date: 2014-05-19 16:39:42.048125 - -""" - -# revision identifiers, used by Alembic. -revision = '2db5203cb7a9' -down_revision = '10cd28e692e9' - - -from alembic import op -import sqlalchemy as sa - -from neutron.db import migration - -# This migration will be executed only if the neutron DB schema contains -# the tables for the nuage plugin. -# This migration will be skipped when executed in offline mode. - - -@migration.skip_if_offline -def upgrade(): - # These tables will be created even if the nuage plugin is not enabled. - # This is fine as they would be created anyway by the healing migration. - if migration.schema_has_table('routers'): - # In the database we are migrating from, the configured plugin - # did not create the routers table. - op.create_table( - 'nuage_floatingip_pool_mapping', - sa.Column('fip_pool_id', sa.String(length=36), nullable=False), - sa.Column('net_id', sa.String(length=36), nullable=True), - sa.Column('router_id', sa.String(length=36), nullable=True), - sa.ForeignKeyConstraint(['net_id'], ['networks.id'], - ondelete='CASCADE'), - sa.ForeignKeyConstraint(['router_id'], ['routers.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('fip_pool_id'), - ) - if migration.schema_has_table('floatingips'): - # In the database we are migrating from, the configured plugin - # did not create the floatingips table. - op.create_table( - 'nuage_floatingip_mapping', - sa.Column('fip_id', sa.String(length=36), nullable=False), - sa.Column('router_id', sa.String(length=36), nullable=True), - sa.Column('nuage_fip_id', sa.String(length=36), nullable=True), - sa.ForeignKeyConstraint(['fip_id'], ['floatingips.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('fip_id'), - ) - migration.rename_table_if_exists('net_partitions', - 'nuage_net_partitions') - migration.rename_table_if_exists('net_partition_router_mapping', - 'nuage_net_partition_router_mapping') - migration.rename_table_if_exists('router_zone_mapping', - 'nuage_router_zone_mapping') - migration.rename_table_if_exists('subnet_l2dom_mapping', - 'nuage_subnet_l2dom_mapping') - migration.rename_table_if_exists('port_mapping', - 'nuage_port_mapping') - migration.rename_table_if_exists('routerroutes_mapping', - 'nuage_routerroutes_mapping') diff --git a/neutron/db/migration/alembic_migrations/versions/2eeaf963a447_floatingip_status.py b/neutron/db/migration/alembic_migrations/versions/2eeaf963a447_floatingip_status.py deleted file mode 100644 index 8bd9a15f1..000000000 --- a/neutron/db/migration/alembic_migrations/versions/2eeaf963a447_floatingip_status.py +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""floatingip_status - -Revision ID: 2eeaf963a447 -Revises: e766b19a3bb -Create Date: 2014-01-14 11:58:13.754747 - -""" - -# revision identifiers, used by Alembic. -revision = '2eeaf963a447' -down_revision = 'e766b19a3bb' - -from alembic import op -import sqlalchemy as sa - -from neutron.db import migration - - -def upgrade(): - - if not migration.schema_has_table('floatingips'): - # In the database we are migrating from, the configured plugin - # did not create the floatingips table. - return - - op.add_column('floatingips', - sa.Column('last_known_router_id', - sa.String(length=36), - nullable=True)) - op.add_column('floatingips', - sa.Column('status', - sa.String(length=16), - nullable=True)) diff --git a/neutron/db/migration/alembic_migrations/versions/31d7f831a591_add_constraint_for_routerid.py b/neutron/db/migration/alembic_migrations/versions/31d7f831a591_add_constraint_for_routerid.py deleted file mode 100644 index c9a233b66..000000000 --- a/neutron/db/migration/alembic_migrations/versions/31d7f831a591_add_constraint_for_routerid.py +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""add constraint for routerid - -Revision ID: 31d7f831a591 -Revises: 37f322991f59 -Create Date: 2014-02-26 06:47:16.494393 - -""" - -# revision identifiers, used by Alembic. -revision = '31d7f831a591' -down_revision = '37f322991f59' - -from alembic import op - -from neutron.db import migration - -TABLE_NAME = 'routerl3agentbindings' -AGENTS_TABLE_NAME = 'agents' -PK_NAME = 'pk_routerl3agentbindings' - - -def upgrade(): - # In order to sanitize the data during migration, - # the current records in the table need to be verified - # and all the duplicate records which violate the PK - # constraint need to be removed. - context = op.get_context() - query_args = {'table': TABLE_NAME, 'agents_table': AGENTS_TABLE_NAME} - if context.bind.dialect.name in ('postgresql', 'ibm_db_sa'): - op.execute('DELETE FROM %(table)s WHERE id in (' - 'SELECT %(table)s.id FROM %(table)s LEFT OUTER JOIN ' - '(SELECT MIN(id) as id, router_id, l3_agent_id ' - ' FROM %(table)s GROUP BY router_id, l3_agent_id) AS temp ' - 'ON %(table)s.id = temp.id WHERE temp.id is NULL);' - % query_args) - else: - op.execute('DELETE %(table)s FROM %(table)s LEFT OUTER JOIN ' - '(SELECT MIN(id) as id, router_id, l3_agent_id ' - ' FROM %(table)s GROUP BY router_id, l3_agent_id) AS temp ' - 'ON %(table)s.id = temp.id WHERE temp.id is NULL;' - % query_args) - # Remove orphaned records - bindings that reference non-existent agents - op.execute('DELETE FROM %(table)s ' - 'WHERE l3_agent_id NOT IN (select id from %(agents_table)s);' - % query_args) - - op.drop_column(TABLE_NAME, 'id') - - with migration.remove_fks_from_table(TABLE_NAME): - # DB2 doesn't support nullable column in primary key - if context.bind.dialect.name == 'ibm_db_sa': - op.alter_column( - table_name=TABLE_NAME, - column_name='router_id', - nullable=False - ) - op.alter_column( - table_name=TABLE_NAME, - column_name='l3_agent_id', - nullable=False - ) - - op.create_primary_key( - name=PK_NAME, - table_name=TABLE_NAME, - cols=['router_id', 'l3_agent_id'] - ) diff --git a/neutron/db/migration/alembic_migrations/versions/327ee5fde2c7_set_innodb_engine.py b/neutron/db/migration/alembic_migrations/versions/327ee5fde2c7_set_innodb_engine.py deleted file mode 100644 index 62c81c91e..000000000 --- a/neutron/db/migration/alembic_migrations/versions/327ee5fde2c7_set_innodb_engine.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""set_innodb_engine - -Revision ID: 327ee5fde2c7 -Revises: 2026156eab2f -Create Date: 2014-07-24 12:00:38.791287 - -""" - -# revision identifiers, used by Alembic. -revision = '327ee5fde2c7' -down_revision = '4eba2f05c2f4' - - -from alembic import op - -# This list contain tables that could be deployed before change that converts -# all tables to InnoDB appeared -TABLES = ['router_extra_attributes', 'dvr_host_macs', 'ml2_dvr_port_bindings', - 'csnat_l3_agent_bindings'] - - -def upgrade(): - if op.get_bind().dialect.name == 'mysql': - for table in TABLES: - op.execute("ALTER TABLE %s ENGINE=InnoDB" % table) diff --git a/neutron/db/migration/alembic_migrations/versions/32f3915891fd_cisco_apic_driver_update.py b/neutron/db/migration/alembic_migrations/versions/32f3915891fd_cisco_apic_driver_update.py deleted file mode 100644 index 03b52cf99..000000000 --- a/neutron/db/migration/alembic_migrations/versions/32f3915891fd_cisco_apic_driver_update.py +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -""" cisco_apic_driver_update - -Revision ID: 32f3915891fd - -""" - -# revision identifiers, used by Alembic. -revision = '32f3915891fd' -down_revision = 'aae5706a396' - - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - - op.drop_table('cisco_ml2_apic_port_profiles') - - op.create_table( - 'cisco_ml2_apic_host_links', - sa.Column('host', sa.String(length=255), nullable=False), - sa.Column('ifname', sa.String(length=64), nullable=False), - sa.Column('ifmac', sa.String(length=32), nullable=True), - sa.Column('swid', sa.String(length=32), nullable=False), - sa.Column('module', sa.String(length=32), nullable=False), - sa.Column('port', sa.String(length=32), nullable=False), - sa.PrimaryKeyConstraint('host', 'ifname')) - - op.create_table( - 'cisco_ml2_apic_names', - sa.Column('neutron_id', sa.String(length=36), nullable=False), - sa.Column('neutron_type', sa.String(length=32), nullable=False), - sa.Column('apic_name', sa.String(length=255), nullable=False), - sa.PrimaryKeyConstraint('neutron_id', 'neutron_type')) diff --git a/neutron/db/migration/alembic_migrations/versions/33c3db036fe4_set_length_of_description_field_metering.py b/neutron/db/migration/alembic_migrations/versions/33c3db036fe4_set_length_of_description_field_metering.py deleted file mode 100644 index b2a79f756..000000000 --- a/neutron/db/migration/alembic_migrations/versions/33c3db036fe4_set_length_of_description_field_metering.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""set_length_of_description_field_metering - -Revision ID: 33c3db036fe4 -Revises: b65aa907aec -Create Date: 2014-03-25 11:04:27.341830 - -""" - -# revision identifiers, used by Alembic. -revision = '33c3db036fe4' -down_revision = 'b65aa907aec' - -from alembic import op -import sqlalchemy as sa - -from neutron.db import migration -from neutron.db.migration.alembic_migrations import metering_init_ops - - -def upgrade(): - if migration.schema_has_table('meteringlabels'): - op.alter_column('meteringlabels', 'description', type_=sa.String(1024), - existing_nullable=True) - else: - metering_init_ops.create_meteringlabels() diff --git a/neutron/db/migration/alembic_migrations/versions/33dd0a9fa487_embrane_lbaas_driver.py b/neutron/db/migration/alembic_migrations/versions/33dd0a9fa487_embrane_lbaas_driver.py deleted file mode 100644 index 42acf52f9..000000000 --- a/neutron/db/migration/alembic_migrations/versions/33dd0a9fa487_embrane_lbaas_driver.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""embrane_lbaas_driver - -Revision ID: 33dd0a9fa487 -Revises: 19180cf98af6 -Create Date: 2014-02-25 00:15:35.567111 - -""" - -# revision identifiers, used by Alembic. -revision = '33dd0a9fa487' -down_revision = '19180cf98af6' - -from alembic import op -import sqlalchemy as sa - -from neutron.db import migration - - -def upgrade(): - if not migration.schema_has_table('pools'): - # The lbaas service plugin was not configured. - return - op.create_table( - u'embrane_pool_port', - sa.Column(u'pool_id', sa.String(length=36), nullable=False), - sa.Column(u'port_id', sa.String(length=36), nullable=False), - sa.ForeignKeyConstraint(['pool_id'], [u'pools.id'], - name=u'embrane_pool_port_ibfk_1'), - sa.ForeignKeyConstraint(['port_id'], [u'ports.id'], - name=u'embrane_pool_port_ibfk_2'), - sa.PrimaryKeyConstraint(u'pool_id')) diff --git a/neutron/db/migration/alembic_migrations/versions/37f322991f59_nuage_removing_mapping_tables.py b/neutron/db/migration/alembic_migrations/versions/37f322991f59_nuage_removing_mapping_tables.py deleted file mode 100644 index 6a8ac26cd..000000000 --- a/neutron/db/migration/alembic_migrations/versions/37f322991f59_nuage_removing_mapping_tables.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""removing_mapping_tables - -Revision ID: 37f322991f59 -Revises: 2026156eab2f -Create Date: 2014-07-09 17:25:29.242948 - -""" - -# revision identifiers, used by Alembic. -revision = '37f322991f59' -down_revision = '2026156eab2f' - -from alembic import op - - -def upgrade(): - op.drop_table('nuage_floatingip_mapping') - op.drop_table('nuage_floatingip_pool_mapping') - op.drop_table('nuage_routerroutes_mapping') - op.drop_table('nuage_port_mapping') - op.drop_table('nuage_router_zone_mapping') diff --git a/neutron/db/migration/alembic_migrations/versions/3927f7f7c456_l3_extension_distributed_mode.py b/neutron/db/migration/alembic_migrations/versions/3927f7f7c456_l3_extension_distributed_mode.py deleted file mode 100644 index ce2014233..000000000 --- a/neutron/db/migration/alembic_migrations/versions/3927f7f7c456_l3_extension_distributed_mode.py +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""L3 extension distributed mode - -Revision ID: 3927f7f7c456 -Revises: db_healing -Create Date: 2014-04-02 23:26:19.303633 -""" - -# revision identifiers, used by Alembic. -revision = '3927f7f7c456' -down_revision = 'db_healing' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - context = op.get_context() - op.create_table( - 'router_extra_attributes', - sa.Column('router_id', sa.String(length=36), nullable=False), - sa.Column('distributed', sa.Boolean(), nullable=False, - server_default=sa.sql.false()), - sa.ForeignKeyConstraint( - ['router_id'], ['routers.id'], ondelete='CASCADE'), - sa.PrimaryKeyConstraint('router_id') - ) - if context.bind.dialect.name == 'ibm_db_sa': - # NOTE(mriedem): DB2 stores booleans as 0 and 1. - op.execute("INSERT INTO router_extra_attributes " - "SELECT id as router_id, " - "0 as distributed from routers") - else: - op.execute("INSERT INTO router_extra_attributes " - "SELECT id as router_id, " - "False as distributed from routers") diff --git a/neutron/db/migration/alembic_migrations/versions/3b85b693a95f_remove_service_tables.py b/neutron/db/migration/alembic_migrations/versions/3b85b693a95f_remove_service_tables.py deleted file mode 100644 index df97e4cf9..000000000 --- a/neutron/db/migration/alembic_migrations/versions/3b85b693a95f_remove_service_tables.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""Drop unused servicedefinitions and servicetypes tables. - -These tables are created independently on plugins but only dropped if -LoadBalancer plugin is used. Meaning that if LoadBalancer plugin is not set -then these tables were created and never used. - -Revision ID: 3b85b693a95f -Revises: 327ee5fde2c7 -Create Date: 2014-07-22 03:30:05.837152 - -""" - -# revision identifiers, used by Alembic. -revision = '3b85b693a95f' -down_revision = '327ee5fde2c7' - -from alembic import op - -from neutron.db import migration - - -def upgrade(): - for table in ('servicedefinitions', 'servicetypes'): - if migration.schema_has_table(table): - op.drop_table(table) diff --git a/neutron/db/migration/alembic_migrations/versions/3c346828361e_metering_label_shared.py b/neutron/db/migration/alembic_migrations/versions/3c346828361e_metering_label_shared.py deleted file mode 100644 index 3ab624357..000000000 --- a/neutron/db/migration/alembic_migrations/versions/3c346828361e_metering_label_shared.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""metering_label_shared - -Revision ID: 3c346828361e -Revises: 16a27a58e093 -Create Date: 2014-08-27 15:03:46.537290 - -""" - -# revision identifiers, used by Alembic. -revision = '3c346828361e' -down_revision = '16a27a58e093' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.add_column('meteringlabels', sa.Column('shared', sa.Boolean(), - server_default=sa.sql.false(), - nullable=True)) diff --git a/neutron/db/migration/alembic_migrations/versions/3d2585038b95_vmware_nsx.py b/neutron/db/migration/alembic_migrations/versions/3d2585038b95_vmware_nsx.py deleted file mode 100644 index acba275f8..000000000 --- a/neutron/db/migration/alembic_migrations/versions/3d2585038b95_vmware_nsx.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""VMware NSX rebranding - -Revision ID: 3d2585038b95 -Revises: 157a5d299379 -Create Date: 2014-02-11 18:18:34.319031 - -""" - -# revision identifiers, used by Alembic. -revision = '3d2585038b95' -down_revision = '157a5d299379' - -from alembic import op - -from neutron.db import migration - - -def upgrade(): - - if not migration.schema_has_table('nvp_network_bindings'): - # Assume that, in the database we are migrating from, the - # configured plugin did not create any nvp tables. - return - - op.rename_table('nvp_network_bindings', 'tz_network_bindings') - op.rename_table('nvp_multi_provider_networks', 'multi_provider_networks') - - engine = op.get_bind().engine - if engine.name == 'postgresql': - op.execute("ALTER TYPE nvp_network_bindings_binding_type " - "RENAME TO tz_network_bindings_binding_type;") diff --git a/neutron/db/migration/alembic_migrations/versions/3d3cb89d84ee_nsx_switch_mappings.py b/neutron/db/migration/alembic_migrations/versions/3d3cb89d84ee_nsx_switch_mappings.py deleted file mode 100644 index 093087726..000000000 --- a/neutron/db/migration/alembic_migrations/versions/3d3cb89d84ee_nsx_switch_mappings.py +++ /dev/null @@ -1,40 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""nsx_switch_mappings - -Revision ID: 3d3cb89d84ee -Revises: 1421183d533f -Create Date: 2014-01-07 15:37:41.323020 - -""" - -# revision identifiers, used by Alembic. -revision = '3d3cb89d84ee' -down_revision = '1421183d533f' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - # Create table for network mappings - op.create_table( - 'neutron_nsx_network_mappings', - sa.Column('neutron_id', sa.String(length=36), nullable=False), - sa.Column('nsx_id', sa.String(length=36), nullable=True), - sa.ForeignKeyConstraint(['neutron_id'], ['networks.id'], - ondelete='CASCADE'), - # There might be multiple switches for a neutron network - sa.PrimaryKeyConstraint('neutron_id', 'nsx_id'), - ) diff --git a/neutron/db/migration/alembic_migrations/versions/492a106273f8_brocade_ml2_mech_dri.py b/neutron/db/migration/alembic_migrations/versions/492a106273f8_brocade_ml2_mech_dri.py deleted file mode 100644 index 055b69d17..000000000 --- a/neutron/db/migration/alembic_migrations/versions/492a106273f8_brocade_ml2_mech_dri.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""Brocade ML2 Mech. Driver - -Revision ID: 492a106273f8 -Revises: 2eeaf963a447 -Create Date: 2014-03-03 15:35:46.974523 - -""" - -# revision identifiers, used by Alembic. -revision = '492a106273f8' -down_revision = '2eeaf963a447' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.create_table( - 'ml2_brocadenetworks', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('vlan', sa.String(length=10), nullable=True), - sa.Column('segment_id', sa.String(length=36), nullable=True), - sa.Column('network_type', sa.String(length=10), nullable=True), - sa.Column('tenant_id', sa.String(length=255), nullable=True), - sa.PrimaryKeyConstraint('id')) - - op.create_table( - 'ml2_brocadeports', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('network_id', sa.String(length=36), nullable=False), - sa.Column('admin_state_up', sa.Boolean()), - sa.Column('physical_interface', sa.String(length=36), nullable=True), - sa.Column('vlan_id', sa.String(length=36), nullable=True), - sa.Column('tenant_id', sa.String(length=255), nullable=True), - sa.PrimaryKeyConstraint('id'), - sa.ForeignKeyConstraint(['network_id'], ['ml2_brocadenetworks.id'])) diff --git a/neutron/db/migration/alembic_migrations/versions/4ca36cfc898c_nsx_router_mappings.py b/neutron/db/migration/alembic_migrations/versions/4ca36cfc898c_nsx_router_mappings.py deleted file mode 100644 index 1faf1c7ca..000000000 --- a/neutron/db/migration/alembic_migrations/versions/4ca36cfc898c_nsx_router_mappings.py +++ /dev/null @@ -1,51 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""nsx_router_mappings - -Revision ID: 4ca36cfc898c -Revises: 3d3cb89d84ee -Create Date: 2014-01-08 10:41:43.373031 - -""" - -# revision identifiers, used by Alembic. -revision = '4ca36cfc898c' -down_revision = '3d3cb89d84ee' - -from alembic import op -import sqlalchemy as sa - -from neutron.db import migration - - -def upgrade(): - - if not migration.schema_has_table('routers'): - # In the database we are migrating from, the configured plugin - # did not create the routers table. - return - - # Create table for router/lrouter mappings - op.create_table( - 'neutron_nsx_router_mappings', - sa.Column('neutron_id', sa.String(length=36), nullable=False), - sa.Column('nsx_id', sa.String(length=36), nullable=True), - sa.ForeignKeyConstraint(['neutron_id'], ['routers.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('neutron_id'), - ) - # Execute statement to a record in nsx_router_mappings for - # each record in routers - op.execute("INSERT INTO neutron_nsx_router_mappings SELECT id,id " - "from routers") diff --git a/neutron/db/migration/alembic_migrations/versions/4eba2f05c2f4_correct_vxlan_endpoint_primary_key.py b/neutron/db/migration/alembic_migrations/versions/4eba2f05c2f4_correct_vxlan_endpoint_primary_key.py deleted file mode 100644 index 7fe8495c7..000000000 --- a/neutron/db/migration/alembic_migrations/versions/4eba2f05c2f4_correct_vxlan_endpoint_primary_key.py +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (c) 2014 Thales Services SAS -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""correct Vxlan Endpoint primary key - -Revision ID: 4eba2f05c2f4 -Revises: 884573acbf1c -Create Date: 2014-07-07 22:48:38.544323 - -""" - -# revision identifiers, used by Alembic. -revision = '4eba2f05c2f4' -down_revision = '884573acbf1c' - - -from alembic import op - - -TABLE_NAME = 'ml2_vxlan_endpoints' -PK_NAME = 'ml2_vxlan_endpoints_pkey' - - -def upgrade(): - op.drop_constraint(PK_NAME, TABLE_NAME, type_='primary') - op.create_primary_key(PK_NAME, TABLE_NAME, cols=['ip_address']) diff --git a/neutron/db/migration/alembic_migrations/versions/4eca4a84f08a_remove_ml2_cisco_cred_db.py b/neutron/db/migration/alembic_migrations/versions/4eca4a84f08a_remove_ml2_cisco_cred_db.py deleted file mode 100644 index 4b1551256..000000000 --- a/neutron/db/migration/alembic_migrations/versions/4eca4a84f08a_remove_ml2_cisco_cred_db.py +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""Remove ML2 Cisco Credentials DB - -Revision ID: 4eca4a84f08a -Revises: 33c3db036fe4 -Create Date: 2014-04-10 19:32:46.697189 - -""" - -# revision identifiers, used by Alembic. -revision = '4eca4a84f08a' -down_revision = '33c3db036fe4' - - -from alembic import op - -from neutron.db import migration - -TABLE = 'cisco_ml2_credentials' - - -def upgrade(): - if migration.schema_has_table(TABLE): - op.drop_table(TABLE) diff --git a/neutron/db/migration/alembic_migrations/versions/50d5ba354c23_ml2_binding_vif_details.py b/neutron/db/migration/alembic_migrations/versions/50d5ba354c23_ml2_binding_vif_details.py deleted file mode 100644 index 530d97294..000000000 --- a/neutron/db/migration/alembic_migrations/versions/50d5ba354c23_ml2_binding_vif_details.py +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""ml2 binding:vif_details - -Revision ID: 50d5ba354c23 -Revises: 27cc183af192 -Create Date: 2014-02-11 23:21:59.577972 - -""" - -# revision identifiers, used by Alembic. -revision = '50d5ba354c23' -down_revision = '27cc183af192' - -from alembic import op -import sqlalchemy as sa - -from neutron.db import migration - - -def upgrade(): - - if not migration.schema_has_table('ml2_port_bindings'): - # In the database we are migrating from, the configured plugin - # did not create the ml2_port_bindings table. - return - - op.add_column('ml2_port_bindings', - sa.Column('vif_details', sa.String(length=4095), - nullable=False, server_default='')) - if op.get_bind().engine.name == 'ibm_db_sa': - op.execute( - "UPDATE ml2_port_bindings SET" - " vif_details = '{\"port_filter\": true}'" - " WHERE cap_port_filter = 1") - op.execute( - "UPDATE ml2_port_bindings SET" - " vif_details = '{\"port_filter\": false}'" - " WHERE cap_port_filter = 0") - else: - op.execute( - "UPDATE ml2_port_bindings SET" - " vif_details = '{\"port_filter\": true}'" - " WHERE cap_port_filter = true") - op.execute( - "UPDATE ml2_port_bindings SET" - " vif_details = '{\"port_filter\": false}'" - " WHERE cap_port_filter = false") - op.drop_column('ml2_port_bindings', 'cap_port_filter') - if op.get_bind().engine.name == 'ibm_db_sa': - op.execute("CALL SYSPROC.ADMIN_CMD('REORG TABLE ml2_port_bindings')") diff --git a/neutron/db/migration/alembic_migrations/versions/50e86cb2637a_nsx_mappings.py b/neutron/db/migration/alembic_migrations/versions/50e86cb2637a_nsx_mappings.py deleted file mode 100644 index d4d25666c..000000000 --- a/neutron/db/migration/alembic_migrations/versions/50e86cb2637a_nsx_mappings.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright 2013 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""nsx_mappings - -Revision ID: 50e86cb2637a -Revises: 1fcfc149aca4 -Create Date: 2013-10-26 14:37:30.012149 - -""" - -# revision identifiers, used by Alembic. -revision = '50e86cb2637a' -down_revision = '1fcfc149aca4' - -from alembic import op -import sqlalchemy as sa - -from neutron.db import migration - - -def upgrade(): - op.create_table('neutron_nsx_port_mappings', - sa.Column('neutron_id', sa.String(length=36), - nullable=False), - sa.Column('nsx_port_id', sa.String(length=36), - nullable=False), - sa.Column('nsx_switch_id', sa.String(length=36), - nullable=True), - sa.ForeignKeyConstraint(['neutron_id'], ['ports.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('neutron_id')) - - if migration.schema_has_table('quantum_nvp_port_mapping'): - op.execute( - "INSERT INTO neutron_nsx_port_mappings SELECT quantum_id as " - "neutron_id, nvp_id as nsx_port_id, null as nsx_switch_id from" - " quantum_nvp_port_mapping") - op.drop_table('quantum_nvp_port_mapping') diff --git a/neutron/db/migration/alembic_migrations/versions/538732fa21e1_nec_rename_quantum_id_to_neutron_id.py b/neutron/db/migration/alembic_migrations/versions/538732fa21e1_nec_rename_quantum_id_to_neutron_id.py deleted file mode 100644 index e678d00da..000000000 --- a/neutron/db/migration/alembic_migrations/versions/538732fa21e1_nec_rename_quantum_id_to_neutron_id.py +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""NEC Rename quantum_id to neutron_id - -Revision ID: 538732fa21e1 -Revises: 2447ad0e9585 -Create Date: 2014-03-04 05:43:33.660601 - -""" - -# revision identifiers, used by Alembic. -revision = '538732fa21e1' -down_revision = '2447ad0e9585' - -from alembic import op -import sqlalchemy as sa - -from neutron.db import migration - - -def upgrade(): - - if not migration.schema_has_table('ofctenantmappings'): - # Assume that, in the database we are migrating from, the - # configured plugin did not create any ofc tables. - return - - for table in ['ofctenantmappings', 'ofcnetworkmappings', - 'ofcportmappings', 'ofcfiltermappings', - 'ofcroutermappings', - ]: - op.alter_column(table, 'quantum_id', - new_column_name='neutron_id', - existing_type=sa.String(length=36), - existing_nullable=False) diff --git a/neutron/db/migration/alembic_migrations/versions/544673ac99ab_add_router_port_table.py b/neutron/db/migration/alembic_migrations/versions/544673ac99ab_add_router_port_table.py deleted file mode 100644 index d3855a652..000000000 --- a/neutron/db/migration/alembic_migrations/versions/544673ac99ab_add_router_port_table.py +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""add router port relationship - -Revision ID: 544673ac99ab -Revises: 1680e1f0c4dc -Create Date: 2014-01-14 11:58:13.754747 - -""" - -# revision identifiers, used by Alembic. -revision = '544673ac99ab' -down_revision = '1680e1f0c4dc' - -from alembic import op -import sqlalchemy as sa - -SQL_STATEMENT = ( - "insert into routerports " - "select " - "p.device_id as router_id, p.id as port_id, p.device_owner as port_type " - "from ports p join routers r on (p.device_id=r.id) " - "where " - "(r.tenant_id=p.tenant_id AND p.device_owner='network:router_interface') " - "OR (p.tenant_id='' AND p.device_owner='network:router_gateway')" -) - - -def upgrade(): - op.create_table( - 'routerports', - sa.Column('router_id', sa.String(length=36), nullable=False), - sa.Column('port_id', sa.String(length=36), nullable=False), - sa.Column('port_type', sa.String(length=255)), - sa.PrimaryKeyConstraint('router_id', 'port_id'), - sa.ForeignKeyConstraint( - ['router_id'], - ['routers.id'], - ondelete='CASCADE' - ), - sa.ForeignKeyConstraint( - ['port_id'], - ['ports.id'], - ondelete='CASCADE' - ), - ) - - op.execute(SQL_STATEMENT) diff --git a/neutron/db/migration/alembic_migrations/versions/5446f2a45467_set_server_default.py b/neutron/db/migration/alembic_migrations/versions/5446f2a45467_set_server_default.py deleted file mode 100644 index 10e059a90..000000000 --- a/neutron/db/migration/alembic_migrations/versions/5446f2a45467_set_server_default.py +++ /dev/null @@ -1,139 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""set_server_default - -Revision ID: 5446f2a45467 -Revises: 2db5203cb7a9 -Create Date: 2014-07-07 18:31:30.384522 - -""" - -# revision identifiers, used by Alembic. -revision = '5446f2a45467' -down_revision = '2db5203cb7a9' - - -import sqlalchemy as sa -import sqlalchemy.sql - -from neutron.db import migration -from neutron.plugins.cisco.common import cisco_constants - -# This migration will be executed only if then Neutron db contains tables for -# selected plugins and agents. -# required tables and columns are: -# brocade_ports.port_id -# segmentation_id_llocation.allocated -# cisco_n1kv_profile_bindings.tenant_id -# cisco_network_profiles.multicast_ip_index -# cisco_n1kv_vlan_allocations.allocated -# nsxrouterextattributess.service_router -# nsxrouterextattributess.distributed -# qosqueues.default -# agents.admin_state_up -# ml2_gre_allocations.allocated -# ml2_vxlan_allocations.allocated -# This migration will be skipped when executed offline mode. - -default = sqlalchemy.sql.false() - - -def upgrade(): - run() - - -@migration.skip_if_offline -def run(): - set_default_ml2() - set_default_mlnx() - set_default_brocade() - set_default_cisco() - set_default_vmware() - set_default_agents() - - -def set_default_brocade(): - default = '' - migration.alter_column_if_exists( - 'brocadeports', 'port_id', - server_default=default, - existing_type=sa.String(36)) - - -def set_default_mlnx(): - migration.alter_column_if_exists( - 'segmentation_id_allocation', 'allocated', - server_default=default, - existing_nullable=False, - existing_type=sa.Boolean) - - -def set_default_cisco(): - profile_binding_default = cisco_constants.TENANT_ID_NOT_SET - profile_default = '0' - migration.alter_column_if_exists( - 'cisco_n1kv_profile_bindings', 'tenant_id', - existing_type=sa.String(length=36), - server_default=profile_binding_default, - existing_nullable=False) - migration.alter_column_if_exists( - 'cisco_network_profiles', 'multicast_ip_index', - server_default=profile_default, - existing_type=sa.Integer) - migration.alter_column_if_exists( - 'cisco_n1kv_vlan_allocations', 'allocated', - existing_type=sa.Boolean, - server_default=default, - existing_nullable=False) - - -def set_default_vmware(): - migration.alter_column_if_exists( - 'nsxrouterextattributess', 'service_router', - server_default=default, - existing_nullable=False, - existing_type=sa.Boolean) - migration.alter_column_if_exists( - 'nsxrouterextattributess', 'distributed', - server_default=default, - existing_nullable=False, - existing_type=sa.Boolean) - migration.alter_column_if_exists( - 'qosqueues', 'default', - server_default=default, - existing_type=sa.Boolean) - - -def set_default_agents(): - default = sqlalchemy.sql.true() - migration.alter_column_if_exists( - 'agents', 'admin_state_up', - server_default=default, - existing_nullable=False, - existing_type=sa.Boolean) - - -def set_default_ml2(): - migration.alter_column_if_exists( - 'ml2_gre_allocations', 'allocated', - server_default=default, - existing_nullable=False, - existing_type=sa.Boolean) - migration.alter_column_if_exists( - 'ml2_vxlan_allocations', 'allocated', - server_default=default, - existing_nullable=False, - existing_type=sa.Boolean) diff --git a/neutron/db/migration/alembic_migrations/versions/54f7549a0e5f_set_not_null_peer_address.py b/neutron/db/migration/alembic_migrations/versions/54f7549a0e5f_set_not_null_peer_address.py deleted file mode 100644 index 3b45e44a5..000000000 --- a/neutron/db/migration/alembic_migrations/versions/54f7549a0e5f_set_not_null_peer_address.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""set_not_null_peer_address - -Revision ID: 54f7549a0e5f -Revises: 33dd0a9fa487 -Create Date: 2014-03-17 11:00:17.539028 - -""" - -# revision identifiers, used by Alembic. -revision = '54f7549a0e5f' -down_revision = 'icehouse' - -# This migration will be executed only if the neutron DB schema -# contains the tables for VPN service plugin. -# This migration will be skipped when executed in offline mode. - - -import sqlalchemy as sa - -from neutron.db import migration - - -@migration.skip_if_offline -def upgrade(): - migration.alter_column_if_exists( - 'ipsec_site_connections', 'peer_address', - existing_type=sa.String(255), - nullable=False) diff --git a/neutron/db/migration/alembic_migrations/versions/5589aa32bf80_l3_dvr_scheduler.py b/neutron/db/migration/alembic_migrations/versions/5589aa32bf80_l3_dvr_scheduler.py deleted file mode 100644 index 5c162b813..000000000 --- a/neutron/db/migration/alembic_migrations/versions/5589aa32bf80_l3_dvr_scheduler.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""L3 scheduler additions to support DVR - -Revision ID: 5589aa32bf80 -Revises: 31d7f831a591 -Create Date: 2014-07-7 11:00:43.392912 - -""" - -# revision identifiers, used by Alembic. -revision = '5589aa32bf80' -down_revision = '31d7f831a591' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.create_table( - 'csnat_l3_agent_bindings', - sa.Column('router_id', sa.String(length=36), nullable=False), - sa.Column('l3_agent_id', sa.String(length=36), nullable=False), - sa.Column('host_id', sa.String(length=255), nullable=True), - sa.Column('csnat_gw_port_id', sa.String(length=36), nullable=True), - sa.ForeignKeyConstraint(['l3_agent_id'], ['agents.id'], - ondelete='CASCADE'), - sa.ForeignKeyConstraint(['router_id'], ['routers.id'], - ondelete='CASCADE'), - sa.ForeignKeyConstraint(['csnat_gw_port_id'], ['ports.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('router_id') - ) diff --git a/neutron/db/migration/alembic_migrations/versions/58fe87a01143_cisco_csr_routing.py b/neutron/db/migration/alembic_migrations/versions/58fe87a01143_cisco_csr_routing.py deleted file mode 100644 index 53fe89b8b..000000000 --- a/neutron/db/migration/alembic_migrations/versions/58fe87a01143_cisco_csr_routing.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""cisco_csr_routing - -Revision ID: 58fe87a01143 -Revises: 32f3915891fd -Create Date: 2014-08-18 17:14:12.506356 - -""" - -# revision identifiers, used by Alembic. -revision = '58fe87a01143' -down_revision = '32f3915891fd' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.create_table('cisco_hosting_devices', - sa.Column('tenant_id', sa.String(length=255), nullable=True), - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('complementary_id', sa.String(length=36), nullable=True), - sa.Column('device_id', sa.String(length=255), nullable=True), - sa.Column('admin_state_up', sa.Boolean(), nullable=False), - sa.Column('management_port_id', sa.String(length=36), nullable=True), - sa.Column('protocol_port', sa.Integer(), nullable=True), - sa.Column('cfg_agent_id', sa.String(length=36), nullable=True), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('status', sa.String(length=16), nullable=True), - sa.ForeignKeyConstraint(['cfg_agent_id'], ['agents.id'], ), - sa.ForeignKeyConstraint(['management_port_id'], ['ports.id'], - ondelete='SET NULL'), - sa.PrimaryKeyConstraint('id') - ) - op.create_table('cisco_port_mappings', - sa.Column('logical_resource_id', sa.String(length=36), nullable=False), - sa.Column('logical_port_id', sa.String(length=36), nullable=False), - sa.Column('port_type', sa.String(length=32), nullable=True), - sa.Column('network_type', sa.String(length=32), nullable=True), - sa.Column('hosting_port_id', sa.String(length=36), nullable=True), - sa.Column('segmentation_id', sa.Integer(), autoincrement=False, - nullable=True), - sa.ForeignKeyConstraint(['hosting_port_id'], ['ports.id'], - ondelete='CASCADE'), - sa.ForeignKeyConstraint(['logical_port_id'], ['ports.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('logical_resource_id', 'logical_port_id') - ) - op.create_table('cisco_router_mappings', - sa.Column('router_id', sa.String(length=36), nullable=False), - sa.Column('auto_schedule', sa.Boolean(), nullable=False), - sa.Column('hosting_device_id', sa.String(length=36), nullable=True), - sa.ForeignKeyConstraint(['hosting_device_id'], - ['cisco_hosting_devices.id'], - ondelete='SET NULL'), - sa.ForeignKeyConstraint(['router_id'], ['routers.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('router_id') - ) diff --git a/neutron/db/migration/alembic_migrations/versions/5ac1c354a051_n1kv_segment_alloc.py b/neutron/db/migration/alembic_migrations/versions/5ac1c354a051_n1kv_segment_alloc.py deleted file mode 100644 index 395e7a1dc..000000000 --- a/neutron/db/migration/alembic_migrations/versions/5ac1c354a051_n1kv_segment_alloc.py +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""n1kv segment allocs for cisco n1kv plugin - -Revision ID: 5ac1c354a051 -Revises: 538732fa21e1 -Create Date: 2014-03-05 17:36:52.952608 - -""" - -# revision identifiers, used by Alembic. -revision = '5ac1c354a051' -down_revision = '538732fa21e1' - -from alembic import op -import sqlalchemy as sa - -from neutron.db import migration - - -def upgrade(): - - if not migration.schema_has_table('cisco_n1kv_vlan_allocations'): - # Assume that, in the database we are migrating from, the - # configured plugin did not create any n1kv tables. - return - - op.add_column( - 'cisco_n1kv_vlan_allocations', - sa.Column('network_profile_id', - sa.String(length=36), - nullable=False) - ) - op.create_foreign_key( - 'cisco_n1kv_vlan_allocations_ibfk_1', - source='cisco_n1kv_vlan_allocations', - referent='cisco_network_profiles', - local_cols=['network_profile_id'], remote_cols=['id'], - ondelete='CASCADE' - ) - op.add_column( - 'cisco_n1kv_vxlan_allocations', - sa.Column('network_profile_id', - sa.String(length=36), - nullable=False) - ) - op.create_foreign_key( - 'cisco_n1kv_vxlan_allocations_ibfk_1', - source='cisco_n1kv_vxlan_allocations', - referent='cisco_network_profiles', - local_cols=['network_profile_id'], remote_cols=['id'], - ondelete='CASCADE' - ) diff --git a/neutron/db/migration/alembic_migrations/versions/6be312499f9_set_not_null_vlan_id_cisco.py b/neutron/db/migration/alembic_migrations/versions/6be312499f9_set_not_null_vlan_id_cisco.py deleted file mode 100644 index 7f718cb64..000000000 --- a/neutron/db/migration/alembic_migrations/versions/6be312499f9_set_not_null_vlan_id_cisco.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""set_not_null_vlan_id_cisco - -Revision ID: 6be312499f9 -Revises: d06e871c0d5 -Create Date: 2014-03-27 14:38:12.571173 - -""" - -# revision identifiers, used by Alembic. -revision = '6be312499f9' -down_revision = 'd06e871c0d5' - -# This migration will be executed only if the neutron DB schema -# contains the tables for the cisco plugin. -# This migration will be skipped when executed in offline mode. - -import sqlalchemy as sa - -from neutron.db import migration - - -@migration.skip_if_offline -def upgrade(): - migration.alter_column_if_exists( - 'cisco_nexusport_bindings', 'vlan_id', - nullable=False, - existing_type=sa.Integer) diff --git a/neutron/db/migration/alembic_migrations/versions/81c553f3776c_bsn_consistencyhashes.py b/neutron/db/migration/alembic_migrations/versions/81c553f3776c_bsn_consistencyhashes.py deleted file mode 100644 index 99c7ef52d..000000000 --- a/neutron/db/migration/alembic_migrations/versions/81c553f3776c_bsn_consistencyhashes.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""bsn_consistencyhashes - -Revision ID: 81c553f3776c -Revises: 24c7ea5160d7 -Create Date: 2014-02-26 18:56:00.402855 - -""" - -# revision identifiers, used by Alembic. -revision = '81c553f3776c' -down_revision = '24c7ea5160d7' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.create_table( - 'consistencyhashes', - sa.Column('hash_id', sa.String(255), primary_key=True), - sa.Column('hash', sa.String(255), nullable=False) - ) diff --git a/neutron/db/migration/alembic_migrations/versions/86d6d9776e2b_cisco_apic_driver_update_l3.py b/neutron/db/migration/alembic_migrations/versions/86d6d9776e2b_cisco_apic_driver_update_l3.py deleted file mode 100644 index 73c06f2bb..000000000 --- a/neutron/db/migration/alembic_migrations/versions/86d6d9776e2b_cisco_apic_driver_update_l3.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""Cisco APIC Mechanism Driver - -Revision ID: 86d6d9776e2b -Revises: 236b90af57abg -Create Date: 2014-04-23 09:27:08.177021 - -""" - -# revision identifiers, used by Alembic. -revision = '86d6d9776e2b' -down_revision = '236b90af57ab' - - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - - op.drop_table('cisco_ml2_apic_contracts') - op.drop_table('cisco_ml2_apic_epgs') - - op.create_table( - 'cisco_ml2_apic_contracts', - sa.Column('tenant_id', sa.String(length=255)), - sa.Column('router_id', sa.String(length=64), nullable=False), - sa.ForeignKeyConstraint(['router_id'], ['routers.id']), - sa.PrimaryKeyConstraint('router_id')) diff --git a/neutron/db/migration/alembic_migrations/versions/884573acbf1c_unify_nsx_router_extra_attributes.py b/neutron/db/migration/alembic_migrations/versions/884573acbf1c_unify_nsx_router_extra_attributes.py deleted file mode 100644 index c0e4f2c91..000000000 --- a/neutron/db/migration/alembic_migrations/versions/884573acbf1c_unify_nsx_router_extra_attributes.py +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""Drop NSX table in favor of the extra_attributes one - -Revision ID: 884573acbf1c -Revises: 5589aa32bf80 -Create Date: 2013-01-07 13:47:29.093160 - -""" - -revision = '884573acbf1c' -down_revision = '5589aa32bf80' - - -from alembic import op -import sqlalchemy as sa - - -def _migrate_data(old_table, new_table): - engine = op.get_bind().engine - if engine.name == 'postgresql': - op.execute(("UPDATE %(new_table)s new_t " - "SET distributed = old_t.distributed, " - "service_router = old_t.service_router " - "FROM %(old_table)s old_t " - "WHERE new_t.router_id = old_t.router_id") % - {'new_table': new_table, 'old_table': old_table}) - elif engine.name == 'ibm_db_sa': - op.execute(("UPDATE %(new_table)s new_t " - "SET (distributed, service_router) = " - "(SELECT old_t.distributed, old_t.service_router " - "FROM %(old_table)s old_t " - "WHERE new_t.router_id = old_t.router_id)") % - {'new_table': new_table, 'old_table': old_table}) - else: - op.execute(("UPDATE %(new_table)s new_t " - "INNER JOIN %(old_table)s as old_t " - "ON new_t.router_id = old_t.router_id " - "SET new_t.distributed = old_t.distributed, " - "new_t.service_router = old_t.service_router") % - {'new_table': new_table, 'old_table': old_table}) - - -def upgrade(): - op.add_column('router_extra_attributes', - sa.Column('service_router', sa.Boolean(), - nullable=False, - server_default=sa.sql.false())) - _migrate_data('router_extra_attributes', 'nsxrouterextattributess') - op.drop_table('nsxrouterextattributess') diff --git a/neutron/db/migration/alembic_migrations/versions/aae5706a396_nuage_provider_networks.py b/neutron/db/migration/alembic_migrations/versions/aae5706a396_nuage_provider_networks.py deleted file mode 100644 index ea781291f..000000000 --- a/neutron/db/migration/alembic_migrations/versions/aae5706a396_nuage_provider_networks.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""nuage_provider_networks - -Revision ID: aae5706a396 -Revises: 3b85b693a95f -Create Date: 2014-08-18 16:00:21.898795 - -""" - -revision = 'aae5706a396' -down_revision = '3b85b693a95f' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.create_table( - 'nuage_provider_net_bindings', - sa.Column('network_id', sa.String(length=36), nullable=False), - sa.Column('network_type', sa.String(length=32), nullable=False), - sa.Column('physical_network', sa.String(length=64), nullable=False), - sa.Column('vlan_id', sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ['network_id'], ['networks.id'], ondelete='CASCADE'), - sa.PrimaryKeyConstraint('network_id') - ) diff --git a/neutron/db/migration/alembic_migrations/versions/abc88c33f74f_lb_stats_needs_bigint.py b/neutron/db/migration/alembic_migrations/versions/abc88c33f74f_lb_stats_needs_bigint.py deleted file mode 100644 index 816dc973f..000000000 --- a/neutron/db/migration/alembic_migrations/versions/abc88c33f74f_lb_stats_needs_bigint.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""lb stats - -Revision ID: abc88c33f74f -Revises: 3d2585038b95 -Create Date: 2014-02-24 20:14:59.577972 - -""" - -# revision identifiers, used by Alembic. -revision = 'abc88c33f74f' -down_revision = '3d2585038b95' - - -from alembic import op -import sqlalchemy as sa - -from neutron.db import migration - - -def upgrade(): - if migration.schema_has_table('poolstatisticss'): - op.alter_column('poolstatisticss', 'bytes_in', - type_=sa.BigInteger(), existing_type=sa.Integer()) - op.alter_column('poolstatisticss', 'bytes_out', - type_=sa.BigInteger(), existing_type=sa.Integer()) - op.alter_column('poolstatisticss', 'active_connections', - type_=sa.BigInteger(), existing_type=sa.Integer()) - op.alter_column('poolstatisticss', 'total_connections', - type_=sa.BigInteger(), existing_type=sa.Integer()) diff --git a/neutron/db/migration/alembic_migrations/versions/b65aa907aec_set_length_of_protocol_field.py b/neutron/db/migration/alembic_migrations/versions/b65aa907aec_set_length_of_protocol_field.py deleted file mode 100644 index 0ec354aef..000000000 --- a/neutron/db/migration/alembic_migrations/versions/b65aa907aec_set_length_of_protocol_field.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""set_length_of_protocol_field - -Revision ID: b65aa907aec -Revises: 1e5dd1d09b22 -Create Date: 2014-03-21 16:30:10.626649 - -""" - -# revision identifiers, used by Alembic. -revision = 'b65aa907aec' -down_revision = '1e5dd1d09b22' - -# This migration will be executed only if then Neutron db contains tables for -# the firewall service plugin -# This migration will not be executed in offline mode - -import sqlalchemy as sa - -from neutron.db import migration - - -@migration.skip_if_offline -def upgrade(): - migration.alter_column_if_exists( - 'firewall_rules', 'protocol', - type_=sa.String(40), - existing_nullable=True) diff --git a/neutron/db/migration/alembic_migrations/versions/d06e871c0d5_set_admin_state_up_not_null_ml2.py b/neutron/db/migration/alembic_migrations/versions/d06e871c0d5_set_admin_state_up_not_null_ml2.py deleted file mode 100644 index a717a78f3..000000000 --- a/neutron/db/migration/alembic_migrations/versions/d06e871c0d5_set_admin_state_up_not_null_ml2.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2014 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""set_admin_state_up_not_null_ml2 - -Revision ID: d06e871c0d5 -Revises: 2447ad0e9585 -Create Date: 2014-03-21 17:22:20.545186 - -""" - -# revision identifiers, used by Alembic. -revision = 'd06e871c0d5' -down_revision = '4eca4a84f08a' - -# This migration will be executed only if the neutron DB schema -# contains the tables for the ML2 plugin brocade driver. -# This migration will be skipped when executed in offline mode. - - -import sqlalchemy as sa - -from neutron.db import migration - - -@migration.skip_if_offline -def upgrade(): - migration.alter_column_if_exists( - 'ml2_brocadeports', 'admin_state_up', - nullable=False, - existing_type=sa.Boolean) diff --git a/neutron/db/migration/alembic_migrations/versions/e197124d4b9_add_unique_constrain.py b/neutron/db/migration/alembic_migrations/versions/e197124d4b9_add_unique_constrain.py deleted file mode 100644 index 7d2b3571c..000000000 --- a/neutron/db/migration/alembic_migrations/versions/e197124d4b9_add_unique_constrain.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2013 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""add unique constraint to members - -Revision ID: e197124d4b9 -Revises: havana -Create Date: 2013-11-17 10:09:37.728903 - -""" - -# revision identifiers, used by Alembic. -revision = 'e197124d4b9' -down_revision = 'havana' - -from alembic import op - -from neutron.db import migration - - -CONSTRAINT_NAME = 'uniq_member0pool_id0address0port' -TABLE_NAME = 'members' - - -def upgrade(): - if migration.schema_has_table(TABLE_NAME): - op.create_unique_constraint( - name=CONSTRAINT_NAME, - source=TABLE_NAME, - local_cols=['pool_id', 'address', 'protocol_port'] - ) diff --git a/neutron/db/migration/alembic_migrations/versions/icehouse_release.py b/neutron/db/migration/alembic_migrations/versions/icehouse_release.py deleted file mode 100644 index 56413d9d2..000000000 --- a/neutron/db/migration/alembic_migrations/versions/icehouse_release.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2014 Yahoo! Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""icehouse - -Revision ID: icehouse -Revises: 5ac1c354a051 -Create Date: 2013-03-28 00:00:00.000000 - -""" - -# revision identifiers, used by Alembic. -revision = 'icehouse' -down_revision = '5ac1c354a051' - - -def upgrade(): - """A no-op migration for marking the Icehouse release.""" - pass diff --git a/neutron/db/migration/alembic_migrations/versions/havana_initial.py b/neutron/db/migration/alembic_migrations/versions/juno_initial.py similarity index 91% rename from neutron/db/migration/alembic_migrations/versions/havana_initial.py rename to neutron/db/migration/alembic_migrations/versions/juno_initial.py index c1b91261a..72c9f0b46 100644 --- a/neutron/db/migration/alembic_migrations/versions/havana_initial.py +++ b/neutron/db/migration/alembic_migrations/versions/juno_initial.py @@ -13,15 +13,15 @@ # under the License. # -"""havana_initial +"""juno_initial -Revision ID: havana +Revision ID: juno Revises: None """ # revision identifiers, used by Alembic. -revision = 'havana' +revision = 'juno' down_revision = None @@ -29,6 +29,7 @@ from neutron.db.migration.alembic_migrations import agent_init_ops from neutron.db.migration.alembic_migrations import brocade_init_ops from neutron.db.migration.alembic_migrations import cisco_init_ops from neutron.db.migration.alembic_migrations import core_init_ops +from neutron.db.migration.alembic_migrations import dvr_init_opts from neutron.db.migration.alembic_migrations import firewall_init_ops from neutron.db.migration.alembic_migrations import l3_init_ops from neutron.db.migration.alembic_migrations import lb_init_ops @@ -37,6 +38,7 @@ from neutron.db.migration.alembic_migrations import metering_init_ops from neutron.db.migration.alembic_migrations import ml2_init_ops from neutron.db.migration.alembic_migrations import mlnx_init_ops from neutron.db.migration.alembic_migrations import nec_init_ops +from neutron.db.migration.alembic_migrations import nuage_init_opts from neutron.db.migration.alembic_migrations import other_extensions_init_ops from neutron.db.migration.alembic_migrations import other_plugins_init_ops from neutron.db.migration.alembic_migrations import ovs_init_ops @@ -57,6 +59,7 @@ def upgrade(): lb_init_ops.upgrade() ovs_init_ops.upgrade() ml2_init_ops.upgrade() + dvr_init_opts.upgrade() firewall_init_ops.upgrade() loadbalancer_init_ops.upgrade() vpn_init_ops.upgrade() @@ -68,3 +71,4 @@ def upgrade(): other_plugins_init_ops.upgrade() ryu_init_ops.upgrade() vmware_init_ops.upgrade() + nuage_init_opts.upgrade() diff --git a/neutron/db/migration/alembic_migrations/versions/juno_release.py b/neutron/db/migration/alembic_migrations/versions/juno_release.py deleted file mode 100644 index 8e42cf668..000000000 --- a/neutron/db/migration/alembic_migrations/versions/juno_release.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2014 Yahoo! Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""juno - -Revision ID: juno -Revises: 544673ac99ab -Create Date: 2014-10-09 00:00:00.000000 - -""" - -# revision identifiers, used by Alembic. -revision = 'juno' -down_revision = '544673ac99ab' - - -def upgrade(): - """A no-op migration for marking the Juno release.""" - pass diff --git a/neutron/db/migration/alembic_migrations/vmware_init_ops.py b/neutron/db/migration/alembic_migrations/vmware_init_ops.py index 6304dfc72..706b11cb9 100644 --- a/neutron/db/migration/alembic_migrations/vmware_init_ops.py +++ b/neutron/db/migration/alembic_migrations/vmware_init_ops.py @@ -21,7 +21,7 @@ import sqlalchemy as sa net_binding_type = sa.Enum('flat', 'vlan', 'stt', 'gre', 'l3_ext', - name='nvp_network_bindings_binding_type') + name='tz_network_bindings_binding_type') l2gw_segmentation_type = sa.Enum('flat', 'vlan', name='networkconnections_segmentation_type') qos_marking = sa.Enum('untrusted', 'trusted', name='qosqueues_qos_marking') @@ -29,15 +29,7 @@ qos_marking = sa.Enum('untrusted', 'trusted', name='qosqueues_qos_marking') def upgrade(): op.create_table( - 'quantum_nvp_port_mapping', - sa.Column('quantum_id', sa.String(length=36), nullable=False), - sa.Column('nvp_id', sa.String(length=36), nullable=True), - sa.ForeignKeyConstraint(['quantum_id'], ['ports.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('quantum_id')) - - op.create_table( - 'nvp_network_bindings', + 'tz_network_bindings', sa.Column('network_id', sa.String(length=36), nullable=False), sa.Column('binding_type', net_binding_type, nullable=False), sa.Column('phy_uuid', sa.String(length=36), nullable=True), @@ -48,22 +40,12 @@ def upgrade(): 'phy_uuid', 'vlan_id')) op.create_table( - 'nvp_multi_provider_networks', + 'multi_provider_networks', sa.Column('network_id', sa.String(length=36), nullable=False), sa.ForeignKeyConstraint(['network_id'], ['networks.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('network_id')) - op.create_table( - 'nsxrouterextattributess', - sa.Column('router_id', sa.String(length=36), nullable=False), - sa.Column('distributed', sa.Boolean(), nullable=False), - sa.Column('service_router', sa.Boolean(), nullable=False, - server_default='0'), - sa.ForeignKeyConstraint(['router_id'], ['routers.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('router_id')) - op.create_table( 'vcns_router_bindings', sa.Column('status', sa.String(length=16), nullable=False), @@ -116,16 +98,6 @@ def upgrade(): sa.Column('default', sa.Boolean(), nullable=True), sa.PrimaryKeyConstraint('id')) - op.create_table( - 'networkgatewaydevices', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('network_gateway_id', sa.String(length=36), nullable=True), - sa.Column('interface_name', sa.String(length=64), nullable=True), - sa.ForeignKeyConstraint(['network_gateway_id'], - ['networkgateways.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('id')) - op.create_table( 'networkconnections', sa.Column('tenant_id', sa.String(length=255), nullable=True), @@ -148,7 +120,8 @@ def upgrade(): sa.Column('tenant_id', sa.String(length=255), nullable=True), sa.Column('id', sa.String(length=36), nullable=False), sa.Column('name', sa.String(length=255), nullable=True), - sa.Column('default', sa.Boolean(), nullable=True), + sa.Column('default', sa.Boolean(), nullable=True, + server_default=sa.sql.false()), sa.Column('min', sa.Integer(), nullable=False), sa.Column('max', sa.Integer(), nullable=True), sa.Column('qos_marking', qos_marking, nullable=True), @@ -181,3 +154,90 @@ def upgrade(): sa.ForeignKeyConstraint(['port_id'], ['ports.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('port_id')) + + op.create_table('neutron_nsx_port_mappings', + sa.Column('neutron_id', sa.String(length=36), + nullable=False), + sa.Column('nsx_port_id', sa.String(length=36), + nullable=False), + sa.Column('nsx_switch_id', sa.String(length=36), + nullable=True), + sa.ForeignKeyConstraint(['neutron_id'], ['ports.id'], + ondelete='CASCADE'), + sa.PrimaryKeyConstraint('neutron_id')) + + op.create_table( + 'lsn', + sa.Column('net_id', + sa.String(length=36), nullable=False), + sa.Column('lsn_id', + sa.String(length=36), nullable=False), + sa.PrimaryKeyConstraint('lsn_id')) + + op.create_table( + 'lsn_port', + sa.Column('lsn_port_id', + sa.String(length=36), nullable=False), + sa.Column('lsn_id', + sa.String(length=36), nullable=False), + sa.Column('sub_id', + sa.String(length=36), nullable=False, unique=True), + sa.Column('mac_addr', + sa.String(length=32), nullable=False, unique=True), + sa.ForeignKeyConstraint(['lsn_id'], ['lsn.lsn_id'], + ondelete='CASCADE'), + sa.PrimaryKeyConstraint('lsn_port_id')) + + op.create_table( + 'neutron_nsx_network_mappings', + sa.Column('neutron_id', sa.String(length=36), nullable=False), + sa.Column('nsx_id', sa.String(length=36), nullable=True), + sa.ForeignKeyConstraint(['neutron_id'], ['networks.id'], + ondelete='CASCADE'), + # There might be multiple switches for a neutron network + sa.PrimaryKeyConstraint('neutron_id', 'nsx_id'), + ) + + op.create_table( + 'neutron_nsx_router_mappings', + sa.Column('neutron_id', sa.String(length=36), nullable=False), + sa.Column('nsx_id', sa.String(length=36), nullable=True), + sa.ForeignKeyConstraint(['neutron_id'], ['routers.id'], + ondelete='CASCADE'), + sa.PrimaryKeyConstraint('neutron_id'), + ) + # Execute statement to a record in nsx_router_mappings for + # each record in routers + op.execute("INSERT INTO neutron_nsx_router_mappings SELECT id,id " + "from routers") + + op.create_table( + 'neutron_nsx_security_group_mappings', + sa.Column('neutron_id', sa.String(length=36), nullable=False), + sa.Column('nsx_id', sa.String(length=36), nullable=False), + sa.ForeignKeyConstraint(['neutron_id'], ['securitygroups.id'], + ondelete='CASCADE'), + sa.PrimaryKeyConstraint('neutron_id', 'nsx_id')) + # Execute statement to add a record in security group mappings for + # each record in securitygroups + op.execute("INSERT INTO neutron_nsx_security_group_mappings SELECT id,id " + "from securitygroups") + op.create_table( + 'networkgatewaydevicereferences', + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('network_gateway_id', sa.String(length=36), nullable=True), + sa.Column('interface_name', sa.String(length=64), nullable=True), + sa.ForeignKeyConstraint(['network_gateway_id'], ['networkgateways.id'], + ondelete='CASCADE'), + sa.PrimaryKeyConstraint('id', 'network_gateway_id', 'interface_name')) + + op.create_table( + 'networkgatewaydevices', + sa.Column('tenant_id', sa.String(length=255), nullable=True), + sa.Column('id', sa.String(length=36), nullable=False), + sa.Column('nsx_id', sa.String(length=36), nullable=True), + sa.Column('name', sa.String(length=255), nullable=True), + sa.Column('connector_type', sa.String(length=10), nullable=True), + sa.Column('connector_ip', sa.String(length=64), nullable=True), + sa.Column('status', sa.String(length=16), nullable=True), + sa.PrimaryKeyConstraint('id')) diff --git a/neutron/db/migration/models/frozen.py b/neutron/db/migration/models/frozen.py deleted file mode 100644 index 528fc4165..000000000 --- a/neutron/db/migration/models/frozen.py +++ /dev/null @@ -1,1843 +0,0 @@ -# Copyright (c) 2014 OpenStack Foundation. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -""" -This module should not be changed. - -The module provides all database models that were present at the moment of -creation of heal_script. - -Its purpose is to create comparable metadata with current database schema. -Based on this comparison database can be healed with healing migration. - -Current HEAD commit is 59da928e945ec58836d34fd561d30a8a446e2728 -""" - - -import sqlalchemy as sa -from sqlalchemy.ext import declarative -from sqlalchemy.ext.orderinglist import ordering_list -from sqlalchemy import orm -from sqlalchemy import schema - -from neutron.db import model_base -from neutron.openstack.common import uuidutils - - -# Dictionary of all tables that was renamed: -# {new_table_name: old_table_name} -renamed_tables = { - 'subnetroutes': 'routes', - 'cisco_credentials': 'credentials', - 'cisco_nexusport_bindings': 'nexusport_bindings', - 'cisco_qos_policies': 'qoss', - 'tz_network_bindings': 'nvp_network_bindings', - 'multi_provider_networks': 'nvp_multi_provider_networks', - 'net_partitions': 'nuage_net_partitions', - 'net_partition_router_mapping': 'nuage_net_partition_router_mapping', - 'router_zone_mapping': 'nuage_router_zone_mapping', - 'subnet_l2dom_mapping': 'nuage_subnet_l2dom_mapping', - 'port_mapping': 'nuage_port_mapping', - 'routerroutes_mapping': 'nuage_routerroutes_mapping', -} - -#neutron/plugins/ml2/drivers/mech_arista/db.py -UUID_LEN = 36 -STR_LEN = 255 - -#neutron/plugins/cisco/common/cisco_constants.py -CISCO_CONSTANTS_NETWORK_TYPE_VLAN = 'vlan' -CISCO_CONSTANTS_NETWORK_TYPE_OVERLAY = 'overlay' -CISCO_CONSTANTS_NETWORK_TYPE_TRUNK = 'trunk' -CISCO_CONSTANTS_NETWORK_TYPE_MULTI_SEGMENT = 'multi-segment' -CISCO_CONSTANTS_NETWORK = 'network' -CISCO_CONSTANTS_POLICY = 'policy' -CISCO_CONSTANTS_TENANT_ID_NOT_SET = 'TENANT_ID_NOT_SET' - -#neutron/plugins/ml2/models.py -BINDING_PROFILE_LEN = 4095 - -#neutron/extensions/portbindings.py -VNIC_NORMAL = 'normal' - -#neutron/common/constants.py -IPV6_SLAAC = 'slaac' -DHCPV6_STATEFUL = 'dhcpv6-stateful' -DHCPV6_STATELESS = 'dhcpv6-stateless' - - -BASEV2 = declarative.declarative_base(cls=model_base.NeutronBaseV2) - - -#neutron/db/models_v2.py -class HasTenant(object): - tenant_id = sa.Column(sa.String(255)) - - -#neutron/db/models_v2.py -class HasId(object): - id = sa.Column(sa.String(36), - primary_key=True, - default=uuidutils.generate_uuid) - - -#neutron/db/models_v2.py -class HasStatusDescription(object): - status = sa.Column(sa.String(16), nullable=False) - status_description = sa.Column(sa.String(255)) - - -#neutron/db/models_v2.py -class IPAvailabilityRange(BASEV2): - allocation_pool_id = sa.Column(sa.String(36), - sa.ForeignKey('ipallocationpools.id', - ondelete="CASCADE"), - nullable=False, - primary_key=True) - first_ip = sa.Column(sa.String(64), nullable=False, primary_key=True) - last_ip = sa.Column(sa.String(64), nullable=False, primary_key=True) - - -#neutron/db/models_v2.py -class IPAllocationPool(BASEV2, HasId): - subnet_id = sa.Column(sa.String(36), sa.ForeignKey('subnets.id', - ondelete="CASCADE"), - nullable=True) - first_ip = sa.Column(sa.String(64), nullable=False) - last_ip = sa.Column(sa.String(64), nullable=False) - available_ranges = orm.relationship(IPAvailabilityRange, - backref='ipallocationpool', - lazy="joined", - cascade='all, delete-orphan') - - -#neutron/db/models_v2.py -class IPAllocation(BASEV2): - port_id = sa.Column(sa.String(36), sa.ForeignKey('ports.id', - ondelete="CASCADE"), - nullable=True) - ip_address = sa.Column(sa.String(64), nullable=False, primary_key=True) - subnet_id = sa.Column(sa.String(36), sa.ForeignKey('subnets.id', - ondelete="CASCADE"), - nullable=False, primary_key=True) - network_id = sa.Column(sa.String(36), sa.ForeignKey("networks.id", - ondelete="CASCADE"), - nullable=False, primary_key=True) - - -#neutron/db/models_v2.py -class Route(object): - destination = sa.Column(sa.String(64), nullable=False, primary_key=True) - nexthop = sa.Column(sa.String(64), nullable=False, primary_key=True) - - -#neutron/db/models_v2.py -class SubnetRoute(BASEV2, Route): - subnet_id = sa.Column(sa.String(36), - sa.ForeignKey('subnets.id', - ondelete="CASCADE"), - primary_key=True) - - -#neutron/db/models_v2.py -class Port(BASEV2, HasId, HasTenant): - name = sa.Column(sa.String(255)) - network_id = sa.Column(sa.String(36), sa.ForeignKey("networks.id"), - nullable=False) - fixed_ips = orm.relationship(IPAllocation, backref='ports', lazy='joined') - mac_address = sa.Column(sa.String(32), nullable=False) - admin_state_up = sa.Column(sa.Boolean(), nullable=False) - status = sa.Column(sa.String(16), nullable=False) - device_id = sa.Column(sa.String(255), nullable=False) - device_owner = sa.Column(sa.String(255), nullable=False) - - -#neutron/db/models_v2.py -class DNSNameServer(BASEV2): - address = sa.Column(sa.String(128), nullable=False, primary_key=True) - subnet_id = sa.Column(sa.String(36), - sa.ForeignKey('subnets.id', - ondelete="CASCADE"), - primary_key=True) - - -#neutron/db/models_v2.py -class Subnet(BASEV2, HasId, HasTenant): - name = sa.Column(sa.String(255)) - network_id = sa.Column(sa.String(36), sa.ForeignKey('networks.id')) - ip_version = sa.Column(sa.Integer, nullable=False) - cidr = sa.Column(sa.String(64), nullable=False) - gateway_ip = sa.Column(sa.String(64)) - allocation_pools = orm.relationship(IPAllocationPool, - backref='subnet', - lazy="joined", - cascade='delete') - enable_dhcp = sa.Column(sa.Boolean()) - dns_nameservers = orm.relationship(DNSNameServer, - backref='subnet', - cascade='all, delete, delete-orphan') - routes = orm.relationship(SubnetRoute, - backref='subnet', - cascade='all, delete, delete-orphan') - shared = sa.Column(sa.Boolean) - ipv6_ra_mode = sa.Column(sa.Enum(IPV6_SLAAC, - DHCPV6_STATEFUL, - DHCPV6_STATELESS, - name='ipv6_ra_modes'), nullable=True) - ipv6_address_mode = sa.Column(sa.Enum(IPV6_SLAAC, - DHCPV6_STATEFUL, - DHCPV6_STATELESS, - name='ipv6_address_modes'), - nullable=True) - - -#neutron/db/models_v2.py -class Network(BASEV2, HasId, HasTenant): - name = sa.Column(sa.String(255)) - ports = orm.relationship(Port, backref='networks') - subnets = orm.relationship(Subnet, backref='networks', - lazy="joined") - status = sa.Column(sa.String(16)) - admin_state_up = sa.Column(sa.Boolean) - shared = sa.Column(sa.Boolean) - - -#neutron/db/agents_db.py -class Agent(BASEV2, HasId): - __table_args__ = ( - sa.UniqueConstraint('agent_type', 'host', - name='uniq_agents0agent_type0host'), - ) - - agent_type = sa.Column(sa.String(255), nullable=False) - binary = sa.Column(sa.String(255), nullable=False) - topic = sa.Column(sa.String(255), nullable=False) - host = sa.Column(sa.String(255), nullable=False) - admin_state_up = sa.Column(sa.Boolean, default=True, - server_default=sa.sql.true(), nullable=False) - created_at = sa.Column(sa.DateTime, nullable=False) - started_at = sa.Column(sa.DateTime, nullable=False) - heartbeat_timestamp = sa.Column(sa.DateTime, nullable=False) - description = sa.Column(sa.String(255)) - configurations = sa.Column(sa.String(4095), nullable=False) - - -#neutron/db/agentschedulers_db.py -class NetworkDhcpAgentBinding(BASEV2): - network_id = sa.Column(sa.String(36), - sa.ForeignKey("networks.id", ondelete='CASCADE'), - primary_key=True) - dhcp_agent = orm.relation(Agent) - dhcp_agent_id = sa.Column(sa.String(36), - sa.ForeignKey("agents.id", - ondelete='CASCADE'), - primary_key=True) - - -#neutron/db/allowedaddresspairs_db.py -class AllowedAddressPair(BASEV2): - port_id = sa.Column(sa.String(36), - sa.ForeignKey('ports.id', ondelete="CASCADE"), - primary_key=True) - mac_address = sa.Column(sa.String(32), nullable=False, primary_key=True) - ip_address = sa.Column(sa.String(64), nullable=False, primary_key=True) - port = orm.relationship( - Port, - backref=orm.backref("allowed_address_pairs", - lazy="joined", cascade="delete")) - - -#neutron/db/external_net_db.py -class ExternalNetwork(BASEV2): - network_id = sa.Column(sa.String(36), - sa.ForeignKey('networks.id', ondelete="CASCADE"), - primary_key=True) - network = orm.relationship( - Network, - backref=orm.backref("external", lazy='joined', - uselist=False, cascade='delete')) - - -#neutron/db/extradhcpopt_db.py -class ExtraDhcpOpt(BASEV2, HasId): - port_id = sa.Column(sa.String(36), - sa.ForeignKey('ports.id', ondelete="CASCADE"), - nullable=False) - opt_name = sa.Column(sa.String(64), nullable=False) - opt_value = sa.Column(sa.String(255), nullable=False) - __table_args__ = (sa.UniqueConstraint('port_id', - 'opt_name', - name='uidx_portid_optname'), - BASEV2.__table_args__,) - ports = orm.relationship( - Port, - backref=orm.backref("dhcp_opts", lazy='joined', cascade='delete')) - - -#neutron/db/l3_db.py -class Router(BASEV2, HasId, HasTenant): - name = sa.Column(sa.String(255)) - status = sa.Column(sa.String(16)) - admin_state_up = sa.Column(sa.Boolean) - gw_port_id = sa.Column(sa.String(36), sa.ForeignKey('ports.id')) - gw_port = orm.relationship(Port, lazy='joined') - enable_snat = sa.Column(sa.Boolean, default=True, - server_default=sa.sql.true(), nullable=False) - - -#neutron/db/l3_db.py -class FloatingIP(BASEV2, HasId, HasTenant): - floating_ip_address = sa.Column(sa.String(64), nullable=False) - floating_network_id = sa.Column(sa.String(36), nullable=False) - floating_port_id = sa.Column(sa.String(36), sa.ForeignKey('ports.id'), - nullable=False) - fixed_port_id = sa.Column(sa.String(36), sa.ForeignKey('ports.id')) - fixed_ip_address = sa.Column(sa.String(64)) - router_id = sa.Column(sa.String(36), sa.ForeignKey('routers.id')) - last_known_router_id = sa.Column(sa.String(36)) - status = sa.Column(sa.String(16)) - - -#neutron/db/extraroute_db.py -class RouterRoute(BASEV2, Route): - router_id = sa.Column(sa.String(36), - sa.ForeignKey('routers.id', - ondelete="CASCADE"), - primary_key=True) - - router = orm.relationship(Router, - backref=orm.backref("route_list", - lazy='joined', - cascade='delete')) - - -#neutron/db/servicetype_db.py -class ProviderResourceAssociation(BASEV2): - provider_name = sa.Column(sa.String(255), - nullable=False, primary_key=True) - resource_id = sa.Column(sa.String(36), nullable=False, primary_key=True, - unique=True) - - -#neutron/db/firewall/firewall_db.py -class FirewallRule(BASEV2, HasId, HasTenant): - __tablename__ = 'firewall_rules' - name = sa.Column(sa.String(255)) - description = sa.Column(sa.String(1024)) - firewall_policy_id = sa.Column(sa.String(36), - sa.ForeignKey('firewall_policies.id'), - nullable=True) - shared = sa.Column(sa.Boolean) - protocol = sa.Column(sa.String(40)) - ip_version = sa.Column(sa.Integer, nullable=False) - source_ip_address = sa.Column(sa.String(46)) - destination_ip_address = sa.Column(sa.String(46)) - source_port_range_min = sa.Column(sa.Integer) - source_port_range_max = sa.Column(sa.Integer) - destination_port_range_min = sa.Column(sa.Integer) - destination_port_range_max = sa.Column(sa.Integer) - action = sa.Column(sa.Enum('allow', 'deny', name='firewallrules_action')) - enabled = sa.Column(sa.Boolean) - position = sa.Column(sa.Integer) - - -#neutron/db/firewall/firewall_db.py -class Firewall(BASEV2, HasId, HasTenant): - __tablename__ = 'firewalls' - name = sa.Column(sa.String(255)) - description = sa.Column(sa.String(1024)) - shared = sa.Column(sa.Boolean) - admin_state_up = sa.Column(sa.Boolean) - status = sa.Column(sa.String(16)) - firewall_policy_id = sa.Column(sa.String(36), - sa.ForeignKey('firewall_policies.id'), - nullable=True) - - -#neutron/db/firewall/firewall_db.py -class FirewallPolicy(BASEV2, HasId, HasTenant): - __tablename__ = 'firewall_policies' - name = sa.Column(sa.String(255)) - description = sa.Column(sa.String(1024)) - shared = sa.Column(sa.Boolean) - firewall_rules = orm.relationship( - FirewallRule, - backref=orm.backref('firewall_policies', cascade='all, delete'), - order_by='FirewallRule.position', - collection_class=ordering_list('position', count_from=1)) - audited = sa.Column(sa.Boolean) - firewalls = orm.relationship(Firewall, backref='firewall_policies') - - -#neutron/db/l3_agentschedulers_db.py -class RouterL3AgentBinding(BASEV2, HasId): - router_id = sa.Column(sa.String(36), - sa.ForeignKey("routers.id", ondelete='CASCADE')) - l3_agent = orm.relation(Agent) - l3_agent_id = sa.Column(sa.String(36), - sa.ForeignKey("agents.id", - ondelete='CASCADE')) - - -#neutron/db/loadbalancer/loadbalancer_db.py -class SessionPersistence(BASEV2): - vip_id = sa.Column(sa.String(36), - sa.ForeignKey("vips.id"), - primary_key=True) - type = sa.Column(sa.Enum("SOURCE_IP", - "HTTP_COOKIE", - "APP_COOKIE", - name="sesssionpersistences_type"), - nullable=False) - cookie_name = sa.Column(sa.String(1024)) - - -#neutron/db/loadbalancer/loadbalancer_db.py -class PoolStatistics(BASEV2): - pool_id = sa.Column(sa.String(36), sa.ForeignKey("pools.id"), - primary_key=True) - bytes_in = sa.Column(sa.BigInteger, nullable=False) - bytes_out = sa.Column(sa.BigInteger, nullable=False) - active_connections = sa.Column(sa.BigInteger, nullable=False) - total_connections = sa.Column(sa.BigInteger, nullable=False) - - -#neutron/db/loadbalancer/loadbalancer_db.py -class Vip(BASEV2, HasId, HasTenant, HasStatusDescription): - name = sa.Column(sa.String(255)) - description = sa.Column(sa.String(255)) - port_id = sa.Column(sa.String(36), sa.ForeignKey('ports.id')) - protocol_port = sa.Column(sa.Integer, nullable=False) - protocol = sa.Column(sa.Enum("HTTP", "HTTPS", "TCP", name="lb_protocols"), - nullable=False) - pool_id = sa.Column(sa.String(36), nullable=False, unique=True) - session_persistence = orm.relationship(SessionPersistence, - uselist=False, - backref="vips", - cascade="all, delete-orphan") - admin_state_up = sa.Column(sa.Boolean(), nullable=False) - connection_limit = sa.Column(sa.Integer) - port = orm.relationship(Port) - - -#neutron/db/loadbalancer/loadbalancer_db.py -class Member(BASEV2, HasId, HasTenant, HasStatusDescription): - __table_args__ = ( - sa.schema.UniqueConstraint('pool_id', 'address', 'protocol_port', - name='uniq_member0pool_id0address0port'), - ) - pool_id = sa.Column(sa.String(36), sa.ForeignKey("pools.id"), - nullable=False) - address = sa.Column(sa.String(64), nullable=False) - protocol_port = sa.Column(sa.Integer, nullable=False) - weight = sa.Column(sa.Integer, nullable=False) - admin_state_up = sa.Column(sa.Boolean(), nullable=False) - - -#neutron/db/loadbalancer/loadbalancer_db.py -class Pool(BASEV2, HasId, HasTenant, HasStatusDescription): - vip_id = sa.Column(sa.String(36), sa.ForeignKey("vips.id")) - name = sa.Column(sa.String(255)) - description = sa.Column(sa.String(255)) - subnet_id = sa.Column(sa.String(36), nullable=False) - protocol = sa.Column(sa.Enum("HTTP", "HTTPS", "TCP", name="lb_protocols"), - nullable=False) - lb_method = sa.Column(sa.Enum("ROUND_ROBIN", - "LEAST_CONNECTIONS", - "SOURCE_IP", - name="pools_lb_method"), - nullable=False) - admin_state_up = sa.Column(sa.Boolean(), nullable=False) - stats = orm.relationship(PoolStatistics, - uselist=False, - backref="pools", - cascade="all, delete-orphan") - members = orm.relationship(Member, backref="pools", - cascade="all, delete-orphan") - monitors = orm.relationship("PoolMonitorAssociation", backref="pools", - cascade="all, delete-orphan") - vip = orm.relationship(Vip, backref='pool') - - provider = orm.relationship( - ProviderResourceAssociation, - uselist=False, - lazy="joined", - primaryjoin="Pool.id==ProviderResourceAssociation.resource_id", - foreign_keys=[ProviderResourceAssociation.resource_id] - ) - - -#neutron/db/loadbalancer/loadbalancer_db.py -class HealthMonitor(BASEV2, HasId, HasTenant): - type = sa.Column(sa.Enum("PING", "TCP", "HTTP", "HTTPS", - name="healthmontiors_type"), - nullable=False) - delay = sa.Column(sa.Integer, nullable=False) - timeout = sa.Column(sa.Integer, nullable=False) - max_retries = sa.Column(sa.Integer, nullable=False) - http_method = sa.Column(sa.String(16)) - url_path = sa.Column(sa.String(255)) - expected_codes = sa.Column(sa.String(64)) - admin_state_up = sa.Column(sa.Boolean(), nullable=False) - - pools = orm.relationship( - "PoolMonitorAssociation", backref="healthmonitor", - cascade="all", lazy="joined" - ) - - -#neutron/db/loadbalancer/loadbalancer_db.py -class PoolMonitorAssociation(BASEV2, HasStatusDescription): - pool_id = sa.Column(sa.String(36), - sa.ForeignKey("pools.id"), - primary_key=True) - monitor_id = sa.Column(sa.String(36), - sa.ForeignKey("healthmonitors.id"), - primary_key=True) - - -#neutron/db/metering/metering_db.py -class MeteringLabelRule(BASEV2, HasId): - direction = sa.Column(sa.Enum('ingress', 'egress', - name='meteringlabels_direction')) - remote_ip_prefix = sa.Column(sa.String(64)) - metering_label_id = sa.Column(sa.String(36), - sa.ForeignKey("meteringlabels.id", - ondelete="CASCADE"), - nullable=False) - excluded = sa.Column(sa.Boolean, default=False, - server_default=sa.sql.false()) - - -#neutron/db/metering/metering_db.py -class MeteringLabel(BASEV2, HasId, HasTenant): - name = sa.Column(sa.String(255)) - description = sa.Column(sa.String(1024)) - rules = orm.relationship(MeteringLabelRule, backref="label", - cascade="delete", lazy="joined") - routers = orm.relationship( - Router, - primaryjoin="MeteringLabel.tenant_id==Router.tenant_id", - foreign_keys='MeteringLabel.tenant_id', - uselist=True) - - -#neutron/db/portbindings_db.py -class PortBindingPort(BASEV2): - port_id = sa.Column(sa.String(36), - sa.ForeignKey('ports.id', ondelete="CASCADE"), - primary_key=True) - host = sa.Column(sa.String(255), nullable=False) - port = orm.relationship( - Port, - backref=orm.backref("portbinding", - lazy='joined', uselist=False, - cascade='delete')) - - -#neutron/db/portsecurity_db.py -class PortSecurityBinding(BASEV2): - port_id = sa.Column(sa.String(36), - sa.ForeignKey('ports.id', ondelete="CASCADE"), - primary_key=True) - port_security_enabled = sa.Column(sa.Boolean(), nullable=False) - port = orm.relationship( - Port, - backref=orm.backref("port_security", uselist=False, - cascade='delete', lazy='joined')) - - -#neutron/db/portsecurity_db.py -class NetworkSecurityBinding(BASEV2): - network_id = sa.Column(sa.String(36), - sa.ForeignKey('networks.id', ondelete="CASCADE"), - primary_key=True) - port_security_enabled = sa.Column(sa.Boolean(), nullable=False) - network = orm.relationship( - Network, - backref=orm.backref("port_security", uselist=False, - cascade='delete', lazy='joined')) - - -#neutron/db/quota_db.py -class Quota(BASEV2, HasId): - tenant_id = sa.Column(sa.String(255), index=True) - resource = sa.Column(sa.String(255)) - limit = sa.Column(sa.Integer) - - -#neutron/db/routedserviceinsertion_db.py -class ServiceRouterBinding(BASEV2): - resource_id = sa.Column(sa.String(36), - primary_key=True) - resource_type = sa.Column(sa.String(36), - primary_key=True) - router_id = sa.Column(sa.String(36), - sa.ForeignKey('routers.id'), - nullable=False) - - -#neutron/db/routerservicetype_db.py -class RouterServiceTypeBinding(BASEV2): - router_id = sa.Column(sa.String(36), - sa.ForeignKey('routers.id', ondelete="CASCADE"), - primary_key=True) - service_type_id = sa.Column(sa.String(36), - nullable=False) - - -#neutron/db/securitygroups_db.py -class SecurityGroup(BASEV2, HasId, HasTenant): - name = sa.Column(sa.String(255)) - description = sa.Column(sa.String(255)) - - -#neutron/db/securitygroups_db.py -class SecurityGroupPortBinding(BASEV2): - port_id = sa.Column(sa.String(36), - sa.ForeignKey("ports.id", - ondelete='CASCADE'), - primary_key=True) - security_group_id = sa.Column(sa.String(36), - sa.ForeignKey("securitygroups.id"), - primary_key=True) - - # Add a relationship to the Port model in order to instruct SQLAlchemy to - # eagerly load security group bindings - ports = orm.relationship( - Port, - backref=orm.backref("security_groups", - lazy='joined', cascade='delete')) - - -#neutron/db/securitygroups_db.py -class SecurityGroupRule(BASEV2, HasId, - HasTenant): - security_group_id = sa.Column(sa.String(36), - sa.ForeignKey("securitygroups.id", - ondelete="CASCADE"), - nullable=False) - - remote_group_id = sa.Column(sa.String(36), - sa.ForeignKey("securitygroups.id", - ondelete="CASCADE"), - nullable=True) - - direction = sa.Column(sa.Enum('ingress', 'egress', - name='securitygrouprules_direction')) - ethertype = sa.Column(sa.String(40)) - protocol = sa.Column(sa.String(40)) - port_range_min = sa.Column(sa.Integer) - port_range_max = sa.Column(sa.Integer) - remote_ip_prefix = sa.Column(sa.String(255)) - security_group = orm.relationship( - SecurityGroup, - backref=orm.backref('rules', cascade='all,delete'), - primaryjoin="SecurityGroup.id==SecurityGroupRule.security_group_id") - source_group = orm.relationship( - SecurityGroup, - backref=orm.backref('source_rules', cascade='all,delete'), - primaryjoin="SecurityGroup.id==SecurityGroupRule.remote_group_id") - - -#neutron/db/vpn/vpn_db.py -class IPsecPeerCidr(BASEV2): - cidr = sa.Column(sa.String(32), nullable=False, primary_key=True) - ipsec_site_connection_id = sa.Column( - sa.String(36), - sa.ForeignKey('ipsec_site_connections.id', - ondelete="CASCADE"), - primary_key=True) - - -#neutron/db/vpn/vpn_db.py -class IPsecPolicy(BASEV2, HasId, HasTenant): - __tablename__ = 'ipsecpolicies' - name = sa.Column(sa.String(255)) - description = sa.Column(sa.String(255)) - transform_protocol = sa.Column(sa.Enum("esp", "ah", "ah-esp", - name="ipsec_transform_protocols"), - nullable=False) - auth_algorithm = sa.Column(sa.Enum("sha1", - name="vpn_auth_algorithms"), - nullable=False) - encryption_algorithm = sa.Column(sa.Enum("3des", "aes-128", - "aes-256", "aes-192", - name="vpn_encrypt_algorithms"), - nullable=False) - encapsulation_mode = sa.Column(sa.Enum("tunnel", "transport", - name="ipsec_encapsulations"), - nullable=False) - lifetime_units = sa.Column(sa.Enum("seconds", "kilobytes", - name="vpn_lifetime_units"), - nullable=False) - lifetime_value = sa.Column(sa.Integer, nullable=False) - pfs = sa.Column(sa.Enum("group2", "group5", "group14", - name="vpn_pfs"), nullable=False) - - -#neutron/db/vpn/vpn_db.py -class IKEPolicy(BASEV2, HasId, HasTenant): - __tablename__ = 'ikepolicies' - name = sa.Column(sa.String(255)) - description = sa.Column(sa.String(255)) - auth_algorithm = sa.Column(sa.Enum("sha1", - name="vpn_auth_algorithms"), - nullable=False) - encryption_algorithm = sa.Column(sa.Enum("3des", "aes-128", - "aes-256", "aes-192", - name="vpn_encrypt_algorithms"), - nullable=False) - phase1_negotiation_mode = sa.Column(sa.Enum("main", - name="ike_phase1_mode"), - nullable=False) - lifetime_units = sa.Column(sa.Enum("seconds", "kilobytes", - name="vpn_lifetime_units"), - nullable=False) - lifetime_value = sa.Column(sa.Integer, nullable=False) - ike_version = sa.Column(sa.Enum("v1", "v2", name="ike_versions"), - nullable=False) - pfs = sa.Column(sa.Enum("group2", "group5", "group14", - name="vpn_pfs"), nullable=False) - - -#neutron/db/vpn/vpn_db.py -class IPsecSiteConnection(BASEV2, - HasId, HasTenant): - __tablename__ = 'ipsec_site_connections' - name = sa.Column(sa.String(255)) - description = sa.Column(sa.String(255)) - peer_address = sa.Column(sa.String(255), nullable=False) - peer_id = sa.Column(sa.String(255), nullable=False) - route_mode = sa.Column(sa.String(8), nullable=False) - mtu = sa.Column(sa.Integer, nullable=False) - initiator = sa.Column(sa.Enum("bi-directional", "response-only", - name="vpn_initiators"), nullable=False) - auth_mode = sa.Column(sa.String(16), nullable=False) - psk = sa.Column(sa.String(255), nullable=False) - dpd_action = sa.Column(sa.Enum("hold", "clear", - "restart", "disabled", - "restart-by-peer", name="vpn_dpd_actions"), - nullable=False) - dpd_interval = sa.Column(sa.Integer, nullable=False) - dpd_timeout = sa.Column(sa.Integer, nullable=False) - status = sa.Column(sa.String(16), nullable=False) - admin_state_up = sa.Column(sa.Boolean(), nullable=False) - vpnservice_id = sa.Column(sa.String(36), - sa.ForeignKey('vpnservices.id'), - nullable=False) - ipsecpolicy_id = sa.Column(sa.String(36), - sa.ForeignKey('ipsecpolicies.id'), - nullable=False) - ikepolicy_id = sa.Column(sa.String(36), - sa.ForeignKey('ikepolicies.id'), - nullable=False) - ipsecpolicy = orm.relationship( - IPsecPolicy, backref='ipsec_site_connection') - ikepolicy = orm.relationship(IKEPolicy, backref='ipsec_site_connection') - peer_cidrs = orm.relationship(IPsecPeerCidr, - backref='ipsec_site_connection', - lazy='joined', - cascade='all, delete, delete-orphan') - - -#neutron/db/vpn/vpn_db.py -class VPNService(BASEV2, HasId, HasTenant): - name = sa.Column(sa.String(255)) - description = sa.Column(sa.String(255)) - status = sa.Column(sa.String(16), nullable=False) - admin_state_up = sa.Column(sa.Boolean(), nullable=False) - subnet_id = sa.Column(sa.String(36), sa.ForeignKey('subnets.id'), - nullable=False) - router_id = sa.Column(sa.String(36), sa.ForeignKey('routers.id'), - nullable=False) - subnet = orm.relationship(Subnet) - router = orm.relationship(Router) - ipsec_site_connections = orm.relationship( - IPsecSiteConnection, - backref='vpnservice', - cascade="all, delete-orphan") - - -#neutron/plugins/bigswitch/db/consistency_db.py -class ConsistencyHash(BASEV2): - __tablename__ = 'consistencyhashes' - hash_id = sa.Column(sa.String(255), - primary_key=True) - hash = sa.Column(sa.String(255), nullable=False) - - -#neutron/plugins/bigswitch/routerrule_db.py -class RouterRule(BASEV2): - id = sa.Column(sa.Integer, primary_key=True) - source = sa.Column(sa.String(64), nullable=False) - destination = sa.Column(sa.String(64), nullable=False) - nexthops = orm.relationship('NextHop', cascade='all,delete') - action = sa.Column(sa.String(10), nullable=False) - router_id = sa.Column(sa.String(36), - sa.ForeignKey('routers.id', - ondelete="CASCADE")) - - -#neutron/plugins/bigswitch/routerrule_db.py -class NextHop(BASEV2): - rule_id = sa.Column(sa.Integer, - sa.ForeignKey('routerrules.id', - ondelete="CASCADE"), - primary_key=True) - nexthop = sa.Column(sa.String(64), nullable=False, primary_key=True) - - -#neutron/plugins/brocade/db/models.py -class BrocadeNetwork(BASEV2, HasId): - vlan = sa.Column(sa.String(10)) - - -#neutron/plugins/brocade/db/models.py -class BrocadePort(BASEV2): - port_id = sa.Column(sa.String(36), primary_key=True, default="", - server_default='') - network_id = sa.Column(sa.String(36), - sa.ForeignKey("brocadenetworks.id"), - nullable=False) - admin_state_up = sa.Column(sa.Boolean, nullable=False) - physical_interface = sa.Column(sa.String(36)) - vlan_id = sa.Column(sa.String(36)) - tenant_id = sa.Column(sa.String(36)) - - -#neutron/plugins/cisco/db/n1kv_models_v2.py -class N1kvVlanAllocation(BASEV2): - __tablename__ = 'cisco_n1kv_vlan_allocations' - - physical_network = sa.Column(sa.String(64), - nullable=False, - primary_key=True) - vlan_id = sa.Column(sa.Integer, nullable=False, primary_key=True, - autoincrement=False) - allocated = sa.Column(sa.Boolean, nullable=False, default=False, - server_default=sa.sql.false()) - network_profile_id = sa.Column(sa.String(36), - sa.ForeignKey('cisco_network_profiles.id', - ondelete="CASCADE"), - nullable=False) - - -#neutron/plugins/cisco/db/n1kv_models_v2.py -class N1kvVxlanAllocation(BASEV2): - __tablename__ = 'cisco_n1kv_vxlan_allocations' - - vxlan_id = sa.Column(sa.Integer, nullable=False, primary_key=True, - autoincrement=False) - allocated = sa.Column(sa.Boolean, nullable=False, default=False, - server_default=sa.sql.false()) - network_profile_id = sa.Column(sa.String(36), - sa.ForeignKey('cisco_network_profiles.id', - ondelete="CASCADE"), - nullable=False) - - -#neutron/plugins/cisco/db/n1kv_models_v2.py -class N1kvPortBinding(BASEV2): - __tablename__ = 'cisco_n1kv_port_bindings' - - port_id = sa.Column(sa.String(36), - sa.ForeignKey('ports.id', ondelete="CASCADE"), - primary_key=True) - profile_id = sa.Column(sa.String(36), - sa.ForeignKey('cisco_policy_profiles.id')) - - -#neutron/plugins/cisco/db/n1kv_models_v2.py -class N1kvNetworkBinding(BASEV2): - __tablename__ = 'cisco_n1kv_network_bindings' - - network_id = sa.Column(sa.String(36), - sa.ForeignKey('networks.id', ondelete="CASCADE"), - primary_key=True) - network_type = sa.Column(sa.String(32), nullable=False) - physical_network = sa.Column(sa.String(64)) - segmentation_id = sa.Column(sa.Integer) - multicast_ip = sa.Column(sa.String(32)) - profile_id = sa.Column(sa.String(36), - sa.ForeignKey('cisco_network_profiles.id')) - - -#neutron/plugins/cisco/db/n1kv_models_v2.py -class N1kVmNetwork(BASEV2): - __tablename__ = 'cisco_n1kv_vmnetworks' - - name = sa.Column(sa.String(80), primary_key=True) - profile_id = sa.Column(sa.String(36), - sa.ForeignKey('cisco_policy_profiles.id')) - network_id = sa.Column(sa.String(36)) - port_count = sa.Column(sa.Integer) - - -#neutron/plugins/cisco/db/n1kv_models_v2.py -class NetworkProfile(BASEV2, HasId): - __tablename__ = 'cisco_network_profiles' - - name = sa.Column(sa.String(255)) - segment_type = sa.Column( - sa.Enum(CISCO_CONSTANTS_NETWORK_TYPE_VLAN, - CISCO_CONSTANTS_NETWORK_TYPE_OVERLAY, - CISCO_CONSTANTS_NETWORK_TYPE_TRUNK, - CISCO_CONSTANTS_NETWORK_TYPE_MULTI_SEGMENT, - name='segment_type'), - nullable=False) - sub_type = sa.Column(sa.String(255)) - segment_range = sa.Column(sa.String(255)) - multicast_ip_index = sa.Column(sa.Integer, default=0, - server_default='0') - multicast_ip_range = sa.Column(sa.String(255)) - physical_network = sa.Column(sa.String(255)) - - -#neutron/plugins/cisco/db/n1kv_models_v2.py -class PolicyProfile(BASEV2): - __tablename__ = 'cisco_policy_profiles' - - id = sa.Column(sa.String(36), primary_key=True) - name = sa.Column(sa.String(255)) - - -#neutron/plugins/cisco/db/n1kv_models_v2.py -class ProfileBinding(BASEV2): - __tablename__ = 'cisco_n1kv_profile_bindings' - - profile_type = sa.Column(sa.Enum(CISCO_CONSTANTS_NETWORK, - CISCO_CONSTANTS_POLICY, - name='profile_type')) - tenant_id = sa.Column(sa.String(36), - primary_key=True, - default=CISCO_CONSTANTS_TENANT_ID_NOT_SET, - server_default=CISCO_CONSTANTS_TENANT_ID_NOT_SET) - profile_id = sa.Column(sa.String(36), primary_key=True) - - -#neutron/plugins/cisco/db/n1kv_models_v2.py -class N1kvTrunkSegmentBinding(BASEV2): - __tablename__ = 'cisco_n1kv_trunk_segments' - - trunk_segment_id = sa.Column(sa.String(36), - sa.ForeignKey('networks.id', - ondelete="CASCADE"), - primary_key=True) - segment_id = sa.Column(sa.String(36), nullable=False, primary_key=True) - dot1qtag = sa.Column(sa.String(36), nullable=False, primary_key=True) - - -#neutron/plugins/cisco/db/n1kv_models_v2.py -class N1kvMultiSegmentNetworkBinding(BASEV2): - __tablename__ = 'cisco_n1kv_multi_segments' - - multi_segment_id = sa.Column(sa.String(36), - sa.ForeignKey('networks.id', - ondelete="CASCADE"), - primary_key=True) - segment1_id = sa.Column(sa.String(36), nullable=False, primary_key=True) - segment2_id = sa.Column(sa.String(36), nullable=False, primary_key=True) - encap_profile_name = sa.Column(sa.String(36)) - - -#neutron/plugins/cisco/db/network_models_v2.py -class QoS(BASEV2): - __tablename__ = 'cisco_qos_policies' - - qos_id = sa.Column(sa.String(255)) - tenant_id = sa.Column(sa.String(255), primary_key=True) - qos_name = sa.Column(sa.String(255), primary_key=True) - qos_desc = sa.Column(sa.String(255)) - - -#neutron/plugins/cisco/db/network_models_v2.py -class Credential(BASEV2): - __tablename__ = 'cisco_credentials' - - credential_id = sa.Column(sa.String(255)) - credential_name = sa.Column(sa.String(255), primary_key=True) - user_name = sa.Column(sa.String(255)) - password = sa.Column(sa.String(255)) - type = sa.Column(sa.String(255)) - - -#neutron/plugins/cisco/db/network_models_v2.py -class ProviderNetwork(BASEV2): - __tablename__ = 'cisco_provider_networks' - - network_id = sa.Column(sa.String(36), - sa.ForeignKey('networks.id', ondelete="CASCADE"), - primary_key=True) - network_type = sa.Column(sa.String(255), nullable=False) - segmentation_id = sa.Column(sa.Integer, nullable=False) - - -#neutron/plugins/cisco/db/nexus_models_v2.py -#class was renamed from NexusPortBinding to CiscoNexusPortBinding -class CiscoNexusPortBinding(BASEV2): - __tablename__ = "cisco_nexusport_bindings" - - id = sa.Column(sa.Integer, primary_key=True, autoincrement=True) - port_id = sa.Column(sa.String(255)) - vlan_id = sa.Column(sa.Integer, nullable=False) - switch_ip = sa.Column(sa.String(255), nullable=False) - instance_id = sa.Column(sa.String(255), nullable=False) - - -#neutron/plugins/hyperv/model.py -#class was renamed from VlanAllocation to HyperVVlanAllocation -class HyperVVlanAllocation(BASEV2): - __tablename__ = 'hyperv_vlan_allocations' - - physical_network = sa.Column(sa.String(64), - nullable=False, - primary_key=True) - vlan_id = sa.Column(sa.Integer, nullable=False, primary_key=True, - autoincrement=False) - allocated = sa.Column(sa.Boolean, nullable=False) - - -#neutron/plugins/hyperv/model.py -#class was renamed from NetworkBinding to HyperVNetworkBinding -class HyperVNetworkBinding(BASEV2): - __tablename__ = 'hyperv_network_bindings' - - network_id = sa.Column(sa.String(36), - sa.ForeignKey('networks.id', ondelete="CASCADE"), - primary_key=True) - network_type = sa.Column(sa.String(32), nullable=False) - physical_network = sa.Column(sa.String(64)) - segmentation_id = sa.Column(sa.Integer) - - -#neutron/plugins/linuxbridge/db/l2network_models_v2.py -class NetworkState(BASEV2): - __tablename__ = 'network_states' - - physical_network = sa.Column(sa.String(64), nullable=False, - primary_key=True) - vlan_id = sa.Column(sa.Integer, nullable=False, primary_key=True, - autoincrement=False) - allocated = sa.Column(sa.Boolean, nullable=False) - - -#neutron/plugins/linuxbridge/db/l2network_models_v2.py -class NetworkBinding(BASEV2): - __tablename__ = 'network_bindings' - - network_id = sa.Column(sa.String(36), - sa.ForeignKey('networks.id', ondelete="CASCADE"), - primary_key=True) - physical_network = sa.Column(sa.String(64)) - vlan_id = sa.Column(sa.Integer, nullable=False) - - -#neutron/plugins/metaplugin/meta_models_v2.py -class NetworkFlavor(BASEV2): - flavor = sa.Column(sa.String(255)) - network_id = sa.Column(sa.String(36), sa.ForeignKey('networks.id', - ondelete="CASCADE"), - primary_key=True) - - -#neutron/plugins/metaplugin/meta_models_v2.py -class RouterFlavor(BASEV2): - flavor = sa.Column(sa.String(255)) - router_id = sa.Column(sa.String(36), sa.ForeignKey('routers.id', - ondelete="CASCADE"), - primary_key=True) - - -#neutron/plugins/ml2/drivers/brocade/db/models.py -class ML2_BrocadeNetwork(BASEV2, HasId, - HasTenant): - vlan = sa.Column(sa.String(10)) - segment_id = sa.Column(sa.String(36)) - network_type = sa.Column(sa.String(10)) - - -#neutron/plugins/ml2/drivers/brocade/db/models.py -class ML2_BrocadePort(BASEV2, HasId, - HasTenant): - network_id = sa.Column(sa.String(36), - sa.ForeignKey("ml2_brocadenetworks.id"), - nullable=False) - admin_state_up = sa.Column(sa.Boolean, nullable=False) - physical_interface = sa.Column(sa.String(36)) - vlan_id = sa.Column(sa.String(36)) - - -#neutron/plugins/ml2/drivers/cisco/apic/apic_model.py -class NetworkEPG(BASEV2): - __tablename__ = 'cisco_ml2_apic_epgs' - - network_id = sa.Column(sa.String(255), nullable=False, primary_key=True) - epg_id = sa.Column(sa.String(64), nullable=False) - segmentation_id = sa.Column(sa.String(64), nullable=False) - provider = sa.Column(sa.Boolean, default=False, - server_default=sa.sql.false(), nullable=False) - - -#neutron/plugins/ml2/drivers/cisco/apic/apic_model.py -class PortProfile(BASEV2): - __tablename__ = 'cisco_ml2_apic_port_profiles' - - node_id = sa.Column(sa.String(255), nullable=False, primary_key=True) - profile_id = sa.Column(sa.String(64), nullable=False) - hpselc_id = sa.Column(sa.String(64), nullable=False) - module = sa.Column(sa.String(10), nullable=False) - from_port = sa.Column(sa.Integer(), nullable=False) - to_port = sa.Column(sa.Integer(), nullable=False) - - -#neutron/plugins/ml2/drivers/cisco/apic/apic_model.py -class TenantContract(BASEV2, HasTenant): - __tablename__ = 'cisco_ml2_apic_contracts' - - __table_args__ = (sa.PrimaryKeyConstraint('tenant_id'),) - contract_id = sa.Column(sa.String(64), nullable=False) - filter_id = sa.Column(sa.String(64), nullable=False) - - -#neutron/plugins/ml2/drivers/cisco/nexus/nexus_models_v2.py -#class was renamed from NexusPortBinding to CiscoMl2NexusPortBinding -class CiscoMl2NexusPortBinding(BASEV2): - __tablename__ = "cisco_ml2_nexusport_bindings" - - binding_id = sa.Column(sa.Integer, primary_key=True, autoincrement=True) - port_id = sa.Column(sa.String(255)) - vlan_id = sa.Column(sa.Integer, nullable=False) - switch_ip = sa.Column(sa.String(255)) - instance_id = sa.Column(sa.String(255)) - - -#neutron/plugins/ml2/drivers/mech_arista/db.py -class AristaProvisionedNets(BASEV2, HasId, - HasTenant): - __tablename__ = 'arista_provisioned_nets' - - network_id = sa.Column(sa.String(UUID_LEN)) - segmentation_id = sa.Column(sa.Integer) - - -#neutron/plugins/ml2/drivers/mech_arista/db.py -class AristaProvisionedVms(BASEV2, HasId, - HasTenant): - __tablename__ = 'arista_provisioned_vms' - - vm_id = sa.Column(sa.String(STR_LEN)) - host_id = sa.Column(sa.String(STR_LEN)) - port_id = sa.Column(sa.String(UUID_LEN)) - network_id = sa.Column(sa.String(UUID_LEN)) - - -#neutron/plugins/ml2/drivers/mech_arista/db.py -class AristaProvisionedTenants(BASEV2, HasId, - HasTenant): - __tablename__ = 'arista_provisioned_tenants' - - -#neutron/plugins/ml2/drivers/type_flat.py -class FlatAllocation(BASEV2): - __tablename__ = 'ml2_flat_allocations' - - physical_network = sa.Column(sa.String(64), nullable=False, - primary_key=True) - - -#neutron/plugins/ml2/drivers/type_gre.py -class GreAllocation(BASEV2): - __tablename__ = 'ml2_gre_allocations' - - gre_id = sa.Column(sa.Integer, nullable=False, primary_key=True, - autoincrement=False) - allocated = sa.Column(sa.Boolean, nullable=False, default=False, - server_default=sa.sql.false()) - - -#neutron/plugins/ml2/drivers/type_gre.py -class GreEndpoints(BASEV2): - __tablename__ = 'ml2_gre_endpoints' - - ip_address = sa.Column(sa.String(64), primary_key=True) - - -#neutron/plugins/ml2/drivers/type_vlan.py -#class was renamed from VlanAllocation to Ml2VlanAllocation -class Ml2VlanAllocation(BASEV2): - __tablename__ = 'ml2_vlan_allocations' - - physical_network = sa.Column(sa.String(64), nullable=False, - primary_key=True) - vlan_id = sa.Column(sa.Integer, nullable=False, primary_key=True, - autoincrement=False) - allocated = sa.Column(sa.Boolean, nullable=False) - - -#neutron/plugins/ml2/drivers/type_vxlan.py -class VxlanAllocation(BASEV2): - __tablename__ = 'ml2_vxlan_allocations' - - vxlan_vni = sa.Column(sa.Integer, nullable=False, primary_key=True, - autoincrement=False) - allocated = sa.Column(sa.Boolean, nullable=False, default=False, - server_default=sa.sql.false()) - - -#neutron/plugins/ml2/drivers/type_vxlan.py -class VxlanEndpoints(BASEV2): - __tablename__ = 'ml2_vxlan_endpoints' - - ip_address = sa.Column(sa.String(64), primary_key=True) - udp_port = sa.Column(sa.Integer, primary_key=True, nullable=False, - autoincrement=False) - - -#neutron/plugins/ml2/models.py -class NetworkSegment(BASEV2, HasId): - __tablename__ = 'ml2_network_segments' - - network_id = sa.Column(sa.String(36), - sa.ForeignKey('networks.id', ondelete="CASCADE"), - nullable=False) - network_type = sa.Column(sa.String(32), nullable=False) - physical_network = sa.Column(sa.String(64)) - segmentation_id = sa.Column(sa.Integer) - - -#neutron/plugins/ml2/models.py -class PortBinding(BASEV2): - __tablename__ = 'ml2_port_bindings' - - port_id = sa.Column(sa.String(36), - sa.ForeignKey('ports.id', ondelete="CASCADE"), - primary_key=True) - host = sa.Column(sa.String(255), nullable=False, default='', - server_default='') - vnic_type = sa.Column(sa.String(64), nullable=False, - default=VNIC_NORMAL, server_default=VNIC_NORMAL) - profile = sa.Column(sa.String(BINDING_PROFILE_LEN), nullable=False, - default='', server_default='') - vif_type = sa.Column(sa.String(64), nullable=False) - vif_details = sa.Column(sa.String(4095), nullable=False, default='', - server_default='') - driver = sa.Column(sa.String(64)) - segment = sa.Column(sa.String(36), - sa.ForeignKey('ml2_network_segments.id', - ondelete="SET NULL")) - port = orm.relationship( - Port, - backref=orm.backref("port_binding", - lazy='joined', uselist=False, - cascade='delete')) - - -#neutron/plugins/mlnx/db/mlnx_models_v2.py -class SegmentationIdAllocation(BASEV2): - __tablename__ = 'segmentation_id_allocation' - - physical_network = sa.Column(sa.String(64), nullable=False, - primary_key=True) - segmentation_id = sa.Column(sa.Integer, nullable=False, primary_key=True, - autoincrement=False) - allocated = sa.Column(sa.Boolean, nullable=False, default=False, - server_default=sa.sql.false()) - - -#neutron/plugins/mlnx/db/mlnx_models_v2.py -#class was renamed from NetworkBinding to MlnxNetworkBinding -class MlnxNetworkBinding(BASEV2): - __tablename__ = 'mlnx_network_bindings' - - network_id = sa.Column(sa.String(36), - sa.ForeignKey('networks.id', ondelete="CASCADE"), - primary_key=True) - network_type = sa.Column(sa.String(32), nullable=False) - physical_network = sa.Column(sa.String(64)) - segmentation_id = sa.Column(sa.Integer, nullable=False) - - -#neutron/plugins/mlnx/db/mlnx_models_v2.py -class PortProfileBinding(BASEV2): - __tablename__ = 'port_profile' - - port_id = sa.Column(sa.String(36), - sa.ForeignKey('ports.id', ondelete="CASCADE"), - primary_key=True) - vnic_type = sa.Column(sa.String(32), nullable=False) - - -#neutron/plugins/nec/db/models.py -class OFCId(object): - ofc_id = sa.Column(sa.String(255), unique=True, nullable=False) - - -#neutron/plugins/nec/db/models.py -class NeutronId(object): - neutron_id = sa.Column(sa.String(36), primary_key=True) - - -#neutron/plugins/nec/db/models.py -class OFCTenantMapping(BASEV2, NeutronId, OFCId): - """Represents a Tenant on OpenFlow Network/Controller.""" - - -#neutron/plugins/nec/db/models.py -class OFCNetworkMapping(BASEV2, NeutronId, OFCId): - """Represents a Network on OpenFlow Network/Controller.""" - - -#neutron/plugins/nec/db/models.py -class OFCPortMapping(BASEV2, NeutronId, OFCId): - """Represents a Port on OpenFlow Network/Controller.""" - - -#neutron/plugins/nec/db/models.py -class OFCRouterMapping(BASEV2, NeutronId, OFCId): - """Represents a router on OpenFlow Network/Controller.""" - - -#neutron/plugins/nec/db/models.py -class OFCFilterMapping(BASEV2, NeutronId, OFCId): - """Represents a Filter on OpenFlow Network/Controller.""" - - -#neutron/plugins/nec/db/models.py -class PortInfo(BASEV2): - id = sa.Column(sa.String(36), - sa.ForeignKey('ports.id', ondelete="CASCADE"), - primary_key=True) - datapath_id = sa.Column(sa.String(36), nullable=False) - port_no = sa.Column(sa.Integer, nullable=False) - vlan_id = sa.Column(sa.Integer, nullable=False) - mac = sa.Column(sa.String(32), nullable=False) - port = orm.relationship( - Port, - backref=orm.backref("portinfo", - lazy='joined', uselist=False, - cascade='delete')) - - -#neutron/plugins/nec/db/packetfilter.py -class PacketFilter(BASEV2, HasId, HasTenant): - name = sa.Column(sa.String(255)) - network_id = sa.Column(sa.String(36), - sa.ForeignKey('networks.id', ondelete="CASCADE"), - nullable=False) - priority = sa.Column(sa.Integer, nullable=False) - action = sa.Column(sa.String(16), nullable=False) - in_port = sa.Column(sa.String(36), - sa.ForeignKey('ports.id', ondelete="CASCADE"), - nullable=True) - src_mac = sa.Column(sa.String(32), nullable=False) - dst_mac = sa.Column(sa.String(32), nullable=False) - eth_type = sa.Column(sa.Integer, nullable=False) - src_cidr = sa.Column(sa.String(64), nullable=False) - dst_cidr = sa.Column(sa.String(64), nullable=False) - protocol = sa.Column(sa.String(16), nullable=False) - src_port = sa.Column(sa.Integer, nullable=False) - dst_port = sa.Column(sa.Integer, nullable=False) - admin_state_up = sa.Column(sa.Boolean(), nullable=False) - status = sa.Column(sa.String(16), nullable=False) - - network = orm.relationship( - Network, - backref=orm.backref('packetfilters', lazy='joined', cascade='delete'), - uselist=False) - in_port_ref = orm.relationship( - Port, - backref=orm.backref('packetfilters', lazy='joined', cascade='delete'), - primaryjoin="Port.id==PacketFilter.in_port", - uselist=False) - - -#neutron/plugins/nec/db/router.py -class RouterProvider(BASEV2): - provider = sa.Column(sa.String(255)) - router_id = sa.Column(sa.String(36), - sa.ForeignKey('routers.id', ondelete="CASCADE"), - primary_key=True) - - router = orm.relationship(Router, uselist=False, - backref=orm.backref('provider', uselist=False, - lazy='joined', - cascade='delete')) - - -#neutron/plugins/nuage/nuage_models.py -class NetPartition(BASEV2, HasId): - __tablename__ = 'nuage_net_partitions' - name = sa.Column(sa.String(64)) - l3dom_tmplt_id = sa.Column(sa.String(36)) - l2dom_tmplt_id = sa.Column(sa.String(36)) - - -#neutron/plugins/nuage/nuage_models.py -class NetPartitionRouter(BASEV2): - __tablename__ = "nuage_net_partition_router_mapping" - net_partition_id = sa.Column(sa.String(36), - sa.ForeignKey('nuage_net_partitions.id', - ondelete="CASCADE"), - primary_key=True) - router_id = sa.Column(sa.String(36), - sa.ForeignKey('routers.id', ondelete="CASCADE"), - primary_key=True) - nuage_router_id = sa.Column(sa.String(36)) - - -#neutron/plugins/nuage/nuage_models.py -class RouterZone(BASEV2): - __tablename__ = "nuage_router_zone_mapping" - router_id = sa.Column(sa.String(36), - sa.ForeignKey('routers.id', ondelete="CASCADE"), - primary_key=True) - nuage_zone_id = sa.Column(sa.String(36)) - nuage_user_id = sa.Column(sa.String(36)) - nuage_group_id = sa.Column(sa.String(36)) - - -#neutron/plugins/nuage/nuage_models.py -class SubnetL2Domain(BASEV2): - __tablename__ = 'nuage_subnet_l2dom_mapping' - subnet_id = sa.Column(sa.String(36), - sa.ForeignKey('subnets.id', ondelete="CASCADE"), - primary_key=True) - net_partition_id = sa.Column(sa.String(36), - sa.ForeignKey('nuage_net_partitions.id', - ondelete="CASCADE")) - nuage_subnet_id = sa.Column(sa.String(36)) - nuage_l2dom_tmplt_id = sa.Column(sa.String(36)) - nuage_user_id = sa.Column(sa.String(36)) - nuage_group_id = sa.Column(sa.String(36)) - - -#neutron/plugins/nuage/nuage_models.py -class PortVPortMapping(BASEV2): - __tablename__ = 'nuage_port_mapping' - port_id = sa.Column(sa.String(36), - sa.ForeignKey('ports.id', ondelete="CASCADE"), - primary_key=True) - nuage_vport_id = sa.Column(sa.String(36)) - nuage_vif_id = sa.Column(sa.String(36)) - static_ip = sa.Column(sa.Boolean()) - - -#neutron/plugins/nuage/nuage_models.py -class RouterRoutesMapping(BASEV2, Route): - __tablename__ = 'nuage_routerroutes_mapping' - router_id = sa.Column(sa.String(36), - sa.ForeignKey('routers.id', - ondelete="CASCADE"), - primary_key=True, - nullable=False) - nuage_route_id = sa.Column(sa.String(36)) - - -#neutron/plugins/nuage/nuage_models.py -class FloatingIPPoolMapping(BASEV2): - __tablename__ = "nuage_floatingip_pool_mapping" - fip_pool_id = sa.Column(sa.String(36), primary_key=True) - net_id = sa.Column(sa.String(36), - sa.ForeignKey('networks.id', ondelete="CASCADE")) - router_id = sa.Column(sa.String(36)) - - -#neutron/plugins/nuage/nuage_models.py -class FloatingIPMapping(BASEV2): - __tablename__ = 'nuage_floatingip_mapping' - fip_id = sa.Column(sa.String(36), - sa.ForeignKey('floatingips.id', - ondelete="CASCADE"), - primary_key=True) - router_id = sa.Column(sa.String(36)) - nuage_fip_id = sa.Column(sa.String(36)) - - -#neutron/plugins/openvswitch/ovs_models_v2.py -#class was renamed from VlanAllocation to OvsVlanAllocation -class OvsVlanAllocation(BASEV2): - __tablename__ = 'ovs_vlan_allocations' - - physical_network = sa.Column(sa.String(64), - nullable=False, - primary_key=True) - vlan_id = sa.Column(sa.Integer, nullable=False, primary_key=True, - autoincrement=False) - allocated = sa.Column(sa.Boolean, nullable=False) - - -#neutron/plugins/openvswitch/ovs_models_v2.py -class TunnelAllocation(BASEV2): - __tablename__ = 'ovs_tunnel_allocations' - - tunnel_id = sa.Column(sa.Integer, nullable=False, primary_key=True, - autoincrement=False) - allocated = sa.Column(sa.Boolean, nullable=False) - - -#neutron/plugins/openvswitch/ovs_models_v2.py -#class was renamed from NetworkBinding to OvsNetworkBinding -class OvsNetworkBinding(BASEV2): - __tablename__ = 'ovs_network_bindings' - - network_id = sa.Column(sa.String(36), - sa.ForeignKey('networks.id', ondelete="CASCADE"), - primary_key=True) - # 'gre', 'vlan', 'flat', 'local' - network_type = sa.Column(sa.String(32), nullable=False) - physical_network = sa.Column(sa.String(64)) - segmentation_id = sa.Column(sa.Integer) # tunnel_id or vlan_id - - network = orm.relationship( - Network, - backref=orm.backref("binding", lazy='joined', - uselist=False, cascade='delete')) - - -#neutron/plugins/openvswitch/ovs_models_v2.py -class TunnelEndpoint(BASEV2): - __tablename__ = 'ovs_tunnel_endpoints' - __table_args__ = ( - schema.UniqueConstraint('id', name='uniq_ovs_tunnel_endpoints0id'), - BASEV2.__table_args__, - ) - - ip_address = sa.Column(sa.String(64), primary_key=True) - id = sa.Column(sa.Integer, nullable=False) - - -#neutron/plugins/ryu/db/models_v2.py -class TunnelKeyLast(BASEV2): - last_key = sa.Column(sa.Integer, primary_key=True) - - -#neutron/plugins/ryu/db/models_v2.py -class TunnelKey(BASEV2): - network_id = sa.Column(sa.String(36), sa.ForeignKey("networks.id"), - nullable=False) - tunnel_key = sa.Column(sa.Integer, primary_key=True, - nullable=False, autoincrement=False) - - -#neutron/plugins/vmware/dbexts/lsn_db.py -class LsnPort(BASEV2): - __tablename__ = 'lsn_port' - - lsn_port_id = sa.Column(sa.String(36), primary_key=True) - - lsn_id = sa.Column(sa.String(36), sa.ForeignKey('lsn.lsn_id', - ondelete="CASCADE"), - nullable=False) - sub_id = sa.Column(sa.String(36), nullable=False, unique=True) - mac_addr = sa.Column(sa.String(32), nullable=False, unique=True) - - -#neutron/plugins/vmware/dbexts/lsn_db.py -class Lsn(BASEV2): - __tablename__ = 'lsn' - - lsn_id = sa.Column(sa.String(36), primary_key=True) - net_id = sa.Column(sa.String(36), nullable=False) - - -#neutron/plugins/vmware/dbexts/maclearning.py -class MacLearningState(BASEV2): - port_id = sa.Column(sa.String(36), - sa.ForeignKey('ports.id', ondelete="CASCADE"), - primary_key=True) - mac_learning_enabled = sa.Column(sa.Boolean(), nullable=False) - port = orm.relationship( - Port, - backref=orm.backref("mac_learning_state", lazy='joined', - uselist=False, cascade='delete')) - - -#neutron/plugins/vmware/dbexts/models.py -class TzNetworkBinding(BASEV2): - __tablename__ = 'tz_network_bindings' - - network_id = sa.Column(sa.String(36), - sa.ForeignKey('networks.id', ondelete="CASCADE"), - primary_key=True) - binding_type = sa.Column(sa.Enum('flat', 'vlan', 'stt', 'gre', 'l3_ext', - name='tz_network_bindings_binding_type'), - nullable=False, primary_key=True) - phy_uuid = sa.Column(sa.String(36), primary_key=True, nullable=True) - vlan_id = sa.Column(sa.Integer, primary_key=True, nullable=True, - autoincrement=False) - - -#neutron/plugins/vmware/dbexts/models.py -class NeutronNsxNetworkMapping(BASEV2): - __tablename__ = 'neutron_nsx_network_mappings' - neutron_id = sa.Column(sa.String(36), - sa.ForeignKey('networks.id', ondelete='CASCADE'), - primary_key=True) - nsx_id = sa.Column(sa.String(36), primary_key=True) - - -#neutron/plugins/vmware/dbexts/models.py -class NeutronNsxSecurityGroupMapping(BASEV2): - __tablename__ = 'neutron_nsx_security_group_mappings' - neutron_id = sa.Column(sa.String(36), - sa.ForeignKey('securitygroups.id', - ondelete="CASCADE"), - primary_key=True) - nsx_id = sa.Column(sa.String(36), primary_key=True) - - -#neutron/plugins/vmware/dbexts/models.py -class NeutronNsxPortMapping(BASEV2): - __tablename__ = 'neutron_nsx_port_mappings' - neutron_id = sa.Column(sa.String(36), - sa.ForeignKey('ports.id', ondelete="CASCADE"), - primary_key=True) - nsx_switch_id = sa.Column(sa.String(36)) - nsx_port_id = sa.Column(sa.String(36), nullable=False) - - -#neutron/plugins/vmware/dbexts/models.py -class NeutronNsxRouterMapping(BASEV2): - __tablename__ = 'neutron_nsx_router_mappings' - neutron_id = sa.Column(sa.String(36), - sa.ForeignKey('routers.id', ondelete='CASCADE'), - primary_key=True) - nsx_id = sa.Column(sa.String(36)) - - -#neutron/plugins/vmware/dbexts/models.py -class MultiProviderNetworks(BASEV2): - __tablename__ = 'multi_provider_networks' - network_id = sa.Column(sa.String(36), - sa.ForeignKey('networks.id', ondelete="CASCADE"), - primary_key=True) - - -#neutron/plugins/vmware/dbexts/models.py -class NSXRouterExtAttributes(BASEV2): - router_id = sa.Column(sa.String(36), - sa.ForeignKey('routers.id', ondelete="CASCADE"), - primary_key=True) - distributed = sa.Column(sa.Boolean, default=False, - server_default=sa.sql.false(), nullable=False) - service_router = sa.Column(sa.Boolean, default=False, - server_default=sa.sql.false(), nullable=False) - router = orm.relationship( - Router, - backref=orm.backref("nsx_attributes", lazy='joined', - uselist=False, cascade='delete')) - - -#neutron/plugins/vmware/dbexts/networkgw_db.py -class NetworkConnection(BASEV2, HasTenant): - network_gateway_id = sa.Column(sa.String(36), - sa.ForeignKey('networkgateways.id', - ondelete='CASCADE')) - network_id = sa.Column(sa.String(36), - sa.ForeignKey('networks.id', ondelete='CASCADE')) - segmentation_type = sa.Column( - sa.Enum('flat', 'vlan', - name='networkconnections_segmentation_type')) - segmentation_id = sa.Column(sa.Integer) - __table_args__ = (sa.UniqueConstraint(network_gateway_id, - segmentation_type, - segmentation_id),) - port_id = sa.Column(sa.String(36), - sa.ForeignKey('ports.id', ondelete='CASCADE'), - primary_key=True) - - -#neutron/plugins/vmware/dbexts/networkgw_db.py -class NetworkGatewayDeviceReference(BASEV2): - id = sa.Column(sa.String(36), primary_key=True) - network_gateway_id = sa.Column(sa.String(36), - sa.ForeignKey('networkgateways.id', - ondelete='CASCADE'), - primary_key=True) - interface_name = sa.Column(sa.String(64), primary_key=True) - - -#neutron/plugins/vmware/dbexts/networkgw_db.py -class NetworkGatewayDevice(BASEV2, HasId, - HasTenant): - nsx_id = sa.Column(sa.String(36)) - # Optional name for the gateway device - name = sa.Column(sa.String(255)) - # Transport connector type. Not using enum as range of - # connector types might vary with backend version - connector_type = sa.Column(sa.String(10)) - # Transport connector IP Address - connector_ip = sa.Column(sa.String(64)) - # operational status - status = sa.Column(sa.String(16)) - - -#neutron/plugins/vmware/dbexts/networkgw_db.py -class NetworkGateway(BASEV2, HasId, - HasTenant): - name = sa.Column(sa.String(255)) - # Tenant id is nullable for this resource - tenant_id = sa.Column(sa.String(36)) - default = sa.Column(sa.Boolean()) - devices = orm.relationship(NetworkGatewayDeviceReference, - backref='networkgateways', - cascade='all,delete') - network_connections = orm.relationship(NetworkConnection, lazy='joined') - - -#neutron/plugins/vmware/dbexts/qos_db.py -class QoSQueue(BASEV2, HasId, HasTenant): - name = sa.Column(sa.String(255)) - default = sa.Column(sa.Boolean, default=False, - server_default=sa.sql.false()) - min = sa.Column(sa.Integer, nullable=False) - max = sa.Column(sa.Integer, nullable=True) - qos_marking = sa.Column(sa.Enum('untrusted', 'trusted', - name='qosqueues_qos_marking')) - dscp = sa.Column(sa.Integer) - - -#neutron/plugins/vmware/dbexts/qos_db.py -class PortQueueMapping(BASEV2): - port_id = sa.Column(sa.String(36), - sa.ForeignKey("ports.id", ondelete="CASCADE"), - primary_key=True) - - queue_id = sa.Column(sa.String(36), sa.ForeignKey("qosqueues.id"), - primary_key=True) - - # Add a relationship to the Port model adding a backref which will - # allow SQLAlchemy for eagerly load the queue binding - port = orm.relationship( - Port, - backref=orm.backref("qos_queue", uselist=False, - cascade='delete', lazy='joined')) - - -#neutron/plugins/vmware/dbexts/qos_db.py -class NetworkQueueMapping(BASEV2): - network_id = sa.Column(sa.String(36), - sa.ForeignKey("networks.id", ondelete="CASCADE"), - primary_key=True) - - queue_id = sa.Column(sa.String(36), sa.ForeignKey("qosqueues.id", - ondelete="CASCADE")) - - # Add a relationship to the Network model adding a backref which will - # allow SQLAlcremy for eagerly load the queue binding - network = orm.relationship( - Network, - backref=orm.backref("qos_queue", uselist=False, - cascade='delete', lazy='joined')) - - -#neutron/plugins/vmware/dbexts/vcns_models.py -class VcnsRouterBinding(BASEV2, HasStatusDescription): - __tablename__ = 'vcns_router_bindings' - - # no sa.ForeignKey to routers.id because for now, a router can be removed - # from routers when delete_router is executed, but the binding is only - # removed after the Edge is deleted - router_id = sa.Column(sa.String(36), - primary_key=True) - edge_id = sa.Column(sa.String(16), - nullable=True) - lswitch_id = sa.Column(sa.String(36), - nullable=False) - - -#neutron/plugins/vmware/dbexts/vcns_models.py -class VcnsEdgeFirewallRuleBinding(BASEV2): - __tablename__ = 'vcns_firewall_rule_bindings' - - rule_id = sa.Column(sa.String(36), - sa.ForeignKey("firewall_rules.id"), - primary_key=True) - edge_id = sa.Column(sa.String(36), primary_key=True) - rule_vseid = sa.Column(sa.String(36)) - - -#neutron/plugins/vmware/dbexts/vcns_models.py -class VcnsEdgePoolBinding(BASEV2): - __tablename__ = 'vcns_edge_pool_bindings' - - pool_id = sa.Column(sa.String(36), - sa.ForeignKey("pools.id", ondelete="CASCADE"), - primary_key=True) - edge_id = sa.Column(sa.String(36), primary_key=True) - pool_vseid = sa.Column(sa.String(36)) - - -#neutron/plugins/vmware/dbexts/vcns_models.py -class VcnsEdgeVipBinding(BASEV2): - __tablename__ = 'vcns_edge_vip_bindings' - - vip_id = sa.Column(sa.String(36), - sa.ForeignKey("vips.id", ondelete="CASCADE"), - primary_key=True) - edge_id = sa.Column(sa.String(36)) - vip_vseid = sa.Column(sa.String(36)) - app_profileid = sa.Column(sa.String(36)) - - -#neutron/plugins/vmware/dbexts/vcns_models.py -class VcnsEdgeMonitorBinding(BASEV2): - __tablename__ = 'vcns_edge_monitor_bindings' - - monitor_id = sa.Column(sa.String(36), - sa.ForeignKey("healthmonitors.id", - ondelete="CASCADE"), - primary_key=True) - edge_id = sa.Column(sa.String(36), primary_key=True) - monitor_vseid = sa.Column(sa.String(36)) - - -#neutron/services/loadbalancer/agent_scheduler.py -class PoolLoadbalancerAgentBinding(BASEV2): - pool_id = sa.Column(sa.String(36), - sa.ForeignKey("pools.id", ondelete='CASCADE'), - primary_key=True) - agent = orm.relation(Agent) - agent_id = sa.Column(sa.String(36), sa.ForeignKey("agents.id", - ondelete='CASCADE'), - nullable=False) - - -#neutron/services/loadbalancer/drivers/embrane/models.py -class PoolPort(BASEV2): - __tablename__ = 'embrane_pool_port' - - pool_id = sa.Column(sa.String(36), sa.ForeignKey('pools.id'), - primary_key=True) - port_id = sa.Column(sa.String(36), sa.ForeignKey('ports.id'), - nullable=False) - - -#neutron/services/vpn/service_drivers/cisco_csr_db.py -class IdentifierMap(BASEV2, HasTenant): - __tablename__ = 'cisco_csr_identifier_map' - - ipsec_site_conn_id = sa.Column(sa.String(64), - sa.ForeignKey('ipsec_site_connections.id', - ondelete="CASCADE"), - primary_key=True) - csr_tunnel_id = sa.Column(sa.Integer, nullable=False) - csr_ike_policy_id = sa.Column(sa.Integer, nullable=False) - csr_ipsec_policy_id = sa.Column(sa.Integer, nullable=False) - - -def get_metadata(): - return BASEV2.metadata diff --git a/neutron/tests/functional/db/test_models.py b/neutron/tests/functional/db/test_models.py index 939617177..a05c5a549 100644 --- a/neutron/tests/functional/db/test_models.py +++ b/neutron/tests/functional/db/test_models.py @@ -36,7 +36,3 @@ class TestDBCreation(base.BaseTestCase): def test_head_creation(self): from neutron.db.migration.models import head self._test_creation(head) - - def test_frozen_creation(self): - from neutron.db.migration.models import frozen - self._test_creation(frozen)