1
# Copyright 2013 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
"""FWaaS Havana-2 model
18
Revision ID: 39cf3f799352
20
Create Date: 2013-07-10 16:16:51.302943
24
# revision identifiers, used by Alembic.
25
revision = '39cf3f799352'
26
down_revision = 'e6b16a30d97'
28
# Change to ['*'] if this migration applies to all plugins
30
migration_for_plugins = [
31
'neutron.services.firewall.fwaas_plugin.FirewallPlugin',
34
from alembic import op
35
import sqlalchemy as sa
37
from neutron.db import migration
39
firewallrules_action = sa.Enum('allow', 'deny', name='firewallrules_action')
42
def downgrade(active_plugins=None, options=None):
43
if not migration.should_run(active_plugins, migration_for_plugins):
46
op.drop_table('firewall_rules')
47
firewallrules_action.drop(op.get_bind(), checkfirst=False)
48
op.drop_table('firewalls')
49
op.drop_table('firewall_policies')
52
def upgrade(active_plugins=None, options=None):
53
if not migration.should_run(active_plugins, migration_for_plugins):
58
sa.Column('tenant_id', sa.String(length=255), nullable=True),
59
sa.Column('id', sa.String(length=36), nullable=False),
60
sa.Column('name', sa.String(length=255), nullable=True),
61
sa.Column('description', sa.String(length=1024), nullable=True),
62
sa.Column('shared', sa.Boolean(), autoincrement=False, nullable=True),
63
sa.Column('audited', sa.Boolean(), autoincrement=False,
65
sa.PrimaryKeyConstraint('id'))
67
'firewalls', sa.Column('tenant_id', sa.String(length=255),
69
sa.Column('id', sa.String(length=36), nullable=False),
70
sa.Column('name', sa.String(length=255), nullable=True),
71
sa.Column('description', sa.String(length=1024), nullable=True),
72
sa.Column('shared', sa.Boolean(), autoincrement=False, nullable=True),
73
sa.Column('admin_state_up', sa.Boolean(), autoincrement=False,
75
sa.Column('status', sa.String(length=16), nullable=True),
76
sa.Column('firewall_policy_id', sa.String(length=36), nullable=True),
77
sa.ForeignKeyConstraint(['firewall_policy_id'],
78
['firewall_policies.id'],
79
name='firewalls_ibfk_1'),
80
sa.PrimaryKeyConstraint('id'))
83
sa.Column('tenant_id', sa.String(length=255), nullable=True),
84
sa.Column('id', sa.String(length=36), nullable=False),
85
sa.Column('name', sa.String(length=255), nullable=True),
86
sa.Column('description', sa.String(length=1024), nullable=True),
87
sa.Column('firewall_policy_id', sa.String(length=36), nullable=True),
88
sa.Column('shared', sa.Boolean(), autoincrement=False,
90
sa.Column('protocol', sa.String(length=24), nullable=True),
91
sa.Column('ip_version', sa.Integer(), autoincrement=False,
93
sa.Column('source_ip_address', sa.String(length=46), nullable=True),
94
sa.Column('destination_ip_address', sa.String(length=46),
96
sa.Column('source_port_range_min', sa.Integer(), nullable=True),
97
sa.Column('source_port_range_max', sa.Integer(), nullable=True),
98
sa.Column('destination_port_range_min', sa.Integer(), nullable=True),
99
sa.Column('destination_port_range_max', sa.Integer(), nullable=True),
100
sa.Column('action', firewallrules_action, nullable=True),
101
sa.Column('enabled', sa.Boolean(), autoincrement=False,
103
sa.Column('position', sa.Integer(), autoincrement=False,
105
sa.ForeignKeyConstraint(['firewall_policy_id'],
106
['firewall_policies.id'],
107
name='firewall_rules_ibfk_1'),
108
sa.PrimaryKeyConstraint('id'))