Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gnmi set request error #20

Open
piyeng opened this issue Oct 11, 2021 · 50 comments
Open

gnmi set request error #20

piyeng opened this issue Oct 11, 2021 · 50 comments
Assignees

Comments

@piyeng
Copy link

piyeng commented Oct 11, 2021

Hello,

I am trying to understand the gNMI interface implementation in SONiC.
I built a private SONiC image based of the 202012 branch with TELEMETRY_WRITABLE=y.

Noticed the following error seen in the logs when the telemetry docker is started.
libyang[0]: Failed to find "autoneg" as a sibling to "sonic-port:ifname".

Oct 11 20:34:15.272884 sonic INFO telemetry#/supervisord: telemetry Traceback (most recent call last):
Oct 11 20:34:15.272884 sonic INFO telemetry#/supervisord: telemetry   File "/usr/local/bin/sonic-cfggen", line 431, in <module>
Oct 11 20:34:15.272884 sonic INFO telemetry#/supervisord: telemetry     main()
Oct 11 20:34:15.272884 sonic INFO telemetry#/supervisord: telemetry   File "/usr/local/bin/sonic-cfggen", line 396, in main
Oct 11 20:34:15.272884 sonic INFO telemetry#/supervisord: telemetry     template_data = template.render(data)
Oct 11 20:34:15.272884 sonic INFO telemetry#/supervisord: telemetry   File "/usr/local/lib/python3.7/dist-packages/jinja2/environment.py", line 1304, in render
Oct 11 20:34:15.272884 sonic INFO telemetry#/supervisord: telemetry     self.environment.handle_exception()
Oct 11 20:34:15.272884 sonic INFO telemetry#/supervisord: telemetry   File "/usr/local/lib/python3.7/dist-packages/jinja2/environment.py", line 925, in handle_exception
Oct 11 20:34:15.272884 sonic INFO telemetry#/supervisord: telemetry     raise rewrite_traceback_stack(source=source)
Oct 11 20:34:15.272884 sonic INFO telemetry#/supervisord: telemetry   File "/usr/share/sonic/templates/telemetry_vars.j2", line 2, in top-level template code
Oct 11 20:34:15.272957 sonic INFO telemetry#/supervisord: telemetry     "certs": {% if "certs" in TELEMETRY.keys() %}{{ TELEMETRY["certs"] }}{% else %}""{% endif %},
Oct 11 20:34:15.272957 sonic INFO telemetry#/supervisord: telemetry   File "/usr/local/lib/python3.7/dist-packages/jinja2/environment.py", line 474, in getattr
Oct 11 20:34:15.272957 sonic INFO telemetry#/supervisord: telemetry     return getattr(obj, attribute)
Oct 11 20:34:15.272974 sonic INFO telemetry#/supervisord: telemetry jinja2.exceptions.UndefinedError: 'TELEMETRY' is undefined
Oct 11 20:34:15.338110 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.337695      18 util.go:172] Current Values of CVL Configuration File map[LOGTOSTDERR:false SKIP_SEMANTIC_VALIDATION:false SKIP_VALIDATION:false STDERRTHRESHOLD:ERROR TRACE_CACHE:false TRACE_CREATE:false TRACE_DELETE:false TRACE_LIBYANG:false TRACE_ONERROR:true TRACE_SEMANTIC:false TRACE_SYNTAX:false TRACE_UPDATE:false TRACE_YPARSER:false VERBOSITY:0 __comment1__:Log trace data when error occurs __comment2__:Set LOGTOSTDER to 'true' to log on standard error __comment3__:Display log upto INFO level __comment4__:Display log upto INFO level 8]
Oct 11 20:34:15.338110 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.337763      18 util.go:172] Current Values of CVL Configuration File map[LOGTOSTDERR:false SKIP_SEMANTIC_VALIDATION:false SKIP_VALIDATION:false STDERRTHRESHOLD:ERROR TRACE_CACHE:false TRACE_CREATE:false TRACE_DELETE:false TRACE_LIBYANG:false TRACE_ONERROR:true TRACE_SEMANTIC:false TRACE_SYNTAX:false TRACE_UPDATE:false TRACE_YPARSER:false VERBOSITY:0 __comment1__:Log trace data when error occurs __comment2__:Set LOGTOSTDER to 'true' to log on standard error __comment3__:Display log upto INFO level __comment4__:Display log upto INFO level 8]
Oct 11 20:34:15.348938 sonic INFO telemetry#/supervisord: telemetry libyang[0]: Failed to find "autoneg" as a sibling to "sonic-port:ifname".
Oct 11 20:34:15.348938 sonic INFO telemetry#/supervisord: telemetry E1011 20:34:15.348653      18 util.go:176] Failed to create leaf nodes, data = [0xc000388320 0xc000388340 0xc000388380 0xc0003883c0 0xc0003883e0 0xc000388400 0xc000388420 0xc000388440 0xc000388460]
Oct 11 20:34:15.473184 sonic INFO telemetry#/supervisord: telemetry Yang modles path: /usr/models/yang/
Oct 11 20:34:15.473535 sonic INFO telemetry#/supervisord: telemetry Yang model List: [sonic-acl.yang sonic-common.yang sonic-extension.yang sonic-extensions.yang sonic-interface.yang sonic-port.yang openconfig-acl.yang openconfig-acl-annot.yang]
Oct 11 20:34:15.494853 sonic INFO telemetry#/supervisord: telemetry Found version 1.0.2 for yang module openconfig-acl
Oct 11 20:34:15.519103 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.518715      18 app_interface.go:99] Registering for path =/openconfig-acl:acl
Oct 11 20:34:15.519103 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.518729      18 app_interface.go:99] Registering for path =/sonic-
Oct 11 20:34:15.519103 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.518734      18 app_interface.go:99] Registering for path =*
Oct 11 20:34:15.519138 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.518742      18 intf_app.go:93] Init called for INTF module
Oct 11 20:34:15.519138 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.518747      18 app_interface.go:99] Registering for path =/openconfig-interfaces:interfaces
Oct 11 20:34:15.519164 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.518754      18 lldp_app.go:61] Init called for LLDP modules module
Oct 11 20:34:15.519164 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.518758      18 app_interface.go:99] Registering for path =/openconfig-lldp:lldp
Oct 11 20:34:15.519164 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.518765      18 pfm_app.go:42] Init called for Platform module
Oct 11 20:34:15.519164 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.518769      18 app_interface.go:99] Registering for path =/openconfig-platform:components
Oct 11 20:34:15.580043 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.579564      18 sys_app.go:45] SysApp: Init called for System module
Oct 11 20:34:15.580043 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.579599      18 app_interface.go:99] Registering for path =/openconfig-system:system
Oct 11 20:34:15.580449 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.579762      18 version.go:144] *** Yang bundle version = 1.0.0
Oct 11 20:34:15.580449 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.579786      18 version.go:145] *** Yang base version   = 1.0.0
Oct 11 20:34:15.580494 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.579795      18 app_interface.go:99] Registering for path =/ietf-yang-library:modules-state
Oct 11 20:34:15.582834 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.582553      18 telemetry.go:47] client_auth not provided, using defaults.
Oct 11 20:34:15.583207 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.582803      18 server.go:147] Created Server on localhost:8080, read-only: false
Oct 11 20:34:15.583207 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.582815      18 telemetry.go:140] Auth Modes: %!(EXTRA gnmi.AuthTypes=password jwt )
Oct 11 20:34:15.583225 sonic INFO telemetry#/supervisord: telemetry I1011 20:34:15.582832      18 telemetry.go:141] Starting RPC server on address: localhost:8080
Oct 11 20:34:17.620573 sonic INFO telemetry#/supervisord: dialout I1011 20:34:17.620185      48 util.go:172] Current Values of CVL Configuration File map[LOGTOSTDERR:false SKIP_SEMANTIC_VALIDATION:false SKIP_VALIDATION:false STDERRTHRESHOLD:ERROR TRACE_CACHE:false TRACE_CREATE:false TRACE_DELETE:false TRACE_LIBYANG:false TRACE_ONERROR:true TRACE_SEMANTIC:false TRACE_SYNTAX:false TRACE_UPDATE:false TRACE_YPARSER:false VERBOSITY:0 __comment1__:Log trace data when error occurs __comment2__:Set LOGTOSTDER to 'true' to log on standard error __comment3__:Display log upto INFO level __comment4__:Display log upto INFO level 8]
Oct 11 20:34:17.620573 sonic INFO telemetry#/supervisord: dialout I1011 20:34:17.620278      48 util.go:172] Current Values of CVL Configuration File map[LOGTOSTDERR:false SKIP_SEMANTIC_VALIDATION:false SKIP_VALIDATION:false STDERRTHRESHOLD:ERROR TRACE_CACHE:false TRACE_CREATE:false TRACE_DELETE:false TRACE_LIBYANG:false TRACE_ONERROR:true TRACE_SEMANTIC:false TRACE_SYNTAX:false TRACE_UPDATE:false TRACE_YPARSER:false VERBOSITY:0 __comment1__:Log trace data when error occurs __comment2__:Set LOGTOSTDER to 'true' to log on standard error __comment3__:Display log upto INFO level __comment4__:Display log upto INFO level 8]
Oct 11 20:34:17.630024 sonic INFO telemetry#/supervisord: dialout libyang[0]: Failed to find "autoneg" as a sibling to "sonic-port:ifname".
Oct 11 20:34:17.630024 sonic INFO telemetry#/supervisord: dialout E1011 20:34:17.629819      48 util.go:176] Failed to create leaf nodes, data = [0xc00031a320 0xc00031a340 0xc00031a380 0xc00031a3c0 0xc00031a3e0 0xc00031a400 0xc00031a420 0xc00031a440 0xc00031a460]
Oct 11 20:34:17.652059 sonic INFO systemd[1]: telemetry.service: Scheduled restart job, restart counter is at 1.
Oct 11 20:34:17.652392 sonic INFO systemd[1]: telemetry.timer: Succeeded.
Oct 11 20:34:17.785109 sonic INFO telemetry#/supervisord: dialout Yang modles path: /usr/models/yang/
Oct 11 20:34:17.785518 sonic INFO telemetry#/supervisord: dialout Yang model List: [sonic-acl.yang sonic-common.yang sonic-extension.yang sonic-extensions.yang sonic-interface.yang sonic-port.yang openconfig-acl.yang openconfig-acl-annot.yang]
Oct 11 20:34:17.806767 sonic INFO telemetry#/supervisord: dialout Found version 1.0.2 for yang module openconfig-acl
Oct 11 20:34:17.827176 sonic INFO telemetry#/supervisord: dialout I1011 20:34:17.826806      48 app_interface.go:99] Registering for path =/openconfig-acl:acl
Oct 11 20:34:17.827176 sonic INFO telemetry#/supervisord: dialout I1011 20:34:17.826825      48 app_interface.go:99] Registering for path =/sonic-
Oct 11 20:34:17.827176 sonic INFO telemetry#/supervisord: dialout I1011 20:34:17.826831      48 app_interface.go:99] Registering for path =*
Oct 11 20:34:17.827176 sonic INFO telemetry#/supervisord: dialout I1011 20:34:17.826842      48 intf_app.go:93] Init called for INTF module
Oct 11 20:34:17.827176 sonic INFO telemetry#/supervisord: dialout I1011 20:34:17.826847      48 app_interface.go:99] Registering for path =/openconfig-interfaces:interfaces
Oct 11 20:34:17.827176 sonic INFO telemetry#/supervisord: dialout I1011 20:34:17.826857      48 lldp_app.go:61] Init called for LLDP modules module
Oct 11 20:34:17.827176 sonic INFO telemetry#/supervisord: dialout I1011 20:34:17.826864      48 app_interface.go:99] Registering for path =/openconfig-lldp:lldp
Oct 11 20:34:17.827267 sonic INFO telemetry#/supervisord: dialout I1011 20:34:17.826869      48 pfm_app.go:42] Init called for Platform module
Oct 11 20:34:17.827267 sonic INFO telemetry#/supervisord: dialout I1011 20:34:17.826874      48 app_interface.go:99] Registering for path =/openconfig-platform:components
Oct 11 20:34:17.886363 sonic INFO telemetry#/supervisord: dialout I1011 20:34:17.885943      48 sys_app.go:45] SysApp: Init called for System module
Oct 11 20:34:17.886363 sonic INFO telemetry#/supervisord: dialout I1011 20:34:17.885967      48 app_interface.go:99] Registering for path =/openconfig-system:system
Oct 11 20:34:17.886523 sonic INFO telemetry#/supervisord: dialout I1011 20:34:17.886120      48 version.go:144] *** Yang bundle version = 1.0.0
Oct 11 20:34:17.886570 sonic INFO telemetry#/supervisord: dialout I1011 20:34:17.886141      48 version.go:145] *** Yang base version   = 1.0.0
Oct 11 20:34:17.886935 sonic INFO telemetry#/supervisord: dialout I1011 20:34:17.886149      48 app_interface.go:99] Registering for path =/ietf-yang-library:modules-state
Oct 11 20:34:17.887173 sonic INFO telemetry#/supervisord: dialout I1011 20:34:17.886936      48 dialout_client_cli.go:43] Starting telemetry publish client
Oct 11 20:34:17.887885 sonic INFO telemetry#/supervisord: dialout I1011 20:34:17.887701      48 dialout_client.go:684] Psubscribe succeeded: psubscribe: __keyspace@4__:TELEMETRY_CLIENT|*
root@sonic:/# ps -eaf
UID          PID    PPID  C STIME TTY          TIME CMD
root           1       0  0 20:34 pts/0    00:00:00 /usr/bin/python3 /usr/local/bin/supervisord
root           9       1  0 20:34 pts/0    00:00:00 python3 /usr/bin/supervisor-proc-exit-listener --container-name telemetry
root          12       1  0 20:34 pts/0    00:00:00 /usr/sbin/rsyslogd -n -iNONE
root          18       1  1 20:34 pts/0    00:00:00 /usr/sbin/telemetry -logtostderr --noTLS --port 8080 --allow_no_client_auth -v=2
root          48       1  1 20:34 pts/0    00:00:00 /usr/sbin/dialout_client_cli -insecure -logtostderr -v 2
root          62       0  0 20:35 pts/1    00:00:00 /bin/bash
root          67      62  0 20:35 pts/1    00:00:00 ps -eaf

