diff options
Diffstat (limited to 'networking_sfc/db/migration')
14 files changed, 0 insertions, 515 deletions
diff --git a/networking_sfc/db/migration/README b/networking_sfc/db/migration/README deleted file mode 100644 index 20c6fb9..0000000 --- a/networking_sfc/db/migration/README +++ /dev/null @@ -1,3 +0,0 @@ -For details refer to: -http://docs.openstack.org/developer/networking-sfc/alembic_migration.html - diff --git a/networking_sfc/db/migration/__init__.py b/networking_sfc/db/migration/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/networking_sfc/db/migration/__init__.py +++ /dev/null diff --git a/networking_sfc/db/migration/alembic_migrations/__init__.py b/networking_sfc/db/migration/alembic_migrations/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/networking_sfc/db/migration/alembic_migrations/__init__.py +++ /dev/null diff --git a/networking_sfc/db/migration/alembic_migrations/env.py b/networking_sfc/db/migration/alembic_migrations/env.py deleted file mode 100644 index e2f858a..0000000 --- a/networking_sfc/db/migration/alembic_migrations/env.py +++ /dev/null @@ -1,88 +0,0 @@ -# Copyright 2015 Futurewei. 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. - -from logging import config as logging_config - -from alembic import context -from neutron.db import model_base -from oslo_config import cfg -from oslo_db.sqlalchemy import session -import sqlalchemy as sa -from sqlalchemy import event - -from networking_sfc.db.migration.models import head # noqa - - -MYSQL_ENGINE = None -SFC_VERSION_TABLE = 'alembic_version_sfc' -config = context.config -neutron_config = config.neutron_config -logging_config.fileConfig(config.config_file_name) -target_metadata = model_base.BASEV2.metadata - - -def set_mysql_engine(): - try: - mysql_engine = neutron_config.command.mysql_engine - except cfg.NoSuchOptError: - mysql_engine = None - - global MYSQL_ENGINE - MYSQL_ENGINE = (mysql_engine or - model_base.BASEV2.__table_args__['mysql_engine']) - - -def run_migrations_offline(): - set_mysql_engine() - - kwargs = dict() - if neutron_config.database.connection: - kwargs['url'] = neutron_config.database.connection - else: - kwargs['dialect_name'] = neutron_config.database.engine - kwargs['version_table'] = SFC_VERSION_TABLE - context.configure(**kwargs) - - with context.begin_transaction(): - context.run_migrations() - - -@event.listens_for(sa.Table, 'after_parent_attach') -def set_storage_engine(target, parent): - if MYSQL_ENGINE: - target.kwargs['mysql_engine'] = MYSQL_ENGINE - - -def run_migrations_online(): - set_mysql_engine() - engine = session.create_engine(neutron_config.database.connection) - - connection = engine.connect() - context.configure( - connection=connection, - target_metadata=target_metadata, - version_table=SFC_VERSION_TABLE - ) - try: - with context.begin_transaction(): - context.run_migrations() - finally: - connection.close() - engine.dispose() - - -if context.is_offline_mode(): - run_migrations_offline() -else: - run_migrations_online() diff --git a/networking_sfc/db/migration/alembic_migrations/script.py.mako b/networking_sfc/db/migration/alembic_migrations/script.py.mako deleted file mode 100644 index 5f14159..0000000 --- a/networking_sfc/db/migration/alembic_migrations/script.py.mako +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2015 Futurewei. 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. -# - -"""${message} - -Revision ID: ${up_revision} -Revises: ${down_revision} -Create Date: ${create_date} - -""" - -# revision identifiers, used by Alembic. -revision = ${repr(up_revision)} -down_revision = ${repr(down_revision)} -% if branch_labels: -branch_labels = ${repr(branch_labels)} -%endif - -from alembic import op -import sqlalchemy as sa -${imports if imports else ""} - -def upgrade(): - ${upgrades if upgrades else "pass"} diff --git a/networking_sfc/db/migration/alembic_migrations/versions/HEADS b/networking_sfc/db/migration/alembic_migrations/versions/HEADS deleted file mode 100644 index 152ab9e..0000000 --- a/networking_sfc/db/migration/alembic_migrations/versions/HEADS +++ /dev/null @@ -1,2 +0,0 @@ -48072cb59133 -5a475fc853e6 diff --git a/networking_sfc/db/migration/alembic_migrations/versions/liberty/contract/48072cb59133_initial.py b/networking_sfc/db/migration/alembic_migrations/versions/liberty/contract/48072cb59133_initial.py deleted file mode 100644 index 87b53ce..0000000 --- a/networking_sfc/db/migration/alembic_migrations/versions/liberty/contract/48072cb59133_initial.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2015 Futurewei. 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. - -"""Initial Mitaka no-op script. - -Revision ID: 48072cb59133 -Revises: start_networking_sfc -Create Date: 2015-07-28 22:18:13.330846 - -""" - -from neutron.db.migration import cli - - -# revision identifiers, used by Alembic. -revision = '48072cb59133' -down_revision = 'start_networking_sfc' -branch_labels = (cli.CONTRACT_BRANCH,) - - -def upgrade(): - pass diff --git a/networking_sfc/db/migration/alembic_migrations/versions/liberty/expand/24fc7241aa5_initial.py b/networking_sfc/db/migration/alembic_migrations/versions/liberty/expand/24fc7241aa5_initial.py deleted file mode 100644 index f23c9b3..0000000 --- a/networking_sfc/db/migration/alembic_migrations/versions/liberty/expand/24fc7241aa5_initial.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2015 Futurewei. 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. - -"""Initial Mitaka no-op script. - -Revision ID: 24fc7241aa5 -Revises: start_networking_sfc -Create Date: 2015-09-11 11:37:19.349951 - -""" - -from neutron.db.migration import cli - - -# revision identifiers, used by Alembic. -revision = '24fc7241aa5' -down_revision = 'start_networking_sfc' -branch_labels = (cli.EXPAND_BRANCH,) - - -def upgrade(): - pass diff --git a/networking_sfc/db/migration/alembic_migrations/versions/liberty/expand/5a475fc853e6_ovs_data_model.py b/networking_sfc/db/migration/alembic_migrations/versions/liberty/expand/5a475fc853e6_ovs_data_model.py deleted file mode 100644 index e257548..0000000 --- a/networking_sfc/db/migration/alembic_migrations/versions/liberty/expand/5a475fc853e6_ovs_data_model.py +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright 2015 Futurewei. 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. - -"""Defining OVS data-model - -Revision ID: 5a475fc853e6 -Revises: c3e178d4a985 -Create Date: 2015-09-30 18:00:57.758762 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '5a475fc853e6' -down_revision = 'c3e178d4a985' - - -def upgrade(): - op.create_table('sfc_portpair_details', - sa.Column('tenant_id', sa.String(length=255), nullable=True), - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('ingress', sa.String(length=36), nullable=True), - sa.Column('egress', sa.String(length=36), nullable=True), - sa.Column('host_id', sa.String(length=255), nullable=False), - sa.Column('mac_address', sa.String(length=32), nullable=False), - sa.Column('network_type', sa.String(length=8), nullable=True), - sa.Column('segment_id', sa.Integer(), nullable=True), - sa.Column('local_endpoint', sa.String(length=64), nullable=False), - sa.PrimaryKeyConstraint('id') - ) - - op.create_index( - op.f('ix_sfc_portpair_details_tenant_id'), - 'sfc_portpair_details', ['tenant_id'], unique=False - ) - op.create_table('sfc_uuid_intid_associations', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('uuid', sa.String(length=36), nullable=False), - sa.Column('intid', sa.Integer(), nullable=False), - sa.Column('type_', sa.String(length=32), nullable=False), - sa.PrimaryKeyConstraint('id', 'uuid'), - sa.UniqueConstraint('intid') - ) - - op.create_table('sfc_path_nodes', - sa.Column('tenant_id', sa.String(length=255), nullable=True), - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('nsp', sa.Integer(), nullable=False), - sa.Column('nsi', sa.Integer(), nullable=False), - sa.Column('node_type', sa.String(length=32), nullable=True), - sa.Column('portchain_id', sa.String(length=255), nullable=True), - sa.Column('status', sa.String(length=32), nullable=True), - sa.Column('next_group_id', sa.Integer(), nullable=True), - sa.Column('next_hop', sa.String(length=512), nullable=True), - sa.ForeignKeyConstraint(['portchain_id'], ['sfc_port_chains.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('id') - ) - op.create_index( - op.f('ix_sfc_path_nodes_tenant_id'), - 'sfc_path_nodes', ['tenant_id'], unique=False - ) - - op.create_table('sfc_path_port_associations', - sa.Column('pathnode_id', sa.String(length=36), nullable=False), - sa.Column('portpair_id', sa.String(length=36), nullable=False), - sa.Column('weight', sa.Integer(), nullable=False), - sa.ForeignKeyConstraint(['pathnode_id'], ['sfc_path_nodes.id'], - ondelete='CASCADE'), - sa.ForeignKeyConstraint(['portpair_id'], ['sfc_portpair_details.id'], - ondelete='CASCADE'), - sa.PrimaryKeyConstraint('pathnode_id', 'portpair_id') - ) diff --git a/networking_sfc/db/migration/alembic_migrations/versions/liberty/expand/9768e6a66c9_flowclassifier_data_model.py b/networking_sfc/db/migration/alembic_migrations/versions/liberty/expand/9768e6a66c9_flowclassifier_data_model.py deleted file mode 100644 index e43e9c1..0000000 --- a/networking_sfc/db/migration/alembic_migrations/versions/liberty/expand/9768e6a66c9_flowclassifier_data_model.py +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 2015 Futurewei. 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. - -"""Defining flow-classifier data-model - -Revision ID: 9768e6a66c9 -Revises: 24fc7241aa5 -Create Date: 2015-09-30 17:54:35.852573 - -""" - -from alembic import op -import sqlalchemy as sa - -from neutron.api.v2 import attributes as attr - -# revision identifiers, used by Alembic. -revision = '9768e6a66c9' -down_revision = '24fc7241aa5' - - -def upgrade(): - op.create_table( - 'sfc_flow_classifiers', - sa.Column('tenant_id', sa.String(length=attr.TENANT_ID_MAX_LEN), - nullable=True, index=True), - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('name', sa.String(length=attr.NAME_MAX_LEN), nullable=True), - sa.Column('ethertype', sa.String(length=40), nullable=True), - sa.Column('protocol', sa.String(length=40), nullable=True), - sa.Column('description', sa.String(length=attr.DESCRIPTION_MAX_LEN), - nullable=True), - sa.Column('source_port_range_min', sa.Integer(), nullable=True), - sa.Column('source_port_range_max', sa.Integer(), nullable=True), - sa.Column('destination_port_range_min', sa.Integer(), nullable=True), - sa.Column('destination_port_range_max', sa.Integer(), nullable=True), - sa.Column('source_ip_prefix', sa.String(length=255), nullable=True), - sa.Column('destination_ip_prefix', sa.String(length=255), - nullable=True), - sa.PrimaryKeyConstraint('id') - ) - - op.create_table( - 'sfc_flow_classifier_l7_parameters', - sa.Column('keyword', sa.String(length=255), nullable=False), - sa.Column('value', sa.String(length=255), nullable=True), - sa.Column('classifier_id', sa.String(length=36), nullable=False), - sa.ForeignKeyConstraint(['classifier_id'], ['sfc_flow_classifiers.id'], ), - sa.PrimaryKeyConstraint('keyword', 'classifier_id') - ) diff --git a/networking_sfc/db/migration/alembic_migrations/versions/liberty/expand/c3e178d4a985_sfc_data_model.py b/networking_sfc/db/migration/alembic_migrations/versions/liberty/expand/c3e178d4a985_sfc_data_model.py deleted file mode 100644 index 9f5362a..0000000 --- a/networking_sfc/db/migration/alembic_migrations/versions/liberty/expand/c3e178d4a985_sfc_data_model.py +++ /dev/null @@ -1,119 +0,0 @@ -# Copyright 2015 Futurewei. 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. - -"""Defining Port Chain data-model. - -Revision ID: c3e178d4a985 -Revises: 9768e6a66c9 -Create Date: 2015-09-11 11:37:19.349951 - -""" - -from alembic import op -import sqlalchemy as sa - -from neutron.api.v2 import attributes as attr - -# revision identifiers, used by Alembic. -revision = 'c3e178d4a985' -down_revision = '9768e6a66c9' - - -def upgrade(): - op.create_table( - 'sfc_port_pair_groups', - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('tenant_id', sa.String(length=attr.TENANT_ID_MAX_LEN), - nullable=True, index=True), - sa.Column('name', sa.String(length=attr.NAME_MAX_LEN), - nullable=True), - sa.Column('description', sa.String(length=attr.DESCRIPTION_MAX_LEN), - nullable=True), - sa.PrimaryKeyConstraint('id') - ) - - op.create_table( - 'sfc_port_pairs', - sa.Column('tenant_id', sa.String(length=attr.TENANT_ID_MAX_LEN), - nullable=True, index=True), - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('name', sa.String(length=attr.NAME_MAX_LEN), nullable=True), - sa.Column('description', sa.String(length=attr.DESCRIPTION_MAX_LEN), - nullable=True), - sa.Column('ingress', sa.String(length=36), nullable=False), - sa.Column('egress', sa.String(length=36), nullable=False), - sa.Column('portpairgroup_id', sa.String(length=36), nullable=True), - sa.ForeignKeyConstraint(['egress'], ['ports.id'], - ondelete='RESTRICT'), - sa.ForeignKeyConstraint(['ingress'], ['ports.id'], - ondelete='RESTRICT'), - sa.ForeignKeyConstraint(['portpairgroup_id'], ['sfc_port_pair_groups.id'], - ondelete='RESTRICT'), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('ingress', 'egress', - name='uniq_sfc_port_pairs0ingress0egress') - ) - - op.create_table( - 'sfc_port_chains', - sa.Column('tenant_id', sa.String(length=attr.TENANT_ID_MAX_LEN), - nullable=True, index=True), - sa.Column('id', sa.String(length=36), nullable=False), - sa.Column('name', sa.String(length=attr.NAME_MAX_LEN), - nullable=True), - sa.Column('description', sa.String(length=attr.DESCRIPTION_MAX_LEN), - nullable=True), - sa.PrimaryKeyConstraint('id') - ) - - op.create_table( - 'sfc_chain_group_associations', - sa.Column('portpairgroup_id', sa.String(length=36), nullable=False), - sa.Column('portchain_id', sa.String(length=36), nullable=False), - sa.Column('position', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['portchain_id'], ['sfc_port_chains.id'], ), - sa.ForeignKeyConstraint(['portpairgroup_id'], ['sfc_port_pair_groups.id'], - ondelete='RESTRICT'), - sa.PrimaryKeyConstraint('portpairgroup_id', 'portchain_id') - ) - - op.create_table( - 'sfc_port_chain_parameters', - sa.Column('keyword', sa.String(length=255), nullable=False), - sa.Column('value', sa.String(length=255), nullable=True), - sa.Column('chain_id', sa.String(length=36), nullable=False), - sa.ForeignKeyConstraint(['chain_id'], ['sfc_port_chains.id'], ), - sa.PrimaryKeyConstraint('keyword', 'chain_id') - ) - - op.create_table( - 'sfc_service_function_params', - sa.Column('keyword', sa.String(length=255), nullable=False), - sa.Column('value', sa.String(length=255), nullable=True), - sa.Column('pair_id', sa.String(length=36), nullable=False), - sa.ForeignKeyConstraint(['pair_id'], ['sfc_port_pairs.id'], ), - sa.PrimaryKeyConstraint('keyword', 'pair_id') - ) - - op.create_table( - 'sfc_chain_classifier_associations', - sa.Column('flowclassifier_id', sa.String(length=36), nullable=False), - sa.Column('portchain_id', sa.String(length=36), nullable=False), - sa.ForeignKeyConstraint(['flowclassifier_id'], - ['sfc_flow_classifiers.id'], - ondelete='RESTRICT'), - sa.ForeignKeyConstraint(['portchain_id'], ['sfc_port_chains.id'], ), - sa.PrimaryKeyConstraint('flowclassifier_id', 'portchain_id'), - sa.UniqueConstraint('flowclassifier_id') - ) diff --git a/networking_sfc/db/migration/alembic_migrations/versions/start_networking_sfc.py b/networking_sfc/db/migration/alembic_migrations/versions/start_networking_sfc.py deleted file mode 100644 index 4810d1e..0000000 --- a/networking_sfc/db/migration/alembic_migrations/versions/start_networking_sfc.py +++ /dev/null @@ -1,30 +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. -# - -"""start networking-sfc chain - -Revision ID: start_networking_sfc -Revises: None -Create Date: 2015-09-10 18:42:08.262632 - -""" - -# revision identifiers, used by Alembic. -revision = 'start_networking_sfc' -down_revision = None - - -def upgrade(): - pass diff --git a/networking_sfc/db/migration/models/__init__.py b/networking_sfc/db/migration/models/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/networking_sfc/db/migration/models/__init__.py +++ /dev/null diff --git a/networking_sfc/db/migration/models/head.py b/networking_sfc/db/migration/models/head.py deleted file mode 100644 index 1345cd6..0000000 --- a/networking_sfc/db/migration/models/head.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2015 Futurewei. 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. - -from neutron.db import model_base - -from networking_sfc.db import flowclassifier_db # noqa -from networking_sfc.db import sfc_db # noqa -from networking_sfc.services.sfc.drivers.ovs import db as ovs_db # noqa - - -def get_metadata(): - return model_base.BASEV2.metadata |