| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
from neutron.services import provider_configuration as provconf |
| 17 |
from oslo_config import cfg |
| 18 |
from oslo_log import log as logging |
| 19 |
from oslo_utils import importutils |
| 20 |
|
| 21 |
from neutron_fwaas._i18n import _ |
| 22 |
|
| 23 |
LOG = logging.getLogger(__name__) |
| 24 |
|
| 25 |
FIREWALL_DRIVERS = 'firewall_drivers' |
| 26 |
|
| 27 |
|
| 28 |
class FirewallService: |
| 29 |
"""Firewall Service observer.""" |
| 30 |
|
| 31 |
def load_device_drivers(self): |
| 32 |
"""Loads a single device driver for FWaaS.""" |
| 33 |
device_driver = provconf.get_provider_driver_class( |
| 34 |
cfg.CONF.fwaas.driver, FIREWALL_DRIVERS) |
| 35 |
try: |
| 36 |
driver = importutils.import_object(device_driver) |
| 37 |
LOG.debug('Loaded FWaaS device driver: %s', device_driver) |
| 38 |
return driver |
| 39 |
except ImportError: |
| 40 |
msg = _('Error importing FWaaS device driver: %s') |
| 41 |
raise ImportError(msg % device_driver) |
| 42 |
except ValueError: |
| 43 |
msg = _('Configuration error - no FWaaS device_driver specified') |
| 44 |
raise ValueError(msg) |