google / gnxi

gNXI Tools - gRPC Network Management/Operations Interface Tools
Apache License 2.0
260 stars 115 forks source link

gnmi get is giving metadata credentials not present though notls is given and tls has been disabled on device i am accessing #260

Closed sandeepabvp closed 3 years ago

sandeepabvp commented 3 years ago

./gnmi_get -target_name "device_name" -xpath "/interfaces/interface[name=Ethernet16]" -target_addr "@IP:32767 -alsologtostderr -notls true

or

./gnmi_get -target_name "device_name" -xpath "/interfaces/interface[name=Ethernet16]" -target_addr "@IP:32767 -alsologtostderr -insecure true

or

(though notls and insecure was given i tried below) ./gnmi_get -target_name "device_name" -xpath "/interfaces/interface[name=Ethernet16]" -target_addr "@IP:32767 -alsologtostderr -notls true -insecure true -username ''username" -password "password"

all the above are giving same result as below

== GetRequest: path: < elem: < name: "interfaces"

elem: < name: "interface" key: < key: "name" value: "Ethernet16"

encoding: JSON_IETF

F0204 13:12:23.567015 25776 gnmi_get.go:130] Get failed: rpc error: code = Unauthenticated desc = gNMI: get: metadata credentials not present

Am i sending anyparmeters wrong or doing anything wrong?

hellt commented 3 years ago

you are not providing credentials (username and passwd)

sandeepabvp commented 3 years ago

i did in 3 rd command

its device credentials which i am providing

hellt commented 3 years ago

ah, sorry. you can try other clients to eliminate the problem with the gNMI target, for example http://gnmic.kmrd.dev

the command would be:

gnmic -a ip:32767 --insecure -u username -p password get --path "/interfaces/interface[name=Ethernet16]" 
sandeepabvp commented 3 years ago

thank you for responding but below is the error i am getting if gnmic is used

cmd == gnmic -a ip:32767 --insecure -u uname -p pwd get --path "Cisco-IOS-XR-ethernet-lldp-oper:lldp/nodes" --log

output rpc error: code = Unimplemented desc = gNMI: unsupported get-request encoding: JSON

which is supported as said by capabilities output for capabilites command gnmic -a ip:32767 -u uname -p pwd --insecure capabilities | grep lldp Capabilities Response:

what may be wrong

hellt commented 3 years ago

That's the encoding that's not supported Check what is reported by capabilities with regards to supported encodings

If memory serves me well you need to supply either -e json_ietf or -e proto with iosxr

On Thu, 4 Feb 2021, 23:03 Sandeep, notifications@github.com wrote:

thank you for responding but below is the error i am getting if gnmic is used

cmd == gnmic -a ip:32767 --insecure -u uname -p pwd get --path "Cisco-IOS-XR-ethernet-lldp-oper:lldp/nodes" --log

output rpc error: code = Unimplemented desc = gNMI: unsupported get-request encoding: JSON

which is supported as said by capabilities output for capabilites command gnmic -a ip:32767 -u uname -p pwd --insecure capabilities | grep lldp Capabilities Response:

  • Cisco-IOS-XR-ethernet-lldp-oper, Cisco Systems, Inc., 2019-04-05
  • Cisco-IOS-XR-ethernet-lldp-oper-sub1, Cisco Systems, Inc., 2019-04-05
  • Cisco-IOS-XR-ethernet-lldp-oper-sub2, Cisco Systems, Inc., 2019-04-05
  • openconfig-lldp, OpenConfig working group, 0.1.0
  • Cisco-IOS-XR-ethernet-lldp-cfg, Cisco Systems, Inc., 2019-04-05
  • openconfig-lldp-types, OpenConfig working group, 0.1.0
  • cisco-xr-openconfig-lldp-deviations, Cisco Systems, Inc., 2017-03-08

what may be wrong

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/google/gnxi/issues/260#issuecomment-773632615, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLKV5N4SBILNNFP6C6DDQDS5MKRVANCNFSM4XDPKAOA .

sandeepabvp commented 3 years ago

Thank you very much its working with json_ietf

samribeiro commented 3 years ago

This has been fixed in the latest commit. Credentials are now attached to the session context.