self._delete_port(context, port['id'])
# clean up subnets
- subnets_qry = context.session.query(models_v2.Subnet)
- subnets_qry.filter_by(network_id=id).delete()
+ subnets = self._get_subnets_by_network(context, id)
+ for subnet in subnets:
+ self.delete_subnet(context, subnet['id'])
+
context.session.delete(network)
def get_network(self, context, id, fields=None):
self._send_update_network(orig_net, context)
return new_subnet
- # NOTE(kevinbenton): workaround for eventlet/mysql deadlock
- @utils.synchronized('bsn-port-barrier')
@put_context_in_serverpool
def delete_subnet(self, context, id):
LOG.debug(_("NeutronRestProxyV2: delete_subnet() called"))
res = self._create_network(fmt=self.fmt, name='net',
admin_state_up=True)
network = self.deserialize(self.fmt, res)
- self._make_subnet(self.fmt, network, gateway_ip, cidr, ip_version=4)
+ subnet = self._make_subnet(self.fmt, network, gateway_ip, cidr,
+ ip_version=4)
req = self.new_delete_request('networks', network['network']['id'])
res = req.get_response(self.api)
self.assertEqual(res.status_int, webob.exc.HTTPNoContent.code)
+ req = self.new_show_request('subnets', subnet['subnet']['id'])
+ res = req.get_response(self.api)
+ self.assertEqual(webob.exc.HTTPNotFound.code, res.status_int)
def test_create_subnet_bad_tenant(self):
with self.network() as network: