Example #1
0
    def __init__(self, conf):
        LOG.debug("Initializing firewall agent")
        self.conf = conf
        fwaas_driver_class_path = provconf.get_provider_driver_class(
            cfg.CONF.fwaas.driver)
        self.fwaas_enabled = cfg.CONF.fwaas.enabled

        # None means l3-agent has no information on the server
        # configuration due to the lack of RPC support.
        if self.neutron_service_plugins is not None:
            fwaas_plugin_configured = (constants.FIREWALL
                                       in self.neutron_service_plugins)
            if fwaas_plugin_configured and not self.fwaas_enabled:
                msg = _("FWaaS plugin is configured in the server side, but "
                        "FWaaS is disabled in L3-agent.")
                LOG.error(msg)
                raise SystemExit(1)
            self.fwaas_enabled = self.fwaas_enabled and fwaas_plugin_configured

        if self.fwaas_enabled:
            try:
                self.fwaas_driver = importutils.import_object(
                    fwaas_driver_class_path)
                LOG.debug("FWaaS Driver Loaded: '%s'", fwaas_driver_class_path)
            except ImportError:
                msg = _('Error importing FWaaS device driver: %s')
                raise ImportError(msg % fwaas_driver_class_path)
        self.services_sync = False
        # setup RPC to msg fwaas plugin
        self.fwplugin_rpc = FWaaSL3PluginApi(FIREWALL_PLUGIN, conf.host)
        super(FWaaSL3AgentRpcCallback, self).__init__(host=conf.host)
Example #2
0
    def __init__(self, plugin):
        super(AgentDriverBase, self).__init__(plugin)
        if not self.device_driver:
            raise DriverNotSpecified()

        self.load_balancer = LoadBalancerManager(self)
        self.listener = ListenerManager(self)
        self.pool = PoolManager(self)
        self.member = MemberManager(self)
        self.health_monitor = HealthMonitorManager(self)

        self.agent_rpc = LoadBalancerAgentApi(lb_const.LOADBALANCER_AGENTV2)

        self.agent_endpoints = [
            agent_callbacks.LoadBalancerCallbacks(self.plugin),
            agents_db.AgentExtRpcCallback(self.plugin.db)
        ]

        self.conn = None

        # Setting this on the db because the plugin no longer inherts from
        # database classes, the db does.
        self.plugin.db.agent_notifiers.update(
            {lb_const.AGENT_TYPE_LOADBALANCERV2: self.agent_rpc})

        lb_sched_driver = provconf.get_provider_driver_class(
            cfg.CONF.loadbalancer_scheduler_driver, LB_SCHEDULERS)
        self.loadbalancer_scheduler = importutils.import_object(
            lb_sched_driver)
    def __init__(self, conf):
        LOG.debug("Initializing firewall agent")
        self.conf = conf
        fwaas_driver_class_path = provconf.get_provider_driver_class(
            cfg.CONF.fwaas.driver)
        self.fwaas_enabled = cfg.CONF.fwaas.enabled

        # None means l3-agent has no information on the server
        # configuration due to the lack of RPC support.
        if self.neutron_service_plugins is not None:
            fwaas_plugin_configured = (constants.FIREWALL
                                       in self.neutron_service_plugins)
            if fwaas_plugin_configured and not self.fwaas_enabled:
                msg = _("FWaaS plugin is configured in the server side, but "
                        "FWaaS is disabled in L3-agent.")
                LOG.error(msg)
                raise SystemExit(1)
            self.fwaas_enabled = self.fwaas_enabled and fwaas_plugin_configured

        if self.fwaas_enabled:
            try:
                self.fwaas_driver = importutils.import_object(
                    fwaas_driver_class_path)
                LOG.debug("FWaaS Driver Loaded: '%s'", fwaas_driver_class_path)
            except ImportError:
                msg = _('Error importing FWaaS device driver: %s')
                raise ImportError(msg % fwaas_driver_class_path)
        self.services_sync = False
        # setup RPC to msg fwaas plugin
        self.fwplugin_rpc = FWaaSL3PluginApi(topics.FIREWALL_PLUGIN,
                                             conf.host)
        super(FWaaSL3AgentRpcCallback, self).__init__(host=conf.host)
    def __init__(self, plugin):
        super(AgentDriverBase, self).__init__(plugin)
        if not self.device_driver:
            raise DriverNotSpecified()

        self.load_balancer = LoadBalancerManager(self)
        self.listener = ListenerManager(self)
        self.pool = PoolManager(self)
        self.member = MemberManager(self)
        self.health_monitor = HealthMonitorManager(self)

        self.agent_rpc = LoadBalancerAgentApi(lb_const.LOADBALANCER_AGENTV2)

        self.agent_endpoints = [
            agent_callbacks.LoadBalancerCallbacks(self.plugin),
            agents_db.AgentExtRpcCallback(self.plugin.db)
        ]

        self.conn = None

        # Setting this on the db because the plugin no longer inherts from
        # database classes, the db does.
        self.plugin.db.agent_notifiers.update(
            {lb_const.AGENT_TYPE_LOADBALANCERV2: self.agent_rpc})

        lb_sched_driver = provconf.get_provider_driver_class(
            cfg.CONF.loadbalancer_scheduler_driver, LB_SCHEDULERS)
        self.loadbalancer_scheduler = importutils.import_object(
            lb_sched_driver)
