Help required on -xpath_target flag

299 views
Skip to first unread message

chandresh bhatt

unread,
Mar 10, 2021, 5:25:11 AM3/10/21
to sonicproject
Hi,

we are using gnmi_get tool to perform a GET against my Target (SONiC gNMI server).

Command is :
./gnmi_get -insecure -username admin -password password -target_addr 10.x.x.x:8080 -target_name switch -xpath /openconfig-lldp 

Above command is failed:
failed: rpc error: code = Unimplemented desc = No target specified in prefix

Later on we found that we need to use -xpath_target flag for prefix.

Command:
./gnmi_get -insecure -username admin -password password -target_addr 10.x.x.x:8080 -target_name switch -xpath /openconfig-lldp -xpath_target CONFIG_DB

Above command is failed:
flag provided but not defined.

Any help on this ? OR how to provide the prefix in ./gnmi_get command ? Can we provide the prefix in the path itself ? If yes then please provide the example.





Sachin Holla

unread,
Mar 10, 2021, 8:44:27 AM3/10/21
to chandresh bhatt, sonicproject
Hi Chandresh,

Use xpath "/openconfig-lldp:lldp" to get the full lldp yang data tree. Xpaths with just yang module prefix is not supported. It should point to a yang data node.

gnmi_get -insecure -username admin -password password -target_addr localhost:8080 -target_name switch -xpath /openconfig-lldp:lldp


--
You received this message because you are subscribed to the Google Groups "sonicproject" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonicproject...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonicproject/ee64520e-4891-437d-9001-29e826e8970dn%40googlegroups.com.

This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.

Masaru OKI

unread,
Mar 10, 2021, 6:13:25 PM3/10/21
to chandresh bhatt, sonicproject
Try -xpath_target openconfig


2021年3月10日(水) 19:25 chandresh bhatt <chandre...@gmail.com>:

santosh kumar panda

unread,
Mar 17, 2021, 6:13:27 AM3/17/21
to sonicproject
I am facing the same issue when tried with -xpath_target openconfig and CONFIG_DB

./gnmi_get -xpath /openconfig-interfaces -target_addr 10.x.x.x:8080 -target_name hostname  -alsologtostderr -insecure true -pretty -xpath_target openconfig

== GetRequest:

 path: <

  elem: <

    name: "openconfig-lldp"

  >

>

encoding: JSON_IETF


F0317 15:42:09.237367   92919 gnmi_get.go:130] Get failed: rpc error: code = Unimplemented desc = No target specified in prefix



Also I have tried by providing exert yang data node but I got error in parsing the xpath.

./gnmi_get -xpath /openconfig-lldp:lldp/interfaces  -target_addr 10.x.x.x:8080 -target_name hostname -alsologtostderr -insecure true -pretty -xpath_target openconfig

F0317 15:36:46.529255   90999 gnmi_get.go:103] error in parsing xpath "/openconfig-lldp:lldp/interfaces " to gnmi path 

Please suggest how to proceed with this. 

Eric Seifert

unread,
Mar 17, 2021, 11:55:06 AM3/17/21
to sonicp...@googlegroups.com

Try:

./gnmi_get -xpath /openconfig-interfaces:interfaces -target_addr 127.0.0.1:8080 -target_name hostname  -alsologtostderr -insecure true -pretty -xpath_target openconfig
== getRequest:
prefix: <
>
path: <
  elem: <
    name: "openconfig-interfaces:interfaces"
  >
>
encoding: JSON_IETF

== getResponse:
notification: <
  timestamp: 1615996387251210700
  prefix: <
  >
  update: <
    path: <
      elem: <
        name: "openconfig-interfaces:interfaces"
      >
    >
    val: <

      json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"config\":{\"description\":\"\",\"enabled\":false,\"mtu\":9100,\"name\":\"Ethernet0\",\"type\":\"iana-if-type:ethernetCsmacd\"},\"name\":\"Ethernet0\",\"openconfig-if-ethernet:ethernet\":{\"config\":{\"openconfig-if-ethernet-ext2:port-fec\":\"openconfig-platform-types:FEC_DISABLED\",\"port-speed\":\"openconfig-if-ethernet:SPEED_100GB\"},\"state\":{\"counters\":{\"in-fragment-frames\":\"0\",\"in-jabber-frames\":\"0\",\"in-oversize-frames\":\"0\",\"in-undersize-frames\":\"0\",\"openconfig-if-ethernet-ext2:eth-in-distribution\":{\"in-frames-1024-1518-octets\":\"0\",\"in-frames-128-255-octets\":\"0\",\"in-frames-1519-2047-octets\":\"0\",\"in-frames

...

Serdar Vural

unread,
Feb 16, 2022, 12:52:34 PM2/16/22
to sonicproject
Hello,

I'm getting an issue perhaps similar to this: 

gnmi_get -insecure -username admin -password sonic -target_addr 127.0.0.1:8080 -target_name switch -xpath /openconfig-interfaces:interfaces -xpath_target openconfig

flag provided but not defined: -xpath_target

What could be the issue? Could you let me know which gNMI client to use? (maybe I'm using an outdated one - followed this here: https://github.com/Azure/sonic-telemetry/blob/master/doc/gNMI_usage_examples.md)

Cheers
Serdar
Reply all
Reply to author
Forward
0 new messages