Merge "FirewallGroupPortInvalidProject can be raised now"

This commit is contained in:
Jenkins 2017-08-29 20:58:48 +00:00 committed by Gerrit Code Review
commit 403f09acb9
2 changed files with 29 additions and 1 deletions

View File

@ -230,7 +230,7 @@ class FirewallPluginV2(
raise f_exc.FirewallGroupPortInvalid(port_id=port_id)
if port_db['tenant_id'] != tenant_id:
raise f_exc.FirewallGroupPortInvalidProject(
port_id=port_id, tenant_id=port_db['tenant_id'])
port_id=port_id, project_id=port_db['tenant_id'])
return
def _check_no_need_pending(self, context, fwg_id, fwg_body):

View File

@ -670,6 +670,34 @@ class TestFirewallPluginBasev2(TestFirewallRouterPortBase,
s['subnet']['id'],
None)
def test_update_firewall_group_with_invalid_project(self):
with self.router(name='router1',
admin_state_up=True,
tenant_id=self._tenant_id) as r, \
self.subnet(cidr='30.0.0.0/24') as s:
body = self._router_interface_action('add',
r['router']['id'],
s['subnet']['id'],
None)
port_id = body['port_id']
with self.firewall_group(name='test',
default_policy=False,
ports=[],
admin_state_up=True) as fwg1:
data = {'firewall_group': {'ports': [port_id]}}
req = self.new_update_request(
'firewall_groups', data, fwg1['firewall_group']['id'],
context=context.get_admin_context())
res = self.deserialize(self.fmt,
req.get_response(self.ext_api))
self.assertEqual('FirewallGroupPortInvalidProject',
res['NeutronError']['type'])
self._router_interface_action('remove',
r['router']['id'],
s['subnet']['id'],
None)
def test_update_firewall_group_with_ports_and_polcy(self):
"""neutron firewall_group create test-policy """
with self.router(name='router1', admin_state_up=True,