Update a nictag

    name : string
        name of nictag
    mac : string
        optional new mac for nictag
    mtu : int
        optional new MTU for nictag

    CLI Example:

    .. code-block:: bash

        salt '*' nictagadm.update trunk mtu=9000

def update(name, mac=None, mtu=None):
    '''
    Update a nictag

    name : string
        name of nictag
    mac : string
        optional new mac for nictag
    mtu : int
        optional new MTU for nictag

    CLI Example:

    .. code-block:: bash

        salt '*' nictagadm.update trunk mtu=9000
    '''
    ret = {}

    if name not in list_nictags():
        return {'Error': 'nictag {0} does not exists.'.format(name)}
    if not mtu and not mac:
        return {'Error': 'please provide either mac or/and mtu.'}
    if mtu:
        if mtu > 9000 or mtu < 1500:
            return {'Error': 'mtu must be a value between 1500 and 9000.'}
    if mac:
        if mac == 'etherstub':
            return {'Error': 'cannot update a nic with "etherstub".'}
        else:
            cmd = 'dladm show-phys -m -p -o address'
            res = __salt__['cmd.run_all'](cmd)
            # dladm prints '00' as '0', so account for that.
            if mac.replace('00', '0') not in res['stdout'].splitlines():
                return {'Error': '{0} is not present on this system.'.format(mac)}

    if mac and mtu:
        properties = "mtu={0},mac={1}".format(mtu, mac)
    elif mac:
        properties = "mac={0}".format(mac) if mac else ""
    elif mtu:
        properties = "mtu={0}".format(mtu) if mtu else ""

    cmd = 'nictagadm update -p {0} {1}'.format(properties, name)
    res = __salt__['cmd.run_all'](cmd)

    if res['retcode'] == 0:
        return True
    else:
        return {'Error': 'failed to update nictag.' if 'stderr' not in res and res['stderr'] == '' else res['stderr']}