NSX|V: Fix FWaaS exceptions
Commit I6faf26d263788d21da078e570487ee4876d04efd moved the fwaas exceptions to a new file Change-Id: I1684605a16b7dfb565cbba373397181e5ebefbbd
This commit is contained in:
parent
4f380132fe
commit
80d83e2fce
@ -18,7 +18,7 @@ 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 fw_ext
|
from neutron_fwaas.common import exceptions
|
||||||
from neutron_fwaas.services.firewall.drivers import fwaas_base
|
from neutron_fwaas.services.firewall.drivers import fwaas_base
|
||||||
|
|
||||||
from vmware_nsx.common import locking
|
from vmware_nsx.common import locking
|
||||||
@ -61,12 +61,14 @@ 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 fw_ext.FirewallInternalDriverError(driver=FWAAS_DRIVER_NAME)
|
raise exceptions.FirewallInternalDriverError(
|
||||||
|
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 fw_ext.FirewallInternalDriverError(driver=FWAAS_DRIVER_NAME)
|
raise exceptions.FirewallInternalDriverError(
|
||||||
|
driver=FWAAS_DRIVER_NAME)
|
||||||
|
|
||||||
if not router_data.get('external_gateway_info'):
|
if not router_data.get('external_gateway_info'):
|
||||||
LOG.info("Cannot apply firewall to router %s with no gateway",
|
LOG.info("Cannot apply firewall to router %s with no gateway",
|
||||||
@ -211,7 +213,8 @@ 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 backend firewall %(fw)s: "
|
LOG.error("Failed to update backend firewall %(fw)s: "
|
||||||
"%(e)s", {'e': e, 'fw': fw_id})
|
"%(e)s", {'e': e, 'fw': fw_id})
|
||||||
raise fw_ext.FirewallInternalDriverError(driver=FWAAS_DRIVER_NAME)
|
raise exceptions.FirewallInternalDriverError(
|
||||||
|
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):
|
||||||
# admin state down means default block rule firewall
|
# admin state down means default block rule firewall
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
import copy
|
import copy
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from neutron_fwaas.extensions import firewall as fw_ext
|
from neutron_fwaas.common import 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
|
||||||
@ -199,7 +199,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(fw_ext.FirewallInternalDriverError,
|
self.assertRaises(exceptions.FirewallInternalDriverError,
|
||||||
self.firewall.should_apply_firewall_to_router,
|
self.firewall.should_apply_firewall_to_router,
|
||||||
router)
|
router)
|
||||||
|
|
||||||
@ -210,6 +210,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(fw_ext.FirewallInternalDriverError,
|
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