Merge "Decompose ML2 mechanism driver for Mellanox"

This commit is contained in:
Jenkins 2015-11-02 09:03:10 +00:00 committed by Gerrit Code Review
commit 6f4ba78a8a
12 changed files with 0 additions and 332 deletions

View File

@ -1,31 +0,0 @@
[eswitch]
# (ListOpt) Comma-separated list of
# <physical_network>:<physical_interface> tuples mapping physical
# network names to the agent's node-specific physical network
# interfaces to be used for flat and VLAN networks. All physical
# networks listed in network_vlan_ranges on the server should have
# mappings to appropriate interfaces on each agent.
#
# physical_interface_mappings =
# Example: physical_interface_mappings = default:eth2
# (StrOpt) Eswitch daemon end point connection url
# daemon_endpoint = 'tcp://127.0.0.1:60001'
# The number of milliseconds the agent will wait for
# response on request to daemon
# request_timeout = 3000
# The number of retries the agent will send request
# to daemon before giving up
# retries = 3
# The backoff rate multiplier for waiting period between retries
# on request to daemon, i.e. value of 2 will double
# the request timeout each retry
# backoff_rate = 2
[agent]
# Agent's polling interval in seconds
# polling_interval = 2

View File

@ -1,19 +0,0 @@
# Copyright 2015 Mellanox Technologies, Ltd
#
# 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 neutron.plugins.ml2.drivers.mlnx.agent import eswitch_neutron_agent
def main():
eswitch_neutron_agent.main()

View File

@ -1,4 +0,0 @@
The Neutron Mellanox plugin has been removed from the tree in Kilo.
This directory includes Mellanox L2 agent for MLNX mechanism driver.
For more details, please refer to the following link:
https://wiki.openstack.org/wiki/Mellanox-Neutron-ML2

View File

@ -1,50 +0,0 @@
# Copyright 2013 Mellanox Technologies, Ltd
#
# 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 oslo_config import cfg
from neutron.agent.common import config
DEFAULT_INTERFACE_MAPPINGS = []
eswitch_opts = [
cfg.ListOpt('physical_interface_mappings',
default=DEFAULT_INTERFACE_MAPPINGS,
help=_("List of <physical_network>:<physical_interface>")),
cfg.StrOpt('daemon_endpoint',
default='tcp://127.0.0.1:60001',
help=_('eswitch daemon end point')),
cfg.IntOpt('request_timeout', default=3000,
help=_("The number of milliseconds the agent will wait for "
"response on request to daemon.")),
cfg.IntOpt('retries', default=3,
help=_("The number of retries the agent will send request "
"to daemon before giving up")),
cfg.IntOpt('backoff_rate', default=2,
help=_("backoff rate multiplier for waiting period between "
"retries for request to daemon, i.e. value of 2 will "
" double the request timeout each retry")),
]
agent_opts = [
cfg.IntOpt('polling_interval', default=2,
help=_("The number of seconds the agent will wait between "
"polling for local device changes.")),
]
cfg.CONF.register_opts(eswitch_opts, "ESWITCH")
cfg.CONF.register_opts(agent_opts, "AGENT")
config.register_agent_state_opts_helper(cfg.CONF)

View File

@ -1,60 +0,0 @@
# Copyright 2013 Mellanox Technologies, Ltd
#
# 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
from networking_mlnx.plugins.ml2.drivers.mlnx.agent import (
mlnx_eswitch_neutron_agent)
from oslo_config import cfg
from oslo_log import log as logging
from neutron.i18n import _LE, _LI
from neutron.common import config as common_config
from neutron.common import utils
from neutron.plugins.ml2.drivers.mlnx.agent import config # noqa
LOG = logging.getLogger(__name__)
def main():
common_config.init(sys.argv[1:])
common_config.setup_logging()
try:
interface_mappings = utils.parse_mappings(
cfg.CONF.ESWITCH.physical_interface_mappings)
except ValueError as e:
LOG.error(_LE("Parsing physical_interface_mappings failed: %s. "
"Agent terminated!"), e)
sys.exit(1)
LOG.info(_LI("Interface mappings: %s"), interface_mappings)
try:
agent = mlnx_eswitch_neutron_agent.MlnxEswitchNeutronAgent(
interface_mappings)
except Exception as e:
LOG.error(_LE("Failed on Agent initialisation : %s. "
"Agent terminated!"), e)
sys.exit(1)
# Start everything.
LOG.info(_LI("Agent initialised successfully, now running... "))
agent.run()
sys.exit(0)
if __name__ == '__main__':
main()

