예제 #1
0
def upgrade(active_plugins=None, options=None):
    # general model
    upgrade_base()

    if migration.should_run(active_plugins, L3_CAPABLE):
        common_ext_ops.upgrade_l3()

    if migration.should_run(active_plugins, FOLSOM_QUOTA):
        common_ext_ops.upgrade_quota()

    if PLUGINS['lbr'] in active_plugins:
        upgrade_linuxbridge()
    elif PLUGINS['ovs'] in active_plugins:
        upgrade_ovs()
    elif PLUGINS['cisco'] in active_plugins:
        upgrade_cisco()
        # Cisco plugin imports OVS models too
        upgrade_ovs()
    elif PLUGINS['meta'] in active_plugins:
        upgrade_meta()
    elif PLUGINS['nec'] in active_plugins:
        upgrade_nec()
    elif PLUGINS['ryu'] in active_plugins:
        upgrade_ryu()
    elif PLUGINS['brocade'] in active_plugins:
        upgrade_brocade()
        # Brocade plugin imports linux bridge models too
        upgrade_linuxbridge()
예제 #2
0
def upgrade(active_plugins=None, options=None):
    # general model
    upgrade_base()

    if migration.should_run(active_plugins, L3_CAPABLE):
        common_ext_ops.upgrade_l3()

    if migration.should_run(active_plugins, FOLSOM_QUOTA):
        common_ext_ops.upgrade_quota(options)

    if PLUGINS['lbr'] in active_plugins:
        upgrade_linuxbridge()
    elif PLUGINS['ovs'] in active_plugins:
        upgrade_ovs()
    elif PLUGINS['cisco'] in active_plugins:
        upgrade_cisco()
        # Cisco plugin imports OVS models too
        upgrade_ovs()
    elif PLUGINS['meta'] in active_plugins:
        upgrade_meta()
    elif PLUGINS['nec'] in active_plugins:
        upgrade_nec()
    elif PLUGINS['ryu'] in active_plugins:
        upgrade_ryu()
    elif PLUGINS['brocade'] in active_plugins:
        upgrade_brocade()
        # Brocade plugin imports linux bridge models too
        upgrade_linuxbridge()
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    # Workaround for Alemic bug #89
    # https://bitbucket.org/zzzeek/alembic/issue/89
    context = op.get_context()
    if context.bind.dialect.name == "postgresql":
        op.execute(
            "CREATE TYPE ipv6_ra_modes AS ENUM ('%s', '%s', '%s')" % ("slaac", "dhcpv6-stateful", "dhcpv6-stateless")
        )
        op.execute(
            "CREATE TYPE ipv6_address_modes AS ENUM ('%s', '%s', '%s')"
            % ("slaac", "dhcpv6-stateful", "dhcpv6-stateless")
        )
    op.add_column(
        "subnets",
        sa.Column(
            "ipv6_ra_mode", sa.Enum("slaac", "dhcpv6-stateful", "dhcpv6-stateless", name="ipv6_ra_modes"), nullable=True
        ),
    )
    op.add_column(
        "subnets",
        sa.Column(
            "ipv6_address_mode",
            sa.Enum("slaac", "dhcpv6-stateful", "dhcpv6-stateless", name="ipv6_address_modes"),
            nullable=True,
        ),
    )
def upgrade(active_plugin=None, options=None):
    if not migration.should_run(active_plugin, migration_for_plugins):
        return

    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('networksecuritybindings',
                    sa.Column('network_id', sa.String(length=36),
                    nullable=False),
                    sa.Column('port_security_enabled', sa.Boolean(),
                    nullable=False),
                    sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
                    ondelete='CASCADE'),
                    sa.PrimaryKeyConstraint('network_id'))
    op.create_table('portsecuritybindings',
                    sa.Column('port_id', sa.String(length=36),
                    nullable=False),
                    sa.Column('port_security_enabled', sa.Boolean(),
                    nullable=False),
                    sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
                    ondelete='CASCADE'),
                    sa.PrimaryKeyConstraint('port_id'))
    ### end Alembic commands ###

    # Copy network and port ids over to network|port(securitybindings) table
    # and set port_security_enabled to false as ip address pairs were not
    # configured in NVP originally.
    op.execute("INSERT INTO networksecuritybindings SELECT id as "
               "network_id, False as port_security_enabled from networks")
    op.execute("INSERT INTO portsecuritybindings SELECT id as port_id, "
               "False as port_security_enabled from ports")
예제 #5
0
def downgrade(active_plugin=None, options=None):
    if not migration.should_run(active_plugin, migration_for_plugins):
        return

    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('portsecuritybindings')
    op.drop_table('networksecuritybindings')
def downgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    ### commands auto generated by Alembic - please adjust! ###
    op.drop_column("floatingips", "uos_name")
    op.drop_column("floatingips", "floating_subnet_id")
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return
    op.add_column('lbaas_pools',
                  sa.Column(u'network_id', sa.String(36), nullable=False))
    op.add_column('lbaas_pools',
                  sa.Column(u'subnet_id', sa.String(36), nullable=True))
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.create_table('consistencyhashes',
                    sa.Column('hash_id', sa.String(255), primary_key=True),
                    sa.Column('hash', sa.String(255), nullable=False))
예제 #9
0
def downgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.drop_table('vcns_edge_vip_bindings')
    op.drop_table('vcns_edge_monitor_bindings')
    op.drop_table('vcns_edge_pool_bindings')
def downgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('routerl3agentbindings')
    op.drop_table('networkdhcpagentbindings')
예제 #11
0
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.create_table(
        'vpncredentials',
        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('ca', sa.Text(), nullable=False),
        sa.Column('server_certificate', sa.Text(), nullable=False),
        sa.Column('server_key', sa.Text(), nullable=False),
        sa.Column('dh', sa.Text(), nullable=True),
        sa.Column('crl', sa.Text(), nullable=True),
        sa.PrimaryKeyConstraint('id'),
    )
    op.create_table(
        'ssl_vpn_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('admin_state_up', sa.Boolean(), nullable=True),
        sa.Column('status', sa.String(length=16), nullable=False),
        sa.Column('vpnservice_id', sa.String(length=36), nullable=False),
        sa.Column('credential_id', sa.String(length=36), nullable=False),
        sa.Column(
            'client_address_pool_cidr', sa.String(length=64), nullable=True),
        sa.ForeignKeyConstraint(['vpnservice_id'], ['vpnservices.id'], ),
        sa.ForeignKeyConstraint(['credential_id'], ['vpncredentials.id'], ),
        sa.PrimaryKeyConstraint('id'),
    )
