From bca8c2ceac86088b0ecb82727bb5c2736a33340a Mon Sep 17 00:00:00 2001 From: Selvakumar S Date: Tue, 16 Feb 2016 22:45:35 -0800 Subject: [PATCH] VNETEE-441 - Remove hp references Changed the 'hp' driver name to other convention name to be used for BNP enablement also supported devstack and configuration to enable the hpe driver . --- .../db/bm_nw_provision_db.py | 11 - .../ml2/extensions/bnp_switch.py | 10 +- .../ml2/hp_network_provisioning_driver.py | 4 +- .../ml2/hpeironicextensiondriver.py | 40 ++++ .../ml2/mechanism_hpe.py | 203 ++++++++++++++++ .../tests/unit/db/test_bm_nw_provision_db.py | 8 - .../unit/ml2/extensions/test_bnp_switch.py | 6 +- .../tests/unit/ml2/test_mechanism_hpe.py | 226 ++++++++++++++++++ devstack/README.rst | 4 +- devstack/plugin.sh | 6 +- devstack/settings | 8 +- etc/ml2_conf_hpe.ini | 14 ++ setup.cfg | 6 +- 13 files changed, 505 insertions(+), 41 deletions(-) create mode 100644 baremetal_network_provisioning/ml2/hpeironicextensiondriver.py create mode 100644 baremetal_network_provisioning/ml2/mechanism_hpe.py create mode 100644 baremetal_network_provisioning/tests/unit/ml2/test_mechanism_hpe.py create mode 100644 etc/ml2_conf_hpe.ini diff --git a/baremetal_network_provisioning/db/bm_nw_provision_db.py b/baremetal_network_provisioning/db/bm_nw_provision_db.py index 287db0f..00ce9ab 100644 --- a/baremetal_network_provisioning/db/bm_nw_provision_db.py +++ b/baremetal_network_provisioning/db/bm_nw_provision_db.py @@ -531,14 +531,3 @@ def get_bnp_phys_switch_ports_by_switch_id(context, switch_id): LOG.error('no ports found for physical switch %s', switch_id) return return switch_ports - - -def get_all_bnp_swport_mappings(context): - """Get all switch port mappings.""" - try: - query = context.session.query(models.BNPSwitchPortMapping) - swport_map = query.all() - except exc.NoResultFound: - LOG.error(_LE("no switch port mapping found")) - return - return swport_map diff --git a/baremetal_network_provisioning/ml2/extensions/bnp_switch.py b/baremetal_network_provisioning/ml2/extensions/bnp_switch.py index 116381f..7db7233 100644 --- a/baremetal_network_provisioning/ml2/extensions/bnp_switch.py +++ b/baremetal_network_provisioning/ml2/extensions/bnp_switch.py @@ -139,12 +139,10 @@ def delete(self, request, id, **kwargs): context = request.context self._check_admin(context) switch = db.get_bnp_phys_switch(context, id) - portmaps = db.get_all_bnp_swport_mappings(context) - for portmap in portmaps: - switch_id = portmap['switch_id'] - if id == switch_id: - raise webob.exc.HTTPConflict( - _("Switch id %s has active port mappings") % id) + portmap = db.get_bnp_switch_port_map_by_switchid(context, id) + if portmap: + raise webob.exc.HTTPConflict( + _("Switch id %s has active port mappings") % id) if not switch: raise webob.exc.HTTPNotFound( _("Switch %s does not exist") % id) diff --git a/baremetal_network_provisioning/ml2/hp_network_provisioning_driver.py b/baremetal_network_provisioning/ml2/hp_network_provisioning_driver.py index 4aef187..42cca50 100644 --- a/baremetal_network_provisioning/ml2/hp_network_provisioning_driver.py +++ b/baremetal_network_provisioning/ml2/hp_network_provisioning_driver.py @@ -30,7 +30,7 @@ LOG = logging.getLogger(__name__) -hp_opts = [ +hpe_opts = [ cfg.StrOpt('base_url', help=_("Base HTTP URL of SDN controller")), cfg.StrOpt('auth_token', @@ -45,7 +45,7 @@ help=_("Timeout in seconds to wait for SDN HTTP request" "completion.")), ] -cfg.CONF.register_opts(hp_opts, "default") +cfg.CONF.register_opts(hpe_opts, "default") class HPNetworkProvisioningDriver(api.NetworkProvisioningApi): diff --git a/baremetal_network_provisioning/ml2/hpeironicextensiondriver.py b/baremetal_network_provisioning/ml2/hpeironicextensiondriver.py new file mode 100644 index 0000000..2c52afa --- /dev/null +++ b/baremetal_network_provisioning/ml2/hpeironicextensiondriver.py @@ -0,0 +1,40 @@ +# Copyright (c) 2015 OpenStack Foundation +# +# 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.api import extensions as neutron_extensions +from neutron.plugins.ml2 import driver_api as api + +from baremetal_network_provisioning.ml2 import extensions + +from oslo_log import log as logging + +LOG = logging.getLogger(__name__) + + +class HPEIronicExtensionDriver(api.ExtensionDriver): + _supported_extension_aliases = 'bnp-switch' + + def initialize(self): + neutron_extensions.append_api_extensions_path(extensions.__path__) + LOG.info(_("HPIronicExtensionDriver initialization complete")) + + @property + def extension_alias(self): + """Supported extension alias. + + identifying the core API extension supported + by this BNP driver + """ + return self._supported_extension_aliases diff --git a/baremetal_network_provisioning/ml2/mechanism_hpe.py b/baremetal_network_provisioning/ml2/mechanism_hpe.py new file mode 100644 index 0000000..0814284 --- /dev/null +++ b/baremetal_network_provisioning/ml2/mechanism_hpe.py @@ -0,0 +1,203 @@ +# Copyright (c) 2015 OpenStack Foundation +# +# 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 oslo_log import log as logging +from oslo_utils import importutils + +from neutron.common import constants as n_const +from neutron.extensions import portbindings +from neutron.plugins.common import constants +from neutron.plugins.ml2 import driver_api as api + +from baremetal_network_provisioning.common import constants as hp_const + + +LOG = logging.getLogger(__name__) +hpe_opts = [ + cfg.StrOpt('net_provisioning_driver', + default='baremetal_network_provisioning.ml2' + '.hp_network_provisioning_driver.HPNetworkProvisioningDriver', + help=_("Driver to provision networks on the switches in" + "the cloud fabric")), +] +cfg.CONF.register_opts(hpe_opts, "ml2_hpe") + + +class HPEMechanismDriver(api.MechanismDriver): + """Ml2 Mechanism front-end driver interface for bare + + metal provisioning. + """ + + def initialize(self): + self.conf = cfg.CONF + self._load_drivers() + self.vif_type = hp_const.HP_VIF_TYPE + self.vif_details = {portbindings.CAP_PORT_FILTER: True} + + def _load_drivers(self): + """Loads back end network provision driver from configuration.""" + driver_obj = self.conf.ml2_hpe.net_provisioning_driver + if not driver_obj: + raise SystemExit(_('A network provisioning driver' + 'must be specified')) + self.np_driver = importutils.import_object(driver_obj) + + def create_port_precommit(self, context): + """create_port_precommit.""" + if not self._is_port_of_interest(context): + return + port_dict = self._construct_port(context) + try: + self.np_driver.create_port(port_dict) + except Exception as e: + raise e + + def create_port_postcommit(self, context): + """create_port_postcommit.""" + pass + + def update_port_precommit(self, context): + """update_port_precommit.""" + vnic_type = self._get_vnic_type(context) + profile = self._get_binding_profile(context) + if vnic_type != portbindings.VNIC_BAREMETAL or not profile: + return + port_dict = self._construct_port(context) + host_id = context.current['binding:host_id'] + bind_port_dict = port_dict.get('port') + bind_port_dict['host_id'] = host_id + self.np_driver.update_port(port_dict) + + def update_port_postcommit(self, context): + """update_port_postcommit.""" + pass + + def delete_port_precommit(self, context): + """delete_port_postcommit.""" + vnic_type = self._get_vnic_type(context) + port_id = context.current['id'] + if vnic_type == portbindings.VNIC_BAREMETAL: + self.np_driver.delete_port(port_id) + + def delete_port_postcommit(self, context): + pass + + def bind_port(self, context): + """bind_port for claiming the ironic port.""" + LOG.debug("HPMechanismDriver Attempting to bind port %(port)s on " + "network %(network)s", + {'port': context.current['id'], + 'network': context.network.current['id']}) + port_id = context.current['id'] + for segment in context.segments_to_bind: + segmentation_id = segment.get(api.SEGMENTATION_ID) + if self._is_vlan_segment(segment, context): + port_status = n_const.PORT_STATUS_ACTIVE + if not self._is_port_of_interest(context): + return + host_id = context.current['binding:host_id'] + if host_id: + port = self._construct_port(context, segmentation_id) + b_status = self.np_driver.bind_port_to_segment(port) + if b_status == hp_const.BIND_SUCCESS: + context.set_binding(segment[api.ID], + self.vif_type, + self.vif_details, + status=port_status) + LOG.debug("port bound using segment for port %(port)s", + {'port': port_id}) + return + else: + LOG.debug("port binding pass for %(segment)s", + {'segment': segment}) + return + else: + LOG.debug("Ignoring %(seg)s for port %(port)s", + {'seg': segmentation_id, + 'port': port_id}) + return + + def _is_vlan_segment(self, segment, context): + """Verify a segment is valid for the HP MechanismDriver. + + Verify the requested segment is supported by HP and return True or + False to indicate this to callers. + """ + network_type = segment[api.NETWORK_TYPE] + if network_type in [constants.TYPE_VLAN]: + return True + else: + False + + def _construct_port(self, context, segmentation_id=None): + """"Contruct port dict.""" + port = context.current + port_id = port['id'] + network_id = port['network_id'] + is_lag = False + bind_port_dict = None + profile = self._get_binding_profile(context) + local_link_information = profile.get('local_link_information') + host_id = context.current['binding:host_id'] + LOG.debug("_construct_port local link info %(local_info)s", + {'local_info': local_link_information}) + if local_link_information and len(local_link_information) > 1: + is_lag = True + port_dict = {'port': + {'id': port_id, + 'network_id': network_id, + 'is_lag': is_lag, + 'switchports': local_link_information, + 'host_id': host_id + } + } + if segmentation_id: + bind_port_dict = port_dict.get('port') + bind_port_dict['segmentation_id'] = segmentation_id + bind_port_dict['access_type'] = hp_const.ACCESS + else: + return port_dict + final_dict = {'port': bind_port_dict} + LOG.debug("final port dict %(final_dict)s", + {'final_dict': final_dict}) + return final_dict + + def _get_binding_profile(self, context): + """get binding profile from port context.""" + profile = context.current.get(portbindings.PROFILE, {}) + if not profile: + LOG.debug("Missing profile in port binding") + return profile + + def _get_vnic_type(self, context): + """get vnic type for baremetal.""" + vnic_type = context.current.get(portbindings.VNIC_TYPE, "") + if not vnic_type: + return None + else: + return vnic_type + + def _is_port_of_interest(self, context): + vnic_type = self._get_vnic_type(context) + binding_profile = self._get_binding_profile(context) + if vnic_type != portbindings.VNIC_BAREMETAL or not binding_profile: + return False + local_link_information = binding_profile.get('local_link_information') + if not local_link_information: + LOG.debug("local_link_information list does not exist in profile") + return False + return True diff --git a/baremetal_network_provisioning/tests/unit/db/test_bm_nw_provision_db.py b/baremetal_network_provisioning/tests/unit/db/test_bm_nw_provision_db.py index 5e6bf9a..099138e 100644 --- a/baremetal_network_provisioning/tests/unit/db/test_bm_nw_provision_db.py +++ b/baremetal_network_provisioning/tests/unit/db/test_bm_nw_provision_db.py @@ -309,11 +309,3 @@ def test_update_bnp_phys_swport_status(self): port_updt = self.ctx.session.query(models.BNPPhysicalSwitchPort).all() self.assertNotEqual(port_dict['port_status'], port_updt[0]['port_status']) - - def test_get_all_bnp_sw_port_mappings(self): - """Test test_get_all_bnp_sw_port_mappings method.""" - port_map = self._get_bnp_switch_port_map_dict() - db.add_bnp_switch_port_map(self.ctx, port_map) - mappings = db.get_all_bnp_swport_mappings(self.ctx) - actual_switch_id = mappings[0]['switch_id'] - self.assertEqual(actual_switch_id, '3456') diff --git a/baremetal_network_provisioning/tests/unit/ml2/extensions/test_bnp_switch.py b/baremetal_network_provisioning/tests/unit/ml2/extensions/test_bnp_switch.py index c7db545..beaa802 100644 --- a/baremetal_network_provisioning/tests/unit/ml2/extensions/test_bnp_switch.py +++ b/baremetal_network_provisioning/tests/unit/ml2/extensions/test_bnp_switch.py @@ -41,7 +41,7 @@ class TestBnpSwitches(test_plugin.NeutronDbPluginV2TestCase, testlib_api.WebTestCase): fmt = 'json' - _mechanism_drivers = ['hp'] + _mechanism_drivers = ['hpe_bnp'] _ext_drivers = 'bnp_ext_driver' def setUp(self): @@ -104,7 +104,7 @@ def _update_switch(self, data, switch_id): def _delete_switch(self, switch_id): with contextlib.nested( - mock.patch.object(db, 'get_all_bnp_swport_mappings', + mock.patch.object(db, 'get_bnp_switch_port_map_by_switchid', return_value=[])): delete_req = self.new_delete_request('bnp-switches', switch_id) @@ -112,7 +112,7 @@ def _delete_switch(self, switch_id): def _delete_switch_with_active_mappings(self, switch_id): with contextlib.nested( - mock.patch.object(db, 'get_all_bnp_swport_mappings', + mock.patch.object(db, 'get_bnp_switch_port_map_by_switchid', return_value=[{'switch_id': switch_id}])): delete_req = self.new_delete_request('bnp-switches', switch_id) diff --git a/baremetal_network_provisioning/tests/unit/ml2/test_mechanism_hpe.py b/baremetal_network_provisioning/tests/unit/ml2/test_mechanism_hpe.py new file mode 100644 index 0000000..ccdab0b --- /dev/null +++ b/baremetal_network_provisioning/tests/unit/ml2/test_mechanism_hpe.py @@ -0,0 +1,226 @@ +# Copyright 2015 OpenStack Foundation +# +# 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 baremetal_network_provisioning.common import constants as hp_const +from baremetal_network_provisioning.ml2 import (hp_network_provisioning_driver + as np_drv) +from baremetal_network_provisioning.ml2 import mechanism_hpe as hpe_mech + +import contextlib + +import mock +from oslo_config import cfg + +from neutron.extensions import portbindings +from neutron.tests import base +CONF = cfg.CONF + + +class TestHPEMechDriver(base.BaseTestCase): + """Test class for mech driver.""" + + def setUp(self): + super(TestHPEMechDriver, self).setUp() + self.driver = hpe_mech.HPEMechanismDriver() + self.np_driver = np_drv.HPNetworkProvisioningDriver() + self.driver.initialize() + self.driver._load_drivers() + + def _get_port_context(self, tenant_id, net_id, vm_id, network): + """Get port context.""" + port = {'device_id': vm_id, + 'device_owner': 'compute', + 'binding:host_id': 'ironic', + 'name': 'test-port', + 'tenant_id': tenant_id, + 'id': 123456, + 'network_id': net_id, + 'binding:profile': + {'local_link_information': [{'switch_id': '11:22:33:44:55:66', + 'port_id': 'Tengig0/1'}]}, + 'binding:vnic_type': 'baremetal', + 'admin_state_up': True, + } + return FakePortContext(port, port, network) + + def _get_network_context(self, tenant_id, net_id, seg_id, shared): + """Get network context.""" + network = {'id': net_id, + 'tenant_id': tenant_id, + 'name': 'test-net', + 'shared': shared} + network_segments = [{'segmentation_id': seg_id}] + return FakeNetworkContext(network, network_segments, network) + + def _get_port_dict(self): + """Get port dict.""" + port_dict = {'port': + {'segmentation_id': 1001, + 'host_id': 'ironic', + 'access_type': hp_const.ACCESS, + 'switchports': + [{'port_id': 'Tengig0/1', + 'switch_id': '11:22:33:44:55:66'}], + 'id': 123456, + 'network_id': "net1-id", + 'is_lag': False}} + return port_dict + + def test_create_port_precommit(self): + """Test create_port_precommit method.""" + fake_port_dict = mock.Mock() + fake_context = mock.Mock() + with contextlib.nested( + mock.patch.object(hpe_mech.HPEMechanismDriver, + '_is_port_of_interest', + return_value=True), + mock.patch.object(hpe_mech.HPEMechanismDriver, + '_construct_port', + return_value=fake_port_dict), + mock.patch.object(np_drv.HPNetworkProvisioningDriver, + 'create_port', + return_value=None) + ) as (is_port, cons_port, c_port): + self.driver.create_port_precommit(fake_context) + is_port.assert_called_with(fake_context) + cons_port.assert_called_with(fake_context) + c_port.assert_called_with(fake_port_dict) + + def test_delete_port_precommit(self): + """Test delete_port_precommit method.""" + tenant_id = 'ten-1' + network_id = 'net1-id' + segmentation_id = 1001 + vm_id = 'vm1' + network_context = self._get_network_context(tenant_id, + network_id, + segmentation_id, + False) + + port_context = self._get_port_context(tenant_id, + network_id, + vm_id, + network_context) + port_id = port_context.current['id'] + with contextlib.nested( + mock.patch.object(hpe_mech.HPEMechanismDriver, + '_get_vnic_type', + return_value=portbindings.VNIC_BAREMETAL), + mock.patch.object(np_drv.HPNetworkProvisioningDriver, + 'delete_port', + return_value=None) + ) as (vnic_type, d_port): + self.driver.delete_port_precommit(port_context) + vnic_type.assert_called_with(port_context) + d_port.assert_called_with(port_id) + + def test__construct_port(self): + """Test _construct_port method.""" + tenant_id = 'ten-1' + network_id = 'net1-id' + segmentation_id = 1001 + vm_id = 'vm1' + fake_port_dict = self._get_port_dict() + network_context = self._get_network_context(tenant_id, + network_id, + segmentation_id, + False) + + port_context = self._get_port_context(tenant_id, + network_id, + vm_id, + network_context) + port_dict = self.driver._construct_port(port_context, segmentation_id) + self.assertEqual(port_dict, fake_port_dict) + + def test__get_binding_profile(self): + """Test _get_binding_profile method.""" + tenant_id = 'ten-1' + network_id = 'net1-id' + segmentation_id = 1001 + vm_id = 'vm1' + network_context = self._get_network_context(tenant_id, + network_id, + segmentation_id, + False) + + port_context = self._get_port_context(tenant_id, + network_id, + vm_id, + network_context) + fake_profile = {'local_link_information': + [{'switch_id': '11:22:33:44:55:66', + 'port_id': 'Tengig0/1'}]} + profile = self.driver._get_binding_profile(port_context) + self.assertEqual(profile, fake_profile) + + def test__get_vnic_type(self): + """Test _get_binding_profile method.""" + tenant_id = 'ten-1' + network_id = 'net1-id' + segmentation_id = 1001 + vm_id = 'vm1' + network_context = self._get_network_context(tenant_id, + network_id, + segmentation_id, + False) + + port_context = self._get_port_context(tenant_id, + network_id, + vm_id, + network_context) + vnic_type = self.driver._get_vnic_type(port_context) + self.assertEqual(vnic_type, 'baremetal') + + +class FakeNetworkContext(object): + """To generate network context for testing purposes only.""" + + def __init__(self, network, segments=None, original_network=None): + self._network = network + self._original_network = original_network + self._segments = segments + + @property + def current(self): + return self._network + + @property + def original(self): + return self._original_network + + @property + def network_segments(self): + return self._segments + + +class FakePortContext(object): + """To generate port context for testing purposes only.""" + + def __init__(self, port, original_port, network): + self._port = port + self._original_port = original_port + self._network_context = network + + @property + def current(self): + return self._port + + @property + def original(self): + return self._original_port + + @property + def network(self): + return self._network_context diff --git a/devstack/README.rst b/devstack/README.rst index 4f067b8..0361a2f 100644 --- a/devstack/README.rst +++ b/devstack/README.rst @@ -13,7 +13,7 @@ Enabling Baremetal Network Provisioning in Devstack 3. Add the following required flag in local.conf to enable BNP ML2 MechanismDriver:: - Q_ML2_PLUGIN_MECHANISM_DRIVERS=openvswitch,l2population,hp + Q_ML2_PLUGIN_MECHANISM_DRIVERS=openvswitch,l2population,hpe_bnp 4. Add the following required flag in local.conf to enable BNP Extension driver:: @@ -23,7 +23,7 @@ Enabling Baremetal Network Provisioning in Devstack 5. Provide the extra config file in local.conf for loading mechanism driver:: Q_PLUGIN_EXTRA_CONF_PATH=etc/neutron/plugins/ml2 - Q_PLUGIN_EXTRA_CONF_FILES=(ml2_conf_hp.ini) + Q_PLUGIN_EXTRA_CONF_FILES=(ml2_conf_hpe.ini) 6. Read the settings file for more details. diff --git a/devstack/plugin.sh b/devstack/plugin.sh index bc692d1..20e427a 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -25,11 +25,11 @@ function configure_bnp_plugin { sudo mkdir -p $NEUTRON_CONF_DIR sudo chown -R $STACK_USER:root /etc/neutron fi - cp $BNP_DIR/etc/ml2_conf_hp.ini $BNP_ML2_CONF_HP_FILE + cp $BNP_DIR/etc/ml2_conf_hpe.ini $BNP_ML2_CONF_HPE_FILE iniset $BNP_ML2_CONF_HP_FILE default snmp_timeout $SNMP_TIMEOUT iniset $BNP_ML2_CONF_HP_FILE default snmp_retries $SNMP_RETRIES - iniadd $BNP_ML2_CONF_HP_FILE ml2_hp net_provisioning_driver $NET_PROVISIONING_DRIVER - iniset $BNP_ENTRY_POINT_FILE neutron.ml2.mechanism_drivers hp $HP_MECHANISM_DRIVER + iniadd $BNP_ML2_CONF_HP_FILE ml2_hpe net_provisioning_driver $NET_PROVISIONING_DRIVER + iniset $BNP_ENTRY_POINT_FILE neutron.ml2.mechanism_drivers hpe_bnp $HPE_MECHANISM_DRIVER iniset $BNP_ENTRY_POINT_FILE neutron.ml2.extension_drivers bnp_ext_driver $BNP_EXTENSION_DRIVER } diff --git a/devstack/settings b/devstack/settings index 65a2cb6..2e2c24e 100644 --- a/devstack/settings +++ b/devstack/settings @@ -1,13 +1,13 @@ # Devstack settings BNP_DIR=$DEST/baremetal-network-provisioning -BNP_ML2_CONF_HP_FILE=/etc/neutron/plugins/ml2/ml2_conf_hp.ini +BNP_ML2_CONF_HPE_FILE=/etc/neutron/plugins/ml2/ml2_conf_hpe.ini BNP_ENTRY_POINT_FILE=/opt/stack/neutron/neutron.egg-info/entry_points.txt NEUTRON_CONF_DIR=/etc/neutron/plugins/ml2 SNMP_TIMEOUT=3 SNMP_RETRIES=5 NET_PROVISIONING_DRIVER=baremetal_network_provisioning.drivers.hp.hp_snmp_provisioning_driver.HPSNMPProvisioningDriver -HP_MECHANISM_DRIVER=baremetal_network_provisioning.ml2.mechanism_hp:HPMechanismDriver -BNP_EXTENSION_DRIVER=baremetal_network_provisioning.ml2.hpironicextensiondriver:HPIronicExtensionDriver +HPE_MECHANISM_DRIVER=baremetal_network_provisioning.ml2.mechanism_hpe:HPEMechanismDriver +BNP_EXTENSION_DRIVER=baremetal_network_provisioning.ml2.hpeironicextensiondriver:HPEIronicExtensionDriver # # Each service you enable has the following meaning: # bnp-plugin - Add this config flag to enable bnp service plugin @@ -16,3 +16,5 @@ BNP_EXTENSION_DRIVER=baremetal_network_provisioning.ml2.hpironicextensiondriver: # enable_service bnp-plugin # # This can be overridden in the localrc file +SNMP_TIMEOUT=${SNMP_TIMEOUT:-3} +SNMP_RETRIES=${SNMP_RETRIES:-5} diff --git a/etc/ml2_conf_hpe.ini b/etc/ml2_conf_hpe.ini new file mode 100644 index 0000000..ff1d9e4 --- /dev/null +++ b/etc/ml2_conf_hpe.ini @@ -0,0 +1,14 @@ +[ml2_hpe] +# (StrOpt) Back end driver +# +# net_provisioning_driver = +# Example : net_provisioning_driver = baremetal_network_provisioning.drivers.hp.hp_snmp_provisioning_driver.HPSNMPProvisioningDriver + +[default] +# snmp_timeout = +# Example snmp_timeout = 3 +#(IntOpt)Timeout in seconds to wait for SNMP request completion + +# snmp_retries +# Example snmp_retries = 5 +# (IntOpt) Number of retries to be done for the SNMP request after the timeout diff --git a/setup.cfg b/setup.cfg index 49dda3d..8dbc9ab 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] name = baremetal-network-provisioning version = 2015.2.1 -summary = HP mechanism drivers for bare metal connectivity +summary = HPE mechanism drivers for bare metal connectivity description-file = README.rst author = OpenStack @@ -26,7 +26,7 @@ packages = baremetal_network_provisioning data_files = etc/neutron = - etc/ml2_conf_hp.ini + etc/ml2_conf_hpe.ini etc/hp_network_provisioning_conf.ini [entry_points] @@ -35,7 +35,7 @@ console_scripts = neutron.db.alembic_migrations = baremetal-network-provisioning = baremetal_network_provisioning.db.migration:alembic_migrations neutron.ml2.extension_drivers = - bnp_ext_driver = baremetal_network_provisioning.ml2.hpironicextensiondriver:HPIronicExtensionDriver + bnp_ext_driver = baremetal_network_provisioning.ml2.hpeironicextensiondriver:HPEIronicExtensionDriver bnpclient.extension = bnp_switch = baremetal_network_provisioning.bnpclient.bnp_client_ext.bnpswitch._bnp_switch