Next, an attempt to issue a gnmi set request to update mtu value failed with the same error - libyang[0]: Failed to find "autoneg" as a sibling to "sonic-port:ifname".

root@sonic:~# cat mtu.json
{"mtu": 9108}

root@sonic:~# gnmi_set -alsologtostderr -insecure -notls -target_addr 127.0.0.1:8080 -target_name sonic -update /openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu:@./mtu.json -xpath_target OC-YANG   
/openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu
@./mtu.json
== setRequest:
prefix: <
  target: "OC-YANG"
>
update: <
  path: <
    elem: <
      name: "openconfig-interfaces:interfaces"
    >
    elem: <
      name: "interface"
      key: <
        key: "name"
        value: "Ethernet11"
      >
    >
    elem: <
      name: "config"
    >
    elem: <
      name: "mtu"
    >
  >
  val: <
    json_ietf_val: "{\"mtu\": 9108}"
  >
>

F1011 20:40:52.009319      70 gnmi_set.go:190] Set failed: rpc error: code = Unknown desc = Translib Redis Error: CVL Failure: 1,001: { 1,001  []    with keys[] has field  with invalid value  Invalid value }

===============================
Oct 11 20:40:52.000032 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:51.999526      18 server.go:383] Update path: path:{elem:{name:"openconfig-interfaces:interfaces"}  elem:{name:"interface"  key:{key:"name"  value:"Ethernet11"}}  elem:{name:"config"}  elem:{name:"mtu"}}  val:{json_ietf_val:"{\"mtu\": 9108}"} 
Oct 11 20:40:52.000032 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:51.999713      18 transl_utils.go:212] Incoming JSON body is{"mtu": 9108}
Oct 11 20:40:52.000032 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:51.999738      18 translib.go:269] Update request received with path =/openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu
Oct 11 20:40:52.000200 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:51.999752      18 translib.go:270] Update request received with payload ={"mtu": 9108}
Oct 11 20:40:52.000200 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:51.999764      18 app_interface.go:129] getAppModule called for path =/openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu
Oct 11 20:40:52.000200 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:51.999777      18 app_interface.go:136] found the entry in the map for path =/openconfig-interfaces:interfaces
Oct 11 20:40:52.000200 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:51.999796      18 app_interface.go:164] cast to appInterface worked&{<nil> [] <nil> <nil> <nil> [] <nil> <nil> map[] map[] {0 {map[]}} map[] <nil> <nil> <nil> <nil> <nil> <nil>}
Oct 11 20:40:52.000428 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:52.000174      18 request_binder.go:338] requestBinder: modified path is: elem:{name:"interfaces"}  elem:{name:"interface"  key:{key:"name"  value:"Ethernet11"}}  elem:{name:"config"}
Oct 11 20:40:52.000779 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:52.000578      18 intf_app.go:111] initialize:if:path =/openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu
Oct 11 20:40:52.000882 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:52.000695      18 db.go:394] NewDB: Init indication not requested
Oct 11 20:40:52.000901 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:52.000708      18 intf_app.go:148] translateUpdate:intf:path =&{/openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu /openconfig-interfaces:interfaces/interface{}/config/mtu map[name:Ethernet11]}
Oct 11 20:40:52.001037 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:52.000757      18 intf_app.go:1077] Received UPDATE for path /openconfig-interfaces:interfaces/interface{}/config/mtu; vars=map[name:Ethernet11]
Oct 11 20:40:52.008180 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:52.007948      18 intf_app.go:516] Found 112 INTF table keys
Oct 11 20:40:52.008341 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:52.007996      18 intf_app.go:1084] uripath:=/openconfig-interfaces:interfaces/interface/config/mtu
Oct 11 20:40:52.008341 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:52.008004      18 intf_app.go:1085] err:=<nil>
Oct 11 20:40:52.008341 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:52.008011      18 intf_app.go:1088] len:=1
Oct 11 20:40:52.008412 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:52.008019      18 intf_app.go:1090] Name:=Ethernet11
Oct 11 20:40:52.008412 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:52.008108      18 intf_app.go:1107] mtu:= 9108
Oct 11 20:40:52.008412 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:52.008120      18 intf_app.go:1117] Writing to db for Ethernet11
Oct 11 20:40:52.008445 sonic INFO telemetry#/supervisord: telemetry W1011 20:40:52.008137      18 db.go:1299] performWatch: Empty WatchKeys. Skipping WATCH
Oct 11 20:40:52.008445 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:52.008143      18 intf_app.go:298] Calling processCommon()
Oct 11 20:40:52.008491 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:52.008149      18 intf_app.go:1274] processCommon:intf:path =&{/openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu /openconfig-interfaces:interfaces/interface{}/config/mtu map[name:Ethernet11]}
Oct 11 20:40:52.008491 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:52.008165      18 intf_app.go:1275] ProcessCommon: Target Type is uint16
Oct 11 20:40:52.008515 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:52.008171      18 intf_app.go:1279] Updating entry for Ethernet11
Oct 11 20:40:52.008725 sonic INFO telemetry#/supervisord: telemetry libyang[0]: Failed to find "autoneg" as a sibling to "sonic-port:ifname".
Oct 11 20:40:52.008725 sonic INFO telemetry#/supervisord: telemetry E1011 20:40:52.008415      18 util.go:176] Failed to create leaf nodes, data = [0xc00054f4e0 0xc00054f520 0xc00054f560 0xc00054f5a0 0xc00054f5c0 0xc00054f5e0 0xc00054f600 0xc00054f620 0xc00054f640]
Oct 11 20:40:52.008725 sonic INFO telemetry#/supervisord: telemetry W1011 20:40:52.008431      18 db.go:650] doCVL: CVL Failure: 1001
Oct 11 20:40:52.008725 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:52.008446      18 db.go:654] doCVL: 1 1
Oct 11 20:40:52.008725 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:52.008456      18 db.go:1478] AbortTx: No SET|DEL done, txState: txStateWatch
Oct 11 20:40:52.008955 sonic INFO telemetry#/supervisord: telemetry I1011 20:40:52.008627      18 transl_utils.go:235] UPDATE operation failed with error =1, Translib Redis Error: CVL Failure: 1,001: { 1,001  []    with keys[] has field  with invalid value  Invalid value }