예제 #12
0
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.create_table(
        'vcns_edge_pool_bindings',
        sa.Column('pool_id', sa.String(length=36), nullable=False),
        sa.Column('edge_id', sa.String(length=36), nullable=False),
        sa.Column('pool_vseid', sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(['pool_id'], ['pools.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('pool_id', 'edge_id')
    )
    op.create_table(
        'vcns_edge_monitor_bindings',
        sa.Column('monitor_id', sa.String(length=36), nullable=False),
        sa.Column('edge_id', sa.String(length=36), nullable=False),
        sa.Column('monitor_vseid', sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(['monitor_id'], ['healthmonitors.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('monitor_id', 'edge_id')
    )
    op.create_table(
        'vcns_edge_vip_bindings',
        sa.Column('vip_id', sa.String(length=36), nullable=False),
        sa.Column('edge_id', sa.String(length=36), nullable=True),
        sa.Column('vip_vseid', sa.String(length=36), nullable=True),
        sa.Column('app_profileid', sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(['vip_id'], ['vips.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('vip_id')
    )
예제 #13
0
def downgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    if op.get_bind().engine.name == 'ibm_db_sa':
        # Note(xuhanp): DB2 doesn't allow nullable=False Column with
        # "DEFAULT" clause not specified. So server_default is used.
        # Using sa.text will result "DEFAULT 0" for cap_port_filter.
        op.add_column(
            'ml2_port_bindings',
            sa.Column('cap_port_filter',
                      sa.Boolean(),
                      nullable=False,
                      server_default=sa.text("0")))
        op.execute("UPDATE ml2_port_bindings SET"
                   " cap_port_filter = 1"
                   " WHERE vif_details LIKE '%\"port_filter\": true%'")
    else:
        op.add_column(
            'ml2_port_bindings',
            sa.Column('cap_port_filter',
                      sa.Boolean(),
                      nullable=False,
                      server_default=sa.text("false")))
        op.execute("UPDATE ml2_port_bindings SET"
                   " cap_port_filter = true"
                   " WHERE vif_details LIKE '%\"port_filter\": true%'")
    op.drop_column('ml2_port_bindings', 'vif_details')
    if op.get_bind().engine.name == 'ibm_db_sa':
        op.execute("CALL SYSPROC.ADMIN_CMD('REORG TABLE ml2_port_bindings')")
예제 #14
0
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.add_column(
        'ml2_port_bindings',
        sa.Column('vif_details',
                  sa.String(length=4095),
                  nullable=False,
                  server_default=''))
    if op.get_bind().engine.name == 'ibm_db_sa':
        op.execute("UPDATE ml2_port_bindings SET"
                   " vif_details = '{\"port_filter\": true}'"
                   " WHERE cap_port_filter = 1")
        op.execute("UPDATE ml2_port_bindings SET"
                   " vif_details = '{\"port_filter\": false}'"
                   " WHERE cap_port_filter = 0")
    else:
        op.execute("UPDATE ml2_port_bindings SET"
                   " vif_details = '{\"port_filter\": true}'"
                   " WHERE cap_port_filter = true")
        op.execute("UPDATE ml2_port_bindings SET"
                   " vif_details = '{\"port_filter\": false}'"
                   " WHERE cap_port_filter = false")
    op.drop_column('ml2_port_bindings', 'cap_port_filter')
    if op.get_bind().engine.name == 'ibm_db_sa':
        op.execute("CALL SYSPROC.ADMIN_CMD('REORG TABLE ml2_port_bindings')")
예제 #15
0
def downgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return
    try:
        op.drop_constraint(name=UC_NAME, table_name=TABLE_NAME, type_='unique')
    except exc.OperationalError:
        pass
예제 #16
0
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.create_table(
        'cisco_n1kv_trunk_segments',
        sa.Column('trunk_segment_id', sa.String(length=36), nullable=False),
        sa.Column('segment_id', sa.String(length=36), nullable=False),
        sa.Column('dot1qtag', sa.String(length=36), nullable=False),
        sa.ForeignKeyConstraint(['trunk_segment_id'], ['networks.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('trunk_segment_id', 'segment_id', 'dot1qtag')
    )
    op.create_table(
        'cisco_n1kv_multi_segments',
        sa.Column('multi_segment_id', sa.String(length=36), nullable=False),
        sa.Column('segment1_id', sa.String(length=36), nullable=False),
        sa.Column('segment2_id', sa.String(length=36), nullable=False),
        sa.Column('encap_profile_name', sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(['multi_segment_id'], ['networks.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('multi_segment_id', 'segment1_id',
                                'segment2_id')
    )
    migration.alter_enum('cisco_network_profiles', 'segment_type', new_type,
                         nullable=False)
    op.add_column('cisco_network_profiles',
                  sa.Column('sub_type', sa.String(length=255), nullable=True))
def downgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('routerl3agentbindings')
    op.drop_table('networkdhcpagentbindings')
예제 #18
0
def downgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.drop_table('arista_provisioned_tenants')
    op.drop_table('arista_provisioned_vms')
    op.drop_table('arista_provisioned_nets')
def downgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.drop_table('firewall_rules')
    op.drop_table('firewalls')
    op.drop_table('firewall_policies')
예제 #20
0
def downgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    # Delete the multi_provider_network entries from nvp_network_bindings
    op.execute("DELETE from nvp_network_bindings WHERE network_id IN "
               "(SELECT network_id from nvp_multi_provider_networks)")

    # create table with previous contains
    op.create_table(
        'rename_nvp_network_bindings',
        sa.Column('network_id', sa.String(length=36), primary_key=True),
        sa.Column('binding_type',
                  sa.Enum('flat',
                          'vlan',
                          'stt',
                          'gre',
                          'l3_ext',
                          name=('nvp_network_bindings_binding_type')),
                  nullable=False),
        sa.Column('phy_uuid', sa.String(36), nullable=True),
        sa.Column('vlan_id', sa.Integer, nullable=True, autoincrement=False))

    # copy data from nvp_network_bindings into rename_nvp_network_bindings
    op.execute("INSERT INTO rename_nvp_network_bindings SELECT network_id, "
               "binding_type, phy_uuid, vlan_id from nvp_network_bindings")

    op.drop_table('nvp_network_bindings')
    op.rename_table('rename_nvp_network_bindings', 'nvp_network_bindings')
    op.drop_table('nvp_multi_provider_networks')
예제 #21
0
def upgrade(active_plugin=None, options=None):
    if not migration.should_run(active_plugin, migration_for_plugins):
        return

    ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'ml2_network_segments',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('network_id', sa.String(length=36), nullable=False),
        sa.Column('network_type', sa.String(length=32), nullable=False),
        sa.Column('physical_network', sa.String(length=64), nullable=True),
        sa.Column('segmentation_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'ml2_vlan_allocations',
        sa.Column('physical_network', sa.String(length=64), nullable=False),
        sa.Column('vlan_id', sa.Integer(), autoincrement=False,
                  nullable=False),
        sa.Column('allocated',
                  sa.Boolean(),
                  autoincrement=False,
                  nullable=False),
        sa.PrimaryKeyConstraint('physical_network', 'vlan_id'))
    op.create_table(
        'ml2_flat_allocations',
        sa.Column('physical_network', sa.String(length=64), nullable=False),
        sa.PrimaryKeyConstraint('physical_network'))
예제 #22
0
def downgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.drop_table('arista_provisioned_tenants')
    op.drop_table('arista_provisioned_vms')
    op.drop_table('arista_provisioned_nets')
예제 #23
0
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.create_table('meteringlabels',
                    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.PrimaryKeyConstraint('id'))
    op.create_table('meteringlabelrules',
                    sa.Column('id', sa.String(length=36), nullable=False),
                    sa.Column('direction',
                              sa.Enum('ingress', 'egress',
                                      name='meteringlabels_direction'),
                              nullable=True),
                    sa.Column('remote_ip_prefix', sa.String(length=64),
                              nullable=True),
                    sa.Column('metering_label_id', sa.String(length=36),
                              nullable=False),
                    sa.Column('excluded', sa.Boolean(),
                              autoincrement=False, nullable=True),
                    sa.ForeignKeyConstraint(['metering_label_id'],
                                            ['meteringlabels.id'],
                                            name='meteringlabelrules_ibfk_1'),
                    sa.PrimaryKeyConstraint('id'))
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.create_table(
        'lsn',
        sa.Column('net_id',
                  sa.String(length=36), nullable=False),
        sa.Column('lsn_id',
                  sa.String(length=36), nullable=False),
        sa.PrimaryKeyConstraint('lsn_id'))

    op.create_table(
        'lsn_port',
        sa.Column('lsn_port_id',
                  sa.String(length=36), nullable=False),
        sa.Column('lsn_id',
                  sa.String(length=36), nullable=False),
        sa.Column('sub_id',
                  sa.String(length=36), nullable=False, unique=True),
        sa.Column('mac_addr',
                  sa.String(length=32), nullable=False, unique=True),
        sa.ForeignKeyConstraint(['lsn_id'], ['lsn.lsn_id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('lsn_port_id'))
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.add_column('ml2_port_bindings',
                  sa.Column('vif_details', sa.String(length=4095),
                            nullable=False, server_default=''))
    if op.get_bind().engine.name == 'ibm_db_sa':
        op.execute(
            "UPDATE ml2_port_bindings SET"
            " vif_details = '{\"port_filter\": true}'"
            " WHERE cap_port_filter = 1")
        op.execute(
            "UPDATE ml2_port_bindings SET"
            " vif_details = '{\"port_filter\": false}'"
            " WHERE cap_port_filter = 0")
    else:
        op.execute(
            "UPDATE ml2_port_bindings SET"
            " vif_details = '{\"port_filter\": true}'"
            " WHERE cap_port_filter = true")
        op.execute(
            "UPDATE ml2_port_bindings SET"
            " vif_details = '{\"port_filter\": false}'"
            " WHERE cap_port_filter = false")
    op.drop_column('ml2_port_bindings', 'cap_port_filter')
    if op.get_bind().engine.name == 'ibm_db_sa':
        op.execute("CALL SYSPROC.ADMIN_CMD('REORG TABLE ml2_port_bindings')")
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.alter_column('packetfilters', 'network_id',
                    existing_type=sa.String(length=36),
                    nullable=False)
def downgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    if op.get_bind().engine.name == 'ibm_db_sa':
        # Note(xuhanp): DB2 doesn't allow nullable=False Column with
        # "DEFAULT" clause not specified. So server_default is used.
        # Using sa.text will result "DEFAULT 0" for cap_port_filter.
        op.add_column('ml2_port_bindings',
                      sa.Column('cap_port_filter', sa.Boolean(),
                                nullable=False,
                                server_default=sa.text("0")))
        op.execute(
            "UPDATE ml2_port_bindings SET"
            " cap_port_filter = 1"
            " WHERE vif_details LIKE '%\"port_filter\": true%'")
    else:
        op.add_column('ml2_port_bindings',
                      sa.Column('cap_port_filter', sa.Boolean(),
                                nullable=False,
                                server_default=sa.text("false")))
        op.execute(
            "UPDATE ml2_port_bindings SET"
            " cap_port_filter = true"
            " WHERE vif_details LIKE '%\"port_filter\": true%'")
    op.drop_column('ml2_port_bindings', 'vif_details')
    if op.get_bind().engine.name == 'ibm_db_sa':
        op.execute("CALL SYSPROC.ADMIN_CMD('REORG TABLE ml2_port_bindings')")
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    ### commands auto generated by Alembic - please adjust! ###
    op.add_column("floatingips", sa.Column("uos_name", sa.String(length=255), nullable=True))
    op.add_column("floatingips", sa.Column("floating_subnet_id", sa.String(length=255), nullable=True))
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.add_column('floatingips',
                  sa.Column('rate_limit', sa.Integer(),
                            nullable=True, default=1024))
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.drop_table(u'portprofile_bindings')
    op.drop_table(u'portprofiles')
    op.drop_table(u'port_bindings')
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return
    op.create_table(
        'networkgateways', sa.Column('id',
                                     sa.String(length=36),
                                     nullable=False),
        sa.Column('name', sa.String(length=255), nullable=True),
        sa.Column('tenant_id', sa.String(length=36), nullable=True),
        sa.Column('default', sa.Boolean(), nullable=True),
        sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'networkgatewaydevices',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('network_gateway_id', sa.String(length=36), nullable=True),
        sa.Column('interface_name', sa.String(length=64), nullable=True),
        sa.ForeignKeyConstraint(['network_gateway_id'], ['networkgateways.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'networkconnections',
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('network_gateway_id', sa.String(length=36), nullable=True),
        sa.Column('network_id', sa.String(length=36), nullable=True),
        sa.Column('segmentation_type', net_conn_seg_type, nullable=True),
        sa.Column('segmentation_id', sa.Integer(), nullable=True),
        sa.Column('port_id', sa.String(length=36), nullable=False),
        sa.ForeignKeyConstraint(['network_gateway_id'], ['networkgateways.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['port_id'], ['ports.id'], ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('port_id'),
        sa.UniqueConstraint('network_gateway_id', 'segmentation_type',
                            'segmentation_id'))
예제 #32
0
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.create_table('nvp_multi_provider_networks',
                    sa.Column('network_id',
                              sa.String(length=36),
                              nullable=False),
                    sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
                                            ondelete='CASCADE'),
                    sa.PrimaryKeyConstraint('network_id'),
                    mysql_engine='InnoDB')
    op.create_table(
        'rename_nvp_network_bindings',
        sa.Column('network_id', sa.String(length=36), primary_key=True),
        sa.Column('binding_type', get_enum(), nullable=False,
                  primary_key=True),
        sa.Column('phy_uuid', sa.String(36), primary_key=True, nullable=True),
        sa.Column('vlan_id',
                  sa.Integer,
                  primary_key=True,
                  nullable=True,
                  autoincrement=False))
    # copy data from nvp_network_bindings into rename_nvp_network_bindings
    op.execute("INSERT INTO rename_nvp_network_bindings SELECT network_id, "
               "binding_type, phy_uuid, vlan_id from nvp_network_bindings")

    op.drop_table('nvp_network_bindings')
    op.rename_table('rename_nvp_network_bindings', 'nvp_network_bindings')
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.create_table(
        'nvp_multi_provider_networks',
        sa.Column('network_id', sa.String(length=36), nullable=False),
        sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('network_id'),
        mysql_engine='InnoDB'
    )
    op.create_table('rename_nvp_network_bindings',
                    sa.Column('network_id', sa.String(length=36),
                              primary_key=True),
                    sa.Column('binding_type',
                              sa.Enum(
                                  'flat', 'vlan', 'stt', 'gre', 'l3_ext',
                                  name=(
                                      'nvp_network_bindings_binding_type')),
                              nullable=False, primary_key=True),
                    sa.Column('phy_uuid', sa.String(36), primary_key=True,
                              nullable=True),
                    sa.Column('vlan_id', sa.Integer, primary_key=True,
                              nullable=True, autoincrement=False))
    # copy data from nvp_network_bindings into rename_nvp_network_bindings
    op.execute("INSERT INTO rename_nvp_network_bindings SELECT network_id, "
               "binding_type, phy_uuid, vlan_id from nvp_network_bindings")

    op.drop_table('nvp_network_bindings')
    op.rename_table('rename_nvp_network_bindings', 'nvp_network_bindings')
def downgrade(active_plugin=None, options=None):
    if not migration.should_run(active_plugin, migration_for_plugins):
        return

    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('portsecuritybindings')
    op.drop_table('networksecuritybindings')
def downgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    # Delete the multi_provider_network entries from nvp_network_bindings
    op.execute("DELETE from nvp_network_bindings WHERE network_id IN "
               "(SELECT network_id from nvp_multi_provider_networks)")

    # create table with previous contains
    op.create_table(
        'rename_nvp_network_bindings',
        sa.Column('network_id', sa.String(length=36), primary_key=True),
        sa.Column('binding_type',
                  sa.Enum('flat', 'vlan', 'stt', 'gre', 'l3_ext',
                          name=('nvp_network_bindings_binding_type')),
                  nullable=False),
        sa.Column('phy_uuid', sa.String(36), nullable=True),
        sa.Column('vlan_id', sa.Integer, nullable=True, autoincrement=False))

    # copy data from nvp_network_bindings into rename_nvp_network_bindings
    op.execute("INSERT INTO rename_nvp_network_bindings SELECT network_id, "
               "binding_type, phy_uuid, vlan_id from nvp_network_bindings")

    op.drop_table('nvp_network_bindings')
    op.rename_table('rename_nvp_network_bindings', 'nvp_network_bindings')
    op.drop_table('nvp_multi_provider_networks')
예제 #36
0
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.create_table(
        'arista_provisioned_nets',
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('network_id', sa.String(length=36), nullable=True),
        sa.Column('segmentation_id', sa.Integer(),
                  autoincrement=False, nullable=True),
        sa.PrimaryKeyConstraint('id'))

    op.create_table(
        'arista_provisioned_vms',
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('vm_id', sa.String(length=36), nullable=True),
        sa.Column('host_id', sa.String(length=255), nullable=True),
        sa.Column('port_id', sa.String(length=36), nullable=True),
        sa.Column('network_id', sa.String(length=36), nullable=True),
        sa.PrimaryKeyConstraint('id'))

    op.create_table(
        'arista_provisioned_tenants',
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.PrimaryKeyConstraint('id'))
예제 #37
0
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.add_column("routers", sa.Column("enable_snat", sa.Boolean(), nullable=False, default=True))
    # Set enable_snat to True for existing routers
    op.execute("UPDATE routers SET enable_snat=True")
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'networkdhcpagentbindings',
        sa.Column('network_id', sa.String(length=36), nullable=False),
        sa.Column('dhcp_agent_id', sa.String(length=36), nullable=False),
        sa.ForeignKeyConstraint(['dhcp_agent_id'], ['agents.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('network_id', 'dhcp_agent_id')
    )
    op.create_table(
        'routerl3agentbindings',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('router_id', sa.String(length=36), nullable=True),
        sa.Column('l3_agent_id', sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(['l3_agent_id'], ['agents.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id')
    )
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.create_table(
        'nuage_floatingip_pool_mapping',
        sa.Column('fip_pool_id', sa.String(length=36), nullable=False),
        sa.Column('net_id', sa.String(length=36), nullable=True),
        sa.Column('router_id', sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(['net_id'], ['networks.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('fip_pool_id'),
    )
    op.create_table(
        'nuage_floatingip_mapping',
        sa.Column('fip_id', sa.String(length=36), nullable=False),
        sa.Column('router_id', sa.String(length=36), nullable=True),
        sa.Column('nuage_fip_id', sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(['fip_id'], ['floatingips.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('fip_id'),
    )
    op.rename_table('net_partitions', 'nuage_net_partitions')
    op.rename_table('net_partition_router_mapping',
                    'nuage_net_partition_router_mapping')
    op.rename_table('router_zone_mapping', 'nuage_router_zone_mapping')
    op.rename_table('subnet_l2dom_mapping', 'nuage_subnet_l2dom_mapping')
    op.rename_table('port_mapping', 'nuage_port_mapping')
    op.rename_table('routerroutes_mapping', 'nuage_routerroutes_mapping')
예제 #40
0
def downgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.drop_table('networkgatewaydevices')
    # Re-create previous version of networkgatewaydevices table
    op.create_table('networkgatewaydevices',
                    sa.Column('id', sa.String(length=36), nullable=False),
                    sa.Column('network_gateway_id',
                              sa.String(length=36),
                              nullable=True),
                    sa.Column('interface_name',
                              sa.String(length=64),
                              nullable=True),
                    sa.ForeignKeyConstraint(['network_gateway_id'],
                                            ['networkgateways.id'],
                                            ondelete='CASCADE'),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_engine='InnoDB')
    # Copy from networkgatewaydevicereferences to networkgatewaydevices
    op.execute("INSERT INTO networkgatewaydevices SELECT "
               "id, network_gateway_id, interface_name FROM "
               "networkgatewaydevicereferences")
    # Dropt networkgatewaydevicereferences
    op.drop_table('networkgatewaydevicereferences')
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.add_column(
        'agents',
        sa.Column('reserved', sa.Boolean(), nullable=True, default=False))
def downgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.drop_table('networkconnections')
    op.drop_table('networkgatewaydevices')
    op.drop_table('networkgateways')
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.add_column('routers', sa.Column('ha_vr_id', sa.Integer())),

    op.create_table(
        'ha_router_agent_port_bindings',
        sa.Column('port_id', sa.String(length=36), nullable=False),
        sa.Column('router_id', sa.String(length=36), nullable=False),
        sa.Column('l3_agent_id', sa.String(length=36), nullable=True),
        sa.Column('priority', sa.Integer, default=50),
        sa.PrimaryKeyConstraint('port_id'),
        sa.ForeignKeyConstraint(['port_id'], ['ports.id'], ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['l3_agent_id'], ['agents.id']))

    op.create_table(
        'ha_router_networks',
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('network_id',
                  sa.String(length=36),
                  nullable=False,
                  unique=True),
        sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
                                ondelete='CASCADE'))
예제 #44
0
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.create_table(
        'arista_provisioned_nets',
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('network_id', sa.String(length=36), nullable=True),
        sa.Column('segmentation_id',
                  sa.Integer(),
                  autoincrement=False,
                  nullable=True), sa.PrimaryKeyConstraint('id'))

    op.create_table(
        'arista_provisioned_vms',
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('vm_id', sa.String(length=36), nullable=True),
        sa.Column('host_id', sa.String(length=255), nullable=True),
        sa.Column('port_id', sa.String(length=36), nullable=True),
        sa.Column('network_id', sa.String(length=36), nullable=True),
        sa.PrimaryKeyConstraint('id'))

    op.create_table(
        'arista_provisioned_tenants',
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.PrimaryKeyConstraint('id'))
def downgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.drop_table('ha_router_networks')
    op.drop_table('ha_router_agent_port_bindings')
    op.drop_column('routers', 'ha_vr_id')
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.create_unique_constraint(name=UC_NAME,
                                source=TABLE_NAME,
                                local_cols=['tenant_id', 'ha_vr_id'])
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    # Workaround for Alemic bug #89
    # https://bitbucket.org/zzzeek/alembic/issue/89
    context = op.get_context()
    if context.bind.dialect.name == 'postgresql':
        op.execute("CREATE TYPE ipv6_ra_modes AS ENUM ('%s', '%s', '%s')" %
                   ('slaac', 'dhcpv6-stateful', 'dhcpv6-stateless'))
        op.execute(
            "CREATE TYPE ipv6_address_modes AS ENUM ('%s', '%s', '%s')" %
            ('slaac', 'dhcpv6-stateful', 'dhcpv6-stateless'))
    op.add_column(
        'subnets',
        sa.Column('ipv6_ra_mode',
                  sa.Enum('slaac',
                          'dhcpv6-stateful',
                          'dhcpv6-stateless',
                          name='ipv6_ra_modes'),
                  nullable=True))
    op.add_column(
        'subnets',
        sa.Column('ipv6_address_mode',
                  sa.Enum('slaac',
                          'dhcpv6-stateful',
                          'dhcpv6-stateless',
                          name='ipv6_address_modes'),
                  nullable=True))
def downgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return
    op.create_table(
        'servicetypes',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('tenant_id', sa.String(length=255)),
        sa.Column('name', sa.String(255)),
        sa.Column('description', sa.String(255)),
        sa.Column('default', sa.Boolean(), nullable=False, default=False),
        sa.Column('num_instances', sa.Integer, default=0),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_table(
        'servicedefinitions',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('service_class', sa.String(255)),
        sa.Column('plugin', sa.String(255)),
        sa.Column('driver', sa.String(255)),
        sa.Column('service_type_id', sa.String(36),
                  sa.ForeignKey('servicetypes.id',
                                ondelete='CASCADE')),
        sa.PrimaryKeyConstraint('id', 'service_class')
    )
    op.drop_table('providerresourceassociations')
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.add_column('ml2_port_bindings',
                  sa.Column('profile', sa.String(length=4095),
                            nullable=False, server_default=''))
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.create_table(
        'dvr_host_macs',
        sa.Column('host', sa.String(length=255), nullable=False),
        sa.Column('mac_address', sa.String(length=32),
                  nullable=False, unique=True),
        sa.PrimaryKeyConstraint('host')
    )
    op.create_table(
        'ml2_dvr_port_bindings',
        sa.Column('port_id', sa.String(length=36), nullable=False),
        sa.Column('host', sa.String(length=255), nullable=False),
        sa.Column('router_id', sa.String(length=36), nullable=True),
        sa.Column('vif_type', sa.String(length=64), nullable=False),
        sa.Column('vif_details', sa.String(length=4095),
                  nullable=False, server_default=''),
        sa.Column('vnic_type', sa.String(length=64),
                  nullable=False, server_default='normal'),
        sa.Column('profile', sa.String(length=4095),
                  nullable=False, server_default=''),
        sa.Column('cap_port_filter', sa.Boolean(), nullable=False),
        sa.Column('driver', sa.String(length=64), nullable=True),
        sa.Column('segment', sa.String(length=36), nullable=True),
        sa.Column(u'status', sa.String(16), nullable=False),
        sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['segment'], ['ml2_network_segments.id'],
                                ondelete='SET NULL'),
        sa.PrimaryKeyConstraint('port_id', 'host')
    )
예제 #51
0
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'ml2_network_segments',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('network_id', sa.String(length=36), nullable=False),
        sa.Column('network_type', sa.String(length=32), nullable=False),
        sa.Column('physical_network', sa.String(length=64), nullable=True),
        sa.Column('segmentation_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_table(
        'ml2_vlan_allocations',
        sa.Column('physical_network', sa.String(length=64), nullable=False),
        sa.Column('vlan_id', sa.Integer(), autoincrement=False,
                  nullable=False),
        sa.Column('allocated', sa.Boolean(), autoincrement=False,
                  nullable=False),
        sa.PrimaryKeyConstraint('physical_network', 'vlan_id')
    )
    op.create_table(
        'ml2_flat_allocations',
        sa.Column('physical_network', sa.String(length=64), nullable=False),
        sa.PrimaryKeyConstraint('physical_network')
    )
예제 #52
0
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('networksecuritybindings',
                    sa.Column('network_id', sa.String(length=36),
                    nullable=False),
                    sa.Column('port_security_enabled', sa.Boolean(),
                    nullable=False),
                    sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
                    ondelete='CASCADE'),
                    sa.PrimaryKeyConstraint('network_id'))
    op.create_table('portsecuritybindings',
                    sa.Column('port_id', sa.String(length=36),
                    nullable=False),
                    sa.Column('port_security_enabled', sa.Boolean(),
                    nullable=False),
                    sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
                    ondelete='CASCADE'),
                    sa.PrimaryKeyConstraint('port_id'))
    ### end Alembic commands ###

    # Copy network and port ids over to network|port(securitybindings) table
    # and set port_security_enabled to false as ip address pairs were not
    # configured in NVP originally.
    op.execute("INSERT INTO networksecuritybindings SELECT id as "
               "network_id, False as port_security_enabled from networks")
    op.execute("INSERT INTO portsecuritybindings SELECT id as port_id, "
               "False as port_security_enabled from ports")
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'networkdhcpagentbindings',
        sa.Column('network_id', sa.String(length=36), nullable=False),
        sa.Column('dhcp_agent_id', sa.String(length=36), nullable=False),
        sa.ForeignKeyConstraint(['dhcp_agent_id'], ['agents.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('network_id', 'dhcp_agent_id')
    )
    op.create_table(
        'routerl3agentbindings',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('router_id', sa.String(length=36), nullable=True),
        sa.Column('l3_agent_id', sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(['l3_agent_id'], ['agents.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id')
    )
def downgrade(active_plugin=None, options=None):
    if not migration.should_run(active_plugin, migration_for_plugins):
        return

    op.drop_table('networkconnections')
    op.drop_table('networkgatewaydevices')
    op.drop_table('networkgateways')
예제 #55
0
def upgrade(active_plugins=None, options=None):
    if not migration.should_run(active_plugins, migration_for_plugins):
        return

    op.create_table(
        u'servicetypes', sa.Column(u'tenant_id', sa.String(255),
                                   nullable=True),
        sa.Column(u'id', sa.String(36), nullable=False),
        sa.Column(u'name', sa.String(255), nullable=True),
        sa.Column(u'description', sa.String(255), nullable=True),
        sa.Column(u'default',
                  sa.Boolean(),
                  autoincrement=False,
                  nullable=False),
        sa.Column(u'num_instances',
                  sa.Integer(),
                  autoincrement=False,
                  nullable=True), sa.PrimaryKeyConstraint(u'id'))
    op.create_table(
        u'servicedefinitions', sa.Column(u'id', sa.String(36), nullable=False),
        sa.Column(u'service_class', sa.String(length=255), nullable=False),
        sa.Column(u'plugin', sa.String(255), nullable=True),
        sa.Column(u'driver', sa.String(255), nullable=True),
        sa.Column(u'service_type_id', sa.String(36), nullable=False),
        sa.ForeignKeyConstraint(['service_type_id'], [u'servicetypes.id'],
                                name=u'servicedefinitions_ibfk_1'),
        sa.PrimaryKeyConstraint(u'id', u'service_class', u'service_type_id'))