Shared ip and first gen mac address range columns
These columns are needed for implementing shared ips and migration of first-gen mac addresses. RM#7675
This commit is contained in:
		@@ -0,0 +1,34 @@
 | 
			
		||||
"""Populate enabled and do_not_use
 | 
			
		||||
 | 
			
		||||
Revision ID: 3ed0c5a067f1
 | 
			
		||||
Revises: 5927940a466e
 | 
			
		||||
Create Date: 2014-07-07 07:52:27.989294
 | 
			
		||||
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
# revision identifiers, used by Alembic.
 | 
			
		||||
revision = '3ed0c5a067f1'
 | 
			
		||||
down_revision = '5927940a466e'
 | 
			
		||||
 | 
			
		||||
from alembic import op
 | 
			
		||||
from sqlalchemy.sql import column, table
 | 
			
		||||
import sqlalchemy as sa
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def upgrade():
 | 
			
		||||
    port_ip_associations = table('quark_port_ip_address_associations',
 | 
			
		||||
                                 column('enabled', sa.Boolean()))
 | 
			
		||||
    mac_addr_ranges = table('quark_mac_address_ranges',
 | 
			
		||||
                            column('do_not_use', sa.Boolean()))
 | 
			
		||||
 | 
			
		||||
    connection = op.get_bind()
 | 
			
		||||
 | 
			
		||||
    a = port_ip_associations.update().values({'enabled': True})
 | 
			
		||||
    connection.execute(a)
 | 
			
		||||
 | 
			
		||||
    b = mac_addr_ranges.update().values({'do_not_use': False})
 | 
			
		||||
    connection.execute(b)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def downgrade():
 | 
			
		||||
    pass
 | 
			
		||||
@@ -0,0 +1,32 @@
 | 
			
		||||
"""Create enabled and do_not_use columns
 | 
			
		||||
 | 
			
		||||
Revision ID: 5927940a466e
 | 
			
		||||
Revises: 552b213c2b8c
 | 
			
		||||
Create Date: 2014-07-07 07:50:39.372294
 | 
			
		||||
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
# revision identifiers, used by Alembic.
 | 
			
		||||
revision = '5927940a466e'
 | 
			
		||||
down_revision = '552b213c2b8c'
 | 
			
		||||
 | 
			
		||||
from alembic import op
 | 
			
		||||
import sqlalchemy as sa
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def upgrade():
 | 
			
		||||
    op.add_column('quark_port_ip_address_associations',
 | 
			
		||||
                  sa.Column('enabled',
 | 
			
		||||
                            sa.Boolean(),
 | 
			
		||||
                            nullable=False,
 | 
			
		||||
                            default=True))
 | 
			
		||||
    op.add_column('quark_mac_address_ranges',
 | 
			
		||||
                  sa.Column('do_not_use',
 | 
			
		||||
                            sa.Boolean(),
 | 
			
		||||
                            nullable=False,
 | 
			
		||||
                            default=False))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def downgrade():
 | 
			
		||||
    op.drop_column('quark_mac_address_ranges', 'do_not_use')
 | 
			
		||||
    op.drop_column('quark_port_ip_address_associations', 'enabled')
 | 
			
		||||
@@ -1 +1 @@
 | 
			
		||||
552b213c2b8c
 | 
			
		||||
3ed0c5a067f1
 | 
			
		||||
@@ -249,6 +249,7 @@ port_ip_association_table = sa.Table(
 | 
			
		||||
              sa.ForeignKey("quark_ports.id")),
 | 
			
		||||
    sa.Column("ip_address_id", sa.String(36),
 | 
			
		||||
              sa.ForeignKey("quark_ip_addresses.id")),
 | 
			
		||||
    sa.Column("enabled", sa.Boolean(), default=True, nullable=False),
 | 
			
		||||
    **TABLE_KWARGS)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -354,6 +355,7 @@ class MacAddressRange(BASEV2, models.HasId):
 | 
			
		||||
                                      'MacAddress.mac_address_range_id, '
 | 
			
		||||
                                      'MacAddress.deallocated!=1)',
 | 
			
		||||
                                      backref="mac_address_range")
 | 
			
		||||
    do_not_use = sa.Column(sa.Boolean(), default=False, nullable=False)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class IPPolicy(BASEV2, models.HasId, models.HasTenant):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user