aristanetworks / goeapi

Go library for Arista's eAPI command API implementation
BSD 3-Clause "New" or "Revised" License
46 stars 31 forks source link

Users module issue with SSHKey #49

Closed sriram-fastly closed 2 years ago

sriram-fastly commented 2 years ago

Unable to obtain SSHKeys using the provided module Users.

I am trying to make use of the Arista goeapi (https://github.com/aristanetworks/goeapi)

While working with the module.Users, i see that the regular expressions used to parse the running config to build UserConfig uses sshkey  Refer : https://github.com/aristanetworks/goeapi/blob/master/module/users.go#L57 https://github.com/aristanetworks/goeapi/blob/master/module/users.go#L220 https://github.com/aristanetworks/goeapi/blob/master/module/users.go#L366-L374

I am using  EOS version 4.25.2Fand with this version, the sshkey is not a keyword that is seen in the running config or with the eos commands. While working with the EOS version 4.25 +. the regex should be using ssh-key instead of sshkey. Looks like a change between Arista EOS versions that is not captured in code.

Sample from running config beyond EOS 4.25.x

username test-user ssh-key ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC6FMb/x8E8WJ4KOZjm4uMF23FoxA7KQuIxr7nsKUTEE6i9WjAxo1v3t5Nffu5Qc2iD783BCKQSr3A9QuZ141Tsqu3ufkKLyio//ufVBrgKNYfn3h+8+1DbdUt5gqcbb2eTpxuaUjSweCesjvCUqR+YwdfIj1DGfUOtDsu1FgZx+IUaYC/0rEETbnlTSvrtgG7GU1QbqRBGPYm02e+asdasYLCQfvpy86y6fk3coY72JuKNR6IEmKWl9Kcd/6RZiIHVAWAybYkrYsNGZKzqQm0l0rN0+yF5kXjyeImJWqaAHfnaFVJCpW7kEUT5CoTivlGyCKYWSfjwi/lSGdbWu1Vf87uvfHe5ojB0z9hragbRoRj2d6IzKiuGMoWuvq2QooUed0R58b5bBqMvI3xONiUKRaa/a4YxBUHjpj+xD6zKVgmge2hrnEf6sASIf36BRXqFIXIXNJgSgSvrIdQN0ut6lNbNrG+JF+7KkNCG0krxvZRp55A3CsF6MB/G+GEw1ccXU= test-user@mars