Browse Source

Merge "Update Brocade MLX plugin from Neutron decomposition"

Jenkins 3 years ago
parent
commit
9d3c974cbb

+ 20
- 0
devstack/plugin.sh View File

@@ -0,0 +1,20 @@
1
+#!/usr/bin/env bash
2
+
3
+DIR_BRCD=$DEST/networking-brocade
4
+
5
+if 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
20
+fi

+ 19
- 0
etc/neutron/plugins/brocade/brocade_mlx.ini View File

@@ -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

+ 33
- 0
etc/neutron/plugins/ml2/ml2_conf_brocade_fi_ni.ini View File

@@ -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

+ 44
- 0
networking_brocade/_i18n.py View File

@@ -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
+
15
+import oslo_i18n
16
+
17
+DOMAIN = "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
+
43
+def get_available_languages():
44
+        return oslo_i18n.get_available_languages(DOMAIN)

+ 48
- 0
networking_brocade/mlx/ml2/fi_ni/brcd_config.py View File

@@ -20,6 +20,50 @@ Parses the brocade ethernet configuration template
20 20
 
21 21
 from oslo_config import cfg
22 22
 
23
+SWITCHES = [
24
+    cfg.StrOpt(
25
+        'switch_names',
26
+        default='',
27
+        help=('Switches connected to the compute nodes'))]
28
+
29
+ML2_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
+               ]
49
+L3_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
+              ]
62
+cfg.CONF.register_opts(SWITCHES, 'ml2_brocade_fi_ni')
63
+cfg.CONF.register_opts(SWITCHES, 'l3_brocade_mlx')
64
+cfg.CONF.register_opts(ML2_BROCADE, 'ML2_BROCADE_MLX_EXAMPLE')
65
+cfg.CONF.register_opts(L3_BROCADE, 'L3_BROCADE_MLX_EXAMPLE')
66
+
23 67
 
24 68
 class ML2BrocadeConfig(object):
25 69
 
@@ -52,6 +96,10 @@ class ML2BrocadeConfig(object):
52 96
         for switch in switches:
53 97
             switch_info = {}
54 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 103
             for key, value in cfg.CONF._get(switch).items():
56 104
                 value = value.strip()
57 105
                 switch_info.update({key: value})

+ 20
- 24
networking_brocade/mlx/ml2/fi_ni/mechanism_brocade_fi_ni.py View File

@@ -16,8 +16,8 @@
16 16
 
17 17
 """Implementation of Brocade ML2 Mechanism driver for ICX and MLX."""
18 18
 
19
-from neutron.i18n import _LE
20
-from neutron.i18n import _LI
19
+from networking_brocade._i18n import _LE
20
+from networking_brocade._i18n import _LI
21 21
 from neutron.plugins.ml2.common import exceptions as ml2_exc
22 22
 from neutron.plugins.ml2 import driver_api
23 23
 from oslo_log import log as logging
@@ -73,18 +73,16 @@ class BrocadeFiNiMechanism(driver_api.MechanismDriver):
73 73
         vlan_id = segments[0]['segmentation_id']
74 74
         physical_network = segments[0]['physical_network']
75 75
         if physical_network not in self._physical_networks:
76
-            LOG.exception(_LE("BrocadeFiNiMechanism: Failed to create network."
77
-                              " Network cannot be created in the configured "
78
-                              "physical network %(physnet)s"),
79
-                          {'physnet': physical_network})
80
-            raise ml2_exc.MechanismDriverError(method='create_network_postcomm'
81
-                                               'it')
76
+            LOG.info(_LI("BrocadeFiNiMechanism: Ignoring request to create "
77
+                         "network. Network cannot be created in the "
78
+                         "configured physical network %(physnet)s"),
79
+                     {'physnet': physical_network})
80
+            return
82 81
         if network_type != 'vlan':
83
-            LOG.exception(_LE("BrocadeFiNiMechanism: Failed to create network "
84
-                              "for network type %(nw_type)s. Only network type"
85
-                              " vlan is supported"), {'nw_type': network_type})
86
-            raise ml2_exc.MechanismDriverError(method='create_network_postcomm'
87
-                                               'it')
82
+            LOG.info(_LI("BrocadeFiNiMechanism: Ignoring request to create "
83
+                         "network for network type %(nw_type)s. Only type "
84
+                         "vlan is supported"), {'nw_type': network_type})
85
+            return
88 86
         try:
89 87
             devices = self._physical_networks.get(physical_network)
90 88
             for device in devices:
@@ -142,18 +140,16 @@ class BrocadeFiNiMechanism(driver_api.MechanismDriver):
142 140
         network_type = segment['network_type']
143 141
         physical_network = segment['physical_network']
144 142
         if physical_network not in self._physical_networks:
