def authentication
      hash = {}
      hash[:auth_type] = default_authentication_auth_type
      hash[:key_type] = default_authentication_key_type
      hash[:enc_type] = default_authentication_enc_type
      hash[:password] = default_authentication_string
      hash[:compat] = default_authentication_compatibility
      hash[:timeout] = default_authentication_timeout
      str = config_get('interface_hsrp_group', 'authentication', @get_args)
      return hash if str.nil?
      regexp = Regexp.new('(?<authtype>text|md5)'\
           ' *(?<keytype>key-chain|key-string|\S+)'\
           ' *(?<enctype>7|\S+)?'\
           ' *(?<keystring>\S+)?')
      params = regexp.match(str)
      if params[:authtype] == 'text'
        hash[:password] = params[:keytype]
      else
        hash[:auth_type] = 'md5'
        hash[:key_type] = params[:keytype]
        if hash[:key_type] == 'key-chain'
          hash[:password] = params[:enctype]
        else
          if params[:enctype] == '7' && params[:keystring].nil?
            hash[:password] = '7'
          elsif params[:enctype] == '7' && !params[:keystring].nil?
            hash[:enc_type] = '7'
            hash[:password] = params[:keystring]
          else
            hash[:password] = params[:enctype]
          end
          # get rid of password from str just in case the password is
          # compatibility or timeout
          str.sub!(hash[:password], '')
          hash[:compat] = true if str.include?('compatibility')
          hash[:timeout] = str.split.last.to_i if str.include?('timeout')
        end
      end
      hash
    end
def authentication
      hash = {}
      hash[:auth_type] = default_authentication_auth_type
      hash[:key_type] = default_authentication_key_type
      hash[:enc_type] = default_authentication_enc_type
      hash[:password] = default_authentication_string
      hash[:compat] = default_authentication_compatibility
      hash[:timeout] = default_authentication_timeout
      str = config_get('interface_hsrp_group', 'authentication', @get_args)
      return hash if str.nil?
      regexp = Regexp.new('(?<authtype>text|md5)'\
           ' *(?<keytype>key-chain|key-string|\S+)'\
           ' *(?<enctype>7|\S+)?'\
           ' *(?<keystring>\S+)?')
      params = regexp.match(str)
      if params[:authtype] == 'text'
        hash[:password] = params[:keytype]
      else
        hash[:auth_type] = 'md5'
        hash[:key_type] = params[:keytype]
        if hash[:key_type] == 'key-chain'
          hash[:password] = params[:enctype]
        else
          if params[:enctype] == '7' && params[:keystring].nil?
            hash[:password] = '7'
          elsif params[:enctype] == '7' && !params[:keystring].nil?
            hash[:enc_type] = '7'
            hash[:password] = params[:keystring]
          else
            hash[:password] = params[:enctype]
          end
          # get rid of password from str just in case the password is
          # compatibility or timeout
          str.sub!(hash[:password], '')
          hash[:compat] = true if str.include?('compatibility')
          hash[:timeout] = str.split.last.to_i if str.include?('timeout')
        end
      end
      hash
    end
PROPERTIES                      

 This CLI is very complicated, it can take many forms
 authentication text Test
 authentication md5 key-chain abcd
 authentication md5 key-string 7 => 7 is key-string
 authentication md5 key-string 7 12345678901234567890
 authentication md5 key-string ABCXYZ => enctype is 0
 authentication md5 key-string ABCXYZ compatibility
 authentication md5 key-string ABCXYZ compatibility timeout 22
 authentication md5 key-string ABCXYZ timeout 22
 authentication md5 key-string 7 12345678901234567890 timeout 22
 authentication md5 key-string 7 123456789 compatibility timeout 22
 if passwd
   req auth_enc_type
 if encrypted
   req authentication_key_type, authentication_enc_type
   if key-string
     optional compat and timeout