'Tests that we continue to gracefully delete the network even if
a neutron:dhcp-owned port was deleted concurrently.'

def test_delete_network_port_exists_owned_by_network_port_not_found(self):

    res = self._create_network(fmt=self.fmt, name='net', admin_state_up=True)
    network = self.deserialize(self.fmt, res)
    network_id = network['network']['id']
    self._create_port(self.fmt, network_id, device_owner=constants.DEVICE_OWNER_DHCP)
    plugin = directory.get_plugin()
    orig_delete = plugin.delete_port
    def fake_delete_port(context, id):
        self.assertIsNone(orig_delete(context, id))
        raise lib_exc.PortNotFound(port_id=id)
    p = mock.patch.object(plugin, 'delete_port')
    mock_del_port = p.start()
    mock_del_port.side_effect = fake_delete_port
    req = self.new_delete_request('networks', network_id)
    res = req.get_response(self.api)
    self.assertEqual(webob.exc.HTTPNoContent.code, res.status_int)
