Method: Rbeapi::Netdev::Snmp#snmp_users
- Defined in:
- lib/rbeapi/netdev/snmp.rb
#snmp_users ⇒ Array<Hash<Symbol,Object>>
snmp_users retrieves all of the SNMP users defined on the target device and returns an Array of Hash objects suitable for use as a resource hash to the provider’s initializer method.
198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/rbeapi/netdev/snmp.rb', line 198 def snmp_users cmd = 'show snmp user' result = node.enable(cmd) text = result.first[:result]['output'] users = parse_snmp_users(text) users.each do |h| cmd = "snmp-server user #{h[:name]} #{h[:roles]} #{h[:version]}" password = snmp_user_password_hash(config, cmd)[:auth] h[:password] = password if password end end |