<commit_before># Copyright (c) 2017 Cisco Systems Inc.
# 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.

# Note: This module should be treated as legacy and should not be extended to
# add any new data migrations. New data migrations should be added
# directly to the alembic migration script along with the table definitions
# that are being referenced.
# For reference see how its done here:
# https://github.com/openstack/neutron/blob/
# 625de54de3936b0da8760c3da76d2d315d05f94e/neutron/db/migration/
# alembic_migrations/versions/newton/contract/
# 3b935b28e7a0_migrate_to_pluggable_ipam.py

import netaddr

from aim.aim_lib import nat_strategy
from aim import aim_manager
from aim.api import resource as aim_resource
from aim import context as aim_context
from aim import utils as aim_utils
from alembic import util as alembic_util
from neutron.db.migration.cli import CONF
from neutron.db.models import address_scope as as_db
from neutron.db.models import securitygroup as sg_models
from neutron.db import models_v2
from neutron.db import segments_db  # noqa
from neutron_lib.db import model_base
import sqlalchemy as sa
from sqlalchemy.orm import lazyload

from gbpservice.neutron.extensions import cisco_apic as ext
from gbpservice.neutron.plugins.ml2plus.drivers.apic_aim import apic_mapper


# The following definitions have been taken from commit:
# 9b4b7276ad8a0f181c9be12ba5a0192432aa5027
# and is frozen for the data migration script that was included
# in this module. It should not be changed in this module.
NetworkExtensionDb = sa.Table(
        'apic_aim_network_extensions', sa.MetaData(),
        sa.Column('network_id', sa.String(36), nullable=False),
        sa.Column('external_network_dn', sa.String(1024)),
        sa.Column('nat_type', sa.Enum('distributed', 'edge', '')))


NetworkExtensionCidrDb = sa.Table(
        'apic_aim_network_external_cidrs', sa.MetaData(),
        sa.Column('network_id', sa.String(36), nullable=False),
        sa.Column('cidr', sa.String(64), nullable=False))


AddressScopeMapping = sa.Table(
        'apic_aim_address_scope_mappings', sa.MetaData(),
        sa.Column('scope_id', sa.String(36)),
        sa.Column('vrf_name', sa.String(64)),
        sa.Column('vrf_tenant_name', sa.String(64)),
        sa.Column('vrf_owned', sa.Boolean, nullable=False))


# The following definition has been taken from commit:
# f8b41855acbbb7e59a0bab439445c198fc6aa146
# and is frozen for the data migration script that was included
# in this module. It should not be changed in this module.
NetworkMapping = sa.Table(
        'apic_aim_network_mappings', sa.MetaData(),
        sa.Column('network_id', sa.String(36), nullable=False),
        sa.Column('bd_name', sa.String(64), nullable=True),
        sa.Column('bd_tenant_name', sa.String(64), nullable=True),
        sa.Column('epg_name', sa.String(64), nullable=True),
        sa.Column('epg_tenant_name', sa.String(64), nullable=True),
        sa.Column('epg_app_profile_name', sa.String(64), nullable=True),
        sa.Column('vrf_name', sa.String(64), nullable=True),
        sa.Column('vrf_tenant_name', sa.String(64), nullable=True))


# This is neeeded in order to make aueries against the table
# prior to the pirmary key change in the schema (the ORM is defined
# with the new primary keys, so it can't be used).
HAIPAddressToPortAssociation = sa.Table(
        'apic_ml2_ha_ipaddress_to_port_owner', sa.MetaData(),<commit_msg>data-migrations spelling fixes<commit_after># Copyright (c) 2017 Cisco Systems Inc.
# 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.

# Note: This module should be treated as legacy and should not be extended to
# add any new data migrations. New data migrations should be added
# directly to the alembic migration script along with the table definitions
# that are being referenced.
# For reference see how its done here:
# https://github.com/openstack/neutron/blob/
# 625de54de3936b0da8760c3da76d2d315d05f94e/neutron/db/migration/
# alembic_migrations/versions/newton/contract/
# 3b935b28e7a0_migrate_to_pluggable_ipam.py

import netaddr

from aim.aim_lib import nat_strategy
from aim import aim_manager
from aim.api import resource as aim_resource
from aim import context as aim_context
from aim import utils as aim_utils
from alembic import util as alembic_util
from neutron.db.migration.cli import CONF
from neutron.db.models import address_scope as as_db
from neutron.db.models import securitygroup as sg_models
from neutron.db import models_v2
from neutron.db import segments_db  # noqa
from neutron_lib.db import model_base
import sqlalchemy as sa
from sqlalchemy.orm import lazyload

from gbpservice.neutron.extensions import cisco_apic as ext
from gbpservice.neutron.plugins.ml2plus.drivers.apic_aim import apic_mapper


# The following definitions have been taken from commit:
# <PASSWORD>
# and is frozen for the data migration script that was included
# in this module. It should not be changed in this module.
NetworkExtensionDb = sa.Table(
        'apic_aim_network_extensions', sa.MetaData(),
        sa.Column('network_id', sa.String(36), nullable=False),
        sa.Column('external_network_dn', sa.String(1024)),
        sa.Column('nat_type', sa.Enum('distributed', 'edge', '')))


NetworkExtensionCidrDb = sa.Table(
        'apic_aim_network_external_cidrs', sa.MetaData(),
        sa.Column('network_id', sa.String(36), nullable=False),
        sa.Column('cidr', sa.String(64), nullable=False))


AddressScopeMapping = sa.Table(
        'apic_aim_address_scope_mappings', sa.MetaData(),
        sa.Column('scope_id', sa.String(36)),
        sa.Column('vrf_name', sa.String(64)),
        sa.Column('vrf_tenant_name', sa.String(64)),
        sa.Column('vrf_owned', sa.Boolean, nullable=False))


# The following definition has been taken from commit:
# f8b41855acbbb7e59a0bab439445c198fc6aa146
# and is frozen for the data migration script that was included
# in this module. It should not be changed in this module.
NetworkMapping = sa.Table(
        'apic_aim_network_mappings', sa.MetaData(),
        sa.Column('network_id', sa.String(36), nullable=False),
        sa.Column('bd_name', sa.String(64), nullable=True),
        sa.Column('bd_tenant_name', sa.String(64), nullable=True),
        sa.Column('epg_name', sa.String(64), nullable=True),
        sa.Column('epg_tenant_name', sa.String(64), nullable=True),
        sa.Column('epg_app_profile_name', sa.String(64), nullable=True),
        sa.Column('vrf_name', sa.String(64), nullable=True),
        sa.Column('vrf_tenant_name', sa.String(64), nullable=True))


# This is needed in order to make queries against the table
# prior to the primary key change in the schema (the ORM is defined
# with the new primary keys, so it can't be used).
HAIPAddressToPortAssociation = sa.Table(
        'apic_ml2_ha_ipaddress_to_port_owner', sa.MetaData(),
{'fraction_non_alphanumeric': 0.0929559748427673, 'fraction_numerical': 0.028176100628930816, 'mean_word_length': 4.314839572192513, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4628252', 'n_tokens_mistral': 2559, 'n_tokens_neox': 2448, 'n_words': 767}