View File

@ -1,61 +0,0 @@
# Copyright (c) 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 oslo_log import log
from neutron.extensions import portbindings
from neutron.plugins.common import constants as p_constants
from neutron.plugins.ml2 import driver_api as api
from neutron.plugins.ml2.drivers import mech_agent
LOG = log.getLogger(__name__)
AGENT_TYPE_MLNX = 'Mellanox plugin agent'
VIF_TYPE_IB_HOSTDEV = 'ib_hostdev'
class MlnxMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
"""Attach to networks using Mellanox eSwitch L2 agent.
The MellanoxMechanismDriver integrates the ml2 plugin with the
Mellanox eswitch L2 agent. Port binding with this driver requires the
Mellanox eswitch agent to be running on the port's host, and that agent
to have connectivity to at least one segment of the port's
network.
"""
def __init__(self):
super(MlnxMechanismDriver, self).__init__(
agent_type=AGENT_TYPE_MLNX,
vif_type=VIF_TYPE_IB_HOSTDEV,
vif_details={portbindings.CAP_PORT_FILTER: False},
supported_vnic_types=[portbindings.VNIC_DIRECT])
def get_allowed_network_types(self, agent=None):
return [p_constants.TYPE_LOCAL, p_constants.TYPE_FLAT,
p_constants.TYPE_VLAN]
def get_mappings(self, agent):
return agent['configurations'].get('interface_mappings', {})
def try_to_bind_segment_for_agent(self, context, segment, agent):
if self.check_segment_for_agent(segment, agent):
if (segment[api.NETWORK_TYPE] in
(p_constants.TYPE_FLAT, p_constants.TYPE_VLAN)):
self.vif_details['physical_network'] = segment[
'physical_network']
context.set_binding(segment[api.ID],
self.vif_type,
self.vif_details)

View File

@ -1 +0,0 @@
networking_mlnx

View File

