Merge "Fix NVP FWaaS errors when creating firewall without policy"

This commit is contained in:
Jenkins 2014-03-03 22:31:10 +00:00 committed by Gerrit Code Review
commit dc66ed9c07
3 changed files with 19 additions and 4 deletions

View File

@ -852,7 +852,7 @@ class NsxAdvancedPlugin(sr_db.ServiceRouter_mixin,
LOG.exception(msg)
raise e
except exceptions.BadRequest as e:
except exceptions.VcnsBadRequest as e:
self._firewall_set_status(
context, fw['id'], service_constants.ERROR)
LOG.exception(_("Bad Firewall request Input"))

View File

@ -41,7 +41,7 @@ class EdgeFirewallDriver(db_base_plugin_v2.NeutronDbPluginV2):
return VSE_FWAAS_DENY
else:
msg = _("Invalid action value %s in a firewall rule") % action
raise vcns_exc.BadRequest(resource='firewall_rule', msg=msg)
raise vcns_exc.VcnsBadRequest(resource='firewall_rule', msg=msg)
def _restore_firewall_action(self, action):
if action == VSE_FWAAS_ALLOW:
@ -51,7 +51,7 @@ class EdgeFirewallDriver(db_base_plugin_v2.NeutronDbPluginV2):
else:
msg = (_("Invalid action value %s in "
"a vshield firewall rule") % action)
raise vcns_exc.BadRequest(resource='firewall_rule', msg=msg)
raise vcns_exc.VcnsBadRequest(resource='firewall_rule', msg=msg)
def _get_port_range_from_min_max_ports(self, min_port, max_port):
if not min_port:
@ -351,4 +351,4 @@ class EdgeFirewallDriver(db_base_plugin_v2.NeutronDbPluginV2):
else:
msg = _("Can't execute insert rule operation "
"without reference rule_id")
raise vcns_exc.BadRequest(resource='firewall_rule', msg=msg)
raise vcns_exc.VcnsBadRequest(resource='firewall_rule', msg=msg)

View File

@ -141,6 +141,21 @@ class FirewallPluginTestCase(test_db_firewall.FirewallPluginDbTestCase,
for k, v in attrs.iteritems():
self.assertEqual(fw['firewall'][k], v)
def test_create_firewall_without_policy(self):
name = "new_fw"
attrs = self._get_test_firewall_attrs(name)
attrs['router_id'] = self._create_and_get_router()
with self.firewall(name=name,
router_id=attrs['router_id'],
admin_state_up=
test_db_firewall.ADMIN_STATE_UP,
expected_res_status=201) as fw:
attrs = self._replace_firewall_status(
attrs, const.PENDING_CREATE, const.ACTIVE)
for k, v in attrs.iteritems():
self.assertEqual(fw['firewall'][k], v)
def test_update_firewall(self):
name = "new_fw"
attrs = self._get_test_firewall_attrs(name)