Just as an experiment, I removed "autoneg" attribute for Ethernet11 from the config_sb.json file, reloaded the config, and attempted to issue the gnmi set request again. The set request failed with the error - libyang[0]: Failed to find "fec" as a sibling to "sonic-port:ifname"

admin@sonic:~$ show interface status Ethernet11
  Interface    Lanes    Speed    MTU    FEC       Alias    Vlan    Oper    Admin    Type    Asym PFC
-----------  -------  -------  -----  -----  ----------  ------  ------  -------  ------  ----------
 Ethernet11       10      25G   9100     rs  Ethernet11  routed    down       up     N/A         N/A
 
root@sonic:~# gnmi_set -alsologtostderr -insecure -notls -target_addr 127.0.0.1:8080 -target_name sonic -update /openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu:@./mtu.json -xpath_target OC-YANG
/openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu
@./mtu.json
== setRequest:
prefix: <
  target: "OC-YANG"
>
update: <
  path: <
    elem: <
      name: "openconfig-interfaces:interfaces"
    >
    elem: <
      name: "interface"
      key: <
        key: "name"
        value: "Ethernet11"
      >
    >
    elem: <
      name: "config"
    >
    elem: <
      name: "mtu"
    >
  >
  val: <
    json_ietf_val: "{\"mtu\": 9108}"
  >
>

F1011 20:49:37.605226      67 gnmi_set.go:190] Set failed: rpc error: code = Unknown desc = Translib Redis Error: CVL Failure: 1,001: { 1,001  []    with keys[] has field  with invalid value  Invalid value }

