

def delete_vpn_connection(context, vpn_connection_id):
    vpn_connection = ec2utils.get_db_item(context, vpn_connection_id)
    with common.OnCrashCleaner() as cleaner:
        db_api.delete_item(context, vpn_connection['id'])
        cleaner.addCleanup(db_api.restore_item, context, 'vpn', vpn_connection)
        neutron = clients.neutron(context)
        _stop_vpn_connection(neutron, vpn_connection)
        try:
            neutron.delete_ipsecpolicy(vpn_connection['os_ipsecpolicy_id'])
        except neutron_exception.Conflict as ex:
            LOG.warning(_('Failed to delete ipsecoplicy %(os_id)s during deleting VPN connection %(id)s. Reason: %(reason)s'), {
                'id': vpn_connection['id'],
                'os_id': vpn_connection['os_ipsecpolicy_id'],
                'reason': ex.message,
            })
        except neutron_exception.NotFound:
            pass
        try:
            neutron.delete_ikepolicy(vpn_connection['os_ikepolicy_id'])
        except neutron_exception.Conflict as ex:
            LOG.warning(_('Failed to delete ikepolicy %(os_id)s during deleting VPN connection %(id)s. Reason: %(reason)s'), {
                'id': vpn_connection['id'],
                'os_id': vpn_connection['os_ikepolicy_id'],
                'reason': ex.message,
            })
        except neutron_exception.NotFound:
            pass
    return True

dataset/ETHPy150Open openstack/ec2-api/ec2api/api/vpn_connection.py delete_vpn_connection/original