Merge "Enable full-sync for the bgpvpn, lbaas, qos, sfc, trunk driver"
This commit is contained in:
commit
9272b7a6eb
|
@ -20,8 +20,11 @@ from oslo_log import log as logging
|
|||
|
||||
from networking_bgpvpn.neutron.extensions import bgpvpn as bgpvpn_ext
|
||||
from networking_bgpvpn.neutron.services.service_drivers import driver_api
|
||||
from neutron_lib.api.definitions import bgpvpn as bgpvpn_const
|
||||
|
||||
from networking_odl.common import constants as odl_const
|
||||
from networking_odl.common import postcommit
|
||||
from networking_odl.journal import full_sync
|
||||
from networking_odl.journal import journal
|
||||
|
||||
|
||||
|
@ -29,6 +32,15 @@ cfg.CONF.import_group('ml2_odl', 'networking_odl.common.config')
|
|||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
BGPVPN_RESOURCES = {
|
||||
odl_const.ODL_BGPVPN: odl_const.ODL_BGPVPNS,
|
||||
odl_const.ODL_BGPVPN_NETWORK_ASSOCIATION:
|
||||
odl_const.ODL_BGPVPN_NETWORK_ASSOCIATIONS,
|
||||
|
||||
odl_const.ODL_BGPVPN_ROUTER_ASSOCIATION:
|
||||
odl_const.ODL_BGPVPN_ROUTER_ASSOCIATIONS
|
||||
}
|
||||
|
||||
|
||||
@postcommit.add_postcommit('bgpvpn', 'net_assoc', 'router_assoc')
|
||||
class OpenDaylightBgpvpnDriver(driver_api.BGPVPNDriver):
|
||||
|
@ -44,6 +56,7 @@ class OpenDaylightBgpvpnDriver(driver_api.BGPVPNDriver):
|
|||
LOG.info("Initializing OpenDaylight BGPVPN v2 driver")
|
||||
super(OpenDaylightBgpvpnDriver, self).__init__(service_plugin)
|
||||
self.journal = journal.OpenDaylightJournalThread()
|
||||
full_sync.register(bgpvpn_const.LABEL, BGPVPN_RESOURCES)
|
||||
|
||||
@log_helpers.log_method_call
|
||||
def create_bgpvpn_precommit(self, context, bgpvpn):
|
||||
|
|
|
@ -47,17 +47,28 @@ ODL_QOS_POLICIES = 'policies'
|
|||
|
||||
ODL_SFC = 'sfc'
|
||||
ODL_SFC_FLOW_CLASSIFIER = 'flowclassifier'
|
||||
ODL_SFC_FLOW_CLASSIFIERS = 'flowclassifiers'
|
||||
ODL_SFC_PORT_PAIR = 'portpair'
|
||||
ODL_SFC_PORT_PAIRS = 'portpairs'
|
||||
ODL_SFC_PORT_PAIR_GROUP = 'portpairgroup'
|
||||
ODL_SFC_PORT_PAIR_GROUPS = 'portpairgroups'
|
||||
ODL_SFC_PORT_CHAIN = 'portchain'
|
||||
ODL_SFC_PORT_CHAINS = 'portchains'
|
||||
|
||||
ODL_TRUNK = 'trunk'
|
||||
ODL_TRUNKS = 'trunks'
|
||||
|
||||
ODL_L2GATEWAY = 'l2_gateway'
|
||||
ODL_L2GATEWAYS = 'l2_gateways'
|
||||
ODL_L2GATEWAY_CONNECTION = 'l2gateway_connection'
|
||||
ODL_L2GATEWAY_CONNECTIONS = 'l2_gateway_connections'
|
||||
|
||||
ODL_BGPVPN = 'bgpvpn'
|
||||
ODL_BGPVPNS = 'bgpvpns'
|
||||
ODL_BGPVPN_NETWORK_ASSOCIATION = 'bgpvpn_network_association'
|
||||
ODL_BGPVPN_NETWORK_ASSOCIATIONS = 'bgpvpn_network_associations'
|
||||
ODL_BGPVPN_ROUTER_ASSOCIATION = 'bgpvpn_network_association'
|
||||
ODL_BGPVPN_ROUTER_ASSOCIATIONS = 'bgpvpn_network_associations'
|
||||
|
||||
ODL_ML2_MECH_DRIVER_V1 = "opendaylight"
|
||||
ODL_ML2_MECH_DRIVER_V2 = "opendaylight_v2"
|
||||
|
|
|
@ -44,7 +44,30 @@ _ORDERED_ODL_RESOURCES = (
|
|||
odl_const.ODL_SUBNET,
|
||||
odl_const.ODL_ROUTER,
|
||||
odl_const.ODL_PORT,
|
||||
odl_const.ODL_FLOATINGIP)
|
||||
odl_const.ODL_FLOATINGIP,
|
||||
odl_const.ODL_LOADBALANCER,
|
||||
odl_const.ODL_LISTENER,
|
||||
odl_const.ODL_POOL,
|
||||
odl_const.ODL_MEMBER,
|
||||
odl_const.ODL_HEALTHMONITOR,
|
||||
odl_const.ODL_QOS_POLICY,
|
||||
odl_const.ODL_TRUNK,
|
||||
odl_const.ODL_BGPVPN,
|
||||
odl_const.ODL_BGPVPN_NETWORK_ASSOCIATION,
|
||||
odl_const.ODL_BGPVPN_ROUTER_ASSOCIATION,
|
||||
odl_const.ODL_SFC_FLOW_CLASSIFIER,
|
||||
odl_const.ODL_SFC_PORT_PAIR,
|
||||
odl_const.ODL_SFC_PORT_PAIR_GROUP,
|
||||
odl_const.ODL_SFC_PORT_CHAIN,
|
||||
odl_const.ODL_L2GATEWAY,
|
||||
odl_const.ODL_L2GATEWAY_CONNECTION,
|
||||
)
|
||||
|
||||
ALL_RESOURCES = {}
|
||||
|
||||
|
||||
def register(driver, resources):
|
||||
ALL_RESOURCES[driver] = resources
|
||||
|
||||
|
||||
def full_sync(session):
|
||||
|
@ -55,7 +78,7 @@ def full_sync(session):
|
|||
|
||||
dbcontext = neutron_context.get_admin_context()
|
||||
for resource_type in _ORDERED_ODL_RESOURCES:
|
||||
for plugin_alias, resource in odl_const.ALL_RESOURCES.items():
|
||||
for plugin_alias, resource in ALL_RESOURCES.items():
|
||||
collection_name = resource.get(resource_type)
|
||||
if collection_name is not None:
|
||||
plugin = directory.get_plugin(plugin_alias)
|
||||
|
|
|
@ -23,6 +23,7 @@ from networking_l2gw.services.l2gateway.common import constants
|
|||
from networking_l2gw.services.l2gateway import service_drivers
|
||||
from networking_odl.common import constants as odl_const
|
||||
from networking_odl.common import postcommit
|
||||
from networking_odl.journal import full_sync
|
||||
from networking_odl.journal import journal
|
||||
|
||||
|
||||
|
@ -30,6 +31,11 @@ cfg.CONF.import_group('ml2_odl', 'networking_odl.common.config')
|
|||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
L2GW_RESOURCES = {
|
||||
odl_const.ODL_L2GATEWAY: odl_const.ODL_L2GATEWAYS,
|
||||
odl_const.ODL_L2GATEWAY_CONNECTION: odl_const.ODL_L2GATEWAY_CONNECTIONS
|
||||
}
|
||||
|
||||
|
||||
@postcommit.add_postcommit('l2_gateway', 'l2_gateway_connection')
|
||||
class OpenDaylightL2gwDriver(service_drivers.L2gwDriver):
|
||||
|
@ -43,6 +49,7 @@ class OpenDaylightL2gwDriver(service_drivers.L2gwDriver):
|
|||
super(OpenDaylightL2gwDriver, self).__init__(service_plugin, validator)
|
||||
self.service_plugin = service_plugin
|
||||
self.journal = journal.OpenDaylightJournalThread()
|
||||
full_sync.register(constants.L2GW, L2GW_RESOURCES)
|
||||
LOG.info("ODL: Started OpenDaylight L2Gateway V2 driver")
|
||||
|
||||
@property
|
||||
|
|
|
@ -27,10 +27,16 @@ from neutron_lib.plugins import constants as plugin_constants
|
|||
|
||||
from networking_odl.common import config # noqa
|
||||
from networking_odl.common import constants as odl_const
|
||||
from networking_odl.journal import full_sync
|
||||
from networking_odl.journal import journal
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
L3_RESOURCES = {
|
||||
odl_const.ODL_ROUTER: odl_const.ODL_ROUTERS,
|
||||
odl_const.ODL_FLOATINGIP: odl_const.ODL_FLOATINGIPS
|
||||
}
|
||||
|
||||
|
||||
class OpenDaylightL3RouterPlugin(
|
||||
common_db_mixin.CommonDbMixin,
|
||||
|
@ -54,6 +60,7 @@ class OpenDaylightL3RouterPlugin(
|
|||
# TODO(rcurran): Continue investigation into how many journal threads
|
||||
# to run per neutron controller deployment.
|
||||
self.journal = journal.OpenDaylightJournalThread()
|
||||
full_sync.register(plugin_constants.L3, L3_RESOURCES)
|
||||
|
||||
def get_plugin_type(self):
|
||||
return plugin_constants.L3
|
||||
|
|
|
@ -19,13 +19,23 @@ from oslo_log import helpers as log_helpers
|
|||
from oslo_log import log as logging
|
||||
|
||||
from neutron_lbaas.drivers import driver_base
|
||||
from neutron_lib.plugins import constants as nlib_const
|
||||
|
||||
from networking_odl.common import constants as odl_const
|
||||
from networking_odl.journal import full_sync
|
||||
from networking_odl.journal import journal
|
||||
|
||||
cfg.CONF.import_group('ml2_odl', 'networking_odl.common.config')
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
LBAAS_RESOURCES = {
|
||||
odl_const.ODL_LOADBALANCER: odl_const.ODL_LOADBALANCERS,
|
||||
odl_const.ODL_LISTENER: odl_const.ODL_LISTENERS,
|
||||
odl_const.ODL_POOL: odl_const.ODL_POOLS,
|
||||
odl_const.ODL_MEMBER: odl_const.ODL_MEMBERS,
|
||||
odl_const.ODL_HEALTHMONITOR: odl_const.ODL_HEALTHMONITORS
|
||||
}
|
||||
|
||||
|
||||
class OpenDaylightManager(driver_base.LoadBalancerBaseDriver):
|
||||
"""OpenDaylight LBaaS Driver for the V2 API
|
||||
|
@ -40,6 +50,7 @@ class OpenDaylightManager(driver_base.LoadBalancerBaseDriver):
|
|||
super(OpenDaylightManager, self).__init__(driver)
|
||||
self.journal = journal.OpenDaylightJournalThread()
|
||||
self.obj_type = obj_type
|
||||
full_sync.register(nlib_const.LOADBALANCERV2, LBAAS_RESOURCES)
|
||||
|
||||
def _journal_record(self, context, obj_type, obj_id, operation, obj):
|
||||
obj_type = ("lbaas/%s" % obj_type)
|
||||
|
|
|
@ -20,6 +20,7 @@ from oslo_log import log as logging
|
|||
from neutron.extensions import multiprovidernet as mpnet
|
||||
from neutron_lib.api.definitions import provider_net as providernet
|
||||
from neutron_lib import constants as p_const
|
||||
from neutron_lib.plugins import constants as nlib_const
|
||||
from neutron_lib.plugins.ml2 import api
|
||||
|
||||
from networking_odl.common import callback
|
||||
|
@ -39,6 +40,14 @@ from networking_odl.trunk import trunk_driver_v2 as trunk_driver
|
|||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
L2_RESOURCES = {
|
||||
odl_const.ODL_SG: odl_const.ODL_SGS,
|
||||
odl_const.ODL_SG_RULE: odl_const.ODL_SG_RULES,
|
||||
odl_const.ODL_NETWORK: odl_const.ODL_NETWORKS,
|
||||
odl_const.ODL_SUBNET: odl_const.ODL_SUBNETS,
|
||||
odl_const.ODL_PORT: odl_const.ODL_PORTS
|
||||
}
|
||||
|
||||
|
||||
@postcommit.add_postcommit('network', 'subnet', 'port')
|
||||
class OpenDaylightMechanismDriver(api.MechanismDriver):
|
||||
|
@ -60,6 +69,7 @@ class OpenDaylightMechanismDriver(api.MechanismDriver):
|
|||
if odl_const.ODL_QOS in cfg.CONF.ml2.extension_drivers:
|
||||
qos_driver.OpenDaylightQosDriver.create()
|
||||
self._start_maintenance_thread()
|
||||
full_sync.register(nlib_const.CORE, L2_RESOURCES)
|
||||
odl_features.init()
|
||||
|
||||
def get_workers(self):
|
||||
|
|
|
@ -16,10 +16,12 @@ from neutron.common import constants as n_consts
|
|||
from neutron.services.qos.drivers import base
|
||||
from neutron.services.qos import qos_consts
|
||||
from neutron_lib.api.definitions import portbindings
|
||||
from neutron_lib.plugins import constants as nlib_const
|
||||
from oslo_log import helpers as log_helpers
|
||||
from oslo_log import log as logging
|
||||
|
||||
from networking_odl.common import constants as odl_const
|
||||
from networking_odl.journal import full_sync
|
||||
from networking_odl.journal import journal
|
||||
from networking_odl.qos import qos_utils
|
||||
|
||||
|
@ -40,6 +42,10 @@ SUPPORTED_RULES = {
|
|||
VIF_TYPES = [portbindings.VIF_TYPE_OVS, portbindings.VIF_TYPE_VHOST_USER]
|
||||
VNIC_TYPES = [portbindings.VNIC_NORMAL]
|
||||
|
||||
QOS_RESOURCES = {
|
||||
odl_const.ODL_QOS_POLICY: odl_const.ODL_QOS_POLICIES
|
||||
}
|
||||
|
||||
|
||||
class OpenDaylightQosDriver(base.DriverBase):
|
||||
|
||||
|
@ -63,6 +69,7 @@ class OpenDaylightQosDriver(base.DriverBase):
|
|||
requires_rpc_notifications)
|
||||
LOG.debug("Initializing OpenDaylight Qos driver")
|
||||
self.journal = journal.OpenDaylightJournalThread()
|
||||
full_sync.register(nlib_const.QOS, QOS_RESOURCES)
|
||||
|
||||
def _record_in_journal(self, context, op_const, qos_policy):
|
||||
data = qos_utils.convert_rules_format(qos_policy.to_dict())
|
||||
|
|
|
@ -16,14 +16,20 @@
|
|||
from oslo_log import helpers as log_helpers
|
||||
from oslo_log import log as logging
|
||||
|
||||
from networking_sfc.extensions import flowclassifier as fc_const
|
||||
from networking_sfc.services.flowclassifier.drivers import base as fc_driver
|
||||
|
||||
from networking_odl.common import constants as odl_const
|
||||
from networking_odl.common import postcommit
|
||||
from networking_odl.journal import full_sync
|
||||
from networking_odl.journal import journal
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
SFC_FC_RESOURCES = {
|
||||
odl_const.ODL_SFC_FLOW_CLASSIFIER: odl_const.ODL_SFC_FLOW_CLASSIFIERS,
|
||||
}
|
||||
|
||||
|
||||
@postcommit.add_postcommit('flow_classifier')
|
||||
class OpenDaylightSFCFlowClassifierDriverV2(
|
||||
|
@ -40,6 +46,7 @@ class OpenDaylightSFCFlowClassifierDriverV2(
|
|||
LOG.debug("Initializing OpenDaylight Networking "
|
||||
"SFC Flow Classifier driver Version 2")
|
||||
self.journal = journal.OpenDaylightJournalThread()
|
||||
full_sync.register(fc_const.FLOW_CLASSIFIER_EXT, SFC_FC_RESOURCES)
|
||||
|
||||
@staticmethod
|
||||
def _record_in_journal(context, object_type, operation, data=None):
|
||||
|
|
|
@ -16,14 +16,22 @@
|
|||
from oslo_log import helpers as log_helpers
|
||||
from oslo_log import log as logging
|
||||
|
||||
from networking_sfc.extensions import sfc as sfc_const
|
||||
from networking_sfc.services.sfc.drivers import base as sfc_driver
|
||||
|
||||
from networking_odl.common import constants as odl_const
|
||||
from networking_odl.common import postcommit
|
||||
from networking_odl.journal import full_sync
|
||||
from networking_odl.journal import journal
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
SFC_RESOURCES = {
|
||||
odl_const.ODL_SFC_PORT_PAIR: odl_const.ODL_SFC_PORT_PAIRS,
|
||||
odl_const.ODL_SFC_PORT_PAIR_GROUP: odl_const.ODL_SFC_PORT_PAIR_GROUPS,
|
||||
odl_const.ODL_SFC_PORT_CHAIN: odl_const.ODL_SFC_PORT_CHAINS
|
||||
}
|
||||
|
||||
|
||||
@postcommit.add_postcommit('port_pair', 'port_pair_group', 'port_chain')
|
||||
class OpenDaylightSFCDriverV2(sfc_driver.SfcDriverBase):
|
||||
|
@ -38,6 +46,7 @@ class OpenDaylightSFCDriverV2(sfc_driver.SfcDriverBase):
|
|||
def initialize(self):
|
||||
LOG.debug("Initializing OpenDaylight Networking SFC driver(Version 2)")
|
||||
self.journal = journal.OpenDaylightJournalThread()
|
||||
full_sync.register(sfc_const.SFC_EXT, SFC_RESOURCES)
|
||||
|
||||
@staticmethod
|
||||
def _record_in_journal(context, object_type, operation, data=None):
|
||||
|
|
|
@ -17,15 +17,29 @@
|
|||
import mock
|
||||
import requests
|
||||
|
||||
from networking_l2gw.services.l2gateway.common import constants as l2gw_const
|
||||
from networking_sfc.extensions import flowclassifier as fc_const
|
||||
from networking_sfc.extensions import sfc as sfc_const
|
||||
from neutron.services.trunk import constants as t_consts
|
||||
from neutron_lib.api.definitions import bgpvpn as bgpvpn_const
|
||||
from neutron_lib.plugins import constants
|
||||
from neutron_lib.plugins import directory
|
||||
|
||||
from networking_odl.bgpvpn import odl_v2 as bgpvpn_driver
|
||||
from networking_odl.common import constants as odl_const
|
||||
from networking_odl.db import db
|
||||
from networking_odl.journal import full_sync
|
||||
from networking_odl.journal import journal
|
||||
from networking_odl.l2gateway import driver_v2 as l2gw_driver
|
||||
from networking_odl.l3 import l3_odl_v2
|
||||
from networking_odl.lbaas import lbaasv2_driver_v2 as lbaas_driver
|
||||
from networking_odl.ml2 import mech_driver_v2
|
||||
from networking_odl.qos import qos_driver_v2 as qos_driver
|
||||
from networking_odl.sfc.flowclassifier import sfc_flowclassifier_v2
|
||||
from networking_odl.sfc import sfc_driver_v2 as sfc_driver
|
||||
from networking_odl.tests import base
|
||||
from networking_odl.tests.unit import test_base_db
|
||||
from networking_odl.trunk import trunk_driver_v2 as trunk_driver
|
||||
|
||||
|
||||
class FullSyncTestCase(test_base_db.ODLBaseDbTestCase):
|
||||
|
@ -35,10 +49,36 @@ class FullSyncTestCase(test_base_db.ODLBaseDbTestCase):
|
|||
self.useFixture(
|
||||
base.OpenDaylightRestClientGlobalFixture(full_sync._CLIENT))
|
||||
self._CLIENT = full_sync._CLIENT.get_client()
|
||||
self.plugin = mock.MagicMock()
|
||||
self.l3_plugin = mock.MagicMock()
|
||||
directory.add_plugin(constants.CORE, self.plugin)
|
||||
directory.add_plugin(constants.L3, self.l3_plugin)
|
||||
|
||||
for plugin_name in self._get_all_resources():
|
||||
mocked = mock.MagicMock()
|
||||
if plugin_name == constants.CORE:
|
||||
self.plugin = mocked
|
||||
elif plugin_name == constants.L3:
|
||||
self.l3_plugin = mocked
|
||||
|
||||
directory.add_plugin(plugin_name, mocked)
|
||||
|
||||
self.addCleanup(self.clean_registered_resources)
|
||||
|
||||
@staticmethod
|
||||
def _get_all_resources():
|
||||
return {
|
||||
constants.L3: l3_odl_v2.L3_RESOURCES,
|
||||
constants.CORE: mech_driver_v2.L2_RESOURCES,
|
||||
constants.LOADBALANCERV2: lbaas_driver.LBAAS_RESOURCES,
|
||||
t_consts.TRUNK: trunk_driver.TRUNK_RESOURCES,
|
||||
constants.QOS: qos_driver.QOS_RESOURCES,
|
||||
sfc_const.SFC_EXT: sfc_driver.SFC_RESOURCES,
|
||||
bgpvpn_const.LABEL: bgpvpn_driver.BGPVPN_RESOURCES,
|
||||
fc_const.FLOW_CLASSIFIER_EXT:
|
||||
sfc_flowclassifier_v2.SFC_FC_RESOURCES,
|
||||
l2gw_const.L2GW: l2gw_driver.L2GW_RESOURCES,
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def clean_registered_resources():
|
||||
full_sync.ALL_RESOURCES = {}
|
||||
|
||||
def test_no_full_sync_when_canary_exists(self):
|
||||
full_sync.full_sync(self.db_session)
|
||||
|
@ -89,6 +129,8 @@ class FullSyncTestCase(test_base_db.ODLBaseDbTestCase):
|
|||
def test_sync_resource_order(
|
||||
self, record_mock, _sync_resources_mock, _full_sync_needed_mock,
|
||||
delete_pending_rows_mock):
|
||||
|
||||
full_sync.ALL_RESOURCES = self._get_all_resources()
|
||||
_full_sync_needed_mock._full_sync_needed.return_value = True
|
||||
session = mock.MagicMock()
|
||||
full_sync.full_sync(session)
|
||||
|
@ -103,7 +145,31 @@ class FullSyncTestCase(test_base_db.ODLBaseDbTestCase):
|
|||
(odl_const.ODL_SUBNET, odl_const.ODL_SUBNETS),
|
||||
(odl_const.ODL_ROUTER, odl_const.ODL_ROUTERS),
|
||||
(odl_const.ODL_PORT, odl_const.ODL_PORTS),
|
||||
(odl_const.ODL_FLOATINGIP, odl_const.ODL_FLOATINGIPS)]])
|
||||
(odl_const.ODL_FLOATINGIP, odl_const.ODL_FLOATINGIPS),
|
||||
(odl_const.ODL_LOADBALANCER, odl_const.ODL_LOADBALANCERS),
|
||||
(odl_const.ODL_LISTENER, odl_const.ODL_LISTENERS),
|
||||
(odl_const.ODL_POOL, odl_const.ODL_POOLS),
|
||||
(odl_const.ODL_MEMBER, odl_const.ODL_MEMBERS),
|
||||
(odl_const.ODL_HEALTHMONITOR,
|
||||
odl_const.ODL_HEALTHMONITORS),
|
||||
(odl_const.ODL_QOS_POLICY, odl_const.ODL_QOS_POLICIES),
|
||||
(odl_const.ODL_TRUNK, odl_const.ODL_TRUNKS),
|
||||
(odl_const.ODL_BGPVPN, odl_const.ODL_BGPVPNS),
|
||||
(odl_const.ODL_BGPVPN_NETWORK_ASSOCIATION,
|
||||
odl_const.ODL_BGPVPN_NETWORK_ASSOCIATIONS),
|
||||
(odl_const.ODL_BGPVPN_ROUTER_ASSOCIATION,
|
||||
odl_const.ODL_BGPVPN_ROUTER_ASSOCIATIONS),
|
||||
(odl_const.ODL_SFC_FLOW_CLASSIFIER,
|
||||
odl_const.ODL_SFC_FLOW_CLASSIFIERS),
|
||||
(odl_const.ODL_SFC_PORT_PAIR,
|
||||
odl_const.ODL_SFC_PORT_PAIRS),
|
||||
(odl_const.ODL_SFC_PORT_PAIR_GROUP,
|
||||
odl_const.ODL_SFC_PORT_PAIR_GROUPS),
|
||||
(odl_const.ODL_SFC_PORT_CHAIN,
|
||||
odl_const.ODL_SFC_PORT_CHAINS),
|
||||
(odl_const.ODL_L2GATEWAY, odl_const.ODL_L2GATEWAYS),
|
||||
(odl_const.ODL_L2GATEWAY_CONNECTION,
|
||||
odl_const.ODL_L2GATEWAY_CONNECTIONS)]])
|
||||
|
||||
def test_client_error_propagates(self):
|
||||
class TestException(Exception):
|
||||
|
@ -146,6 +212,7 @@ class FullSyncTestCase(test_base_db.ODLBaseDbTestCase):
|
|||
self._test_full_sync_resources({})
|
||||
|
||||
def test_full_sync_l2_resources(self):
|
||||
full_sync.ALL_RESOURCES = {constants.CORE: mech_driver_v2.L2_RESOURCES}
|
||||
self._test_full_sync_resources(self._mock_l2_resources())
|
||||
|
||||
def _mock_router_port(self, port_id):
|
||||
|
@ -166,4 +233,5 @@ class FullSyncTestCase(test_base_db.ODLBaseDbTestCase):
|
|||
return expected_journal
|
||||
|
||||
def test_full_sync_l3_resources(self):
|
||||
full_sync.ALL_RESOURCES = {constants.L3: l3_odl_v2.L3_RESOURCES}
|
||||
self._test_full_sync_resources(self._mock_l3_resources())
|
||||
|
|
|
@ -25,6 +25,8 @@ from networking_odl.common import constants as odl_const
|
|||
from networking_odl.db import db
|
||||
from networking_odl.db import models
|
||||
from networking_odl.journal import recovery
|
||||
from networking_odl.l3 import l3_odl_v2
|
||||
from networking_odl.ml2 import mech_driver_v2
|
||||
from networking_odl.tests import base
|
||||
|
||||
|
||||
|
@ -60,13 +62,13 @@ class RecoveryTestCase(SqlTestCaseLight):
|
|||
|
||||
@mock.patch.object(directory, 'get_plugin')
|
||||
def test__get_latest_resource_l2(self, plugin_mock):
|
||||
for resource_type in odl_const.L2_RESOURCES:
|
||||
for resource_type in mech_driver_v2.L2_RESOURCES:
|
||||
plugin = plugin_mock.return_value
|
||||
self._test__get_latest_resource(plugin, resource_type)
|
||||
|
||||
@mock.patch.object(directory, 'get_plugin')
|
||||
def test__get_latest_resource_l3(self, plugin_mock):
|
||||
for resource_type in odl_const.L3_RESOURCES:
|
||||
for resource_type in l3_odl_v2.L3_RESOURCES:
|
||||
plugin = plugin_mock.return_value
|
||||
self._test__get_latest_resource(plugin, resource_type)
|
||||
|
||||
|
|
|
@ -25,17 +25,23 @@ from neutron.services.trunk.drivers import base as trunk_base
|
|||
|
||||
from networking_odl.common import config as odl_conf
|
||||
from networking_odl.common import constants as odl_const
|
||||
from networking_odl.journal import full_sync
|
||||
from networking_odl.journal import journal
|
||||
from networking_odl.trunk import constants as odltrunk_const
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
TRUNK_RESOURCES = {
|
||||
odl_const.ODL_TRUNK: odl_const.ODL_TRUNKS
|
||||
}
|
||||
|
||||
|
||||
@registry.has_registry_receivers
|
||||
class OpenDaylightTrunkHandlerV2(object):
|
||||
def __init__(self):
|
||||
cfg.CONF.register_opts(odl_conf.odl_opts, "ml2_odl")
|
||||
self.journal = journal.OpenDaylightJournalThread()
|
||||
full_sync.register(t_consts.TRUNK, TRUNK_RESOURCES)
|
||||
LOG.info('initialized trunk driver for OpendayLight')
|
||||
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in New Issue