# Path: a10_neutron_lbaas/a10_exceptions.py
# class InternalError(Exception):
# class InvalidConfig(Exception):
# class InvalidDeviceConfig(Exception):
# class UnsupportedFeature(Exception):
# class DeviceConfigMissing(Exception):
# class InstanceMissing(Exception):
# class NoDatabaseURL(Exception):
# class RequiresDatabase(Exception):
# class ImageNotFoundError(Exception):
# class FlavorNotFoundError(Exception):
# class NetworksNotFoundError(Exception):
# class IdentifierUnspecifiedError(Exception):
# class ServiceUnavailableError(Exception):
# class FeatureNotConfiguredError(Exception):
# class NoDevicesAvailableError(Exception):
# class NotImplemented(Exception):
# class ConnLimitOutOfBounds(Exception):
# 
# Path: a10_neutron_lbaas/etc/config.py

# 
# Path: a10_neutron_lbaas/etc/defaults.py
# GLOBAL_DEFAULTS = {
#     "verify_appliances": False,
#     "use_database": False,
#     "database_connection": None,
#     "neutron_conf_dir": '/etc/neutron',
#     "member_name_use_uuid": False,
#     "keystone_auth_url": None,
#     "keystone_version": 2,
#     "plumbing_hooks_class": a10_neutron_lbaas.plumbing_hooks.PlumbingHooks,
#     "nova_api_version": "2.1",
#     "vport_defaults": {},
#     "use_parent_project": False
# }
# DEVICE_REQUIRED_FIELDS = [
#     "host",
#     "username",
#     "password",
# ]
# DEVICE_OPTIONAL_DEFAULTS = {
#     "protocol": "https",
#     "port": 443,
#     "api_version": "2.1",
#     "status": True,
#     "autosnat": False,
#     "v_method": "LSI",
#     "shared_partition": "shared",
#     "use_float": False,
#     "default_virtual_server_vrid": None,
#     "ipinip": False,
#     "ha_sync_list": [],
#     "write_memory": True,
#     "vport_defaults": {},
#     # "max_instance": 5000,
#     # "method": "hash",
# 
#     # "max_partitions": 10,
#     # "per_partition_lif_max": 10,
#     # "peer_mgmt_ip": "",
#     # "peer_mgmt_port": "",
#     # "default_virtual_server_vrid": 1,
#     # "vlan": 0,
#     # "gateway_mode": 1,
# }
# VTHUNDER_REQUIRED_FIELDS = [
#     'username',
#     'password',
# 
#     'nova_flavor',
#     'glance_image',
# 
#     'vthunder_management_network',
#     'vthunder_data_networks',
# ]
# VTHUNDER_OPTIONAL_DEFAULTS = DEVICE_OPTIONAL_DEFAULTS
# VTHUNDER_OPTIONAL_DEFAULTS = dict(DEVICE_OPTIONAL_DEFAULTS)


import logging
import os
import runpy
import sys
    import ConfigParser as ini
    import configparser as ini
from debtcollector import removals
from a10_neutron_lbaas import a10_exceptions as a10_ex
from a10_neutron_lbaas.etc import config as blank_config
from a10_neutron_lbaas.etc import defaults
            from a10_neutron_lbaas.db import models
            from a10_neutron_lbaas.db import models

        for k, v in d['providers'][provider].items():
            if isinstance(v, dict):
                if k not in self.__dict__:
                    self.__dict__[k] = {}
                self.__dict__[k].update(v)
            else:
                self.__dict__[k] = v

    @classmethod
    def load(cls, path, provider=None):
        d = runpy.run_path(path)
        return ConfigModule(d, provider=provider)


class A10Config(object):

    def __init__(self, config_dir=None, config=None, provider=None):
        if config is not None:
            self._config = config
            self._load_config()
            return

        self._config_dir = self._find_config_dir(config_dir)
        self._config_path = os.path.join(self._config_dir, "config.py")

        try:
            self._config = ConfigModule.load(self._config_path, provider=provider)
        except IOError:
            LOG.error("A10Config could not find %s", self._config_path)

