summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-03-14 17:49:27 +0000
committerGerrit Code Review <review@openstack.org>2016-03-14 17:49:28 +0000
commit9d3c974cbb6ba66ffaf383aa047544201a3c1789 (patch)
treeb531128885ea18e674f0201f1a1e007d4f6c7523
parent836a9d014893f819b5fa65c1f88da1d052cba4cd (diff)
parent6453b84e109101a4ddcfccdcf1deb84b08612aed (diff)
Merge "Update Brocade MLX plugin from Neutron decomposition"kilo-eol
-rw-r--r--devstack/plugin.sh20
-rw-r--r--etc/neutron/plugins/brocade/brocade_mlx.ini19
-rw-r--r--etc/neutron/plugins/ml2/ml2_conf_brocade_fi_ni.ini33
-rw-r--r--networking_brocade/_i18n.py44
-rw-r--r--networking_brocade/mlx/ml2/fi_ni/brcd_config.py48
-rw-r--r--networking_brocade/mlx/ml2/fi_ni/mechanism_brocade_fi_ni.py44
-rw-r--r--networking_brocade/mlx/services/l3_router/brocade/l3_router_plugin.py4
-rw-r--r--networking_brocade/mlx/tests/unit/ml2/drivers/brocade/test_brocade_fi_ni_mechanism_driver.py25
-rw-r--r--networking_brocade/test_discover/test_discover.py2
-rw-r--r--requirements.txt29
-rw-r--r--setup.cfg12
11 files changed, 211 insertions, 69 deletions
diff --git a/devstack/plugin.sh b/devstack/plugin.sh
new file mode 100644
index 0000000..b14d7dc
--- /dev/null
+++ b/devstack/plugin.sh
@@ -0,0 +1,20 @@
1#!/usr/bin/env bash
2
3DIR_BRCD=$DEST/networking-brocade
4
5if is_service_enabled net-brcd; then
6
7 if [[ "$1" == "source" ]]; then
8 :
9 fi
10
11 if [[ "$1" == "stack" && "$2" == "install" ]]; then
12 cd $DIR_BRCD
13 echo "Installing networking-brocade"
14 setup_develop $DIR_BRCD
15 fi
16
17 if [[ "$1" == "clean" ]]; then
18 :
19 fi
20fi
diff --git a/etc/neutron/plugins/brocade/brocade_mlx.ini b/etc/neutron/plugins/brocade/brocade_mlx.ini
new file mode 100644
index 0000000..3e1e338
--- /dev/null
+++ b/etc/neutron/plugins/brocade/brocade_mlx.ini
@@ -0,0 +1,19 @@
1[l3_brocade_mlx]
2# switch_names = Comma separated list of names of MLX switches to be configured
3# Example:
4# switch_names = mlx
5
6[L3_BROCADE_MLX_EXAMPLE]
7# address = The IP address of the MLX switch
8# username = The SSH username to use to connect to device
9# password = The SSH password to use to connect to device
10# physical_networks = Allowed physical networks for VLAN configuration
11# ports = Comma separated list of ports on the switch which needs to be tagged to VLAN
12#
13# Example:
14# [mlx]
15# address = 10.24.20.21
16# username = admin
17# password = password
18# physical_networks = physnet1
19# ports = 3/3, 3/9
diff --git a/etc/neutron/plugins/ml2/ml2_conf_brocade_fi_ni.ini b/etc/neutron/plugins/ml2/ml2_conf_brocade_fi_ni.ini
new file mode 100644
index 0000000..b37fa43
--- /dev/null
+++ b/etc/neutron/plugins/ml2/ml2_conf_brocade_fi_ni.ini
@@ -0,0 +1,33 @@
1[ml2_brocade_fi_ni]
2# switch_names = Comma separated names of switch to be configured
3# Example:
4# switch_names = icx-1, icx-2
5
6[ML2_BROCADE_MLX_EXAMPLE]
7# address = The address of the host to SSH to
8# username = The username to use to connect to device
9# password = The password to use to connect to device
10# physical_networks = Allowed physical networks
11# ports = Ports on the switch which needs to tagged to VLAN. Multiple ports can be separated by a comma.
12# transport = Protocol to use for device connection(SSH or Telnet). Default is SSH. This is an optional parameter
13# ostype = Optional parameter, which will identify the firmware version(FI/NI)
14#
15# Example:
16# [icx-1]
17# address = 10.24.20.22
18# username = admin
19# password = password
20# physical_networks = physnet1
21# ports = 1/1/1, 1/1/2
22# transport = SSH
23# ostype = FI
24
25# Example:
26# [mlx]
27# address = 10.24.20.21
28# username = admin
29# password = password
30# physical_networks = physnet1
31# ports = 3/3, 3/9
32# transport = SSH
33# ostype = NI
diff --git a/networking_brocade/_i18n.py b/networking_brocade/_i18n.py
new file mode 100644
index 0000000..ddeb63d
--- /dev/null
+++ b/networking_brocade/_i18n.py
@@ -0,0 +1,44 @@
1# Copyright 2016 Brocade Communications
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15import oslo_i18n
16
17DOMAIN = "networking-brocade"
18
19_translators = oslo_i18n.TranslatorFactory(domain=DOMAIN)
20
21# The primary translation function using the well-known name "_"
22_ = _translators.primary
23
24# The contextual translation function using the name "_C"
25# requires oslo.i18n >=2.1.0
26_C = _translators.contextual_form
27
28# The plural translation function using the name "_P"
29# requires oslo.i18n >=2.1.0
30_P = _translators.plural_form
31
32# Translators for log levels.
33#
34# The abbreviated names are meant to reflect the usual use of a short
35# name like '_'. The "L" is for "log" and the other letter comes from
36# the level.
37_LI = _translators.log_info
38_LW = _translators.log_warning
39_LE = _translators.log_error
40_LC = _translators.log_critical
41
42
43def get_available_languages():
44 return oslo_i18n.get_available_languages(DOMAIN)
diff --git a/networking_brocade/mlx/ml2/fi_ni/brcd_config.py b/networking_brocade/mlx/ml2/fi_ni/brcd_config.py
index f5def54..c982b79 100644
--- a/networking_brocade/mlx/ml2/fi_ni/brcd_config.py
+++ b/networking_brocade/mlx/ml2/fi_ni/brcd_config.py
@@ -20,6 +20,50 @@ Parses the brocade ethernet configuration template
20 20
21from oslo_config import cfg 21from oslo_config import cfg
22 22
23SWITCHES = [
24 cfg.StrOpt(
25 'switch_names',
26 default='',
27 help=('Switches connected to the compute nodes'))]
28
29ML2_BROCADE = [cfg.StrOpt('address', default='',
30 help=('The IP address of the MLX or ICX switch')),
31 cfg.StrOpt('username', default='admin',
32 help=('The SSH username of the switch')),
33 cfg.StrOpt('password', default='password', secret=True,
34 help=('The SSH password of the switch')),
35 cfg.StrOpt('physical_networks', default='',
36 help=('Allowed physical networks where VLAN can '
37 'be configured on this switch')),
38 cfg.StrOpt('ports', default='',
39 help=('Ports to be tagged in the VLAN being '
40 'configured on the switch')),
41 cfg.StrOpt('transport', default='SSH',
42 choices=('SSH', 'TELNET'),
43 help=('Protocol used to communicate with switch')),
44 cfg.StrOpt('ostype', default='NI', choices=('NI', 'FI'),
45 help=('OS type of the device. NI is NetIron '
46 'for MLX switches. FI is FastIron for '
47 'ICX switches.')),
48 ]
49L3_BROCADE = [cfg.StrOpt('address', default='',
50 help=('The IP address of the MLX switch')),
51 cfg.StrOpt('username', default='admin',
52 help=('The SSH username of the switch')),
53 cfg.StrOpt('password', default='password', secret=True,
54 help=('The SSH password of the switch')),
55 cfg.StrOpt('physical_networks', default='',
56 help=('Allowed physical networks where VLAN can '
57 'be configured on this switch')),
58 cfg.StrOpt('ports', default='',
59 help=('Ports to be tagged in the VLAN being '
60 'configured on the switch')),
61 ]
62cfg.CONF.register_opts(SWITCHES, 'ml2_brocade_fi_ni')
63cfg.CONF.register_opts(SWITCHES, 'l3_brocade_mlx')
64cfg.CONF.register_opts(ML2_BROCADE, 'ML2_BROCADE_MLX_EXAMPLE')
65cfg.CONF.register_opts(L3_BROCADE, 'L3_BROCADE_MLX_EXAMPLE')
66
23 67
24class ML2BrocadeConfig(object): 68class ML2BrocadeConfig(object):
25 69
@@ -52,6 +96,10 @@ class ML2BrocadeConfig(object):
52 for switch in switches: 96 for switch in switches:
53 switch_info = {} 97 switch_info = {}
54 switch = switch.strip() 98 switch = switch.strip()
99 if isL2:
100 cfg.CONF.register_opts(ML2_BROCADE, switch)
101 else:
102 cfg.CONF.register_opts(L3_BROCADE, switch)
55 for key, value in cfg.CONF._get(switch).items(): 103 for key, value in cfg.CONF._get(switch).items():
56 value = value.strip() 104 value = value.strip()
57 switch_info.update({key: value}) 105 switch_info.update({key: value})
diff --git a/networking_brocade/mlx/ml2/fi_ni/mechanism_brocade_fi_ni.py b/networking_brocade/mlx/ml2/fi_ni/mechanism_brocade_fi_ni.py
index 61fa591..403003a 100644
--- a/networking_brocade/mlx/ml2/fi_ni/mechanism_brocade_fi_ni.py
+++ b/networking_brocade/mlx/ml2/fi_ni/mechanism_brocade_fi_ni.py
@@ -16,8 +16,8 @@
16 16
17"""Implementation of Brocade ML2 Mechanism driver for ICX and MLX.""" 17"""Implementation of Brocade ML2 Mechanism driver for ICX and MLX."""
18 18
19from neutron.i18n import _LE 19from networking_brocade._i18n import _LE
20from neutron.i18n import _LI 20from networking_brocade._i18n import _LI
21from neutron.plugins.ml2.common import exceptions as ml2_exc 21from neutron.plugins.ml2.common import exceptions as ml2_exc
22from neutron.plugins.ml2 import driver_api 22from neutron.plugins.ml2 import driver_api
23from oslo_log import log as logging 23from oslo_log import log as logging
@@ -73,18 +73,16 @@ class BrocadeFiNiMechanism(driver_api.MechanismDriver):
73 vlan_id = segments[0]['segmentation_id'] 73 vlan_id = segments[0]['segmentation_id']
74 physical_network = segments[0]['physical_network'] 74 physical_network = segments[0]['physical_network']
75 if physical_network not in self._physical_networks: 75 if physical_network not in self._physical_networks:
76 LOG.exception(_LE("BrocadeFiNiMechanism: Failed to create network." 76 LOG.info(_LI("BrocadeFiNiMechanism: Ignoring request to create "
77 " Network cannot be created in the configured " 77 "network. Network cannot be created in the "
78 "physical network %(physnet)s"), 78 "configured physical network %(physnet)s"),
79 {'physnet': physical_network}) 79 {'physnet': physical_network})
80 raise ml2_exc.MechanismDriverError(method='create_network_postcomm' 80 return
81 'it')
82 if network_type != 'vlan': 81 if network_type != 'vlan':
83 LOG.exception(_LE("BrocadeFiNiMechanism: Failed to create network " 82 LOG.info(_LI("BrocadeFiNiMechanism: Ignoring request to create "
84 "for network type %(nw_type)s. Only network type" 83 "network for network type %(nw_type)s. Only type "
85 " vlan is supported"), {'nw_type': network_type}) 84 "vlan is supported"), {'nw_type': network_type})
86 raise ml2_exc.MechanismDriverError(method='create_network_postcomm' 85 return
87 'it')
88 try: 86 try:
89 devices = self._physical_networks.get(physical_network) 87 devices = self._physical_networks.get(physical_network)
90 for device in devices: 88 for device in devices:
@@ -142,18 +140,16 @@ class BrocadeFiNiMechanism(driver_api.MechanismDriver):
142 network_type = segment['network_type'] 140 network_type = segment['network_type']
143 physical_network = segment['physical_network'] 141 physical_network = segment['physical_network']
144 if physical_network not in self._physical_networks: 142 if physical_network not in self._physical_networks:
145 LOG.exception(_LE("BrocadeFiNiMechanism: Failed to delete network." 143 LOG.info(_LI("BrocadeFiNiMechanism: Ignoring request to delete "
146 " Network cannot be deleted in the configured " 144 "network. Network cannot be deleted in the "
147 "physical network %(physnet)s"), 145 "configured physical network %(physnet)s"),
148 {'physnet': physical_network}) 146 {'physnet': physical_network})
149 raise ml2_exc.MechanismDriverError(method='delete_network_postcomm' 147 return
150 'it')
151 if network_type != 'vlan': 148 if network_type != 'vlan':
152 LOG.exception(_LE("BrocadeFiNiMechanism: Failed to delete network " 149 LOG.info(_LI("BrocadeFiNiMechanism: Ignoring request to delete "
153 "for network type %(nw_type)s. Only network type" 150 "network for type %(nw_type)s. Only network type "
154 " vlan is supported"), {'nw_type': network_type}) 151 "vlan is supported"), {'nw_type': network_type})
155 raise ml2_exc.MechanismDriverError(method='delete_network_postcomm' 152 return
156 'it')
157 try: 153 try:
158 devices = self._physical_networks.get(physical_network) 154 devices = self._physical_networks.get(physical_network)
159 for device in devices: 155 for device in devices:
diff --git a/networking_brocade/mlx/services/l3_router/brocade/l3_router_plugin.py b/networking_brocade/mlx/services/l3_router/brocade/l3_router_plugin.py
index 0d3b7ed..13d4dc9 100644
--- a/networking_brocade/mlx/services/l3_router/brocade/l3_router_plugin.py
+++ b/networking_brocade/mlx/services/l3_router/brocade/l3_router_plugin.py
@@ -17,8 +17,8 @@
17 17
18"""Implementation of Brocade L3RouterPlugin for NI devices.""" 18"""Implementation of Brocade L3RouterPlugin for NI devices."""
19 19
20from neutron.i18n import _LE 20from networking_brocade._i18n import _LE
21from neutron.i18n import _LI 21from networking_brocade._i18n import _LI
22from neutron.plugins.ml2.driver_context import NetworkContext 22from neutron.plugins.ml2.driver_context import NetworkContext
23from neutron.services.l3_router import l3_router_plugin as router 23from neutron.services.l3_router import l3_router_plugin as router
24from oslo_log import log as logging 24from oslo_log import log as logging
diff --git a/networking_brocade/mlx/tests/unit/ml2/drivers/brocade/test_brocade_fi_ni_mechanism_driver.py b/networking_brocade/mlx/tests/unit/ml2/drivers/brocade/test_brocade_fi_ni_mechanism_driver.py
index 4d55da6..0aa342b 100644
--- a/networking_brocade/mlx/tests/unit/ml2/drivers/brocade/test_brocade_fi_ni_mechanism_driver.py
+++ b/networking_brocade/mlx/tests/unit/ml2/drivers/brocade/test_brocade_fi_ni_mechanism_driver.py
@@ -83,31 +83,6 @@ class TestBrocadeFiNiMechDriver(base.BaseTestCase):
83 super(TestBrocadeFiNiMechDriver, self).setUp() 83 super(TestBrocadeFiNiMechDriver, self).setUp()
84 self.mechanism_driver = importutils.import_object(_mechanism_name) 84 self.mechanism_driver = importutils.import_object(_mechanism_name)
85 85
86 def test_create_network_postcommit_wrong_physnet(self):
87 """
88 Test create network with wrong value for physical network.
89 Physical network to which the devices belong is 'physnet1' but
90 we make a call to create network with physical network 'physnet2'.
91 In this case we raise an exception with error message -
92 "Brocade Mechanism: failed to create network, network cannot be
93 created in the configured physical network."
94 """
95 ctx = self._get_network_context('physnet2', 'vlan')
96 self.assertRaises(ml2_exc.MechanismDriverError,
97 self.mechanism_driver.create_network_postcommit, ctx)
98
99 def test_create_network_postcommit_wrong_network_type(self):
100 """
101 Test create network with wrong value for network type. The plugin
102 allows to create network only if the request is to create a VLAN
103 network. For any other network type following exception is raised -
104 'Brocade Mechanism failed to create network, only network type vlan
105 is supported"
106 """
107 ctx = self._get_network_context('physnet1', 'vxlan')
108 self.assertRaises(ml2_exc.MechanismDriverError,
109 self.mechanism_driver.create_network_postcommit, ctx)
110
111 @mock.patch.object(brocadefinimechanism.BrocadeFiNiMechanism, 86 @mock.patch.object(brocadefinimechanism.BrocadeFiNiMechanism,
112 '_get_driver') 87 '_get_driver')
113 def test_create_network_postcommit(self, mock_driver): 88 def test_create_network_postcommit(self, mock_driver):
diff --git a/networking_brocade/test_discover/test_discover.py b/networking_brocade/test_discover/test_discover.py
index dcdd101..fa4a9d9 100644
--- a/networking_brocade/test_discover/test_discover.py
+++ b/networking_brocade/test_discover/test_discover.py
@@ -28,7 +28,7 @@ def load_tests(loader, tests, pattern):
28 base_path = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0] 28 base_path = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0]
29 base_path = os.path.split(base_path)[0] 29 base_path = os.path.split(base_path)[0]
30 test_dirs = {'./networking_brocade/tests', 30 test_dirs = {'./networking_brocade/tests',
31 './networking_brocade/vdx/tests/unit/ml2/drivers/brocade', 31# './networking_brocade/vdx/tests/unit/ml2/drivers/brocade',
32 MLX_TEST_BASE_PATH + '/unit/ml2/drivers/brocade', 32 MLX_TEST_BASE_PATH + '/unit/ml2/drivers/brocade',
33 MLX_TEST_BASE_PATH + '/unit/services/l3_router/brocade', 33 MLX_TEST_BASE_PATH + '/unit/services/l3_router/brocade',
34 } 34 }
diff --git a/requirements.txt b/requirements.txt
index 6d7b2e7..6866759 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,21 +1,16 @@
1# The order of packages is significant, because pip processes them in the order 1# The order of packages is significant, because pip processes them in the order
2# of appearance. Changing the order has an impact on the overall integration 2# of appearance. Changing the order has an impact on the overall integration
3# process, which may cause wedges in the gate later. 3# process, which may cause wedges in the gate later.
4pbr<2.0,>=1.4 4pbr>=1.6 # Apache-2.0
5 5
6eventlet>=0.17.4 6eventlet!=0.18.3,>=0.18.2 # MIT
7httplib2>=0.7.5 7httplib2>=0.7.5 # MIT
8netaddr>=0.7.12 8netaddr!=0.7.16,>=0.7.12 #BSD
9SQLAlchemy<1.1.0,>=0.9.7 9SQLAlchemy<1.1.0,>=1.0.10 # MIT
10alembic>=0.8.0 10alembic>=0.8.0 # MIT
11six>=1.9.0 11six>=1.9.0 # MIT
12oslo.config>=2.1.0 # Apache-2.0 12oslo.config>=3.7.0 # Apache-2.0
13oslo.db>=2.0 # Apache-2.0 13oslo.db>=4.1.0 # Apache-2.0
14oslo.messaging!=1.17.0,!=1.17.1,>=1.16.0 14oslo.messaging>=4.0.0
15oslo.serialization>=1.4.0 # Apache-2.0 15oslo.serialization>=1.10.0 # Apache-2.0
16oslo.utils>=2.0.0 # Apache-2.0 16oslo.utils>=3.5.0 # Apache-2.0
17
18# This project does depend on neutron as a library, but the
19# openstack tooling does not play nicely with projects that
20# are not publicly available in pypi.
21# -e git+https://git.openstack.org/openstack/neutron#egg=neutron
diff --git a/setup.cfg b/setup.cfg
index 0076234..a532e73 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -26,6 +26,18 @@ version = 2015.1.1
26[files] 26[files]
27packages = 27packages =
28 networking_brocade 28 networking_brocade
29data_files =
30 etc/neutron =
31 etc/neutron/plugins/ml2/ml2_conf_brocade_fi_ni.ini
32 etc/neutron/plugins/brocade/brocade_mlx.ini
33
34[entry_points]
35neutron.ml2.mechanism_drivers =
36 brocade_fi_ni = networking_brocade.mlx.ml2.fi_ni.mechanism_brocade_fi_ni:BrocadeFiNiMechanism
37
38# Service Plugins
39neutron.service_plugins =
40 brocade_mlx_l3 = networking_brocade.mlx.services.l3_router.brocade.l3_router_plugin.BrocadeRouterPlugin
29 41
30[build_sphinx] 42[build_sphinx]
31source-dir = doc/source 43source-dir = doc/source