Merge "Remove FWaaS Noop driver as default and move to unit tests dir"
This commit is contained in:
commit
f400ae6351
@ -29,8 +29,7 @@ LOG = logging.getLogger(__name__)
|
|||||||
FWaaSOpts = [
|
FWaaSOpts = [
|
||||||
cfg.StrOpt(
|
cfg.StrOpt(
|
||||||
'driver',
|
'driver',
|
||||||
default=('neutron.services.firewall.drivers.fwaas_base.'
|
default='',
|
||||||
'NoopFwaasDriver'),
|
|
||||||
help=_("Name of the FWaaS Driver")),
|
help=_("Name of the FWaaS Driver")),
|
||||||
cfg.BoolOpt(
|
cfg.BoolOpt(
|
||||||
'enabled',
|
'enabled',
|
||||||
|
@ -67,13 +67,15 @@ class FWaaSL3AgentRpcCallback(api.FWaaSAgentRpcCallbackMixin):
|
|||||||
self.conf = conf
|
self.conf = conf
|
||||||
fwaas_driver_class_path = cfg.CONF.fwaas.driver
|
fwaas_driver_class_path = cfg.CONF.fwaas.driver
|
||||||
self.fwaas_enabled = cfg.CONF.fwaas.enabled
|
self.fwaas_enabled = cfg.CONF.fwaas.enabled
|
||||||
try:
|
if self.fwaas_enabled:
|
||||||
self.fwaas_driver = importutils.import_object(
|
try:
|
||||||
fwaas_driver_class_path)
|
self.fwaas_driver = importutils.import_object(
|
||||||
LOG.debug(_("FWaaS Driver Loaded: '%s'"), fwaas_driver_class_path)
|
fwaas_driver_class_path)
|
||||||
except ImportError:
|
LOG.debug(_("FWaaS Driver Loaded: '%s'"),
|
||||||
msg = _('Error importing FWaaS device driver: %s')
|
fwaas_driver_class_path)
|
||||||
raise ImportError(msg % fwaas_driver_class_path)
|
except ImportError:
|
||||||
|
msg = _('Error importing FWaaS device driver: %s')
|
||||||
|
raise ImportError(msg % fwaas_driver_class_path)
|
||||||
self.services_sync = False
|
self.services_sync = False
|
||||||
self.root_helper = config.get_root_helper(conf)
|
self.root_helper = config.get_root_helper(conf)
|
||||||
# setup RPC to msg fwaas plugin
|
# setup RPC to msg fwaas plugin
|
||||||
@ -220,6 +222,9 @@ class FWaaSL3AgentRpcCallback(api.FWaaSAgentRpcCallbackMixin):
|
|||||||
|
|
||||||
def process_services_sync(self, ctx):
|
def process_services_sync(self, ctx):
|
||||||
"""On RPC issues sync with plugin and apply the sync data."""
|
"""On RPC issues sync with plugin and apply the sync data."""
|
||||||
|
# avoid msg to plugin when fwaas is not configured
|
||||||
|
if not self.fwaas_enabled:
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
# get all routers
|
# get all routers
|
||||||
routers = self.plugin_rpc.get_routers(ctx)
|
routers = self.plugin_rpc.get_routers(ctx)
|
||||||
|
@ -98,23 +98,3 @@ class FwaasDriverBase(object):
|
|||||||
interfaces.
|
interfaces.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class NoopFwaasDriver(FwaasDriverBase):
|
|
||||||
"""Noop Fwaas Driver.
|
|
||||||
|
|
||||||
Firewall driver which does nothing.
|
|
||||||
This driver is for disabling Fwaas functionality.
|
|
||||||
"""
|
|
||||||
|
|
||||||
def create_firewall(self, apply_list, firewall):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def delete_firewall(self, apply_list, firewall):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def update_firewall(self, apply_list, firewall):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def apply_default_policy(self, apply_list, firewall):
|
|
||||||
pass
|
|
||||||
|
@ -32,6 +32,7 @@ from neutron import context
|
|||||||
from neutron.plugins.common import constants
|
from neutron.plugins.common import constants
|
||||||
from neutron.services.firewall.agents.l3reference import firewall_l3_agent
|
from neutron.services.firewall.agents.l3reference import firewall_l3_agent
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
|
from neutron.tests.unit.services.firewall.agents import test_firewall_agent_api
|
||||||
|
|
||||||
|
|
||||||
class FWaasHelper(object):
|
class FWaasHelper(object):
|
||||||
@ -55,6 +56,7 @@ class TestFwaasL3AgentRpcCallback(base.BaseTestCase):
|
|||||||
agent_config.register_root_helper(self.conf)
|
agent_config.register_root_helper(self.conf)
|
||||||
self.conf.root_helper = 'sudo'
|
self.conf.root_helper = 'sudo'
|
||||||
self.api = FWaasAgent(self.conf)
|
self.api = FWaasAgent(self.conf)
|
||||||
|
self.api.fwaas_driver = test_firewall_agent_api.NoopFwaasDriver()
|
||||||
|
|
||||||
def test_create_firewall(self):
|
def test_create_firewall(self):
|
||||||
fake_firewall = {'id': 0}
|
fake_firewall = {'id': 0}
|
||||||
|
@ -23,9 +23,30 @@ import contextlib
|
|||||||
import mock
|
import mock
|
||||||
|
|
||||||
from neutron.services.firewall.agents import firewall_agent_api as api
|
from neutron.services.firewall.agents import firewall_agent_api as api
|
||||||
|
from neutron.services.firewall.drivers import fwaas_base as base_driver
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
|
|
||||||
|
|
||||||
|
class NoopFwaasDriver(base_driver.FwaasDriverBase):
|
||||||
|
"""Noop Fwaas Driver.
|
||||||
|
|
||||||
|
Firewall driver which does nothing.
|
||||||
|
This driver is for disabling Fwaas functionality.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def create_firewall(self, apply_list, firewall):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def delete_firewall(self, apply_list, firewall):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def update_firewall(self, apply_list, firewall):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def apply_default_policy(self, apply_list, firewall):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TestFWaaSAgentApi(base.BaseTestCase):
|
class TestFWaaSAgentApi(base.BaseTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestFWaaSAgentApi, self).setUp()
|
super(TestFWaaSAgentApi, self).setUp()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user