**** CubicPower OpenStack Study ****
def upgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
common_ext_ops.upgrade_l3()
op.create_table(
'quotas',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('resource', sa.String(length=255), nullable=True),
sa.Column('limit', sa.Integer(), nullable=True),
sa.PrimaryKeyConstraint('id'),
)
op.create_table(
'net_partitions',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=64), nullable=True),
sa.Column('l3dom_tmplt_id', sa.String(length=36), nullable=True),
sa.Column('l2dom_tmplt_id', sa.String(length=36), nullable=True),
sa.PrimaryKeyConstraint('id'),
)
op.create_table(
'port_mapping',
sa.Column('port_id', sa.String(length=36), nullable=False),
sa.Column('nuage_vport_id', sa.String(length=36), nullable=True),
sa.Column('nuage_vif_id', sa.String(length=36), nullable=True),
sa.Column('static_ip', sa.Boolean(), nullable=True),
sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('port_id'),
)
op.create_table(
'subnet_l2dom_mapping',
sa.Column('subnet_id', sa.String(length=36), nullable=False),
sa.Column('net_partition_id', sa.String(length=36), nullable=True),
sa.Column('nuage_subnet_id', sa.String(length=36), nullable=True),
sa.Column('nuage_l2dom_tmplt_id', sa.String(length=36),
nullable=True),
sa.Column('nuage_user_id', sa.String(length=36), nullable=True),
sa.Column('nuage_group_id', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['net_partition_id'], ['net_partitions.id'],
ondelete='CASCADE'),
sa.ForeignKeyConstraint(['subnet_id'], ['subnets.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('subnet_id'),
)
op.create_table(
'net_partition_router_mapping',
sa.Column('net_partition_id', sa.String(length=36), nullable=False),
sa.Column('router_id', sa.String(length=36), nullable=False),
sa.Column('nuage_router_id', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['net_partition_id'], ['net_partitions.id'],
ondelete='CASCADE'),
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('router_id'),
)
op.create_table(
'router_zone_mapping',
sa.Column('router_id', sa.String(length=36), nullable=False),
sa.Column('nuage_zone_id', sa.String(length=36), nullable=True),
sa.Column('nuage_user_id', sa.String(length=36), nullable=True),
sa.Column('nuage_group_id', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('router_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('router_zone_mapping')
op.drop_table('net_partition_router_mapping')
op.drop_table('subnet_l2dom_mapping')
op.drop_table('port_mapping')
op.drop_table('net_partitions')
op.drop_table('quotas')
common_ext_ops.downgrade_l3()