¡@

Home 

OpenStack Study: 52ff27f7567a_support_for_vpnaas.py

OpenStack Index

**** CubicPower OpenStack Study ****

def upgrade(active_plugins=None, options=None):

    if not migration.should_run(active_plugins, migration_for_plugins):

        return

    op.create_table(

        'ikepolicies',

        sa.Column('tenant_id', sa.String(length=255), nullable=True),

        sa.Column('id', sa.String(length=36), nullable=False),

        sa.Column('name', sa.String(length=255), nullable=True),

        sa.Column('description', sa.String(length=255), nullable=True),

        sa.Column(

            'auth_algorithm',

            sa.Enum('sha1', name='vpn_auth_algorithms'), nullable=False),

        sa.Column(

            'encryption_algorithm',

            sa.Enum('3des', 'aes-128', 'aes-256', 'aes-192',

                    name='vpn_encrypt_algorithms'), nullable=False),

        sa.Column(

            'phase1_negotiation_mode',

            sa.Enum('main', name='ike_phase1_mode'), nullable=False),

        sa.Column(

            'lifetime_units',

            sa.Enum('seconds', 'kilobytes', name='vpn_lifetime_units'),

            nullable=False),

        sa.Column('lifetime_value', sa.Integer(), nullable=False),

        sa.Column(

            'ike_version',

            sa.Enum('v1', 'v2', name='ike_versions'), nullable=False),

        sa.Column(

            'pfs',

            sa.Enum('group2', 'group5', 'group14', name='vpn_pfs'),

            nullable=False),

        sa.PrimaryKeyConstraint('id')

    )

    op.create_table(

        'ipsecpolicies',

        sa.Column('tenant_id', sa.String(length=255), nullable=True),

        sa.Column('id', sa.String(length=36), nullable=False),

        sa.Column('name', sa.String(length=255), nullable=True),

        sa.Column('description', sa.String(length=255), nullable=True),

        sa.Column(

            'transform_protocol',

            sa.Enum('esp', 'ah', 'ah-esp', name='ipsec_transform_protocols'),

            nullable=False),

        sa.Column(

            'auth_algorithm',

            sa.Enum('sha1', name='vpn_auth_algorithms'), nullable=False),

        sa.Column(

            'encryption_algorithm',

            sa.Enum(

                '3des', 'aes-128',

                'aes-256', 'aes-192', name='vpn_encrypt_algorithms'),

            nullable=False),

        sa.Column(

            'encapsulation_mode',

            sa.Enum('tunnel', 'transport', name='ipsec_encapsulations'),

            nullable=False),

        sa.Column(

            'lifetime_units',

            sa.Enum(

                'seconds', 'kilobytes',

                name='vpn_lifetime_units'), nullable=False),

        sa.Column(

            'lifetime_value', sa.Integer(), nullable=False),

        sa.Column(

            'pfs',

            sa.Enum(

                'group2', 'group5', 'group14', name='vpn_pfs'),

            nullable=False),

        sa.PrimaryKeyConstraint('id')

    )

    op.create_table(

        'vpnservices',

        sa.Column('tenant_id', sa.String(length=255), nullable=True),

        sa.Column('id', sa.String(length=36), nullable=False),

        sa.Column('name', sa.String(length=255), nullable=True),

        sa.Column('description', sa.String(length=255), nullable=True),

        sa.Column('status', sa.String(length=16), nullable=False),

        sa.Column('admin_state_up', sa.Boolean(), nullable=False),

        sa.Column('subnet_id', sa.String(length=36), nullable=False),

        sa.Column('router_id', sa.String(length=36), nullable=False),

        sa.ForeignKeyConstraint(['router_id'], ['routers.id'], ),

        sa.ForeignKeyConstraint(['subnet_id'], ['subnets.id'], ),

        sa.PrimaryKeyConstraint('id')

    )

    op.create_table(

        'ipsec_site_connections',

        sa.Column('tenant_id', sa.String(length=255), nullable=True),

        sa.Column('id', sa.String(length=36), nullable=False),

        sa.Column('name', sa.String(length=255), nullable=True),

        sa.Column('description', sa.String(length=255), nullable=True),

        sa.Column('peer_address', sa.String(length=64), nullable=False),

        sa.Column('peer_id', sa.String(length=255), nullable=False),

        sa.Column('route_mode', sa.String(length=8), nullable=False),

        sa.Column('mtu', sa.Integer(), nullable=False),

        sa.Column(

            'initiator',

            sa.Enum(

                'bi-directional', 'response-only', name='vpn_initiators'),

            nullable=False),

        sa.Column('auth_mode', sa.String(length=16), nullable=False),

        sa.Column('psk', sa.String(length=255), nullable=False),

        sa.Column(

            'dpd_action',

            sa.Enum(

                'hold', 'clear', 'restart',

                'disabled', 'restart-by-peer', name='vpn_dpd_actions'),

            nullable=False),

        sa.Column('dpd_interval', sa.Integer(), nullable=False),

        sa.Column('dpd_timeout', sa.Integer(), nullable=False),

        sa.Column('status', sa.String(length=16), nullable=False),

        sa.Column('admin_state_up', sa.Boolean(), nullable=False),

        sa.Column('vpnservice_id', sa.String(length=36), nullable=False),

        sa.Column('ipsecpolicy_id', sa.String(length=36), nullable=False),

        sa.Column('ikepolicy_id', sa.String(length=36), nullable=False),

        sa.ForeignKeyConstraint(['ikepolicy_id'], ['ikepolicies.id']),

        sa.ForeignKeyConstraint(['ipsecpolicy_id'], ['ipsecpolicies.id']),

        sa.ForeignKeyConstraint(['vpnservice_id'], ['vpnservices.id']),

        sa.PrimaryKeyConstraint('id')

    )

    op.create_table(

        'ipsecpeercidrs',

        sa.Column('cidr', sa.String(length=32), nullable=False),

        sa.Column('ipsec_site_connection_id',

                  sa.String(length=36),

                  nullable=False),

        sa.ForeignKeyConstraint(['ipsec_site_connection_id'],

                                ['ipsec_site_connections.id'],

                                ondelete='CASCADE'),

        sa.PrimaryKeyConstraint('cidr', 'ipsec_site_connection_id')

    )

**** CubicPower OpenStack Study ****

def downgrade(active_plugins=None, options=None):

    if not migration.should_run(active_plugins, migration_for_plugins):

        return

    op.drop_table('ipsecpeercidrs')

    op.drop_table('ipsec_site_connections')

    op.drop_table('vpnservices')

    op.drop_table('ipsecpolicies')

    op.drop_table('ikepolicies')