Configure specified adapter to use ipv4 manual settings

    Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.

    :param str interface: interface label
    :param str address: ipv4 address
    :param str netmask: ipv4 netmask
    :param str gateway: ipv4 gateway
    :param str nameservers: list of nameservers servers separated by spaces (Optional)
    :return: True if the settings were applied, otherwise an exception will be thrown.
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' ip.set_static_all interface-label address netmask gateway nameservers

def set_static_all(interface, address, netmask, gateway, nameservers=None):
    '''
    Configure specified adapter to use ipv4 manual settings

    Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.

    :param str interface: interface label
    :param str address: ipv4 address
    :param str netmask: ipv4 netmask
    :param str gateway: ipv4 gateway
    :param str nameservers: list of nameservers servers separated by spaces (Optional)
    :return: True if the settings were applied, otherwise an exception will be thrown.
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' ip.set_static_all interface-label address netmask gateway nameservers
    '''
    validate, msg = _validate_ipv4([address, netmask, gateway])
    if not validate:
        raise salt.exceptions.CommandExecutionError(msg)
    if nameservers:
        validate, msg = _space_delimited_list(nameservers)
        if not validate:
            raise salt.exceptions.CommandExecutionError(msg)
        if not isinstance(nameservers, list):
            nameservers = nameservers.split(' ')
    if __grains__['lsb_distrib_id'] == 'nilrt':
        initial_mode = _get_adapter_mode_info(interface)
        _save_config(interface, 'Mode', 'TCPIP')
        _save_config(interface, 'dhcpenabled', '0')
        _save_config(interface, 'linklocalenabled', '0')
        _save_config(interface, 'IP_Address', address)
        _save_config(interface, 'Subnet_Mask', netmask)
        _save_config(interface, 'Gateway', gateway)
        if nameservers:
            _save_config(interface, 'DNS_Address', nameservers[0])
        if initial_mode == 'ethercat':
            __salt__['system.set_reboot_required_witnessed']()
        else:
            _restart(interface)
        return True
    service = _interface_to_service(interface)
    if not service:
        if interface in pyiface.getIfaces():
            return _configure_static_interface(interface, **{'ip': address,
                                                             'dns': ','.join(nameservers) if nameservers else '',
                                                             'netmask': netmask, 'gateway': gateway})
        raise salt.exceptions.CommandExecutionError('Invalid interface name: {0}'.format(interface))
    service = pyconnman.ConnService(os.path.join(SERVICE_PATH, service))
    ipv4 = service.get_property('IPv4.Configuration')
    ipv4['Method'] = dbus.String('manual', variant_level=1)
    ipv4['Address'] = dbus.String('{0}'.format(address), variant_level=1)
    ipv4['Netmask'] = dbus.String('{0}'.format(netmask), variant_level=1)
    ipv4['Gateway'] = dbus.String('{0}'.format(gateway), variant_level=1)
    try:
        service.set_property('IPv4.Configuration', ipv4)
        if nameservers:
            service.set_property('Nameservers.Configuration', [dbus.String('{0}'.format(d)) for d in nameservers])
    except Exception as exc:
        exc_msg = 'Couldn\'t set manual settings for service: {0}\nError: {1}\n'.format(service, exc)
        raise salt.exceptions.CommandExecutionError(exc_msg)
    return True