Ensure a specific configuration line exists in the running config

    name
        config line to set

    Examples:

    .. code-block:: yaml

        add snmp group:
          onyx.config_present:
            - names:
              - snmp-server community randoSNMPstringHERE group network-operator
              - snmp-server community AnotherRandomSNMPSTring group network-admin

        add snmp acl:
          onyx.config_present:
            - names:
              - snmp-server community randoSNMPstringHERE use-acl snmp-acl-ro
              - snmp-server community AnotherRandomSNMPSTring use-acl snmp-acl-rw

def config_present(name):
    '''
    Ensure a specific configuration line exists in the running config

    name
        config line to set

    Examples:

    .. code-block:: yaml

        add snmp group:
          onyx.config_present:
            - names:
              - snmp-server community randoSNMPstringHERE group network-operator
              - snmp-server community AnotherRandomSNMPSTring group network-admin

        add snmp acl:
          onyx.config_present:
            - names:
              - snmp-server community randoSNMPstringHERE use-acl snmp-acl-ro
              - snmp-server community AnotherRandomSNMPSTring use-acl snmp-acl-rw
    '''
    ret = {'name': name,
           'result': False,
           'changes': {},
           'comment': ''}

    matches = __salt__['onyx.cmd']('find', name)

    if matches:
        ret['result'] = True
        ret['comment'] = 'Config is already set'

    elif __opts__['test'] is True:
        ret['result'] = None
        ret['comment'] = 'Config will be added'
        ret['changes']['new'] = name

    else:
        __salt__['onyx.cmd']('add_config', name)
        matches = __salt__['onyx.cmd']('find', name)
        if matches:
            ret['result'] = True
            ret['comment'] = 'Successfully added config'
            ret['changes']['new'] = name
        else:
            ret['result'] = False
            ret['comment'] = 'Failed to add config'

    return ret