Example #5
0
 def test_get_provider_driver_class_hit(self):
     driver = 'ml2'
     expected = 'neutron.plugins.ml2.plugin.Ml2Plugin'
     actual = provconf.get_provider_driver_class(
         driver,
         namespace=manager.CORE_PLUGINS_NAMESPACE)
     self.assertEqual(expected, actual)
Example #6
0
    def __init__(self, plugin):
        if not self.device_driver:
            raise DriverNotSpecified()

        self.agent_rpc = LoadBalancerAgentApi(topics.LOADBALANCER_AGENT)

        self.plugin = plugin
        self._set_callbacks_on_plugin()
        self.plugin.agent_notifiers.update(
            {q_const.AGENT_TYPE_LOADBALANCER: self.agent_rpc})

        pool_sched_driver = provconf.get_provider_driver_class(
            cfg.CONF.loadbalancer_pool_scheduler_driver, POOL_SCHEDULERS)
        self.pool_scheduler = importutils.import_object(pool_sched_driver)
Example #7
0
 def load_device_drivers(self, host):
     """Loads one or more device drivers for VPNaaS."""
     drivers = []
     for device_driver in self.conf.vpnagent.vpn_device_driver:
         device_driver = provconfig.get_provider_driver_class(
             device_driver, DEVICE_DRIVERS)
         try:
             drivers.append(
                 importutils.import_object(device_driver, self, host))
             LOG.debug('Loaded VPNaaS device driver: %s', device_driver)
         except ImportError:
             raise vpnaas.DeviceDriverImportError(
                 device_driver=device_driver)
     return drivers
    def __init__(self, plugin):
        if not self.device_driver:
            raise DriverNotSpecified()

        self.agent_rpc = LoadBalancerAgentApi(l_const.LOADBALANCER_AGENT)

        self.plugin = plugin
        self._set_callbacks_on_plugin()
        self.plugin.agent_notifiers.update(
            {q_const.AGENT_TYPE_LOADBALANCER: self.agent_rpc})

        pool_sched_driver = provconf.get_provider_driver_class(
            cfg.CONF.loadbalancer_pool_scheduler_driver, POOL_SCHEDULERS)
        self.pool_scheduler = importutils.import_object(pool_sched_driver)
 def load_device_drivers(self):
     """Loads a single device driver for FWaaS."""
     device_driver = provconf.get_provider_driver_class(
         cfg.CONF.fwaas.driver, FIREWALL_DRIVERS)
     try:
         driver = importutils.import_object(device_driver)
         LOG.debug('Loaded FWaaS device driver: %s', device_driver)
         return driver
     except ImportError:
         msg = _('Error importing FWaaS device driver: %s')
         raise ImportError(msg % device_driver)
     except ValueError:
         msg = _('Configuration error - no FWaaS device_driver specified')
         raise ValueError(msg)
Example #10
0
 def load_device_drivers(self):
     """Loads a single device driver for FWaaS."""
     device_driver = provconf.get_provider_driver_class(
         cfg.CONF.fwaas.driver, FIREWALL_DRIVERS)
     try:
         driver = importutils.import_object(device_driver)
         LOG.debug('Loaded FWaaS device driver: %s', device_driver)
         return driver
     except ImportError:
         msg = _('Error importing FWaaS device driver: %s')
         raise ImportError(msg % device_driver)
     except ValueError:
         msg = _('Configuration error - no FWaaS device_driver specified')
         raise ValueError(msg)
 def load_device_drivers(self, host):
     """Loads device drivers for VPNaaS."""
     drivers = []
     for device_driver in self.conf.vpnagent.vpn_device_driver:
         device_driver = provconfig.get_provider_driver_class(
             device_driver, DEVICE_DRIVERS)
         try:
             drivers.append(importutils.import_object(device_driver,
                                                      self,
                                                      host))
             LOG.debug('Loaded VPNaaS device driver: %s', device_driver)
         except ImportError:
             raise vpnaas.DeviceDriverImportError(
                 device_driver=device_driver)
     return drivers
Example #12
0
    def _load_drivers(self):
        self.device_drivers = {}
        for driver in self.conf.device_driver:
            driver = provconfig.get_provider_driver_class(driver, DEVICE_DRIVERS)
            try:
                driver_inst = importutils.import_object(driver, self.conf, self.plugin_rpc)
            except ImportError:
                msg = _("Error importing loadbalancer device driver: %s")
                raise SystemExit(msg % driver)

            driver_name = driver_inst.get_name()
            if driver_name not in self.device_drivers:
                self.device_drivers[driver_name] = driver_inst
            else:
                msg = _("Multiple device drivers with the same name found: %s")
                raise SystemExit(msg % driver_name)
Example #13
0
    def _load_drivers(self):
        self.device_drivers = {}
        for driver in self.conf.device_driver:
            driver = provconfig.get_provider_driver_class(
                driver, DEVICE_DRIVERS)
            try:
                driver_inst = importutils.import_object(
                    driver, self.conf, self.plugin_rpc)
            except ImportError:
                msg = _('Error importing loadbalancer device driver: %s')
                raise SystemExit(msg % driver)

            driver_name = driver_inst.get_name()
            if driver_name not in self.device_drivers:
                self.device_drivers[driver_name] = driver_inst
            else:
                msg = _('Multiple device drivers with the same name found: %s')
                raise SystemExit(msg % driver_name)
Example #14
0
 def test_get_provider_driver_class_miss(self):
     retval = provconf.get_provider_driver_class('foo')
     self.assertEqual('foo', retval)
 def test_get_provider_driver_class_miss(self):
     retval = provconf.get_provider_driver_class('foo')
     self.assertEqual('foo', retval)