9ef55843da6052d54e20222a3ab8aabdb1b3f171
[openstack-build/neutron-build.git] / neutron / db / migration / alembic_migrations / versions / liberty / contract / 11926bcfe72d_add_geneve_ml2_type_driver.py
1 # Copyright 2015 OpenStack Foundation
2 #
3 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
4 #    not use this file except in compliance with the License. You may obtain
5 #    a copy of the License at
6 #
7 #         http://www.apache.org/licenses/LICENSE-2.0
8 #
9 #    Unless required by applicable law or agreed to in writing, software
10 #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 #    License for the specific language governing permissions and limitations
13 #    under the License.
14 #
15
16 """add geneve ml2 type driver
17
18 Revision ID: 11926bcfe72d
19 Revises: 2e5352a0ad4d
20 Create Date: 2015-08-27 19:56:16.356522
21
22 """
23
24 # revision identifiers, used by Alembic.
25 revision = '11926bcfe72d'
26 down_revision = '2e5352a0ad4d'
27
28 from alembic import op
29 import sqlalchemy as sa
30
31
32 def upgrade():
33     op.create_table(
34         'ml2_geneve_allocations',
35         sa.Column('geneve_vni', sa.Integer(),
36                   autoincrement=False, nullable=False),
37         sa.Column('allocated', sa.Boolean(),
38                   server_default=sa.sql.false(), nullable=False),
39         sa.PrimaryKeyConstraint('geneve_vni'),
40     )
41     op.create_index(op.f('ix_ml2_geneve_allocations_allocated'),
42                     'ml2_geneve_allocations', ['allocated'], unique=False)
43     op.create_table(
44         'ml2_geneve_endpoints',
45         sa.Column('ip_address', sa.String(length=64), nullable=False),
46         sa.Column('host', sa.String(length=255), nullable=True),
47         sa.PrimaryKeyConstraint('ip_address'),
48         sa.UniqueConstraint('host', name='unique_ml2_geneve_endpoints0host'),
49     )