.. versionadded:: 2019.2.0

    Return the key-value arguments used for the authentication arguments for
    the netmiko module.

    When running in a non-native NAPALM driver (e.g., ``panos``, `f5``, ``mos`` -
    either from https://github.com/napalm-automation-community or defined in
    user's own environment, one can specify the Netmiko device type (the
    ``device_type`` argument) via the ``netmiko_device_type_map`` configuration
    option / Pillar key, e.g.,

    .. code-block:: yaml

        netmiko_device_type_map:
          f5: f5_ltm
          dellos10: dell_os10

    The configuration above defines the mapping between the NAPALM ``os`` Grain
    and the Netmiko ``device_type``, e.g., when the NAPALM Grain is ``f5``, it
    would use the ``f5_ltm`` SSH Netmiko driver to execute commands over SSH on
    the remote network device.

    CLI Example:

    .. code-block:: bash

        salt '*' napalm.netmiko_args

def netmiko_args(**kwargs):
    '''
    .. versionadded:: 2019.2.0

    Return the key-value arguments used for the authentication arguments for
    the netmiko module.

    When running in a non-native NAPALM driver (e.g., ``panos``, `f5``, ``mos`` -
    either from https://github.com/napalm-automation-community or defined in
    user's own environment, one can specify the Netmiko device type (the
    ``device_type`` argument) via the ``netmiko_device_type_map`` configuration
    option / Pillar key, e.g.,

    .. code-block:: yaml

        netmiko_device_type_map:
          f5: f5_ltm
          dellos10: dell_os10

    The configuration above defines the mapping between the NAPALM ``os`` Grain
    and the Netmiko ``device_type``, e.g., when the NAPALM Grain is ``f5``, it
    would use the ``f5_ltm`` SSH Netmiko driver to execute commands over SSH on
    the remote network device.

    CLI Example:

    .. code-block:: bash

        salt '*' napalm.netmiko_args
    '''
    if not HAS_NETMIKO:
        raise CommandExecutionError('Please install netmiko to be able to use this feature.')
    kwargs = {}
    napalm_opts = salt.utils.napalm.get_device_opts(__opts__, salt_obj=__salt__)
    optional_args = napalm_opts['OPTIONAL_ARGS']
    netmiko_args = _get_netmiko_args(optional_args)
    kwargs['host'] = napalm_opts['HOSTNAME']
    kwargs['username'] = napalm_opts['USERNAME']
    kwargs['password'] = napalm_opts['PASSWORD']
    kwargs['timeout'] = napalm_opts['TIMEOUT']
    kwargs.update(netmiko_args)
    netmiko_device_type_map = {
        'junos': 'juniper_junos',
        'ios': 'cisco_ios',
        'iosxr': 'cisco_xr',
        'eos': 'arista_eos',
        'nxos_ssh': 'cisco_nxos',
        'asa': 'cisco_asa',
        'fortios': 'fortinet',
        'panos': 'paloalto_panos',
        'aos': 'alcatel_aos',
        'vyos': 'vyos',
        'f5': 'f5_ltm',
        'ce': 'huawei',
        's350': 'cisco_s300'
    }
    # If you have a device type that is not listed here, please submit a PR
    # to add it, and/or add the map into your opts/Pillar: netmiko_device_type_map
    # Example:
    #
    # netmiko_device_type_map:
    #   junos: juniper_junos
    #   ios: cisco_ios
    #
    #etc.
    netmiko_device_type_map.update(__salt__['config.get']('netmiko_device_type_map', {}))
    kwargs['device_type'] = netmiko_device_type_map[__grains__['os']]
    return kwargs