diff --git a/neutron_vpnaas/services/vpn/plugin.py b/neutron_vpnaas/services/vpn/plugin.py index c70c2c790..38b8d6792 100644 --- a/neutron_vpnaas/services/vpn/plugin.py +++ b/neutron_vpnaas/services/vpn/plugin.py @@ -15,11 +15,12 @@ # under the License. from neutron.db import servicetype_db as st_db -from neutron.extensions import flavors from neutron.services.flavors import flavors_plugin from neutron.services import provider_configuration as pconf from neutron.services import service_base from neutron_lib import context as ncontext +from neutron_lib import exceptions as lib_exc +from neutron_lib.exceptions import flavors as flav_exc from neutron_lib.plugins import constants from neutron_lib.plugins import directory from oslo_log import log as logging @@ -124,10 +125,10 @@ class VPNDriverPlugin(VPNPlugin, vpn_db.VPNPluginRpcDbMixin): fl_db = flavors_plugin.FlavorsPlugin.get_flavor( self._flavors_plugin, context, flavor_id) if fl_db['service_type'] != constants.VPN: - raise flavors.InvalidFlavorServiceType( + raise lib_exc.InvalidServiceType( service_type=fl_db['service_type']) if not fl_db['enabled']: - raise flavors.FlavorDisabled() + raise flav_exc.FlavorDisabled() providers = flavors_plugin.FlavorsPlugin.get_flavor_next_provider( self._flavors_plugin, context, fl_db['id']) provider = providers[0].get('provider') diff --git a/neutron_vpnaas/tests/unit/services/vpn/test_plugin.py b/neutron_vpnaas/tests/unit/services/vpn/test_plugin.py index 7ff3aabd4..ce7c847c1 100644 --- a/neutron_vpnaas/tests/unit/services/vpn/test_plugin.py +++ b/neutron_vpnaas/tests/unit/services/vpn/test_plugin.py @@ -16,13 +16,14 @@ import contextlib import mock from neutron.db import servicetype_db as st_db -from neutron.extensions import flavors from neutron.services.flavors.flavors_plugin import FlavorsPlugin from neutron.tests.unit.db import test_agentschedulers_db from neutron.tests.unit.extensions import test_agent as test_agent_ext_plugin from neutron_lib import constants as lib_constants from neutron_lib import context +from neutron_lib import exceptions as lib_exc +from neutron_lib.exceptions import flavors as flav_exc from neutron_lib.plugins import constants as p_constants from neutron_lib.plugins import directory from oslo_utils import uuidutils @@ -288,7 +289,7 @@ class TestVPNDriverPluginMultipleDrivers(base.BaseTestCase): with self.vpnservices_providers_set(): driver_plugin = vpn_plugin.VPNDriverPlugin() self.assertRaises( - flavors.InvalidFlavorServiceType, + lib_exc.InvalidServiceType, driver_plugin._get_provider_for_flavor, self.adminContext, _uuid()) @@ -303,7 +304,7 @@ class TestVPNDriverPluginMultipleDrivers(base.BaseTestCase): with self.vpnservices_providers_set(): driver_plugin = vpn_plugin.VPNDriverPlugin() self.assertRaises( - flavors.FlavorDisabled, + flav_exc.FlavorDisabled, driver_plugin._get_provider_for_flavor, self.adminContext, _uuid())