================================
Oct 11 20:49:37.592969 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.592344      18 server.go:383] Update path: path:{elem:{name:"openconfig-interfaces:interfaces"}  elem:{name:"interface"  key:{key:"name"  value:"Ethernet11"}}  elem:{name:"config"}  elem:{name:"mtu"}}  val:{json_ietf_val:"{\"mtu\": 9108}"} 
Oct 11 20:49:37.593114 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.592454      18 transl_utils.go:212] Incoming JSON body is{"mtu": 9108}
Oct 11 20:49:37.593114 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.592466      18 translib.go:269] Update request received with path =/openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu
Oct 11 20:49:37.593114 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.592471      18 translib.go:270] Update request received with payload ={"mtu": 9108}
Oct 11 20:49:37.593161 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.592478      18 app_interface.go:129] getAppModule called for path =/openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu
Oct 11 20:49:37.593161 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.592484      18 app_interface.go:136] found the entry in the map for path =/openconfig-interfaces:interfaces
Oct 11 20:49:37.593186 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.592495      18 app_interface.go:164] cast to appInterface worked&{<nil> [] <nil> <nil> <nil> [] <nil> <nil> map[] map[] {0 {map[]}} map[] <nil> <nil> <nil> <nil> <nil> <nil>}
Oct 11 20:49:37.593461 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.592693      18 request_binder.go:338] requestBinder: modified path is: elem:{name:"interfaces"}  elem:{name:"interface"  key:{key:"name"  value:"Ethernet11"}}  elem:{name:"config"}
Oct 11 20:49:37.593461 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.592890      18 intf_app.go:111] initialize:if:path =/openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu
Oct 11 20:49:37.593532 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.592939      18 db.go:394] NewDB: Init indication not requested
Oct 11 20:49:37.593532 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.592948      18 intf_app.go:148] translateUpdate:intf:path =&{/openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu /openconfig-interfaces:interfaces/interface{}/config/mtu map[name:Ethernet11]}
Oct 11 20:49:37.593532 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.592968      18 intf_app.go:1077] Received UPDATE for path /openconfig-interfaces:interfaces/interface{}/config/mtu; vars=map[name:Ethernet11]
Oct 11 20:49:37.603400 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.603038      18 intf_app.go:516] Found 112 INTF table keys
Oct 11 20:49:37.603400 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.603104      18 intf_app.go:1084] uripath:=/openconfig-interfaces:interfaces/interface/config/mtu
Oct 11 20:49:37.603768 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.603115      18 intf_app.go:1085] err:=<nil>
Oct 11 20:49:37.603810 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.603125      18 intf_app.go:1088] len:=1
Oct 11 20:49:37.603829 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.603135      18 intf_app.go:1090] Name:=Ethernet11
Oct 11 20:49:37.603850 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.603288      18 intf_app.go:1107] mtu:= 9108
Oct 11 20:49:37.603926 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.603304      18 intf_app.go:1117] Writing to db for Ethernet11
Oct 11 20:49:37.603926 sonic INFO telemetry#/supervisord: telemetry W1011 20:49:37.603328      18 db.go:1299] performWatch: Empty WatchKeys. Skipping WATCH
Oct 11 20:49:37.603926 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.603336      18 intf_app.go:298] Calling processCommon()
Oct 11 20:49:37.603926 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.603346      18 intf_app.go:1274] processCommon:intf:path =&{/openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu /openconfig-interfaces:interfaces/interface{}/config/mtu map[name:Ethernet11]}
Oct 11 20:49:37.603926 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.603368      18 intf_app.go:1275] ProcessCommon: Target Type is uint16
Oct 11 20:49:37.603972 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.603381      18 intf_app.go:1279] Updating entry for Ethernet11
Oct 11 20:49:37.604244 sonic INFO telemetry#/supervisord: telemetry libyang[0]: Failed to find "fec" as a sibling to "sonic-port:ifname".
Oct 11 20:49:37.604244 sonic INFO telemetry#/supervisord: telemetry E1011 20:49:37.603751      18 util.go:176] Failed to create leaf nodes, data = [0xc0004974e0 0xc000497500 0xc000497520 0xc000497580 0xc0004975c0 0xc0004975e0 0xc000497600 0xc000497640]
Oct 11 20:49:37.604270 sonic INFO telemetry#/supervisord: telemetry W1011 20:49:37.603772      18 db.go:650] doCVL: CVL Failure: 1001
Oct 11 20:49:37.604287 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.603790      18 db.go:654] doCVL: 1 1
Oct 11 20:49:37.604287 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.603811      18 db.go:1478] AbortTx: No SET|DEL done, txState: txStateWatch
Oct 11 20:49:37.604711 sonic INFO telemetry#/supervisord: telemetry I1011 20:49:37.604045      18 transl_utils.go:235] UPDATE operation failed with error =1, Translib Redis Error: CVL Failure: 1,001: { 1,001  []    with keys[] has field  with invalid value  Invalid value }

Then I removed, "fec" parameter for Ethernet11, reloaded the config, and issue the set request again. This time the set request succeeded.

admin@sonic:~$ show interface status Ethernet11
  Interface    Lanes    Speed    MTU    FEC       Alias    Vlan    Oper    Admin    Type    Asym PFC
-----------  -------  -------  -----  -----  ----------  ------  ------  -------  ------  ----------
 Ethernet11       10      25G   9100    N/A  Ethernet11  routed    down       up     N/A         N/A

root@sonic:~# gnmi_set -alsologtostderr -insecure -notls -target_addr 127.0.0.1:8080 -target_name sonic -update /openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu:@./mtu.json -xpath_target OC-YANG
/openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu
@./mtu.json
== setRequest:
prefix: <
  target: "OC-YANG"
>
update: <
  path: <
    elem: <
      name: "openconfig-interfaces:interfaces"
    >
    elem: <
      name: "interface"
      key: <
        key: "name"
        value: "Ethernet11"
      >
    >
    elem: <
      name: "config"
    >
    elem: <
      name: "mtu"
    >
  >
  val: <
    json_ietf_val: "{\"mtu\": 9108}"
  >
>

== setResponse:
prefix: <
  target: "OC-YANG"
>
response: <
  path: <
    elem: <
      name: "openconfig-interfaces:interfaces"
    >
    elem: <
      name: "interface"
      key: <
        key: "name"
        value: "Ethernet11"
      >
    >
    elem: <
      name: "config"
    >
    elem: <
      name: "mtu"
    >
  >
  op: UPDATE
>

admin@sonic:~$ show interface status Ethernet11
  Interface    Lanes    Speed    MTU    FEC       Alias    Vlan    Oper    Admin    Type    Asym PFC
-----------  -------  -------  -----  -----  ----------  ------  ------  -------  ------  ----------
 Ethernet11       10      25G   9108    N/A  Ethernet11  routed    down       up     N/A         N/A

================================

Oct 11 20:55:44.117293 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.113288      19 server.go:383] Update path: path:{elem:{name:"openconfig-interfaces:interfaces"}  elem:{name:"interface"  key:{key:"name"  value:"Ethernet11"}}  elem:{name:"config"}  elem:{name:"mtu"}}  val:{json_ietf_val:"{\"mtu\": 9108}"} 
Oct 11 20:55:44.117293 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.113448      19 transl_utils.go:212] Incoming JSON body is{"mtu": 9108}
Oct 11 20:55:44.117293 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.113464      19 translib.go:269] Update request received with path =/openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu
Oct 11 20:55:44.117293 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.113472      19 translib.go:270] Update request received with payload ={"mtu": 9108}
Oct 11 20:55:44.117293 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.113481      19 app_interface.go:129] getAppModule called for path =/openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu
Oct 11 20:55:44.117293 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.113503      19 app_interface.go:136] found the entry in the map for path =/openconfig-interfaces:interfaces
Oct 11 20:55:44.117293 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.113518      19 app_interface.go:164] cast to appInterface worked&{<nil> [] <nil> <nil> <nil> [] <nil> <nil> map[] map[] {0 {map[]}} map[] <nil> <nil> <nil> <nil> <nil> <nil>}
Oct 11 20:55:44.117293 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.113843      19 request_binder.go:338] requestBinder: modified path is: elem:{name:"interfaces"}  elem:{name:"interface"  key:{key:"name"  value:"Ethernet11"}}  elem:{name:"config"}
Oct 11 20:55:44.117293 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.114163      19 intf_app.go:111] initialize:if:path =/openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu
Oct 11 20:55:44.117293 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.114233      19 db.go:394] NewDB: Init indication not requested
Oct 11 20:55:44.117293 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.114244      19 intf_app.go:148] translateUpdate:intf:path =&{/openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu /openconfig-interfaces:interfaces/interface{}/config/mtu map[name:Ethernet11]}
Oct 11 20:55:44.117293 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.114294      19 intf_app.go:1077] Received UPDATE for path /openconfig-interfaces:interfaces/interface{}/config/mtu; vars=map[name:Ethernet11]
Oct 11 20:55:44.122024 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.121791      19 intf_app.go:516] Found 112 INTF table keys
Oct 11 20:55:44.122024 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.121841      19 intf_app.go:1084] uripath:=/openconfig-interfaces:interfaces/interface/config/mtu
Oct 11 20:55:44.122024 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.121848      19 intf_app.go:1085] err:=<nil>
Oct 11 20:55:44.122209 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.121854      19 intf_app.go:1088] len:=1
Oct 11 20:55:44.122209 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.121861      19 intf_app.go:1090] Name:=Ethernet11
Oct 11 20:55:44.122209 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.121935      19 intf_app.go:1107] mtu:= 9108
Oct 11 20:55:44.122209 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.121945      19 intf_app.go:1117] Writing to db for Ethernet11
Oct 11 20:55:44.122209 sonic INFO telemetry#/supervisord: telemetry W1011 20:55:44.121964      19 db.go:1299] performWatch: Empty WatchKeys. Skipping WATCH
Oct 11 20:55:44.122235 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.121969      19 intf_app.go:298] Calling processCommon()
Oct 11 20:55:44.122235 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.121973      19 intf_app.go:1274] processCommon:intf:path =&{/openconfig-interfaces:interfaces/interface[name=Ethernet11]/config/mtu /openconfig-interfaces:interfaces/interface{}/config/mtu map[name:Ethernet11]}
Oct 11 20:55:44.122281 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.121993      19 intf_app.go:1275] ProcessCommon: Target Type is uint16
Oct 11 20:55:44.122281 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.121998      19 intf_app.go:1279] Updating entry for Ethernet11
Oct 11 20:55:44.122793 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.122644      19 db.go:686] doWrite: Change to txStateSet, txState: txStateWatch
Oct 11 20:55:44.122793 sonic INFO telemetry#/supervisord: telemetry I1011 20:55:44.122675      19 db.go:750] doWrite: op: 1  PORT|Ethernet11 : 

Any advice on how to further debug or fix this issue would be really helpful.

Thanks,
Prashanth

@piyeng
Copy link
Author

piyeng commented Jan 6, 2022

Hi,

Wondering if someone can confirm if this is an actual issue. Any feedback or suggestion to further troubleshoot or fix this issue would be helpful.

Thanks,
Prashanth

@ganglyu ganglyu transferred this issue from sonic-net/sonic-telemetry Aug 31, 2022
@vishwas-palc
Copy link

Hi @ganglyu i am also facing some issues withe set request as well the error is
I0705 07:16:15.245444 9953 db.go:901] setEntry: DoCVL for UPDATE
I0705 07:16:15.245530 9953 db.go:479] key2redis: Begin: PORT|Ethernet0
I0705 07:16:15.245549 9953 db.go:722] doCVL: calling ValidateEditConfig: [{3 2 PORT|Ethernet0 map[admin_status:up alias:fortyGigE0/0 index:0 lanes:25,26,27,28 mtu:9000 speed:40000]}]
I0705 07:16:15.245609 9953 util.go:313] [CVL] : ValidateEditConfig() called from () : [{3 2 PORT|Ethernet0 map[admin_status:up alias:fortyGigE0/0 index:0 lanes:25,26,27,28 mtu:9000 speed:40000]}]
W0705 07:16:15.245639 9953 util.go:303] [CVL] : Could not find any of key delimeter map[] in key 'PORT|Ethernet0'
W0705 07:16:15.245690 9953 util.go:303] [CVL] : ValidateEditConfig() failed: {TableName: ErrCode:1001 CVLErrDetails:Config Validation Syntax Error Keys:[] Value: Field: Msg:Invalid table or key for PORT|Ethernet0 ConstraintErrMsg: ErrAppTag:}
W0705 07:16:15.245719 9953 db.go:728] doCVL: CVL Failure: 1001
I0705 07:16:15.245737 9953 db.go:732] doCVL: 1 1
I0705 07:16:15.245900 9953 db.go:743] doCVL: End: e: Translib Redis Error: CVL Failure: 1,001: { 1,001 Config Validation Syntax Error [] Invalid table or key for PORT|Ethernet0 }
I0705 07:16:15.245950 9953 db.go:1540] AbortTx: Begin:
I0705 07:16:15.246093 9953 db.go:1552] AbortTx: No SET|DEL done, txState: txStateWatch
I0705 07:16:15.246218 9953 db.go:1588] AbortTx: End: e:
I0705 07:16:15.246628 9953 db.go:455] DeleteDB: Begin: d: { client: Redis<127.0.0.1:6379 db:4>, Opts: { DBNo: 4, InitIndicator: , TableNameSeparator: |, KeySeparator: | , DisableCVLCheck: false }, txState: txStateNone, tsCmds: [] }
I0705 07:16:15.246795 9953 transl_utils.go:238] UPDATE operation failed with error =1, Translib Redis Error: CVL Failure: 1,001: { 1,001 Config Validation Syntax Error [] Invalid table or key for PORT|Ethernet0 }

Logs for the server when i startup the server
I0705 07:18:35.068274 9962 util.go:301] [CVL] : Could not read platform schema location or no platform specific schema exists.
libyang[0]: Schema node not found. (path: /sonic-common)
W0705 07:18:35.069942 9962 util.go:303] [CVL] : Unable to get schema details for sonic-common.yin
I0705 07:18:35.234152 9962 xlate_utils.go:1029] [transformer.go:93]init.0 Yang model List: []
I0705 07:18:35.419279 9962 xspec.go:145] xspec init done ...
I0705 07:18:35.420087 9962 app_interface.go:101] Registering for path =/openconfig-acl:acl
I0705 07:18:35.420582 9962 app_interface.go:101] Registering for path =/sonic-
I0705 07:18:35.421069 9962 app_interface.go:101] Registering for path =*
W0705 07:18:35.421546 9962 common_app.go:73] Failure in fetching model capabilities data.
I0705 07:18:35.421835 9962 intf_app.go:105] Init called for INTF module
I0705 07:18:35.421863 9962 app_interface.go:101] Registering for path =/openconfig-interfaces:interfaces
I0705 07:18:35.421887 9962 lldp_app.go:62] Init called for LLDP modules module
I0705 07:18:35.421903 9962 app_interface.go:101] Registering for path =/openconfig-lldp:lldp
I0705 07:18:35.421920 9962 pfm_app.go:43] Init called for Platform module
I0705 07:18:35.421935 9962 app_interface.go:101] Registering for path =/openconfig-platform:components
I0705 07:18:35.421964 9962 sys_app.go:47] SysApp: Init called for System module
I0705 07:18:35.422187 9962 app_interface.go:101] Registering for path =/openconfig-system:system
I0705 07:18:35.422389 9962 version.go:144] *** Yang bundle version = 1.0.0
I0705 07:18:35.422697 9962 version.go:145] *** Yang base version = 1.0.0
I0705 07:18:35.422719 9962 app_interface.go:101] Registering for path =/ietf-yang-library:modules-state
I0705 07:18:35.425590 9962 telemetry.go:47] client_auth not provided, using defaults.
I0705 07:18:39.240630 9962 server.go:147] Created Server on localhost:8080, read-only: false

can you please give some guidance why might cause this

@vishwas-palc
Copy link

Hi @piyeng i am also facing issues with the set functionality you can see the above msg

@ganglyu
Copy link
Contributor

ganglyu commented Jul 5, 2023

@vishwas-palc
Translib is disabled by default, and its readiness status is unknown to me.

@vishwas-palc
Copy link

Hi @ganglyu thanks for the response by translib you mean READ_WRITE_MODE which is by default false which I changed to true so i can perform set operations can you please clear this doubt
Best Regards
Vishwas

@vishwas-palc
Copy link

vishwas-palc commented Jul 5, 2023

@ganglyu also can you please suggest whom shuld i connect with on this issue ?

@ganglyu
Copy link
Contributor

ganglyu commented Jul 5, 2023

@ganglyu also can you please suggest whom shuld i connect with on this issue ?

Please use git blame to check transl_utils/transl_utils.go

