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,
26 sa.Column('id', sa.String(length=36), nullable=False),
27 sa.Column('name', sa.String(length=255), nullable=True),
28 sa.Column('status', sa.String(length=16), nullable=True),
29 sa.Column('admin_state_up', sa.Boolean(), nullable=True),
30 sa.Column('shared', sa.Boolean(), nullable=True),
31 sa.Column('mtu', sa.Integer(), nullable=True),
32 sa.Column('vlan_transparent', sa.Boolean(), nullable=True),
33 sa.PrimaryKeyConstraint('id'))
37 sa.Column('tenant_id', sa.String(length=255), nullable=True,
39 sa.Column('id', sa.String(length=36), nullable=False),
40 sa.Column('name', sa.String(length=255), nullable=True),
41 sa.Column('network_id', sa.String(length=36), nullable=False),
42 sa.Column('mac_address', sa.String(length=32), nullable=False),
43 sa.Column('admin_state_up', sa.Boolean(), nullable=False),
44 sa.Column('status', sa.String(length=16), nullable=False),
45 sa.Column('device_id', sa.String(length=255), nullable=False),
46 sa.Column('device_owner', sa.String(length=255), nullable=False),
47 sa.ForeignKeyConstraint(['network_id'], ['networks.id']),
48 sa.UniqueConstraint('network_id', 'mac_address',
49 name='uniq_ports0network_id0mac_address'),
50 sa.PrimaryKeyConstraint('id'),
51 sa.Index(op.f('ix_ports_network_id_device_owner'), 'network_id',
53 sa.Index(op.f('ix_ports_network_id_mac_address'), 'network_id',
58 sa.Column('tenant_id', sa.String(length=255), nullable=True,
60 sa.Column('id', sa.String(length=36), nullable=False),
61 sa.Column('name', sa.String(length=255), nullable=True),
62 sa.Column('network_id', sa.String(length=36), nullable=True),
63 sa.Column('ip_version', sa.Integer(), nullable=False),
64 sa.Column('cidr', sa.String(length=64), nullable=False),
65 sa.Column('gateway_ip', sa.String(length=64), nullable=True),
66 sa.Column('enable_dhcp', sa.Boolean(), nullable=True),
67 sa.Column('shared', sa.Boolean(), nullable=True),
68 sa.Column('ipv6_ra_mode',
69 sa.Enum('slaac', 'dhcpv6-stateful', 'dhcpv6-stateless',
70 name='ipv6_ra_modes'),
72 sa.Column('ipv6_address_mode',
73 sa.Enum('slaac', 'dhcpv6-stateful', 'dhcpv6-stateless',
74 name='ipv6_address_modes'),
76 sa.Column('subnetpool_id', sa.String(length=36), nullable=True,
78 sa.ForeignKeyConstraint(['network_id'], ['networks.id'], ),
79 sa.PrimaryKeyConstraint('id'))
83 sa.Column('address', sa.String(length=128), nullable=False),
84 sa.Column('subnet_id', sa.String(length=36), nullable=False),
85 sa.ForeignKeyConstraint(['subnet_id'], ['subnets.id'],
87 sa.PrimaryKeyConstraint('address', 'subnet_id'))
91 sa.Column('id', sa.String(length=36), nullable=False),
92 sa.Column('subnet_id', sa.String(length=36), nullable=True),
93 sa.Column('first_ip', sa.String(length=64), nullable=False),
94 sa.Column('last_ip', sa.String(length=64), nullable=False),
95 sa.ForeignKeyConstraint(['subnet_id'], ['subnets.id'],
97 sa.PrimaryKeyConstraint('id'))
101 sa.Column('destination', sa.String(length=64), nullable=False),
102 sa.Column('nexthop', sa.String(length=64), nullable=False),
103 sa.Column('subnet_id', sa.String(length=36), nullable=False),
104 sa.ForeignKeyConstraint(['subnet_id'], ['subnets.id'],
106 sa.PrimaryKeyConstraint('destination', 'nexthop', 'subnet_id'))
110 sa.Column('port_id', sa.String(length=36), nullable=True),
111 sa.Column('ip_address', sa.String(length=64), nullable=False),
112 sa.Column('subnet_id', sa.String(length=36), nullable=False),
113 sa.Column('network_id', sa.String(length=36), nullable=False),
114 sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
116 sa.ForeignKeyConstraint(['port_id'], ['ports.id'], ondelete='CASCADE'),
117 sa.ForeignKeyConstraint(['subnet_id'], ['subnets.id'],
119 sa.PrimaryKeyConstraint('ip_address', 'subnet_id', 'network_id'))
122 'ipavailabilityranges',
123 sa.Column('allocation_pool_id', sa.String(length=36), nullable=False),
124 sa.Column('first_ip', sa.String(length=64), nullable=False),
125 sa.Column('last_ip', sa.String(length=64), nullable=False),
126 sa.ForeignKeyConstraint(['allocation_pool_id'],
127 ['ipallocationpools.id'], ondelete='CASCADE'),
128 sa.PrimaryKeyConstraint('allocation_pool_id', 'first_ip', 'last_ip'),
130 'first_ip', 'allocation_pool_id',
131 name='uniq_ipavailabilityranges0first_ip0allocation_pool_id'),
133 'last_ip', 'allocation_pool_id',
134 name='uniq_ipavailabilityranges0last_ip0allocation_pool_id'))
137 'networkdhcpagentbindings',
138 sa.Column('network_id', sa.String(length=36), nullable=False),
139 sa.Column('dhcp_agent_id', sa.String(length=36), nullable=False),
140 sa.ForeignKeyConstraint(['dhcp_agent_id'], ['agents.id'],
142 sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
144 sa.PrimaryKeyConstraint('network_id', 'dhcp_agent_id'))