Merge "Revert "Squash alchemy Liberty branch""

changes/63/738163/16
Zuul 2 years ago committed by Gerrit Code Review
commit ad99b74d5e
  1. 2
      neutron/db/migration/__init__.py
  2. 133
      neutron/db/migration/alembic_migrations/cisco_init_ops.py
  3. 40
      neutron/db/migration/alembic_migrations/core_init_ops.py
  4. 38
      neutron/db/migration/alembic_migrations/lb_init_ops.py
  5. 17
      neutron/db/migration/alembic_migrations/ml2_init_ops.py
  6. 13
      neutron/db/migration/alembic_migrations/nsxv_initial_opts.py
  7. 42
      neutron/db/migration/alembic_migrations/other_extensions_init_ops.py
  8. 17
      neutron/db/migration/alembic_migrations/other_plugins_init_ops.py
  9. 54
      neutron/db/migration/alembic_migrations/ovs_init_ops.py
  10. 16
      neutron/db/migration/alembic_migrations/versions/kilo_initial.py
  11. 57
      neutron/db/migration/alembic_migrations/versions/liberty/contract/11926bcfe72d_add_geneve_ml2_type_driver.py
  12. 33
      neutron/db/migration/alembic_migrations/versions/liberty/contract/2a16083502f3_metaplugin_removal.py
  13. 44
      neutron/db/migration/alembic_migrations/versions/liberty/contract/2e5352a0ad4d_add_missing_foreign_keys.py
  14. 31
      neutron/db/migration/alembic_migrations/versions/liberty/contract/30018084ec99_initial.py
  15. 49
      neutron/db/migration/alembic_migrations/versions/liberty/contract/4af11ca47297_drop_cisco_monolithic_tables.py
  16. 69
      neutron/db/migration/alembic_migrations/versions/liberty/contract/4ffceebfada_rbac_network.py
  17. 37
      neutron/db/migration/alembic_migrations/versions/liberty/contract/5498d17be016_drop_legacy_ovs_and_lb.py
  18. 36
      neutron/db/migration/alembic_migrations/versions/liberty/expand/1b4c6e320f79_address_scope_support_in_subnetpool.py
  19. 35
      neutron/db/migration/alembic_migrations/versions/liberty/expand/1c844d1677f7_dns_nameservers_order.py
  20. 35
      neutron/db/migration/alembic_migrations/versions/liberty/expand/26c371498592_subnetpool_hash.py
  21. 62
      neutron/db/migration/alembic_migrations/versions/liberty/expand/31337ec0ffee_flavors.py
  22. 42
      neutron/db/migration/alembic_migrations/versions/liberty/expand/34af2b5c5a59_add_dns_name_to_port.py
  23. 47
      neutron/db/migration/alembic_migrations/versions/liberty/expand/354db87e3225_nsxv_vdr_metadata.py
  24. 45
      neutron/db/migration/alembic_migrations/versions/liberty/expand/45f955889773_quota_usage.py
  25. 16
      neutron/db/migration/alembic_migrations/versions/liberty/expand/48153cb5f051_qos_db_changes.py
  26. 36
      neutron/db/migration/alembic_migrations/versions/liberty/expand/52c5312f6baf_address_scopes.py
  27. 16
      neutron/db/migration/alembic_migrations/versions/liberty/expand/599c6a226151_neutrodb_ipam.py
  28. 16
      neutron/db/migration/alembic_migrations/versions/liberty/expand/8675309a5c4f_rbac_network.py
  29. 47
      neutron/db/migration/alembic_migrations/versions/liberty/expand/9859ac9c136_quota_reservations.py
  30. 7
      neutron/db/migration/alembic_migrations/versions/mitaka/contract/1b294093239c_remove_embrane_plugin.py
  31. 7
      neutron/db/migration/alembic_migrations/versions/mitaka/expand/59cb5b6cf4d_availability_zone.py
  32. 23
      neutron/db/migration/cli.py
  33. 26
      neutron/tests/unit/db/test_migration.py