145
-            LOG.exception(_LE("BrocadeFiNiMechanism: Failed to delete network."
146
-                              " Network cannot be deleted in the configured "
147
-                              "physical network %(physnet)s"),
148
-                          {'physnet': physical_network})
149
-            raise ml2_exc.MechanismDriverError(method='delete_network_postcomm'
150
-                                               'it')
143
+            LOG.info(_LI("BrocadeFiNiMechanism: Ignoring request to delete "
144
+                         "network. Network cannot be deleted in the "
145
+                         "configured physical network %(physnet)s"),
146
+                     {'physnet': physical_network})
147
+            return
151 148
         if network_type != 'vlan':
152
-            LOG.exception(_LE("BrocadeFiNiMechanism: Failed to delete network "
153
-                              "for network type %(nw_type)s. Only network type"
154
-                              " vlan is supported"), {'nw_type': network_type})
155
-            raise ml2_exc.MechanismDriverError(method='delete_network_postcomm'
156
-                                               'it')
149
+            LOG.info(_LI("BrocadeFiNiMechanism: Ignoring request to delete "
150
+                         "network for type %(nw_type)s. Only network type "
151
+                         "vlan is supported"), {'nw_type': network_type})
152
+            return
157 153
         try:
158 154
             devices = self._physical_networks.get(physical_network)
159 155
             for device in devices:

+ 2
- 2
networking_brocade/mlx/services/l3_router/brocade/l3_router_plugin.py View File

@@ -17,8 +17,8 @@
17 17
 
18 18
 """Implementation of Brocade L3RouterPlugin for NI devices."""
19 19
 
20
-from neutron.i18n import _LE
21
-from neutron.i18n import _LI
20
+from networking_brocade._i18n import _LE
21
+from networking_brocade._i18n import _LI
22 22
 from neutron.plugins.ml2.driver_context import NetworkContext
23 23
 from neutron.services.l3_router import l3_router_plugin as router
24 24
 from oslo_log import log as logging

+ 0
- 25
networking_brocade/mlx/tests/unit/ml2/drivers/brocade/test_brocade_fi_ni_mechanism_driver.py View File

@@ -83,31 +83,6 @@ class TestBrocadeFiNiMechDriver(base.BaseTestCase):
83 83
             super(TestBrocadeFiNiMechDriver, self).setUp()
84 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 86
     @mock.patch.object(brocadefinimechanism.BrocadeFiNiMechanism,
112 87
                        '_get_driver')
113 88
     def test_create_network_postcommit(self, mock_driver):

+ 1
- 1
networking_brocade/test_discover/test_discover.py View File

@@ -28,7 +28,7 @@ def load_tests(loader, tests, pattern):
28 28
     base_path = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0]
29 29
     base_path = os.path.split(base_path)[0]
30 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 32
                  MLX_TEST_BASE_PATH + '/unit/ml2/drivers/brocade',
33 33
                  MLX_TEST_BASE_PATH + '/unit/services/l3_router/brocade',
34 34
                  }

+ 12
- 17
requirements.txt View File

@@ -1,21 +1,16 @@
1 1
 # The order of packages is significant, because pip processes them in the order
2 2
 # of appearance. Changing the order has an impact on the overall integration
3 3
 # process, which may cause wedges in the gate later.
4
-pbr<2.0,>=1.4
4
+pbr>=1.6 # Apache-2.0
5 5
 
6
-eventlet>=0.17.4
7
-httplib2>=0.7.5
8
-netaddr>=0.7.12
9
-SQLAlchemy<1.1.0,>=0.9.7
10
-alembic>=0.8.0
11
-six>=1.9.0
12
-oslo.config>=2.1.0  # Apache-2.0
13
-oslo.db>=2.0  # Apache-2.0
14
-oslo.messaging!=1.17.0,!=1.17.1,>=1.16.0
15
-oslo.serialization>=1.4.0               # Apache-2.0
16
-oslo.utils>=2.0.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
6
+eventlet!=0.18.3,>=0.18.2 # MIT
7
+httplib2>=0.7.5 # MIT
8
+netaddr!=0.7.16,>=0.7.12 #BSD
9
+SQLAlchemy<1.1.0,>=1.0.10 # MIT
10
+alembic>=0.8.0 # MIT
11
+six>=1.9.0 # MIT
12
+oslo.config>=3.7.0 # Apache-2.0
13
+oslo.db>=4.1.0 # Apache-2.0
14
+oslo.messaging>=4.0.0
15
+oslo.serialization>=1.10.0 # Apache-2.0
16
+oslo.utils>=3.5.0 # Apache-2.0

+ 12
- 0
setup.cfg View File

@@ -26,6 +26,18 @@ version = 2015.1.1
26 26
 [files]
27 27
 packages =
28 28
     networking_brocade
29
+data_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]
35
+neutron.ml2.mechanism_drivers =
36
+    brocade_fi_ni = networking_brocade.mlx.ml2.fi_ni.mechanism_brocade_fi_ni:BrocadeFiNiMechanism
37
+
38
+# Service Plugins
39
+neutron.service_plugins =
40
+    brocade_mlx_l3 = networking_brocade.mlx.services.l3_router.brocade.l3_router_plugin.BrocadeRouterPlugin
29 41
 
30 42
 [build_sphinx]
31 43
 source-dir = doc/source

Loading…
Cancel
Save