@vishwas-palc
Copy link

@ganglyu i got this after git blame and it shows nothing regarding translib
aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 1) package transl_utils
aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 2)
aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 3) import (
aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 4) "bytes"
aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 5) "encoding/json"
aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 6) "strings"
aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 7) "fmt"
aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 8) log "github.com/golang/glog"
aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 9) gnmipb "github.com/openconfig/gnmi/proto/gnmi"
fa8d498 (Sachin Holla 2020-06-14 06:33:38 +0530 10) "github.com/Azure/sonic-mgmt-common/translib"
4fcd5b6 (Eric Seifert 2021-02-04 11:57:53 -0800 11) "github.com/Azure/sonic-telemetry/common_utils"
4fcd5b6 (Eric Seifert 2021-02-04 11:57:53 -0800 12) "context"
4fcd5b6 (Eric Seifert 2021-02-04 11:57:53 -0800 13) "log/syslog"
4fcd5b6 (Eric Seifert 2021-02-04 11:57:53 -0800 14) "github.com/Azure/sonic-mgmt-common/translib/tlerr"
4fcd5b6 (Eric Seifert 2021-02-04 11:57:53 -0800 15)
4fcd5b6 (Eric Seifert 2021-02-04 11:57:53 -0800 16) )
4fcd5b6 (Eric Seifert 2021-02-04 11:57:53 -0800 17)
4fcd5b6 (Eric Seifert 2021-02-04 11:57:53 -0800 18) var (
4fcd5b6 (Eric Seifert 2021-02-04 11:57:53 -0800 19) Writer *syslog.Writer
aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 20) )
aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 21)
best regards
Vishwas

@ganglyu
Copy link
Contributor

ganglyu commented Jul 5, 2023

Please contact them, maybe they know something about translib

@vishwas-palc
Copy link

Hi @FengPan-Frank I need some guidance on the above issue can please clarify on this
?
Best regards
Vishwas

@FengPan-Frank
Copy link
Collaborator

@ganglyu i got this after git blame and it shows nothing regarding translib aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 1) package transl_utils aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 2) aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 3) import ( aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 4) "bytes" aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 5) "encoding/json" aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 6) "strings" aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 7) "fmt" aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 8) log "github.com/golang/glog" aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 9) gnmipb "github.com/openconfig/gnmi/proto/gnmi" fa8d498 (Sachin Holla 2020-06-14 06:33:38 +0530 10) "github.com/Azure/sonic-mgmt-common/translib" 4fcd5b6 (Eric Seifert 2021-02-04 11:57:53 -0800 11) "github.com/Azure/sonic-telemetry/common_utils" 4fcd5b6 (Eric Seifert 2021-02-04 11:57:53 -0800 12) "context" 4fcd5b6 (Eric Seifert 2021-02-04 11:57:53 -0800 13) "log/syslog" 4fcd5b6 (Eric Seifert 2021-02-04 11:57:53 -0800 14) "github.com/Azure/sonic-mgmt-common/translib/tlerr" 4fcd5b6 (Eric Seifert 2021-02-04 11:57:53 -0800 15) 4fcd5b6 (Eric Seifert 2021-02-04 11:57:53 -0800 16) ) 4fcd5b6 (Eric Seifert 2021-02-04 11:57:53 -0800 17) 4fcd5b6 (Eric Seifert 2021-02-04 11:57:53 -0800 18) var ( 4fcd5b6 (Eric Seifert 2021-02-04 11:57:53 -0800 19) Writer *syslog.Writer aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 20) ) aaa9188 (Prabhu Sreenivasan 2019-12-24 01:52:03 +0530 21) best regards Vishwas

fa8d498 (Sachin Holla 2020-06-14 06:33:38 +0530 10) "github.com/Azure/sonic-mgmt-common/translib"

I guess you might need to check with Sachin on this translib issue, @sachinholla could you pls help on this?

@sachinholla
Copy link
Contributor

@vishwas-palc, please share branch details and how you are you bringing up the telemetry server. By any chance are you running the telemetry program directly?

cc: @anand-kumar-subramanian

@vishwas-palc
Copy link

hi @sachinholla Thanls for the response i followed the instruction given in docs to create the docker and run telemetry in docker by doing make
Best Regards
Vishwas Sharma

@vishwas-palc
Copy link

vishwas-palc commented Jul 5, 2023

@sachinholla
the get and subscribe request are working fine only the set request is causing issues Also these are the commands i used

To run the docker after it is created in this am mounting my docker on the folder of redis which is running outside the docker
and src directory which will have both sonic-telemetry and sonic-mgmt directories are stored

sudo docker run -it -v /var/run/redis:/var/run/redis -v ~/src:/src --net=host --name telemetry-dev-env telemetry-dev

once inside the docker I followed the instruction given in the docs as follows

cd /src/sonic-mgmt-common && make
cd /src/sonic-telemetry && make all

before these commands i had comment out some functions with a patch as follows

diff --git a/cvl/internal/yparser/yparser.go b/cvl/internal/yparser/yparser.go
index 92343bc..6bb34f3 100644
--- a/cvl/internal/yparser/yparser.go
+++ b/cvl/internal/yparser/yparser.go
@@ -38,7 +38,6 @@ import (
#include <stdio.h>
#include <string.h>

-extern int lyd_check_mandatory_tree(struct lyd_node *root, struct ly_ctx *ctx, const struct lys_module **modules, int mod_count, int options);

struct lyd_node* lyd_parse_data_path(struct ly_ctx *ctx, const char *path, LYD_FORMAT format, int options) {
return lyd_parse_path(ctx, path, format, options);
@@ -51,16 +50,6 @@ struct lyd_node *lyd_parse_data_mem(struct ly_ctx *ctx, const char *data, LYD_FO

int lyd_data_validate(struct lyd_node **node, int options, struct ly_ctx *ctx)
{

  •   int ret = -1;
    
  •   //Check mandatory elements as it is skipped for LYD_OPT_EDIT
    
  •   ret = lyd_check_mandatory_tree(*node, ctx, NULL, 0, LYD_OPT_CONFIG | LYD_OPT_NOEXTDEPS);
    
  •   if (ret != 0)
    
  •   {
    
  •           return ret;
    
  •   }
    
  •   return lyd_validate(node, options, ctx);
    

}

The reason i used this patch due to incompatible with libyang version used in docker creation and was causing the make to fail

after the make was done i ran the telemetry binary in build/bin directory

./build/bin/telemetry --port 8080 -insecure --allow_no_client_auth --logtostderr -v 10

I did the get and subscribe request and where correctly handled but when I sent a set request i found that telemetry was in readonly mode so I enabled the READ_WRITE_ONLY flag and did set again and got this issue as response

I0705 07:16:15.246795 9953 transl_utils.go:238] UPDATE operation failed with error =1, Translib Redis Error: CVL Failure: 1,001: { 1,001 Config Validation Syntax Error [] Invalid table or key for PORT|Ethernet0 }

@vishwas-palc
Copy link

Hi @sachinholla any update on above I have provided the steps i followed to run the telemetery

@sachinholla
Copy link
Contributor

Hi @vishwas-palc,

Some of the cvl checks may fail if you disable lyd_check_mandatory_tree() call. How did you install the libyang in your development docker? Better to install the libyang 1.0.73 debs from the build artifacts. You can refer to the "install dependency" step in the pipeline.

Can you share the set request details you attempted? I think you also need to set the following environment variable before running the telemetry program:

export CVL_SCHEMA_PATH=/src/sonic-mgmt-common/build/cvl/schema

Also, are you using the master branch??

@vishwas-palc
Copy link

Hi @sachinholla
I did not install libyang saperately i installed the one mentioned in the docker file also i am using the master brach to build also i did set the environment variable in telemetry program
the set request i am using is
sudo ./gnmi_set -insecure -username admin -password sonicadmin -update /openconfig-interfaces:interfaces/interface[name=Ethernet0]/config/mtu:@./mtu.json -target_addr 172.26.1.74:8080 -xpath_target OC-YANG
/openconfig-interfaces:interfaces/interface[name=Ethernet0]/config/mtu
@./mtu.json
== setRequest:
prefix: <
target: "OC-YANG"

update: <
path: <
elem: <
name: "openconfig-interfaces:interfaces"

elem: <
  name: "interface"
  key: <
    key: "name"
    value: "Ethernet0"
elem: <
  name: "config"
elem: <
  name: "mtu"

val: <
json_ietf_val: "{"mtu": 9108}"

F0621 23:50:46.456628 8881 gnmi_set.go:190] Set failed: rpc error: code = Unknown desc = Translib Redis Error: CVL Failure: 1,001: { 1,001 Config Validation Syntax Error [] Invalid table or key for PORT|Ethernet0 }

@sachinholla
Copy link
Contributor

What was the CVL_SCHEMA_PATH environment variable value? The "Invalid table or key" error typically indicates that the cvl could not read the schema files. Can you share the full telemetry logs from the startup?

@vishwas-palc
Copy link

Hi @sachinholla i tried the schema file path you suggested now it is working it is able to handle the set request

sudo ./gnmi_set -insecure -username admin -password sonicadmin -update /openconfig-interfaces:interfaces/interface[name=Ethernet0]/config/mtu:@./mtu.json -target_addr 172.26.1.74:8080 -xpath_target OC-YANG
/openconfig-interfaces:interfaces/interface[name=Ethernet0]/config/mtu
@./mtu.json

i have one more doubt regarding this is that when i do get on this
./gnmi_get -xpath_target APPL_DB -xpath PORT_TABLE/Ethernet32/mtu -target_addr 172.27.1.113:8080 -alsologtostderr -insecure true the commands works fine

but if i do a set on the same path by using this command

sudo ./gnmi_set -insecure -username admin -password sonicadmin -xpath_target APPL_DB -update /PORT_TABLE/Ethernet32/mtu:@./mtu.json -target_addr 172.27.1.113:8080

i get this error

F0719 15:18:27.381105 15244 gnmi_set.go:190] Set failed: rpc error: code = Unknown desc = rpc error: code = InvalidArgument desc = no match found in *ocbinds.Device, for path element:"PORT_TABLE" element:"Ethernet32" element:"mtu" elem:{name:"PORT_TABLE"} elem:{name:"Ethernet32"} elem:{name:"mtu"}

