]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Merge "prevent deletion of router interface if it is needed by a floating ip"
authorJenkins <jenkins@review.openstack.org>
Sat, 1 Dec 2012 03:01:25 +0000 (03:01 +0000)
committerGerrit Code Review <review@openstack.org>
Sat, 1 Dec 2012 03:01:25 +0000 (03:01 +0000)
1  2 
quantum/db/l3_db.py
quantum/extensions/l3.py
quantum/tests/unit/test_l3_plugin.py

Simple merge
Simple merge
index 787d10e3adbd7c8b0fe2320ac4d85c8fc982e884,d588e1ff6a3c73c77eea8609b3c027f1a0d28d0e..5f252c3cf683e41f0c48883f919264f74d8d7391
@@@ -1095,10 -1025,37 +1095,37 @@@ class L3NatDBTestCase(test_db_plugin.Qu
  
      def test_create_floatingip_invalid_fixed_ip_address_returns_400(self):
          # API-level test - no need to create all objects for l3 plugin
 -        res = self._create_floatingip('json', utils.str_uuid(),
 -                                      utils.str_uuid(), 'iamnotnanip')
 +        res = self._create_floatingip('json', uuidutils.generate_uuid(),
 +                                      uuidutils.generate_uuid(), 'iamnotnanip')
          self.assertEqual(res.status_int, 400)
  
+     def test_floatingip_delete_router_intf_with_subnet_id_returns_409(self):
+         found = False
+         with self.floatingip_with_assoc() as fip:
+             for p in self._list('ports')['ports']:
+                 if p['device_owner'] == 'network:router_interface':
+                     subnet_id = p['fixed_ips'][0]['subnet_id']
+                     router_id = p['device_id']
+                     self._router_interface_action(
+                         'remove', router_id, subnet_id, None,
+                         expected_code=exc.HTTPConflict.code)
+                     found = True
+                     break
+         self.assertTrue(found)
+     def test_floatingip_delete_router_intf_with_port_id_returns_409(self):
+         found = False
+         with self.floatingip_with_assoc() as fip:
+             for p in self._list('ports')['ports']:
+                 if p['device_owner'] == 'network:router_interface':
+                     router_id = p['device_id']
+                     self._router_interface_action(
+                         'remove', router_id, None, p['id'],
+                         expected_code=exc.HTTPConflict.code)
+                     found = True
+                     break
+         self.assertTrue(found)
      def test_list_nets_external(self):
          with self.network() as n1:
              self._set_net_external(n1['network']['id'])