summaryrefslogtreecommitdiffstats
path: root/networking_sfc/db/migration/alembic_migrations/versions/liberty/expand/5a475fc853e6_ovs_data_model.py
blob: e257548893d9e1de543c2cf6aebb3b75d5b49975 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Copyright 2015 Futurewei. All rights reserved.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

"""Defining OVS data-model

Revision ID: 5a475fc853e6
Revises: c3e178d4a985
Create Date: 2015-09-30 18:00:57.758762

"""

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '5a475fc853e6'
down_revision = 'c3e178d4a985'


def upgrade():
    op.create_table('sfc_portpair_details',
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('ingress', sa.String(length=36), nullable=True),
        sa.Column('egress', sa.String(length=36), nullable=True),
        sa.Column('host_id', sa.String(length=255), nullable=False),
        sa.Column('mac_address', sa.String(length=32), nullable=False),
        sa.Column('network_type', sa.String(length=8), nullable=True),
        sa.Column('segment_id', sa.Integer(), nullable=True),
        sa.Column('local_endpoint', sa.String(length=64), nullable=False),
        sa.PrimaryKeyConstraint('id')
    )

    op.create_index(
        op.f('ix_sfc_portpair_details_tenant_id'),
        'sfc_portpair_details', ['tenant_id'], unique=False
    )
    op.create_table('sfc_uuid_intid_associations',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('uuid', sa.String(length=36), nullable=False),
        sa.Column('intid', sa.Integer(), nullable=False),
        sa.Column('type_', sa.String(length=32), nullable=False),
        sa.PrimaryKeyConstraint('id', 'uuid'),
        sa.UniqueConstraint('intid')
    )

    op.create_table('sfc_path_nodes',
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('nsp', sa.Integer(), nullable=False),
        sa.Column('nsi', sa.Integer(), nullable=False),
        sa.Column('node_type', sa.String(length=32), nullable=True),
        sa.Column('portchain_id', sa.String(length=255), nullable=True),
        sa.Column('status', sa.String(length=32), nullable=True),
        sa.Column('next_group_id', sa.Integer(), nullable=True),
        sa.Column('next_hop', sa.String(length=512), nullable=True),
        sa.ForeignKeyConstraint(['portchain_id'], ['sfc_port_chains.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_index(
        op.f('ix_sfc_path_nodes_tenant_id'),
        'sfc_path_nodes', ['tenant_id'], unique=False
    )

    op.create_table('sfc_path_port_associations',
        sa.Column('pathnode_id', sa.String(length=36), nullable=False),
        sa.Column('portpair_id', sa.String(length=36), nullable=False),
        sa.Column('weight', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(['pathnode_id'], ['sfc_path_nodes.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['portpair_id'], ['sfc_portpair_details.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('pathnode_id', 'portpair_id')
    )