diff --git a/neutron/agent/linux/dhcp.py b/neutron/agent/linux/dhcp.py index cd6ffdb51f..36bce4ee2e 100644 --- a/neutron/agent/linux/dhcp.py +++ b/neutron/agent/linux/dhcp.py @@ -167,23 +167,23 @@ class DhcpBase(object): def existing_dhcp_networks(cls, conf, root_helper): """Return a list of existing networks ids that we have configs for.""" - raise NotImplementedError + raise NotImplementedError() @classmethod def check_version(cls): """Execute version checks on DHCP server.""" - raise NotImplementedError + raise NotImplementedError() @classmethod def get_isolated_subnets(cls, network): """Returns a dict indicating whether or not a subnet is isolated""" - raise NotImplementedError + raise NotImplementedError() @classmethod def should_enable_metadata(cls, conf, network): """True if the metadata-proxy should be enabled for the network.""" - raise NotImplementedError + raise NotImplementedError() class DhcpLocalProcess(DhcpBase): diff --git a/neutron/api/v2/base.py b/neutron/api/v2/base.py index 92acdc3111..48c6072569 100644 --- a/neutron/api/v2/base.py +++ b/neutron/api/v2/base.py @@ -200,7 +200,7 @@ class Controller(object): return getattr(self._plugin, name)(*arg_list, **kwargs) return _handle_action else: - raise AttributeError + raise AttributeError() def _get_pagination_helper(self, request): if self._allow_pagination and self._native_pagination: diff --git a/neutron/extensions/agent.py b/neutron/extensions/agent.py index 0dc0acd056..0d4224787a 100644 --- a/neutron/extensions/agent.py +++ b/neutron/extensions/agent.py @@ -130,7 +130,7 @@ class AgentPluginBase(object): This operation is not allow in REST API. @raise exceptions.BadRequest: """ - raise exceptions.BadRequest + raise exceptions.BadRequest() @abc.abstractmethod def delete_agent(self, context, id): diff --git a/neutron/neutron_plugin_base_v2.py b/neutron/neutron_plugin_base_v2.py index 8c0c7804dc..1310d4e028 100644 --- a/neutron/neutron_plugin_base_v2.py +++ b/neutron/neutron_plugin_base_v2.py @@ -116,7 +116,7 @@ class NeutronPluginBaseV2(object): .. note:: this method is optional, as it was not part of the originally defined plugin API. """ - raise NotImplementedError + raise NotImplementedError() @abc.abstractmethod def delete_subnet(self, context, id): @@ -217,7 +217,7 @@ class NeutronPluginBaseV2(object): NOTE: this method is optional, as it was not part of the originally defined plugin API. """ - raise NotImplementedError + raise NotImplementedError() @abc.abstractmethod def delete_network(self, context, id): @@ -313,7 +313,7 @@ class NeutronPluginBaseV2(object): .. note:: this method is optional, as it was not part of the originally defined plugin API. """ - raise NotImplementedError + raise NotImplementedError() @abc.abstractmethod def delete_port(self, context, id): @@ -334,7 +334,7 @@ class NeutronPluginBaseV2(object): .. note:: this method is optional, as it was not part of the originally defined plugin API. """ - raise NotImplementedError + raise NotImplementedError() def rpc_workers_supported(self): """Return whether the plugin supports multiple RPC workers. diff --git a/neutron/plugins/cisco/cfg_agent/device_drivers/csr1kv/csr1kv_routing_driver.py b/neutron/plugins/cisco/cfg_agent/device_drivers/csr1kv/csr1kv_routing_driver.py index 68f8fac77d..191f1ee09a 100644 --- a/neutron/plugins/cisco/cfg_agent/device_drivers/csr1kv/csr1kv_routing_driver.py +++ b/neutron/plugins/cisco/cfg_agent/device_drivers/csr1kv/csr1kv_routing_driver.py @@ -63,7 +63,7 @@ class CSR1kvRoutingDriver(devicedriver_api.RoutingDriverBase): except KeyError as e: LOG.error(_("Missing device parameter:%s. Aborting " "CSR1kvRoutingDriver initialization"), e) - raise cfg_exc.CSR1kvInitializationException + raise cfg_exc.CSR1kvInitializationException() ###### Public Functions ######## def router_added(self, ri): @@ -149,10 +149,10 @@ class CSR1kvRoutingDriver(devicedriver_api.RoutingDriverBase): self._set_ha_HSRP(subinterface, vrf_name, priority, group, ip) def _csr_add_ha_VRRP(self, ri, port): - raise NotImplementedError + raise NotImplementedError() def _csr_add_ha_GBLP(self, ri, port): - raise NotImplementedError + raise NotImplementedError() def _csr_remove_ha(self, ri, port): pass diff --git a/neutron/plugins/cisco/db/n1kv_db_v2.py b/neutron/plugins/cisco/db/n1kv_db_v2.py index 4bd9f6664f..83f62e9bda 100644 --- a/neutron/plugins/cisco/db/n1kv_db_v2.py +++ b/neutron/plugins/cisco/db/n1kv_db_v2.py @@ -564,7 +564,7 @@ def reserve_specific_vlan(db_session, physical_network, vlan_id): alloc.allocated = True db_session.add(alloc) except exc.NoResultFound: - raise c_exc.VlanIDOutsidePool + raise c_exc.VlanIDOutsidePool() def release_vlan(db_session, physical_network, vlan_id): @@ -643,7 +643,7 @@ def reserve_specific_vxlan(db_session, vxlan_id): alloc.allocated = True db_session.add(alloc) except exc.NoResultFound: - raise c_exc.VxlanIDOutsidePool + raise c_exc.VxlanIDOutsidePool() def release_vxlan(db_session, vxlan_id): diff --git a/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py b/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py index 7889125b9f..07331053a2 100644 --- a/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py +++ b/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py @@ -355,7 +355,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2, segment2), encap_profile) else: - raise cisco_exceptions.NoClusterFound + raise cisco_exceptions.NoClusterFound() for profile in encap_dict: n1kvclient.update_encapsulation_profile(context, profile, @@ -922,7 +922,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2, seg_min, seg_max = self._get_segment_range( network_profile['segment_range']) if not seg_min <= segmentation_id <= seg_max: - raise cisco_exceptions.VlanIDOutsidePool + raise cisco_exceptions.VlanIDOutsidePool() n1kv_db_v2.reserve_specific_vlan(session, physical_network, segmentation_id) diff --git a/neutron/plugins/metaplugin/meta_neutron_plugin.py b/neutron/plugins/metaplugin/meta_neutron_plugin.py index 5adc86087e..f0b4ae45f7 100644 --- a/neutron/plugins/metaplugin/meta_neutron_plugin.py +++ b/neutron/plugins/metaplugin/meta_neutron_plugin.py @@ -191,7 +191,7 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2, return getattr(plugin, key) # if no plugin support the method, then raise - raise AttributeError + raise AttributeError() def _extend_network_dict(self, context, network): flavor = self._get_flavor_by_network_id(context, network['id']) @@ -281,7 +281,7 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2, def create_port(self, context, port): p = port['port'] if 'network_id' not in p: - raise exc.NotFound + raise exc.NotFound() plugin = self._get_plugin_by_network_id(context, p['network_id']) return plugin.create_port(context, port) @@ -328,7 +328,7 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2, def create_subnet(self, context, subnet): s = subnet['subnet'] if 'network_id' not in s: - raise exc.NotFound + raise exc.NotFound() plugin = self._get_plugin_by_network_id(context, s['network_id']) return plugin.create_subnet(context, subnet) diff --git a/neutron/plugins/ml2/drivers/helpers.py b/neutron/plugins/ml2/drivers/helpers.py index 5ab0e7f2d1..d3050989dd 100644 --- a/neutron/plugins/ml2/drivers/helpers.py +++ b/neutron/plugins/ml2/drivers/helpers.py @@ -140,4 +140,4 @@ class TypeDriverHelper(api.TypeDriver): LOG.warning(_("Allocate %(type)s segment from pool failed " "after %(number)s failed attempts"), {"type": network_type, "number": DB_MAX_RETRIES}) - raise exc.NoNetworkFoundInMaximumAllowedAttempts + raise exc.NoNetworkFoundInMaximumAllowedAttempts() diff --git a/neutron/plugins/ml2/drivers/type_tunnel.py b/neutron/plugins/ml2/drivers/type_tunnel.py index 7b6a2bf036..819cd7e739 100644 --- a/neutron/plugins/ml2/drivers/type_tunnel.py +++ b/neutron/plugins/ml2/drivers/type_tunnel.py @@ -100,7 +100,7 @@ class TunnelTypeDriver(helpers.TypeDriverHelper): if self.is_partial_segment(segment): alloc = self.allocate_partially_specified_segment(session) if not alloc: - raise exc.NoNetworkAvailable + raise exc.NoNetworkAvailable() else: segmentation_id = segment.get(api.SEGMENTATION_ID) alloc = self.allocate_fully_specified_segment( diff --git a/neutron/plugins/ml2/drivers/type_vlan.py b/neutron/plugins/ml2/drivers/type_vlan.py index 35cbace21c..5cd3c3c8be 100644 --- a/neutron/plugins/ml2/drivers/type_vlan.py +++ b/neutron/plugins/ml2/drivers/type_vlan.py @@ -205,7 +205,7 @@ class VlanTypeDriver(helpers.TypeDriverHelper): alloc = self.allocate_partially_specified_segment( session, **filters) if not alloc: - raise exc.NoNetworkAvailable + raise exc.NoNetworkAvailable() else: alloc = self.allocate_fully_specified_segment( session, **filters) diff --git a/neutron/plugins/vmware/common/sync.py b/neutron/plugins/vmware/common/sync.py index a35ae07a4c..c7fa6aeec2 100644 --- a/neutron/plugins/vmware/common/sync.py +++ b/neutron/plugins/vmware/common/sync.py @@ -601,7 +601,7 @@ class NsxSynchronizer(): def _synchronize_state(self, sp): # If the plugin has been destroyed, stop the LoopingCall if not self._plugin: - raise loopingcall.LoopingCallDone + raise loopingcall.LoopingCallDone() start = timeutils.utcnow() # Reset page cursor variables if necessary if sp.current_chunk == 0: diff --git a/neutron/plugins/vmware/extensions/qos.py b/neutron/plugins/vmware/extensions/qos.py index 1904bcfd27..ecc12e0b20 100644 --- a/neutron/plugins/vmware/extensions/qos.py +++ b/neutron/plugins/vmware/extensions/qos.py @@ -75,7 +75,7 @@ def convert_to_unsigned_int_or_none(val): try: val = int(val) if val < 0: - raise ValueError + raise ValueError() except (ValueError, TypeError): msg = _("'%s' must be a non negative integer.") % val raise qexception.InvalidInput(error_message=msg) diff --git a/neutron/service.py b/neutron/service.py index cf357d16fa..0cac907b33 100644 --- a/neutron/service.py +++ b/neutron/service.py @@ -146,7 +146,7 @@ def serve_rpc(): msg = _("'rpc_workers = %d' ignored because start_rpc_listeners " "is not implemented.") LOG.error(msg, cfg.CONF.rpc_workers) - raise NotImplementedError + raise NotImplementedError() try: rpc = RpcWorker(plugin) diff --git a/neutron/tests/unit/agent/linux/test_ovs_lib.py b/neutron/tests/unit/agent/linux/test_ovs_lib.py index 3fbf813782..8d2444acce 100644 --- a/neutron/tests/unit/agent/linux/test_ovs_lib.py +++ b/neutron/tests/unit/agent/linux/test_ovs_lib.py @@ -934,7 +934,7 @@ class TestDeferredOVSBridge(base.BaseTestCase): deferred_br.add_flow(**self.add_flow_dict1) deferred_br.mod_flow(**self.mod_flow_dict1) deferred_br.delete_flows(**self.del_flow_dict1) - raise Exception + raise Exception() except Exception: self._verify_mock_call([]) else: diff --git a/neutron/tests/unit/cisco/l3/device_handling_test_support.py b/neutron/tests/unit/cisco/l3/device_handling_test_support.py index e8fad7b885..1921e56acb 100644 --- a/neutron/tests/unit/cisco/l3/device_handling_test_support.py +++ b/neutron/tests/unit/cisco/l3/device_handling_test_support.py @@ -100,7 +100,7 @@ class DeviceHandlingTestSupportMixin(object): LOG.error('Failed to delete port %(p_id)s for vm instance ' '%(v_id)s due to %(err)s', {'p_id': port['id'], 'v_id': vm_id, 'err': e}) - raise nova_exc.InternalServerError + raise nova_exc.InternalServerError() def _mock_svc_vm_create_delete(self, plugin): # Mock novaclient methods for creation/deletion of service VMs diff --git a/neutron/tests/unit/test_linux_dhcp.py b/neutron/tests/unit/test_linux_dhcp.py index c23af7402e..d06a7139e2 100644 --- a/neutron/tests/unit/test_linux_dhcp.py +++ b/neutron/tests/unit/test_linux_dhcp.py @@ -732,7 +732,7 @@ class TestDnsmasq(TestBase): if index == 0: return '/usr/local/bin/neutron-dhcp-agent' else: - raise IndexError + raise IndexError() expected = [ 'ip', diff --git a/neutron/tests/unit/vmware/extensions/test_networkgw.py b/neutron/tests/unit/vmware/extensions/test_networkgw.py index 3d223e9584..7427527545 100644 --- a/neutron/tests/unit/vmware/extensions/test_networkgw.py +++ b/neutron/tests/unit/vmware/extensions/test_networkgw.py @@ -974,7 +974,7 @@ class TestNetworkGateway(test_nsx_plugin.NsxPluginV2TestCase, def test_create_network_gateway_nsx_error_returns_500(self): def raise_nsx_api_exc(*args, **kwargs): - raise api_exc.NsxApiException + raise api_exc.NsxApiException() with mock.patch.object(nsxlib.l2gateway, 'create_l2_gw_service', diff --git a/neutron/tests/unit/vmware/nsxlib/base.py b/neutron/tests/unit/vmware/nsxlib/base.py index baff3e9c63..679db7b73b 100644 --- a/neutron/tests/unit/vmware/nsxlib/base.py +++ b/neutron/tests/unit/vmware/nsxlib/base.py @@ -72,7 +72,7 @@ class NsxlibNegativeBaseTestCase(base.BaseTestCase): version.Version(fake_version)) def _faulty_request(*args, **kwargs): - raise exception.NsxApiException + raise exception.NsxApiException() instance.return_value.request.side_effect = _faulty_request self.fake_cluster = cluster.NSXCluster(