1
# Copyright 2014 OpenStack Foundation
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
7
# http://www.apache.org/licenses/LICENSE-2.0
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
16
# Initial operations for core resources
17
from alembic import op
18
import sqlalchemy as sa
24
sa.Column('tenant_id', sa.String(length=255), nullable=True),
25
sa.Column('id', sa.String(length=36), nullable=False),
26
sa.Column('name', sa.String(length=255), nullable=True),
27
sa.Column('status', sa.String(length=16), nullable=True),
28
sa.Column('admin_state_up', sa.Boolean(), nullable=True),
29
sa.Column('shared', sa.Boolean(), nullable=True),
30
sa.PrimaryKeyConstraint('id'))
34
sa.Column('tenant_id', sa.String(length=255), nullable=True),
35
sa.Column('id', sa.String(length=36), nullable=False),
36
sa.Column('name', sa.String(length=255), nullable=True),
37
sa.Column('network_id', sa.String(length=36), nullable=False),
38
sa.Column('mac_address', sa.String(length=32), nullable=False),
39
sa.Column('admin_state_up', sa.Boolean(), nullable=False),
40
sa.Column('status', sa.String(length=16), nullable=False),
41
sa.Column('device_id', sa.String(length=255), nullable=False),
42
sa.Column('device_owner', sa.String(length=255), nullable=False),
43
sa.ForeignKeyConstraint(['network_id'], ['networks.id'], ),
44
sa.PrimaryKeyConstraint('id'))
48
sa.Column('tenant_id', sa.String(length=255), nullable=True),
49
sa.Column('id', sa.String(length=36), nullable=False),
50
sa.Column('name', sa.String(length=255), nullable=True),
51
sa.Column('network_id', sa.String(length=36), nullable=True),
52
sa.Column('ip_version', sa.Integer(), nullable=False),
53
sa.Column('cidr', sa.String(length=64), nullable=False),
54
sa.Column('gateway_ip', sa.String(length=64), nullable=True),
55
sa.Column('enable_dhcp', sa.Boolean(), nullable=True),
56
sa.Column('shared', sa.Boolean(), nullable=True),
57
sa.ForeignKeyConstraint(['network_id'], ['networks.id'], ),
58
sa.PrimaryKeyConstraint('id'))
62
sa.Column('address', sa.String(length=128), nullable=False),
63
sa.Column('subnet_id', sa.String(length=36), nullable=False),
64
sa.ForeignKeyConstraint(['subnet_id'], ['subnets.id'],
66
sa.PrimaryKeyConstraint('address', 'subnet_id'))
70
sa.Column('id', sa.String(length=36), nullable=False),
71
sa.Column('subnet_id', sa.String(length=36), nullable=True),
72
sa.Column('first_ip', sa.String(length=64), nullable=False),
73
sa.Column('last_ip', sa.String(length=64), nullable=False),
74
sa.ForeignKeyConstraint(['subnet_id'], ['subnets.id'],
76
sa.PrimaryKeyConstraint('id'))
80
sa.Column('destination', sa.String(length=64), nullable=False),
81
sa.Column('nexthop', sa.String(length=64), nullable=False),
82
sa.Column('subnet_id', sa.String(length=36), nullable=False),
83
sa.ForeignKeyConstraint(['subnet_id'], ['subnets.id'],
85
sa.PrimaryKeyConstraint('destination', 'nexthop', 'subnet_id'))
89
sa.Column('port_id', sa.String(length=36), nullable=True),
90
sa.Column('ip_address', sa.String(length=64), nullable=False),
91
sa.Column('subnet_id', sa.String(length=36), nullable=False),
92
sa.Column('network_id', sa.String(length=36), nullable=False),
93
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
95
sa.ForeignKeyConstraint(['port_id'], ['ports.id'], ondelete='CASCADE'),
96
sa.ForeignKeyConstraint(['subnet_id'], ['subnets.id'],
98
sa.PrimaryKeyConstraint('ip_address', 'subnet_id', 'network_id'))
101
'ipavailabilityranges',
102
sa.Column('allocation_pool_id', sa.String(length=36), nullable=False),
103
sa.Column('first_ip', sa.String(length=64), nullable=False),
104
sa.Column('last_ip', sa.String(length=64), nullable=False),
105
sa.ForeignKeyConstraint(['allocation_pool_id'],
106
['ipallocationpools.id'], ondelete='CASCADE'),
107
sa.PrimaryKeyConstraint('allocation_pool_id', 'first_ip', 'last_ip'))
110
'networkdhcpagentbindings',
111
sa.Column('network_id', sa.String(length=36), nullable=False),
112
sa.Column('dhcp_agent_id', sa.String(length=36), nullable=False),
113
sa.ForeignKeyConstraint(['dhcp_agent_id'], ['agents.id'],
115
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
117
sa.PrimaryKeyConstraint('network_id', 'dhcp_agent_id'))
121
op.drop_table('networkdhcpagentbindings')
122
op.drop_table('ipavailabilityranges')
123
op.drop_table('ipallocations')
124
op.drop_table('subnetroutes')
125
op.drop_table('ipallocationpools')
126
op.drop_table('dnsnameservers')
127
op.drop_table('subnets')
128
op.drop_table('ports')
129
op.drop_table('networks')