# Path: a10_neutron_lbaas/a10_exceptions.py
# class InternalError(Exception):
# class InvalidConfig(Exception):
# class InvalidDeviceConfig(Exception):
# class UnsupportedFeature(Exception):
# class DeviceConfigMissing(Exception):
# class InstanceMissing(Exception):
# class NoDatabaseURL(Exception):
# class RequiresDatabase(Exception):
# class ImageNotFoundError(Exception):
# class FlavorNotFoundError(Exception):
# class NetworksNotFoundError(Exception):
# class IdentifierUnspecifiedError(Exception):
# class ServiceUnavailableError(Exception):
# class FeatureNotConfiguredError(Exception):
# class NoDevicesAvailableError(Exception):
# class NotImplemented(Exception):
# class ConnLimitOutOfBounds(Exception):
# 
# Path: a10_neutron_lbaas/etc/config.py

# 
# Path: a10_neutron_lbaas/etc/defaults.py
# GLOBAL_DEFAULTS = {
#     "verify_appliances": False,
#     "use_database": False,
#     "database_connection": None,
#     "neutron_conf_dir": '/etc/neutron',
#     "member_name_use_uuid": False,
#     "keystone_auth_url": None,
#     "keystone_version": 2,
#     "plumbing_hooks_class": a10_neutron_lbaas.plumbing_hooks.PlumbingHooks,
#     "nova_api_version": "2.1",
#     "vport_defaults": {},
#     "use_parent_project": False
# }
# DEVICE_REQUIRED_FIELDS = [
#     "host",
#     "username",
#     "password",
# ]
# DEVICE_OPTIONAL_DEFAULTS = {
#     "protocol": "https",
#     "port": 443,
#     "api_version": "2.1",
#     "status": True,
#     "autosnat": False,
#     "v_method": "LSI",
#     "shared_partition": "shared",
#     "use_float": False,
#     "default_virtual_server_vrid": None,
#     "ipinip": False,
#     "ha_sync_list": [],
#     "write_memory": True,
#     "vport_defaults": {},
#     # "max_instance": 5000,
#     # "method": "hash",
# 
#     # "max_partitions": 10,
#     # "per_partition_lif_max": 10,
#     # "peer_mgmt_ip": "",
#     # "peer_mgmt_port": "",
#     # "default_virtual_server_vrid": 1,
#     # "vlan": 0,
#     # "gateway_mode": 1,
# }
# VTHUNDER_REQUIRED_FIELDS = [
#     'username',
#     'password',
# 
#     'nova_flavor',
#     'glance_image',
# 
#     'vthunder_management_network',
#     'vthunder_data_networks',
# ]
# VTHUNDER_OPTIONAL_DEFAULTS = DEVICE_OPTIONAL_DEFAULTS
# VTHUNDER_OPTIONAL_DEFAULTS = dict(DEVICE_OPTIONAL_DEFAULTS)


# Path: a10_neutron_lbaas/a10_config.py
import logging
import os
import runpy
import sys
    import ConfigParser as ini
    import configparser as ini
from debtcollector import removals
from a10_neutron_lbaas import a10_exceptions as a10_ex
from a10_neutron_lbaas.etc import config as blank_config
from a10_neutron_lbaas.etc import defaults
            from a10_neutron_lbaas.db import models
            from a10_neutron_lbaas.db import models


        for k, v in d['providers'][provider].items():
            if isinstance(v, dict):
                if k not in self.__dict__:
                    self.__dict__[k] = {}
                self.__dict__[k].update(v)
            else:
                self.__dict__[k] = v

    @classmethod
    def load(cls, path, provider=None):
        d = runpy.run_path(path)
        return ConfigModule(d, provider=provider)


class A10Config(object):

    def __init__(self, config_dir=None, config=None, provider=None):
        if config is not None:
            self._config = config
            self._load_config()
            return

        self._config_dir = self._find_config_dir(config_dir)
        self._config_path = os.path.join(self._config_dir, "config.py")

        try:
            self._config = ConfigModule.load(self._config_path, provider=provider)
        except IOError:
            LOG.error("A10Config could not find %s", self._config_path)

            self._config = blank_config