# Path: networking_sfc/services/sfc/common/exceptions.py
# class SfcDriverError(exceptions.NeutronException):
# class SfcException(exceptions.NeutronException):
# class SfcBadRequest(exceptions.BadRequest, SfcException):
# class SfcNoSubnetGateway(SfcDriverError):
# class SfcNoSuchSubnet(SfcDriverError):
# class FlowClassifierInvalid(SfcDriverError):


from oslo_config import cfg
from oslo_log import log
from stevedore.named import NamedExtensionManager
from networking_sfc.services.sfc.common import exceptions as sfc_exc

    def initialize(self):
        # ServiceChain bulk operations requires each driver to support them
        self.native_bulk_support = True
        for driver in self.ordered_drivers:
            LOG.info("Initializing SFC driver '%s'", driver.name)
            driver.obj.initialize()
            self.native_bulk_support &= getattr(driver.obj,
                                                'native_bulk_support', True)

    def _call_drivers(self, method_name, context, raise_orig_exc=False):
        """Helper method for calling a method across all SFC drivers.

        :param method_name: name of the method to call
        :param context: context parameter to pass to each method call
        :param raise_orig_exc: whether or not to raise the original
        driver exception, or use a general one
        """
        for driver in self.ordered_drivers:
            try:
                getattr(driver.obj, method_name)(context)
            except Exception as e:
                # This is an internal failure.
                LOG.exception(e)
                LOG.error(
                    "SFC driver '%(name)s' failed in %(method)s",
                    {'name': driver.name, 'method': method_name}
                )
                if raise_orig_exc:
                    raise

# Path: networking_sfc/services/sfc/common/exceptions.py
# class SfcDriverError(exceptions.NeutronException):
# class SfcException(exceptions.NeutronException):
# class SfcBadRequest(exceptions.BadRequest, SfcException):
# class SfcNoSubnetGateway(SfcDriverError):
# class SfcNoSuchSubnet(SfcDriverError):
# class FlowClassifierInvalid(SfcDriverError):


# Path: networking_sfc/services/sfc/driver_manager.py
from oslo_config import cfg
from oslo_log import log
from stevedore.named import NamedExtensionManager
from networking_sfc.services.sfc.common import exceptions as sfc_exc


    def initialize(self):
        # ServiceChain bulk operations requires each driver to support them
        self.native_bulk_support = True
        for driver in self.ordered_drivers:
            LOG.info("Initializing SFC driver '%s'", driver.name)
            driver.obj.initialize()
            self.native_bulk_support &= getattr(driver.obj,
                                                'native_bulk_support', True)

    def _call_drivers(self, method_name, context, raise_orig_exc=False):
        """Helper method for calling a method across all SFC drivers.

        :param method_name: name of the method to call
        :param context: context parameter to pass to each method call
        :param raise_orig_exc: whether or not to raise the original
        driver exception, or use a general one
        """
        for driver in self.ordered_drivers:
            try:
                getattr(driver.obj, method_name)(context)
            except Exception as e:
                # This is an internal failure.
                LOG.exception(e)
                LOG.error(
                    "SFC driver '%(name)s' failed in %(method)s",
                    {'name': driver.name, 'method': method_name}
                )
                if raise_orig_exc:
                    raise

                raise sfc_exc.SfcDriverError(