Deletes the given virtual network from OpenNebula. Either a name or a vn_id must
    be supplied.

    .. versionadded:: 2016.3.0

    name
        The name of the virtual network to delete. Can be used instead of ``vn_id``.

    vn_id
        The ID of the virtual network to delete. Can be used instead of ``name``.

    CLI Example:

    .. code-block:: bash

        salt-cloud -f vn_delete opennebula name=my-virtual-network
        salt-cloud --function vn_delete opennebula vn_id=3

def vn_delete(call=None, kwargs=None):
    '''
    Deletes the given virtual network from OpenNebula. Either a name or a vn_id must
    be supplied.

    .. versionadded:: 2016.3.0

    name
        The name of the virtual network to delete. Can be used instead of ``vn_id``.

    vn_id
        The ID of the virtual network to delete. Can be used instead of ``name``.

    CLI Example:

    .. code-block:: bash

        salt-cloud -f vn_delete opennebula name=my-virtual-network
        salt-cloud --function vn_delete opennebula vn_id=3
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The vn_delete function must be called with -f or --function.'
        )

    if kwargs is None:
        kwargs = {}

    name = kwargs.get('name', None)
    vn_id = kwargs.get('vn_id', None)

    if vn_id:
        if name:
            log.warning(
                'Both the \'vn_id\' and \'name\' arguments were provided. '
                '\'vn_id\' will take precedence.'
            )
    elif name:
        vn_id = get_vn_id(kwargs={'name': name})
    else:
        raise SaltCloudSystemExit(
            'The vn_delete function requires a \'name\' or a \'vn_id\' '
            'to be provided.'
        )

    server, user, password = _get_xml_rpc()
    auth = ':'.join([user, password])
    response = server.one.vn.delete(auth, int(vn_id))

    data = {
        'action': 'vn.delete',
        'deleted': response[0],
        'vn_id': response[1],
        'error_code': response[2],
    }

    return data