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 schema operations for VMware plugins
19
from alembic import op
20
import sqlalchemy as sa
23
net_binding_type = sa.Enum('flat', 'vlan', 'stt', 'gre', 'l3_ext',
24
name='nvp_network_bindings_binding_type')
25
l2gw_segmentation_type = sa.Enum('flat', 'vlan',
26
name='networkconnections_segmentation_type')
27
qos_marking = sa.Enum('untrusted', 'trusted', name='qosqueues_qos_marking')
32
'quantum_nvp_port_mapping',
33
sa.Column('quantum_id', sa.String(length=36), nullable=False),
34
sa.Column('nvp_id', sa.String(length=36), nullable=True),
35
sa.ForeignKeyConstraint(['quantum_id'], ['ports.id'],
37
sa.PrimaryKeyConstraint('quantum_id'))
40
'nvp_network_bindings',
41
sa.Column('network_id', sa.String(length=36), nullable=False),
42
sa.Column('binding_type', net_binding_type, nullable=False),
43
sa.Column('phy_uuid', sa.String(length=36), nullable=True),
44
sa.Column('vlan_id', sa.Integer(), autoincrement=False, nullable=True),
45
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
47
sa.PrimaryKeyConstraint('network_id', 'binding_type',
48
'phy_uuid', 'vlan_id'))
51
'nvp_multi_provider_networks',
52
sa.Column('network_id', sa.String(length=36), nullable=False),
53
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
55
sa.PrimaryKeyConstraint('network_id'))
58
'nsxrouterextattributess',
59
sa.Column('router_id', sa.String(length=36), nullable=False),
60
sa.Column('distributed', sa.Boolean(), nullable=False),
61
sa.Column('service_router', sa.Boolean(), nullable=False,
63
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
65
sa.PrimaryKeyConstraint('router_id'))
68
'vcns_router_bindings',
69
sa.Column('status', sa.String(length=16), nullable=False),
70
sa.Column('status_description', sa.String(length=255), nullable=True),
71
sa.Column('router_id', sa.String(length=36), nullable=False),
72
sa.Column('edge_id', sa.String(length=16), nullable=True),
73
sa.Column('lswitch_id', sa.String(length=36), nullable=False),
74
sa.PrimaryKeyConstraint('router_id'))
77
'vcns_edge_pool_bindings',
78
sa.Column('pool_id', sa.String(length=36), nullable=False),
79
sa.Column('edge_id', sa.String(length=36), nullable=False),
80
sa.Column('pool_vseid', sa.String(length=36), nullable=True),
81
sa.ForeignKeyConstraint(['pool_id'], ['pools.id'],
83
sa.PrimaryKeyConstraint('pool_id', 'edge_id'))
86
'vcns_edge_monitor_bindings',
87
sa.Column('monitor_id', sa.String(length=36), nullable=False),
88
sa.Column('edge_id', sa.String(length=36), nullable=False),
89
sa.Column('monitor_vseid', sa.String(length=36), nullable=True),
90
sa.ForeignKeyConstraint(['monitor_id'], ['healthmonitors.id'],
92
sa.PrimaryKeyConstraint('monitor_id', 'edge_id'))
95
'vcns_firewall_rule_bindings',
96
sa.Column('rule_id', sa.String(length=36), nullable=False),
97
sa.Column('edge_id', sa.String(length=36), nullable=False),
98
sa.Column('rule_vseid', sa.String(length=36), nullable=True),
99
sa.ForeignKeyConstraint(['rule_id'], ['firewall_rules.id'], ),
100
sa.PrimaryKeyConstraint('rule_id', 'edge_id'))
103
'vcns_edge_vip_bindings',
104
sa.Column('vip_id', sa.String(length=36), nullable=False),
105
sa.Column('edge_id', sa.String(length=36), nullable=True),
106
sa.Column('vip_vseid', sa.String(length=36), nullable=True),
107
sa.Column('app_profileid', sa.String(length=36), nullable=True),
108
sa.ForeignKeyConstraint(['vip_id'], ['vips.id'], ondelete='CASCADE'),
109
sa.PrimaryKeyConstraint('vip_id'))
113
sa.Column('id', sa.String(length=36), nullable=False),
114
sa.Column('name', sa.String(length=255), nullable=True),
115
sa.Column('tenant_id', sa.String(length=36), nullable=True),
116
sa.Column('default', sa.Boolean(), nullable=True),
117
sa.PrimaryKeyConstraint('id'))
120
'networkgatewaydevices',
121
sa.Column('id', sa.String(length=36), nullable=False),
122
sa.Column('network_gateway_id', sa.String(length=36), nullable=True),
123
sa.Column('interface_name', sa.String(length=64), nullable=True),
124
sa.ForeignKeyConstraint(['network_gateway_id'],
125
['networkgateways.id'],
127
sa.PrimaryKeyConstraint('id'))
130
'networkconnections',
131
sa.Column('tenant_id', sa.String(length=255), nullable=True),
132
sa.Column('network_gateway_id', sa.String(length=36), nullable=True),
133
sa.Column('network_id', sa.String(length=36), nullable=True),
134
sa.Column('segmentation_type', l2gw_segmentation_type, nullable=True),
135
sa.Column('segmentation_id', sa.Integer(), nullable=True),
136
sa.Column('port_id', sa.String(length=36), nullable=False),
137
sa.ForeignKeyConstraint(['network_gateway_id'], ['networkgateways.id'],
139
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
141
sa.ForeignKeyConstraint(['port_id'], ['ports.id'], ondelete='CASCADE'),
142
sa.PrimaryKeyConstraint('port_id'),
143
sa.UniqueConstraint('network_gateway_id', 'segmentation_type',
148
sa.Column('tenant_id', sa.String(length=255), nullable=True),
149
sa.Column('id', sa.String(length=36), nullable=False),
150
sa.Column('name', sa.String(length=255), nullable=True),
151
sa.Column('default', sa.Boolean(), nullable=True),
152
sa.Column('min', sa.Integer(), nullable=False),
153
sa.Column('max', sa.Integer(), nullable=True),
154
sa.Column('qos_marking', qos_marking, nullable=True),
155
sa.Column('dscp', sa.Integer(), nullable=True),
156
sa.PrimaryKeyConstraint('id'))
159
'networkqueuemappings',
160
sa.Column('network_id', sa.String(length=36), nullable=False),
161
sa.Column('queue_id', sa.String(length=36), nullable=True),
162
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
164
sa.ForeignKeyConstraint(['queue_id'], ['qosqueues.id'],
166
sa.PrimaryKeyConstraint('network_id'))
170
sa.Column('port_id', sa.String(length=36), nullable=False),
171
sa.Column('queue_id', sa.String(length=36), nullable=False),
172
sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
174
sa.ForeignKeyConstraint(['queue_id'], ['qosqueues.id'], ),
175
sa.PrimaryKeyConstraint('port_id', 'queue_id'))
179
sa.Column('port_id', sa.String(length=36), nullable=False),
180
sa.Column('mac_learning_enabled', sa.Boolean(), nullable=False),
181
sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
183
sa.PrimaryKeyConstraint('port_id'))
187
op.drop_table('maclearningstates')
188
op.drop_table('portqueuemappings')
189
op.drop_table('networkqueuemappings')
190
op.drop_table('qosqueues')
191
op.drop_table('networkconnections')
192
op.drop_table('networkgatewaydevices')
193
op.drop_table('networkgateways')
194
op.drop_table('vcns_edge_vip_bindings')
195
op.drop_table('vcns_firewall_rule_bindings')
196
op.drop_table('vcns_edge_monitor_bindings')
197
op.drop_table('vcns_edge_pool_bindings')
198
op.drop_table('vcns_router_bindings')
199
op.drop_table('nsxrouterextattributess')
200
op.drop_table('nvp_multi_provider_networks')
201
op.drop_table('nvp_network_bindings')
202
op.drop_table('quantum_nvp_port_mapping')
203
l2gw_segmentation_type.drop(op.get_bind(), checkfirst=False)
204
qos_marking.drop(op.get_bind(), checkfirst=False)
205
net_binding_type.drop(op.get_bind(), checkfirst=False)