can you please guide me why this command is not working for the same path at which get is working
Best Regards
Vishwas Sharma

@sachinholla
Copy link
Contributor

/PORT_TABLE/Ethernet32/mtu is not a openconfig yang or sonic yang path -- hence that error. Did you try the native write feature as described here). I think you do not have to send a path target, instead origin "sonic-db" should be used. Path will look something like /sonic-db:APPL_DB/PORT_TABLE/Ethernet32/mtu

@vishwas-palc
Copy link

hi @sachinholla i am facing issues with make for sonic telemetry

github.com/Azure/sonic-telemetry/sonic_data_client

sonic_data_client/transl_data_client.go:164:37: cannot use stringPaths (type []string) as type []translib.IsSubscribePath in field value
sonic_data_client/transl_data_client.go:372:23: v.Payload undefined (type *translib.SubscribeResponse has no field or method Payload)
Makefile:60: recipe for target 'sonic-telemetry' failed
when i did this step in the docker container
cd /src/sonic-telemetry && make all

@sachinholla
Copy link
Contributor

It looks like you are using latest sonic-mgmt-common but an old version of sonic-gnmi.
If you are on any old release branch, you need to checkout corresponding version of sonic-mgmt-common as well. You can find correct version from the submodule file (sonic-buildimage/src/sonic-mgmt-common)

@vishwas-palc
Copy link

vishwas-palc commented Oct 17, 2023

@sachinholla if I use the latest sonic-gnmi branch i am getting this
make -C swsscommon
make[1]: Entering directory '/src/sonic-gnmi/swsscommon'
cp -f /usr/share/swss/swsscommon.i .
cp: cannot stat '/usr/share/swss/swsscommon.i': No such file or directory
Makefile:17: recipe for target 'all' failed
make[1]: *** [all] Error 1
make[1]: Leaving directory '/src/sonic-gnmi/swsscommon'
Makefile:88: recipe for target 'swsscommon_wrap' failed
make: *** [swsscommon_wrap] Error 2

@sachinholla
Copy link
Contributor

@ganglyu, @zbud-msft -- can you help with this swsscommon error?

@vishwas-palc, if you really want to go ahead with the old code, you can try resetting sonic-mgmt-common to 29be3000d83d8435ce43ef95556fa7e2ecb99ddd or a previous commit. But there may be other failures.

@vishwas-palc
Copy link

@sachinholla actually I want to use the latest version

@vishwas-palc
Copy link

hi @ganglyu and @zbud-msft any update on the issue

@ganglyu
Copy link
Contributor

ganglyu commented Oct 18, 2023

hi @ganglyu and @zbud-msft any update on the issue

The latest sonic-gnmi branch has dependency on src/sonic-swss-common, please use latest sonic-swss-common.

@vishwas-palc
Copy link

@ganglyu so before doing the build for sonic-gnmi I should clone the sonic-swss-common build and sonic-mgmt-common
?

@vishwas-palc
Copy link

vishwas-palc commented Oct 18, 2023

@ganglyu I have the sonic-swiss-common in the same directory as the sonic gnmi but facing the same issue when i do build

@ganglyu
Copy link
Contributor

ganglyu commented Oct 18, 2023

@ganglyu I have the sonic-swiss-common in the same directory as the sonic gnmi but facing the same issue when i do build

https://github.com/sonic-net/sonic-gnmi/blob/master/azure-pipelines.yml#L135-L137

@vishwas-palc
Copy link

@ganglyu i am not able to find where can i find these files

@ganglyu
Copy link
Contributor

ganglyu commented Oct 18, 2023

please build sonic-swss-common to generate these files

@vishwas-palc
Copy link

@ganglyu i am facing issues building the swss common locally is there a older version of sonic gnmi that does not require swss common dependencies

@vishwas-palc
Copy link

hi @sachinholla i am able to build using older verion of mgmt and telemetryi am facing this issue
I1019 06:49:12.728682 79 util.go:301] [CVL] : 'unix_socket_path' is not a valid field in /var/run/redis/sonic-db/database_config.json !
I1019 06:49:12.744312 79 util.go:301] [CVL] : Could not read platform schema location or no platform specific schema exists.
libyang[0]: Schema node not found. (path: /sonic-common)
W1019 06:49:12.745778 79 util.go:303] [CVL] : Unable to get schema details for sonic-common.yin
panic: open /var/run/redis/sonic-db/database_config.json: no such file or directory

while running the telemetry server binary

@sachinholla
Copy link
Contributor

@vishwas-palc, I am not aware of these error messages. I need to check the code. What sonic-mgmt-common and sonic-gnmi commit ids are you using?
Also share the steps you followed to start the telemetry server. Are you directly trying to run from your development docker? If yes, give me the full command line you used and the environment variables.

@vishwas-palc
Copy link

/PORT_TABLE/Ethernet32/mtu is not a openconfig yang or sonic yang path -- hence that error. Did you try the native write feature as described here). I think you do not have to send a path target, instead origin "sonic-db" should be used. Path will look something like /sonic-db:APPL_DB/PORT_TABLE/Ethernet32/mtu

Hi @sachinholla i was trying to work with set request again and tried the path you suggested but got the same issue
./gnmi_set -insecure -username admin -password sonicadmin -update /sonic_db:APPL_DB/PORT_TABLE/Ethernet0/mtu:@./mtu.json -target_addr 127.0.0.1:8080
/sonic_db:APPL_DB/PORT_TABLE/Ethernet0/mtu
@./mtu.json
== setRequest:
prefix: <

