~niedbalski/ubuntu/vivid/neutron/fixes-1447803

« back to all changes in this revision

Viewing changes to neutron/db/migration/alembic_migrations/versions/39cf3f799352_fwaas_havana_2_model.py

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-10-03 18:45:23 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20141003184523-4mt6dy1q3j8n30c9
Tags: 1:2014.2~rc1-0ubuntu1
* New upstream release candidate:
  - d/p/*: Refreshed.
  - d/control: Add python-requests-mock to BD's.
  - d/control: Align versioned requirements with upstream.
* Transition linuxbridge and openvswitch plugin users to modular
  layer 2 plugin (LP: #1323729):
  - d/control: Mark removed plugin packages as transitional, depend
    on neutron-plugin-ml2, mark oldlibs/extra.
  - d/neutron-plugin-{linuxbridge,openvswitch}.install: Drop.
  - d/control: Depend on neutron-plugin-ml2 for linuxbridge
    agent package.
  - d/neutron-plugin-linuxbridge-agent.upstart: Use ml2 plugin
    configuration files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2013 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
 
"""FWaaS Havana-2 model
17
 
 
18
 
Revision ID: 39cf3f799352
19
 
Revises: e6b16a30d97
20
 
Create Date: 2013-07-10 16:16:51.302943
21
 
 
22
 
"""
23
 
 
24
 
# revision identifiers, used by Alembic.
25
 
revision = '39cf3f799352'
26
 
down_revision = 'e6b16a30d97'
27
 
 
28
 
# Change to ['*'] if this migration applies to all plugins
29
 
 
30
 
migration_for_plugins = [
31
 
    'neutron.services.firewall.fwaas_plugin.FirewallPlugin',
32
 
]
33
 
 
34
 
from alembic import op
35
 
import sqlalchemy as sa
36
 
 
37
 
from neutron.db import migration
38
 
 
39
 
firewallrules_action = sa.Enum('allow', 'deny', name='firewallrules_action')
40
 
 
41
 
 
42
 
def downgrade(active_plugins=None, options=None):
43
 
    if not migration.should_run(active_plugins, migration_for_plugins):
44
 
        return
45
 
 
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')
50
 
 
51
 
 
52
 
def upgrade(active_plugins=None, options=None):
53
 
    if not migration.should_run(active_plugins, migration_for_plugins):
54
 
        return
55
 
 
56
 
    op.create_table(
57
 
        'firewall_policies',
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,
64
 
                  nullable=True),
65
 
        sa.PrimaryKeyConstraint('id'))
66
 
    op.create_table(
67
 
        'firewalls', sa.Column('tenant_id', sa.String(length=255),
68
 
                               nullable=True),
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,
74
 
                  nullable=True),
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'))
81
 
    op.create_table(
82
 
        'firewall_rules',
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,
89
 
                  nullable=True),
90
 
        sa.Column('protocol', sa.String(length=24), nullable=True),
91
 
        sa.Column('ip_version', sa.Integer(), autoincrement=False,
92
 
                  nullable=False),
93
 
        sa.Column('source_ip_address', sa.String(length=46), nullable=True),
94
 
        sa.Column('destination_ip_address', sa.String(length=46),
95
 
                  nullable=True),
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,
102
 
                  nullable=True),
103
 
        sa.Column('position', sa.Integer(), autoincrement=False,
104
 
                  nullable=True),
105
 
        sa.ForeignKeyConstraint(['firewall_policy_id'],
106
 
                                ['firewall_policies.id'],
107
 
                                name='firewall_rules_ibfk_1'),
108
 
        sa.PrimaryKeyConstraint('id'))