@ -1,103 +0,0 @@
# Copyright (c) 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.
import sys
import mock
from neutron.extensions import portbindings
from neutron.plugins.ml2 import driver_api as api
from neutron.tests.unit.plugins.ml2 import _test_mech_agent as base
m_const_mock = mock.Mock()
with mock.patch.dict(sys.modules,
{'networking_mlnx': mock.Mock(),
'networking_mlnx.plugins': mock.Mock(),
'networking_mlnx.plugins.ml2': mock.Mock(),
'networking_mlnx.plugins.ml2.drivers': mock.Mock(),
'networking_mlnx.plugins.ml2.drivers.mlnx':
m_const_mock}):
from neutron.plugins.ml2.drivers.mlnx import mech_mlnx
class MlnxMechanismBaseTestCase(base.AgentMechanismBaseTestCase):
VIF_TYPE = mech_mlnx.VIF_TYPE_IB_HOSTDEV
CAP_PORT_FILTER = False
AGENT_TYPE = mech_mlnx.AGENT_TYPE_MLNX
VNIC_TYPE = portbindings.VNIC_DIRECT
GOOD_MAPPINGS = {'fake_physical_network': 'fake_bridge'}
GOOD_CONFIGS = {'interface_mappings': GOOD_MAPPINGS}
BAD_MAPPINGS = {'wrong_physical_network': 'wrong_bridge'}
BAD_CONFIGS = {'interface_mappings': BAD_MAPPINGS}
AGENTS = [{'alive': True,
'configurations': GOOD_CONFIGS,
'host': 'host'}]
AGENTS_DEAD = [{'alive': False,
'configurations': GOOD_CONFIGS,
'host': 'dead_host'}]
AGENTS_BAD = [{'alive': False,
'configurations': GOOD_CONFIGS,
'host': 'bad_host_1'},
{'alive': True,
'configurations': BAD_CONFIGS,
'host': 'bad_host_2'}]
def setUp(self):
super(MlnxMechanismBaseTestCase, self).setUp()
self.driver = mech_mlnx.MlnxMechanismDriver()
self.driver.initialize()
class MlnxMechanismGenericTestCase(MlnxMechanismBaseTestCase,
base.AgentMechanismGenericTestCase):
pass
class MlnxMechanismLocalTestCase(MlnxMechanismBaseTestCase,
base.AgentMechanismLocalTestCase):
pass
class MlnxMechanismFlatTestCase(MlnxMechanismBaseTestCase,
base.AgentMechanismFlatTestCase):
pass
class MlnxMechanismVlanTestCase(MlnxMechanismBaseTestCase,
base.AgentMechanismVlanTestCase):
pass
class MlnxMechanismVifDetailsTestCase(MlnxMechanismBaseTestCase):
def setUp(self):
super(MlnxMechanismVifDetailsTestCase, self).setUp()
def test_vif_details_contains_physical_net(self):
VLAN_SEGMENTS = [{api.ID: 'vlan_segment_id',
api.NETWORK_TYPE: 'vlan',
api.PHYSICAL_NETWORK: 'fake_physical_network',
api.SEGMENTATION_ID: 1234}]
context = base.FakePortContext(self.AGENT_TYPE,
self.AGENTS,
VLAN_SEGMENTS,
portbindings.VNIC_DIRECT)
segment = VLAN_SEGMENTS[0]
agent = self.AGENTS[0]
self.driver.try_to_bind_segment_for_agent(context, segment, agent)
set({"physical_network": "fake_physical_network"}).issubset(
set(context._bound_vif_details.items()))

View File

@ -65,7 +65,6 @@ data_files =
etc/neutron/plugins/ml2/ml2_conf_sriov.ini
etc/neutron/plugins/ml2/openvswitch_agent.ini
etc/neutron/plugins/ml2/sriov_agent.ini
etc/neutron/plugins/mlnx = etc/neutron/plugins/mlnx/mlnx_conf.ini
etc/neutron/plugins/nuage = etc/neutron/plugins/nuage/nuage_plugin.ini
scripts =
bin/neutron-rootwrap-xen-dom0
@ -82,7 +81,6 @@ console_scripts =
neutron-linuxbridge-agent = neutron.plugins.ml2.drivers.linuxbridge.agent.linuxbridge_neutron_agent:main
neutron-linuxbridge-cleanup = neutron.cmd.linuxbridge_cleanup:main
neutron-metadata-agent = neutron.cmd.eventlet.agents.metadata:main
neutron-mlnx-agent = neutron.cmd.eventlet.plugins.mlnx_neutron_agent:main
neutron-netns-cleanup = neutron.cmd.netns_cleanup:main
neutron-ns-metadata-proxy = neutron.cmd.eventlet.agents.metadata_proxy:main
neutron-openvswitch-agent = neutron.cmd.eventlet.plugins.ovs_neutron_agent:main
@ -136,7 +134,6 @@ neutron.ml2.mechanism_drivers =
hyperv = neutron.plugins.ml2.drivers.hyperv.mech_hyperv:HypervMechanismDriver
l2population = neutron.plugins.ml2.drivers.l2pop.mech_driver:L2populationMechanismDriver
ofagent = neutron.plugins.ml2.drivers.ofagent.driver:OfagentMechanismDriver
mlnx = neutron.plugins.ml2.drivers.mlnx.mech_mlnx:MlnxMechanismDriver
brocade = networking_brocade.vdx.ml2driver.mechanism_brocade:BrocadeMechanism
brocade_fi_ni = neutron.plugins.ml2.drivers.brocade.fi_ni.mechanism_brocade_fi_ni:BrocadeFiNiMechanism
fslsdn = neutron.plugins.ml2.drivers.freescale.mechanism_fslsdn:FslsdnMechanismDriver