openconfig / gnmic

gNMIc is a gNMI CLI client and collector
https://gnmic.openconfig.net
Apache License 2.0
171 stars 55 forks source link

Error when "Combining multiple stream subscriptions in the same gRPC stream" #302

Closed amamory closed 9 months ago

amamory commented 9 months ago

I am trying to reproduce this example in the documentation https://gnmic.openconfig.net/user_guide/subscriptions/#combining-multiple-stream-subscriptions-in-the-same-grpc-stream Where it combines multiple types of stream subscriptions in the same gRPC stream:

This is the config file:

subscriptions: sub1: stream-subscriptions:

  • paths:
    • /configure/system/name stream-mode: on-change
  • paths:
    • /state/port/statistics stream-mode: sample sample-interval: 10s
      encoding: bytes

I am expecting to see two paths w different stream modes in the same request. But the message is not sent from the client side. It generates this error

$ gnmic -a localhost:50051 --insecure subscribe --debug --config ../multi-sub2.yml ... 2023/11/27 10:31:00.809277 /home/runner/work/gnmic/gnmic/app/gnmi_client_subscribe.go:79: [gnmic] failed to subscribe: missing path(s) in subscription 'sub1' ...

It seems that gnmic is not parsing the provided example. Maybe the documentation is out of date ? If that's the case, could you please provide a YML example that sends two paths w different stream modes ?

This is the gnmic version:

$ gnmic version version : 0.29.0 commit : 08d41dd date : 2023-02-21T09:10:29Z gitURL : https://github.com/openconfig/gnmic docs : https://gnmic.openconfig.net

amamory commented 9 months ago

The next example https://gnmic.openconfig.net/user_guide/subscriptions/#configure-multiple-subscriptions works fine. You see 3 Request msgs arriving at the server. But this case has multiple RPC requests, each one w its own mode.

I need a single RPC request with multiple paths and each path with different stream modes.

hellt commented 9 months ago

Hi Did you try to upgrade gnmic?

gnmic version upgrade

amamory commented 9 months ago

Upgrading worked 👍 Now the example in the doc is working. For instance, w this yml:

subscriptions:
  sub1:
    stream-subscriptions:
      - paths:
        - dummy:0
        stream-mode: sample
        sample-interval: 2s  
      - paths:
        - dummy:1
        stream-mode: sample
        sample-interval: 1s  
    encoding: json

And this is the request message received by the server.

Subscribe request msg:
{
 "subscribe": {
  "subscription": [
   {
    "path": {
     "elem": [
      {
       "name": "dummy:0"
      }
     ]
    },
    "mode": 2,
    "sample_interval": "2000000000"
   },
   {
    "path": {
     "elem": [
      {
       "name": "dummy:1"
      }
     ]
    },
    "mode": 2,
    "sample_interval": "1000000000"
   }
  ]
 }
}

This is the expected behavior. each path with its own stream config.

Thanks !