@ -23,6 +23,7 @@ from sqlalchemy.engine import reflection
from neutron._i18n import _
# Neutron milestones for upgrade aliases
LIBERTY = 'liberty'
MITAKA = 'mitaka'
NEWTON = 'newton'
OCATA = 'ocata'
@ -36,6 +37,7 @@ VICTORIA = 'victoria'
NEUTRON_MILESTONES = [
# earlier milestones were not tagged
LIBERTY,
MITAKA,
NEWTON,
OCATA,

@ -26,6 +26,139 @@ network_profile_type = sa.Enum('vlan', 'vxlan', name='network_profile_type')
def upgrade():
op.create_table(
'cisco_policy_profiles',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=255), nullable=True),
sa.PrimaryKeyConstraint('id'))
op.create_table(
'cisco_network_profiles',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=255), nullable=True),
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,
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'))
op.create_table(
'cisco_n1kv_vxlan_allocations',
sa.Column('vxlan_id', sa.Integer(), autoincrement=False,
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),
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.Column('type', sa.String(length=255), nullable=True),
sa.PrimaryKeyConstraint('credential_name'))
op.create_table(
'cisco_qos_policies',
sa.Column('qos_id', sa.String(length=255), nullable=True),
sa.Column('tenant_id', sa.String(length=255), nullable=False),
sa.Column('qos_name', sa.String(length=255), nullable=False),
sa.Column('qos_desc', sa.String(length=255), nullable=True),
sa.PrimaryKeyConstraint('tenant_id', 'qos_name'))
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,
server_default='TENANT_ID_NOT_SET'),
sa.Column('profile_id', sa.String(length=36), nullable=False),
sa.PrimaryKeyConstraint('tenant_id', 'profile_id'))
op.create_table(
'cisco_n1kv_vmnetworks',
sa.Column('name', sa.String(length=80), nullable=False),
sa.Column('profile_id', sa.String(length=36), nullable=True),
sa.Column('network_id', sa.String(length=36), nullable=True),
sa.Column('port_count', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['profile_id'],
['cisco_policy_profiles.id'], ),
sa.PrimaryKeyConstraint('name'))
op.create_table(
'cisco_n1kv_trunk_segments',
sa.Column('trunk_segment_id', sa.String(length=36), nullable=False),
sa.Column('segment_id', sa.String(length=36), nullable=False),
sa.Column('dot1qtag', sa.String(length=36), nullable=False),
sa.ForeignKeyConstraint(['trunk_segment_id'], ['networks.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('trunk_segment_id', 'segment_id', 'dot1qtag'))
op.create_table(
'cisco_provider_networks',
sa.Column('network_id', sa.String(length=36), nullable=False),
sa.Column('network_type', sa.String(length=255), nullable=False),
sa.Column('segmentation_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('network_id'))
op.create_table(
'cisco_n1kv_multi_segments',
sa.Column('multi_segment_id', sa.String(length=36), nullable=False),
sa.Column('segment1_id', sa.String(length=36), nullable=False),
sa.Column('segment2_id', sa.String(length=36), nullable=False),
sa.Column('encap_profile_name', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['multi_segment_id'], ['networks.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('multi_segment_id', 'segment1_id',
'segment2_id'))
op.create_table(
'cisco_n1kv_network_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=True),
sa.Column('segmentation_id', sa.Integer(), nullable=True),
sa.Column('multicast_ip', sa.String(length=32), nullable=True),
sa.Column('profile_id', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
ondelete='CASCADE'),
sa.ForeignKeyConstraint(['profile_id'],
['cisco_network_profiles.id']),
sa.PrimaryKeyConstraint('network_id'))
op.create_table(
'cisco_n1kv_port_bindings',
sa.Column('port_id', sa.String(length=36), nullable=False),
sa.Column('profile_id', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
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),

@ -15,7 +15,6 @@
# Initial operations for core resources
from alembic import op
from neutron_lib.db import constants
import sqlalchemy as sa
@ -28,6 +27,7 @@ def upgrade():
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('status', sa.String(length=16), nullable=True),
sa.Column('admin_state_up', sa.Boolean(), nullable=True),
sa.Column('shared', sa.Boolean(), nullable=True),
sa.Column('mtu', sa.Integer(), nullable=True),
sa.Column('vlan_transparent', sa.Boolean(), nullable=True),
sa.PrimaryKeyConstraint('id'))
@ -44,8 +44,6 @@ def upgrade():
sa.Column('status', sa.String(length=16), nullable=False),
sa.Column('device_id', sa.String(length=255), nullable=False),
sa.Column('device_owner', sa.String(length=255), nullable=False),
sa.Column('dns_name', sa.String(length=constants.FQDN_FIELD_SIZE),
nullable=True),
sa.ForeignKeyConstraint(['network_id'], ['networks.id']),
sa.UniqueConstraint('network_id', 'mac_address',
name='uniq_ports0network_id0mac_address'),
@ -66,6 +64,7 @@ def upgrade():
sa.Column('cidr', sa.String(length=64), nullable=False),
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'),
@ -83,7 +82,6 @@ def upgrade():
'dnsnameservers',
sa.Column('address', sa.String(length=128), nullable=False),
sa.Column('subnet_id', sa.String(length=36), nullable=False),
sa.Column('order', sa.Integer(), server_default='0', nullable=False),
sa.ForeignKeyConstraint(['subnet_id'], ['subnets.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('address', 'subnet_id'))
@ -144,37 +142,3 @@ def upgrade():
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('network_id', 'dhcp_agent_id'))
op.create_table(
'flavors',
sa.Column('id', sa.String(36)),
sa.Column('name', sa.String(255)),
sa.Column('description', sa.String(1024)),
sa.Column('enabled', sa.Boolean, nullable=False,
server_default=sa.sql.true()),
sa.Column('service_type', sa.String(36), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table(
'serviceprofiles',
sa.Column('id', sa.String(36)),
sa.Column('description', sa.String(1024)),
sa.Column('driver', sa.String(1024), nullable=False),
sa.Column('enabled', sa.Boolean, nullable=False,
server_default=sa.sql.true()),
sa.Column('metainfo', sa.String(4096)),
sa.PrimaryKeyConstraint('id')
)
op.create_table(
'flavorserviceprofilebindings',
sa.Column('service_profile_id', sa.String(36), nullable=False),
sa.Column('flavor_id', sa.String(36), nullable=False),
sa.ForeignKeyConstraint(['service_profile_id'],
['serviceprofiles.id'],
ondelete='CASCADE'),
sa.ForeignKeyConstraint(['flavor_id'], ['flavors.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('service_profile_id', 'flavor_id')
)

@ -0,0 +1,38 @@
# 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.
#
# Initial operations for the port security extension
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table(
'network_states',
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(), nullable=False),
sa.PrimaryKeyConstraint('physical_network', 'vlan_id'))
op.create_table(
'network_bindings',
sa.Column('network_id', sa.String(length=36), nullable=False),
sa.Column('physical_network', sa.String(length=64), nullable=True),
sa.Column('vlan_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('network_id'))

@ -47,14 +47,6 @@ def upgrade():
sa.UniqueConstraint('host', name='unique_ml2_gre_endpoints0host'),
sa.PrimaryKeyConstraint('ip_address'))
op.create_table(
'ml2_geneve_endpoints',
sa.Column('ip_address', sa.String(length=64), nullable=False),
sa.Column('host', sa.String(length=255), nullable=True),
sa.PrimaryKeyConstraint('ip_address'),
sa.UniqueConstraint('host', name='unique_ml2_geneve_endpoints0host'),
)
op.create_table(
'ml2_vxlan_allocations',
sa.Column('vxlan_vni', sa.Integer(), autoincrement=False,
@ -71,15 +63,6 @@ def upgrade():
server_default=sa.sql.false(), index=True),
sa.PrimaryKeyConstraint('gre_id'))
op.create_table(
'ml2_geneve_allocations',
sa.Column('geneve_vni', sa.Integer(),
autoincrement=False, nullable=False),
sa.Column('allocated', sa.Boolean(), nullable=False,
server_default=sa.sql.false(), index=True),
sa.PrimaryKeyConstraint('geneve_vni'),
)
op.create_table(
'ml2_flat_allocations',
sa.Column('physical_network', sa.String(length=64), nullable=False),

@ -135,16 +135,3 @@ def upgrade():
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('router_id'))
op.create_table(
'nsxv_vdr_dhcp_bindings',
sa.Column('vdr_router_id', sa.String(length=36), nullable=False),
sa.Column('dhcp_router_id', sa.String(length=36), nullable=False),
sa.Column('dhcp_edge_id', sa.String(length=36), nullable=False),
sa.PrimaryKeyConstraint('vdr_router_id'),
sa.UniqueConstraint(
'dhcp_router_id',
name='unique_nsxv_vdr_dhcp_bindings0dhcp_router_id'),
sa.UniqueConstraint(
'dhcp_edge_id',
name='unique_nsxv_vdr_dhcp_bindings0dhcp_edge_id'))

@ -43,35 +43,6 @@ def upgrade():
sa.Column('limit', sa.Integer(), nullable=True),
sa.PrimaryKeyConstraint('id'))
op.create_table(
'quotausages',
sa.Column('tenant_id', sa.String(length=255),
nullable=False, primary_key=True, index=True),
sa.Column('resource', sa.String(length=255),
nullable=False, primary_key=True, index=True),
sa.Column('dirty', sa.Boolean(), nullable=False,
server_default=sa.sql.false()),
sa.Column('in_use', sa.Integer(), nullable=False,
server_default='0'),
sa.Column('reserved', sa.Integer(), nullable=False,
server_default='0'))
op.create_table(
'reservations',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('expiration', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id'))
op.create_table(
'resourcedeltas',
sa.Column('resource', sa.String(length=255), nullable=False),
sa.Column('reservation_id', sa.String(length=36), nullable=False),
sa.Column('amount', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['reservation_id'], ['reservations.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('resource', 'reservation_id'))
op.create_table(
'allowedaddresspairs',
sa.Column('port_id', sa.String(length=36), nullable=False),
@ -116,10 +87,6 @@ def upgrade():
sa.Column('max_prefixlen', sa.Integer(), nullable=False),
sa.Column('shared', sa.Boolean(), nullable=False),
sa.Column('default_quota', sa.Integer(), nullable=True),
sa.Column('address_scope_id', sa.String(length=36),
nullable=True),
sa.Column('hash', sa.String(36), nullable=False,
server_default=''),
sa.PrimaryKeyConstraint('id'))
op.create_table('subnetpoolprefixes',
sa.Column('cidr', sa.String(length=64), nullable=False),
@ -130,12 +97,3 @@ def upgrade():
['subnetpools.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('cidr', 'subnetpool_id'))
op.create_table(
'address_scopes',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('tenant_id', sa.String(length=255), nullable=True,
index=True),
sa.Column('shared', sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint('id'))

@ -23,6 +23,23 @@ import sqlalchemy as sa
def upgrade():
# metaplugin
op.create_table(
'networkflavors',
sa.Column('flavor', sa.String(length=255), nullable=True),
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(
'routerflavors',
sa.Column('flavor', sa.String(length=255), nullable=True),
sa.Column('router_id', sa.String(length=36), nullable=False),
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('router_id'))
# big switch
op.create_table(
'routerrules',

@ -0,0 +1,54 @@
# 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.
#
# Initial operations for the OVS plugin
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table(
'ovs_tunnel_endpoints',
sa.Column('ip_address', sa.String(length=64), nullable=False),
sa.Column('id', sa.Integer(), nullable=False),
sa.PrimaryKeyConstraint('ip_address'),
sa.UniqueConstraint('id', name='uniq_ovs_tunnel_endpoints0id'))
op.create_table(
'ovs_tunnel_allocations',
sa.Column('tunnel_id', sa.Integer(), autoincrement=False,
nullable=False),
sa.Column('allocated', sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint('tunnel_id'))
op.create_table(
'ovs_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(), nullable=False),
sa.PrimaryKeyConstraint('physical_network', 'vlan_id'))
op.create_table(
'ovs_network_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=True),
sa.Column('segmentation_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('network_id'))

@ -20,8 +20,8 @@ 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 ipam_init_ops
from neutron.db.migration.alembic_migrations import l3_init_ops
from neutron.db.migration.alembic_migrations import lb_init_ops
from neutron.db.migration.alembic_migrations import loadbalancer_init_ops
from neutron.db.migration.alembic_migrations import metering_init_ops
from neutron.db.migration.alembic_migrations import ml2_init_ops
@ -30,22 +30,21 @@ from neutron.db.migration.alembic_migrations import nsxv_initial_opts
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
from neutron.db.migration.alembic_migrations import portsec_init_ops
from neutron.db.migration.alembic_migrations import qos_init_ops
from neutron.db.migration.alembic_migrations import rbac_init_ops
from neutron.db.migration.alembic_migrations import secgroup_init_ops
from neutron.db.migration.alembic_migrations import vmware_init_ops
from neutron.db.migration.alembic_migrations import vpn_init_ops
"""liberty_initial
"""kilo_initial
Revision ID: liberty
Revision ID: kilo
Revises: None
"""
# revision identifiers, used by Alembic.
revision = 'liberty'
revision = 'kilo'
down_revision = None
@ -57,6 +56,8 @@ def upgrade():
secgroup_init_ops.upgrade()
portsec_init_ops.upgrade()
other_extensions_init_ops.upgrade()
lb_init_ops.upgrade()
ovs_init_ops.upgrade()
ml2_init_ops.upgrade()
dvr_init_opts.upgrade()
firewall_init_ops.upgrade()
@ -70,6 +71,3 @@ def upgrade():
vmware_init_ops.upgrade()
nuage_init_opts.upgrade()
nsxv_initial_opts.upgrade()
ipam_init_ops.upgrade()
qos_init_ops.upgrade()
rbac_init_ops.upgrade()

@ -0,0 +1,57 @@
# 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
# 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 alembic import op
import sqlalchemy as sa
"""add geneve ml2 type driver
Revision ID: 11926bcfe72d
Revises: 2e5352a0ad4d
Create Date: 2015-08-27 19:56:16.356522
"""
# revision identifiers, used by Alembic.
revision = '11926bcfe72d'
down_revision = '2e5352a0ad4d'
def contract_creation_exceptions():
"""These elements were created by mistake in the contract branch."""
return {
sa.Table: ['ml2_geneve_allocations', 'ml2_geneve_endpoints'],
sa.Index: ['ml2_geneve_allocations']
}
def upgrade():
op.create_table(
'ml2_geneve_allocations',
sa.Column('geneve_vni', sa.Integer(),
autoincrement=False, nullable=False),
sa.Column('allocated', sa.Boolean(),
server_default=sa.sql.false(), nullable=False),
sa.PrimaryKeyConstraint('geneve_vni'),
)
op.create_index(op.f('ix_ml2_geneve_allocations_allocated'),
'ml2_geneve_allocations', ['allocated'], unique=False)
op.create_table(
'ml2_geneve_endpoints',
sa.Column('ip_address', sa.String(length=64), nullable=False),
sa.Column('host', sa.String(length=255), nullable=True),
sa.PrimaryKeyConstraint('ip_address'),
sa.UniqueConstraint('host', name='unique_ml2_geneve_endpoints0host'),
)

@ -0,0 +1,33 @@
# 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
# 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 alembic import op
"""Metaplugin removal
Revision ID: 2a16083502f3
Revises: 5498d17be016
Create Date: 2015-06-16 09:11:10.488566
"""
# revision identifiers, used by Alembic.
revision = '2a16083502f3'
down_revision = '5498d17be016'
def upgrade():
op.drop_table('networkflavors')
op.drop_table('routerflavors')

@ -0,0 +1,44 @@
# Copyright 2015 Red Hat, 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.
#
from alembic import op
from sqlalchemy.engine import reflection
from neutron.db import migration
"""Add missing foreign keys
Revision ID: 2e5352a0ad4d
Revises: 2a16083502f3
Create Date: 2015-08-20 12:43:09.110427
"""
# revision identifiers, used by Alembic.
revision = '2e5352a0ad4d'
down_revision = '2a16083502f3'
TABLE_NAME = 'flavorserviceprofilebindings'
def upgrade():
inspector = reflection.Inspector.from_engine(op.get_bind())
fk_constraints = inspector.get_foreign_keys(TABLE_NAME)
for fk in fk_constraints:
fk['options']['ondelete'] = 'CASCADE'
migration.remove_foreign_keys(TABLE_NAME, fk_constraints)
migration.create_foreign_keys(TABLE_NAME, fk_constraints)

@ -0,0 +1,31 @@
# 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.migration import cli
"""Initial no-op Liberty contract rule.
Revision ID: 30018084ec99
Revises: None
Create Date: 2015-06-22 00:00:00.000000
"""
# revision identifiers, used by Alembic.
revision = '30018084ec99'
down_revision = 'kilo'
branch_labels = (cli.CONTRACT_BRANCH,)
def upgrade():
pass

@ -0,0 +1,49 @@
# Copyright 2015 Cisco Systems, 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.
#
from alembic import op
from neutron.db import migration
"""Drop cisco monolithic tables
Revision ID: 4af11ca47297
Revises: 11926bcfe72d
Create Date: 2015-08-13 08:01:19.709839
"""
# revision identifiers, used by Alembic.
revision = '4af11ca47297'
down_revision = '11926bcfe72d'
# milestone identifier, used by neutron-db-manage
neutron_milestone = [migration.LIBERTY]
def upgrade():
op.drop_table('cisco_n1kv_port_bindings')
op.drop_table('cisco_n1kv_network_bindings')
op.drop_table('cisco_n1kv_multi_segments')
op.drop_table('cisco_provider_networks')
op.drop_table('cisco_n1kv_trunk_segments')
op.drop_table('cisco_n1kv_vmnetworks')
op.drop_table('cisco_n1kv_profile_bindings')
op.drop_table('cisco_qos_policies')
op.drop_table('cisco_credentials')
op.drop_table('cisco_n1kv_vlan_allocations')
op.drop_table('cisco_n1kv_vxlan_allocations')
op.drop_table('cisco_network_profiles')
op.drop_table('cisco_policy_profiles')

@ -0,0 +1,69 @@
# 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
# 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 alembic import op
from oslo_utils import uuidutils
import sqlalchemy as sa
"""network_rbac
Revision ID: 4ffceebfada
Revises: 30018084ec99
Create Date: 2015-06-14 13:12:04.012457
"""
# revision identifiers, used by Alembic.
revision = '4ffceebfada'
down_revision = '30018084ec99'
depends_on = ('8675309a5c4f',)
# A simple model of the networks table with only the fields needed for
# the migration.
network = sa.Table('networks', sa.MetaData(),
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('tenant_id', sa.String(length=255)),
sa.Column('shared', sa.Boolean(), nullable=False))
networkrbacs = sa.Table(
'networkrbacs', sa.MetaData(),
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('object_id', sa.String(length=36), nullable=False),
sa.Column('tenant_id', sa.String(length=255), nullable=True,
index=True),
sa.Column('target_tenant', sa.String(length=255), nullable=False),
sa.Column('action', sa.String(length=255), nullable=False))
def upgrade():
op.bulk_insert(networkrbacs, get_values())
op.drop_column('networks', 'shared')
# the shared column on subnets was just an internal representation of the
# shared status of the network it was related to. This is now handled by
# other logic so we just drop it.
op.drop_column('subnets', 'shared')
def get_values():
session = sa.orm.Session(bind=op.get_bind())
values = []
for row in session.query(network).filter(network.c.shared).all():
values.append({'id': uuidutils.generate_uuid(), 'object_id': row[0],
'tenant_id': row[1], 'target_tenant': '*',
'action': 'access_as_shared'})
# this commit appears to be necessary to allow further operations
session.commit()
return values

@ -0,0 +1,37 @@
# 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
# 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 alembic import op
"""Drop legacy OVS and LB plugin tables
Revision ID: 5498d17be016
Revises: 4ffceebfada
Create Date: 2015-06-25 14:08:30.984419
"""
# revision identifiers, used by Alembic.
revision = '5498d17be016'
down_revision = '4ffceebfada'
def upgrade():
op.drop_table('ovs_network_bindings')
op.drop_table('ovs_vlan_allocations')
op.drop_table('network_bindings')
op.drop_table('ovs_tunnel_allocations')
op.drop_table('network_states')
op.drop_table('ovs_tunnel_endpoints')

@ -0,0 +1,36 @@
# Copyright 2015 Huawei Technologies India Pvt. Ltd.
#
# 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 alembic import op
import sqlalchemy as sa
"""address scope support in subnetpool
Revision ID: 1b4c6e320f79
Revises: 1c844d1677f7
Create Date: 2015-07-03 09:48:39.491058
"""
# revision identifiers, used by Alembic.
revision = '1b4c6e320f79'
down_revision = '1c844d1677f7'
def upgrade():
op.add_column('subnetpools',
sa.Column('address_scope_id',
sa.String(length=36),
nullable=True))

@ -0,0 +1,35 @@
# 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
# 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 alembic import op
import sqlalchemy as sa
"""add order to dnsnameservers
Revision ID: 1c844d1677f7
Revises: 26c371498592
Create Date: 2015-07-21 22:59:03.383850
"""
# revision identifiers, used by Alembic.
revision = '1c844d1677f7'
down_revision = '26c371498592'
def upgrade():
op.add_column('dnsnameservers',
sa.Column('order', sa.Integer(),
server_default='0', nullable=False))

@ -0,0 +1,35 @@
# Copyright (c) 2015 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.
#
from alembic import op
import sqlalchemy as sa
"""subnetpool hash
Revision ID: 26c371498592
Revises: 45f955889773
Create Date: 2015-06-02 21:18:19.942076
"""
# revision identifiers, used by Alembic.
revision = '26c371498592'
down_revision = '45f955889773'
def upgrade():
op.add_column(
'subnetpools',
sa.Column('hash', sa.String(36), nullable=False, server_default=''))

@ -0,0 +1,62 @@
# Copyright 2014-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
# 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 alembic import op
import sqlalchemy as sa
"""Flavor framework
Revision ID: 313373c0ffee
Revises: 52c5312f6baf
Create Date: 2014-07-17 03:00:00.00
"""
# revision identifiers, used by Alembic.
revision = '313373c0ffee'
down_revision = '52c5312f6baf'
def upgrade():
op.create_table(
'flavors',
sa.Column('id', sa.String(36)),
sa.Column('name', sa.String(255)),
sa.Column('description', sa.String(1024)),
sa.Column('enabled', sa.Boolean, nullable=False,
server_default=sa.sql.true()),
sa.Column('service_type', sa.String(36), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table(
'serviceprofiles',
sa.Column('id', sa.String(36)),
sa.Column('description', sa.String(1024)),
sa.Column('driver', sa.String(1024), nullable=False),
sa.Column('enabled', sa.Boolean, nullable=False,
server_default=sa.sql.true()),
sa.Column('metainfo', sa.String(4096)),
sa.PrimaryKeyConstraint('id')
)
op.create_table(
'flavorserviceprofilebindings',
sa.Column('service_profile_id', sa.String(36), nullable=False),
sa.Column('flavor_id', sa.String(36), nullable=False),
sa.ForeignKeyConstraint(['service_profile_id'],
['serviceprofiles.id']),
sa.ForeignKeyConstraint(['flavor_id'], ['flavors.id']),
sa.PrimaryKeyConstraint('service_profile_id', 'flavor_id')
)

@ -0,0 +1,42 @@
# Copyright 2015 Rackspace
#
# 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 alembic import op
from neutron_lib.db import constants
import sqlalchemy as sa
from neutron.db import migration
"""Add dns_name to Port
Revision ID: 34af2b5c5a59
Revises: 9859ac9c136
Create Date: 2015-08-23 00:22:47.618593
"""
# revision identifiers, used by Alembic.
revision = '34af2b5c5a59'
down_revision = '9859ac9c136'
# milestone identifier, used by neutron-db-manage
neutron_milestone = [migration.LIBERTY]
def upgrade():
op.add_column('ports',
sa.Column('dns_name',
sa.String(length=constants.FQDN_FIELD_SIZE),
nullable=True))

@ -0,0 +1,47 @@
# 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
# 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 alembic import op
import sqlalchemy as sa
from neutron.db.migration import cli
"""nsxv_vdr_metadata.py
Revision ID: 354db87e3225
Revises: kilo
Create Date: 2015-04-19 14:59:15.102609
"""
# revision identifiers, used by Alembic.
revision = '354db87e3225'
down_revision = 'kilo'
branch_labels = (cli.EXPAND_BRANCH,)
def upgrade():
op.create_table(
'nsxv_vdr_dhcp_bindings',
sa.Column('vdr_router_id', sa.String(length=36), nullable=False),
sa.Column('dhcp_router_id', sa.String(length=36), nullable=False),
sa.Column('dhcp_edge_id', sa.String(length=36), nullable=False),
sa.PrimaryKeyConstraint('vdr_router_id'),
sa.UniqueConstraint(
'dhcp_router_id',
name='unique_nsxv_vdr_dhcp_bindings0dhcp_router_id'),
sa.UniqueConstraint(
'dhcp_edge_id',
name='unique_nsxv_vdr_dhcp_bindings0dhcp_edge_id'))

@ -0,0 +1,45 @@
# 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
# 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 alembic import op
import sqlalchemy as sa
from sqlalchemy import sql
"""quota_usage
Revision ID: 45f955889773
Revises: 8675309a5c4f
Create Date: 2015-04-17 08:09:37.611546
"""
# revision identifiers, used by Alembic.
revision = '45f955889773'
down_revision = '8675309a5c4f'
def upgrade():
op.create_table(
'quotausages',
sa.Column('tenant_id', sa.String(length=255),
nullable=False, primary_key=True, index=True),
sa.Column('resource', sa.String(length=255),
nullable=False, primary_key=True, index=True),
sa.Column('dirty', sa.Boolean(), nullable=False,
server_default=sql.false()),
sa.Column('in_use', sa.Integer(), nullable=False,
server_default='0'),
sa.Column('reserved', sa.Integer(), nullable=False,
server_default='0'))

@ -1,5 +1,4 @@
# Copyright (c) 2020 Red Hat, Inc.
# All Rights Reserved.
# Copyright 2015 Huawei Technologies India Pvt Ltd, 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
@ -12,10 +11,23 @@
# 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 alembic import op
import sqlalchemy as sa
"""qos db changes
Revision ID: 48153cb5f051
Revises: 1b4c6e320f79
Create Date: 2015-06-24 17:03:34.965101
"""
# revision identifiers, used by Alembic.
revision = '48153cb5f051'
down_revision = '1b4c6e320f79'
def upgrade():
op.create_table(

@ -0,0 +1,36 @@
# Copyright (c) 2015 Red Hat, 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.
#
from alembic import op
import sqlalchemy as sa
"""Initial operations in support of address scopes
"""
# revision identifiers, used by Alembic.
revision = '52c5312f6baf'
down_revision = '599c6a226151'
def upgrade():
op.create_table(
'address_scopes',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('tenant_id', sa.String(length=255), nullable=True,
index=True),
sa.Column('shared', sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint('id'))

@ -1,5 +1,4 @@
# Copyright (c) 2020 Red Hat, Inc.
# All Rights Reserved.
# 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
@ -12,10 +11,23 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or i