Make log extension more generic
Currently, log extension is only compatible with ovs agent [1]. In order to support security group logging based iptables, this patch will make log extension compatible with linuxbridge agent, too. [1] https://bugs.launchpad.net/neutron/+bug/1743463 Change-Id: Ic6528ac3ecfd9fd2dac6f2b8233df5554a867520 Partially-implements: blueprint security-group-logging
This commit is contained in:
parent
e27f4a53e1
commit
01d90e5153
|
@ -86,9 +86,8 @@ class LoggingExtension(agent_extension.AgentExtension):
|
|||
def initialize(self, connection, driver_type):
|
||||
"""Initialize agent extension."""
|
||||
|
||||
int_br = self.agent_api.request_int_br()
|
||||
self.log_driver = manager.NeutronManager.load_class_for_provider(
|
||||
LOGGING_DRIVERS_NAMESPACE, driver_type)(int_br)
|
||||
LOGGING_DRIVERS_NAMESPACE, driver_type)(self.agent_api)
|
||||
self.resource_rpc = agent_rpc.LoggingApiStub()
|
||||
self._register_rpc_consumers(connection)
|
||||
self.log_driver.initialize(self.resource_rpc)
|
||||
|
|
|
@ -130,7 +130,8 @@ class OVSFirewallLoggingDriver(log_ext.LoggingDriver):
|
|||
ovs_consts.OPENFLOW14,
|
||||
]
|
||||
|
||||
def __init__(self, integration_bridge):
|
||||
def __init__(self, agent_api):
|
||||
integration_bridge = agent_api.request_int_br()
|
||||
self.int_br = self.initialize_bridge(integration_bridge)
|
||||
self._deferred = False
|
||||
self.log_ports = collections.defaultdict(dict)
|
||||
|
|
|
@ -62,12 +62,13 @@ class LoggingExtensionTestFramework(test_firewall.BaseFirewallTestCase):
|
|||
self.log_driver = self.initialize_ovs_fw_log()
|
||||
|
||||
def initialize_ovs_fw_log(self):
|
||||
int_br = ovs_ext_api.OVSCookieBridge(ovs_bridge.OVSAgentBridge(
|
||||
self.tester.bridge.br_name))
|
||||
mock.patch('ryu.base.app_manager.AppManager.get_instance').start()
|
||||
mock.patch(
|
||||
'neutron.agent.ovsdb.impl_vsctl.OvsdbVsctl.transaction').start()
|
||||
log_driver = ovs_fw_log.OVSFirewallLoggingDriver(int_br)
|
||||
agent_api = ovs_ext_api.OVSAgentExtensionAPI(
|
||||
ovs_bridge.OVSAgentBridge(self.tester.bridge.br_name),
|
||||
ovs_bridge.OVSAgentBridge('br-tun'))
|
||||
log_driver = ovs_fw_log.OVSFirewallLoggingDriver(agent_api)
|
||||
log_driver.initialize(self.resource_rpc)
|
||||
return log_driver
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ from neutron_lib import constants
|
|||
from oslo_config import cfg
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from neutron.agent.common import ovs_lib
|
||||
from neutron.agent.linux.openvswitch_firewall import constants as ovsfw_consts
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.objects.logapi import logging_resource as log_object
|
||||
|
@ -104,9 +103,7 @@ class FakeOVSPort(object):
|
|||
class TestOVSFirewallLoggingDriver(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestOVSFirewallLoggingDriver, self).setUp()
|
||||
mock_bridge = mock.patch.object(
|
||||
ovs_lib, 'OVSBridge', autospec=True).start()
|
||||
self.log_driver = ovsfw_log.OVSFirewallLoggingDriver(mock_bridge)
|
||||
self.log_driver = ovsfw_log.OVSFirewallLoggingDriver(mock.Mock())
|
||||
resource_rpc_mock = mock.patch.object(
|
||||
agent_rpc, 'LoggingApiStub', autospec=True).start()
|
||||
self.log_driver.start_logapp = mock.Mock()
|
||||
|
|
Loading…
Reference in New Issue