Set lock_path correctly.
[openstack-build/neutron-build.git] / neutron / db / migration / alembic_migrations / nuage_init_opts.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 # Initial operations for Nuage plugin
17
18 from alembic import op
19 import sqlalchemy as sa
20
21
22 def upgrade():
23
24     op.create_table(
25         'nuage_net_partitions',
26         sa.Column('id', sa.String(length=36), nullable=False),
27         sa.Column('name', sa.String(length=64), nullable=True),
28         sa.Column('l3dom_tmplt_id', sa.String(length=36), nullable=True),
29         sa.Column('l2dom_tmplt_id', sa.String(length=36), nullable=True),
30         sa.Column('isolated_zone', sa.String(length=64), nullable=True),
31         sa.Column('shared_zone', sa.String(length=64), nullable=True),
32         sa.PrimaryKeyConstraint('id'),
33     )
34     op.create_table(
35         'nuage_subnet_l2dom_mapping',
36         sa.Column('subnet_id', sa.String(length=36), nullable=False),
37         sa.Column('net_partition_id', sa.String(length=36), nullable=True),
38         sa.Column('nuage_subnet_id', sa.String(length=36), nullable=True,
39                   unique=True),
40         sa.Column('nuage_l2dom_tmplt_id', sa.String(length=36),
41                   nullable=True),
42         sa.Column('nuage_user_id', sa.String(length=36), nullable=True),
43         sa.Column('nuage_group_id', sa.String(length=36), nullable=True),
44         sa.Column('nuage_managed_subnet', sa.Boolean(), nullable=True),
45         sa.ForeignKeyConstraint(['subnet_id'], ['subnets.id'],
46                                 ondelete='CASCADE'),
47         sa.ForeignKeyConstraint(['net_partition_id'],
48                                 ['nuage_net_partitions.id'],
49                                 ondelete='CASCADE'),
50         sa.PrimaryKeyConstraint('subnet_id'),
51     )
52     op.create_table(
53         'nuage_net_partition_router_mapping',
54         sa.Column('net_partition_id', sa.String(length=36), nullable=False),
55         sa.Column('router_id', sa.String(length=36), nullable=False),
56         sa.Column('nuage_router_id', sa.String(length=36), nullable=True,
57                   unique=True),
58         sa.Column('nuage_rtr_rd', sa.String(length=36), nullable=True),
59         sa.Column('nuage_rtr_rt', sa.String(length=36), nullable=True),
60         sa.ForeignKeyConstraint(['net_partition_id'],
61                                 ['nuage_net_partitions.id'],
62                                 ondelete='CASCADE'),
63         sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
64                                 ondelete='CASCADE'),
65         sa.PrimaryKeyConstraint('net_partition_id', 'router_id'),
66     )
67     op.create_table(
68         'nuage_provider_net_bindings',
69         sa.Column('network_id', sa.String(length=36), nullable=False),
70         sa.Column('network_type', sa.String(length=32), nullable=False),
71         sa.Column('physical_network', sa.String(length=64), nullable=False),
72         sa.Column('vlan_id', sa.Integer(), nullable=False),
73         sa.ForeignKeyConstraint(
74             ['network_id'], ['networks.id'], ondelete='CASCADE'),
75         sa.PrimaryKeyConstraint('network_id')
76     )