update: <
path: <
elem: <
name: "sonic_db:APPL_DB"
>
elem: <
name: "PORT_TABLE"
>
elem: <
name: "Ethernet0"
>
elem: <
name: "mtu"
>

val: <
json_ietf_val: "{"mtu":9000}"

F1030 13:43:32.327202 11850 gnmi_set.go:190] Set failed: rpc error: code = Unknown desc = rpc error: code = InvalidArgument desc = no match found in *ocbinds.Device, for path element:"sonic_db:APPL_DB" element:"PORT_TABLE" element:"Ethernet0" element:"mtu" elem:{name:"APPL_DB"} elem:{name:"PORT_TABLE"} elem:{name:"Ethernet0"} elem:{name:"mtu"}

I went through the doc link you provided but there is no example given for set request

@vishwas-palc
Copy link

hi @sachinholla any update on above

@sachinholla
Copy link
Contributor

@vishwas-palc, I have not used the native write feature.. Please check with the HLD authors

@vishwas-palc
Copy link

Hi @sachinholla can you please tag any one of the HLD authors in this conversation I am not able to find there accounts

@sachinholla
Copy link
Contributor

hi @ganglyu, @zbud-msft, can you help Vishwas with correct sonic_db path syntax to be used in the gnmi_set command?

@vishwas-palc -- did you try "sonic-db" origin (i.e, "/sonic-db:APPL_DB/...")?? Even though the HLD mentions expected origin as "sonic_db", code seems to be expecting "sonic-db" (see here).

@ganglyu
Copy link
Contributor

ganglyu commented Nov 21, 2023

It should be sonic-db.

@vishwas-palc
Copy link

hi @sachinholla and @ganglyu this is the request I gave and its response
./gnmi_set -insecure -username admin -password sonicadmin -update /sonic_db:APPL_DB/PORT_TABLE/Ethernet0/mtu:@./mtu.json -target_addr 127.0.0.1:8080
/sonic_db:APPL_DB/PORT_TABLE/Ethernet0/mtu
@./mtu.json
== setRequest:
prefix: <

update: <
path: <
elem: <
name: "sonic_db:APPL_DB"

elem: <
name: "PORT_TABLE"

elem: <
name: "Ethernet0"

elem: <
name: "mtu"

val: <
json_ietf_val: "{"mtu":9000}"

F1030 13:43:32.327202 11850 gnmi_set.go:190] Set failed: rpc error: code = Unknown desc = rpc error: code = InvalidArgument desc = no match found in *ocbinds.Device, for path element:"sonic_db:APPL_DB" element:"PORT_TABLE" element:"Ethernet0" element:"mtu" elem:{name:"APPL_DB"} elem:{name:"PORT_TABLE"} elem:{name:"Ethernet0"} elem:{name:"mtu"}

@sachinholla
Copy link
Contributor

Hey @vishwas-palc, you are still using origin = "sonic_db". Try "sonic-db" instead.

@vishwas-palc
Copy link

vishwas-palc commented Dec 6, 2023

Hi @sachinholla and @ganglyu its the same error when i tried sonic-db
also can you please tell me when I use this path ./gnmi_set -insecure -username admin -password sonicadmin -update /openconfig-interfaces:interfaces/interface[name=Ethernet0]/config/mtu:@./mtu.json -target_addr 172.27.1.113:8080 -xpath_target OC-YANG where is it reflected in redis

@vishwas-palc
Copy link

hi @ganglyu i am using this request
./gnmi_set -insecure -username admin -password sonicadmin -update /sonic-port:sonic-port/PORT/PORT_LIST[ifname='Ethernet0']/mtu/:@./ipaddress.json -target_addr 127.0.0.1:8080 -xpath_target OC-YANG
/sonic-port:sonic-port/PORT/PORT_LIST[ifname=Ethernet0]/mtu/
@./ipaddress.json
== setRequest:
prefix: <
target: "OC-YANG"

update: <
path: <
elem: <
name: "sonic-port:sonic-port"
>
elem: <
name: "PORT"
>
elem: <
name: "PORT_LIST"
key: <
key: "ifname"
value: "Ethernet0"
>
>
elem: <
name: "mtu"
>

val: <
json_ietf_val: "{"mtu":9000}"

== setResponse:
prefix: <
target: "OC-YANG"

response: <
path: <
elem: <
name: "sonic-port:sonic-port"
>
elem: <
name: "PORT"
>
elem: <
name: "PORT_LIST"
key: <
key: "ifname"
value: "Ethernet0"
>
>
elem: <
name: "mtu"
>

op: UPDATE

according to this my request was succefull but in my redis db it is not refelected these are the server logs

I0110 09:53:39.446834 51 common_app.go:547] transformer.XlateToDb() returned result DB map - map[UPDATE:map[4:map[]]]
Default value DB Map - map[]
Aux DB Map - map[]
I0110 09:53:39.447262 51 xlate_utils.go:1035] [xlate.go:532]GetModuleNmFromPath received URI /sonic-port:sonic-port/PORT/PORT_LIST[ifname=Ethernet0]/mtu to extract module name from
I0110 09:53:39.447940 51 xlate_utils.go:1035] [xlate_utils.go:503]uriModuleNameGet module name = sonic-port
I0110 09:53:39.447961 51 common_app.go:582] Result Tables List[]
I0110 09:53:39.447982 51 db.go:1284] StartTx: Begin: w: [] tss: []
W0110 09:53:39.448018 51 db.go:1375] performWatch: Empty WatchKeys. Skipping WATCH
I0110 09:53:39.448035 51 db.go:1308] StartTx: End: e:
I0110 09:53:39.448051 51 common_app.go:376] processUpdate:path =/sonic-port:sonic-port/PORT/PORT_LIST[ifname=Ethernet0]/mtu
I0110 09:53:39.448066 51 common_app.go:609] Proceeding to perform DB operation
I0110 09:53:39.448152 51 utils.go:50] cvlSortDepTblList = []
I0110 09:53:39.448185 51 common_app.go:642] Returning from processCommon() - success
I0110 09:53:39.448213 51 db.go:1397] CommitTx: Begin:
I0110 09:53:39.448303 51 db.go:1410] CommitTx: No SET|DEL done, txState: txStateWatch
I0110 09:53:39.449950 51 db.go:1437] Before loop: Length of d.txCmds: 0
I0110 09:53:39.451804 51 db.go:504] ts2redisUpdated: Begin: *
I0110 09:53:39.454393 51 db.go:1541] CommitTx: End: e:
I0110 09:53:39.455021 51 db.go:455] DeleteDB: Begin: d: { client: Redis<127.0.0.1:6379 db:4>, Opts: { DBNo: 4, InitIndicator: , TableNameSeparator: |, KeySeparator: | , DisableCVLCheck: false }, txState: txStateNone, tsCmds: [] }

@ganglyu
Copy link
Contributor

ganglyu commented Jan 10, 2024

target OC-YANG is used for translib, but I'm not familiar with this translib.

@sachinholla
Copy link
Contributor

@kwangsuk - can you check this mtu update issue? Request did not translate into any db operation.

I0110 09:53:39.446834 51 common_app.go:547] transformer.XlateToDb() returned result DB map - map[UPDATE:map[4:map[]]]
...
I0110 09:53:39.448303 51 db.go:1410] CommitTx: No SET|DEL done, txState: txStateWatch

@Verma-Anukul
Copy link

@kwangsuk @sachinholla @ganglyu @vishwas-palc
Any update on this issue, even I am seeing similar issue

@kwangsuk
Copy link

kwangsuk commented Sep 5, 2024

@Verma-Anukul have you seen the same issue on 202405 release? It would be already resolved by a newer code merged in the last release.

@Verma-Anukul
Copy link

@kwangsuk
I have used previous releases, will check on 202405

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants