Final decomposition of opendaylight driver
It's all in networking-odl now. Closes-Bug: #1514823 Depends-On: Ibc6fa46b9bae73c045bec71894ebe3cad570edcc Change-Id: I76ae1a5078e4a47ee901150d4832f06c1d1ab093
This commit is contained in:
parent
31f4c878cd
commit
a29fe4a30a
@ -1,46 +0,0 @@
|
||||
OpenDaylight ML2 MechanismDriver
|
||||
================================
|
||||
OpenDaylight is an Open Source SDN Controller developed by a plethora of
|
||||
companies and hosted by the Linux Foundation. The OpenDaylight website
|
||||
contains more information on the capabilities OpenDaylight provides:
|
||||
|
||||
http://www.opendaylight.org
|
||||
|
||||
The networking-odl project provides a thin layer sitting between this
|
||||
driver and OpenDaylight. The code can be downloaded from:
|
||||
|
||||
https://git.openstack.org/cgit/openstack/networking-odl
|
||||
|
||||
Theory of operation
|
||||
===================
|
||||
The OpenStack Neutron integration with OpenDaylight consists of the ML2
|
||||
MechanismDriver which acts as a REST proxy and passes all Neutron API
|
||||
calls into OpenDaylight. OpenDaylight contains a NB REST service (called
|
||||
the NeutronAPIService) which caches data from these proxied API calls and
|
||||
makes it available to other services inside of OpenDaylight. One current
|
||||
user of the SB side of the NeutronAPIService is the OVSDB code in
|
||||
OpenDaylight. OVSDB uses the neutron information to isolate tenant networks
|
||||
using GRE or VXLAN tunnels.
|
||||
|
||||
How to use the OpenDaylight ML2 MechanismDriver
|
||||
===============================================
|
||||
To use the ML2 MechanismDriver, you need to ensure you have it configured
|
||||
as one of the "mechanism_drivers" in ML2:
|
||||
|
||||
mechanism_drivers=opendaylight
|
||||
|
||||
The next step is to setup the "[ml2_odl]" section in either the ml2_conf.ini
|
||||
file or in a separate ml2_conf_odl.ini file. An example is shown below:
|
||||
|
||||
[ml2_odl]
|
||||
password = admin
|
||||
username = admin
|
||||
url = http://192.168.100.1:8080/controller/nb/v2/neutron
|
||||
|
||||
When starting OpenDaylight, ensure you have the SimpleForwarding application
|
||||
disabled or remove the .jar file from the plugins directory. Also ensure you
|
||||
start OpenDaylight before you start OpenStack Neutron.
|
||||
|
||||
There is devstack support for this which will automatically pull down OpenDaylight
|
||||
and start it as part of devstack as well. The patch for this will likely merge
|
||||
around the same time as this patch merges.
|
@ -1,92 +0,0 @@
|
||||
# Copyright (c) 2013-2014 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.
|
||||
|
||||
from networking_odl.common import constants as odl_const
|
||||
from networking_odl.ml2 import mech_driver
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
|
||||
from neutron.plugins.ml2 import driver_api as api
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
odl_opts = [
|
||||
cfg.StrOpt('url',
|
||||
help=_("HTTP URL of OpenDaylight REST interface.")),
|
||||
cfg.StrOpt('username',
|
||||
help=_("HTTP username for authentication")),
|
||||
cfg.StrOpt('password', secret=True,
|
||||
help=_("HTTP password for authentication")),
|
||||
cfg.IntOpt('timeout', default=10,
|
||||
help=_("HTTP timeout in seconds.")),
|
||||
cfg.IntOpt('session_timeout', default=30,
|
||||
help=_("Tomcat session timeout in minutes.")),
|
||||
]
|
||||
|
||||
cfg.CONF.register_opts(odl_opts, "ml2_odl")
|
||||
|
||||
|
||||
class OpenDaylightMechanismDriver(api.MechanismDriver):
|
||||
|
||||
"""Mechanism Driver for OpenDaylight.
|
||||
|
||||
This driver was a port from the NCS MechanismDriver. The API
|
||||
exposed by ODL is slightly different from the API exposed by NCS,
|
||||
but the general concepts are the same.
|
||||
"""
|
||||
|
||||
def initialize(self):
|
||||
self.url = cfg.CONF.ml2_odl.url
|
||||
self.timeout = cfg.CONF.ml2_odl.timeout
|
||||
self.username = cfg.CONF.ml2_odl.username
|
||||
self.password = cfg.CONF.ml2_odl.password
|
||||
required_opts = ('url', 'username', 'password')
|
||||
for opt in required_opts:
|
||||
if not getattr(self, opt):
|
||||
raise cfg.RequiredOptError(opt, 'ml2_odl')
|
||||
|
||||
self.odl_drv = mech_driver.OpenDaylightDriver()
|
||||
|
||||
# Postcommit hooks are used to trigger synchronization.
|
||||
|
||||
def create_network_postcommit(self, context):
|
||||
self.odl_drv.synchronize('create', odl_const.ODL_NETWORKS, context)
|
||||
|
||||
def update_network_postcommit(self, context):
|
||||
self.odl_drv.synchronize('update', odl_const.ODL_NETWORKS, context)
|
||||
|
||||
def delete_network_postcommit(self, context):
|
||||
self.odl_drv.synchronize('delete', odl_const.ODL_NETWORKS, context)
|
||||
|
||||
def create_subnet_postcommit(self, context):
|
||||
self.odl_drv.synchronize('create', odl_const.ODL_SUBNETS, context)
|
||||
|
||||
def update_subnet_postcommit(self, context):
|
||||
self.odl_drv.synchronize('update', odl_const.ODL_SUBNETS, context)
|
||||
|
||||
def delete_subnet_postcommit(self, context):
|
||||
self.odl_drv.synchronize('delete', odl_const.ODL_SUBNETS, context)
|
||||
|
||||
def create_port_postcommit(self, context):
|
||||
self.odl_drv.synchronize('create', odl_const.ODL_PORTS, context)
|
||||
|
||||
def update_port_postcommit(self, context):
|
||||
self.odl_drv.synchronize('update', odl_const.ODL_PORTS, context)
|
||||
|
||||
def delete_port_postcommit(self, context):
|
||||
self.odl_drv.synchronize('delete', odl_const.ODL_PORTS, context)
|
||||
|
||||
def bind_port(self, context):
|
||||
self.odl_drv.bind_port(context)
|
@ -1 +0,0 @@
|
||||
networking-odl
|
@ -1,106 +0,0 @@
|
||||
# Copyright (c) 2013-2015 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 sys
|
||||
|
||||
import mock
|
||||
from neutron import context
|
||||
from neutron.tests.unit.plugins.ml2 import test_plugin
|
||||
|
||||
|
||||
with mock.patch.dict(sys.modules,
|
||||
{'networking_odl': mock.Mock(),
|
||||
'networking_odl.common': mock.Mock(),
|
||||
'networking_odl.ml2': mock.Mock()}):
|
||||
from networking_odl.common import constants as const
|
||||
from neutron.plugins.ml2.drivers.opendaylight import driver
|
||||
|
||||
|
||||
class TestODLShim(test_plugin.Ml2PluginV2TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestODLShim, self).setUp()
|
||||
self.context = context.get_admin_context()
|
||||
self.plugin = mock.Mock()
|
||||
self.driver = driver.OpenDaylightMechanismDriver()
|
||||
self.driver.odl_drv = mock.Mock()
|
||||
|
||||
def test_create_network_postcommit(self):
|
||||
self.driver.create_network_postcommit(self.context)
|
||||
self.driver.odl_drv.synchronize.assert_called_with('create',
|
||||
const.ODL_NETWORKS,
|
||||
self.context)
|
||||
|
||||
def test_update_network_postcommit(self):
|
||||
self.driver.update_network_postcommit(self.context)
|
||||
self.driver.odl_drv.synchronize.assert_called_with('update',
|
||||
const.ODL_NETWORKS,
|
||||
self.context)
|
||||
|
||||
def test_delete_network_postcommit(self):
|
||||
self.driver.delete_network_postcommit(self.context)
|
||||
self.driver.odl_drv.synchronize.assert_called_with('delete',
|
||||
const.ODL_NETWORKS,
|
||||
self.context)
|
||||
|
||||
def test_create_subnet_postcommit(self):
|
||||
self.driver.create_subnet_postcommit(self.context)
|
||||
self.driver.odl_drv.synchronize.assert_called_with('create',
|
||||
const.ODL_SUBNETS,
|
||||
self.context)
|
||||
|
||||
def test_update_subnet_postcommit(self):
|
||||
self.driver.update_subnet_postcommit(self.context)
|
||||
self.driver.odl_drv.synchronize.assert_called_with('update',
|
||||
const.ODL_SUBNETS,
|
||||
self.context)
|
||||
|
||||
def test_delete_subnet_postcommit(self):
|
||||
self.driver.delete_subnet_postcommit(self.context)
|
||||
self.driver.odl_drv.synchronize.assert_called_with('delete',
|
||||
const.ODL_SUBNETS,
|
||||
self.context)
|
||||
|
||||
def test_create_port_postcommit(self):
|
||||
self.driver.create_port_postcommit(self.context)
|
||||
self.driver.odl_drv.synchronize.assert_called_with('create',
|
||||
const.ODL_PORTS,
|
||||
self.context)
|
||||
|
||||
def test_update_port_postcommit(self):
|
||||
self.driver.update_port_postcommit(self.context)
|
||||
self.driver.odl_drv.synchronize.assert_called_with('update',
|
||||
const.ODL_PORTS,
|
||||
self.context)
|
||||
|
||||
def test_delete_port_postcommit(self):
|
||||
self.driver.delete_port_postcommit(self.context)
|
||||
self.driver.odl_drv.synchronize.assert_called_with('delete',
|
||||
const.ODL_PORTS,
|
||||
self.context)
|
||||
|
||||
def test_bind_port_delegation(self):
|
||||
# given front-end with attached back-end
|
||||
front_end = self.driver
|
||||
front_end.odl_drv = back_end = mock.MagicMock(
|
||||
spec=driver.OpenDaylightMechanismDriver)
|
||||
# given PortContext to be forwarded to back-end without using
|
||||
context = object()
|
||||
|
||||
# when binding port
|
||||
front_end.bind_port(context)
|
||||
|
||||
# then port is bound by back-end
|
||||
back_end.bind_port.assert_called_once_with(context)
|
@ -126,7 +126,6 @@ neutron.ml2.type_drivers =
|
||||
gre = neutron.plugins.ml2.drivers.type_gre:GreTypeDriver
|
||||
vxlan = neutron.plugins.ml2.drivers.type_vxlan:VxlanTypeDriver
|
||||
neutron.ml2.mechanism_drivers =
|
||||
opendaylight = neutron.plugins.ml2.drivers.opendaylight.driver:OpenDaylightMechanismDriver
|
||||
logger = neutron.tests.unit.plugins.ml2.drivers.mechanism_logger:LoggerMechanismDriver
|
||||
test = neutron.tests.unit.plugins.ml2.drivers.mechanism_test:TestMechanismDriver
|
||||
linuxbridge = neutron.plugins.ml2.drivers.linuxbridge.mech_driver.mech_linuxbridge:LinuxbridgeMechanismDriver
|
||||
|
Loading…
Reference in New Issue
Block a user