Add an interface and config options for modular switch

Add the an interface (base class) for modular switch.
Also add the relevant configuration options.

Change-Id: I79675aa720cf60ae599b13188b85ae26ea6d2a84
This commit is contained in:
Shachar Snapiri 2018-07-10 14:20:29 +03:00
parent 5ce7e25d15
commit 0170177854
5 changed files with 55 additions and 0 deletions

View File

@ -32,6 +32,7 @@ from dragonflow import version
DF_PUBSUB_DRIVER_NAMESPACE = 'dragonflow.pubsub_driver'
DF_NB_DB_DRIVER_NAMESPACE = 'dragonflow.nb_db_driver'
DF_NEUTRON_NOTIFIER_DRIVER_NAMESPACE = 'dragonflow.neutron_notifier_driver'
DF_SWITCH_BACKEND_DRIVER_NAMESPACE = 'dragonflow.switch_backend_driver'
LOG = logging.getLogger(__name__)

View File

@ -69,6 +69,9 @@ df_opts = [
cfg.StrOpt('neutron_notifier',
default='nb_api_neutron_notifier_driver',
help=_('Notifier for the Dragonflow controller events')),
cfg.StrOpt('switch_backend',
default='vswitch_backend_driver',
help=_('Backend switch drivers to use')),
cfg.ListOpt('publishers_ips',
default=['$local_ip'],
help=_('List of the Neutron Server Publisher IPs.')),

View File

View File

View File

@ -0,0 +1,51 @@
# Copyright (c) 2018 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import abc
import six
@six.add_metaclass(abc.ABCMeta)
class DfSwitchDriver(object):
def __init__(self, nb_api):
super(DfSwitchDriver, self).__init__()
self.db_change_callback = None
self.nb_api = nb_api
def initialize(self, db_change_callback):
self.db_change_callback = db_change_callback
@abc.abstractmethod
def start(self):
"""Start running the switch backend"""
@abc.abstractmethod
def stop(self):
"""Stop the switch backend"""
@abc.abstractmethod
def switch_sync_started(self):
"""Callback on switch sync start"""
@abc.abstractmethod
def switch_sync_finished(self):
"""Callback on switch sync done"""
def sync_ignore_models(self):
"""Which models to ignore on sync
:returns list of model names
"""
return []