Revert "Remove neutron-fwaas exception usage"
This reverts commit 2dd98c36652ed9c216992c37172af055f5ad7370. And uses the neutron-fwaas exception instead. Change-Id: I3934f4f0b6e4df3e51ad3038ba6c8a5c528697c2
This commit is contained in:
parent
2dd98c3665
commit
6716b68bf0
@ -198,7 +198,3 @@ class NsxRouterInterfaceDoesNotMatchAddressScope(n_exc.BadRequest):
|
|||||||
message = _("Unable to update no-NAT router %(router_id)s, "
|
message = _("Unable to update no-NAT router %(router_id)s, "
|
||||||
"only subnets allocated from address-scope "
|
"only subnets allocated from address-scope "
|
||||||
"%(address_scope_id)s can be connected.")
|
"%(address_scope_id)s can be connected.")
|
||||||
|
|
||||||
|
|
||||||
class NsxInternalDriverError(n_exc.NeutronException):
|
|
||||||
message = _("%(driver)s: Internal driver error.")
|
|
||||||
|
@ -18,9 +18,9 @@ from neutron_lib.plugins import directory
|
|||||||
from oslo_log import helpers as log_helpers
|
from oslo_log import helpers as log_helpers
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
|
from neutron_fwaas.extensions import firewall as exceptions
|
||||||
from neutron_fwaas.services.firewall.drivers import fwaas_base
|
from neutron_fwaas.services.firewall.drivers import fwaas_base
|
||||||
|
|
||||||
from vmware_nsx.common import exceptions
|
|
||||||
from vmware_nsx.common import locking
|
from vmware_nsx.common import locking
|
||||||
from vmware_nsx.plugins.nsx_v.vshield import edge_utils
|
from vmware_nsx.plugins.nsx_v.vshield import edge_utils
|
||||||
|
|
||||||
@ -60,13 +60,13 @@ class EdgeFwaasDriver(fwaas_base.FwaasDriverBase):
|
|||||||
router_data.get('router_type') == 'shared'):
|
router_data.get('router_type') == 'shared'):
|
||||||
LOG.error("Cannot apply firewall to shared router %s",
|
LOG.error("Cannot apply firewall to shared router %s",
|
||||||
router_data['id'])
|
router_data['id'])
|
||||||
raise exceptions.NsxInternalDriverError(
|
raise exceptions.FirewallInternalDriverError(
|
||||||
driver=FWAAS_DRIVER_NAME)
|
driver=FWAAS_DRIVER_NAME)
|
||||||
|
|
||||||
if router_data.get('name', '').startswith('metadata_proxy_router'):
|
if router_data.get('name', '').startswith('metadata_proxy_router'):
|
||||||
LOG.error("Cannot apply firewall to the metadata proxy router %s",
|
LOG.error("Cannot apply firewall to the metadata proxy router %s",
|
||||||
router_data['id'])
|
router_data['id'])
|
||||||
raise exceptions.NsxInternalDriverError(
|
raise exceptions.FirewallInternalDriverError(
|
||||||
driver=FWAAS_DRIVER_NAME)
|
driver=FWAAS_DRIVER_NAME)
|
||||||
|
|
||||||
if not router_data.get('external_gateway_info'):
|
if not router_data.get('external_gateway_info'):
|
||||||
@ -151,7 +151,7 @@ class EdgeFwaasDriver(fwaas_base.FwaasDriverBase):
|
|||||||
# catch known library exceptions and raise Fwaas generic exception
|
# catch known library exceptions and raise Fwaas generic exception
|
||||||
LOG.error("Failed to update firewall %(fw)s on edge %(edge_id)s: "
|
LOG.error("Failed to update firewall %(fw)s on edge %(edge_id)s: "
|
||||||
"%(e)s", {'e': e, 'fw': fw_id, 'edge_id': edge_id})
|
"%(e)s", {'e': e, 'fw': fw_id, 'edge_id': edge_id})
|
||||||
raise exceptions.NsxInternalDriverError(
|
raise exceptions.FirewallInternalDriverError(
|
||||||
driver=FWAAS_DRIVER_NAME)
|
driver=FWAAS_DRIVER_NAME)
|
||||||
|
|
||||||
def _create_or_update_firewall(self, agent_mode, apply_list, firewall):
|
def _create_or_update_firewall(self, agent_mode, apply_list, firewall):
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
import netaddr
|
import netaddr
|
||||||
|
|
||||||
|
from neutron_fwaas.extensions import firewall as exceptions
|
||||||
from neutron_fwaas.services.firewall.drivers import fwaas_base
|
from neutron_fwaas.services.firewall.drivers import fwaas_base
|
||||||
from neutron_lib.api.definitions import constants as fwaas_consts
|
from neutron_lib.api.definitions import constants as fwaas_consts
|
||||||
from neutron_lib.callbacks import events
|
from neutron_lib.callbacks import events
|
||||||
@ -25,7 +26,6 @@ from neutron_lib.plugins import directory
|
|||||||
from oslo_log import helpers as log_helpers
|
from oslo_log import helpers as log_helpers
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
from vmware_nsx.common import exceptions
|
|
||||||
from vmware_nsx.db import db as nsx_db
|
from vmware_nsx.db import db as nsx_db
|
||||||
from vmware_nsxlib.v3 import nsx_constants as consts
|
from vmware_nsxlib.v3 import nsx_constants as consts
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ class EdgeFwaasV3Driver(fwaas_base.FwaasDriverBase):
|
|||||||
# Unexpected action
|
# Unexpected action
|
||||||
LOG.error("Unsupported FWAAS action %(action)s for rule %(id)s", {
|
LOG.error("Unsupported FWAAS action %(action)s for rule %(id)s", {
|
||||||
'action': fwaas_action, 'id': fwaas_rule_id})
|
'action': fwaas_action, 'id': fwaas_rule_id})
|
||||||
raise exceptions.NsxInternalDriverError(
|
raise exceptions.FirewallInternalDriverError(
|
||||||
driver=FWAAS_DRIVER_NAME)
|
driver=FWAAS_DRIVER_NAME)
|
||||||
|
|
||||||
def _translate_cidr(self, cidr):
|
def _translate_cidr(self, cidr):
|
||||||
@ -186,7 +186,7 @@ class EdgeFwaasV3Driver(fwaas_base.FwaasDriverBase):
|
|||||||
# prevent firewall actions if the backend does not support it
|
# prevent firewall actions if the backend does not support it
|
||||||
if not self.backend_support:
|
if not self.backend_support:
|
||||||
LOG.error("The NSX backend does not support router firewall")
|
LOG.error("The NSX backend does not support router firewall")
|
||||||
raise exceptions.NsxInternalDriverError(
|
raise exceptions.FirewallInternalDriverError(
|
||||||
driver=FWAAS_DRIVER_NAME)
|
driver=FWAAS_DRIVER_NAME)
|
||||||
|
|
||||||
@log_helpers.log_method_call
|
@log_helpers.log_method_call
|
||||||
@ -245,7 +245,7 @@ class EdgeFwaasV3Driver(fwaas_base.FwaasDriverBase):
|
|||||||
nsx_router_id = nsx_db.get_nsx_router_id(context.session, router_id)
|
nsx_router_id = nsx_db.get_nsx_router_id(context.session, router_id)
|
||||||
if nsx_router_id is None:
|
if nsx_router_id is None:
|
||||||
LOG.error("Didn't find nsx router for router %s", router_id)
|
LOG.error("Didn't find nsx router for router %s", router_id)
|
||||||
raise exceptions.NsxInternalDriverError(
|
raise exceptions.FirewallInternalDriverError(
|
||||||
driver=FWAAS_DRIVER_NAME)
|
driver=FWAAS_DRIVER_NAME)
|
||||||
|
|
||||||
# get the FW section id of the backend router
|
# get the FW section id of the backend router
|
||||||
@ -255,12 +255,12 @@ class EdgeFwaasV3Driver(fwaas_base.FwaasDriverBase):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error("Failed to find router firewall section for router "
|
LOG.error("Failed to find router firewall section for router "
|
||||||
"%(id)s: %(e)s", {'id': router_id, 'e': e})
|
"%(id)s: %(e)s", {'id': router_id, 'e': e})
|
||||||
raise exceptions.NsxInternalDriverError(
|
raise exceptions.FirewallInternalDriverError(
|
||||||
driver=FWAAS_DRIVER_NAME)
|
driver=FWAAS_DRIVER_NAME)
|
||||||
if section_id is None:
|
if section_id is None:
|
||||||
LOG.error("Failed to find router firewall section for router "
|
LOG.error("Failed to find router firewall section for router "
|
||||||
"%(id)s.", {'id': router_id})
|
"%(id)s.", {'id': router_id})
|
||||||
raise exceptions.NsxInternalDriverError(
|
raise exceptions.FirewallInternalDriverError(
|
||||||
driver=FWAAS_DRIVER_NAME)
|
driver=FWAAS_DRIVER_NAME)
|
||||||
|
|
||||||
return nsx_router_id, section_id
|
return nsx_router_id, section_id
|
||||||
|
@ -17,7 +17,8 @@ import copy
|
|||||||
import mock
|
import mock
|
||||||
from oslo_utils import uuidutils
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
from vmware_nsx.common import exceptions
|
from neutron_fwaas.extensions import firewall as exceptions
|
||||||
|
|
||||||
from vmware_nsx.services.fwaas.nsx_v import edge_fwaas_driver
|
from vmware_nsx.services.fwaas.nsx_v import edge_fwaas_driver
|
||||||
from vmware_nsx.tests.unit.nsx_v import test_plugin as test_v_plugin
|
from vmware_nsx.tests.unit.nsx_v import test_plugin as test_v_plugin
|
||||||
|
|
||||||
@ -196,7 +197,7 @@ class NsxvFwaasTestCase(test_v_plugin.NsxVPluginV2TestCase):
|
|||||||
# not for shared router:
|
# not for shared router:
|
||||||
router['router_type'] = 'shared'
|
router['router_type'] = 'shared'
|
||||||
router['distributed'] = False
|
router['distributed'] = False
|
||||||
self.assertRaises(exceptions.NsxInternalDriverError,
|
self.assertRaises(exceptions.FirewallInternalDriverError,
|
||||||
self.firewall.should_apply_firewall_to_router,
|
self.firewall.should_apply_firewall_to_router,
|
||||||
router)
|
router)
|
||||||
|
|
||||||
@ -207,6 +208,6 @@ class NsxvFwaasTestCase(test_v_plugin.NsxVPluginV2TestCase):
|
|||||||
|
|
||||||
# not for mdproxy router:
|
# not for mdproxy router:
|
||||||
router['name'] = 'metadata_proxy_router'
|
router['name'] = 'metadata_proxy_router'
|
||||||
self.assertRaises(exceptions.NsxInternalDriverError,
|
self.assertRaises(exceptions.FirewallInternalDriverError,
|
||||||
self.firewall.should_apply_firewall_to_router,
|
self.firewall.should_apply_firewall_to_router,
|
||||||
router)
|
router)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user